]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore: remove stale file
authorEvan You <yyx990803@gmail.com>
Sun, 2 Feb 2020 05:06:49 +0000 (00:06 -0500)
committerEvan You <yyx990803@gmail.com>
Sun, 2 Feb 2020 05:06:49 +0000 (00:06 -0500)
packages/compiler-ssr/src/codegen.ts [deleted file]

diff --git a/packages/compiler-ssr/src/codegen.ts b/packages/compiler-ssr/src/codegen.ts
deleted file mode 100644 (file)
index 27d599d..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-import {
-  CodegenResult,
-  RootNode,
-  generate as baseGenerate,
-  CodegenOptions,
-  NodeTypes,
-  locStub,
-  BlockStatement,
-  ElementTypes,
-  createCallExpression,
-  TemplateLiteral,
-  createTemplateLiteral,
-  CallExpression,
-  TemplateChildNode
-} from '@vue/compiler-dom'
-import { isString } from '@vue/shared'
-
-export function generate(
-  ast: RootNode,
-  options: CodegenOptions
-): CodegenResult {
-  // construct a SSR-specific codegen tree to pass to core codegen
-  const body: BlockStatement['body'] = []
-  let currentCall: CallExpression | null = null
-  let currentString: TemplateLiteral | null = null
-
-  function ensureCurrentString() {
-    if (!currentCall) {
-      currentCall = createCallExpression(`_push`)
-      body.push(currentCall)
-    }
-    if (!currentString) {
-      currentString = createTemplateLiteral([])
-      currentCall.arguments.push(currentString)
-    }
-    return currentString.elements
-  }
-
-  function pushStringPart(part: TemplateLiteral['elements'][0]) {
-    const bufferedElements = ensureCurrentString()
-    const lastItem = bufferedElements[bufferedElements.length - 1]
-    if (isString(part) && isString(lastItem)) {
-      bufferedElements[bufferedElements.length - 1] += part
-    } else {
-      bufferedElements.push(part)
-    }
-  }
-
-  function processChildren(children: TemplateChildNode[]) {
-    for (let i = 0; i < children.length; i++) {
-      const child = children[i]
-      if (child.type === NodeTypes.ELEMENT) {
-        if (child.tagType === ElementTypes.ELEMENT) {
-          const elementsToAdd = child.ssrCodegenNode!.elements
-          for (let j = 0; j < elementsToAdd.length; j++) {
-            pushStringPart(elementsToAdd[j])
-          }
-          if (child.children.length) {
-            processChildren(child.children)
-          }
-          // push closing tag
-          pushStringPart(`</${child.tag}>`)
-        } else if (child.tagType === ElementTypes.COMPONENT) {
-          // TODO
-        } else if (child.tagType === ElementTypes.SLOT) {
-          // TODO
-        }
-      } else if (child.type === NodeTypes.TEXT) {
-        // TODO
-      } else if (child.type === NodeTypes.IF) {
-        // TODO
-      } else if (child.type === NodeTypes.FOR) {
-        // TODO
-      }
-    }
-  }
-
-  const isFragment = ast.children.length > 1
-  if (isFragment) {
-    pushStringPart(`<!---->`)
-  }
-  processChildren(ast.children)
-  if (isFragment) {
-    pushStringPart(`<!---->`)
-  }
-
-  ast.codegenNode = {
-    type: NodeTypes.JS_BLOCK_STATEMENT,
-    loc: locStub,
-    body
-  }
-
-  return baseGenerate(ast, options)
-}