@vue/compiler-sfc 3.4.3 → 3.4.5
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 -31
- package/dist/compiler-sfc.esm-browser.js +54 -36
- package/package.json +16 -7
package/dist/compiler-sfc.cjs.js
CHANGED
|
@@ -4274,6 +4274,7 @@ function doCompileTemplate({
|
|
|
4274
4274
|
}
|
|
4275
4275
|
if (inAST == null ? void 0 : inAST.transformed) {
|
|
4276
4276
|
const newAST = (ssr ? CompilerDOM__namespace : compiler).parse(inAST.source, {
|
|
4277
|
+
...compilerOptions,
|
|
4277
4278
|
parseMode: "sfc",
|
|
4278
4279
|
onError: (e) => errors.push(e)
|
|
4279
4280
|
});
|
|
@@ -11215,10 +11216,7 @@ const scss = (source, map, options, load = require) => {
|
|
|
11215
11216
|
if (map) {
|
|
11216
11217
|
return {
|
|
11217
11218
|
code: result.css.toString(),
|
|
11218
|
-
map: merge$1(
|
|
11219
|
-
map,
|
|
11220
|
-
result.map.toJSON ? result.map.toJSON() : JSON.parse(result.map.toString())
|
|
11221
|
-
),
|
|
11219
|
+
map: merge$1(map, JSON.parse(result.map.toString())),
|
|
11222
11220
|
errors: [],
|
|
11223
11221
|
dependencies
|
|
11224
11222
|
};
|
|
@@ -19100,7 +19098,8 @@ function processDefineModel(ctx, node, declId) {
|
|
|
19100
19098
|
let modelName;
|
|
19101
19099
|
let options;
|
|
19102
19100
|
const arg0 = node.arguments[0] && CompilerDOM.unwrapTSNode(node.arguments[0]);
|
|
19103
|
-
|
|
19101
|
+
const hasName = arg0 && arg0.type === "StringLiteral";
|
|
19102
|
+
if (hasName) {
|
|
19104
19103
|
modelName = arg0.value;
|
|
19105
19104
|
options = node.arguments[1];
|
|
19106
19105
|
} else {
|
|
@@ -19111,29 +19110,27 @@ function processDefineModel(ctx, node, declId) {
|
|
|
19111
19110
|
ctx.error(`duplicate model name ${JSON.stringify(modelName)}`, node);
|
|
19112
19111
|
}
|
|
19113
19112
|
let optionsString = options && ctx.getString(options);
|
|
19114
|
-
let
|
|
19115
|
-
|
|
19116
|
-
|
|
19117
|
-
|
|
19118
|
-
|
|
19119
|
-
|
|
19120
|
-
|
|
19121
|
-
|
|
19122
|
-
|
|
19123
|
-
|
|
19124
|
-
|
|
19125
|
-
|
|
19126
|
-
|
|
19127
|
-
const next = options.properties[i + 1];
|
|
19128
|
-
const end = (next ? next.start : options.end - 1) - options.start;
|
|
19129
|
-
optionsString = optionsString.slice(0, offset) + optionsString.slice(end);
|
|
19130
|
-
}
|
|
19131
|
-
}
|
|
19132
|
-
if (!runtimeOptions && transformOptions) {
|
|
19133
|
-
runtimeOptions = `{ ${transformOptions} }`;
|
|
19113
|
+
let optionsRemoved = !options;
|
|
19114
|
+
if (options && options.type === "ObjectExpression" && !options.properties.some((p) => p.type === "SpreadElement" || p.computed)) {
|
|
19115
|
+
let removed = 0;
|
|
19116
|
+
for (let i = options.properties.length - 1; i >= 0; i--) {
|
|
19117
|
+
const p = options.properties[i];
|
|
19118
|
+
const next = options.properties[i + 1];
|
|
19119
|
+
const start = p.start;
|
|
19120
|
+
const end = next ? next.start : options.end - 1;
|
|
19121
|
+
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"))) {
|
|
19122
|
+
optionsString = optionsString.slice(0, start - options.start) + optionsString.slice(end - options.start);
|
|
19123
|
+
} else {
|
|
19124
|
+
removed++;
|
|
19125
|
+
ctx.s.remove(ctx.startOffset + start, ctx.startOffset + end);
|
|
19134
19126
|
}
|
|
19135
|
-
}
|
|
19136
|
-
|
|
19127
|
+
}
|
|
19128
|
+
if (removed === options.properties.length) {
|
|
19129
|
+
optionsRemoved = true;
|
|
19130
|
+
ctx.s.remove(
|
|
19131
|
+
ctx.startOffset + (hasName ? arg0.end : options.start),
|
|
19132
|
+
ctx.startOffset + options.end
|
|
19133
|
+
);
|
|
19137
19134
|
}
|
|
19138
19135
|
}
|
|
19139
19136
|
ctx.modelDecls[modelName] = {
|
|
@@ -19143,9 +19140,13 @@ function processDefineModel(ctx, node, declId) {
|
|
|
19143
19140
|
};
|
|
19144
19141
|
ctx.bindingMetadata[modelName] = "props";
|
|
19145
19142
|
ctx.s.overwrite(
|
|
19146
|
-
ctx.startOffset + node.start,
|
|
19147
|
-
ctx.startOffset + node.end,
|
|
19148
|
-
|
|
19143
|
+
ctx.startOffset + node.callee.start,
|
|
19144
|
+
ctx.startOffset + node.callee.end,
|
|
19145
|
+
ctx.helper("useModel")
|
|
19146
|
+
);
|
|
19147
|
+
ctx.s.appendLeft(
|
|
19148
|
+
ctx.startOffset + (node.arguments.length ? node.arguments[0].start : node.end - 1),
|
|
19149
|
+
`__props, ` + (hasName ? `` : `${JSON.stringify(modelName)}${optionsRemoved ? `` : `, `}`)
|
|
19149
19150
|
);
|
|
19150
19151
|
return true;
|
|
19151
19152
|
}
|
|
@@ -20593,7 +20594,7 @@ function isStaticNode(node) {
|
|
|
20593
20594
|
return false;
|
|
20594
20595
|
}
|
|
20595
20596
|
|
|
20596
|
-
const version = "3.4.
|
|
20597
|
+
const version = "3.4.5";
|
|
20597
20598
|
const parseCache = parseCache$1;
|
|
20598
20599
|
const errorMessages = {
|
|
20599
20600
|
...CompilerDOM.errorMessages,
|
|
@@ -17098,6 +17098,18 @@ function isInDestructureAssignment(parent, parentStack) {
|
|
|
17098
17098
|
}
|
|
17099
17099
|
return false;
|
|
17100
17100
|
}
|
|
17101
|
+
function isInNewExpression(parentStack) {
|
|
17102
|
+
let i = parentStack.length;
|
|
17103
|
+
while (i--) {
|
|
17104
|
+
const p = parentStack[i];
|
|
17105
|
+
if (p.type === "NewExpression") {
|
|
17106
|
+
return true;
|
|
17107
|
+
} else if (p.type !== "MemberExpression") {
|
|
17108
|
+
break;
|
|
17109
|
+
}
|
|
17110
|
+
}
|
|
17111
|
+
return false;
|
|
17112
|
+
}
|
|
17101
17113
|
function walkFunctionParams(node, onIdent) {
|
|
17102
17114
|
for (const p of node.params) {
|
|
17103
17115
|
for (const id of extractIdentifiers$1(p)) {
|
|
@@ -22974,12 +22986,17 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
22974
22986
|
const isAssignmentLVal = parent && parent.type === "AssignmentExpression" && parent.left === id;
|
|
22975
22987
|
const isUpdateArg = parent && parent.type === "UpdateExpression" && parent.argument === id;
|
|
22976
22988
|
const isDestructureAssignment = parent && isInDestructureAssignment(parent, parentStack);
|
|
22989
|
+
const isNewExpression = parent && isInNewExpression(parentStack);
|
|
22990
|
+
const wrapWithUnref = (raw2) => {
|
|
22991
|
+
const wrapped = `${context.helperString(UNREF)}(${raw2})`;
|
|
22992
|
+
return isNewExpression ? `(${wrapped})` : wrapped;
|
|
22993
|
+
};
|
|
22977
22994
|
if (isConst(type) || type === "setup-reactive-const" || localVars[raw]) {
|
|
22978
22995
|
return raw;
|
|
22979
22996
|
} else if (type === "setup-ref") {
|
|
22980
22997
|
return `${raw}.value`;
|
|
22981
22998
|
} else if (type === "setup-maybe-ref") {
|
|
22982
|
-
return isAssignmentLVal || isUpdateArg || isDestructureAssignment ? `${raw}.value` :
|
|
22999
|
+
return isAssignmentLVal || isUpdateArg || isDestructureAssignment ? `${raw}.value` : wrapWithUnref(raw);
|
|
22983
23000
|
} else if (type === "setup-let") {
|
|
22984
23001
|
if (isAssignmentLVal) {
|
|
22985
23002
|
const { right: rVal, operator } = parent;
|
|
@@ -23006,7 +23023,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
23006
23023
|
} else if (isDestructureAssignment) {
|
|
23007
23024
|
return raw;
|
|
23008
23025
|
} else {
|
|
23009
|
-
return
|
|
23026
|
+
return wrapWithUnref(raw);
|
|
23010
23027
|
}
|
|
23011
23028
|
} else if (type === "props") {
|
|
23012
23029
|
return genPropsAccessExp(raw);
|
|
@@ -25796,6 +25813,7 @@ var CompilerDOM = /*#__PURE__*/Object.freeze({
|
|
|
25796
25813
|
isCoreComponent: isCoreComponent,
|
|
25797
25814
|
isFunctionType: isFunctionType,
|
|
25798
25815
|
isInDestructureAssignment: isInDestructureAssignment,
|
|
25816
|
+
isInNewExpression: isInNewExpression,
|
|
25799
25817
|
isMemberExpression: isMemberExpression,
|
|
25800
25818
|
isMemberExpressionBrowser: isMemberExpressionBrowser,
|
|
25801
25819
|
isMemberExpressionNode: isMemberExpressionNode,
|
|
@@ -31986,7 +32004,7 @@ function subTransform(node, options, parentContext) {
|
|
|
31986
32004
|
function clone(v) {
|
|
31987
32005
|
if (isArray$3(v)) {
|
|
31988
32006
|
return v.map(clone);
|
|
31989
|
-
} else if (
|
|
32007
|
+
} else if (isPlainObject(v)) {
|
|
31990
32008
|
const res = {};
|
|
31991
32009
|
for (const key in v) {
|
|
31992
32010
|
res[key] = clone(v[key]);
|
|
@@ -32631,10 +32649,10 @@ function doCompileTemplate({
|
|
|
32631
32649
|
inAST = void 0;
|
|
32632
32650
|
}
|
|
32633
32651
|
if (inAST == null ? void 0 : inAST.transformed) {
|
|
32634
|
-
const newAST = (ssr ? CompilerDOM : compiler).parse(inAST.source, {
|
|
32652
|
+
const newAST = (ssr ? CompilerDOM : compiler).parse(inAST.source, __spreadProps$5(__spreadValues$6({}, compilerOptions), {
|
|
32635
32653
|
parseMode: "sfc",
|
|
32636
32654
|
onError: (e) => errors.push(e)
|
|
32637
|
-
});
|
|
32655
|
+
}));
|
|
32638
32656
|
const template = newAST.children.find(
|
|
32639
32657
|
(node) => node.type === 1 && node.tag === "template"
|
|
32640
32658
|
);
|
|
@@ -43978,10 +43996,7 @@ const scss = (source, map, options, load = require) => {
|
|
|
43978
43996
|
if (map) {
|
|
43979
43997
|
return {
|
|
43980
43998
|
code: result.css.toString(),
|
|
43981
|
-
map: merge$1(
|
|
43982
|
-
map,
|
|
43983
|
-
result.map.toJSON ? result.map.toJSON() : JSON.parse(result.map.toString())
|
|
43984
|
-
),
|
|
43999
|
+
map: merge$1(map, JSON.parse(result.map.toString())),
|
|
43985
44000
|
errors: [],
|
|
43986
44001
|
dependencies
|
|
43987
44002
|
};
|
|
@@ -47089,7 +47104,8 @@ function processDefineModel(ctx, node, declId) {
|
|
|
47089
47104
|
let modelName;
|
|
47090
47105
|
let options;
|
|
47091
47106
|
const arg0 = node.arguments[0] && unwrapTSNode(node.arguments[0]);
|
|
47092
|
-
|
|
47107
|
+
const hasName = arg0 && arg0.type === "StringLiteral";
|
|
47108
|
+
if (hasName) {
|
|
47093
47109
|
modelName = arg0.value;
|
|
47094
47110
|
options = node.arguments[1];
|
|
47095
47111
|
} else {
|
|
@@ -47100,29 +47116,27 @@ function processDefineModel(ctx, node, declId) {
|
|
|
47100
47116
|
ctx.error(`duplicate model name ${JSON.stringify(modelName)}`, node);
|
|
47101
47117
|
}
|
|
47102
47118
|
let optionsString = options && ctx.getString(options);
|
|
47103
|
-
let
|
|
47104
|
-
|
|
47105
|
-
|
|
47106
|
-
|
|
47107
|
-
|
|
47108
|
-
|
|
47109
|
-
|
|
47110
|
-
|
|
47111
|
-
|
|
47112
|
-
|
|
47113
|
-
|
|
47114
|
-
|
|
47115
|
-
|
|
47116
|
-
const next = options.properties[i + 1];
|
|
47117
|
-
const end = (next ? next.start : options.end - 1) - options.start;
|
|
47118
|
-
optionsString = optionsString.slice(0, offset) + optionsString.slice(end);
|
|
47119
|
-
}
|
|
47120
|
-
}
|
|
47121
|
-
if (!runtimeOptions && transformOptions) {
|
|
47122
|
-
runtimeOptions = `{ ${transformOptions} }`;
|
|
47119
|
+
let optionsRemoved = !options;
|
|
47120
|
+
if (options && options.type === "ObjectExpression" && !options.properties.some((p) => p.type === "SpreadElement" || p.computed)) {
|
|
47121
|
+
let removed = 0;
|
|
47122
|
+
for (let i = options.properties.length - 1; i >= 0; i--) {
|
|
47123
|
+
const p = options.properties[i];
|
|
47124
|
+
const next = options.properties[i + 1];
|
|
47125
|
+
const start = p.start;
|
|
47126
|
+
const end = next ? next.start : options.end - 1;
|
|
47127
|
+
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"))) {
|
|
47128
|
+
optionsString = optionsString.slice(0, start - options.start) + optionsString.slice(end - options.start);
|
|
47129
|
+
} else {
|
|
47130
|
+
removed++;
|
|
47131
|
+
ctx.s.remove(ctx.startOffset + start, ctx.startOffset + end);
|
|
47123
47132
|
}
|
|
47124
|
-
}
|
|
47125
|
-
|
|
47133
|
+
}
|
|
47134
|
+
if (removed === options.properties.length) {
|
|
47135
|
+
optionsRemoved = true;
|
|
47136
|
+
ctx.s.remove(
|
|
47137
|
+
ctx.startOffset + (hasName ? arg0.end : options.start),
|
|
47138
|
+
ctx.startOffset + options.end
|
|
47139
|
+
);
|
|
47126
47140
|
}
|
|
47127
47141
|
}
|
|
47128
47142
|
ctx.modelDecls[modelName] = {
|
|
@@ -47132,9 +47146,13 @@ function processDefineModel(ctx, node, declId) {
|
|
|
47132
47146
|
};
|
|
47133
47147
|
ctx.bindingMetadata[modelName] = "props";
|
|
47134
47148
|
ctx.s.overwrite(
|
|
47135
|
-
ctx.startOffset + node.start,
|
|
47136
|
-
ctx.startOffset + node.end,
|
|
47137
|
-
|
|
47149
|
+
ctx.startOffset + node.callee.start,
|
|
47150
|
+
ctx.startOffset + node.callee.end,
|
|
47151
|
+
ctx.helper("useModel")
|
|
47152
|
+
);
|
|
47153
|
+
ctx.s.appendLeft(
|
|
47154
|
+
ctx.startOffset + (node.arguments.length ? node.arguments[0].start : node.end - 1),
|
|
47155
|
+
`__props, ` + (hasName ? `` : `${JSON.stringify(modelName)}${optionsRemoved ? `` : `, `}`)
|
|
47138
47156
|
);
|
|
47139
47157
|
return true;
|
|
47140
47158
|
}
|
|
@@ -48612,7 +48630,7 @@ var __spreadValues = (a, b) => {
|
|
|
48612
48630
|
}
|
|
48613
48631
|
return a;
|
|
48614
48632
|
};
|
|
48615
|
-
const version = "3.4.
|
|
48633
|
+
const version = "3.4.5";
|
|
48616
48634
|
const parseCache = parseCache$1;
|
|
48617
48635
|
const errorMessages = __spreadValues(__spreadValues({}, errorMessages$1), DOMErrorMessages);
|
|
48618
48636
|
const walk = walk$2;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/compiler-sfc",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.5",
|
|
4
4
|
"description": "@vue/compiler-sfc",
|
|
5
5
|
"main": "dist/compiler-sfc.cjs.js",
|
|
6
6
|
"module": "dist/compiler-sfc.esm-browser.js",
|
|
@@ -8,6 +8,15 @@
|
|
|
8
8
|
"files": [
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/compiler-sfc.d.ts",
|
|
14
|
+
"node": "./dist/compiler-sfc.cjs.js",
|
|
15
|
+
"import": "./dist/compiler-sfc.esm-browser.js",
|
|
16
|
+
"require": "./dist/compiler-sfc.cjs.js"
|
|
17
|
+
},
|
|
18
|
+
"./*": "./*"
|
|
19
|
+
},
|
|
11
20
|
"buildOptions": {
|
|
12
21
|
"name": "VueCompilerSFC",
|
|
13
22
|
"formats": [
|
|
@@ -37,10 +46,10 @@
|
|
|
37
46
|
"magic-string": "^0.30.5",
|
|
38
47
|
"postcss": "^8.4.32",
|
|
39
48
|
"source-map-js": "^1.0.2",
|
|
40
|
-
"@vue/compiler-core": "3.4.
|
|
41
|
-
"@vue/compiler-ssr": "3.4.
|
|
42
|
-
"@vue/compiler-dom": "3.4.
|
|
43
|
-
"@vue/shared": "3.4.
|
|
49
|
+
"@vue/compiler-core": "3.4.5",
|
|
50
|
+
"@vue/compiler-ssr": "3.4.5",
|
|
51
|
+
"@vue/compiler-dom": "3.4.5",
|
|
52
|
+
"@vue/shared": "3.4.5"
|
|
44
53
|
},
|
|
45
54
|
"devDependencies": {
|
|
46
55
|
"@babel/types": "^7.23.6",
|
|
@@ -50,8 +59,8 @@
|
|
|
50
59
|
"merge-source-map": "^1.1.0",
|
|
51
60
|
"minimatch": "^9.0.3",
|
|
52
61
|
"postcss-modules": "^6.0.0",
|
|
53
|
-
"postcss-selector-parser": "^6.0.
|
|
62
|
+
"postcss-selector-parser": "^6.0.15",
|
|
54
63
|
"pug": "^3.0.2",
|
|
55
|
-
"sass": "^1.69.
|
|
64
|
+
"sass": "^1.69.7"
|
|
56
65
|
}
|
|
57
66
|
}
|