@vue/compiler-sfc 3.4.0-rc.2 → 3.4.0-rc.3
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.
- package/dist/compiler-sfc.cjs.js +32 -22
- package/dist/compiler-sfc.d.ts +1 -1
- package/dist/compiler-sfc.esm-browser.js +40 -35
- package/package.json +5 -5
package/dist/compiler-sfc.cjs.js
CHANGED
|
@@ -2019,7 +2019,7 @@ function generateSourceMap(filename, source, generated, sourceRoot, lineOffset,
|
|
|
2019
2019
|
generatedLine,
|
|
2020
2020
|
generatedColumn: i,
|
|
2021
2021
|
source: filename,
|
|
2022
|
-
// @ts-
|
|
2022
|
+
// @ts-expect-error
|
|
2023
2023
|
name: null
|
|
2024
2024
|
});
|
|
2025
2025
|
}
|
|
@@ -17862,7 +17862,7 @@ function innerResolveTypeElements(ctx, node, scope, typeParameters) {
|
|
|
17862
17862
|
);
|
|
17863
17863
|
}
|
|
17864
17864
|
if (
|
|
17865
|
-
// @ts-
|
|
17865
|
+
// @ts-expect-error
|
|
17866
17866
|
SupportedBuiltinsSet.has(typeName)
|
|
17867
17867
|
) {
|
|
17868
17868
|
return resolveBuiltin(
|
|
@@ -17964,7 +17964,7 @@ function mergeElements(maps, type) {
|
|
|
17964
17964
|
baseProps[key].key,
|
|
17965
17965
|
{
|
|
17966
17966
|
type,
|
|
17967
|
-
// @ts-
|
|
17967
|
+
// @ts-expect-error
|
|
17968
17968
|
types: [baseProps[key], props[key]]
|
|
17969
17969
|
},
|
|
17970
17970
|
baseProps[key]._ownerScope,
|
|
@@ -19094,33 +19094,38 @@ function processDefineModel(ctx, node, declId) {
|
|
|
19094
19094
|
if (ctx.modelDecls[modelName]) {
|
|
19095
19095
|
ctx.error(`duplicate model name ${JSON.stringify(modelName)}`, node);
|
|
19096
19096
|
}
|
|
19097
|
-
|
|
19098
|
-
ctx.modelDecls[modelName] = {
|
|
19099
|
-
type,
|
|
19100
|
-
options: optionsString,
|
|
19101
|
-
identifier: declId && declId.type === "Identifier" ? declId.name : void 0
|
|
19102
|
-
};
|
|
19103
|
-
ctx.bindingMetadata[modelName] = "props";
|
|
19097
|
+
let optionsString = options && ctx.getString(options);
|
|
19104
19098
|
let runtimeOptions = "";
|
|
19099
|
+
let transformOptions = "";
|
|
19105
19100
|
if (options) {
|
|
19106
19101
|
if (options.type === "ObjectExpression") {
|
|
19107
|
-
|
|
19108
|
-
|
|
19109
|
-
|
|
19110
|
-
|
|
19111
|
-
|
|
19112
|
-
} else {
|
|
19113
|
-
for (const p of options.properties) {
|
|
19114
|
-
if (p.type === "SpreadElement" || p.computed) {
|
|
19115
|
-
runtimeOptions = optionsString;
|
|
19116
|
-
break;
|
|
19117
|
-
}
|
|
19102
|
+
for (let i = options.properties.length - 1; i >= 0; i--) {
|
|
19103
|
+
const p = options.properties[i];
|
|
19104
|
+
if (p.type === "SpreadElement" || p.computed) {
|
|
19105
|
+
runtimeOptions = optionsString;
|
|
19106
|
+
break;
|
|
19118
19107
|
}
|
|
19108
|
+
if ((p.type === "ObjectProperty" || p.type === "ObjectMethod") && (p.key.type === "Identifier" && (p.key.name === "get" || p.key.name === "set") || p.key.type === "StringLiteral" && (p.key.value === "get" || p.key.value === "set"))) {
|
|
19109
|
+
transformOptions = ctx.getString(p) + ", " + transformOptions;
|
|
19110
|
+
const offset = p.start - options.start;
|
|
19111
|
+
const next = options.properties[i + 1];
|
|
19112
|
+
const end = (next ? next.start : options.end - 1) - options.start;
|
|
19113
|
+
optionsString = optionsString.slice(0, offset) + optionsString.slice(end);
|
|
19114
|
+
}
|
|
19115
|
+
}
|
|
19116
|
+
if (!runtimeOptions && transformOptions) {
|
|
19117
|
+
runtimeOptions = `{ ${transformOptions} }`;
|
|
19119
19118
|
}
|
|
19120
19119
|
} else {
|
|
19121
19120
|
runtimeOptions = optionsString;
|
|
19122
19121
|
}
|
|
19123
19122
|
}
|
|
19123
|
+
ctx.modelDecls[modelName] = {
|
|
19124
|
+
type,
|
|
19125
|
+
options: optionsString,
|
|
19126
|
+
identifier: declId && declId.type === "Identifier" ? declId.name : void 0
|
|
19127
|
+
};
|
|
19128
|
+
ctx.bindingMetadata[modelName] = "props";
|
|
19124
19129
|
ctx.s.overwrite(
|
|
19125
19130
|
ctx.startOffset + node.start,
|
|
19126
19131
|
ctx.startOffset + node.end,
|
|
@@ -19158,6 +19163,11 @@ function genModelProps(ctx) {
|
|
|
19158
19163
|
}
|
|
19159
19164
|
modelPropsDecl += `
|
|
19160
19165
|
${JSON.stringify(name)}: ${decl},`;
|
|
19166
|
+
const modifierPropName = JSON.stringify(
|
|
19167
|
+
name === "modelValue" ? `modelModifiers` : `${name}Modifiers`
|
|
19168
|
+
);
|
|
19169
|
+
modelPropsDecl += `
|
|
19170
|
+
${modifierPropName}: {},`;
|
|
19161
19171
|
}
|
|
19162
19172
|
return `{${modelPropsDecl}
|
|
19163
19173
|
}`;
|
|
@@ -20567,7 +20577,7 @@ function isStaticNode(node) {
|
|
|
20567
20577
|
return false;
|
|
20568
20578
|
}
|
|
20569
20579
|
|
|
20570
|
-
const version = "3.4.0-rc.
|
|
20580
|
+
const version = "3.4.0-rc.3";
|
|
20571
20581
|
const parseCache = parseCache$1;
|
|
20572
20582
|
const errorMessages = {
|
|
20573
20583
|
...CompilerDOM.errorMessages,
|
package/dist/compiler-sfc.d.ts
CHANGED
|
@@ -221,7 +221,7 @@ export interface SFCParseResult {
|
|
|
221
221
|
descriptor: SFCDescriptor;
|
|
222
222
|
errors: (CompilerError | SyntaxError)[];
|
|
223
223
|
}
|
|
224
|
-
export declare function parse(source: string, { sourceMap, filename, sourceRoot, pad, ignoreEmpty, compiler, parseExpressions }?: SFCParseOptions): SFCParseResult;
|
|
224
|
+
export declare function parse(source: string, { sourceMap, filename, sourceRoot, pad, ignoreEmpty, compiler, parseExpressions, }?: SFCParseOptions): SFCParseResult;
|
|
225
225
|
|
|
226
226
|
type PreprocessLang = 'less' | 'sass' | 'scss' | 'styl' | 'stylus';
|
|
227
227
|
|
|
@@ -18752,7 +18752,6 @@ function createRootCodegen(root, context) {
|
|
|
18752
18752
|
true,
|
|
18753
18753
|
void 0,
|
|
18754
18754
|
false
|
|
18755
|
-
/* isComponent */
|
|
18756
18755
|
);
|
|
18757
18756
|
} else ;
|
|
18758
18757
|
}
|
|
@@ -22264,7 +22263,7 @@ function createCodegenContext(ast, {
|
|
|
22264
22263
|
generatedLine: context.line,
|
|
22265
22264
|
generatedColumn: context.column - 1,
|
|
22266
22265
|
source: filename,
|
|
22267
|
-
// @ts-
|
|
22266
|
+
// @ts-expect-error it is possible to be null
|
|
22268
22267
|
name
|
|
22269
22268
|
});
|
|
22270
22269
|
}
|
|
@@ -23457,7 +23456,6 @@ const transformFor = createStructuralDirectiveTransform(
|
|
|
23457
23456
|
true,
|
|
23458
23457
|
void 0,
|
|
23459
23458
|
false
|
|
23460
|
-
/* isComponent */
|
|
23461
23459
|
);
|
|
23462
23460
|
} else {
|
|
23463
23461
|
childBlock = children[0].codegenNode;
|
|
@@ -23514,7 +23512,6 @@ const transformFor = createStructuralDirectiveTransform(
|
|
|
23514
23512
|
createForLoopParams(forNode.parseResult),
|
|
23515
23513
|
childBlock,
|
|
23516
23514
|
true
|
|
23517
|
-
/* force newline */
|
|
23518
23515
|
)
|
|
23519
23516
|
);
|
|
23520
23517
|
}
|
|
@@ -23772,13 +23769,15 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
23772
23769
|
createForLoopParams(parseResult),
|
|
23773
23770
|
buildDynamicSlot(slotName, slotFunction),
|
|
23774
23771
|
true
|
|
23775
|
-
/* force newline */
|
|
23776
23772
|
)
|
|
23777
23773
|
])
|
|
23778
23774
|
);
|
|
23779
23775
|
} else {
|
|
23780
23776
|
context.onError(
|
|
23781
|
-
createCompilerError(
|
|
23777
|
+
createCompilerError(
|
|
23778
|
+
32,
|
|
23779
|
+
vFor.loc
|
|
23780
|
+
)
|
|
23782
23781
|
);
|
|
23783
23782
|
}
|
|
23784
23783
|
} else {
|
|
@@ -26851,7 +26850,7 @@ function generateSourceMap(filename, source, generated, sourceRoot, lineOffset,
|
|
|
26851
26850
|
generatedLine,
|
|
26852
26851
|
generatedColumn: i,
|
|
26853
26852
|
source: filename,
|
|
26854
|
-
// @ts-
|
|
26853
|
+
// @ts-expect-error
|
|
26855
26854
|
name: null
|
|
26856
26855
|
});
|
|
26857
26856
|
}
|
|
@@ -31367,7 +31366,6 @@ const ssrTransformElement = (node, context) => {
|
|
|
31367
31366
|
false,
|
|
31368
31367
|
false,
|
|
31369
31368
|
true
|
|
31370
|
-
/* ssr */
|
|
31371
31369
|
);
|
|
31372
31370
|
if (props || directives.length) {
|
|
31373
31371
|
const mergedProps = buildSSRProps(props, directives, context);
|
|
@@ -31503,7 +31501,6 @@ const ssrTransformElement = (node, context) => {
|
|
|
31503
31501
|
createSimpleExpression(" " + attrName, true),
|
|
31504
31502
|
createSimpleExpression("", true),
|
|
31505
31503
|
false
|
|
31506
|
-
/* no newline */
|
|
31507
31504
|
)
|
|
31508
31505
|
);
|
|
31509
31506
|
} else if (isSSRSafeAttrName(attrName)) {
|
|
@@ -31649,7 +31646,6 @@ function ssrTransformTransitionGroup(node, context) {
|
|
|
31649
31646
|
true,
|
|
31650
31647
|
false,
|
|
31651
31648
|
true
|
|
31652
|
-
/* ssr (skip event listeners) */
|
|
31653
31649
|
);
|
|
31654
31650
|
let propsExp = null;
|
|
31655
31651
|
if (props || directives.length) {
|
|
@@ -31872,7 +31868,6 @@ function ssrProcessComponent(node, context, parent) {
|
|
|
31872
31868
|
context,
|
|
31873
31869
|
false,
|
|
31874
31870
|
true
|
|
31875
|
-
/* withSlotScopeId */
|
|
31876
31871
|
),
|
|
31877
31872
|
vnodeBranch
|
|
31878
31873
|
);
|
|
@@ -32078,7 +32073,9 @@ function processChildren(parent, context, asFragment = false, disableNestedFragm
|
|
|
32078
32073
|
break;
|
|
32079
32074
|
case 5:
|
|
32080
32075
|
context.pushStringPart(
|
|
32081
|
-
createCallExpression(context.helper(SSR_INTERPOLATE), [
|
|
32076
|
+
createCallExpression(context.helper(SSR_INTERPOLATE), [
|
|
32077
|
+
child.content
|
|
32078
|
+
])
|
|
32082
32079
|
);
|
|
32083
32080
|
break;
|
|
32084
32081
|
case 9:
|
|
@@ -32148,7 +32145,6 @@ const ssrTransformModel = (dir, node, context) => {
|
|
|
32148
32145
|
createSimpleExpression(" selected", true),
|
|
32149
32146
|
createSimpleExpression("", true),
|
|
32150
32147
|
false
|
|
32151
|
-
/* no newline */
|
|
32152
32148
|
)
|
|
32153
32149
|
);
|
|
32154
32150
|
}
|
|
@@ -32283,7 +32279,6 @@ const ssrTransformShow = (dir, node, context) => {
|
|
|
32283
32279
|
)
|
|
32284
32280
|
]),
|
|
32285
32281
|
false
|
|
32286
|
-
/* no newline */
|
|
32287
32282
|
)
|
|
32288
32283
|
)
|
|
32289
32284
|
]
|
|
@@ -45922,7 +45917,7 @@ function innerResolveTypeElements(ctx, node, scope, typeParameters) {
|
|
|
45922
45917
|
);
|
|
45923
45918
|
}
|
|
45924
45919
|
if (
|
|
45925
|
-
// @ts-
|
|
45920
|
+
// @ts-expect-error
|
|
45926
45921
|
SupportedBuiltinsSet.has(typeName)
|
|
45927
45922
|
) {
|
|
45928
45923
|
return resolveBuiltin(
|
|
@@ -46024,7 +46019,7 @@ function mergeElements(maps, type) {
|
|
|
46024
46019
|
baseProps[key].key,
|
|
46025
46020
|
{
|
|
46026
46021
|
type,
|
|
46027
|
-
// @ts-
|
|
46022
|
+
// @ts-expect-error
|
|
46028
46023
|
types: [baseProps[key], props[key]]
|
|
46029
46024
|
},
|
|
46030
46025
|
baseProps[key]._ownerScope,
|
|
@@ -47069,33 +47064,38 @@ function processDefineModel(ctx, node, declId) {
|
|
|
47069
47064
|
if (ctx.modelDecls[modelName]) {
|
|
47070
47065
|
ctx.error(`duplicate model name ${JSON.stringify(modelName)}`, node);
|
|
47071
47066
|
}
|
|
47072
|
-
|
|
47073
|
-
ctx.modelDecls[modelName] = {
|
|
47074
|
-
type,
|
|
47075
|
-
options: optionsString,
|
|
47076
|
-
identifier: declId && declId.type === "Identifier" ? declId.name : void 0
|
|
47077
|
-
};
|
|
47078
|
-
ctx.bindingMetadata[modelName] = "props";
|
|
47067
|
+
let optionsString = options && ctx.getString(options);
|
|
47079
47068
|
let runtimeOptions = "";
|
|
47069
|
+
let transformOptions = "";
|
|
47080
47070
|
if (options) {
|
|
47081
47071
|
if (options.type === "ObjectExpression") {
|
|
47082
|
-
|
|
47083
|
-
|
|
47084
|
-
|
|
47085
|
-
|
|
47086
|
-
|
|
47087
|
-
|
|
47088
|
-
|
|
47089
|
-
|
|
47090
|
-
|
|
47091
|
-
|
|
47092
|
-
|
|
47072
|
+
for (let i = options.properties.length - 1; i >= 0; i--) {
|
|
47073
|
+
const p = options.properties[i];
|
|
47074
|
+
if (p.type === "SpreadElement" || p.computed) {
|
|
47075
|
+
runtimeOptions = optionsString;
|
|
47076
|
+
break;
|
|
47077
|
+
}
|
|
47078
|
+
if ((p.type === "ObjectProperty" || p.type === "ObjectMethod") && (p.key.type === "Identifier" && (p.key.name === "get" || p.key.name === "set") || p.key.type === "StringLiteral" && (p.key.value === "get" || p.key.value === "set"))) {
|
|
47079
|
+
transformOptions = ctx.getString(p) + ", " + transformOptions;
|
|
47080
|
+
const offset = p.start - options.start;
|
|
47081
|
+
const next = options.properties[i + 1];
|
|
47082
|
+
const end = (next ? next.start : options.end - 1) - options.start;
|
|
47083
|
+
optionsString = optionsString.slice(0, offset) + optionsString.slice(end);
|
|
47093
47084
|
}
|
|
47094
47085
|
}
|
|
47086
|
+
if (!runtimeOptions && transformOptions) {
|
|
47087
|
+
runtimeOptions = `{ ${transformOptions} }`;
|
|
47088
|
+
}
|
|
47095
47089
|
} else {
|
|
47096
47090
|
runtimeOptions = optionsString;
|
|
47097
47091
|
}
|
|
47098
47092
|
}
|
|
47093
|
+
ctx.modelDecls[modelName] = {
|
|
47094
|
+
type,
|
|
47095
|
+
options: optionsString,
|
|
47096
|
+
identifier: declId && declId.type === "Identifier" ? declId.name : void 0
|
|
47097
|
+
};
|
|
47098
|
+
ctx.bindingMetadata[modelName] = "props";
|
|
47099
47099
|
ctx.s.overwrite(
|
|
47100
47100
|
ctx.startOffset + node.start,
|
|
47101
47101
|
ctx.startOffset + node.end,
|
|
@@ -47133,6 +47133,11 @@ function genModelProps(ctx) {
|
|
|
47133
47133
|
}
|
|
47134
47134
|
modelPropsDecl += `
|
|
47135
47135
|
${JSON.stringify(name)}: ${decl},`;
|
|
47136
|
+
const modifierPropName = JSON.stringify(
|
|
47137
|
+
name === "modelValue" ? `modelModifiers` : `${name}Modifiers`
|
|
47138
|
+
);
|
|
47139
|
+
modelPropsDecl += `
|
|
47140
|
+
${modifierPropName}: {},`;
|
|
47136
47141
|
}
|
|
47137
47142
|
return `{${modelPropsDecl}
|
|
47138
47143
|
}`;
|
|
@@ -48572,7 +48577,7 @@ var __spreadValues = (a, b) => {
|
|
|
48572
48577
|
}
|
|
48573
48578
|
return a;
|
|
48574
48579
|
};
|
|
48575
|
-
const version = "3.4.0-rc.
|
|
48580
|
+
const version = "3.4.0-rc.3";
|
|
48576
48581
|
const parseCache = parseCache$1;
|
|
48577
48582
|
const errorMessages = __spreadValues(__spreadValues({}, errorMessages$1), DOMErrorMessages);
|
|
48578
48583
|
const walk = walk$2;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/compiler-sfc",
|
|
3
|
-
"version": "3.4.0-rc.
|
|
3
|
+
"version": "3.4.0-rc.3",
|
|
4
4
|
"description": "@vue/compiler-sfc",
|
|
5
5
|
"main": "dist/compiler-sfc.cjs.js",
|
|
6
6
|
"module": "dist/compiler-sfc.esm-browser.js",
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"magic-string": "^0.30.5",
|
|
38
38
|
"postcss": "^8.4.32",
|
|
39
39
|
"source-map-js": "^1.0.2",
|
|
40
|
-
"@vue/compiler-
|
|
41
|
-
"@vue/compiler-
|
|
42
|
-
"@vue/
|
|
43
|
-
"@vue/
|
|
40
|
+
"@vue/compiler-dom": "3.4.0-rc.3",
|
|
41
|
+
"@vue/compiler-core": "3.4.0-rc.3",
|
|
42
|
+
"@vue/shared": "3.4.0-rc.3",
|
|
43
|
+
"@vue/compiler-ssr": "3.4.0-rc.3"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@babel/types": "^7.23.6",
|