@vue/language-core 3.3.4 → 3.3.6
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 +1 -0
- package/index.js +1 -0
- package/lib/codegen/codeFeatures.d.ts +24 -84
- package/lib/codegen/codeFeatures.js +46 -4
- package/lib/codegen/names.d.ts +4 -5
- package/lib/codegen/names.js +4 -5
- package/lib/codegen/script/index.js +5 -5
- package/lib/codegen/script/scriptSetup.js +4 -4
- package/lib/codegen/style/common.js +7 -11
- package/lib/codegen/style/index.d.ts +55 -27
- package/lib/codegen/style/index.js +3 -3
- package/lib/codegen/template/context.d.ts +55 -124
- package/lib/codegen/template/context.js +187 -269
- package/lib/codegen/template/element.js +16 -15
- package/lib/codegen/template/elementDirectives.js +11 -11
- package/lib/codegen/template/elementEvents.js +76 -73
- package/lib/codegen/template/elementProps.js +12 -12
- package/lib/codegen/template/index.d.ts +55 -27
- package/lib/codegen/template/index.js +7 -7
- package/lib/codegen/template/interpolation.js +28 -28
- package/lib/codegen/template/objectProperty.js +5 -5
- package/lib/codegen/template/propertyAccess.js +1 -1
- package/lib/codegen/template/slotOutlet.js +8 -10
- package/lib/codegen/template/styleScopedClasses.js +4 -4
- package/lib/codegen/template/vFor.js +3 -3
- package/lib/codegen/template/vIf.js +4 -4
- package/lib/codegen/template/vSlot.js +9 -9
- package/lib/codegen/utils/boundary.d.ts +7 -2
- package/lib/codegen/utils/boundary.js +15 -9
- package/lib/codegen/utils/camelized.js +5 -13
- package/lib/codegen/utils/escaped.js +4 -9
- package/lib/codegen/utils/index.d.ts +1 -1
- package/lib/codegen/utils/index.js +3 -3
- package/lib/codegen/utils/stringLiteralKey.js +3 -3
- package/lib/codegen/utils/unicode.d.ts +1 -1
- package/lib/codegen/utils/unicode.js +4 -4
- package/lib/languagePlugin.js +2 -1
- package/lib/parsers/scriptRanges.d.ts +2 -2
- package/lib/parsers/scriptRanges.js +3 -10
- package/lib/parsers/scriptSetupRanges.d.ts +2 -2
- package/lib/parsers/scriptSetupRanges.js +3 -10
- package/lib/parsers/utils.d.ts +1 -0
- package/lib/parsers/utils.js +10 -0
- package/lib/parsers/vueCompilerOptions.js +2 -2
- package/lib/plugins/file-html.js +4 -4
- package/lib/plugins/file-md.js +15 -15
- package/lib/plugins/file-vue.js +2 -2
- package/lib/plugins/vue-root-tags.js +3 -3
- package/lib/plugins/vue-sfc-customblocks.js +2 -2
- package/lib/plugins/vue-sfc-scripts.js +2 -4
- package/lib/plugins/vue-sfc-styles.js +3 -3
- package/lib/plugins/vue-sfc-template.js +2 -2
- package/lib/plugins/vue-style-css.js +86 -33
- package/lib/plugins/vue-template-html.js +3 -3
- package/lib/plugins/vue-template-inline-css.js +2 -7
- package/lib/plugins/vue-template-inline-ts.js +4 -5
- package/lib/plugins/vue-tsx.d.ts +61 -31
- package/lib/plugins/vue-tsx.js +26 -23
- package/lib/plugins.d.ts +0 -1
- package/lib/plugins.js +0 -15
- package/lib/utils/forEachTemplateNode.js +36 -43
- package/lib/virtualCode/index.js +2 -2
- package/package.json +2 -2
- package/types/template-helpers.d.ts +15 -25
- package/lib/plugins/shared.d.ts +0 -2
- package/lib/plugins/shared.js +0 -12
|
@@ -37,61 +37,54 @@ exports.forEachElementNode = forEachElementNode;
|
|
|
37
37
|
exports.forEachInterpolationNode = forEachInterpolationNode;
|
|
38
38
|
const CompilerDOM = __importStar(require("@vue/compiler-dom"));
|
|
39
39
|
function* forEachElementNode(node) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
yield
|
|
40
|
+
switch (node.type) {
|
|
41
|
+
case CompilerDOM.NodeTypes.ELEMENT: {
|
|
42
|
+
yield node;
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
else if (node.type === CompilerDOM.NodeTypes.IF) {
|
|
52
|
-
for (const branch of node.branches) {
|
|
53
|
-
for (const childNode of branch.children) {
|
|
54
|
-
yield* forEachElementNode(childNode);
|
|
44
|
+
case CompilerDOM.NodeTypes.IF_BRANCH:
|
|
45
|
+
case CompilerDOM.NodeTypes.FOR:
|
|
46
|
+
case CompilerDOM.NodeTypes.ROOT: {
|
|
47
|
+
for (const child of node.children) {
|
|
48
|
+
yield* forEachElementNode(child);
|
|
55
49
|
}
|
|
50
|
+
break;
|
|
56
51
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
52
|
+
case CompilerDOM.NodeTypes.IF: {
|
|
53
|
+
for (const branch of node.branches) {
|
|
54
|
+
yield* forEachElementNode(branch);
|
|
55
|
+
}
|
|
56
|
+
break;
|
|
61
57
|
}
|
|
62
58
|
}
|
|
63
59
|
}
|
|
64
60
|
function* forEachInterpolationNode(node) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
for (const child of node.children) {
|
|
72
|
-
yield* forEachInterpolationNode(child);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
else if (node.type === CompilerDOM.NodeTypes.COMPOUND_EXPRESSION) {
|
|
76
|
-
for (const child of node.children) {
|
|
77
|
-
if (typeof child === 'object') {
|
|
61
|
+
switch (node.type) {
|
|
62
|
+
case CompilerDOM.NodeTypes.ELEMENT:
|
|
63
|
+
case CompilerDOM.NodeTypes.IF_BRANCH:
|
|
64
|
+
case CompilerDOM.NodeTypes.FOR:
|
|
65
|
+
case CompilerDOM.NodeTypes.ROOT: {
|
|
66
|
+
for (const child of node.children) {
|
|
78
67
|
yield* forEachInterpolationNode(child);
|
|
79
68
|
}
|
|
69
|
+
break;
|
|
80
70
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
else if (node.type === CompilerDOM.NodeTypes.IF) {
|
|
86
|
-
for (const branch of node.branches) {
|
|
87
|
-
for (const childNode of branch.children) {
|
|
88
|
-
yield* forEachInterpolationNode(childNode);
|
|
71
|
+
case CompilerDOM.NodeTypes.IF: {
|
|
72
|
+
for (const branch of node.branches) {
|
|
73
|
+
yield* forEachInterpolationNode(branch);
|
|
89
74
|
}
|
|
75
|
+
break;
|
|
90
76
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
77
|
+
case CompilerDOM.NodeTypes.COMPOUND_EXPRESSION: {
|
|
78
|
+
for (const child of node.children) {
|
|
79
|
+
if (typeof child === 'object') {
|
|
80
|
+
yield* forEachInterpolationNode(child);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
case CompilerDOM.NodeTypes.INTERPOLATION: {
|
|
86
|
+
yield node;
|
|
87
|
+
break;
|
|
95
88
|
}
|
|
96
89
|
}
|
|
97
90
|
}
|
package/lib/virtualCode/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VueVirtualCode = void 0;
|
|
4
4
|
const alien_signals_1 = require("alien-signals");
|
|
5
|
-
const
|
|
5
|
+
const codeFeatures_1 = require("../codegen/codeFeatures");
|
|
6
6
|
const embeddedCodes_1 = require("./embeddedCodes");
|
|
7
7
|
const ir_1 = require("./ir");
|
|
8
8
|
class VueVirtualCode {
|
|
@@ -40,7 +40,7 @@ class VueVirtualCode {
|
|
|
40
40
|
sourceOffsets: [0],
|
|
41
41
|
generatedOffsets: [0],
|
|
42
42
|
lengths: [this._snapshot().getLength()],
|
|
43
|
-
data:
|
|
43
|
+
data: codeFeatures_1.codeFeatures.full,
|
|
44
44
|
}];
|
|
45
45
|
});
|
|
46
46
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/language-core",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"index.d.ts",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"@volar/typescript": "2.4.28",
|
|
35
35
|
"@vue/compiler-sfc": "^3.5.0"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "4893ec6a4b5ca0d00f8add9aa36c17c47085f05a"
|
|
38
38
|
}
|
|
@@ -21,25 +21,16 @@ declare global {
|
|
|
21
21
|
: N2 extends keyof GlobalComponents ? { [K in N0]: GlobalComponents[N2] }
|
|
22
22
|
: N3 extends keyof GlobalComponents ? { [K in N0]: GlobalComponents[N3] }
|
|
23
23
|
: {};
|
|
24
|
-
type
|
|
24
|
+
type __VLS_ExtractComponentContext<T, K> = __VLS_PickNotAny<
|
|
25
25
|
'__ctx' extends keyof __VLS_PickNotAny<K, {}> ? K extends { __ctx?: infer Ctx } ? NonNullable<Ctx> : never : any,
|
|
26
26
|
T extends (props: any, ctx: infer Ctx) => any ? Ctx : any
|
|
27
27
|
>;
|
|
28
|
-
type
|
|
28
|
+
type __VLS_ExtractComponentProps<T, K> = '__ctx' extends keyof __VLS_PickNotAny<K, {}>
|
|
29
29
|
? K extends { __ctx?: { props?: infer P } } ? NonNullable<P> : never
|
|
30
30
|
: T extends (props: infer P, ...args: any) => any ? P
|
|
31
31
|
: {};
|
|
32
|
-
type
|
|
33
|
-
|
|
34
|
-
attrs?: any;
|
|
35
|
-
slots?: T extends { $slots: infer Slots } ? Slots : Record<string, any>;
|
|
36
|
-
emit?: T extends { $emit: infer Emit } ? Emit : {};
|
|
37
|
-
props?: typeof props;
|
|
38
|
-
expose?: (exposed: T) => void;
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
type __VLS_FunctionalComponent1<T> = (
|
|
42
|
-
props: (T extends { $props: infer Props } ? Props : {}) & Record<string, unknown>,
|
|
32
|
+
type __VLS_FunctionalComponent<T, P = {}> = (
|
|
33
|
+
props: (T extends { $props: infer Props } ? Props : {}) & P,
|
|
43
34
|
ctx?: any,
|
|
44
35
|
) => {
|
|
45
36
|
__ctx?: {
|
|
@@ -50,11 +41,10 @@ declare global {
|
|
|
50
41
|
expose?: (exposed: T) => void;
|
|
51
42
|
};
|
|
52
43
|
};
|
|
53
|
-
type __VLS_IsFunction<T, K> = K extends keyof T ?
|
|
54
|
-
|
|
55
|
-
: false
|
|
44
|
+
type __VLS_IsFunction<T, K> = K extends keyof T ? unknown extends T[K] ? false
|
|
45
|
+
: true
|
|
56
46
|
: false;
|
|
57
|
-
type
|
|
47
|
+
type __VLS_ResolveEvent<
|
|
58
48
|
Props,
|
|
59
49
|
Emits,
|
|
60
50
|
onEvent extends keyof Props,
|
|
@@ -123,20 +113,20 @@ declare global {
|
|
|
123
113
|
>
|
|
124
114
|
: T extends (...args: any) => any ? T
|
|
125
115
|
: (arg1: unknown, arg2: unknown, arg3: unknown, arg4: unknown) => void;
|
|
126
|
-
function __VLS_asFunctionalComponent0<T, K
|
|
116
|
+
function __VLS_asFunctionalComponent0<T, K>(
|
|
127
117
|
t: T,
|
|
128
|
-
instance
|
|
129
|
-
): T extends new(...args: any) => any ?
|
|
118
|
+
instance: K,
|
|
119
|
+
): T extends new(...args: any) => any ? __VLS_FunctionalComponent<K>
|
|
130
120
|
: T extends () => any ? (props: {}, ctx?: any) => ReturnType<T>
|
|
131
121
|
: T extends (...args: any) => any ? T
|
|
132
|
-
:
|
|
133
|
-
function __VLS_asFunctionalComponent1<T, K
|
|
122
|
+
: __VLS_FunctionalComponent<{}>;
|
|
123
|
+
function __VLS_asFunctionalComponent1<T, K>(
|
|
134
124
|
t: T,
|
|
135
|
-
instance
|
|
136
|
-
): T extends new(...args: any) => any ?
|
|
125
|
+
instance: K,
|
|
126
|
+
): T extends new(...args: any) => any ? __VLS_FunctionalComponent<K, Record<string, unknown>>
|
|
137
127
|
: T extends () => any ? (props: {}, ctx?: any) => ReturnType<T>
|
|
138
128
|
: T extends (...args: any) => any ? T
|
|
139
|
-
:
|
|
129
|
+
: __VLS_FunctionalComponent<{}, Record<string, unknown>>;
|
|
140
130
|
function __VLS_functionalComponentArgsRest<T extends (...args: any) => any>(
|
|
141
131
|
t: T,
|
|
142
132
|
): 2 extends Parameters<T>['length'] ? [any] : [];
|
package/lib/plugins/shared.d.ts
DELETED
package/lib/plugins/shared.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.allCodeFeatures = void 0;
|
|
4
|
-
exports.allCodeFeatures = {
|
|
5
|
-
verification: true,
|
|
6
|
-
completion: true,
|
|
7
|
-
semantic: true,
|
|
8
|
-
navigation: true,
|
|
9
|
-
structure: true,
|
|
10
|
-
format: true,
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=shared.js.map
|