@vue/compiler-sfc 3.4.0-beta.4 → 3.4.0-rc.1
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
CHANGED
|
@@ -17767,21 +17767,24 @@ class TypeScope {
|
|
|
17767
17767
|
this.imports = imports;
|
|
17768
17768
|
this.types = types;
|
|
17769
17769
|
this.declares = declares;
|
|
17770
|
+
this.isGenericScope = false;
|
|
17770
17771
|
this.resolvedImportSources = /* @__PURE__ */ Object.create(null);
|
|
17771
17772
|
this.exportedTypes = /* @__PURE__ */ Object.create(null);
|
|
17772
17773
|
this.exportedDeclares = /* @__PURE__ */ Object.create(null);
|
|
17773
17774
|
}
|
|
17774
17775
|
}
|
|
17775
17776
|
function resolveTypeElements(ctx, node, scope, typeParameters) {
|
|
17776
|
-
|
|
17777
|
+
const canCache = !typeParameters;
|
|
17778
|
+
if (canCache && node._resolvedElements) {
|
|
17777
17779
|
return node._resolvedElements;
|
|
17778
17780
|
}
|
|
17779
|
-
|
|
17781
|
+
const resolved = innerResolveTypeElements(
|
|
17780
17782
|
ctx,
|
|
17781
17783
|
node,
|
|
17782
17784
|
node._ownerScope || scope || ctxToScope(ctx),
|
|
17783
17785
|
typeParameters
|
|
17784
17786
|
);
|
|
17787
|
+
return canCache ? node._resolvedElements = resolved : resolved;
|
|
17785
17788
|
}
|
|
17786
17789
|
function innerResolveTypeElements(ctx, node, scope, typeParameters) {
|
|
17787
17790
|
var _a, _b;
|
|
@@ -17832,8 +17835,9 @@ function innerResolveTypeElements(ctx, node, scope, typeParameters) {
|
|
|
17832
17835
|
}
|
|
17833
17836
|
const resolved = resolveTypeReference(ctx, node, scope);
|
|
17834
17837
|
if (resolved) {
|
|
17835
|
-
|
|
17838
|
+
let typeParams;
|
|
17836
17839
|
if ((resolved.type === "TSTypeAliasDeclaration" || resolved.type === "TSInterfaceDeclaration") && resolved.typeParameters && node.typeParameters) {
|
|
17840
|
+
typeParams = /* @__PURE__ */ Object.create(null);
|
|
17837
17841
|
resolved.typeParameters.params.forEach((p, i) => {
|
|
17838
17842
|
let param = typeParameters && typeParameters[p.name];
|
|
17839
17843
|
if (!param)
|
|
@@ -17922,6 +17926,7 @@ function typeElementsToMap(ctx, elements, scope = ctxToScope(ctx), typeParameter
|
|
|
17922
17926
|
if (e.type === "TSPropertySignature" || e.type === "TSMethodSignature") {
|
|
17923
17927
|
if (typeParameters) {
|
|
17924
17928
|
scope = createChildScope(scope);
|
|
17929
|
+
scope.isGenericScope = true;
|
|
17925
17930
|
Object.assign(scope.types, typeParameters);
|
|
17926
17931
|
}
|
|
17927
17932
|
e._ownerScope = scope;
|
|
@@ -18219,16 +18224,18 @@ function resolveBuiltin(ctx, node, name, scope, typeParameters) {
|
|
|
18219
18224
|
}
|
|
18220
18225
|
}
|
|
18221
18226
|
function resolveTypeReference(ctx, node, scope, name, onlyExported = false) {
|
|
18222
|
-
|
|
18227
|
+
const canCache = !(scope == null ? void 0 : scope.isGenericScope);
|
|
18228
|
+
if (canCache && node._resolvedReference) {
|
|
18223
18229
|
return node._resolvedReference;
|
|
18224
18230
|
}
|
|
18225
|
-
|
|
18231
|
+
const resolved = innerResolveTypeReference(
|
|
18226
18232
|
ctx,
|
|
18227
18233
|
scope || ctxToScope(ctx),
|
|
18228
18234
|
name || getReferenceName(node),
|
|
18229
18235
|
node,
|
|
18230
18236
|
onlyExported
|
|
18231
18237
|
);
|
|
18238
|
+
return canCache ? node._resolvedReference = resolved : resolved;
|
|
18232
18239
|
}
|
|
18233
18240
|
function innerResolveTypeReference(ctx, scope, name, node, onlyExported) {
|
|
18234
18241
|
if (typeof name === "string") {
|
|
@@ -20560,7 +20567,7 @@ function isStaticNode(node) {
|
|
|
20560
20567
|
return false;
|
|
20561
20568
|
}
|
|
20562
20569
|
|
|
20563
|
-
const version = "3.4.0-
|
|
20570
|
+
const version = "3.4.0-rc.1";
|
|
20564
20571
|
const parseCache = parseCache$1;
|
|
20565
20572
|
const walk = estreeWalker.walk;
|
|
20566
20573
|
const shouldTransformRef = () => false;
|
package/dist/compiler-sfc.d.ts
CHANGED
|
@@ -432,6 +432,7 @@ declare class TypeScope {
|
|
|
432
432
|
types: Record<string, ScopeTypeNode>;
|
|
433
433
|
declares: Record<string, ScopeTypeNode>;
|
|
434
434
|
constructor(filename: string, source: string, offset?: number, imports?: Record<string, Import>, types?: Record<string, ScopeTypeNode>, declares?: Record<string, ScopeTypeNode>);
|
|
435
|
+
isGenericScope: boolean;
|
|
435
436
|
resolvedImportSources: Record<string, string>;
|
|
436
437
|
exportedTypes: Record<string, ScopeTypeNode>;
|
|
437
438
|
exportedDeclares: Record<string, ScopeTypeNode>;
|
|
@@ -17669,12 +17669,6 @@ const tokenizer$2 = new Tokenizer$1(stack, {
|
|
|
17669
17669
|
loc: getLoc(start - 1, end),
|
|
17670
17670
|
codegenNode: void 0
|
|
17671
17671
|
};
|
|
17672
|
-
if (tokenizer$2.inSFCRoot) {
|
|
17673
|
-
currentOpenTag.innerLoc = getLoc(
|
|
17674
|
-
end + fastForward(end) + 1,
|
|
17675
|
-
end
|
|
17676
|
-
);
|
|
17677
|
-
}
|
|
17678
17672
|
},
|
|
17679
17673
|
onopentagend(end) {
|
|
17680
17674
|
endOpenTag(end);
|
|
@@ -17992,6 +17986,9 @@ function getSlice(start, end) {
|
|
|
17992
17986
|
return currentInput.slice(start, end);
|
|
17993
17987
|
}
|
|
17994
17988
|
function endOpenTag(end) {
|
|
17989
|
+
if (tokenizer$2.inSFCRoot) {
|
|
17990
|
+
currentOpenTag.innerLoc = getLoc(end + 1, end + 1);
|
|
17991
|
+
}
|
|
17995
17992
|
addNode(currentOpenTag);
|
|
17996
17993
|
const { tag, ns } = currentOpenTag;
|
|
17997
17994
|
if (ns === 0 && currentOptions.isPreTag(tag)) {
|
|
@@ -18025,7 +18022,7 @@ function onCloseTag(el, end, isImplied = false) {
|
|
|
18025
18022
|
if (isImplied) {
|
|
18026
18023
|
setLocEnd(el.loc, backTrack(end, 60));
|
|
18027
18024
|
} else {
|
|
18028
|
-
setLocEnd(el.loc, end +
|
|
18025
|
+
setLocEnd(el.loc, end + 1);
|
|
18029
18026
|
}
|
|
18030
18027
|
if (tokenizer$2.inSFCRoot) {
|
|
18031
18028
|
if (el.children.length) {
|
|
@@ -18062,13 +18059,6 @@ function onCloseTag(el, end, isImplied = false) {
|
|
|
18062
18059
|
tokenizer$2.inXML = false;
|
|
18063
18060
|
}
|
|
18064
18061
|
}
|
|
18065
|
-
function fastForward(start, c) {
|
|
18066
|
-
let offset = 0;
|
|
18067
|
-
while (currentInput.charCodeAt(start + offset) !== 62 && start + offset < currentInput.length) {
|
|
18068
|
-
offset++;
|
|
18069
|
-
}
|
|
18070
|
-
return offset;
|
|
18071
|
-
}
|
|
18072
18062
|
function backTrack(index, c) {
|
|
18073
18063
|
let i = index;
|
|
18074
18064
|
while (currentInput.charCodeAt(i) !== c && i >= 0)
|
|
@@ -45837,21 +45827,24 @@ class TypeScope {
|
|
|
45837
45827
|
this.imports = imports;
|
|
45838
45828
|
this.types = types;
|
|
45839
45829
|
this.declares = declares;
|
|
45830
|
+
this.isGenericScope = false;
|
|
45840
45831
|
this.resolvedImportSources = /* @__PURE__ */ Object.create(null);
|
|
45841
45832
|
this.exportedTypes = /* @__PURE__ */ Object.create(null);
|
|
45842
45833
|
this.exportedDeclares = /* @__PURE__ */ Object.create(null);
|
|
45843
45834
|
}
|
|
45844
45835
|
}
|
|
45845
45836
|
function resolveTypeElements(ctx, node, scope, typeParameters) {
|
|
45846
|
-
|
|
45837
|
+
const canCache = !typeParameters;
|
|
45838
|
+
if (canCache && node._resolvedElements) {
|
|
45847
45839
|
return node._resolvedElements;
|
|
45848
45840
|
}
|
|
45849
|
-
|
|
45841
|
+
const resolved = innerResolveTypeElements(
|
|
45850
45842
|
ctx,
|
|
45851
45843
|
node,
|
|
45852
45844
|
node._ownerScope || scope || ctxToScope(ctx),
|
|
45853
45845
|
typeParameters
|
|
45854
45846
|
);
|
|
45847
|
+
return canCache ? node._resolvedElements = resolved : resolved;
|
|
45855
45848
|
}
|
|
45856
45849
|
function innerResolveTypeElements(ctx, node, scope, typeParameters) {
|
|
45857
45850
|
var _a, _b;
|
|
@@ -45902,8 +45895,9 @@ function innerResolveTypeElements(ctx, node, scope, typeParameters) {
|
|
|
45902
45895
|
}
|
|
45903
45896
|
const resolved = resolveTypeReference(ctx, node, scope);
|
|
45904
45897
|
if (resolved) {
|
|
45905
|
-
|
|
45898
|
+
let typeParams;
|
|
45906
45899
|
if ((resolved.type === "TSTypeAliasDeclaration" || resolved.type === "TSInterfaceDeclaration") && resolved.typeParameters && node.typeParameters) {
|
|
45900
|
+
typeParams = /* @__PURE__ */ Object.create(null);
|
|
45907
45901
|
resolved.typeParameters.params.forEach((p, i) => {
|
|
45908
45902
|
let param = typeParameters && typeParameters[p.name];
|
|
45909
45903
|
if (!param)
|
|
@@ -45992,6 +45986,7 @@ function typeElementsToMap(ctx, elements, scope = ctxToScope(ctx), typeParameter
|
|
|
45992
45986
|
if (e.type === "TSPropertySignature" || e.type === "TSMethodSignature") {
|
|
45993
45987
|
if (typeParameters) {
|
|
45994
45988
|
scope = createChildScope(scope);
|
|
45989
|
+
scope.isGenericScope = true;
|
|
45995
45990
|
Object.assign(scope.types, typeParameters);
|
|
45996
45991
|
}
|
|
45997
45992
|
e._ownerScope = scope;
|
|
@@ -46288,16 +46283,18 @@ function resolveBuiltin(ctx, node, name, scope, typeParameters) {
|
|
|
46288
46283
|
}
|
|
46289
46284
|
}
|
|
46290
46285
|
function resolveTypeReference(ctx, node, scope, name, onlyExported = false) {
|
|
46291
|
-
|
|
46286
|
+
const canCache = !(scope == null ? void 0 : scope.isGenericScope);
|
|
46287
|
+
if (canCache && node._resolvedReference) {
|
|
46292
46288
|
return node._resolvedReference;
|
|
46293
46289
|
}
|
|
46294
|
-
|
|
46290
|
+
const resolved = innerResolveTypeReference(
|
|
46295
46291
|
ctx,
|
|
46296
46292
|
scope || ctxToScope(ctx),
|
|
46297
46293
|
name || getReferenceName(node),
|
|
46298
46294
|
node,
|
|
46299
46295
|
onlyExported
|
|
46300
46296
|
);
|
|
46297
|
+
return canCache ? node._resolvedReference = resolved : resolved;
|
|
46301
46298
|
}
|
|
46302
46299
|
function innerResolveTypeReference(ctx, scope, name, node, onlyExported) {
|
|
46303
46300
|
if (typeof name === "string") {
|
|
@@ -48559,7 +48556,7 @@ function isStaticNode(node) {
|
|
|
48559
48556
|
return false;
|
|
48560
48557
|
}
|
|
48561
48558
|
|
|
48562
|
-
const version = "3.4.0-
|
|
48559
|
+
const version = "3.4.0-rc.1";
|
|
48563
48560
|
const parseCache = parseCache$1;
|
|
48564
48561
|
const walk = walk$2;
|
|
48565
48562
|
const shouldTransformRef = () => false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/compiler-sfc",
|
|
3
|
-
"version": "3.4.0-
|
|
3
|
+
"version": "3.4.0-rc.1",
|
|
4
4
|
"description": "@vue/compiler-sfc",
|
|
5
5
|
"main": "dist/compiler-sfc.cjs.js",
|
|
6
6
|
"module": "dist/compiler-sfc.esm-browser.js",
|
|
@@ -32,18 +32,18 @@
|
|
|
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.6",
|
|
36
36
|
"estree-walker": "^2.0.2",
|
|
37
37
|
"magic-string": "^0.30.5",
|
|
38
38
|
"postcss": "^8.4.32",
|
|
39
39
|
"source-map-js": "^1.0.2",
|
|
40
|
-
"@vue/compiler-core": "3.4.0-
|
|
41
|
-
"@vue/compiler-ssr": "3.4.0-
|
|
42
|
-
"@vue/compiler-dom": "3.4.0-
|
|
43
|
-
"@vue/shared": "3.4.0-
|
|
40
|
+
"@vue/compiler-core": "3.4.0-rc.1",
|
|
41
|
+
"@vue/compiler-ssr": "3.4.0-rc.1",
|
|
42
|
+
"@vue/compiler-dom": "3.4.0-rc.1",
|
|
43
|
+
"@vue/shared": "3.4.0-rc.1"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@babel/types": "^7.23.
|
|
46
|
+
"@babel/types": "^7.23.6",
|
|
47
47
|
"@vue/consolidate": "^0.17.3",
|
|
48
48
|
"hash-sum": "^2.0.0",
|
|
49
49
|
"lru-cache": "^10.1.0",
|