@vue/compiler-ssr 3.3.9 → 3.4.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -463,13 +463,14 @@ const ssrTransformElement = (node, context) => {
463
463
  }
464
464
  }
465
465
  } else {
466
- if (node.tag === "textarea" && prop.name === "value" && prop.value) {
466
+ const name = prop.name;
467
+ if (node.tag === "textarea" && name === "value" && prop.value) {
467
468
  rawChildrenMap.set(node, shared.escapeHtml(prop.value.content));
468
469
  } else if (!needMergeProps) {
469
- if (prop.name === "key" || prop.name === "ref") {
470
+ if (name === "key" || name === "ref") {
470
471
  continue;
471
472
  }
472
- if (prop.name === "class" && prop.value) {
473
+ if (name === "class" && prop.value) {
473
474
  staticClassBinding = JSON.stringify(prop.value.content);
474
475
  }
475
476
  openTag.push(
@@ -801,7 +802,7 @@ const vnodeDirectiveTransforms = {
801
802
  ...baseDirectiveTransforms,
802
803
  ...compilerDom.DOMDirectiveTransforms
803
804
  };
804
- function createVNodeSlotBranch(props, vForExp, children, parentContext) {
805
+ function createVNodeSlotBranch(slotProps, vFor, children, parentContext) {
805
806
  const rawOptions = rawOptionsMap.get(parentContext.root);
806
807
  const subOptions = {
807
808
  ...rawOptions,
@@ -815,32 +816,26 @@ function createVNodeSlotBranch(props, vForExp, children, parentContext) {
815
816
  ...rawOptions.directiveTransforms || {}
816
817
  }
817
818
  };
819
+ const wrapperProps = [];
820
+ if (slotProps) {
821
+ wrapperProps.push({
822
+ type: 7,
823
+ name: "slot",
824
+ exp: slotProps,
825
+ arg: void 0,
826
+ modifiers: [],
827
+ loc: compilerDom.locStub
828
+ });
829
+ }
830
+ if (vFor) {
831
+ wrapperProps.push(shared.extend({}, vFor));
832
+ }
818
833
  const wrapperNode = {
819
834
  type: 1,
820
835
  ns: 0,
821
836
  tag: "template",
822
837
  tagType: 3,
823
- isSelfClosing: false,
824
- // important: provide v-slot="props" and v-for="exp" on the wrapper for
825
- // proper scope analysis
826
- props: [
827
- {
828
- type: 7,
829
- name: "slot",
830
- exp: props,
831
- arg: void 0,
832
- modifiers: [],
833
- loc: compilerDom.locStub
834
- },
835
- {
836
- type: 7,
837
- name: "for",
838
- exp: vForExp,
839
- arg: void 0,
840
- modifiers: [],
841
- loc: compilerDom.locStub
842
- }
843
- ],
838
+ props: wrapperProps,
844
839
  children,
845
840
  loc: compilerDom.locStub,
846
841
  codegenNode: void 0
@@ -1214,7 +1209,7 @@ const ssrInjectFallthroughAttrs = (node, context) => {
1214
1209
  if (node.type === 0) {
1215
1210
  context.identifiers._attrs = 1;
1216
1211
  }
1217
- if (node.type === 1 && node.tagType === 1 && (compilerDom.isBuiltInType(node.tag, "Transition") || compilerDom.isBuiltInType(node.tag, "KeepAlive"))) {
1212
+ if (node.type === 1 && node.tagType === 1 && (node.tag === "transition" || node.tag === "Transition" || node.tag === "KeepAlive" || node.tag === "keep-alive")) {
1218
1213
  const rootChildren = filterChild(context.root);
1219
1214
  if (rootChildren.length === 1 && rootChildren[0] === node) {
1220
1215
  if (hasSingleChild(node)) {
@@ -1281,7 +1276,7 @@ const ssrInjectCssVars = (node, context) => {
1281
1276
  };
1282
1277
  function injectCssVars(node) {
1283
1278
  if (node.type === 1 && (node.tagType === 0 || node.tagType === 1) && !compilerDom.findDir(node, "for")) {
1284
- if (compilerDom.isBuiltInType(node.tag, "Suspense")) {
1279
+ if (node.tag === "suspense" || node.tag === "Suspense") {
1285
1280
  for (const child of node.children) {
1286
1281
  if (child.type === 1 && child.tagType === 3) {
1287
1282
  child.children.forEach(injectCssVars);
@@ -1302,10 +1297,9 @@ function injectCssVars(node) {
1302
1297
  }
1303
1298
  }
1304
1299
 
1305
- function compile(template, options = {}) {
1300
+ function compile(source, options = {}) {
1306
1301
  options = {
1307
1302
  ...options,
1308
- // apply DOM-specific parsing options
1309
1303
  ...compilerDom.parserOptions,
1310
1304
  ssr: true,
1311
1305
  inSSR: true,
@@ -1316,7 +1310,7 @@ function compile(template, options = {}) {
1316
1310
  cacheHandlers: false,
1317
1311
  hoistStatic: false
1318
1312
  };
1319
- const ast = compilerDom.baseParse(template, options);
1313
+ const ast = typeof source === "string" ? compilerDom.baseParse(source, options) : source;
1320
1314
  rawOptionsMap.set(ast, options);
1321
1315
  compilerDom.transform(ast, {
1322
1316
  ...options,
@@ -1,4 +1,4 @@
1
- import { CompilerOptions, CodegenResult } from '@vue/compiler-dom';
1
+ import { RootNode, CompilerOptions, CodegenResult } from '@vue/compiler-dom';
2
2
 
3
- export declare function compile(template: string, options?: CompilerOptions): CodegenResult;
3
+ export declare function compile(source: string | RootNode, options?: CompilerOptions): CodegenResult;
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/compiler-ssr",
3
- "version": "3.3.9",
3
+ "version": "3.4.0-alpha.2",
4
4
  "description": "@vue/compiler-ssr",
5
5
  "main": "dist/compiler-ssr.cjs.js",
6
6
  "types": "dist/compiler-ssr.d.ts",
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-ssr#readme",
30
30
  "dependencies": {
31
- "@vue/shared": "3.3.9",
32
- "@vue/compiler-dom": "3.3.9"
31
+ "@vue/shared": "3.4.0-alpha.2",
32
+ "@vue/compiler-dom": "3.4.0-alpha.2"
33
33
  }
34
34
  }