@vue/compiler-ssr 3.1.0 → 3.1.4

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.
@@ -363,7 +363,8 @@ function ssrProcessComponent(node, context) {
363
363
  return ssrProcessTransitionGroup(node, context);
364
364
  }
365
365
  else {
366
- // real fall-through (e.g. KeepAlive): just render its children.
366
+ // real fall-through: Transition / KeepAlive
367
+ // just render its children.
367
368
  processChildren(node.children, context);
368
369
  }
369
370
  }
@@ -396,25 +397,16 @@ function ssrProcessComponent(node, context) {
396
397
  const rawOptionsMap = new WeakMap();
397
398
  const [baseNodeTransforms, baseDirectiveTransforms] = compilerDom.getBaseTransformPreset(true);
398
399
  const vnodeNodeTransforms = [...baseNodeTransforms, ...compilerDom.DOMNodeTransforms];
399
- const vnodeDirectiveTransforms = {
400
- ...baseDirectiveTransforms,
401
- ...compilerDom.DOMDirectiveTransforms
402
- };
400
+ const vnodeDirectiveTransforms = Object.assign(Object.assign({}, baseDirectiveTransforms), compilerDom.DOMDirectiveTransforms);
403
401
  function createVNodeSlotBranch(props, children, parentContext) {
404
402
  // apply a sub-transform using vnode-based transforms.
405
403
  const rawOptions = rawOptionsMap.get(parentContext.root);
406
- const subOptions = {
407
- ...rawOptions,
404
+ const subOptions = Object.assign(Object.assign({}, rawOptions), {
408
405
  // overwrite with vnode-based transforms
409
406
  nodeTransforms: [
410
407
  ...vnodeNodeTransforms,
411
408
  ...(rawOptions.nodeTransforms || [])
412
- ],
413
- directiveTransforms: {
414
- ...vnodeDirectiveTransforms,
415
- ...(rawOptions.directiveTransforms || {})
416
- }
417
- };
409
+ ], directiveTransforms: Object.assign(Object.assign({}, vnodeDirectiveTransforms), (rawOptions.directiveTransforms || {})) });
418
410
  // wrap the children with a wrapper template for proper children treatment.
419
411
  const wrapperNode = {
420
412
  type: 1 /* ELEMENT */,
@@ -448,8 +440,8 @@ function subTransform(node, options, parentContext) {
448
440
  // like normal render functions
449
441
  childContext.ssr = false;
450
442
  // inherit parent scope analysis state
451
- childContext.scopes = { ...parentContext.scopes };
452
- childContext.identifiers = { ...parentContext.identifiers };
443
+ childContext.scopes = Object.assign({}, parentContext.scopes);
444
+ childContext.identifiers = Object.assign({}, parentContext.identifiers);
453
445
  childContext.imports = parentContext.imports;
454
446
  // traverse
455
447
  compilerDom.traverseNode(childRoot, childContext);
@@ -1003,6 +995,15 @@ const ssrInjectFallthroughAttrs = (node, context) => {
1003
995
  if (node.type === 0 /* ROOT */) {
1004
996
  context.identifiers._attrs = 1;
1005
997
  }
998
+ if (node.type === 1 /* ELEMENT */ &&
999
+ node.tagType === 1 /* COMPONENT */ &&
1000
+ (compilerDom.isBuiltInType(node.tag, 'Transition') ||
1001
+ compilerDom.isBuiltInType(node.tag, 'KeepAlive'))) {
1002
+ if (hasSingleChild(node)) {
1003
+ injectFallthroughAttrs(node.children[0]);
1004
+ }
1005
+ return;
1006
+ }
1006
1007
  const parent = context.parent;
1007
1008
  if (!parent || parent.type !== 0 /* ROOT */) {
1008
1009
  return;
@@ -1084,26 +1085,16 @@ function injectCssVars(node) {
1084
1085
  }
1085
1086
 
1086
1087
  function compile(template, options = {}) {
1087
- options = {
1088
- ...options,
1089
- // apply DOM-specific parsing options
1090
- ...compilerDom.parserOptions,
1091
- ssr: true,
1092
- scopeId: options.mode === 'function' ? null : options.scopeId,
1088
+ options = Object.assign(Object.assign(Object.assign({}, options), compilerDom.parserOptions), { ssr: true, scopeId: options.mode === 'function' ? null : options.scopeId,
1093
1089
  // always prefix since compiler-ssr doesn't have size concern
1094
- prefixIdentifiers: true,
1090
+ prefixIdentifiers: true,
1095
1091
  // disable optimizations that are unnecessary for ssr
1096
- cacheHandlers: false,
1097
- hoistStatic: false
1098
- };
1092
+ cacheHandlers: false, hoistStatic: false });
1099
1093
  const ast = compilerDom.baseParse(template, options);
1100
1094
  // Save raw options for AST. This is needed when performing sub-transforms
1101
1095
  // on slot vnode branches.
1102
1096
  rawOptionsMap.set(ast, options);
1103
- compilerDom.transform(ast, {
1104
- ...options,
1105
- hoistStatic: false,
1106
- nodeTransforms: [
1097
+ compilerDom.transform(ast, Object.assign(Object.assign({}, options), { hoistStatic: false, nodeTransforms: [
1107
1098
  ssrTransformIf,
1108
1099
  ssrTransformFor,
1109
1100
  compilerDom.trackVForSlotScopes,
@@ -1116,20 +1107,14 @@ function compile(template, options = {}) {
1116
1107
  compilerDom.trackSlotScopes,
1117
1108
  compilerDom.transformStyle,
1118
1109
  ...(options.nodeTransforms || []) // user transforms
1119
- ],
1120
- directiveTransforms: {
1110
+ ], directiveTransforms: Object.assign({
1121
1111
  // reusing core v-bind
1122
- bind: compilerDom.transformBind,
1112
+ bind: compilerDom.transformBind,
1123
1113
  // model and show has dedicated SSR handling
1124
- model: ssrTransformModel,
1125
- show: ssrTransformShow,
1114
+ model: ssrTransformModel, show: ssrTransformShow,
1126
1115
  // the following are ignored during SSR
1127
- on: compilerDom.noopDirectiveTransform,
1128
- cloak: compilerDom.noopDirectiveTransform,
1129
- once: compilerDom.noopDirectiveTransform,
1130
- ...(options.directiveTransforms || {}) // user transforms
1131
- }
1132
- });
1116
+ on: compilerDom.noopDirectiveTransform, cloak: compilerDom.noopDirectiveTransform, once: compilerDom.noopDirectiveTransform }, (options.directiveTransforms || {}) // user transforms
1117
+ ) }));
1133
1118
  // traverse the template AST and convert into SSR codegen AST
1134
1119
  // by replacing ast.codegenNode.
1135
1120
  ssrCodegenTransform(ast, options);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/compiler-ssr",
3
- "version": "3.1.0",
3
+ "version": "3.1.4",
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/vue-next/tree/master/packages/compiler-ssr#readme",
30
30
  "dependencies": {
31
- "@vue/shared": "3.1.0",
32
- "@vue/compiler-dom": "3.1.0"
31
+ "@vue/shared": "3.1.4",
32
+ "@vue/compiler-dom": "3.1.4"
33
33
  }
34
34
  }