@vue/compiler-core 3.3.7 → 3.3.9

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.
@@ -673,6 +673,7 @@ function getMemoedVNodeCall(node) {
673
673
  return node;
674
674
  }
675
675
  }
676
+ const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
676
677
 
677
678
  const deprecationData = {
678
679
  ["COMPILER_IS_ON_ELEMENT"]: {
@@ -2923,6 +2924,15 @@ function walkBlockDeclarations(block, onIdent) {
2923
2924
  if (stmt.declare || !stmt.id)
2924
2925
  continue;
2925
2926
  onIdent(stmt.id);
2927
+ } else if (stmt.type === "ForOfStatement" || stmt.type === "ForInStatement" || stmt.type === "ForStatement") {
2928
+ const variable = stmt.type === "ForStatement" ? stmt.init : stmt.left;
2929
+ if (variable && variable.type === "VariableDeclaration") {
2930
+ for (const decl of variable.declarations) {
2931
+ for (const id of extractIdentifiers(decl.id)) {
2932
+ onIdent(id);
2933
+ }
2934
+ }
2935
+ }
2926
2936
  }
2927
2937
  }
2928
2938
  }
@@ -3175,8 +3185,8 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
3175
3185
  const isScopeVarReference = context.identifiers[rawExp];
3176
3186
  const isAllowedGlobal = shared.isGloballyAllowed(rawExp);
3177
3187
  const isLiteral = isLiteralWhitelisted(rawExp);
3178
- if (!asParams && !isScopeVarReference && !isAllowedGlobal && !isLiteral) {
3179
- if (isConst(bindingMetadata[node.content])) {
3188
+ if (!asParams && !isScopeVarReference && !isLiteral && (!isAllowedGlobal || bindingMetadata[rawExp])) {
3189
+ if (isConst(bindingMetadata[rawExp])) {
3180
3190
  node.constType = 1;
3181
3191
  }
3182
3192
  node.content = rewriteIdentifier(rawExp);
@@ -3713,7 +3723,6 @@ function processFor(node, dir, context, processCodegen) {
3713
3723
  onExit();
3714
3724
  };
3715
3725
  }
3716
- const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
3717
3726
  const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
3718
3727
  const stripParensRE = /^\(|\)$/g;
3719
3728
  function parseForExpression(input, context) {
@@ -4395,7 +4404,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
4395
4404
  )
4396
4405
  );
4397
4406
  } else {
4398
- const { name, arg, exp, loc } = prop;
4407
+ const { name, arg, exp, loc, modifiers } = prop;
4399
4408
  const isVBind = name === "bind";
4400
4409
  const isVOn = name === "on";
4401
4410
  if (name === "slot") {
@@ -4488,6 +4497,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
4488
4497
  }
4489
4498
  continue;
4490
4499
  }
4500
+ if (isVBind && modifiers.includes("prop")) {
4501
+ patchFlag |= 32;
4502
+ }
4491
4503
  const directiveTransform = context.directiveTransforms[name];
4492
4504
  if (directiveTransform) {
4493
4505
  const { props: props2, needRuntime } = directiveTransform(prop, node, context);
@@ -5439,6 +5451,7 @@ exports.createVNodeCall = createVNodeCall;
5439
5451
  exports.extractIdentifiers = extractIdentifiers;
5440
5452
  exports.findDir = findDir;
5441
5453
  exports.findProp = findProp;
5454
+ exports.forAliasRE = forAliasRE;
5442
5455
  exports.generate = generate;
5443
5456
  exports.getBaseTransformPreset = getBaseTransformPreset;
5444
5457
  exports.getConstantType = getConstantType;
@@ -672,6 +672,7 @@ function getMemoedVNodeCall(node) {
672
672
  return node;
673
673
  }
674
674
  }
675
+ const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
675
676
 
676
677
  const deprecationData = {
677
678
  ["COMPILER_IS_ON_ELEMENT"]: {
@@ -2852,6 +2853,15 @@ function walkBlockDeclarations(block, onIdent) {
2852
2853
  if (stmt.declare || !stmt.id)
2853
2854
  continue;
2854
2855
  onIdent(stmt.id);
2856
+ } else if (stmt.type === "ForOfStatement" || stmt.type === "ForInStatement" || stmt.type === "ForStatement") {
2857
+ const variable = stmt.type === "ForStatement" ? stmt.init : stmt.left;
2858
+ if (variable && variable.type === "VariableDeclaration") {
2859
+ for (const decl of variable.declarations) {
2860
+ for (const id of extractIdentifiers(decl.id)) {
2861
+ onIdent(id);
2862
+ }
2863
+ }
2864
+ }
2855
2865
  }
2856
2866
  }
2857
2867
  }
@@ -3104,8 +3114,8 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
3104
3114
  const isScopeVarReference = context.identifiers[rawExp];
3105
3115
  const isAllowedGlobal = shared.isGloballyAllowed(rawExp);
3106
3116
  const isLiteral = isLiteralWhitelisted(rawExp);
3107
- if (!asParams && !isScopeVarReference && !isAllowedGlobal && !isLiteral) {
3108
- if (isConst(bindingMetadata[node.content])) {
3117
+ if (!asParams && !isScopeVarReference && !isLiteral && (!isAllowedGlobal || bindingMetadata[rawExp])) {
3118
+ if (isConst(bindingMetadata[rawExp])) {
3109
3119
  node.constType = 1;
3110
3120
  }
3111
3121
  node.content = rewriteIdentifier(rawExp);
@@ -3632,7 +3642,6 @@ function processFor(node, dir, context, processCodegen) {
3632
3642
  onExit();
3633
3643
  };
3634
3644
  }
3635
- const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
3636
3645
  const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
3637
3646
  const stripParensRE = /^\(|\)$/g;
3638
3647
  function parseForExpression(input, context) {
@@ -4295,7 +4304,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
4295
4304
  )
4296
4305
  );
4297
4306
  } else {
4298
- const { name, arg, exp, loc } = prop;
4307
+ const { name, arg, exp, loc, modifiers } = prop;
4299
4308
  const isVBind = name === "bind";
4300
4309
  const isVOn = name === "on";
4301
4310
  if (name === "slot") {
@@ -4367,6 +4376,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
4367
4376
  }
4368
4377
  continue;
4369
4378
  }
4379
+ if (isVBind && modifiers.includes("prop")) {
4380
+ patchFlag |= 32;
4381
+ }
4370
4382
  const directiveTransform = context.directiveTransforms[name];
4371
4383
  if (directiveTransform) {
4372
4384
  const { props: props2, needRuntime } = directiveTransform(prop, node, context);
@@ -5308,6 +5320,7 @@ exports.createVNodeCall = createVNodeCall;
5308
5320
  exports.extractIdentifiers = extractIdentifiers;
5309
5321
  exports.findDir = findDir;
5310
5322
  exports.findProp = findProp;
5323
+ exports.forAliasRE = forAliasRE;
5311
5324
  exports.generate = generate;
5312
5325
  exports.getBaseTransformPreset = getBaseTransformPreset;
5313
5326
  exports.getConstantType = getConstantType;
@@ -954,6 +954,7 @@ export declare function injectProp(node: VNodeCall | RenderSlotCall, prop: Prope
954
954
  export declare function toValidAssetId(name: string, type: 'component' | 'directive' | 'filter'): string;
955
955
  export declare function hasScopeRef(node: TemplateChildNode | IfBranchNode | ExpressionNode | undefined, ids: TransformContext['identifiers']): boolean;
956
956
  export declare function getMemoedVNodeCall(node: BlockCodegenNode | MemoExpression): VNodeCall | RenderSlotCall;
957
+ export declare const forAliasRE: RegExp;
957
958
 
958
959
  export declare function walkIdentifiers(root: Node$1, onIdentifier: (node: Identifier, parent: Node$1, parentStack: Node$1[], isReference: boolean, isLocal: boolean) => void, includeAll?: boolean, parentStack?: Node$1[], knownIds?: Record<string, number>): void;
959
960
  export declare function isReferencedIdentifier(id: Identifier, parent: Node$1 | null, parentStack: Node$1[]): boolean;
@@ -656,6 +656,7 @@ function getMemoedVNodeCall(node) {
656
656
  return node;
657
657
  }
658
658
  }
659
+ const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
659
660
 
660
661
  const deprecationData = {
661
662
  ["COMPILER_IS_ON_ELEMENT"]: {
@@ -2640,6 +2641,15 @@ function walkBlockDeclarations(block, onIdent) {
2640
2641
  if (stmt.declare || !stmt.id)
2641
2642
  continue;
2642
2643
  onIdent(stmt.id);
2644
+ } else if (stmt.type === "ForOfStatement" || stmt.type === "ForInStatement" || stmt.type === "ForStatement") {
2645
+ const variable = stmt.type === "ForStatement" ? stmt.init : stmt.left;
2646
+ if (variable && variable.type === "VariableDeclaration") {
2647
+ for (const decl of variable.declarations) {
2648
+ for (const id of extractIdentifiers(decl.id)) {
2649
+ onIdent(id);
2650
+ }
2651
+ }
2652
+ }
2643
2653
  }
2644
2654
  }
2645
2655
  }
@@ -3165,7 +3175,6 @@ function processFor(node, dir, context, processCodegen) {
3165
3175
  onExit();
3166
3176
  };
3167
3177
  }
3168
- const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
3169
3178
  const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
3170
3179
  const stripParensRE = /^\(|\)$/g;
3171
3180
  function parseForExpression(input, context) {
@@ -3786,7 +3795,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
3786
3795
  )
3787
3796
  );
3788
3797
  } else {
3789
- const { name, arg, exp, loc } = prop;
3798
+ const { name, arg, exp, loc, modifiers } = prop;
3790
3799
  const isVBind = name === "bind";
3791
3800
  const isVOn = name === "on";
3792
3801
  if (name === "slot") {
@@ -3879,6 +3888,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
3879
3888
  }
3880
3889
  continue;
3881
3890
  }
3891
+ if (isVBind && modifiers.includes("prop")) {
3892
+ patchFlag |= 32;
3893
+ }
3882
3894
  const directiveTransform = context.directiveTransforms[name];
3883
3895
  if (directiveTransform) {
3884
3896
  const { props: props2, needRuntime } = directiveTransform(prop, node, context);
@@ -4702,4 +4714,4 @@ function baseCompile(template, options = {}) {
4702
4714
 
4703
4715
  const noopDirectiveTransform = () => ({ props: [] });
4704
4716
 
4705
- export { BASE_TRANSITION, CAMELIZE, CAPITALIZE, CREATE_BLOCK, CREATE_COMMENT, CREATE_ELEMENT_BLOCK, CREATE_ELEMENT_VNODE, CREATE_SLOTS, CREATE_STATIC, CREATE_TEXT, CREATE_VNODE, FRAGMENT, GUARD_REACTIVE_PROPS, IS_MEMO_SAME, IS_REF, KEEP_ALIVE, MERGE_PROPS, NORMALIZE_CLASS, NORMALIZE_PROPS, NORMALIZE_STYLE, OPEN_BLOCK, POP_SCOPE_ID, PUSH_SCOPE_ID, RENDER_LIST, RENDER_SLOT, RESOLVE_COMPONENT, RESOLVE_DIRECTIVE, RESOLVE_DYNAMIC_COMPONENT, RESOLVE_FILTER, SET_BLOCK_TRACKING, SUSPENSE, TELEPORT, TO_DISPLAY_STRING, TO_HANDLERS, TO_HANDLER_KEY, TS_NODE_TYPES, UNREF, WITH_CTX, WITH_DIRECTIVES, WITH_MEMO, advancePositionWithClone, advancePositionWithMutation, assert, baseCompile, baseParse, buildDirectiveArgs, buildProps, buildSlots, checkCompatEnabled, convertToBlock, createArrayExpression, createAssignmentExpression, createBlockStatement, createCacheExpression, createCallExpression, createCompilerError, createCompoundExpression, createConditionalExpression, createForLoopParams, createFunctionExpression, createIfStatement, createInterpolation, createObjectExpression, createObjectProperty, createReturnStatement, createRoot, createSequenceExpression, createSimpleExpression, createStructuralDirectiveTransform, createTemplateLiteral, createTransformContext, createVNodeCall, extractIdentifiers, findDir, findProp, generate, getBaseTransformPreset, getConstantType, getInnerRange, getMemoedVNodeCall, getVNodeBlockHelper, getVNodeHelper, hasDynamicKeyVBind, hasScopeRef, helperNameMap, injectProp, isBuiltInType, isCoreComponent, isFunctionType, isInDestructureAssignment, isMemberExpression, isMemberExpressionBrowser, isMemberExpressionNode, isReferencedIdentifier, isSimpleIdentifier, isSlotOutlet, isStaticArgOf, isStaticExp, isStaticProperty, isStaticPropertyKey, isTemplateNode, isText$1 as isText, isVSlot, locStub, noopDirectiveTransform, processExpression, processFor, processIf, processSlotOutlet, registerRuntimeHelpers, resolveComponentType, stringifyExpression, toValidAssetId, trackSlotScopes, trackVForSlotScopes, transform, transformBind, transformElement, transformExpression, transformModel, transformOn, traverseNode, walkBlockDeclarations, walkFunctionParams, walkIdentifiers, warnDeprecation };
4717
+ export { BASE_TRANSITION, CAMELIZE, CAPITALIZE, CREATE_BLOCK, CREATE_COMMENT, CREATE_ELEMENT_BLOCK, CREATE_ELEMENT_VNODE, CREATE_SLOTS, CREATE_STATIC, CREATE_TEXT, CREATE_VNODE, FRAGMENT, GUARD_REACTIVE_PROPS, IS_MEMO_SAME, IS_REF, KEEP_ALIVE, MERGE_PROPS, NORMALIZE_CLASS, NORMALIZE_PROPS, NORMALIZE_STYLE, OPEN_BLOCK, POP_SCOPE_ID, PUSH_SCOPE_ID, RENDER_LIST, RENDER_SLOT, RESOLVE_COMPONENT, RESOLVE_DIRECTIVE, RESOLVE_DYNAMIC_COMPONENT, RESOLVE_FILTER, SET_BLOCK_TRACKING, SUSPENSE, TELEPORT, TO_DISPLAY_STRING, TO_HANDLERS, TO_HANDLER_KEY, TS_NODE_TYPES, UNREF, WITH_CTX, WITH_DIRECTIVES, WITH_MEMO, advancePositionWithClone, advancePositionWithMutation, assert, baseCompile, baseParse, buildDirectiveArgs, buildProps, buildSlots, checkCompatEnabled, convertToBlock, createArrayExpression, createAssignmentExpression, createBlockStatement, createCacheExpression, createCallExpression, createCompilerError, createCompoundExpression, createConditionalExpression, createForLoopParams, createFunctionExpression, createIfStatement, createInterpolation, createObjectExpression, createObjectProperty, createReturnStatement, createRoot, createSequenceExpression, createSimpleExpression, createStructuralDirectiveTransform, createTemplateLiteral, createTransformContext, createVNodeCall, extractIdentifiers, findDir, findProp, forAliasRE, generate, getBaseTransformPreset, getConstantType, getInnerRange, getMemoedVNodeCall, getVNodeBlockHelper, getVNodeHelper, hasDynamicKeyVBind, hasScopeRef, helperNameMap, injectProp, isBuiltInType, isCoreComponent, isFunctionType, isInDestructureAssignment, isMemberExpression, isMemberExpressionBrowser, isMemberExpressionNode, isReferencedIdentifier, isSimpleIdentifier, isSlotOutlet, isStaticArgOf, isStaticExp, isStaticProperty, isStaticPropertyKey, isTemplateNode, isText$1 as isText, isVSlot, locStub, noopDirectiveTransform, processExpression, processFor, processIf, processSlotOutlet, registerRuntimeHelpers, resolveComponentType, stringifyExpression, toValidAssetId, trackSlotScopes, trackVForSlotScopes, transform, transformBind, transformElement, transformExpression, transformModel, transformOn, traverseNode, walkBlockDeclarations, walkFunctionParams, walkIdentifiers, warnDeprecation };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/compiler-core",
3
- "version": "3.3.7",
3
+ "version": "3.3.9",
4
4
  "description": "@vue/compiler-core",
5
5
  "main": "index.js",
6
6
  "module": "dist/compiler-core.esm-bundler.js",
@@ -32,12 +32,12 @@
32
32
  },
33
33
  "homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-core#readme",
34
34
  "dependencies": {
35
- "@babel/parser": "^7.23.0",
36
- "@vue/shared": "3.3.7",
35
+ "@babel/parser": "^7.23.3",
37
36
  "estree-walker": "^2.0.2",
38
- "source-map-js": "^1.0.2"
37
+ "source-map-js": "^1.0.2",
38
+ "@vue/shared": "3.3.9"
39
39
  },
40
40
  "devDependencies": {
41
- "@babel/types": "^7.23.0"
41
+ "@babel/types": "^7.23.3"
42
42
  }
43
43
  }