@vue/compiler-ssr 3.1.3 → 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.
- package/dist/compiler-ssr.cjs.js +14 -39
- package/package.json +3 -3
package/dist/compiler-ssr.cjs.js
CHANGED
|
@@ -397,25 +397,16 @@ function ssrProcessComponent(node, context) {
|
|
|
397
397
|
const rawOptionsMap = new WeakMap();
|
|
398
398
|
const [baseNodeTransforms, baseDirectiveTransforms] = compilerDom.getBaseTransformPreset(true);
|
|
399
399
|
const vnodeNodeTransforms = [...baseNodeTransforms, ...compilerDom.DOMNodeTransforms];
|
|
400
|
-
const vnodeDirectiveTransforms = {
|
|
401
|
-
...baseDirectiveTransforms,
|
|
402
|
-
...compilerDom.DOMDirectiveTransforms
|
|
403
|
-
};
|
|
400
|
+
const vnodeDirectiveTransforms = Object.assign(Object.assign({}, baseDirectiveTransforms), compilerDom.DOMDirectiveTransforms);
|
|
404
401
|
function createVNodeSlotBranch(props, children, parentContext) {
|
|
405
402
|
// apply a sub-transform using vnode-based transforms.
|
|
406
403
|
const rawOptions = rawOptionsMap.get(parentContext.root);
|
|
407
|
-
const subOptions = {
|
|
408
|
-
...rawOptions,
|
|
404
|
+
const subOptions = Object.assign(Object.assign({}, rawOptions), {
|
|
409
405
|
// overwrite with vnode-based transforms
|
|
410
406
|
nodeTransforms: [
|
|
411
407
|
...vnodeNodeTransforms,
|
|
412
408
|
...(rawOptions.nodeTransforms || [])
|
|
413
|
-
],
|
|
414
|
-
directiveTransforms: {
|
|
415
|
-
...vnodeDirectiveTransforms,
|
|
416
|
-
...(rawOptions.directiveTransforms || {})
|
|
417
|
-
}
|
|
418
|
-
};
|
|
409
|
+
], directiveTransforms: Object.assign(Object.assign({}, vnodeDirectiveTransforms), (rawOptions.directiveTransforms || {})) });
|
|
419
410
|
// wrap the children with a wrapper template for proper children treatment.
|
|
420
411
|
const wrapperNode = {
|
|
421
412
|
type: 1 /* ELEMENT */,
|
|
@@ -449,8 +440,8 @@ function subTransform(node, options, parentContext) {
|
|
|
449
440
|
// like normal render functions
|
|
450
441
|
childContext.ssr = false;
|
|
451
442
|
// inherit parent scope analysis state
|
|
452
|
-
childContext.scopes = {
|
|
453
|
-
childContext.identifiers = {
|
|
443
|
+
childContext.scopes = Object.assign({}, parentContext.scopes);
|
|
444
|
+
childContext.identifiers = Object.assign({}, parentContext.identifiers);
|
|
454
445
|
childContext.imports = parentContext.imports;
|
|
455
446
|
// traverse
|
|
456
447
|
compilerDom.traverseNode(childRoot, childContext);
|
|
@@ -1094,26 +1085,16 @@ function injectCssVars(node) {
|
|
|
1094
1085
|
}
|
|
1095
1086
|
|
|
1096
1087
|
function compile(template, options = {}) {
|
|
1097
|
-
options = {
|
|
1098
|
-
...options,
|
|
1099
|
-
// apply DOM-specific parsing options
|
|
1100
|
-
...compilerDom.parserOptions,
|
|
1101
|
-
ssr: true,
|
|
1102
|
-
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,
|
|
1103
1089
|
// always prefix since compiler-ssr doesn't have size concern
|
|
1104
|
-
prefixIdentifiers: true,
|
|
1090
|
+
prefixIdentifiers: true,
|
|
1105
1091
|
// disable optimizations that are unnecessary for ssr
|
|
1106
|
-
cacheHandlers: false,
|
|
1107
|
-
hoistStatic: false
|
|
1108
|
-
};
|
|
1092
|
+
cacheHandlers: false, hoistStatic: false });
|
|
1109
1093
|
const ast = compilerDom.baseParse(template, options);
|
|
1110
1094
|
// Save raw options for AST. This is needed when performing sub-transforms
|
|
1111
1095
|
// on slot vnode branches.
|
|
1112
1096
|
rawOptionsMap.set(ast, options);
|
|
1113
|
-
compilerDom.transform(ast, {
|
|
1114
|
-
...options,
|
|
1115
|
-
hoistStatic: false,
|
|
1116
|
-
nodeTransforms: [
|
|
1097
|
+
compilerDom.transform(ast, Object.assign(Object.assign({}, options), { hoistStatic: false, nodeTransforms: [
|
|
1117
1098
|
ssrTransformIf,
|
|
1118
1099
|
ssrTransformFor,
|
|
1119
1100
|
compilerDom.trackVForSlotScopes,
|
|
@@ -1126,20 +1107,14 @@ function compile(template, options = {}) {
|
|
|
1126
1107
|
compilerDom.trackSlotScopes,
|
|
1127
1108
|
compilerDom.transformStyle,
|
|
1128
1109
|
...(options.nodeTransforms || []) // user transforms
|
|
1129
|
-
],
|
|
1130
|
-
directiveTransforms: {
|
|
1110
|
+
], directiveTransforms: Object.assign({
|
|
1131
1111
|
// reusing core v-bind
|
|
1132
|
-
bind: compilerDom.transformBind,
|
|
1112
|
+
bind: compilerDom.transformBind,
|
|
1133
1113
|
// model and show has dedicated SSR handling
|
|
1134
|
-
model: ssrTransformModel,
|
|
1135
|
-
show: ssrTransformShow,
|
|
1114
|
+
model: ssrTransformModel, show: ssrTransformShow,
|
|
1136
1115
|
// the following are ignored during SSR
|
|
1137
|
-
on: compilerDom.noopDirectiveTransform,
|
|
1138
|
-
|
|
1139
|
-
once: compilerDom.noopDirectiveTransform,
|
|
1140
|
-
...(options.directiveTransforms || {}) // user transforms
|
|
1141
|
-
}
|
|
1142
|
-
});
|
|
1116
|
+
on: compilerDom.noopDirectiveTransform, cloak: compilerDom.noopDirectiveTransform, once: compilerDom.noopDirectiveTransform }, (options.directiveTransforms || {}) // user transforms
|
|
1117
|
+
) }));
|
|
1143
1118
|
// traverse the template AST and convert into SSR codegen AST
|
|
1144
1119
|
// by replacing ast.codegenNode.
|
|
1145
1120
|
ssrCodegenTransform(ast, options);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/compiler-ssr",
|
|
3
|
-
"version": "3.1.
|
|
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.
|
|
32
|
-
"@vue/compiler-dom": "3.1.
|
|
31
|
+
"@vue/shared": "3.1.4",
|
|
32
|
+
"@vue/compiler-dom": "3.1.4"
|
|
33
33
|
}
|
|
34
34
|
}
|