@vue/language-core 2.2.0 → 2.2.2
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/index.d.ts +0 -1
- package/index.js +1 -2
- package/lib/codeFeatures.d.ts +1 -0
- package/lib/codeFeatures.js +3 -0
- package/lib/codegen/codeFeatures.d.ts +83 -0
- package/lib/codegen/codeFeatures.js +71 -0
- package/lib/codegen/common.d.ts +12 -0
- package/lib/codegen/common.js +79 -0
- package/lib/codegen/globalTypes.d.ts +3 -1
- package/lib/codegen/globalTypes.js +30 -14
- package/lib/codegen/localTypes.d.ts +1 -1
- package/lib/codegen/localTypes.js +4 -4
- package/lib/codegen/script/binding.d.ts +4 -0
- package/lib/codegen/script/binding.js +41 -0
- package/lib/codegen/script/component.d.ts +1 -1
- package/lib/codegen/script/component.js +7 -7
- package/lib/codegen/script/componentSelf.d.ts +1 -1
- package/lib/codegen/script/componentSelf.js +2 -2
- package/lib/codegen/script/context.d.ts +1 -1
- package/lib/codegen/script/index.d.ts +1 -8
- package/lib/codegen/script/index.js +15 -39
- package/lib/codegen/script/scriptSetup.d.ts +1 -1
- package/lib/codegen/script/scriptSetup.js +46 -58
- package/lib/codegen/script/src.js +2 -2
- package/lib/codegen/script/styleModulesType.d.ts +1 -1
- package/lib/codegen/script/styleModulesType.js +2 -2
- package/lib/codegen/script/template.d.ts +1 -1
- package/lib/codegen/script/template.js +11 -32
- package/lib/codegen/template/camelized.d.ts +2 -0
- package/lib/codegen/template/camelized.js +31 -0
- package/lib/codegen/template/context.d.ts +17 -13
- package/lib/codegen/template/context.js +35 -89
- package/lib/codegen/template/element.js +32 -252
- package/lib/codegen/template/elementChildren.d.ts +1 -1
- package/lib/codegen/template/elementChildren.js +3 -4
- package/lib/codegen/template/elementDirectives.js +18 -11
- package/lib/codegen/template/elementProps.d.ts +2 -1
- package/lib/codegen/template/elementProps.js +22 -26
- package/lib/codegen/template/index.d.ts +1 -0
- package/lib/codegen/template/index.js +39 -33
- package/lib/codegen/template/interpolation.js +13 -9
- package/lib/codegen/template/slotOutlet.js +39 -17
- package/lib/codegen/template/styleScopedClasses.d.ts +3 -0
- package/lib/codegen/template/styleScopedClasses.js +141 -0
- package/lib/codegen/template/templateChild.js +9 -2
- package/lib/codegen/template/vSlot.d.ts +5 -0
- package/lib/codegen/template/vSlot.js +80 -0
- package/lib/codegen/utils/index.d.ts +11 -1
- package/lib/codegen/utils/index.js +15 -4
- package/lib/codegen/utils/src.d.ts +2 -0
- package/lib/codegen/utils/src.js +19 -0
- package/lib/parsers/scriptSetupRanges.d.ts +5 -3
- package/lib/parsers/scriptSetupRanges.js +8 -11
- package/lib/parsers/vueCompilerOptions.d.ts +2 -2
- package/lib/plugins/vue-style-class-names.d.ts +5 -0
- package/lib/plugins/vue-style-class-names.js +32 -0
- package/lib/plugins/vue-style-reference-link.d.ts +1 -0
- package/lib/plugins/vue-style-reference-link.js +3 -0
- package/lib/plugins/vue-style-reference-links.d.ts +3 -0
- package/lib/plugins/vue-style-reference-links.js +26 -0
- package/lib/plugins/vue-template-inline-ts.js +53 -12
- package/lib/plugins/vue-tsx.d.ts +35 -28
- package/lib/plugins/vue-tsx.js +75 -55
- package/lib/plugins/vue-vine.d.ts +3 -0
- package/lib/plugins/vue-vine.js +35 -0
- package/lib/types.d.ts +6 -2
- package/lib/utils/findDestructuredProps.d.ts +1 -0
- package/lib/utils/findDestructuredProps.js +3 -0
- package/lib/utils/parseCssImports.d.ts +4 -0
- package/lib/utils/parseCssImports.js +19 -0
- package/lib/utils/parseSfc.js +4 -3
- package/lib/utils/signals.d.ts +2 -0
- package/lib/utils/signals.js +54 -0
- package/lib/utils/ts.d.ts +14 -2
- package/lib/utils/ts.js +117 -88
- package/lib/virtualFile/computedEmbeddedCodes.d.ts +1 -1
- package/lib/virtualFile/computedEmbeddedCodes.js +11 -11
- package/lib/virtualFile/computedSfc.d.ts +1 -2
- package/lib/virtualFile/computedSfc.js +79 -82
- package/lib/virtualFile/computedVueSfc.d.ts +1 -2
- package/lib/virtualFile/computedVueSfc.js +7 -7
- package/lib/virtualFile/vueFile.d.ts +5 -5
- package/lib/virtualFile/vueFile.js +6 -6
- package/package.json +4 -4
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.computedVueSfc = computedVueSfc;
|
|
4
4
|
const alien_signals_1 = require("alien-signals");
|
|
5
|
-
function computedVueSfc(plugins, fileName, languageId,
|
|
5
|
+
function computedVueSfc(plugins, fileName, languageId, getSnapshot) {
|
|
6
6
|
let cache;
|
|
7
7
|
return (0, alien_signals_1.computed)(() => {
|
|
8
8
|
// incremental update
|
|
9
9
|
if (cache?.plugin.updateSFC) {
|
|
10
|
-
const change =
|
|
10
|
+
const change = getSnapshot().getChangeRange(cache.snapshot);
|
|
11
11
|
if (change) {
|
|
12
12
|
const newSfc = cache.plugin.updateSFC(cache.sfc, {
|
|
13
13
|
start: change.span.start,
|
|
14
14
|
end: change.span.start + change.span.length,
|
|
15
|
-
newText:
|
|
15
|
+
newText: getSnapshot().getText(change.span.start, change.span.start + change.newLength),
|
|
16
16
|
});
|
|
17
17
|
if (newSfc) {
|
|
18
|
-
cache.snapshot =
|
|
18
|
+
cache.snapshot = getSnapshot();
|
|
19
19
|
// force dirty
|
|
20
20
|
cache.sfc = JSON.parse(JSON.stringify(newSfc));
|
|
21
21
|
return cache.sfc;
|
|
@@ -23,12 +23,12 @@ function computedVueSfc(plugins, fileName, languageId, snapshot) {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
for (const plugin of plugins) {
|
|
26
|
-
const sfc = plugin.parseSFC?.(fileName,
|
|
27
|
-
?? plugin.parseSFC2?.(fileName, languageId,
|
|
26
|
+
const sfc = plugin.parseSFC?.(fileName, getSnapshot().getText(0, getSnapshot().getLength()))
|
|
27
|
+
?? plugin.parseSFC2?.(fileName, languageId, getSnapshot().getText(0, getSnapshot().getLength()));
|
|
28
28
|
if (sfc) {
|
|
29
29
|
if (!sfc.errors.length) {
|
|
30
30
|
cache = {
|
|
31
|
-
snapshot:
|
|
31
|
+
snapshot: getSnapshot(),
|
|
32
32
|
sfc,
|
|
33
33
|
plugin,
|
|
34
34
|
};
|
|
@@ -9,16 +9,16 @@ export declare class VueVirtualCode implements VirtualCode {
|
|
|
9
9
|
plugins: VueLanguagePluginReturn[];
|
|
10
10
|
ts: typeof import('typescript');
|
|
11
11
|
id: string;
|
|
12
|
-
_snapshot
|
|
13
|
-
_vueSfc:
|
|
12
|
+
private _snapshot;
|
|
13
|
+
_vueSfc: () => import("@vue/compiler-sfc").SFCParseResult | undefined;
|
|
14
14
|
_sfc: import("../types").Sfc;
|
|
15
|
-
_mappings:
|
|
15
|
+
_mappings: () => {
|
|
16
16
|
sourceOffsets: number[];
|
|
17
17
|
generatedOffsets: number[];
|
|
18
18
|
lengths: number[];
|
|
19
19
|
data: import("@volar/language-core").CodeInformation;
|
|
20
|
-
}[]
|
|
21
|
-
_embeddedCodes:
|
|
20
|
+
}[];
|
|
21
|
+
_embeddedCodes: () => VirtualCode[];
|
|
22
22
|
get embeddedCodes(): VirtualCode[];
|
|
23
23
|
get snapshot(): ts.IScriptSnapshot;
|
|
24
24
|
get mappings(): {
|
|
@@ -9,13 +9,13 @@ const computedVueSfc_1 = require("./computedVueSfc");
|
|
|
9
9
|
class VueVirtualCode {
|
|
10
10
|
// others
|
|
11
11
|
get embeddedCodes() {
|
|
12
|
-
return this._embeddedCodes
|
|
12
|
+
return this._embeddedCodes();
|
|
13
13
|
}
|
|
14
14
|
get snapshot() {
|
|
15
|
-
return this._snapshot
|
|
15
|
+
return this._snapshot();
|
|
16
16
|
}
|
|
17
17
|
get mappings() {
|
|
18
|
-
return this._mappings
|
|
18
|
+
return this._mappings();
|
|
19
19
|
}
|
|
20
20
|
constructor(fileName, languageId, initSnapshot, vueCompilerOptions, plugins, ts) {
|
|
21
21
|
this.fileName = fileName;
|
|
@@ -31,7 +31,7 @@ class VueVirtualCode {
|
|
|
31
31
|
this._vueSfc = (0, computedVueSfc_1.computedVueSfc)(this.plugins, this.fileName, this.languageId, this._snapshot);
|
|
32
32
|
this._sfc = (0, computedSfc_1.computedSfc)(this.ts, this.plugins, this.fileName, this._snapshot, this._vueSfc);
|
|
33
33
|
this._mappings = (0, alien_signals_1.computed)(() => {
|
|
34
|
-
const snapshot = this._snapshot
|
|
34
|
+
const snapshot = this._snapshot();
|
|
35
35
|
return [{
|
|
36
36
|
sourceOffsets: [0],
|
|
37
37
|
generatedOffsets: [0],
|
|
@@ -40,10 +40,10 @@ class VueVirtualCode {
|
|
|
40
40
|
}];
|
|
41
41
|
});
|
|
42
42
|
this._embeddedCodes = (0, computedEmbeddedCodes_1.computedEmbeddedCodes)(this.plugins, this.fileName, this._sfc);
|
|
43
|
-
this._snapshot
|
|
43
|
+
this._snapshot(initSnapshot);
|
|
44
44
|
}
|
|
45
45
|
update(newSnapshot) {
|
|
46
|
-
this._snapshot
|
|
46
|
+
this._snapshot(newSnapshot);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
exports.VueVirtualCode = VueVirtualCode;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/language-core",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"**/*.js",
|
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
"@vue/compiler-dom": "^3.5.0",
|
|
18
18
|
"@vue/compiler-vue2": "^2.7.16",
|
|
19
19
|
"@vue/shared": "^3.5.0",
|
|
20
|
-
"alien-signals": "^0.
|
|
20
|
+
"alien-signals": "^1.0.3",
|
|
21
21
|
"minimatch": "^9.0.3",
|
|
22
22
|
"muggle-string": "^0.4.1",
|
|
23
23
|
"path-browserify": "^1.0.1"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/minimatch": "^5.1.2",
|
|
27
|
-
"@types/node": "
|
|
27
|
+
"@types/node": "^22.10.4",
|
|
28
28
|
"@types/path-browserify": "^1.0.1",
|
|
29
29
|
"@volar/typescript": "~2.4.11",
|
|
30
30
|
"@vue/compiler-sfc": "^3.5.0"
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"optional": true
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "30757908b67f40f779c36795665163634fb81868"
|
|
41
41
|
}
|