@vue/language-core 3.1.8 → 3.2.0
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 -1
- package/index.js +25 -3
- package/lib/codegen/codeFeatures.d.ts +18 -84
- package/lib/codegen/names.d.ts +2 -4
- package/lib/codegen/names.js +3 -5
- package/lib/codegen/script/component.js +37 -4
- package/lib/codegen/script/index.d.ts +4 -12
- package/lib/codegen/script/index.js +77 -22
- package/lib/codegen/script/scriptSetup.js +52 -14
- package/lib/codegen/script/template.js +69 -31
- package/lib/codegen/style/index.d.ts +9 -9
- package/lib/codegen/style/modules.js +34 -1
- package/lib/codegen/template/context.d.ts +7 -7
- package/lib/codegen/template/context.js +34 -1
- package/lib/codegen/template/element.js +48 -7
- package/lib/codegen/template/elementDirectives.js +36 -3
- package/lib/codegen/template/elementEvents.js +36 -3
- package/lib/codegen/template/elementProps.js +35 -2
- package/lib/codegen/template/index.d.ts +10 -10
- package/lib/codegen/template/index.js +34 -1
- package/lib/codegen/template/interpolation.d.ts +4 -3
- package/lib/codegen/template/interpolation.js +37 -4
- package/lib/codegen/template/slotOutlet.js +35 -2
- package/lib/codegen/template/templateChild.js +34 -1
- package/lib/codegen/template/vFor.js +37 -4
- package/lib/codegen/template/vIf.js +34 -1
- package/lib/codegen/template/vSlot.js +38 -5
- package/lib/compilerOptions.d.ts +7 -11
- package/lib/compilerOptions.js +48 -89
- package/lib/languagePlugin.js +34 -1
- package/lib/parsers/scriptRanges.d.ts +26 -16
- package/lib/parsers/scriptRanges.js +66 -64
- package/lib/parsers/scriptSetupRanges.d.ts +19 -24
- package/lib/parsers/scriptSetupRanges.js +13 -15
- package/lib/parsers/utils.d.ts +3 -6
- package/lib/parsers/utils.js +1 -0
- package/lib/plugins/vue-template-inline-css.js +34 -1
- package/lib/plugins/vue-template-inline-ts.js +34 -1
- package/lib/plugins/vue-tsx.d.ts +36 -114
- package/lib/plugins/vue-tsx.js +62 -33
- package/lib/plugins.js +17 -14
- package/lib/types.d.ts +8 -8
- package/lib/utils/collectBindings.d.ts +1 -1
- package/lib/utils/forEachTemplateNode.js +34 -1
- package/lib/utils/parseSfc.js +34 -1
- package/lib/utils/shared.d.ts +1 -1
- package/lib/utils/shared.js +2 -1
- package/lib/virtualCode/embeddedCodes.js +6 -2
- package/lib/virtualCode/index.js +10 -1
- package/lib/virtualCode/ir.js +34 -1
- package/lib/virtualCode/normalize.js +37 -2
- package/package.json +4 -12
- package/types/props-fallback.d.ts +5 -0
- package/types/template-helpers.d.ts +146 -0
- package/types/vue-3.4-shims.d.ts +6 -0
- package/lib/codegen/globalTypes.d.ts +0 -3
- package/lib/codegen/globalTypes.js +0 -163
- package/lib/codegen/script/src.d.ts +0 -3
- package/lib/codegen/script/src.js +0 -43
- package/lib/codegen/style/classProperty.d.ts +0 -2
- package/lib/codegen/style/classProperty.js +0 -18
- package/lib/codegen/style/imports.d.ts +0 -2
- package/lib/codegen/style/imports.js +0 -27
- package/lib/codegen/template/elementChildren.d.ts +0 -5
- package/lib/codegen/template/elementChildren.js +0 -12
- package/lib/codegen/utils/wrapWith.d.ts +0 -2
- package/lib/codegen/utils/wrapWith.js +0 -15
- package/lib/virtualFile/computedEmbeddedCodes.d.ts +0 -4
- package/lib/virtualFile/computedEmbeddedCodes.js +0 -262
- package/lib/virtualFile/computedSfc.d.ts +0 -6
- package/lib/virtualFile/computedSfc.js +0 -340
- package/lib/virtualFile/computedVueSfc.d.ts +0 -4
- package/lib/virtualFile/computedVueSfc.js +0 -41
- package/lib/virtualFile/embeddedFile.d.ts +0 -11
- package/lib/virtualFile/embeddedFile.js +0 -14
- package/lib/virtualFile/vueFile.d.ts +0 -24
- package/lib/virtualFile/vueFile.js +0 -49
package/lib/virtualCode/index.js
CHANGED
|
@@ -6,6 +6,16 @@ const plugins_1 = require("../plugins");
|
|
|
6
6
|
const embeddedCodes_1 = require("./embeddedCodes");
|
|
7
7
|
const ir_1 = require("./ir");
|
|
8
8
|
class VueVirtualCode {
|
|
9
|
+
fileName;
|
|
10
|
+
languageId;
|
|
11
|
+
initSnapshot;
|
|
12
|
+
vueCompilerOptions;
|
|
13
|
+
id = 'main';
|
|
14
|
+
_snapshot;
|
|
15
|
+
_parsedSfcResult;
|
|
16
|
+
_ir;
|
|
17
|
+
_embeddedCodes;
|
|
18
|
+
_mappings;
|
|
9
19
|
get snapshot() {
|
|
10
20
|
return this._snapshot();
|
|
11
21
|
}
|
|
@@ -26,7 +36,6 @@ class VueVirtualCode {
|
|
|
26
36
|
this.languageId = languageId;
|
|
27
37
|
this.initSnapshot = initSnapshot;
|
|
28
38
|
this.vueCompilerOptions = vueCompilerOptions;
|
|
29
|
-
this.id = 'main';
|
|
30
39
|
this._snapshot = (0, alien_signals_1.signal)(initSnapshot);
|
|
31
40
|
this._parsedSfcResult = (0, alien_signals_1.computed)(lastResult => this.parseSfc(plugins, lastResult));
|
|
32
41
|
this._ir = (0, ir_1.useIR)(ts, plugins, fileName, this._snapshot, () => this._parsedSfcResult()?.result);
|
package/lib/virtualCode/ir.js
CHANGED
|
@@ -1,7 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.useIR = useIR;
|
|
4
|
-
const CompilerDOM = require("@vue/compiler-dom");
|
|
37
|
+
const CompilerDOM = __importStar(require("@vue/compiler-dom"));
|
|
5
38
|
const alien_signals_1 = require("alien-signals");
|
|
6
39
|
const signals_1 = require("../utils/signals");
|
|
7
40
|
const normalize_1 = require("./normalize");
|
|
@@ -1,7 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.normalizeTemplateAST = normalizeTemplateAST;
|
|
4
|
-
const CompilerDOM = require("@vue/compiler-dom");
|
|
37
|
+
const CompilerDOM = __importStar(require("@vue/compiler-dom"));
|
|
5
38
|
const forEachTemplateNode_1 = require("../utils/forEachTemplateNode");
|
|
6
39
|
// See https://github.com/vuejs/core/issues/3498
|
|
7
40
|
function normalizeTemplateAST(root) {
|
|
@@ -111,7 +144,9 @@ function createIfBranch(node, dir) {
|
|
|
111
144
|
type: CompilerDOM.NodeTypes.IF_BRANCH,
|
|
112
145
|
loc: node.loc,
|
|
113
146
|
condition: dir.name === 'else' ? undefined : dir.exp,
|
|
114
|
-
children: isTemplateIf && !CompilerDOM.findDir(node, 'for')
|
|
147
|
+
children: isTemplateIf && !CompilerDOM.findDir(node, 'for') && !CompilerDOM.findDir(node, 'slot')
|
|
148
|
+
? node.children
|
|
149
|
+
: [node],
|
|
115
150
|
userKey: CompilerDOM.findProp(node, 'key'),
|
|
116
151
|
isTemplateIf,
|
|
117
152
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/language-core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"**/*.js",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"directory": "packages/language-core"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@volar/language-core": "2.4.
|
|
16
|
+
"@volar/language-core": "2.4.27",
|
|
17
17
|
"@vue/compiler-dom": "^3.5.0",
|
|
18
18
|
"@vue/shared": "^3.5.0",
|
|
19
19
|
"alien-signals": "^3.0.0",
|
|
@@ -25,16 +25,8 @@
|
|
|
25
25
|
"@types/node": "^22.10.4",
|
|
26
26
|
"@types/path-browserify": "^1.0.1",
|
|
27
27
|
"@types/picomatch": "^4.0.0",
|
|
28
|
-
"@volar/typescript": "2.4.
|
|
28
|
+
"@volar/typescript": "2.4.27",
|
|
29
29
|
"@vue/compiler-sfc": "^3.5.0"
|
|
30
30
|
},
|
|
31
|
-
"
|
|
32
|
-
"typescript": "*"
|
|
33
|
-
},
|
|
34
|
-
"peerDependenciesMeta": {
|
|
35
|
-
"typescript": {
|
|
36
|
-
"optional": true
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
"gitHead": "0c9b66d0332698a1764fa56b64d47a6a30e81b47"
|
|
31
|
+
"gitHead": "3138110d767d3d6110899bc46518b53c4b456271"
|
|
40
32
|
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
const __VLS_directiveBindingRestFields: { instance: null; oldValue: null; modifiers: any; dir: any };
|
|
3
|
+
|
|
4
|
+
type __VLS_Elements = __VLS_SpreadMerge<SVGElementTagNameMap, HTMLElementTagNameMap>;
|
|
5
|
+
type __VLS_IsAny<T> = 0 extends 1 & T ? true : false;
|
|
6
|
+
type __VLS_PickNotAny<A, B> = __VLS_IsAny<A> extends true ? B : A;
|
|
7
|
+
type __VLS_SpreadMerge<A, B> = Omit<A, keyof B> & B;
|
|
8
|
+
type __VLS_WithComponent<
|
|
9
|
+
N0 extends string,
|
|
10
|
+
LocalComponents,
|
|
11
|
+
GlobalComponents,
|
|
12
|
+
Self,
|
|
13
|
+
N1 extends string,
|
|
14
|
+
N2 extends string = N1,
|
|
15
|
+
N3 extends string = N1,
|
|
16
|
+
> = N1 extends keyof LocalComponents ? { [K in N0]: LocalComponents[N1] }
|
|
17
|
+
: N2 extends keyof LocalComponents ? { [K in N0]: LocalComponents[N2] }
|
|
18
|
+
: N3 extends keyof LocalComponents ? { [K in N0]: LocalComponents[N3] }
|
|
19
|
+
: Self extends object ? { [K in N0]: Self }
|
|
20
|
+
: N1 extends keyof GlobalComponents ? { [K in N0]: GlobalComponents[N1] }
|
|
21
|
+
: N2 extends keyof GlobalComponents ? { [K in N0]: GlobalComponents[N2] }
|
|
22
|
+
: N3 extends keyof GlobalComponents ? { [K in N0]: GlobalComponents[N3] }
|
|
23
|
+
: {};
|
|
24
|
+
type __VLS_FunctionalComponentCtx<T, K> = __VLS_PickNotAny<
|
|
25
|
+
'__ctx' extends keyof __VLS_PickNotAny<K, {}> ? K extends { __ctx?: infer Ctx } ? NonNullable<Ctx> : never : any,
|
|
26
|
+
T extends (props: any, ctx: infer Ctx) => any ? Ctx : any
|
|
27
|
+
>;
|
|
28
|
+
type __VLS_FunctionalComponentProps<T, K> = '__ctx' extends keyof __VLS_PickNotAny<K, {}>
|
|
29
|
+
? K extends { __ctx?: { props?: infer P } } ? NonNullable<P> : never
|
|
30
|
+
: T extends (props: infer P, ...args: any) => any ? P
|
|
31
|
+
: {};
|
|
32
|
+
type __VLS_FunctionalComponent0<T> = (props: T extends { $props: infer Props } ? Props : {}, ctx?: any) => {
|
|
33
|
+
__ctx?: {
|
|
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>,
|
|
43
|
+
ctx?: any,
|
|
44
|
+
) => {
|
|
45
|
+
__ctx?: {
|
|
46
|
+
attrs?: any;
|
|
47
|
+
slots?: T extends { $slots: infer Slots } ? Slots : Record<string, any>;
|
|
48
|
+
emit?: T extends { $emit: infer Emit } ? Emit : {};
|
|
49
|
+
props?: typeof props;
|
|
50
|
+
expose?: (exposed: T) => void;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
type __VLS_IsFunction<T, K> = K extends keyof T ? __VLS_IsAny<T[K]> extends false ? unknown extends T[K] ? false
|
|
54
|
+
: true
|
|
55
|
+
: false
|
|
56
|
+
: false;
|
|
57
|
+
type __VLS_NormalizeComponentEvent<
|
|
58
|
+
Props,
|
|
59
|
+
Emits,
|
|
60
|
+
onEvent extends keyof Props,
|
|
61
|
+
Event extends keyof Emits,
|
|
62
|
+
CamelizedEvent extends keyof Emits,
|
|
63
|
+
> = __VLS_IsFunction<Props, onEvent> extends true ? Props
|
|
64
|
+
: __VLS_IsFunction<Emits, Event> extends true ? { [K in onEvent]?: Emits[Event] }
|
|
65
|
+
: __VLS_IsFunction<Emits, CamelizedEvent> extends true ? { [K in onEvent]?: Emits[CamelizedEvent] }
|
|
66
|
+
: Props;
|
|
67
|
+
// fix https://github.com/vuejs/language-tools/issues/926
|
|
68
|
+
type __VLS_UnionToIntersection<U> = (U extends unknown ? (arg: U) => unknown : never) extends
|
|
69
|
+
((arg: infer P) => unknown) ? P : never;
|
|
70
|
+
type __VLS_OverloadUnionInner<T, U = unknown> = U & T extends (...args: infer A) => infer R ? U extends T ? never
|
|
71
|
+
: __VLS_OverloadUnionInner<T, Pick<T, keyof T> & U & ((...args: A) => R)> | ((...args: A) => R)
|
|
72
|
+
: never;
|
|
73
|
+
type __VLS_OverloadUnion<T> = Exclude<
|
|
74
|
+
__VLS_OverloadUnionInner<(() => never) & T>,
|
|
75
|
+
T extends () => never ? never : () => never
|
|
76
|
+
>;
|
|
77
|
+
type __VLS_ConstructorOverloads<T> = __VLS_OverloadUnion<T> extends infer F
|
|
78
|
+
? F extends (event: infer E, ...args: infer A) => any ? { [K in E & string]: (...args: A) => void }
|
|
79
|
+
: never
|
|
80
|
+
: never;
|
|
81
|
+
type __VLS_NormalizeEmits<T> = __VLS_PrettifyGlobal<
|
|
82
|
+
__VLS_UnionToIntersection<
|
|
83
|
+
& __VLS_ConstructorOverloads<T>
|
|
84
|
+
& {
|
|
85
|
+
[K in keyof T]: T[K] extends any[] ? { (...args: T[K]): void } : never;
|
|
86
|
+
}
|
|
87
|
+
>
|
|
88
|
+
>;
|
|
89
|
+
type __VLS_EmitsToProps<T> = __VLS_PrettifyGlobal<
|
|
90
|
+
{
|
|
91
|
+
[K in string & keyof T as `on${Capitalize<K>}`]?: (
|
|
92
|
+
...args: T[K] extends (...args: infer P) => any ? P : T[K] extends null ? any[] : never
|
|
93
|
+
) => any;
|
|
94
|
+
}
|
|
95
|
+
>;
|
|
96
|
+
type __VLS_ShortEmitsToObject<E> = E extends Record<string, any[]> ? { [K in keyof E]: (...args: E[K]) => any }
|
|
97
|
+
: E;
|
|
98
|
+
type __VLS_ResolveEmits<
|
|
99
|
+
Comp,
|
|
100
|
+
Emits,
|
|
101
|
+
TypeEmits = Comp extends { __typeEmits?: infer T } ? unknown extends T ? {} : __VLS_ShortEmitsToObject<T> : {},
|
|
102
|
+
NormalizedEmits = __VLS_NormalizeEmits<Emits> extends infer E ? string extends keyof E ? {} : E : never,
|
|
103
|
+
> = __VLS_SpreadMerge<NormalizedEmits, TypeEmits>;
|
|
104
|
+
type __VLS_ResolveDirectives<T> = {
|
|
105
|
+
[K in keyof T & string as `v${Capitalize<K>}`]: T[K];
|
|
106
|
+
};
|
|
107
|
+
type __VLS_PrettifyGlobal<T> = (T extends any ? { [K in keyof T]: T[K] } : { [K in keyof T as K]: T[K] }) & {};
|
|
108
|
+
|
|
109
|
+
function __VLS_vFor<T>(source: T): T extends number ? [number, number][]
|
|
110
|
+
: T extends string ? [string, number][]
|
|
111
|
+
: T extends any[] ? [T[number], number][]
|
|
112
|
+
: T extends Iterable<infer V> ? [V, number][]
|
|
113
|
+
: [T[keyof T], `${keyof T & (string | number)}`, number][];
|
|
114
|
+
function __VLS_vSlot<S, D extends S>(slot: S, decl?: D): D extends (...args: infer P) => any ? P : any[];
|
|
115
|
+
function __VLS_asFunctionalDirective<T, ObjectDirective>(
|
|
116
|
+
dir: T,
|
|
117
|
+
od: ObjectDirective,
|
|
118
|
+
): T extends ObjectDirective ? NonNullable<
|
|
119
|
+
T[keyof T & ('created' | 'beforeMount' | 'mounted' | 'beforeUpdate' | 'updated' | 'beforeUnmount' | 'unmounted')]
|
|
120
|
+
>
|
|
121
|
+
: T extends (...args: any) => any ? T
|
|
122
|
+
: (arg1: unknown, arg2: unknown, arg3: unknown, arg4: unknown) => void;
|
|
123
|
+
function __VLS_asFunctionalComponent0<T, K = T extends new(...args: any) => any ? InstanceType<T> : unknown>(
|
|
124
|
+
t: T,
|
|
125
|
+
instance?: K,
|
|
126
|
+
): T extends new(...args: any) => any ? __VLS_FunctionalComponent0<K>
|
|
127
|
+
: T extends () => any ? (props: {}, ctx?: any) => ReturnType<T>
|
|
128
|
+
: T extends (...args: any) => any ? T
|
|
129
|
+
: __VLS_FunctionalComponent0<{}>;
|
|
130
|
+
function __VLS_asFunctionalComponent1<T, K = T extends new(...args: any) => any ? InstanceType<T> : unknown>(
|
|
131
|
+
t: T,
|
|
132
|
+
instance?: K,
|
|
133
|
+
): T extends new(...args: any) => any ? __VLS_FunctionalComponent1<K>
|
|
134
|
+
: T extends () => any ? (props: {}, ctx?: any) => ReturnType<T>
|
|
135
|
+
: T extends (...args: any) => any ? T
|
|
136
|
+
: __VLS_FunctionalComponent1<{}>;
|
|
137
|
+
function __VLS_functionalComponentArgsRest<T extends (...args: any) => any>(
|
|
138
|
+
t: T,
|
|
139
|
+
): 2 extends Parameters<T>['length'] ? [any] : [];
|
|
140
|
+
function __VLS_asFunctionalElement0<T>(tag: T, endTag?: T): (attrs: T) => void;
|
|
141
|
+
function __VLS_asFunctionalElement1<T>(tag: T, endTag?: T): (attrs: T & Record<string, unknown>) => void;
|
|
142
|
+
function __VLS_asFunctionalSlot<S>(slot: S): S extends () => infer R ? (props: {}) => R : NonNullable<S>;
|
|
143
|
+
function __VLS_tryAsConstant<const T>(t: T): T;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export {};
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getGlobalTypesFileName = getGlobalTypesFileName;
|
|
4
|
-
exports.generateGlobalTypes = generateGlobalTypes;
|
|
5
|
-
const names = require("./names");
|
|
6
|
-
const utils_1 = require("./utils");
|
|
7
|
-
function getGlobalTypesFileName(options) {
|
|
8
|
-
return [
|
|
9
|
-
options.lib,
|
|
10
|
-
options.target,
|
|
11
|
-
options.checkUnknownProps,
|
|
12
|
-
].map(v => (typeof v === 'boolean' ? Number(v) : v)).join('_') + '.d.ts';
|
|
13
|
-
}
|
|
14
|
-
function generateGlobalTypes(options) {
|
|
15
|
-
const { lib, target, checkUnknownProps } = options;
|
|
16
|
-
let text = `// @ts-nocheck${utils_1.newLine}`;
|
|
17
|
-
text += `export {}${utils_1.endOfLine}`;
|
|
18
|
-
if (target < 3.5) {
|
|
19
|
-
text += `declare module '${lib}' {
|
|
20
|
-
export interface GlobalComponents { }
|
|
21
|
-
export interface GlobalDirectives { }
|
|
22
|
-
}${utils_1.newLine}`;
|
|
23
|
-
}
|
|
24
|
-
text += `declare global {
|
|
25
|
-
${checkUnknownProps ? '' : `var ${names.PROPS_FALLBACK}: Record<string, unknown>;`}
|
|
26
|
-
|
|
27
|
-
const __VLS_directiveBindingRestFields: { instance: null, oldValue: null, modifiers: any, dir: any };
|
|
28
|
-
const ${names.placeholder}: any;
|
|
29
|
-
const ${names.intrinsics}: ${target >= 3.3
|
|
30
|
-
? `import('${lib}/jsx-runtime').JSX.IntrinsicElements`
|
|
31
|
-
: `globalThis.JSX.IntrinsicElements`};
|
|
32
|
-
|
|
33
|
-
type __VLS_Elements = __VLS_SpreadMerge<SVGElementTagNameMap, HTMLElementTagNameMap>;
|
|
34
|
-
type __VLS_GlobalComponents = ${target >= 3.5
|
|
35
|
-
? `import('${lib}').GlobalComponents`
|
|
36
|
-
: `import('${lib}').GlobalComponents & Pick<typeof import('${lib}'), 'Transition' | 'TransitionGroup' | 'KeepAlive' | 'Suspense' | 'Teleport'>`};
|
|
37
|
-
type __VLS_GlobalDirectives = import('${lib}').GlobalDirectives;
|
|
38
|
-
type __VLS_IsAny<T> = 0 extends 1 & T ? true : false;
|
|
39
|
-
type __VLS_PickNotAny<A, B> = __VLS_IsAny<A> extends true ? B : A;
|
|
40
|
-
type __VLS_SpreadMerge<A, B> = Omit<A, keyof B> & B;
|
|
41
|
-
type __VLS_WithComponent<N0 extends string, LocalComponents, Self, N1 extends string, N2 extends string = N1, N3 extends string = N1> =
|
|
42
|
-
N1 extends keyof LocalComponents ? { [K in N0]: LocalComponents[N1] } :
|
|
43
|
-
N2 extends keyof LocalComponents ? { [K in N0]: LocalComponents[N2] } :
|
|
44
|
-
N3 extends keyof LocalComponents ? { [K in N0]: LocalComponents[N3] } :
|
|
45
|
-
Self extends object ? { [K in N0]: Self } :
|
|
46
|
-
N1 extends keyof __VLS_GlobalComponents ? { [K in N0]: __VLS_GlobalComponents[N1] } :
|
|
47
|
-
N2 extends keyof __VLS_GlobalComponents ? { [K in N0]: __VLS_GlobalComponents[N2] } :
|
|
48
|
-
N3 extends keyof __VLS_GlobalComponents ? { [K in N0]: __VLS_GlobalComponents[N3] } :
|
|
49
|
-
{};
|
|
50
|
-
type __VLS_FunctionalComponentCtx<T, K> = __VLS_PickNotAny<'__ctx' extends keyof __VLS_PickNotAny<K, {}>
|
|
51
|
-
? K extends { __ctx?: infer Ctx } ? NonNullable<Ctx> : never : any
|
|
52
|
-
, T extends (props: any, ctx: infer Ctx) => any ? Ctx : any
|
|
53
|
-
>;
|
|
54
|
-
type __VLS_FunctionalComponentProps<T, K> = '__ctx' extends keyof __VLS_PickNotAny<K, {}>
|
|
55
|
-
? K extends { __ctx?: { props?: infer P } } ? NonNullable<P> : never
|
|
56
|
-
: T extends (props: infer P, ...args: any) => any ? P
|
|
57
|
-
: {};
|
|
58
|
-
type __VLS_FunctionalComponent<T> = (props: (T extends { $props: infer Props } ? Props : {})${checkUnknownProps ? '' : ' & Record<string, unknown>'}, ctx?: any) => ${target >= 3.3
|
|
59
|
-
? `import('${lib}/jsx-runtime').JSX.Element`
|
|
60
|
-
: `globalThis.JSX.Element`} & {
|
|
61
|
-
__ctx?: {
|
|
62
|
-
attrs?: any;
|
|
63
|
-
slots?: T extends { $slots: infer Slots } ? Slots : Record<string, any>;
|
|
64
|
-
emit?: T extends { $emit: infer Emit } ? Emit : {};
|
|
65
|
-
props?: typeof props;
|
|
66
|
-
expose?: (exposed: T) => void;
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
type __VLS_IsFunction<T, K> = K extends keyof T
|
|
70
|
-
? __VLS_IsAny<T[K]> extends false
|
|
71
|
-
? unknown extends T[K]
|
|
72
|
-
? false
|
|
73
|
-
: true
|
|
74
|
-
: false
|
|
75
|
-
: false;
|
|
76
|
-
type __VLS_NormalizeComponentEvent<
|
|
77
|
-
Props,
|
|
78
|
-
Emits,
|
|
79
|
-
onEvent extends keyof Props,
|
|
80
|
-
Event extends keyof Emits,
|
|
81
|
-
CamelizedEvent extends keyof Emits,
|
|
82
|
-
> = __VLS_IsFunction<Props, onEvent> extends true
|
|
83
|
-
? Props
|
|
84
|
-
: __VLS_IsFunction<Emits, Event> extends true
|
|
85
|
-
? { [K in onEvent]?: Emits[Event] }
|
|
86
|
-
: __VLS_IsFunction<Emits, CamelizedEvent> extends true
|
|
87
|
-
? { [K in onEvent]?: Emits[CamelizedEvent] }
|
|
88
|
-
: Props;
|
|
89
|
-
// fix https://github.com/vuejs/language-tools/issues/926
|
|
90
|
-
type __VLS_UnionToIntersection<U> = (U extends unknown ? (arg: U) => unknown : never) extends ((arg: infer P) => unknown) ? P : never;
|
|
91
|
-
type __VLS_OverloadUnionInner<T, U = unknown> = U & T extends (...args: infer A) => infer R
|
|
92
|
-
? U extends T
|
|
93
|
-
? never
|
|
94
|
-
: __VLS_OverloadUnionInner<T, Pick<T, keyof T> & U & ((...args: A) => R)> | ((...args: A) => R)
|
|
95
|
-
: never;
|
|
96
|
-
type __VLS_OverloadUnion<T> = Exclude<
|
|
97
|
-
__VLS_OverloadUnionInner<(() => never) & T>,
|
|
98
|
-
T extends () => never ? never : () => never
|
|
99
|
-
>;
|
|
100
|
-
type __VLS_ConstructorOverloads<T> = __VLS_OverloadUnion<T> extends infer F
|
|
101
|
-
? F extends (event: infer E, ...args: infer A) => any
|
|
102
|
-
? { [K in E & string]: (...args: A) => void; }
|
|
103
|
-
: never
|
|
104
|
-
: never;
|
|
105
|
-
type __VLS_NormalizeEmits<T> = __VLS_PrettifyGlobal<
|
|
106
|
-
__VLS_UnionToIntersection<
|
|
107
|
-
__VLS_ConstructorOverloads<T> & {
|
|
108
|
-
[K in keyof T]: T[K] extends any[] ? { (...args: T[K]): void } : never
|
|
109
|
-
}
|
|
110
|
-
>
|
|
111
|
-
>;
|
|
112
|
-
type __VLS_EmitsToProps<T> = __VLS_PrettifyGlobal<{
|
|
113
|
-
[K in string & keyof T as \`on\${Capitalize<K>}\`]?:
|
|
114
|
-
(...args: T[K] extends (...args: infer P) => any ? P : T[K] extends null ? any[] : never) => any;
|
|
115
|
-
}>;
|
|
116
|
-
type __VLS_ResolveEmits<
|
|
117
|
-
Comp,
|
|
118
|
-
Emits,
|
|
119
|
-
TypeEmits = ${target >= 3.6
|
|
120
|
-
? `Comp extends { __typeEmits?: infer T } ? unknown extends T ? {} : import('${lib}').ShortEmitsToObject<T> : {}`
|
|
121
|
-
: `{}`},
|
|
122
|
-
NormalizedEmits = __VLS_NormalizeEmits<Emits> extends infer E ? string extends keyof E ? {} : E : never,
|
|
123
|
-
> = __VLS_SpreadMerge<NormalizedEmits, TypeEmits>;
|
|
124
|
-
type __VLS_ResolveDirectives<T> = {
|
|
125
|
-
[K in keyof T & string as \`v\${Capitalize<K>}\`]: T[K];
|
|
126
|
-
};
|
|
127
|
-
type __VLS_PrettifyGlobal<T> = (T extends any ? { [K in keyof T]: T[K]; } : { [K in keyof T as K]: T[K]; }) & {};
|
|
128
|
-
type __VLS_UseTemplateRef<T> = Readonly<import('${lib}').ShallowRef<T | null>>;
|
|
129
|
-
type __VLS_ProxyRefs<T> = import('${lib}').ShallowUnwrapRef<T>;
|
|
130
|
-
|
|
131
|
-
function __VLS_getVForSourceType<T extends number | string | any[] | Iterable<any>>(source: T): [
|
|
132
|
-
item: T extends number ? number
|
|
133
|
-
: T extends string ? string
|
|
134
|
-
: T extends any[] ? T[number]
|
|
135
|
-
: T extends Iterable<infer T1> ? T1
|
|
136
|
-
: any,
|
|
137
|
-
index: number,
|
|
138
|
-
][];
|
|
139
|
-
function __VLS_getVForSourceType<T>(source: T): [
|
|
140
|
-
item: T[keyof T],
|
|
141
|
-
key: keyof T,
|
|
142
|
-
index: number,
|
|
143
|
-
][];
|
|
144
|
-
function __VLS_getSlotParameters<S, D extends S>(slot: S, decl?: D):
|
|
145
|
-
D extends (...args: infer P) => any ? P : any[];
|
|
146
|
-
function __VLS_asFunctionalDirective<T>(dir: T): T extends import('${lib}').ObjectDirective
|
|
147
|
-
? NonNullable<T['created' | 'beforeMount' | 'mounted' | 'beforeUpdate' | 'updated' | 'beforeUnmount' | 'unmounted']>
|
|
148
|
-
: T extends (...args: any) => any
|
|
149
|
-
? T
|
|
150
|
-
: (arg1: unknown, arg2: unknown, arg3: unknown, arg4: unknown) => void;
|
|
151
|
-
function __VLS_asFunctionalComponent<T, K = T extends new (...args: any) => any ? InstanceType<T> : unknown>(t: T, instance?: K):
|
|
152
|
-
T extends new (...args: any) => any ? __VLS_FunctionalComponent<K>
|
|
153
|
-
: T extends () => any ? (props: {}, ctx?: any) => ReturnType<T>
|
|
154
|
-
: T extends (...args: any) => any ? T
|
|
155
|
-
: __VLS_FunctionalComponent<{}>;
|
|
156
|
-
function __VLS_functionalComponentArgsRest<T extends (...args: any) => any>(t: T): 2 extends Parameters<T>['length'] ? [any] : [];
|
|
157
|
-
function __VLS_asFunctionalElement<T>(tag: T, endTag?: T): (attrs: T${checkUnknownProps ? '' : ' & Record<string, unknown>'}) => void;
|
|
158
|
-
function __VLS_asFunctionalSlot<S>(slot: S): S extends () => infer R ? (props: {}) => R : NonNullable<S>;
|
|
159
|
-
function __VLS_tryAsConstant<const T>(t: T): T;
|
|
160
|
-
}${utils_1.newLine}`;
|
|
161
|
-
return text;
|
|
162
|
-
}
|
|
163
|
-
//# sourceMappingURL=globalTypes.js.map
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateSrc = generateSrc;
|
|
4
|
-
exports.resolveSrcPath = resolveSrcPath;
|
|
5
|
-
const codeFeatures_1 = require("../codeFeatures");
|
|
6
|
-
const utils_1 = require("../utils");
|
|
7
|
-
const boundary_1 = require("../utils/boundary");
|
|
8
|
-
function* generateSrc(src) {
|
|
9
|
-
if (src === true) {
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
let { text } = src;
|
|
13
|
-
text = resolveSrcPath(text);
|
|
14
|
-
yield `export * from `;
|
|
15
|
-
const wrapCodeFeatures = {
|
|
16
|
-
...codeFeatures_1.codeFeatures.all,
|
|
17
|
-
...text !== src.text ? codeFeatures_1.codeFeatures.navigationWithoutRename : {},
|
|
18
|
-
};
|
|
19
|
-
const token = yield* (0, boundary_1.startBoundary)('main', src.offset, wrapCodeFeatures);
|
|
20
|
-
yield `'`;
|
|
21
|
-
yield [text.slice(0, src.text.length), 'main', src.offset, { __combineToken: token }];
|
|
22
|
-
yield text.slice(src.text.length);
|
|
23
|
-
yield `'`;
|
|
24
|
-
yield (0, boundary_1.endBoundary)(token, src.offset + src.text.length);
|
|
25
|
-
yield utils_1.endOfLine;
|
|
26
|
-
yield `export { default } from '${text}'${utils_1.endOfLine}`;
|
|
27
|
-
}
|
|
28
|
-
function resolveSrcPath(text) {
|
|
29
|
-
if (text.endsWith('.d.ts')) {
|
|
30
|
-
text = text.slice(0, -'.d.ts'.length);
|
|
31
|
-
}
|
|
32
|
-
else if (text.endsWith('.ts')) {
|
|
33
|
-
text = text.slice(0, -'.ts'.length);
|
|
34
|
-
}
|
|
35
|
-
else if (text.endsWith('.tsx')) {
|
|
36
|
-
text = text.slice(0, -'.tsx'.length) + '.jsx';
|
|
37
|
-
}
|
|
38
|
-
if (!text.endsWith('.js') && !text.endsWith('.jsx')) {
|
|
39
|
-
text = text + '.js';
|
|
40
|
-
}
|
|
41
|
-
return text;
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=src.js.map
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateClassProperty = generateClassProperty;
|
|
4
|
-
const codeFeatures_1 = require("../codeFeatures");
|
|
5
|
-
const utils_1 = require("../utils");
|
|
6
|
-
const wrapWith_1 = require("../utils/wrapWith");
|
|
7
|
-
function* generateClassProperty(styleIndex, classNameWithDot, offset, propertyType) {
|
|
8
|
-
yield `${utils_1.newLine} & { `;
|
|
9
|
-
yield* (0, wrapWith_1.wrapWith)('style_' + styleIndex, offset, offset + classNameWithDot.length, codeFeatures_1.codeFeatures.navigation, `'`, [
|
|
10
|
-
classNameWithDot.slice(1),
|
|
11
|
-
'style_' + styleIndex,
|
|
12
|
-
offset + 1,
|
|
13
|
-
utils_1.combineLastMapping,
|
|
14
|
-
], `'`);
|
|
15
|
-
yield `: ${propertyType}`;
|
|
16
|
-
yield ` }`;
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=classProperty.js.map
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateStyleImports = generateStyleImports;
|
|
4
|
-
const utils_1 = require("../utils");
|
|
5
|
-
const wrapWith_1 = require("../utils/wrapWith");
|
|
6
|
-
function* generateStyleImports(style) {
|
|
7
|
-
const features = {
|
|
8
|
-
navigation: true,
|
|
9
|
-
verification: true,
|
|
10
|
-
};
|
|
11
|
-
if (typeof style.src === 'object') {
|
|
12
|
-
yield `${utils_1.newLine} & typeof import(`;
|
|
13
|
-
yield* (0, wrapWith_1.wrapWith)('main', style.src.offset, style.src.offset + style.src.text.length, features, `'`, [style.src.text, 'main', style.src.offset, utils_1.combineLastMapping], `'`);
|
|
14
|
-
yield `).default`;
|
|
15
|
-
}
|
|
16
|
-
for (const { text, offset } of style.imports) {
|
|
17
|
-
yield `${utils_1.newLine} & typeof import('`;
|
|
18
|
-
yield [
|
|
19
|
-
text,
|
|
20
|
-
style.name,
|
|
21
|
-
offset,
|
|
22
|
-
features,
|
|
23
|
-
];
|
|
24
|
-
yield `').default`;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=imports.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type * as CompilerDOM from '@vue/compiler-dom';
|
|
2
|
-
import type { Code } from '../../types';
|
|
3
|
-
import type { TemplateCodegenContext } from './context';
|
|
4
|
-
import type { TemplateCodegenOptions } from './index';
|
|
5
|
-
export declare function generateElementChildren(options: TemplateCodegenOptions, ctx: TemplateCodegenContext, children: (CompilerDOM.TemplateChildNode | CompilerDOM.SimpleExpressionNode)[], enterNode?: boolean): Generator<Code>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateElementChildren = generateElementChildren;
|
|
4
|
-
const templateChild_1 = require("./templateChild");
|
|
5
|
-
function* generateElementChildren(options, ctx, children, enterNode = true) {
|
|
6
|
-
yield* ctx.generateAutoImportCompletion();
|
|
7
|
-
for (const childNode of children) {
|
|
8
|
-
yield* (0, templateChild_1.generateTemplateChild)(options, ctx, childNode, enterNode);
|
|
9
|
-
}
|
|
10
|
-
yield* ctx.generateAutoImportCompletion();
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=elementChildren.js.map
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.wrapWith = wrapWith;
|
|
4
|
-
function* wrapWith(source, startOffset, endOffset, features, ...codes) {
|
|
5
|
-
yield ['', source, startOffset, features];
|
|
6
|
-
let offset = 1;
|
|
7
|
-
for (const code of codes) {
|
|
8
|
-
if (typeof code !== 'string') {
|
|
9
|
-
offset++;
|
|
10
|
-
}
|
|
11
|
-
yield code;
|
|
12
|
-
}
|
|
13
|
-
yield ['', source, endOffset, { __combineOffset: offset }];
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=wrapWith.js.map
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { VirtualCode } from '@volar/language-core';
|
|
2
|
-
import type { Sfc, VueLanguagePluginReturn } from '../types';
|
|
3
|
-
export declare function computedEmbeddedCodes(plugins: VueLanguagePluginReturn[], fileName: string, sfc: Sfc): () => VirtualCode[];
|
|
4
|
-
export declare function resolveCommonLanguageId(lang: string): string;
|