@vue/compiler-core 3.2.43 → 3.2.45
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.
|
@@ -73,15 +73,16 @@ const errorMessages = {
|
|
|
73
73
|
[41 /* ErrorCodes.X_V_MODEL_NO_EXPRESSION */]: `v-model is missing expression.`,
|
|
74
74
|
[42 /* ErrorCodes.X_V_MODEL_MALFORMED_EXPRESSION */]: `v-model value must be a valid JavaScript member expression.`,
|
|
75
75
|
[43 /* ErrorCodes.X_V_MODEL_ON_SCOPE_VARIABLE */]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
|
|
76
|
-
[44 /* ErrorCodes.
|
|
77
|
-
[45 /* ErrorCodes.
|
|
76
|
+
[44 /* ErrorCodes.X_V_MODEL_ON_PROPS */]: `v-model cannot be used on a prop, because local prop bindings are not writable.\nUse a v-bind binding combined with a v-on listener that emits update:x event instead.`,
|
|
77
|
+
[45 /* ErrorCodes.X_INVALID_EXPRESSION */]: `Error parsing JavaScript expression: `,
|
|
78
|
+
[46 /* ErrorCodes.X_KEEP_ALIVE_INVALID_CHILDREN */]: `<KeepAlive> expects exactly one child component.`,
|
|
78
79
|
// generic errors
|
|
79
|
-
[
|
|
80
|
-
[
|
|
81
|
-
[
|
|
82
|
-
[
|
|
80
|
+
[47 /* ErrorCodes.X_PREFIX_ID_NOT_SUPPORTED */]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
|
|
81
|
+
[48 /* ErrorCodes.X_MODULE_MODE_NOT_SUPPORTED */]: `ES module mode is not supported in this build of compiler.`,
|
|
82
|
+
[49 /* ErrorCodes.X_CACHE_HANDLER_NOT_SUPPORTED */]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
|
|
83
|
+
[50 /* ErrorCodes.X_SCOPE_ID_NOT_SUPPORTED */]: `"scopeId" option is only supported in module mode.`,
|
|
83
84
|
// just to fulfill types
|
|
84
|
-
[
|
|
85
|
+
[51 /* ErrorCodes.__EXTEND_POINT__ */]: ``
|
|
85
86
|
};
|
|
86
87
|
|
|
87
88
|
const FRAGMENT = Symbol(`Fragment` );
|
|
@@ -3496,7 +3497,7 @@ asRawStatements = false, localVars = Object.create(context.identifiers)) {
|
|
|
3496
3497
|
}).program;
|
|
3497
3498
|
}
|
|
3498
3499
|
catch (e) {
|
|
3499
|
-
context.onError(createCompilerError(
|
|
3500
|
+
context.onError(createCompilerError(45 /* ErrorCodes.X_INVALID_EXPRESSION */, node.loc, undefined, e.message));
|
|
3500
3501
|
return node;
|
|
3501
3502
|
}
|
|
3502
3503
|
const ids = [];
|
|
@@ -4396,7 +4397,7 @@ const transformElement = (node, context) => {
|
|
|
4396
4397
|
// 2. Force keep-alive to always be updated, since it uses raw children.
|
|
4397
4398
|
patchFlag |= 1024 /* PatchFlags.DYNAMIC_SLOTS */;
|
|
4398
4399
|
if (node.children.length > 1) {
|
|
4399
|
-
context.onError(createCompilerError(
|
|
4400
|
+
context.onError(createCompilerError(46 /* ErrorCodes.X_KEEP_ALIVE_INVALID_CHILDREN */, {
|
|
4400
4401
|
start: node.children[0].loc.start,
|
|
4401
4402
|
end: node.children[node.children.length - 1].loc.end,
|
|
4402
4403
|
source: ''
|
|
@@ -5385,9 +5386,16 @@ const transformModel = (dir, node, context) => {
|
|
|
5385
5386
|
// im SFC <script setup> inline mode, the exp may have been transformed into
|
|
5386
5387
|
// _unref(exp)
|
|
5387
5388
|
const bindingType = context.bindingMetadata[rawExp];
|
|
5389
|
+
// check props
|
|
5390
|
+
if (bindingType === "props" /* BindingTypes.PROPS */ ||
|
|
5391
|
+
bindingType === "props-aliased" /* BindingTypes.PROPS_ALIASED */) {
|
|
5392
|
+
context.onError(createCompilerError(44 /* ErrorCodes.X_V_MODEL_ON_PROPS */, exp.loc));
|
|
5393
|
+
return createTransformProps();
|
|
5394
|
+
}
|
|
5388
5395
|
const maybeRef = context.inline &&
|
|
5389
|
-
bindingType
|
|
5390
|
-
|
|
5396
|
+
(bindingType === "setup-let" /* BindingTypes.SETUP_LET */ ||
|
|
5397
|
+
bindingType === "setup-ref" /* BindingTypes.SETUP_REF */ ||
|
|
5398
|
+
bindingType === "setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */);
|
|
5391
5399
|
if (!expString.trim() ||
|
|
5392
5400
|
(!isMemberExpression(expString, context) && !maybeRef)) {
|
|
5393
5401
|
context.onError(createCompilerError(42 /* ErrorCodes.X_V_MODEL_MALFORMED_EXPRESSION */, exp.loc));
|
|
@@ -5691,10 +5699,10 @@ function baseCompile(template, options = {}) {
|
|
|
5691
5699
|
const isModuleMode = options.mode === 'module';
|
|
5692
5700
|
const prefixIdentifiers = (options.prefixIdentifiers === true || isModuleMode);
|
|
5693
5701
|
if (!prefixIdentifiers && options.cacheHandlers) {
|
|
5694
|
-
onError(createCompilerError(
|
|
5702
|
+
onError(createCompilerError(49 /* ErrorCodes.X_CACHE_HANDLER_NOT_SUPPORTED */));
|
|
5695
5703
|
}
|
|
5696
5704
|
if (options.scopeId && !isModuleMode) {
|
|
5697
|
-
onError(createCompilerError(
|
|
5705
|
+
onError(createCompilerError(50 /* ErrorCodes.X_SCOPE_ID_NOT_SUPPORTED */));
|
|
5698
5706
|
}
|
|
5699
5707
|
const ast = shared.isString(template) ? baseParse(template, options) : template;
|
|
5700
5708
|
const [nodeTransforms, directiveTransforms] = getBaseTransformPreset(prefixIdentifiers);
|
|
@@ -72,15 +72,16 @@ const errorMessages = {
|
|
|
72
72
|
[41 /* ErrorCodes.X_V_MODEL_NO_EXPRESSION */]: `v-model is missing expression.`,
|
|
73
73
|
[42 /* ErrorCodes.X_V_MODEL_MALFORMED_EXPRESSION */]: `v-model value must be a valid JavaScript member expression.`,
|
|
74
74
|
[43 /* ErrorCodes.X_V_MODEL_ON_SCOPE_VARIABLE */]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
|
|
75
|
-
[44 /* ErrorCodes.
|
|
76
|
-
[45 /* ErrorCodes.
|
|
75
|
+
[44 /* ErrorCodes.X_V_MODEL_ON_PROPS */]: `v-model cannot be used on a prop, because local prop bindings are not writable.\nUse a v-bind binding combined with a v-on listener that emits update:x event instead.`,
|
|
76
|
+
[45 /* ErrorCodes.X_INVALID_EXPRESSION */]: `Error parsing JavaScript expression: `,
|
|
77
|
+
[46 /* ErrorCodes.X_KEEP_ALIVE_INVALID_CHILDREN */]: `<KeepAlive> expects exactly one child component.`,
|
|
77
78
|
// generic errors
|
|
78
|
-
[
|
|
79
|
-
[
|
|
80
|
-
[
|
|
81
|
-
[
|
|
79
|
+
[47 /* ErrorCodes.X_PREFIX_ID_NOT_SUPPORTED */]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
|
|
80
|
+
[48 /* ErrorCodes.X_MODULE_MODE_NOT_SUPPORTED */]: `ES module mode is not supported in this build of compiler.`,
|
|
81
|
+
[49 /* ErrorCodes.X_CACHE_HANDLER_NOT_SUPPORTED */]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
|
|
82
|
+
[50 /* ErrorCodes.X_SCOPE_ID_NOT_SUPPORTED */]: `"scopeId" option is only supported in module mode.`,
|
|
82
83
|
// just to fulfill types
|
|
83
|
-
[
|
|
84
|
+
[51 /* ErrorCodes.__EXTEND_POINT__ */]: ``
|
|
84
85
|
};
|
|
85
86
|
|
|
86
87
|
const FRAGMENT = Symbol(``);
|
|
@@ -3433,7 +3434,7 @@ asRawStatements = false, localVars = Object.create(context.identifiers)) {
|
|
|
3433
3434
|
}).program;
|
|
3434
3435
|
}
|
|
3435
3436
|
catch (e) {
|
|
3436
|
-
context.onError(createCompilerError(
|
|
3437
|
+
context.onError(createCompilerError(45 /* ErrorCodes.X_INVALID_EXPRESSION */, node.loc, undefined, e.message));
|
|
3437
3438
|
return node;
|
|
3438
3439
|
}
|
|
3439
3440
|
const ids = [];
|
|
@@ -5260,9 +5261,16 @@ const transformModel = (dir, node, context) => {
|
|
|
5260
5261
|
// im SFC <script setup> inline mode, the exp may have been transformed into
|
|
5261
5262
|
// _unref(exp)
|
|
5262
5263
|
const bindingType = context.bindingMetadata[rawExp];
|
|
5264
|
+
// check props
|
|
5265
|
+
if (bindingType === "props" /* BindingTypes.PROPS */ ||
|
|
5266
|
+
bindingType === "props-aliased" /* BindingTypes.PROPS_ALIASED */) {
|
|
5267
|
+
context.onError(createCompilerError(44 /* ErrorCodes.X_V_MODEL_ON_PROPS */, exp.loc));
|
|
5268
|
+
return createTransformProps();
|
|
5269
|
+
}
|
|
5263
5270
|
const maybeRef = context.inline &&
|
|
5264
|
-
bindingType
|
|
5265
|
-
|
|
5271
|
+
(bindingType === "setup-let" /* BindingTypes.SETUP_LET */ ||
|
|
5272
|
+
bindingType === "setup-ref" /* BindingTypes.SETUP_REF */ ||
|
|
5273
|
+
bindingType === "setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */);
|
|
5266
5274
|
if (!expString.trim() ||
|
|
5267
5275
|
(!isMemberExpression(expString, context) && !maybeRef)) {
|
|
5268
5276
|
context.onError(createCompilerError(42 /* ErrorCodes.X_V_MODEL_MALFORMED_EXPRESSION */, exp.loc));
|
|
@@ -5565,10 +5573,10 @@ function baseCompile(template, options = {}) {
|
|
|
5565
5573
|
const isModuleMode = options.mode === 'module';
|
|
5566
5574
|
const prefixIdentifiers = (options.prefixIdentifiers === true || isModuleMode);
|
|
5567
5575
|
if (!prefixIdentifiers && options.cacheHandlers) {
|
|
5568
|
-
onError(createCompilerError(
|
|
5576
|
+
onError(createCompilerError(49 /* ErrorCodes.X_CACHE_HANDLER_NOT_SUPPORTED */));
|
|
5569
5577
|
}
|
|
5570
5578
|
if (options.scopeId && !isModuleMode) {
|
|
5571
|
-
onError(createCompilerError(
|
|
5579
|
+
onError(createCompilerError(50 /* ErrorCodes.X_SCOPE_ID_NOT_SUPPORTED */));
|
|
5572
5580
|
}
|
|
5573
5581
|
const ast = shared.isString(template) ? baseParse(template, options) : template;
|
|
5574
5582
|
const [nodeTransforms, directiveTransforms] = getBaseTransformPreset(prefixIdentifiers);
|
package/dist/compiler-core.d.ts
CHANGED
|
@@ -446,13 +446,14 @@ export declare const enum ErrorCodes {
|
|
|
446
446
|
X_V_MODEL_NO_EXPRESSION = 41,
|
|
447
447
|
X_V_MODEL_MALFORMED_EXPRESSION = 42,
|
|
448
448
|
X_V_MODEL_ON_SCOPE_VARIABLE = 43,
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
449
|
+
X_V_MODEL_ON_PROPS = 44,
|
|
450
|
+
X_INVALID_EXPRESSION = 45,
|
|
451
|
+
X_KEEP_ALIVE_INVALID_CHILDREN = 46,
|
|
452
|
+
X_PREFIX_ID_NOT_SUPPORTED = 47,
|
|
453
|
+
X_MODULE_MODE_NOT_SUPPORTED = 48,
|
|
454
|
+
X_CACHE_HANDLER_NOT_SUPPORTED = 49,
|
|
455
|
+
X_SCOPE_ID_NOT_SUPPORTED = 50,
|
|
456
|
+
__EXTEND_POINT__ = 51
|
|
456
457
|
}
|
|
457
458
|
|
|
458
459
|
declare interface ErrorHandlingOptions {
|
|
@@ -68,15 +68,16 @@ const errorMessages = {
|
|
|
68
68
|
[41 /* ErrorCodes.X_V_MODEL_NO_EXPRESSION */]: `v-model is missing expression.`,
|
|
69
69
|
[42 /* ErrorCodes.X_V_MODEL_MALFORMED_EXPRESSION */]: `v-model value must be a valid JavaScript member expression.`,
|
|
70
70
|
[43 /* ErrorCodes.X_V_MODEL_ON_SCOPE_VARIABLE */]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
|
|
71
|
-
[44 /* ErrorCodes.
|
|
72
|
-
[45 /* ErrorCodes.
|
|
71
|
+
[44 /* ErrorCodes.X_V_MODEL_ON_PROPS */]: `v-model cannot be used on a prop, because local prop bindings are not writable.\nUse a v-bind binding combined with a v-on listener that emits update:x event instead.`,
|
|
72
|
+
[45 /* ErrorCodes.X_INVALID_EXPRESSION */]: `Error parsing JavaScript expression: `,
|
|
73
|
+
[46 /* ErrorCodes.X_KEEP_ALIVE_INVALID_CHILDREN */]: `<KeepAlive> expects exactly one child component.`,
|
|
73
74
|
// generic errors
|
|
74
|
-
[
|
|
75
|
-
[
|
|
76
|
-
[
|
|
77
|
-
[
|
|
75
|
+
[47 /* ErrorCodes.X_PREFIX_ID_NOT_SUPPORTED */]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
|
|
76
|
+
[48 /* ErrorCodes.X_MODULE_MODE_NOT_SUPPORTED */]: `ES module mode is not supported in this build of compiler.`,
|
|
77
|
+
[49 /* ErrorCodes.X_CACHE_HANDLER_NOT_SUPPORTED */]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
|
|
78
|
+
[50 /* ErrorCodes.X_SCOPE_ID_NOT_SUPPORTED */]: `"scopeId" option is only supported in module mode.`,
|
|
78
79
|
// just to fulfill types
|
|
79
|
-
[
|
|
80
|
+
[51 /* ErrorCodes.__EXTEND_POINT__ */]: ``
|
|
80
81
|
};
|
|
81
82
|
|
|
82
83
|
const FRAGMENT = Symbol((process.env.NODE_ENV !== 'production') ? `Fragment` : ``);
|
|
@@ -2897,7 +2898,7 @@ function validateBrowserExpression(node, context, asParams = false, asRawStateme
|
|
|
2897
2898
|
if (keywordMatch) {
|
|
2898
2899
|
message = `avoid using JavaScript keyword as property name: "${keywordMatch[0]}"`;
|
|
2899
2900
|
}
|
|
2900
|
-
context.onError(createCompilerError(
|
|
2901
|
+
context.onError(createCompilerError(45 /* ErrorCodes.X_INVALID_EXPRESSION */, node.loc, undefined, message));
|
|
2901
2902
|
}
|
|
2902
2903
|
}
|
|
2903
2904
|
|
|
@@ -3729,7 +3730,7 @@ const transformElement = (node, context) => {
|
|
|
3729
3730
|
// 2. Force keep-alive to always be updated, since it uses raw children.
|
|
3730
3731
|
patchFlag |= 1024 /* PatchFlags.DYNAMIC_SLOTS */;
|
|
3731
3732
|
if ((process.env.NODE_ENV !== 'production') && node.children.length > 1) {
|
|
3732
|
-
context.onError(createCompilerError(
|
|
3733
|
+
context.onError(createCompilerError(46 /* ErrorCodes.X_KEEP_ALIVE_INVALID_CHILDREN */, {
|
|
3733
3734
|
start: node.children[0].loc.start,
|
|
3734
3735
|
end: node.children[node.children.length - 1].loc.end,
|
|
3735
3736
|
source: ''
|
|
@@ -4606,8 +4607,14 @@ const transformModel = (dir, node, context) => {
|
|
|
4606
4607
|
const expString = exp.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ ? exp.content : rawExp;
|
|
4607
4608
|
// im SFC <script setup> inline mode, the exp may have been transformed into
|
|
4608
4609
|
// _unref(exp)
|
|
4609
|
-
context.bindingMetadata[rawExp];
|
|
4610
|
-
|
|
4610
|
+
const bindingType = context.bindingMetadata[rawExp];
|
|
4611
|
+
// check props
|
|
4612
|
+
if (bindingType === "props" /* BindingTypes.PROPS */ ||
|
|
4613
|
+
bindingType === "props-aliased" /* BindingTypes.PROPS_ALIASED */) {
|
|
4614
|
+
context.onError(createCompilerError(44 /* ErrorCodes.X_V_MODEL_ON_PROPS */, exp.loc));
|
|
4615
|
+
return createTransformProps();
|
|
4616
|
+
}
|
|
4617
|
+
const maybeRef = !true ;
|
|
4611
4618
|
if (!expString.trim() ||
|
|
4612
4619
|
(!isMemberExpression(expString) && !maybeRef)) {
|
|
4613
4620
|
context.onError(createCompilerError(42 /* ErrorCodes.X_V_MODEL_MALFORMED_EXPRESSION */, exp.loc));
|
|
@@ -4876,18 +4883,18 @@ function baseCompile(template, options = {}) {
|
|
|
4876
4883
|
/* istanbul ignore if */
|
|
4877
4884
|
{
|
|
4878
4885
|
if (options.prefixIdentifiers === true) {
|
|
4879
|
-
onError(createCompilerError(
|
|
4886
|
+
onError(createCompilerError(47 /* ErrorCodes.X_PREFIX_ID_NOT_SUPPORTED */));
|
|
4880
4887
|
}
|
|
4881
4888
|
else if (isModuleMode) {
|
|
4882
|
-
onError(createCompilerError(
|
|
4889
|
+
onError(createCompilerError(48 /* ErrorCodes.X_MODULE_MODE_NOT_SUPPORTED */));
|
|
4883
4890
|
}
|
|
4884
4891
|
}
|
|
4885
4892
|
const prefixIdentifiers = !true ;
|
|
4886
4893
|
if (options.cacheHandlers) {
|
|
4887
|
-
onError(createCompilerError(
|
|
4894
|
+
onError(createCompilerError(49 /* ErrorCodes.X_CACHE_HANDLER_NOT_SUPPORTED */));
|
|
4888
4895
|
}
|
|
4889
4896
|
if (options.scopeId && !isModuleMode) {
|
|
4890
|
-
onError(createCompilerError(
|
|
4897
|
+
onError(createCompilerError(50 /* ErrorCodes.X_SCOPE_ID_NOT_SUPPORTED */));
|
|
4891
4898
|
}
|
|
4892
4899
|
const ast = isString(template) ? baseParse(template, options) : template;
|
|
4893
4900
|
const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/compiler-core",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.45",
|
|
4
4
|
"description": "@vue/compiler-core",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/compiler-core.esm-bundler.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-core#readme",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@vue/shared": "3.2.
|
|
35
|
+
"@vue/shared": "3.2.45",
|
|
36
36
|
"@babel/parser": "^7.16.4",
|
|
37
37
|
"estree-walker": "^2.0.2",
|
|
38
38
|
"source-map": "^0.6.1"
|