@vue/compiler-sfc 3.2.26 → 3.2.27

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.
@@ -208,7 +208,7 @@ export declare interface SFCScriptCompileOptions {
208
208
  */
209
209
  propsDestructureTransform?: boolean;
210
210
  /**
211
- * @deprecated use `refTransform` instead.
211
+ * @deprecated use `reactivityTransform` instead.
212
212
  */
213
213
  refSugar?: boolean;
214
214
  /**
@@ -33404,17 +33404,16 @@ function createSSRCompilerError(code, loc) {
33404
33404
  return createCompilerError(code, loc, SSRErrorMessages);
33405
33405
  }
33406
33406
  const SSRErrorMessages = {
33407
- [61 /* X_SSR_CUSTOM_DIRECTIVE_NO_TRANSFORM */]: `Custom directive is missing corresponding SSR transform and will be ignored.`,
33408
- [62 /* X_SSR_UNSAFE_ATTR_NAME */]: `Unsafe attribute name for SSR.`,
33409
- [63 /* X_SSR_NO_TELEPORT_TARGET */]: `Missing the 'to' prop on teleport element.`,
33410
- [64 /* X_SSR_INVALID_AST_NODE */]: `Invalid AST node during SSR transform.`
33407
+ [61 /* X_SSR_UNSAFE_ATTR_NAME */]: `Unsafe attribute name for SSR.`,
33408
+ [62 /* X_SSR_NO_TELEPORT_TARGET */]: `Missing the 'to' prop on teleport element.`,
33409
+ [63 /* X_SSR_INVALID_AST_NODE */]: `Invalid AST node during SSR transform.`
33411
33410
  };
33412
33411
 
33413
33412
  // Note: this is a 2nd-pass codegen transform.
33414
33413
  function ssrProcessTeleport(node, context) {
33415
33414
  const targetProp = findProp(node, 'to');
33416
33415
  if (!targetProp) {
33417
- context.onError(createSSRCompilerError(63 /* X_SSR_NO_TELEPORT_TARGET */, node.loc));
33416
+ context.onError(createSSRCompilerError(62 /* X_SSR_NO_TELEPORT_TARGET */, node.loc));
33418
33417
  return;
33419
33418
  }
33420
33419
  let target;
@@ -33426,7 +33425,7 @@ function ssrProcessTeleport(node, context) {
33426
33425
  target = targetProp.exp;
33427
33426
  }
33428
33427
  if (!target) {
33429
- context.onError(createSSRCompilerError(63 /* X_SSR_NO_TELEPORT_TARGET */, targetProp.loc));
33428
+ context.onError(createSSRCompilerError(62 /* X_SSR_NO_TELEPORT_TARGET */, targetProp.loc));
33430
33429
  return;
33431
33430
  }
33432
33431
  const disabledProp = findProp(node, 'disabled', false, true /* allow empty */);
@@ -33840,14 +33839,10 @@ const ssrTransformElement = (node, context) => {
33840
33839
  node.children = [createInterpolation(prop.exp, prop.loc)];
33841
33840
  }
33842
33841
  }
33843
- else {
33842
+ else if (!hasDynamicVBind) {
33844
33843
  // Directive transforms.
33845
33844
  const directiveTransform = context.directiveTransforms[prop.name];
33846
- if (!directiveTransform) {
33847
- // no corresponding ssr directive transform found.
33848
- context.onError(createSSRCompilerError(61 /* X_SSR_CUSTOM_DIRECTIVE_NO_TRANSFORM */, prop.loc));
33849
- }
33850
- else if (!hasDynamicVBind) {
33845
+ if (directiveTransform) {
33851
33846
  const { props, ssrTagParts } = directiveTransform(prop, node, context);
33852
33847
  if (ssrTagParts) {
33853
33848
  openTag.push(...ssrTagParts);
@@ -33887,7 +33882,7 @@ const ssrTransformElement = (node, context) => {
33887
33882
  ]));
33888
33883
  }
33889
33884
  else {
33890
- context.onError(createSSRCompilerError(62 /* X_SSR_UNSAFE_ATTR_NAME */, key.loc));
33885
+ context.onError(createSSRCompilerError(61 /* X_SSR_UNSAFE_ATTR_NAME */, key.loc));
33891
33886
  }
33892
33887
  }
33893
33888
  }
@@ -34082,7 +34077,7 @@ function processChildren(children, context, asFragment = false, disableNestedFra
34082
34077
  // TODO
34083
34078
  break;
34084
34079
  default:
34085
- context.onError(createSSRCompilerError(64 /* X_SSR_INVALID_AST_NODE */, child.loc));
34080
+ context.onError(createSSRCompilerError(63 /* X_SSR_INVALID_AST_NODE */, child.loc));
34086
34081
  // make sure we exhaust all possible types
34087
34082
  const exhaustiveCheck = child;
34088
34083
  return exhaustiveCheck;
@@ -34114,7 +34109,7 @@ function processChildren(children, context, asFragment = false, disableNestedFra
34114
34109
  // `transformText` is not used during SSR compile.
34115
34110
  break;
34116
34111
  default:
34117
- context.onError(createSSRCompilerError(64 /* X_SSR_INVALID_AST_NODE */, child.loc));
34112
+ context.onError(createSSRCompilerError(63 /* X_SSR_INVALID_AST_NODE */, child.loc));
34118
34113
  // make sure we exhaust all possible types
34119
34114
  const exhaustiveCheck = child;
34120
34115
  return exhaustiveCheck;
@@ -34757,33 +34752,7 @@ function transformAST(ast, s, offset = 0, knownRefs, knownProps) {
34757
34752
  function walkScope(node, isRoot = false) {
34758
34753
  for (const stmt of node.body) {
34759
34754
  if (stmt.type === 'VariableDeclaration') {
34760
- if (stmt.declare)
34761
- continue;
34762
- for (const decl of stmt.declarations) {
34763
- let refCall;
34764
- const isCall = decl.init &&
34765
- decl.init.type === 'CallExpression' &&
34766
- decl.init.callee.type === 'Identifier';
34767
- if (isCall &&
34768
- (refCall = isRefCreationCall(decl.init.callee.name))) {
34769
- processRefDeclaration(refCall, decl.id, decl.init);
34770
- }
34771
- else {
34772
- const isProps = isRoot &&
34773
- isCall &&
34774
- decl.init.callee.name === 'defineProps';
34775
- for (const id of extractIdentifiers(decl.id)) {
34776
- if (isProps) {
34777
- // for defineProps destructure, only exclude them since they
34778
- // are already passed in as knownProps
34779
- excludedIds.add(id);
34780
- }
34781
- else {
34782
- registerBinding(id);
34783
- }
34784
- }
34785
- }
34786
- }
34755
+ walkVariableDeclaration(stmt, isRoot);
34787
34756
  }
34788
34757
  else if (stmt.type === 'FunctionDeclaration' ||
34789
34758
  stmt.type === 'ClassDeclaration') {
@@ -34791,6 +34760,38 @@ function transformAST(ast, s, offset = 0, knownRefs, knownProps) {
34791
34760
  continue;
34792
34761
  registerBinding(stmt.id);
34793
34762
  }
34763
+ else if ((stmt.type === 'ForOfStatement' || stmt.type === 'ForInStatement') &&
34764
+ stmt.left.type === 'VariableDeclaration') {
34765
+ walkVariableDeclaration(stmt.left);
34766
+ }
34767
+ }
34768
+ }
34769
+ function walkVariableDeclaration(stmt, isRoot = false) {
34770
+ if (stmt.declare) {
34771
+ return;
34772
+ }
34773
+ for (const decl of stmt.declarations) {
34774
+ let refCall;
34775
+ const isCall = decl.init &&
34776
+ decl.init.type === 'CallExpression' &&
34777
+ decl.init.callee.type === 'Identifier';
34778
+ if (isCall &&
34779
+ (refCall = isRefCreationCall(decl.init.callee.name))) {
34780
+ processRefDeclaration(refCall, decl.id, decl.init);
34781
+ }
34782
+ else {
34783
+ const isProps = isRoot && isCall && decl.init.callee.name === 'defineProps';
34784
+ for (const id of extractIdentifiers(decl.id)) {
34785
+ if (isProps) {
34786
+ // for defineProps destructure, only exclude them since they
34787
+ // are already passed in as knownProps
34788
+ excludedIds.add(id);
34789
+ }
34790
+ else {
34791
+ registerBinding(id);
34792
+ }
34793
+ }
34794
+ }
34794
34795
  }
34795
34796
  }
34796
34797
  function processRefDeclaration(method, id, call) {
@@ -35120,7 +35121,7 @@ function warnOnce$1(msg) {
35120
35121
  }
35121
35122
  }
35122
35123
  function warn$1(msg) {
35123
- console.warn(`\x1b[1m\x1b[33m[@vue/ref-transform]\x1b[0m\x1b[33m ${msg}\x1b[0m\n`);
35124
+ console.warn(`\x1b[1m\x1b[33m[@vue/reactivity-transform]\x1b[0m\x1b[33m ${msg}\x1b[0m\n`);
35124
35125
  }
35125
35126
 
35126
35127
  // Special compiler macros
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/compiler-sfc",
3
- "version": "3.2.26",
3
+ "version": "3.2.27",
4
4
  "description": "@vue/compiler-sfc",
5
5
  "main": "dist/compiler-sfc.cjs.js",
6
6
  "module": "dist/compiler-sfc.esm-browser.js",
@@ -33,11 +33,11 @@
33
33
  "homepage": "https://github.com/vuejs/vue-next/tree/master/packages/compiler-sfc#readme",
34
34
  "dependencies": {
35
35
  "@babel/parser": "^7.16.4",
36
- "@vue/compiler-core": "3.2.26",
37
- "@vue/compiler-dom": "3.2.26",
38
- "@vue/compiler-ssr": "3.2.26",
39
- "@vue/reactivity-transform": "3.2.26",
40
- "@vue/shared": "3.2.26",
36
+ "@vue/compiler-core": "3.2.27",
37
+ "@vue/compiler-dom": "3.2.27",
38
+ "@vue/compiler-ssr": "3.2.27",
39
+ "@vue/reactivity-transform": "3.2.27",
40
+ "@vue/shared": "3.2.27",
41
41
  "estree-walker": "^2.0.2",
42
42
  "magic-string": "^0.25.7",
43
43
  "source-map": "^0.6.1",