@vue/compiler-core 3.4.4 → 3.4.6
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.
|
@@ -1582,6 +1582,18 @@ function isInDestructureAssignment(parent, parentStack) {
|
|
|
1582
1582
|
}
|
|
1583
1583
|
return false;
|
|
1584
1584
|
}
|
|
1585
|
+
function isInNewExpression(parentStack) {
|
|
1586
|
+
let i = parentStack.length;
|
|
1587
|
+
while (i--) {
|
|
1588
|
+
const p = parentStack[i];
|
|
1589
|
+
if (p.type === "NewExpression") {
|
|
1590
|
+
return true;
|
|
1591
|
+
} else if (p.type !== "MemberExpression") {
|
|
1592
|
+
break;
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1595
|
+
return false;
|
|
1596
|
+
}
|
|
1585
1597
|
function walkFunctionParams(node, onIdent) {
|
|
1586
1598
|
for (const p of node.params) {
|
|
1587
1599
|
for (const id of extractIdentifiers(p)) {
|
|
@@ -4232,12 +4244,17 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
4232
4244
|
const isAssignmentLVal = parent && parent.type === "AssignmentExpression" && parent.left === id;
|
|
4233
4245
|
const isUpdateArg = parent && parent.type === "UpdateExpression" && parent.argument === id;
|
|
4234
4246
|
const isDestructureAssignment = parent && isInDestructureAssignment(parent, parentStack);
|
|
4247
|
+
const isNewExpression = parent && isInNewExpression(parentStack);
|
|
4248
|
+
const wrapWithUnref = (raw2) => {
|
|
4249
|
+
const wrapped = `${context.helperString(UNREF)}(${raw2})`;
|
|
4250
|
+
return isNewExpression ? `(${wrapped})` : wrapped;
|
|
4251
|
+
};
|
|
4235
4252
|
if (isConst(type) || type === "setup-reactive-const" || localVars[raw]) {
|
|
4236
4253
|
return raw;
|
|
4237
4254
|
} else if (type === "setup-ref") {
|
|
4238
4255
|
return `${raw}.value`;
|
|
4239
4256
|
} else if (type === "setup-maybe-ref") {
|
|
4240
|
-
return isAssignmentLVal || isUpdateArg || isDestructureAssignment ? `${raw}.value` :
|
|
4257
|
+
return isAssignmentLVal || isUpdateArg || isDestructureAssignment ? `${raw}.value` : wrapWithUnref(raw);
|
|
4241
4258
|
} else if (type === "setup-let") {
|
|
4242
4259
|
if (isAssignmentLVal) {
|
|
4243
4260
|
const { right: rVal, operator } = parent;
|
|
@@ -4264,7 +4281,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
4264
4281
|
} else if (isDestructureAssignment) {
|
|
4265
4282
|
return raw;
|
|
4266
4283
|
} else {
|
|
4267
|
-
return
|
|
4284
|
+
return wrapWithUnref(raw);
|
|
4268
4285
|
}
|
|
4269
4286
|
} else if (type === "props") {
|
|
4270
4287
|
return shared.genPropsAccessExp(raw);
|
|
@@ -6541,6 +6558,7 @@ exports.injectProp = injectProp;
|
|
|
6541
6558
|
exports.isCoreComponent = isCoreComponent;
|
|
6542
6559
|
exports.isFunctionType = isFunctionType;
|
|
6543
6560
|
exports.isInDestructureAssignment = isInDestructureAssignment;
|
|
6561
|
+
exports.isInNewExpression = isInNewExpression;
|
|
6544
6562
|
exports.isMemberExpression = isMemberExpression;
|
|
6545
6563
|
exports.isMemberExpressionBrowser = isMemberExpressionBrowser;
|
|
6546
6564
|
exports.isMemberExpressionNode = isMemberExpressionNode;
|
|
@@ -1578,6 +1578,18 @@ function isInDestructureAssignment(parent, parentStack) {
|
|
|
1578
1578
|
}
|
|
1579
1579
|
return false;
|
|
1580
1580
|
}
|
|
1581
|
+
function isInNewExpression(parentStack) {
|
|
1582
|
+
let i = parentStack.length;
|
|
1583
|
+
while (i--) {
|
|
1584
|
+
const p = parentStack[i];
|
|
1585
|
+
if (p.type === "NewExpression") {
|
|
1586
|
+
return true;
|
|
1587
|
+
} else if (p.type !== "MemberExpression") {
|
|
1588
|
+
break;
|
|
1589
|
+
}
|
|
1590
|
+
}
|
|
1591
|
+
return false;
|
|
1592
|
+
}
|
|
1581
1593
|
function walkFunctionParams(node, onIdent) {
|
|
1582
1594
|
for (const p of node.params) {
|
|
1583
1595
|
for (const id of extractIdentifiers(p)) {
|
|
@@ -4161,12 +4173,17 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
4161
4173
|
const isAssignmentLVal = parent && parent.type === "AssignmentExpression" && parent.left === id;
|
|
4162
4174
|
const isUpdateArg = parent && parent.type === "UpdateExpression" && parent.argument === id;
|
|
4163
4175
|
const isDestructureAssignment = parent && isInDestructureAssignment(parent, parentStack);
|
|
4176
|
+
const isNewExpression = parent && isInNewExpression(parentStack);
|
|
4177
|
+
const wrapWithUnref = (raw2) => {
|
|
4178
|
+
const wrapped = `${context.helperString(UNREF)}(${raw2})`;
|
|
4179
|
+
return isNewExpression ? `(${wrapped})` : wrapped;
|
|
4180
|
+
};
|
|
4164
4181
|
if (isConst(type) || type === "setup-reactive-const" || localVars[raw]) {
|
|
4165
4182
|
return raw;
|
|
4166
4183
|
} else if (type === "setup-ref") {
|
|
4167
4184
|
return `${raw}.value`;
|
|
4168
4185
|
} else if (type === "setup-maybe-ref") {
|
|
4169
|
-
return isAssignmentLVal || isUpdateArg || isDestructureAssignment ? `${raw}.value` :
|
|
4186
|
+
return isAssignmentLVal || isUpdateArg || isDestructureAssignment ? `${raw}.value` : wrapWithUnref(raw);
|
|
4170
4187
|
} else if (type === "setup-let") {
|
|
4171
4188
|
if (isAssignmentLVal) {
|
|
4172
4189
|
const { right: rVal, operator } = parent;
|
|
@@ -4193,7 +4210,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
4193
4210
|
} else if (isDestructureAssignment) {
|
|
4194
4211
|
return raw;
|
|
4195
4212
|
} else {
|
|
4196
|
-
return
|
|
4213
|
+
return wrapWithUnref(raw);
|
|
4197
4214
|
}
|
|
4198
4215
|
} else if (type === "props") {
|
|
4199
4216
|
return shared.genPropsAccessExp(raw);
|
|
@@ -6417,6 +6434,7 @@ exports.injectProp = injectProp;
|
|
|
6417
6434
|
exports.isCoreComponent = isCoreComponent;
|
|
6418
6435
|
exports.isFunctionType = isFunctionType;
|
|
6419
6436
|
exports.isInDestructureAssignment = isInDestructureAssignment;
|
|
6437
|
+
exports.isInNewExpression = isInNewExpression;
|
|
6420
6438
|
exports.isMemberExpression = isMemberExpression;
|
|
6421
6439
|
exports.isMemberExpressionBrowser = isMemberExpressionBrowser;
|
|
6422
6440
|
exports.isMemberExpressionNode = isMemberExpressionNode;
|
package/dist/compiler-core.d.ts
CHANGED
|
@@ -988,6 +988,7 @@ export declare const forAliasRE: RegExp;
|
|
|
988
988
|
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;
|
|
989
989
|
export declare function isReferencedIdentifier(id: Identifier, parent: Node$1 | null, parentStack: Node$1[]): boolean;
|
|
990
990
|
export declare function isInDestructureAssignment(parent: Node$1, parentStack: Node$1[]): boolean;
|
|
991
|
+
export declare function isInNewExpression(parentStack: Node$1[]): boolean;
|
|
991
992
|
export declare function walkFunctionParams(node: Function, onIdent: (id: Identifier) => void): void;
|
|
992
993
|
export declare function walkBlockDeclarations(block: BlockStatement$1 | Program, onIdent: (node: Identifier) => void): void;
|
|
993
994
|
export declare function extractIdentifiers(param: Node$1, nodes?: Identifier[]): Identifier[];
|
|
@@ -1454,6 +1454,18 @@ function isInDestructureAssignment(parent, parentStack) {
|
|
|
1454
1454
|
}
|
|
1455
1455
|
return false;
|
|
1456
1456
|
}
|
|
1457
|
+
function isInNewExpression(parentStack) {
|
|
1458
|
+
let i = parentStack.length;
|
|
1459
|
+
while (i--) {
|
|
1460
|
+
const p = parentStack[i];
|
|
1461
|
+
if (p.type === "NewExpression") {
|
|
1462
|
+
return true;
|
|
1463
|
+
} else if (p.type !== "MemberExpression") {
|
|
1464
|
+
break;
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
return false;
|
|
1468
|
+
}
|
|
1457
1469
|
function walkFunctionParams(node, onIdent) {
|
|
1458
1470
|
for (const p of node.params) {
|
|
1459
1471
|
for (const id of extractIdentifiers(p)) {
|
|
@@ -5642,4 +5654,4 @@ const BindingTypes = {
|
|
|
5642
5654
|
|
|
5643
5655
|
const noopDirectiveTransform = () => ({ props: [] });
|
|
5644
5656
|
|
|
5645
|
-
export { BASE_TRANSITION, BindingTypes, CAMELIZE, CAPITALIZE, CREATE_BLOCK, CREATE_COMMENT, CREATE_ELEMENT_BLOCK, CREATE_ELEMENT_VNODE, CREATE_SLOTS, CREATE_STATIC, CREATE_TEXT, CREATE_VNODE, CompilerDeprecationTypes, ConstantTypes, ElementTypes, ErrorCodes, FRAGMENT, GUARD_REACTIVE_PROPS, IS_MEMO_SAME, IS_REF, KEEP_ALIVE, MERGE_PROPS, NORMALIZE_CLASS, NORMALIZE_PROPS, NORMALIZE_STYLE, Namespaces, NodeTypes, 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, errorMessages, extractIdentifiers, findDir, findProp, forAliasRE, generate, getBaseTransformPreset, getConstantType, getMemoedVNodeCall, getVNodeBlockHelper, getVNodeHelper, hasDynamicKeyVBind, hasScopeRef, helperNameMap, injectProp, 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, unwrapTSNode, walkBlockDeclarations, walkFunctionParams, walkIdentifiers, warnDeprecation };
|
|
5657
|
+
export { BASE_TRANSITION, BindingTypes, CAMELIZE, CAPITALIZE, CREATE_BLOCK, CREATE_COMMENT, CREATE_ELEMENT_BLOCK, CREATE_ELEMENT_VNODE, CREATE_SLOTS, CREATE_STATIC, CREATE_TEXT, CREATE_VNODE, CompilerDeprecationTypes, ConstantTypes, ElementTypes, ErrorCodes, FRAGMENT, GUARD_REACTIVE_PROPS, IS_MEMO_SAME, IS_REF, KEEP_ALIVE, MERGE_PROPS, NORMALIZE_CLASS, NORMALIZE_PROPS, NORMALIZE_STYLE, Namespaces, NodeTypes, 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, errorMessages, extractIdentifiers, findDir, findProp, forAliasRE, generate, getBaseTransformPreset, getConstantType, getMemoedVNodeCall, getVNodeBlockHelper, getVNodeHelper, hasDynamicKeyVBind, hasScopeRef, helperNameMap, injectProp, isCoreComponent, isFunctionType, isInDestructureAssignment, isInNewExpression, 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, unwrapTSNode, walkBlockDeclarations, walkFunctionParams, walkIdentifiers, warnDeprecation };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/compiler-core",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.6",
|
|
4
4
|
"description": "@vue/compiler-core",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/compiler-core.esm-bundler.js",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"entities": "^4.5.0",
|
|
37
37
|
"estree-walker": "^2.0.2",
|
|
38
38
|
"source-map-js": "^1.0.2",
|
|
39
|
-
"@vue/shared": "3.4.
|
|
39
|
+
"@vue/shared": "3.4.6"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@babel/types": "^7.23.6"
|