@vue/compiler-ssr 3.2.44 → 3.2.46

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.
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var compilerDom = require('@vue/compiler-dom');
6
4
  var shared = require('@vue/shared');
7
5
 
@@ -166,16 +164,16 @@ function createSSRCompilerError(code, loc) {
166
164
  return compilerDom.createCompilerError(code, loc, SSRErrorMessages);
167
165
  }
168
166
  const SSRErrorMessages = {
169
- [61 /* SSRErrorCodes.X_SSR_UNSAFE_ATTR_NAME */]: `Unsafe attribute name for SSR.`,
170
- [62 /* SSRErrorCodes.X_SSR_NO_TELEPORT_TARGET */]: `Missing the 'to' prop on teleport element.`,
171
- [63 /* SSRErrorCodes.X_SSR_INVALID_AST_NODE */]: `Invalid AST node during SSR transform.`
167
+ [62 /* SSRErrorCodes.X_SSR_UNSAFE_ATTR_NAME */]: `Unsafe attribute name for SSR.`,
168
+ [63 /* SSRErrorCodes.X_SSR_NO_TELEPORT_TARGET */]: `Missing the 'to' prop on teleport element.`,
169
+ [64 /* SSRErrorCodes.X_SSR_INVALID_AST_NODE */]: `Invalid AST node during SSR transform.`
172
170
  };
173
171
 
174
172
  // Note: this is a 2nd-pass codegen transform.
175
173
  function ssrProcessTeleport(node, context) {
176
174
  const targetProp = compilerDom.findProp(node, 'to');
177
175
  if (!targetProp) {
178
- context.onError(createSSRCompilerError(62 /* SSRErrorCodes.X_SSR_NO_TELEPORT_TARGET */, node.loc));
176
+ context.onError(createSSRCompilerError(63 /* SSRErrorCodes.X_SSR_NO_TELEPORT_TARGET */, node.loc));
179
177
  return;
180
178
  }
181
179
  let target;
@@ -187,7 +185,7 @@ function ssrProcessTeleport(node, context) {
187
185
  target = targetProp.exp;
188
186
  }
189
187
  if (!target) {
190
- context.onError(createSSRCompilerError(62 /* SSRErrorCodes.X_SSR_NO_TELEPORT_TARGET */, targetProp.loc));
188
+ context.onError(createSSRCompilerError(63 /* SSRErrorCodes.X_SSR_NO_TELEPORT_TARGET */, targetProp.loc));
191
189
  return;
192
190
  }
193
191
  const disabledProp = compilerDom.findProp(node, 'disabled', false, true /* allow empty */);
@@ -210,7 +208,7 @@ function ssrProcessTeleport(node, context) {
210
208
  ]));
211
209
  }
212
210
 
213
- const wipMap = new WeakMap();
211
+ const wipMap$2 = new WeakMap();
214
212
  // phase 1
215
213
  function ssrTransformSuspense(node, context) {
216
214
  return () => {
@@ -219,7 +217,7 @@ function ssrTransformSuspense(node, context) {
219
217
  slotsExp: null,
220
218
  wipSlots: []
221
219
  };
222
- wipMap.set(node, wipEntry);
220
+ wipMap$2.set(node, wipEntry);
223
221
  wipEntry.slotsExp = compilerDom.buildSlots(node, context, (_props, children, loc) => {
224
222
  const fn = compilerDom.createFunctionExpression([], undefined, // no return, assign body later
225
223
  true, // newline
@@ -237,7 +235,7 @@ function ssrTransformSuspense(node, context) {
237
235
  // phase 2
238
236
  function ssrProcessSuspense(node, context) {
239
237
  // complete wip slots with ssr code
240
- const wipEntry = wipMap.get(node);
238
+ const wipEntry = wipMap$2.get(node);
241
239
  if (!wipEntry) {
242
240
  return;
243
241
  }
@@ -396,7 +394,7 @@ const ssrTransformElement = (node, context) => {
396
394
  ]));
397
395
  }
398
396
  else {
399
- context.onError(createSSRCompilerError(61 /* SSRErrorCodes.X_SSR_UNSAFE_ATTR_NAME */, key.loc));
397
+ context.onError(createSSRCompilerError(62 /* SSRErrorCodes.X_SSR_UNSAFE_ATTR_NAME */, key.loc));
400
398
  }
401
399
  }
402
400
  }
@@ -593,7 +591,7 @@ function ssrProcessTransitionGroup(node, context) {
593
591
  // scope tracking, but the children of each slot cannot be processed until
594
592
  // the 2nd pass, so we store the WIP slot functions in a weakMap during the 1st
595
593
  // pass and complete them in the 2nd pass.
596
- const wipMap$2 = new WeakMap();
594
+ const wipMap = new WeakMap();
597
595
  const WIP_SLOT = Symbol();
598
596
  const componentTypeMap = new WeakMap();
599
597
  // ssr component transform is done in two phases:
@@ -647,7 +645,7 @@ const ssrTransformComponent = (node, context) => {
647
645
  }
648
646
  }
649
647
  const wipEntries = [];
650
- wipMap$2.set(node, wipEntries);
648
+ wipMap.set(node, wipEntries);
651
649
  const buildSSRSlotFn = (props, children, loc) => {
652
650
  const param0 = (props && compilerDom.stringifyExpression(props)) || `_`;
653
651
  const fn = compilerDom.createFunctionExpression([param0, `_push`, `_parent`, `_scopeId`], undefined, // no return, assign body later
@@ -716,7 +714,7 @@ function ssrProcessComponent(node, context, parent) {
716
714
  }
717
715
  else {
718
716
  // finish up slot function expressions from the 1st pass.
719
- const wipEntries = wipMap$2.get(node) || [];
717
+ const wipEntries = wipMap.get(node) || [];
720
718
  for (let i = 0; i < wipEntries.length; i++) {
721
719
  const { fn, vnodeBranch } = wipEntries[i];
722
720
  // For each slot, we generate two branches: one SSR-optimized branch and
@@ -852,8 +850,7 @@ function ssrCodegenTransform(ast, options) {
852
850
  const varsExp = compilerDom.processExpression(compilerDom.createSimpleExpression(options.ssrCssVars, false), cssContext);
853
851
  context.body.push(compilerDom.createCompoundExpression([`const _cssVars = { style: `, varsExp, `}`]));
854
852
  Array.from(cssContext.helpers.keys()).forEach(helper => {
855
- if (!ast.helpers.includes(helper))
856
- ast.helpers.push(helper);
853
+ ast.helpers.add(helper);
857
854
  });
858
855
  }
859
856
  const isFragment = ast.children.length > 1 && ast.children.some(c => !compilerDom.isText(c));
@@ -861,8 +858,11 @@ function ssrCodegenTransform(ast, options) {
861
858
  ast.codegenNode = compilerDom.createBlockStatement(context.body);
862
859
  // Finalize helpers.
863
860
  // We need to separate helpers imported from 'vue' vs. '@vue/server-renderer'
864
- ast.ssrHelpers = Array.from(new Set([...ast.helpers.filter(h => h in ssrHelpers), ...context.helpers]));
865
- ast.helpers = ast.helpers.filter(h => !(h in ssrHelpers));
861
+ ast.ssrHelpers = Array.from(new Set([
862
+ ...Array.from(ast.helpers).filter(h => h in ssrHelpers),
863
+ ...context.helpers
864
+ ]));
865
+ ast.helpers = new Set(Array.from(ast.helpers).filter(h => !(h in ssrHelpers)));
866
866
  }
867
867
  function createSSRTransformContext(root, options, helpers = new Set(), withSlotScopeId = false) {
868
868
  const body = [];
@@ -931,7 +931,7 @@ function processChildren(parent, context, asFragment = false, disableNestedFragm
931
931
  // TODO
932
932
  break;
933
933
  default:
934
- context.onError(createSSRCompilerError(63 /* SSRErrorCodes.X_SSR_INVALID_AST_NODE */, child.loc));
934
+ context.onError(createSSRCompilerError(64 /* SSRErrorCodes.X_SSR_INVALID_AST_NODE */, child.loc));
935
935
  // make sure we exhaust all possible types
936
936
  const exhaustiveCheck = child;
937
937
  return exhaustiveCheck;
@@ -963,7 +963,7 @@ function processChildren(parent, context, asFragment = false, disableNestedFragm
963
963
  // `transformText` is not used during SSR compile.
964
964
  break;
965
965
  default:
966
- context.onError(createSSRCompilerError(63 /* SSRErrorCodes.X_SSR_INVALID_AST_NODE */, child.loc));
966
+ context.onError(createSSRCompilerError(64 /* SSRErrorCodes.X_SSR_INVALID_AST_NODE */, child.loc));
967
967
  // make sure we exhaust all possible types
968
968
  const exhaustiveCheck = child;
969
969
  return exhaustiveCheck;
@@ -984,7 +984,7 @@ const ssrTransformModel = (dir, node, context) => {
984
984
  function checkDuplicatedValue() {
985
985
  const value = compilerDom.findProp(node, 'value');
986
986
  if (value) {
987
- context.onError(compilerDom.createDOMCompilerError(57 /* DOMErrorCodes.X_V_MODEL_UNNECESSARY_VALUE */, value.loc));
987
+ context.onError(compilerDom.createDOMCompilerError(58 /* DOMErrorCodes.X_V_MODEL_UNNECESSARY_VALUE */, value.loc));
988
988
  }
989
989
  }
990
990
  if (node.tagType === 0 /* ElementTypes.ELEMENT */) {
@@ -1041,7 +1041,7 @@ const ssrTransformModel = (dir, node, context) => {
1041
1041
  }
1042
1042
  break;
1043
1043
  case 'file':
1044
- context.onError(compilerDom.createDOMCompilerError(56 /* DOMErrorCodes.X_V_MODEL_ON_FILE_INPUT_ELEMENT */, dir.loc));
1044
+ context.onError(compilerDom.createDOMCompilerError(57 /* DOMErrorCodes.X_V_MODEL_ON_FILE_INPUT_ELEMENT */, dir.loc));
1045
1045
  break;
1046
1046
  default:
1047
1047
  checkDuplicatedValue();
@@ -1063,7 +1063,7 @@ const ssrTransformModel = (dir, node, context) => {
1063
1063
  }
1064
1064
  else if (node.tag === 'select') ;
1065
1065
  else {
1066
- context.onError(compilerDom.createDOMCompilerError(54 /* DOMErrorCodes.X_V_MODEL_ON_INVALID_ELEMENT */, dir.loc));
1066
+ context.onError(compilerDom.createDOMCompilerError(55 /* DOMErrorCodes.X_V_MODEL_ON_INVALID_ELEMENT */, dir.loc));
1067
1067
  }
1068
1068
  return res;
1069
1069
  }
@@ -1083,7 +1083,7 @@ function findValueBinding(node) {
1083
1083
 
1084
1084
  const ssrTransformShow = (dir, node, context) => {
1085
1085
  if (!dir.exp) {
1086
- context.onError(compilerDom.createDOMCompilerError(58 /* DOMErrorCodes.X_V_SHOW_NO_EXPRESSION */));
1086
+ context.onError(compilerDom.createDOMCompilerError(59 /* DOMErrorCodes.X_V_SHOW_NO_EXPRESSION */));
1087
1087
  }
1088
1088
  return {
1089
1089
  props: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/compiler-ssr",
3
- "version": "3.2.44",
3
+ "version": "3.2.46",
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.2.44",
32
- "@vue/compiler-dom": "3.2.44"
31
+ "@vue/shared": "3.2.46",
32
+ "@vue/compiler-dom": "3.2.46"
33
33
  }
34
34
  }