@vue/compiler-sfc 3.3.9 → 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.
- package/dist/compiler-sfc.cjs.js +194 -49
- package/dist/compiler-sfc.d.ts +1 -1
- package/dist/compiler-sfc.esm-browser.js +173 -52
- package/package.json +10 -10
package/dist/compiler-sfc.cjs.js
CHANGED
|
@@ -94,8 +94,11 @@ function getEscapedPropName(key) {
|
|
|
94
94
|
return propNameEscapeSymbolsRE.test(key) ? JSON.stringify(key) : key;
|
|
95
95
|
}
|
|
96
96
|
const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
|
|
97
|
-
function getEscapedCssVarName(key) {
|
|
98
|
-
return key.replace(
|
|
97
|
+
function getEscapedCssVarName(key, doubleEscape) {
|
|
98
|
+
return key.replace(
|
|
99
|
+
cssVarNameEscapeSymbolsRE,
|
|
100
|
+
(s) => doubleEscape ? `\\\\${s}` : `\\${s}`
|
|
101
|
+
);
|
|
99
102
|
}
|
|
100
103
|
|
|
101
104
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
@@ -178,15 +181,15 @@ const CSS_VARS_HELPER = `useCssVars`;
|
|
|
178
181
|
function genCssVarsFromList(vars, id, isProd, isSSR = false) {
|
|
179
182
|
return `{
|
|
180
183
|
${vars.map(
|
|
181
|
-
(key) => `"${isSSR ? `--` : ``}${genVarName(id, key, isProd)}": (${key})`
|
|
184
|
+
(key) => `"${isSSR ? `--` : ``}${genVarName(id, key, isProd, isSSR)}": (${key})`
|
|
182
185
|
).join(",\n ")}
|
|
183
186
|
}`;
|
|
184
187
|
}
|
|
185
|
-
function genVarName(id, raw, isProd) {
|
|
188
|
+
function genVarName(id, raw, isProd, isSSR = false) {
|
|
186
189
|
if (isProd) {
|
|
187
190
|
return hash$1(id + raw);
|
|
188
191
|
} else {
|
|
189
|
-
return `${id}-${getEscapedCssVarName(raw)}`;
|
|
192
|
+
return `${id}-${getEscapedCssVarName(raw, isSSR)}`;
|
|
190
193
|
}
|
|
191
194
|
}
|
|
192
195
|
function normalizeExpression(exp) {
|
|
@@ -1041,6 +1044,37 @@ class LRUCache {
|
|
|
1041
1044
|
}
|
|
1042
1045
|
return deleted;
|
|
1043
1046
|
}
|
|
1047
|
+
/**
|
|
1048
|
+
* Get the extended info about a given entry, to get its value, size, and
|
|
1049
|
+
* TTL info simultaneously. Like {@link LRUCache#dump}, but just for a
|
|
1050
|
+
* single key. Always returns stale values, if their info is found in the
|
|
1051
|
+
* cache, so be sure to check for expired TTLs if relevant.
|
|
1052
|
+
*/
|
|
1053
|
+
info(key) {
|
|
1054
|
+
const i = this.#keyMap.get(key);
|
|
1055
|
+
if (i === undefined)
|
|
1056
|
+
return undefined;
|
|
1057
|
+
const v = this.#valList[i];
|
|
1058
|
+
const value = this.#isBackgroundFetch(v)
|
|
1059
|
+
? v.__staleWhileFetching
|
|
1060
|
+
: v;
|
|
1061
|
+
if (value === undefined)
|
|
1062
|
+
return undefined;
|
|
1063
|
+
const entry = { value };
|
|
1064
|
+
if (this.#ttls && this.#starts) {
|
|
1065
|
+
const ttl = this.#ttls[i];
|
|
1066
|
+
const start = this.#starts[i];
|
|
1067
|
+
if (ttl && start) {
|
|
1068
|
+
const remain = ttl - (perf.now() - start);
|
|
1069
|
+
entry.ttl = remain;
|
|
1070
|
+
entry.start = Date.now();
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
if (this.#sizes) {
|
|
1074
|
+
entry.size = this.#sizes[i];
|
|
1075
|
+
}
|
|
1076
|
+
return entry;
|
|
1077
|
+
}
|
|
1044
1078
|
/**
|
|
1045
1079
|
* Return an array of [key, {@link LRUCache.Entry}] tuples which can be
|
|
1046
1080
|
* passed to cache.load()
|
|
@@ -1935,22 +1969,29 @@ function parse$2(source, {
|
|
|
1935
1969
|
descriptor.script = null;
|
|
1936
1970
|
}
|
|
1937
1971
|
}
|
|
1972
|
+
let templateColumnOffset = 0;
|
|
1973
|
+
if (descriptor.template && (descriptor.template.lang === "pug" || descriptor.template.lang === "jade")) {
|
|
1974
|
+
[descriptor.template.content, templateColumnOffset] = dedent(
|
|
1975
|
+
descriptor.template.content
|
|
1976
|
+
);
|
|
1977
|
+
}
|
|
1938
1978
|
if (sourceMap) {
|
|
1939
|
-
const genMap = (block) => {
|
|
1979
|
+
const genMap = (block, columnOffset = 0) => {
|
|
1940
1980
|
if (block && !block.src) {
|
|
1941
1981
|
block.map = generateSourceMap(
|
|
1942
1982
|
filename,
|
|
1943
1983
|
source,
|
|
1944
1984
|
block.content,
|
|
1945
1985
|
sourceRoot,
|
|
1946
|
-
!pad || block.type === "template" ? block.loc.start.line - 1 : 0
|
|
1986
|
+
!pad || block.type === "template" ? block.loc.start.line - 1 : 0,
|
|
1987
|
+
columnOffset
|
|
1947
1988
|
);
|
|
1948
1989
|
}
|
|
1949
1990
|
};
|
|
1950
|
-
genMap(descriptor.template);
|
|
1991
|
+
genMap(descriptor.template, templateColumnOffset);
|
|
1951
1992
|
genMap(descriptor.script);
|
|
1952
|
-
descriptor.styles.forEach(genMap);
|
|
1953
|
-
descriptor.customBlocks.forEach(genMap);
|
|
1993
|
+
descriptor.styles.forEach((s) => genMap(s));
|
|
1994
|
+
descriptor.customBlocks.forEach((s) => genMap(s));
|
|
1954
1995
|
}
|
|
1955
1996
|
descriptor.cssVars = parseCssVars(descriptor);
|
|
1956
1997
|
const slottedRE = /(?:::v-|:)slotted\(/;
|
|
@@ -2028,7 +2069,7 @@ function createBlock(node, source, pad) {
|
|
|
2028
2069
|
const splitRE = /\r?\n/g;
|
|
2029
2070
|
const emptyRE = /^(?:\/\/)?\s*$/;
|
|
2030
2071
|
const replaceRE = /./g;
|
|
2031
|
-
function generateSourceMap(filename, source, generated, sourceRoot, lineOffset) {
|
|
2072
|
+
function generateSourceMap(filename, source, generated, sourceRoot, lineOffset, columnOffset) {
|
|
2032
2073
|
const map = new sourceMapJs.SourceMapGenerator({
|
|
2033
2074
|
file: filename.replace(/\\/g, "/"),
|
|
2034
2075
|
sourceRoot: sourceRoot.replace(/\\/g, "/")
|
|
@@ -2044,7 +2085,7 @@ function generateSourceMap(filename, source, generated, sourceRoot, lineOffset)
|
|
|
2044
2085
|
source: filename,
|
|
2045
2086
|
original: {
|
|
2046
2087
|
line: originalLine,
|
|
2047
|
-
column: i
|
|
2088
|
+
column: i + columnOffset
|
|
2048
2089
|
},
|
|
2049
2090
|
generated: {
|
|
2050
2091
|
line: generatedLine,
|
|
@@ -2095,6 +2136,26 @@ function hmrShouldReload(prevImports, next) {
|
|
|
2095
2136
|
}
|
|
2096
2137
|
return false;
|
|
2097
2138
|
}
|
|
2139
|
+
function dedent(s) {
|
|
2140
|
+
const lines = s.split("\n");
|
|
2141
|
+
const minIndent = lines.reduce(function(minIndent2, line) {
|
|
2142
|
+
var _a, _b;
|
|
2143
|
+
if (line.trim() === "") {
|
|
2144
|
+
return minIndent2;
|
|
2145
|
+
}
|
|
2146
|
+
const indent = ((_b = (_a = line.match(/^\s*/)) == null ? void 0 : _a[0]) == null ? void 0 : _b.length) || 0;
|
|
2147
|
+
return Math.min(indent, minIndent2);
|
|
2148
|
+
}, Infinity);
|
|
2149
|
+
if (minIndent === 0) {
|
|
2150
|
+
return [s, minIndent];
|
|
2151
|
+
}
|
|
2152
|
+
return [
|
|
2153
|
+
lines.map(function(line) {
|
|
2154
|
+
return line.slice(minIndent);
|
|
2155
|
+
}).join("\n"),
|
|
2156
|
+
minIndent
|
|
2157
|
+
];
|
|
2158
|
+
}
|
|
2098
2159
|
|
|
2099
2160
|
function isRelativeUrl(url) {
|
|
2100
2161
|
const firstChar = url.charAt(0);
|
|
@@ -7909,14 +7970,19 @@ function rewriteSelector(id, selector, selectorRoot, slotted = false) {
|
|
|
7909
7970
|
return false;
|
|
7910
7971
|
}
|
|
7911
7972
|
}
|
|
7912
|
-
if (n.type !== "pseudo" && n.type !== "combinator") {
|
|
7973
|
+
if (n.type !== "pseudo" && n.type !== "combinator" || n.type === "pseudo" && (n.value === ":is" || n.value === ":where")) {
|
|
7913
7974
|
node = n;
|
|
7914
7975
|
}
|
|
7915
|
-
|
|
7916
|
-
|
|
7976
|
+
});
|
|
7977
|
+
if (node) {
|
|
7978
|
+
const { type, value } = node;
|
|
7979
|
+
if (type === "pseudo" && (value === ":is" || value === ":where")) {
|
|
7980
|
+
node.nodes.forEach(
|
|
7981
|
+
(value2) => rewriteSelector(id, value2, selectorRoot, slotted)
|
|
7982
|
+
);
|
|
7917
7983
|
shouldInject = false;
|
|
7918
7984
|
}
|
|
7919
|
-
}
|
|
7985
|
+
}
|
|
7920
7986
|
if (node) {
|
|
7921
7987
|
node.spaces.after = "";
|
|
7922
7988
|
} else {
|
|
@@ -17743,33 +17809,39 @@ class TypeScope {
|
|
|
17743
17809
|
this.exportedDeclares = /* @__PURE__ */ Object.create(null);
|
|
17744
17810
|
}
|
|
17745
17811
|
}
|
|
17746
|
-
function resolveTypeElements(ctx, node, scope) {
|
|
17812
|
+
function resolveTypeElements(ctx, node, scope, typeParameters) {
|
|
17747
17813
|
if (node._resolvedElements) {
|
|
17748
17814
|
return node._resolvedElements;
|
|
17749
17815
|
}
|
|
17750
17816
|
return node._resolvedElements = innerResolveTypeElements(
|
|
17751
17817
|
ctx,
|
|
17752
17818
|
node,
|
|
17753
|
-
node._ownerScope || scope || ctxToScope(ctx)
|
|
17819
|
+
node._ownerScope || scope || ctxToScope(ctx),
|
|
17820
|
+
typeParameters
|
|
17754
17821
|
);
|
|
17755
17822
|
}
|
|
17756
|
-
function innerResolveTypeElements(ctx, node, scope) {
|
|
17823
|
+
function innerResolveTypeElements(ctx, node, scope, typeParameters) {
|
|
17757
17824
|
var _a, _b;
|
|
17758
17825
|
switch (node.type) {
|
|
17759
17826
|
case "TSTypeLiteral":
|
|
17760
|
-
return typeElementsToMap(ctx, node.members, scope);
|
|
17827
|
+
return typeElementsToMap(ctx, node.members, scope, typeParameters);
|
|
17761
17828
|
case "TSInterfaceDeclaration":
|
|
17762
|
-
return resolveInterfaceMembers(ctx, node, scope);
|
|
17829
|
+
return resolveInterfaceMembers(ctx, node, scope, typeParameters);
|
|
17763
17830
|
case "TSTypeAliasDeclaration":
|
|
17764
17831
|
case "TSParenthesizedType":
|
|
17765
|
-
return resolveTypeElements(
|
|
17832
|
+
return resolveTypeElements(
|
|
17833
|
+
ctx,
|
|
17834
|
+
node.typeAnnotation,
|
|
17835
|
+
scope,
|
|
17836
|
+
typeParameters
|
|
17837
|
+
);
|
|
17766
17838
|
case "TSFunctionType": {
|
|
17767
17839
|
return { props: {}, calls: [node] };
|
|
17768
17840
|
}
|
|
17769
17841
|
case "TSUnionType":
|
|
17770
17842
|
case "TSIntersectionType":
|
|
17771
17843
|
return mergeElements(
|
|
17772
|
-
node.types.map((t) => resolveTypeElements(ctx, t, scope)),
|
|
17844
|
+
node.types.map((t) => resolveTypeElements(ctx, t, scope, typeParameters)),
|
|
17773
17845
|
node.type
|
|
17774
17846
|
);
|
|
17775
17847
|
case "TSMappedType":
|
|
@@ -17786,20 +17858,53 @@ function innerResolveTypeElements(ctx, node, scope) {
|
|
|
17786
17858
|
const typeName = getReferenceName(node);
|
|
17787
17859
|
if ((typeName === "ExtractPropTypes" || typeName === "ExtractPublicPropTypes") && node.typeParameters && ((_a = scope.imports[typeName]) == null ? void 0 : _a.source) === "vue") {
|
|
17788
17860
|
return resolveExtractPropTypes(
|
|
17789
|
-
resolveTypeElements(
|
|
17861
|
+
resolveTypeElements(
|
|
17862
|
+
ctx,
|
|
17863
|
+
node.typeParameters.params[0],
|
|
17864
|
+
scope,
|
|
17865
|
+
typeParameters
|
|
17866
|
+
),
|
|
17790
17867
|
scope
|
|
17791
17868
|
);
|
|
17792
17869
|
}
|
|
17793
17870
|
const resolved = resolveTypeReference(ctx, node, scope);
|
|
17794
17871
|
if (resolved) {
|
|
17795
|
-
|
|
17872
|
+
const typeParams = /* @__PURE__ */ Object.create(null);
|
|
17873
|
+
if ((resolved.type === "TSTypeAliasDeclaration" || resolved.type === "TSInterfaceDeclaration") && resolved.typeParameters && node.typeParameters) {
|
|
17874
|
+
resolved.typeParameters.params.forEach((p, i) => {
|
|
17875
|
+
let param = typeParameters && typeParameters[p.name];
|
|
17876
|
+
if (!param)
|
|
17877
|
+
param = node.typeParameters.params[i];
|
|
17878
|
+
typeParams[p.name] = param;
|
|
17879
|
+
});
|
|
17880
|
+
}
|
|
17881
|
+
return resolveTypeElements(
|
|
17882
|
+
ctx,
|
|
17883
|
+
resolved,
|
|
17884
|
+
resolved._ownerScope,
|
|
17885
|
+
typeParams
|
|
17886
|
+
);
|
|
17796
17887
|
} else {
|
|
17797
17888
|
if (typeof typeName === "string") {
|
|
17889
|
+
if (typeParameters && typeParameters[typeName]) {
|
|
17890
|
+
return resolveTypeElements(
|
|
17891
|
+
ctx,
|
|
17892
|
+
typeParameters[typeName],
|
|
17893
|
+
scope,
|
|
17894
|
+
typeParameters
|
|
17895
|
+
);
|
|
17896
|
+
}
|
|
17798
17897
|
if (
|
|
17799
17898
|
// @ts-ignore
|
|
17800
17899
|
SupportedBuiltinsSet.has(typeName)
|
|
17801
17900
|
) {
|
|
17802
|
-
return resolveBuiltin(
|
|
17901
|
+
return resolveBuiltin(
|
|
17902
|
+
ctx,
|
|
17903
|
+
node,
|
|
17904
|
+
typeName,
|
|
17905
|
+
scope,
|
|
17906
|
+
typeParameters
|
|
17907
|
+
);
|
|
17803
17908
|
} else if (typeName === "ReturnType" && node.typeParameters) {
|
|
17804
17909
|
const ret = resolveReturnType(
|
|
17805
17910
|
ctx,
|
|
@@ -17848,10 +17953,14 @@ function innerResolveTypeElements(ctx, node, scope) {
|
|
|
17848
17953
|
}
|
|
17849
17954
|
return ctx.error(`Unresolvable type: ${node.type}`, node, scope);
|
|
17850
17955
|
}
|
|
17851
|
-
function typeElementsToMap(ctx, elements, scope = ctxToScope(ctx)) {
|
|
17956
|
+
function typeElementsToMap(ctx, elements, scope = ctxToScope(ctx), typeParameters) {
|
|
17852
17957
|
const res = { props: {} };
|
|
17853
17958
|
for (const e of elements) {
|
|
17854
17959
|
if (e.type === "TSPropertySignature" || e.type === "TSMethodSignature") {
|
|
17960
|
+
if (typeParameters) {
|
|
17961
|
+
scope = createChildScope(scope);
|
|
17962
|
+
Object.assign(scope.types, typeParameters);
|
|
17963
|
+
}
|
|
17855
17964
|
e._ownerScope = scope;
|
|
17856
17965
|
const name = getId(e.key);
|
|
17857
17966
|
if (name && !e.computed) {
|
|
@@ -17914,8 +18023,13 @@ function createProperty(key, typeAnnotation, scope, optional) {
|
|
|
17914
18023
|
_ownerScope: scope
|
|
17915
18024
|
};
|
|
17916
18025
|
}
|
|
17917
|
-
function resolveInterfaceMembers(ctx, node, scope) {
|
|
17918
|
-
const base = typeElementsToMap(
|
|
18026
|
+
function resolveInterfaceMembers(ctx, node, scope, typeParameters) {
|
|
18027
|
+
const base = typeElementsToMap(
|
|
18028
|
+
ctx,
|
|
18029
|
+
node.body.body,
|
|
18030
|
+
node._ownerScope,
|
|
18031
|
+
typeParameters
|
|
18032
|
+
);
|
|
17919
18033
|
if (node.extends) {
|
|
17920
18034
|
for (const ext of node.extends) {
|
|
17921
18035
|
if (ext.leadingComments && ext.leadingComments.some((c) => c.value.includes("@vue-ignore"))) {
|
|
@@ -18090,8 +18204,13 @@ const SupportedBuiltinsSet = /* @__PURE__ */ new Set([
|
|
|
18090
18204
|
"Pick",
|
|
18091
18205
|
"Omit"
|
|
18092
18206
|
]);
|
|
18093
|
-
function resolveBuiltin(ctx, node, name, scope) {
|
|
18094
|
-
const t = resolveTypeElements(
|
|
18207
|
+
function resolveBuiltin(ctx, node, name, scope, typeParameters) {
|
|
18208
|
+
const t = resolveTypeElements(
|
|
18209
|
+
ctx,
|
|
18210
|
+
node.typeParameters.params[0],
|
|
18211
|
+
scope,
|
|
18212
|
+
typeParameters
|
|
18213
|
+
);
|
|
18095
18214
|
switch (name) {
|
|
18096
18215
|
case "Partial": {
|
|
18097
18216
|
const res2 = { props: {}, calls: t.calls };
|
|
@@ -18219,7 +18338,21 @@ function resolveGlobalScope(ctx) {
|
|
|
18219
18338
|
let ts;
|
|
18220
18339
|
let loadTS;
|
|
18221
18340
|
function registerTS(_loadTS) {
|
|
18222
|
-
loadTS =
|
|
18341
|
+
loadTS = () => {
|
|
18342
|
+
try {
|
|
18343
|
+
return _loadTS();
|
|
18344
|
+
} catch (err) {
|
|
18345
|
+
if (typeof err.message === "string" && err.message.includes("Cannot find module")) {
|
|
18346
|
+
throw new Error(
|
|
18347
|
+
'Failed to load TypeScript, which is required for resolving imported types. Please make sure "typescript" is installed as a project dependency.'
|
|
18348
|
+
);
|
|
18349
|
+
} else {
|
|
18350
|
+
throw new Error(
|
|
18351
|
+
"Failed to load TypeScript for resolving imported types."
|
|
18352
|
+
);
|
|
18353
|
+
}
|
|
18354
|
+
}
|
|
18355
|
+
};
|
|
18223
18356
|
}
|
|
18224
18357
|
function resolveFS(ctx) {
|
|
18225
18358
|
if (ctx.fs) {
|
|
@@ -18253,7 +18386,12 @@ function resolveTypeFromImport(ctx, node, name, scope) {
|
|
|
18253
18386
|
return resolveTypeReference(ctx, node, sourceScope, imported, true);
|
|
18254
18387
|
}
|
|
18255
18388
|
function importSourceToScope(ctx, node, scope, source) {
|
|
18256
|
-
|
|
18389
|
+
let fs;
|
|
18390
|
+
try {
|
|
18391
|
+
fs = resolveFS(ctx);
|
|
18392
|
+
} catch (err) {
|
|
18393
|
+
return ctx.error(err.message, node, scope);
|
|
18394
|
+
}
|
|
18257
18395
|
if (!fs) {
|
|
18258
18396
|
return ctx.error(
|
|
18259
18397
|
`No fs option provided to \`compileScript\` in non-Node environment. File system access is required for resolving imported types.`,
|
|
@@ -18462,14 +18600,7 @@ function moduleDeclToScope(ctx, node, parentScope) {
|
|
|
18462
18600
|
if (node._resolvedChildScope) {
|
|
18463
18601
|
return node._resolvedChildScope;
|
|
18464
18602
|
}
|
|
18465
|
-
const scope =
|
|
18466
|
-
parentScope.filename,
|
|
18467
|
-
parentScope.source,
|
|
18468
|
-
parentScope.offset,
|
|
18469
|
-
Object.create(parentScope.imports),
|
|
18470
|
-
Object.create(parentScope.types),
|
|
18471
|
-
Object.create(parentScope.declares)
|
|
18472
|
-
);
|
|
18603
|
+
const scope = createChildScope(parentScope);
|
|
18473
18604
|
if (node.body.type === "TSModuleDeclaration") {
|
|
18474
18605
|
const decl = node.body;
|
|
18475
18606
|
decl._ownerScope = scope;
|
|
@@ -18480,6 +18611,16 @@ function moduleDeclToScope(ctx, node, parentScope) {
|
|
|
18480
18611
|
}
|
|
18481
18612
|
return node._resolvedChildScope = scope;
|
|
18482
18613
|
}
|
|
18614
|
+
function createChildScope(parentScope) {
|
|
18615
|
+
return new TypeScope(
|
|
18616
|
+
parentScope.filename,
|
|
18617
|
+
parentScope.source,
|
|
18618
|
+
parentScope.offset,
|
|
18619
|
+
Object.create(parentScope.imports),
|
|
18620
|
+
Object.create(parentScope.types),
|
|
18621
|
+
Object.create(parentScope.declares)
|
|
18622
|
+
);
|
|
18623
|
+
}
|
|
18483
18624
|
const importExportRE = /^Import|^Export/;
|
|
18484
18625
|
function recordTypes(ctx, body, scope, asGlobal = false) {
|
|
18485
18626
|
const { types, declares, exportedTypes, exportedDeclares, imports } = scope;
|
|
@@ -18601,7 +18742,7 @@ function recordType(node, types, declares, overwriteId) {
|
|
|
18601
18742
|
types[overwriteId || getId(node.id)] = node;
|
|
18602
18743
|
break;
|
|
18603
18744
|
case "TSTypeAliasDeclaration":
|
|
18604
|
-
types[node.id.name] = node.typeAnnotation;
|
|
18745
|
+
types[node.id.name] = node.typeParameters ? node : node.typeAnnotation;
|
|
18605
18746
|
break;
|
|
18606
18747
|
case "TSDeclareFunction":
|
|
18607
18748
|
if (node.id)
|
|
@@ -19141,7 +19282,7 @@ function genRuntimeProps(ctx) {
|
|
|
19141
19282
|
);
|
|
19142
19283
|
}
|
|
19143
19284
|
if (defaults.length) {
|
|
19144
|
-
propsDecls =
|
|
19285
|
+
propsDecls = `/*#__PURE__*/${ctx.helper(
|
|
19145
19286
|
`mergeDefaults`
|
|
19146
19287
|
)}(${propsDecls}, {
|
|
19147
19288
|
${defaults.join(",\n ")}
|
|
@@ -19153,7 +19294,9 @@ function genRuntimeProps(ctx) {
|
|
|
19153
19294
|
}
|
|
19154
19295
|
const modelsDecls = genModelProps(ctx);
|
|
19155
19296
|
if (propsDecls && modelsDecls) {
|
|
19156
|
-
return
|
|
19297
|
+
return `/*#__PURE__*/${ctx.helper(
|
|
19298
|
+
"mergeModels"
|
|
19299
|
+
)}(${propsDecls}, ${modelsDecls})`;
|
|
19157
19300
|
} else {
|
|
19158
19301
|
return modelsDecls || propsDecls;
|
|
19159
19302
|
}
|
|
@@ -19175,9 +19318,9 @@ function genRuntimePropsFromTypes(ctx) {
|
|
|
19175
19318
|
${propStrings.join(",\n ")}
|
|
19176
19319
|
}`;
|
|
19177
19320
|
if (ctx.propsRuntimeDefaults && !hasStaticDefaults) {
|
|
19178
|
-
propsDecls =
|
|
19179
|
-
|
|
19180
|
-
)})`;
|
|
19321
|
+
propsDecls = `/*#__PURE__*/${ctx.helper(
|
|
19322
|
+
"mergeDefaults"
|
|
19323
|
+
)}(${propsDecls}, ${ctx.getString(ctx.propsRuntimeDefaults)})`;
|
|
19181
19324
|
}
|
|
19182
19325
|
return propsDecls;
|
|
19183
19326
|
}
|
|
@@ -19514,7 +19657,9 @@ function genRuntimeEmits(ctx) {
|
|
|
19514
19657
|
}
|
|
19515
19658
|
if (ctx.hasDefineModelCall) {
|
|
19516
19659
|
let modelEmitsDecl = `[${Object.keys(ctx.modelDecls).map((n) => JSON.stringify(`update:${n}`)).join(", ")}]`;
|
|
19517
|
-
emitsDecl = emitsDecl ?
|
|
19660
|
+
emitsDecl = emitsDecl ? `/*#__PURE__*/${ctx.helper(
|
|
19661
|
+
"mergeModels"
|
|
19662
|
+
)}(${emitsDecl}, ${modelEmitsDecl})` : modelEmitsDecl;
|
|
19518
19663
|
}
|
|
19519
19664
|
return emitsDecl;
|
|
19520
19665
|
}
|
|
@@ -20484,7 +20629,7 @@ function isStaticNode(node) {
|
|
|
20484
20629
|
return false;
|
|
20485
20630
|
}
|
|
20486
20631
|
|
|
20487
|
-
const version = "3.3.
|
|
20632
|
+
const version = "3.3.10";
|
|
20488
20633
|
const parseCache = parseCache$1;
|
|
20489
20634
|
const walk = estreeWalker.walk;
|
|
20490
20635
|
|
package/dist/compiler-sfc.d.ts
CHANGED
|
@@ -455,7 +455,7 @@ interface ResolvedElements {
|
|
|
455
455
|
*/
|
|
456
456
|
export declare function resolveTypeElements(ctx: TypeResolveContext, node: Node & MaybeWithScope & {
|
|
457
457
|
_resolvedElements?: ResolvedElements;
|
|
458
|
-
}, scope?: TypeScope): ResolvedElements;
|
|
458
|
+
}, scope?: TypeScope, typeParameters?: Record<string, Node>): ResolvedElements;
|
|
459
459
|
/**
|
|
460
460
|
* @private
|
|
461
461
|
*/
|
|
@@ -11,8 +11,8 @@ const EMPTY_OBJ = Object.freeze({}) ;
|
|
|
11
11
|
const NOOP = () => {
|
|
12
12
|
};
|
|
13
13
|
const NO = () => false;
|
|
14
|
-
const
|
|
15
|
-
|
|
14
|
+
const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
|
|
15
|
+
(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
|
|
16
16
|
const extend = Object.assign;
|
|
17
17
|
const hasOwnProperty$3 = Object.prototype.hasOwnProperty;
|
|
18
18
|
const hasOwn = (val, key) => hasOwnProperty$3.call(val, key);
|
|
@@ -22483,6 +22483,10 @@ function resolveSetupReference(name, context) {
|
|
|
22483
22483
|
`${context.helperString(UNREF)}(${fromMaybeRef})`
|
|
22484
22484
|
) : `$setup[${JSON.stringify(fromMaybeRef)}]`;
|
|
22485
22485
|
}
|
|
22486
|
+
const fromProps = checkType("props");
|
|
22487
|
+
if (fromProps) {
|
|
22488
|
+
return `${context.helperString(UNREF)}(${context.inline ? "__props" : "$props"}[${JSON.stringify(fromProps)}])`;
|
|
22489
|
+
}
|
|
22486
22490
|
}
|
|
22487
22491
|
function buildProps(node, context, props = node.props, isComponent, isDynamicComponent, ssr = false) {
|
|
22488
22492
|
const { tag, loc: elementLoc, children } = node;
|
|
@@ -22523,6 +22527,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
22523
22527
|
if (isEventHandler && isReservedProp(name)) {
|
|
22524
22528
|
hasVnodeHook = true;
|
|
22525
22529
|
}
|
|
22530
|
+
if (isEventHandler && value.type === 14) {
|
|
22531
|
+
value = value.arguments[0];
|
|
22532
|
+
}
|
|
22526
22533
|
if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
|
|
22527
22534
|
return;
|
|
22528
22535
|
}
|
|
@@ -26842,8 +26849,11 @@ function getEscapedPropName(key) {
|
|
|
26842
26849
|
return propNameEscapeSymbolsRE.test(key) ? JSON.stringify(key) : key;
|
|
26843
26850
|
}
|
|
26844
26851
|
const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
|
|
26845
|
-
function getEscapedCssVarName(key) {
|
|
26846
|
-
return key.replace(
|
|
26852
|
+
function getEscapedCssVarName(key, doubleEscape) {
|
|
26853
|
+
return key.replace(
|
|
26854
|
+
cssVarNameEscapeSymbolsRE,
|
|
26855
|
+
(s) => doubleEscape ? `\\\\${s}` : `\\${s}`
|
|
26856
|
+
);
|
|
26847
26857
|
}
|
|
26848
26858
|
|
|
26849
26859
|
function pad$1 (hash, len) {
|
|
@@ -26920,15 +26930,15 @@ const CSS_VARS_HELPER = `useCssVars`;
|
|
|
26920
26930
|
function genCssVarsFromList(vars, id, isProd, isSSR = false) {
|
|
26921
26931
|
return `{
|
|
26922
26932
|
${vars.map(
|
|
26923
|
-
(key) => `"${isSSR ? `--` : ``}${genVarName(id, key, isProd)}": (${key})`
|
|
26933
|
+
(key) => `"${isSSR ? `--` : ``}${genVarName(id, key, isProd, isSSR)}": (${key})`
|
|
26924
26934
|
).join(",\n ")}
|
|
26925
26935
|
}`;
|
|
26926
26936
|
}
|
|
26927
|
-
function genVarName(id, raw, isProd) {
|
|
26937
|
+
function genVarName(id, raw, isProd, isSSR = false) {
|
|
26928
26938
|
if (isProd) {
|
|
26929
26939
|
return hash(id + raw);
|
|
26930
26940
|
} else {
|
|
26931
|
-
return `${id}-${getEscapedCssVarName(raw)}`;
|
|
26941
|
+
return `${id}-${getEscapedCssVarName(raw, isSSR)}`;
|
|
26932
26942
|
}
|
|
26933
26943
|
}
|
|
26934
26944
|
function normalizeExpression(exp) {
|
|
@@ -27516,22 +27526,29 @@ function parse$7(source, {
|
|
|
27516
27526
|
descriptor.script = null;
|
|
27517
27527
|
}
|
|
27518
27528
|
}
|
|
27529
|
+
let templateColumnOffset = 0;
|
|
27530
|
+
if (descriptor.template && (descriptor.template.lang === "pug" || descriptor.template.lang === "jade")) {
|
|
27531
|
+
[descriptor.template.content, templateColumnOffset] = dedent(
|
|
27532
|
+
descriptor.template.content
|
|
27533
|
+
);
|
|
27534
|
+
}
|
|
27519
27535
|
if (sourceMap) {
|
|
27520
|
-
const genMap = (block) => {
|
|
27536
|
+
const genMap = (block, columnOffset = 0) => {
|
|
27521
27537
|
if (block && !block.src) {
|
|
27522
27538
|
block.map = generateSourceMap(
|
|
27523
27539
|
filename,
|
|
27524
27540
|
source,
|
|
27525
27541
|
block.content,
|
|
27526
27542
|
sourceRoot,
|
|
27527
|
-
!pad || block.type === "template" ? block.loc.start.line - 1 : 0
|
|
27543
|
+
!pad || block.type === "template" ? block.loc.start.line - 1 : 0,
|
|
27544
|
+
columnOffset
|
|
27528
27545
|
);
|
|
27529
27546
|
}
|
|
27530
27547
|
};
|
|
27531
|
-
genMap(descriptor.template);
|
|
27548
|
+
genMap(descriptor.template, templateColumnOffset);
|
|
27532
27549
|
genMap(descriptor.script);
|
|
27533
|
-
descriptor.styles.forEach(genMap);
|
|
27534
|
-
descriptor.customBlocks.forEach(genMap);
|
|
27550
|
+
descriptor.styles.forEach((s) => genMap(s));
|
|
27551
|
+
descriptor.customBlocks.forEach((s) => genMap(s));
|
|
27535
27552
|
}
|
|
27536
27553
|
descriptor.cssVars = parseCssVars(descriptor);
|
|
27537
27554
|
const slottedRE = /(?:::v-|:)slotted\(/;
|
|
@@ -27609,7 +27626,7 @@ function createBlock(node, source, pad) {
|
|
|
27609
27626
|
const splitRE = /\r?\n/g;
|
|
27610
27627
|
const emptyRE = /^(?:\/\/)?\s*$/;
|
|
27611
27628
|
const replaceRE = /./g;
|
|
27612
|
-
function generateSourceMap(filename, source, generated, sourceRoot, lineOffset) {
|
|
27629
|
+
function generateSourceMap(filename, source, generated, sourceRoot, lineOffset, columnOffset) {
|
|
27613
27630
|
const map = new SourceMapGenerator$6({
|
|
27614
27631
|
file: filename.replace(/\\/g, "/"),
|
|
27615
27632
|
sourceRoot: sourceRoot.replace(/\\/g, "/")
|
|
@@ -27625,7 +27642,7 @@ function generateSourceMap(filename, source, generated, sourceRoot, lineOffset)
|
|
|
27625
27642
|
source: filename,
|
|
27626
27643
|
original: {
|
|
27627
27644
|
line: originalLine,
|
|
27628
|
-
column: i
|
|
27645
|
+
column: i + columnOffset
|
|
27629
27646
|
},
|
|
27630
27647
|
generated: {
|
|
27631
27648
|
line: generatedLine,
|
|
@@ -27676,6 +27693,26 @@ function hmrShouldReload(prevImports, next) {
|
|
|
27676
27693
|
}
|
|
27677
27694
|
return false;
|
|
27678
27695
|
}
|
|
27696
|
+
function dedent(s) {
|
|
27697
|
+
const lines = s.split("\n");
|
|
27698
|
+
const minIndent = lines.reduce(function(minIndent2, line) {
|
|
27699
|
+
var _a, _b;
|
|
27700
|
+
if (line.trim() === "") {
|
|
27701
|
+
return minIndent2;
|
|
27702
|
+
}
|
|
27703
|
+
const indent = ((_b = (_a = line.match(/^\s*/)) == null ? void 0 : _a[0]) == null ? void 0 : _b.length) || 0;
|
|
27704
|
+
return Math.min(indent, minIndent2);
|
|
27705
|
+
}, Infinity);
|
|
27706
|
+
if (minIndent === 0) {
|
|
27707
|
+
return [s, minIndent];
|
|
27708
|
+
}
|
|
27709
|
+
return [
|
|
27710
|
+
lines.map(function(line) {
|
|
27711
|
+
return line.slice(minIndent);
|
|
27712
|
+
}).join("\n"),
|
|
27713
|
+
minIndent
|
|
27714
|
+
];
|
|
27715
|
+
}
|
|
27679
27716
|
|
|
27680
27717
|
/*! https://mths.be/punycode v1.4.1 by @mathias */
|
|
27681
27718
|
|
|
@@ -37602,7 +37639,7 @@ let Root$2 = root$2;
|
|
|
37602
37639
|
|
|
37603
37640
|
let Processor$1 = class Processor {
|
|
37604
37641
|
constructor(plugins = []) {
|
|
37605
|
-
this.version = '8.4.
|
|
37642
|
+
this.version = '8.4.32';
|
|
37606
37643
|
this.plugins = this.normalize(plugins);
|
|
37607
37644
|
}
|
|
37608
37645
|
|
|
@@ -41394,14 +41431,19 @@ function rewriteSelector(id, selector, selectorRoot, slotted = false) {
|
|
|
41394
41431
|
return false;
|
|
41395
41432
|
}
|
|
41396
41433
|
}
|
|
41397
|
-
if (n.type !== "pseudo" && n.type !== "combinator") {
|
|
41434
|
+
if (n.type !== "pseudo" && n.type !== "combinator" || n.type === "pseudo" && (n.value === ":is" || n.value === ":where")) {
|
|
41398
41435
|
node = n;
|
|
41399
41436
|
}
|
|
41400
|
-
|
|
41401
|
-
|
|
41437
|
+
});
|
|
41438
|
+
if (node) {
|
|
41439
|
+
const { type, value } = node;
|
|
41440
|
+
if (type === "pseudo" && (value === ":is" || value === ":where")) {
|
|
41441
|
+
node.nodes.forEach(
|
|
41442
|
+
(value2) => rewriteSelector(id, value2, selectorRoot, slotted)
|
|
41443
|
+
);
|
|
41402
41444
|
shouldInject = false;
|
|
41403
41445
|
}
|
|
41404
|
-
}
|
|
41446
|
+
}
|
|
41405
41447
|
if (node) {
|
|
41406
41448
|
node.spaces.after = "";
|
|
41407
41449
|
} else {
|
|
@@ -47130,33 +47172,39 @@ class TypeScope {
|
|
|
47130
47172
|
this.exportedDeclares = /* @__PURE__ */ Object.create(null);
|
|
47131
47173
|
}
|
|
47132
47174
|
}
|
|
47133
|
-
function resolveTypeElements(ctx, node, scope) {
|
|
47175
|
+
function resolveTypeElements(ctx, node, scope, typeParameters) {
|
|
47134
47176
|
if (node._resolvedElements) {
|
|
47135
47177
|
return node._resolvedElements;
|
|
47136
47178
|
}
|
|
47137
47179
|
return node._resolvedElements = innerResolveTypeElements(
|
|
47138
47180
|
ctx,
|
|
47139
47181
|
node,
|
|
47140
|
-
node._ownerScope || scope || ctxToScope(ctx)
|
|
47182
|
+
node._ownerScope || scope || ctxToScope(ctx),
|
|
47183
|
+
typeParameters
|
|
47141
47184
|
);
|
|
47142
47185
|
}
|
|
47143
|
-
function innerResolveTypeElements(ctx, node, scope) {
|
|
47186
|
+
function innerResolveTypeElements(ctx, node, scope, typeParameters) {
|
|
47144
47187
|
var _a, _b;
|
|
47145
47188
|
switch (node.type) {
|
|
47146
47189
|
case "TSTypeLiteral":
|
|
47147
|
-
return typeElementsToMap(ctx, node.members, scope);
|
|
47190
|
+
return typeElementsToMap(ctx, node.members, scope, typeParameters);
|
|
47148
47191
|
case "TSInterfaceDeclaration":
|
|
47149
|
-
return resolveInterfaceMembers(ctx, node, scope);
|
|
47192
|
+
return resolveInterfaceMembers(ctx, node, scope, typeParameters);
|
|
47150
47193
|
case "TSTypeAliasDeclaration":
|
|
47151
47194
|
case "TSParenthesizedType":
|
|
47152
|
-
return resolveTypeElements(
|
|
47195
|
+
return resolveTypeElements(
|
|
47196
|
+
ctx,
|
|
47197
|
+
node.typeAnnotation,
|
|
47198
|
+
scope,
|
|
47199
|
+
typeParameters
|
|
47200
|
+
);
|
|
47153
47201
|
case "TSFunctionType": {
|
|
47154
47202
|
return { props: {}, calls: [node] };
|
|
47155
47203
|
}
|
|
47156
47204
|
case "TSUnionType":
|
|
47157
47205
|
case "TSIntersectionType":
|
|
47158
47206
|
return mergeElements(
|
|
47159
|
-
node.types.map((t) => resolveTypeElements(ctx, t, scope)),
|
|
47207
|
+
node.types.map((t) => resolveTypeElements(ctx, t, scope, typeParameters)),
|
|
47160
47208
|
node.type
|
|
47161
47209
|
);
|
|
47162
47210
|
case "TSMappedType":
|
|
@@ -47173,20 +47221,53 @@ function innerResolveTypeElements(ctx, node, scope) {
|
|
|
47173
47221
|
const typeName = getReferenceName(node);
|
|
47174
47222
|
if ((typeName === "ExtractPropTypes" || typeName === "ExtractPublicPropTypes") && node.typeParameters && ((_a = scope.imports[typeName]) == null ? void 0 : _a.source) === "vue") {
|
|
47175
47223
|
return resolveExtractPropTypes(
|
|
47176
|
-
resolveTypeElements(
|
|
47224
|
+
resolveTypeElements(
|
|
47225
|
+
ctx,
|
|
47226
|
+
node.typeParameters.params[0],
|
|
47227
|
+
scope,
|
|
47228
|
+
typeParameters
|
|
47229
|
+
),
|
|
47177
47230
|
scope
|
|
47178
47231
|
);
|
|
47179
47232
|
}
|
|
47180
47233
|
const resolved = resolveTypeReference(ctx, node, scope);
|
|
47181
47234
|
if (resolved) {
|
|
47182
|
-
|
|
47235
|
+
const typeParams = /* @__PURE__ */ Object.create(null);
|
|
47236
|
+
if ((resolved.type === "TSTypeAliasDeclaration" || resolved.type === "TSInterfaceDeclaration") && resolved.typeParameters && node.typeParameters) {
|
|
47237
|
+
resolved.typeParameters.params.forEach((p, i) => {
|
|
47238
|
+
let param = typeParameters && typeParameters[p.name];
|
|
47239
|
+
if (!param)
|
|
47240
|
+
param = node.typeParameters.params[i];
|
|
47241
|
+
typeParams[p.name] = param;
|
|
47242
|
+
});
|
|
47243
|
+
}
|
|
47244
|
+
return resolveTypeElements(
|
|
47245
|
+
ctx,
|
|
47246
|
+
resolved,
|
|
47247
|
+
resolved._ownerScope,
|
|
47248
|
+
typeParams
|
|
47249
|
+
);
|
|
47183
47250
|
} else {
|
|
47184
47251
|
if (typeof typeName === "string") {
|
|
47252
|
+
if (typeParameters && typeParameters[typeName]) {
|
|
47253
|
+
return resolveTypeElements(
|
|
47254
|
+
ctx,
|
|
47255
|
+
typeParameters[typeName],
|
|
47256
|
+
scope,
|
|
47257
|
+
typeParameters
|
|
47258
|
+
);
|
|
47259
|
+
}
|
|
47185
47260
|
if (
|
|
47186
47261
|
// @ts-ignore
|
|
47187
47262
|
SupportedBuiltinsSet.has(typeName)
|
|
47188
47263
|
) {
|
|
47189
|
-
return resolveBuiltin(
|
|
47264
|
+
return resolveBuiltin(
|
|
47265
|
+
ctx,
|
|
47266
|
+
node,
|
|
47267
|
+
typeName,
|
|
47268
|
+
scope,
|
|
47269
|
+
typeParameters
|
|
47270
|
+
);
|
|
47190
47271
|
} else if (typeName === "ReturnType" && node.typeParameters) {
|
|
47191
47272
|
const ret = resolveReturnType(
|
|
47192
47273
|
ctx,
|
|
@@ -47235,10 +47316,14 @@ function innerResolveTypeElements(ctx, node, scope) {
|
|
|
47235
47316
|
}
|
|
47236
47317
|
return ctx.error(`Unresolvable type: ${node.type}`, node, scope);
|
|
47237
47318
|
}
|
|
47238
|
-
function typeElementsToMap(ctx, elements, scope = ctxToScope(ctx)) {
|
|
47319
|
+
function typeElementsToMap(ctx, elements, scope = ctxToScope(ctx), typeParameters) {
|
|
47239
47320
|
const res = { props: {} };
|
|
47240
47321
|
for (const e of elements) {
|
|
47241
47322
|
if (e.type === "TSPropertySignature" || e.type === "TSMethodSignature") {
|
|
47323
|
+
if (typeParameters) {
|
|
47324
|
+
scope = createChildScope(scope);
|
|
47325
|
+
Object.assign(scope.types, typeParameters);
|
|
47326
|
+
}
|
|
47242
47327
|
e._ownerScope = scope;
|
|
47243
47328
|
const name = getId(e.key);
|
|
47244
47329
|
if (name && !e.computed) {
|
|
@@ -47301,8 +47386,13 @@ function createProperty(key, typeAnnotation, scope, optional) {
|
|
|
47301
47386
|
_ownerScope: scope
|
|
47302
47387
|
};
|
|
47303
47388
|
}
|
|
47304
|
-
function resolveInterfaceMembers(ctx, node, scope) {
|
|
47305
|
-
const base = typeElementsToMap(
|
|
47389
|
+
function resolveInterfaceMembers(ctx, node, scope, typeParameters) {
|
|
47390
|
+
const base = typeElementsToMap(
|
|
47391
|
+
ctx,
|
|
47392
|
+
node.body.body,
|
|
47393
|
+
node._ownerScope,
|
|
47394
|
+
typeParameters
|
|
47395
|
+
);
|
|
47306
47396
|
if (node.extends) {
|
|
47307
47397
|
for (const ext of node.extends) {
|
|
47308
47398
|
if (ext.leadingComments && ext.leadingComments.some((c) => c.value.includes("@vue-ignore"))) {
|
|
@@ -47476,8 +47566,13 @@ const SupportedBuiltinsSet = /* @__PURE__ */ new Set([
|
|
|
47476
47566
|
"Pick",
|
|
47477
47567
|
"Omit"
|
|
47478
47568
|
]);
|
|
47479
|
-
function resolveBuiltin(ctx, node, name, scope) {
|
|
47480
|
-
const t = resolveTypeElements(
|
|
47569
|
+
function resolveBuiltin(ctx, node, name, scope, typeParameters) {
|
|
47570
|
+
const t = resolveTypeElements(
|
|
47571
|
+
ctx,
|
|
47572
|
+
node.typeParameters.params[0],
|
|
47573
|
+
scope,
|
|
47574
|
+
typeParameters
|
|
47575
|
+
);
|
|
47481
47576
|
switch (name) {
|
|
47482
47577
|
case "Partial": {
|
|
47483
47578
|
const res2 = { props: {}, calls: t.calls };
|
|
@@ -47605,7 +47700,21 @@ function resolveGlobalScope(ctx) {
|
|
|
47605
47700
|
let ts;
|
|
47606
47701
|
let loadTS;
|
|
47607
47702
|
function registerTS(_loadTS) {
|
|
47608
|
-
loadTS =
|
|
47703
|
+
loadTS = () => {
|
|
47704
|
+
try {
|
|
47705
|
+
return _loadTS();
|
|
47706
|
+
} catch (err) {
|
|
47707
|
+
if (typeof err.message === "string" && err.message.includes("Cannot find module")) {
|
|
47708
|
+
throw new Error(
|
|
47709
|
+
'Failed to load TypeScript, which is required for resolving imported types. Please make sure "typescript" is installed as a project dependency.'
|
|
47710
|
+
);
|
|
47711
|
+
} else {
|
|
47712
|
+
throw new Error(
|
|
47713
|
+
"Failed to load TypeScript for resolving imported types."
|
|
47714
|
+
);
|
|
47715
|
+
}
|
|
47716
|
+
}
|
|
47717
|
+
};
|
|
47609
47718
|
}
|
|
47610
47719
|
function resolveFS(ctx) {
|
|
47611
47720
|
if (ctx.fs) {
|
|
@@ -47639,7 +47748,12 @@ function resolveTypeFromImport(ctx, node, name, scope) {
|
|
|
47639
47748
|
return resolveTypeReference(ctx, node, sourceScope, imported, true);
|
|
47640
47749
|
}
|
|
47641
47750
|
function importSourceToScope(ctx, node, scope, source) {
|
|
47642
|
-
|
|
47751
|
+
let fs;
|
|
47752
|
+
try {
|
|
47753
|
+
fs = resolveFS(ctx);
|
|
47754
|
+
} catch (err) {
|
|
47755
|
+
return ctx.error(err.message, node, scope);
|
|
47756
|
+
}
|
|
47643
47757
|
if (!fs) {
|
|
47644
47758
|
return ctx.error(
|
|
47645
47759
|
`No fs option provided to \`compileScript\` in non-Node environment. File system access is required for resolving imported types.`,
|
|
@@ -47764,14 +47878,7 @@ function moduleDeclToScope(ctx, node, parentScope) {
|
|
|
47764
47878
|
if (node._resolvedChildScope) {
|
|
47765
47879
|
return node._resolvedChildScope;
|
|
47766
47880
|
}
|
|
47767
|
-
const scope =
|
|
47768
|
-
parentScope.filename,
|
|
47769
|
-
parentScope.source,
|
|
47770
|
-
parentScope.offset,
|
|
47771
|
-
Object.create(parentScope.imports),
|
|
47772
|
-
Object.create(parentScope.types),
|
|
47773
|
-
Object.create(parentScope.declares)
|
|
47774
|
-
);
|
|
47881
|
+
const scope = createChildScope(parentScope);
|
|
47775
47882
|
if (node.body.type === "TSModuleDeclaration") {
|
|
47776
47883
|
const decl = node.body;
|
|
47777
47884
|
decl._ownerScope = scope;
|
|
@@ -47782,6 +47889,16 @@ function moduleDeclToScope(ctx, node, parentScope) {
|
|
|
47782
47889
|
}
|
|
47783
47890
|
return node._resolvedChildScope = scope;
|
|
47784
47891
|
}
|
|
47892
|
+
function createChildScope(parentScope) {
|
|
47893
|
+
return new TypeScope(
|
|
47894
|
+
parentScope.filename,
|
|
47895
|
+
parentScope.source,
|
|
47896
|
+
parentScope.offset,
|
|
47897
|
+
Object.create(parentScope.imports),
|
|
47898
|
+
Object.create(parentScope.types),
|
|
47899
|
+
Object.create(parentScope.declares)
|
|
47900
|
+
);
|
|
47901
|
+
}
|
|
47785
47902
|
const importExportRE = /^Import|^Export/;
|
|
47786
47903
|
function recordTypes(ctx, body, scope, asGlobal = false) {
|
|
47787
47904
|
const { types, declares, exportedTypes, exportedDeclares, imports } = scope;
|
|
@@ -47903,7 +48020,7 @@ function recordType(node, types, declares, overwriteId) {
|
|
|
47903
48020
|
types[overwriteId || getId(node.id)] = node;
|
|
47904
48021
|
break;
|
|
47905
48022
|
case "TSTypeAliasDeclaration":
|
|
47906
|
-
types[node.id.name] = node.typeAnnotation;
|
|
48023
|
+
types[node.id.name] = node.typeParameters ? node : node.typeAnnotation;
|
|
47907
48024
|
break;
|
|
47908
48025
|
case "TSDeclareFunction":
|
|
47909
48026
|
if (node.id)
|
|
@@ -48443,7 +48560,7 @@ function genRuntimeProps(ctx) {
|
|
|
48443
48560
|
);
|
|
48444
48561
|
}
|
|
48445
48562
|
if (defaults.length) {
|
|
48446
|
-
propsDecls =
|
|
48563
|
+
propsDecls = `/*#__PURE__*/${ctx.helper(
|
|
48447
48564
|
`mergeDefaults`
|
|
48448
48565
|
)}(${propsDecls}, {
|
|
48449
48566
|
${defaults.join(",\n ")}
|
|
@@ -48455,7 +48572,9 @@ function genRuntimeProps(ctx) {
|
|
|
48455
48572
|
}
|
|
48456
48573
|
const modelsDecls = genModelProps(ctx);
|
|
48457
48574
|
if (propsDecls && modelsDecls) {
|
|
48458
|
-
return
|
|
48575
|
+
return `/*#__PURE__*/${ctx.helper(
|
|
48576
|
+
"mergeModels"
|
|
48577
|
+
)}(${propsDecls}, ${modelsDecls})`;
|
|
48459
48578
|
} else {
|
|
48460
48579
|
return modelsDecls || propsDecls;
|
|
48461
48580
|
}
|
|
@@ -48477,9 +48596,9 @@ function genRuntimePropsFromTypes(ctx) {
|
|
|
48477
48596
|
${propStrings.join(",\n ")}
|
|
48478
48597
|
}`;
|
|
48479
48598
|
if (ctx.propsRuntimeDefaults && !hasStaticDefaults) {
|
|
48480
|
-
propsDecls =
|
|
48481
|
-
|
|
48482
|
-
)})`;
|
|
48599
|
+
propsDecls = `/*#__PURE__*/${ctx.helper(
|
|
48600
|
+
"mergeDefaults"
|
|
48601
|
+
)}(${propsDecls}, ${ctx.getString(ctx.propsRuntimeDefaults)})`;
|
|
48483
48602
|
}
|
|
48484
48603
|
return propsDecls;
|
|
48485
48604
|
}
|
|
@@ -48816,7 +48935,9 @@ function genRuntimeEmits(ctx) {
|
|
|
48816
48935
|
}
|
|
48817
48936
|
if (ctx.hasDefineModelCall) {
|
|
48818
48937
|
let modelEmitsDecl = `[${Object.keys(ctx.modelDecls).map((n) => JSON.stringify(`update:${n}`)).join(", ")}]`;
|
|
48819
|
-
emitsDecl = emitsDecl ?
|
|
48938
|
+
emitsDecl = emitsDecl ? `/*#__PURE__*/${ctx.helper(
|
|
48939
|
+
"mergeModels"
|
|
48940
|
+
)}(${emitsDecl}, ${modelEmitsDecl})` : modelEmitsDecl;
|
|
48820
48941
|
}
|
|
48821
48942
|
return emitsDecl;
|
|
48822
48943
|
}
|
|
@@ -49800,7 +49921,7 @@ function isStaticNode(node) {
|
|
|
49800
49921
|
return false;
|
|
49801
49922
|
}
|
|
49802
49923
|
|
|
49803
|
-
const version = "3.3.
|
|
49924
|
+
const version = "3.3.10";
|
|
49804
49925
|
const parseCache = parseCache$1;
|
|
49805
49926
|
const walk = walk$1;
|
|
49806
49927
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/compiler-sfc",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.10",
|
|
4
4
|
"description": "@vue/compiler-sfc",
|
|
5
5
|
"main": "dist/compiler-sfc.cjs.js",
|
|
6
6
|
"module": "dist/compiler-sfc.esm-browser.js",
|
|
@@ -32,22 +32,22 @@
|
|
|
32
32
|
},
|
|
33
33
|
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-sfc#readme",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@babel/parser": "^7.23.
|
|
35
|
+
"@babel/parser": "^7.23.5",
|
|
36
36
|
"estree-walker": "^2.0.2",
|
|
37
37
|
"magic-string": "^0.30.5",
|
|
38
|
-
"postcss": "^8.4.
|
|
38
|
+
"postcss": "^8.4.32",
|
|
39
39
|
"source-map-js": "^1.0.2",
|
|
40
|
-
"@vue/compiler-core": "3.3.
|
|
41
|
-
"@vue/compiler-dom": "3.3.
|
|
42
|
-
"@vue/
|
|
43
|
-
"@vue/
|
|
44
|
-
"@vue/
|
|
40
|
+
"@vue/compiler-core": "3.3.10",
|
|
41
|
+
"@vue/compiler-dom": "3.3.10",
|
|
42
|
+
"@vue/compiler-ssr": "3.3.10",
|
|
43
|
+
"@vue/reactivity-transform": "3.3.10",
|
|
44
|
+
"@vue/shared": "3.3.10"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@babel/types": "^7.23.
|
|
47
|
+
"@babel/types": "^7.23.5",
|
|
48
48
|
"@vue/consolidate": "^0.17.3",
|
|
49
49
|
"hash-sum": "^2.0.0",
|
|
50
|
-
"lru-cache": "^10.0
|
|
50
|
+
"lru-cache": "^10.1.0",
|
|
51
51
|
"merge-source-map": "^1.1.0",
|
|
52
52
|
"minimatch": "^9.0.3",
|
|
53
53
|
"postcss-modules": "^4.3.1",
|