@vue/compiler-core 3.3.8 → 3.3.10

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
  }
@@ -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) {
@@ -4287,6 +4296,10 @@ function resolveSetupReference(name, context) {
4287
4296
  `${context.helperString(UNREF)}(${fromMaybeRef})`
4288
4297
  ) : `$setup[${JSON.stringify(fromMaybeRef)}]`;
4289
4298
  }
4299
+ const fromProps = checkType("props");
4300
+ if (fromProps) {
4301
+ return `${context.helperString(UNREF)}(${context.inline ? "__props" : "$props"}[${JSON.stringify(fromProps)}])`;
4302
+ }
4290
4303
  }
4291
4304
  function buildProps(node, context, props = node.props, isComponent, isDynamicComponent, ssr = false) {
4292
4305
  const { tag, loc: elementLoc, children } = node;
@@ -4327,6 +4340,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
4327
4340
  if (isEventHandler && shared.isReservedProp(name)) {
4328
4341
  hasVnodeHook = true;
4329
4342
  }
4343
+ if (isEventHandler && value.type === 14) {
4344
+ value = value.arguments[0];
4345
+ }
4330
4346
  if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
4331
4347
  return;
4332
4348
  }
@@ -4395,7 +4411,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
4395
4411
  )
4396
4412
  );
4397
4413
  } else {
4398
- const { name, arg, exp, loc } = prop;
4414
+ const { name, arg, exp, loc, modifiers } = prop;
4399
4415
  const isVBind = name === "bind";
4400
4416
  const isVOn = name === "on";
4401
4417
  if (name === "slot") {
@@ -4488,6 +4504,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
4488
4504
  }
4489
4505
  continue;
4490
4506
  }
4507
+ if (isVBind && modifiers.includes("prop")) {
4508
+ patchFlag |= 32;
4509
+ }
4491
4510
  const directiveTransform = context.directiveTransforms[name];
4492
4511
  if (directiveTransform) {
4493
4512
  const { props: props2, needRuntime } = directiveTransform(prop, node, context);
@@ -5439,6 +5458,7 @@ exports.createVNodeCall = createVNodeCall;
5439
5458
  exports.extractIdentifiers = extractIdentifiers;
5440
5459
  exports.findDir = findDir;
5441
5460
  exports.findProp = findProp;
5461
+ exports.forAliasRE = forAliasRE;
5442
5462
  exports.generate = generate;
5443
5463
  exports.getBaseTransformPreset = getBaseTransformPreset;
5444
5464
  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
  }
@@ -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) {
@@ -4187,6 +4196,10 @@ function resolveSetupReference(name, context) {
4187
4196
  `${context.helperString(UNREF)}(${fromMaybeRef})`
4188
4197
  ) : `$setup[${JSON.stringify(fromMaybeRef)}]`;
4189
4198
  }
4199
+ const fromProps = checkType("props");
4200
+ if (fromProps) {
4201
+ return `${context.helperString(UNREF)}(${context.inline ? "__props" : "$props"}[${JSON.stringify(fromProps)}])`;
4202
+ }
4190
4203
  }
4191
4204
  function buildProps(node, context, props = node.props, isComponent, isDynamicComponent, ssr = false) {
4192
4205
  const { tag, loc: elementLoc, children } = node;
@@ -4227,6 +4240,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
4227
4240
  if (isEventHandler && shared.isReservedProp(name)) {
4228
4241
  hasVnodeHook = true;
4229
4242
  }
4243
+ if (isEventHandler && value.type === 14) {
4244
+ value = value.arguments[0];
4245
+ }
4230
4246
  if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
4231
4247
  return;
4232
4248
  }
@@ -4295,7 +4311,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
4295
4311
  )
4296
4312
  );
4297
4313
  } else {
4298
- const { name, arg, exp, loc } = prop;
4314
+ const { name, arg, exp, loc, modifiers } = prop;
4299
4315
  const isVBind = name === "bind";
4300
4316
  const isVOn = name === "on";
4301
4317
  if (name === "slot") {
@@ -4367,6 +4383,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
4367
4383
  }
4368
4384
  continue;
4369
4385
  }
4386
+ if (isVBind && modifiers.includes("prop")) {
4387
+ patchFlag |= 32;
4388
+ }
4370
4389
  const directiveTransform = context.directiveTransforms[name];
4371
4390
  if (directiveTransform) {
4372
4391
  const { props: props2, needRuntime } = directiveTransform(prop, node, context);
@@ -5308,6 +5327,7 @@ exports.createVNodeCall = createVNodeCall;
5308
5327
  exports.extractIdentifiers = extractIdentifiers;
5309
5328
  exports.findDir = findDir;
5310
5329
  exports.findProp = findProp;
5330
+ exports.forAliasRE = forAliasRE;
5311
5331
  exports.generate = generate;
5312
5332
  exports.getBaseTransformPreset = getBaseTransformPreset;
5313
5333
  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) {
@@ -3730,6 +3739,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
3730
3739
  if (isEventHandler && isReservedProp(name)) {
3731
3740
  hasVnodeHook = true;
3732
3741
  }
3742
+ if (isEventHandler && value.type === 14) {
3743
+ value = value.arguments[0];
3744
+ }
3733
3745
  if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
3734
3746
  return;
3735
3747
  }
@@ -3786,7 +3798,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
3786
3798
  )
3787
3799
  );
3788
3800
  } else {
3789
- const { name, arg, exp, loc } = prop;
3801
+ const { name, arg, exp, loc, modifiers } = prop;
3790
3802
  const isVBind = name === "bind";
3791
3803
  const isVOn = name === "on";
3792
3804
  if (name === "slot") {
@@ -3879,6 +3891,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
3879
3891
  }
3880
3892
  continue;
3881
3893
  }
3894
+ if (isVBind && modifiers.includes("prop")) {
3895
+ patchFlag |= 32;
3896
+ }
3882
3897
  const directiveTransform = context.directiveTransforms[name];
3883
3898
  if (directiveTransform) {
3884
3899
  const { props: props2, needRuntime } = directiveTransform(prop, node, context);
@@ -4702,4 +4717,4 @@ function baseCompile(template, options = {}) {
4702
4717
 
4703
4718
  const noopDirectiveTransform = () => ({ props: [] });
4704
4719
 
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 };
4720
+ 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.8",
3
+ "version": "3.3.10",
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.8",
35
+ "@babel/parser": "^7.23.5",
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.10"
39
39
  },
40
40
  "devDependencies": {
41
- "@babel/types": "^7.23.0"
41
+ "@babel/types": "^7.23.5"
42
42
  }
43
43
  }