@vue/language-core 2.0.13 → 2.0.14
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 +1 -1
- package/lib/codegen/common.d.ts +11 -0
- package/lib/codegen/common.js +70 -0
- package/lib/codegen/script/component.d.ts +9 -0
- package/lib/codegen/script/component.js +101 -0
- package/lib/codegen/script/context.d.ts +25 -0
- package/lib/codegen/script/context.js +124 -0
- package/lib/{generators → codegen/script}/globalTypes.d.ts +1 -1
- package/lib/codegen/script/globalTypes.js +135 -0
- package/lib/codegen/script/index.d.ts +33 -0
- package/lib/codegen/script/index.js +127 -0
- package/lib/codegen/script/internalComponent.d.ts +5 -0
- package/lib/codegen/script/internalComponent.js +58 -0
- package/lib/codegen/script/scriptSetup.d.ts +6 -0
- package/lib/codegen/script/scriptSetup.js +338 -0
- package/lib/codegen/script/src.d.ts +2 -0
- package/lib/codegen/script/src.js +52 -0
- package/lib/codegen/script/template.d.ts +5 -0
- package/lib/codegen/script/template.js +193 -0
- package/lib/codegen/template/camelized.d.ts +2 -0
- package/lib/codegen/template/camelized.js +32 -0
- package/lib/codegen/template/context.d.ts +44 -0
- package/lib/codegen/template/context.js +171 -0
- package/lib/codegen/template/element.d.ts +7 -0
- package/lib/codegen/template/element.js +325 -0
- package/lib/codegen/template/elementChildren.d.ts +5 -0
- package/lib/codegen/template/elementChildren.js +21 -0
- package/lib/codegen/template/elementDirectives.d.ts +5 -0
- package/lib/codegen/template/elementDirectives.js +46 -0
- package/lib/codegen/template/elementEvents.d.ts +7 -0
- package/lib/codegen/template/elementEvents.js +141 -0
- package/lib/codegen/template/elementProps.d.ts +5 -0
- package/lib/codegen/template/elementProps.js +250 -0
- package/lib/codegen/template/index.d.ts +60 -0
- package/lib/codegen/template/index.js +217 -0
- package/lib/codegen/template/interpolation.d.ts +6 -0
- package/lib/{utils/transform.js → codegen/template/interpolation.js} +76 -46
- package/lib/codegen/template/objectProperty.d.ts +4 -0
- package/lib/codegen/template/objectProperty.js +31 -0
- package/lib/codegen/template/propertyAccess.d.ts +4 -0
- package/lib/codegen/template/propertyAccess.js +24 -0
- package/lib/codegen/template/slotOutlet.d.ts +5 -0
- package/lib/codegen/template/slotOutlet.js +72 -0
- package/lib/codegen/template/stringLiteralKey.d.ts +2 -0
- package/lib/codegen/template/stringLiteralKey.js +14 -0
- package/lib/codegen/template/templateChild.d.ts +7 -0
- package/lib/codegen/template/templateChild.js +156 -0
- package/lib/codegen/template/vFor.d.ts +12 -0
- package/lib/codegen/template/vFor.js +69 -0
- package/lib/codegen/template/vIf.d.ts +5 -0
- package/lib/codegen/template/vIf.js +53 -0
- package/lib/languageModule.d.ts +3 -3
- package/lib/languageModule.js +2 -3
- package/lib/plugins/shared.d.ts +2 -0
- package/lib/plugins/shared.js +12 -0
- package/lib/plugins/vue-sfc-customblocks.js +2 -2
- package/lib/plugins/vue-sfc-scripts.js +2 -3
- package/lib/plugins/vue-sfc-styles.js +3 -3
- package/lib/plugins/vue-sfc-template.js +2 -2
- package/lib/plugins/vue-template-inline-css.js +34 -2
- package/lib/plugins/vue-template-inline-ts.js +10 -8
- package/lib/plugins/vue-tsx.d.ts +42 -5
- package/lib/plugins/vue-tsx.js +38 -28
- package/lib/types.d.ts +1 -3
- package/lib/utils/ts.js +0 -29
- package/lib/virtualFile/computedFiles.d.ts +1 -1
- package/lib/virtualFile/computedFiles.js +22 -12
- package/lib/virtualFile/computedMappings.js +3 -3
- package/lib/virtualFile/computedSfc.js +22 -1
- package/lib/virtualFile/embeddedFile.d.ts +2 -3
- package/lib/virtualFile/embeddedFile.js +1 -2
- package/lib/virtualFile/vueFile.d.ts +3 -5
- package/lib/virtualFile/vueFile.js +6 -8
- package/package.json +3 -3
- package/lib/generators/globalTypes.js +0 -135
- package/lib/generators/inlineCss.d.ts +0 -3
- package/lib/generators/inlineCss.js +0 -37
- package/lib/generators/script.d.ts +0 -13
- package/lib/generators/script.js +0 -981
- package/lib/generators/template.d.ts +0 -19
- package/lib/generators/template.js +0 -1578
- package/lib/generators/utils.d.ts +0 -5
- package/lib/generators/utils.js +0 -54
- package/lib/utils/transform.d.ts +0 -8
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.computedMappings = void 0;
|
|
4
4
|
const language_core_1 = require("@volar/language-core");
|
|
5
5
|
const computeds_1 = require("computeds");
|
|
6
|
-
const
|
|
6
|
+
const shared_1 = require("../plugins/shared");
|
|
7
7
|
function computedMappings(snapshot, sfc) {
|
|
8
8
|
return (0, computeds_1.computed)(() => {
|
|
9
|
-
const str = [[snapshot().getText(0, snapshot().getLength()), undefined, 0,
|
|
9
|
+
const str = [[snapshot().getText(0, snapshot().getLength()), undefined, 0, shared_1.allCodeFeatures]];
|
|
10
10
|
for (const block of [
|
|
11
11
|
sfc.script,
|
|
12
12
|
sfc.scriptSetup,
|
|
@@ -55,7 +55,7 @@ function computedMappings(snapshot, sfc) {
|
|
|
55
55
|
sourceOffsets: offsets,
|
|
56
56
|
generatedOffsets: offsets,
|
|
57
57
|
lengths: offsets.map(() => 0),
|
|
58
|
-
data:
|
|
58
|
+
data: { structure: true },
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
}
|
|
@@ -32,7 +32,7 @@ function computedSfc(ts, plugins, fileName, snapshot, parsed) {
|
|
|
32
32
|
get ast() { return ast(); },
|
|
33
33
|
});
|
|
34
34
|
});
|
|
35
|
-
const
|
|
35
|
+
const scriptSetupOriginal = computedNullableSfcBlock('scriptSetup', 'js', (0, computeds_1.computed)(() => parsed()?.descriptor.scriptSetup ?? undefined), (block, base) => {
|
|
36
36
|
const generic = (0, computeds_1.computed)(() => {
|
|
37
37
|
const _block = block();
|
|
38
38
|
return typeof _block.attrs.generic === 'string' ? _block.attrs.generic : undefined;
|
|
@@ -48,6 +48,27 @@ function computedSfc(ts, plugins, fileName, snapshot, parsed) {
|
|
|
48
48
|
get ast() { return ast(); },
|
|
49
49
|
});
|
|
50
50
|
});
|
|
51
|
+
const hasScript = (0, computeds_1.computed)(() => !!parsed()?.descriptor.script);
|
|
52
|
+
const hasScriptSetup = (0, computeds_1.computed)(() => !!parsed()?.descriptor.scriptSetup);
|
|
53
|
+
const scriptSetup = (0, computeds_1.computed)(() => {
|
|
54
|
+
if (!hasScript() && !hasScriptSetup()) {
|
|
55
|
+
//#region monkey fix: https://github.com/vuejs/language-tools/pull/2113
|
|
56
|
+
return {
|
|
57
|
+
content: '',
|
|
58
|
+
lang: 'ts',
|
|
59
|
+
name: '',
|
|
60
|
+
start: 0,
|
|
61
|
+
end: 0,
|
|
62
|
+
startTagEnd: 0,
|
|
63
|
+
endTagStart: 0,
|
|
64
|
+
generic: undefined,
|
|
65
|
+
genericOffset: 0,
|
|
66
|
+
attrs: {},
|
|
67
|
+
ast: ts.createSourceFile('', '', 99, false, ts.ScriptKind.TS),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
return scriptSetupOriginal();
|
|
71
|
+
});
|
|
51
72
|
const styles = (0, computeds_1.computedArray)((0, computeds_1.computed)(() => parsed()?.descriptor.styles ?? []), (block, i) => {
|
|
52
73
|
const base = computedSfcBlock('style_' + i, 'css', block);
|
|
53
74
|
const module = (0, computeds_1.computed)(() => typeof block().module === 'string' ? block().module : block().module ? '$style' : undefined);
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import type { Mapping
|
|
1
|
+
import type { Mapping } from '@volar/language-core';
|
|
2
2
|
import type { Code } from '../types';
|
|
3
3
|
export declare class VueEmbeddedCode {
|
|
4
4
|
id: string;
|
|
5
5
|
lang: string;
|
|
6
6
|
content: Code[];
|
|
7
|
-
contentStacks: StackNode[];
|
|
8
7
|
parentCodeId?: string;
|
|
9
8
|
linkedCodeMappings: Mapping[];
|
|
10
9
|
embeddedCodes: VueEmbeddedCode[];
|
|
11
|
-
constructor(id: string, lang: string, content: Code[]
|
|
10
|
+
constructor(id: string, lang: string, content: Code[]);
|
|
12
11
|
}
|
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VueEmbeddedCode = void 0;
|
|
4
4
|
class VueEmbeddedCode {
|
|
5
|
-
constructor(id, lang, content
|
|
5
|
+
constructor(id, lang, content) {
|
|
6
6
|
this.id = id;
|
|
7
7
|
this.lang = lang;
|
|
8
8
|
this.content = content;
|
|
9
|
-
this.contentStacks = contentStacks;
|
|
10
9
|
this.linkedCodeMappings = [];
|
|
11
10
|
this.embeddedCodes = [];
|
|
12
11
|
}
|
|
@@ -1,25 +1,23 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { VirtualCode } from '@volar/language-core';
|
|
2
2
|
import { Signal } from 'computeds';
|
|
3
3
|
import type * as ts from 'typescript';
|
|
4
4
|
import type { VueCompilerOptions, VueLanguagePlugin } from '../types';
|
|
5
|
-
export declare class
|
|
5
|
+
export declare class VueVirtualCode implements VirtualCode {
|
|
6
6
|
fileName: string;
|
|
7
7
|
languageId: string;
|
|
8
8
|
initSnapshot: ts.IScriptSnapshot;
|
|
9
9
|
vueCompilerOptions: VueCompilerOptions;
|
|
10
10
|
plugins: ReturnType<VueLanguagePlugin>[];
|
|
11
11
|
ts: typeof import('typescript');
|
|
12
|
-
codegenStack: boolean;
|
|
13
12
|
id: string;
|
|
14
13
|
_snapshot: Signal<ts.IScriptSnapshot>;
|
|
15
14
|
getVueSfc: () => import("@vue/compiler-sfc").SFCParseResult | undefined;
|
|
16
15
|
sfc: import("../types").Sfc;
|
|
17
16
|
getMappings: () => import("@volar/language-core").CodeMapping[];
|
|
18
17
|
getEmbeddedCodes: () => VirtualCode[];
|
|
19
|
-
codegenStacks: Stack[];
|
|
20
18
|
get embeddedCodes(): VirtualCode[];
|
|
21
19
|
get snapshot(): ts.IScriptSnapshot;
|
|
22
20
|
get mappings(): import("@volar/language-core").CodeMapping[];
|
|
23
|
-
constructor(fileName: string, languageId: string, initSnapshot: ts.IScriptSnapshot, vueCompilerOptions: VueCompilerOptions, plugins: ReturnType<VueLanguagePlugin>[], ts: typeof import('typescript')
|
|
21
|
+
constructor(fileName: string, languageId: string, initSnapshot: ts.IScriptSnapshot, vueCompilerOptions: VueCompilerOptions, plugins: ReturnType<VueLanguagePlugin>[], ts: typeof import('typescript'));
|
|
24
22
|
update(newSnapshot: ts.IScriptSnapshot): void;
|
|
25
23
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.VueVirtualCode = void 0;
|
|
4
4
|
const computeds_1 = require("computeds");
|
|
5
5
|
const computedFiles_1 = require("./computedFiles");
|
|
6
6
|
const computedMappings_1 = require("./computedMappings");
|
|
7
7
|
const computedSfc_1 = require("./computedSfc");
|
|
8
8
|
const computedVueSfc_1 = require("./computedVueSfc");
|
|
9
|
-
class
|
|
9
|
+
class VueVirtualCode {
|
|
10
|
+
// others
|
|
10
11
|
get embeddedCodes() {
|
|
11
12
|
return this.getEmbeddedCodes();
|
|
12
13
|
}
|
|
@@ -16,28 +17,25 @@ class VueGeneratedCode {
|
|
|
16
17
|
get mappings() {
|
|
17
18
|
return this.getMappings();
|
|
18
19
|
}
|
|
19
|
-
constructor(fileName, languageId, initSnapshot, vueCompilerOptions, plugins, ts
|
|
20
|
+
constructor(fileName, languageId, initSnapshot, vueCompilerOptions, plugins, ts) {
|
|
20
21
|
this.fileName = fileName;
|
|
21
22
|
this.languageId = languageId;
|
|
22
23
|
this.initSnapshot = initSnapshot;
|
|
23
24
|
this.vueCompilerOptions = vueCompilerOptions;
|
|
24
25
|
this.plugins = plugins;
|
|
25
26
|
this.ts = ts;
|
|
26
|
-
this.codegenStack = codegenStack;
|
|
27
27
|
// sources
|
|
28
28
|
this.id = 'main';
|
|
29
29
|
// computeds
|
|
30
30
|
this.getVueSfc = (0, computedVueSfc_1.computedVueSfc)(this.plugins, this.fileName, () => this._snapshot());
|
|
31
31
|
this.sfc = (0, computedSfc_1.computedSfc)(this.ts, this.plugins, this.fileName, () => this._snapshot(), this.getVueSfc);
|
|
32
32
|
this.getMappings = (0, computedMappings_1.computedMappings)(() => this._snapshot(), this.sfc);
|
|
33
|
-
this.getEmbeddedCodes = (0, computedFiles_1.computedFiles)(this.plugins, this.fileName, this.sfc
|
|
34
|
-
// others
|
|
35
|
-
this.codegenStacks = [];
|
|
33
|
+
this.getEmbeddedCodes = (0, computedFiles_1.computedFiles)(this.plugins, this.fileName, this.sfc);
|
|
36
34
|
this._snapshot = (0, computeds_1.signal)(initSnapshot);
|
|
37
35
|
}
|
|
38
36
|
update(newSnapshot) {
|
|
39
37
|
this._snapshot.set(newSnapshot);
|
|
40
38
|
}
|
|
41
39
|
}
|
|
42
|
-
exports.
|
|
40
|
+
exports.VueVirtualCode = VueVirtualCode;
|
|
43
41
|
//# sourceMappingURL=vueFile.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/language-core",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.14",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"**/*.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"directory": "packages/language-core"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@volar/language-core": "2.2.0-alpha.
|
|
15
|
+
"@volar/language-core": "2.2.0-alpha.10",
|
|
16
16
|
"@vue/compiler-dom": "^3.4.0",
|
|
17
17
|
"@vue/shared": "^3.4.0",
|
|
18
18
|
"computeds": "^0.0.1",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"optional": true
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "ce1412067f88b7f9af03a2d3e04c220b4921c363"
|
|
38
38
|
}
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateGlobalTypes = void 0;
|
|
4
|
-
const shared_1 = require("../utils/shared");
|
|
5
|
-
function generateGlobalTypes(vueCompilerOptions) {
|
|
6
|
-
const fnPropsType = `(K extends { $props: infer Props } ? Props : any)${vueCompilerOptions.strictTemplates ? '' : ' & Record<string, unknown>'}`;
|
|
7
|
-
return `
|
|
8
|
-
; export const __VLS_globalTypesStart = {};
|
|
9
|
-
declare global {
|
|
10
|
-
// @ts-ignore
|
|
11
|
-
type __VLS_IntrinsicElements = __VLS_PickNotAny<import('vue/jsx-runtime').JSX.IntrinsicElements, __VLS_PickNotAny<globalThis.JSX.IntrinsicElements, Record<string, any>>>;
|
|
12
|
-
// @ts-ignore
|
|
13
|
-
type __VLS_Element = __VLS_PickNotAny<import('vue/jsx-runtime').JSX.Element, globalThis.JSX.Element>;
|
|
14
|
-
// @ts-ignore
|
|
15
|
-
type __VLS_GlobalComponents = ${[
|
|
16
|
-
`__VLS_PickNotAny<import('vue').GlobalComponents, {}>`,
|
|
17
|
-
`__VLS_PickNotAny<import('@vue/runtime-core').GlobalComponents, {}>`,
|
|
18
|
-
`__VLS_PickNotAny<import('@vue/runtime-dom').GlobalComponents, {}>`,
|
|
19
|
-
`Pick<typeof import('${vueCompilerOptions.lib}'), 'Transition' | 'TransitionGroup' | 'KeepAlive' | 'Suspense' | 'Teleport'>`
|
|
20
|
-
].join(' & ')};
|
|
21
|
-
type __VLS_IsAny<T> = 0 extends 1 & T ? true : false;
|
|
22
|
-
type __VLS_PickNotAny<A, B> = __VLS_IsAny<A> extends true ? B : A;
|
|
23
|
-
|
|
24
|
-
const __VLS_intrinsicElements: __VLS_IntrinsicElements;
|
|
25
|
-
|
|
26
|
-
// v-for
|
|
27
|
-
function __VLS_getVForSourceType(source: number): [number, number, number][];
|
|
28
|
-
function __VLS_getVForSourceType(source: string): [string, number, number][];
|
|
29
|
-
function __VLS_getVForSourceType<T extends any[]>(source: T): [
|
|
30
|
-
item: T[number],
|
|
31
|
-
key: number,
|
|
32
|
-
index: number,
|
|
33
|
-
][];
|
|
34
|
-
function __VLS_getVForSourceType<T extends { [Symbol.iterator](): Iterator<any> }>(source: T): [
|
|
35
|
-
item: T extends { [Symbol.iterator](): Iterator<infer T1> } ? T1 : never,
|
|
36
|
-
key: number,
|
|
37
|
-
index: undefined,
|
|
38
|
-
][];
|
|
39
|
-
// #3845
|
|
40
|
-
function __VLS_getVForSourceType<T extends number | { [Symbol.iterator](): Iterator<any> }>(source: T): [
|
|
41
|
-
item: number | (Exclude<T, number> extends { [Symbol.iterator](): Iterator<infer T1> } ? T1 : never),
|
|
42
|
-
key: number,
|
|
43
|
-
index: undefined,
|
|
44
|
-
][];
|
|
45
|
-
function __VLS_getVForSourceType<T>(source: T): [
|
|
46
|
-
item: T[keyof T],
|
|
47
|
-
key: keyof T,
|
|
48
|
-
index: number,
|
|
49
|
-
][];
|
|
50
|
-
|
|
51
|
-
// @ts-ignore
|
|
52
|
-
function __VLS_getSlotParams<T>(slot: T): Parameters<__VLS_PickNotAny<NonNullable<T>, (...args: any[]) => any>>;
|
|
53
|
-
// @ts-ignore
|
|
54
|
-
function __VLS_getSlotParam<T>(slot: T): Parameters<__VLS_PickNotAny<NonNullable<T>, (...args: any[]) => any>>[0];
|
|
55
|
-
function __VLS_directiveFunction<T>(dir: T):
|
|
56
|
-
T extends import('${vueCompilerOptions.lib}').ObjectDirective<infer E, infer V> | import('${vueCompilerOptions.lib}').FunctionDirective<infer E, infer V> ? (value: V) => void
|
|
57
|
-
: T;
|
|
58
|
-
function __VLS_withScope<T, K>(ctx: T, scope: K): ctx is T & K;
|
|
59
|
-
function __VLS_makeOptional<T>(t: T): { [K in keyof T]?: T[K] };
|
|
60
|
-
|
|
61
|
-
type __VLS_SelfComponent<N, C> = string extends N ? {} : N extends string ? { [P in N]: C } : {};
|
|
62
|
-
type __VLS_WithComponent<N0 extends string, LocalComponents, N1 extends string, N2 extends string, N3 extends string> =
|
|
63
|
-
N1 extends keyof LocalComponents ? N1 extends N0 ? Pick<LocalComponents, N0 extends keyof LocalComponents ? N0 : never> : { [K in N0]: LocalComponents[N1] } :
|
|
64
|
-
N2 extends keyof LocalComponents ? N2 extends N0 ? Pick<LocalComponents, N0 extends keyof LocalComponents ? N0 : never> : { [K in N0]: LocalComponents[N2] } :
|
|
65
|
-
N3 extends keyof LocalComponents ? N3 extends N0 ? Pick<LocalComponents, N0 extends keyof LocalComponents ? N0 : never> : { [K in N0]: LocalComponents[N3] } :
|
|
66
|
-
N1 extends keyof __VLS_GlobalComponents ? N1 extends N0 ? Pick<__VLS_GlobalComponents, N0 extends keyof __VLS_GlobalComponents ? N0 : never> : { [K in N0]: __VLS_GlobalComponents[N1] } :
|
|
67
|
-
N2 extends keyof __VLS_GlobalComponents ? N2 extends N0 ? Pick<__VLS_GlobalComponents, N0 extends keyof __VLS_GlobalComponents ? N0 : never> : { [K in N0]: __VLS_GlobalComponents[N2] } :
|
|
68
|
-
N3 extends keyof __VLS_GlobalComponents ? N3 extends N0 ? Pick<__VLS_GlobalComponents, N0 extends keyof __VLS_GlobalComponents ? N0 : never> : { [K in N0]: __VLS_GlobalComponents[N3] } :
|
|
69
|
-
${vueCompilerOptions.strictTemplates ? '{}' : '{ [K in N0]: unknown }'}
|
|
70
|
-
|
|
71
|
-
type __VLS_FillingEventArg_ParametersLength<E extends (...args: any) => any> = __VLS_IsAny<Parameters<E>> extends true ? -1 : Parameters<E>['length'];
|
|
72
|
-
type __VLS_FillingEventArg<E> = E extends (...args: any) => any ? __VLS_FillingEventArg_ParametersLength<E> extends 0 ? ($event?: undefined) => ReturnType<E> : E : E;
|
|
73
|
-
function __VLS_asFunctionalComponent<T, K = T extends new (...args: any) => any ? InstanceType<T> : unknown>(t: T, instance?: K):
|
|
74
|
-
T extends new (...args: any) => any
|
|
75
|
-
? (props: ${fnPropsType}, ctx?: any) => __VLS_Element & { __ctx?: {
|
|
76
|
-
attrs?: any,
|
|
77
|
-
slots?: K extends { ${(0, shared_1.getSlotsPropertyName)(vueCompilerOptions.target)}: infer Slots } ? Slots : any,
|
|
78
|
-
emit?: K extends { $emit: infer Emit } ? Emit : any
|
|
79
|
-
} & { props?: ${fnPropsType}; expose?(exposed: K): void; } }
|
|
80
|
-
: T extends () => any ? (props: {}, ctx?: any) => ReturnType<T>
|
|
81
|
-
: T extends (...args: any) => any ? T
|
|
82
|
-
: (_: {}${vueCompilerOptions.strictTemplates ? '' : ' & Record<string, unknown>'}, ctx?: any) => { __ctx?: { attrs?: any, expose?: any, slots?: any, emit?: any, props?: {}${vueCompilerOptions.strictTemplates ? '' : ' & Record<string, unknown>'} } };
|
|
83
|
-
function __VLS_elementAsFunctionalComponent<T>(t: T): (_: T${vueCompilerOptions.strictTemplates ? '' : ' & Record<string, unknown>'}, ctx?: any) => { __ctx?: { attrs?: any, expose?: any, slots?: any, emit?: any, props?: T${vueCompilerOptions.strictTemplates ? '' : ' & Record<string, unknown>'} } };
|
|
84
|
-
function __VLS_functionalComponentArgsRest<T extends (...args: any) => any>(t: T): Parameters<T>['length'] extends 2 ? [any] : [];
|
|
85
|
-
function __VLS_pickEvent<E1, E2>(emitEvent: E1, propEvent: E2): __VLS_FillingEventArg<
|
|
86
|
-
__VLS_PickNotAny<
|
|
87
|
-
__VLS_AsFunctionOrAny<E2>,
|
|
88
|
-
__VLS_AsFunctionOrAny<E1>
|
|
89
|
-
>
|
|
90
|
-
> | undefined;
|
|
91
|
-
function __VLS_pickFunctionalComponentCtx<T, K>(comp: T, compInstance: K): __VLS_PickNotAny<
|
|
92
|
-
'__ctx' extends keyof __VLS_PickNotAny<K, {}> ? K extends { __ctx?: infer Ctx } ? Ctx : never : any
|
|
93
|
-
, T extends (props: any, ctx: infer Ctx) => any ? Ctx : any
|
|
94
|
-
>;
|
|
95
|
-
type __VLS_FunctionalComponentProps<T, K> =
|
|
96
|
-
'__ctx' extends keyof __VLS_PickNotAny<K, {}> ? K extends { __ctx?: { props?: infer P } } ? NonNullable<P> : never
|
|
97
|
-
: T extends (props: infer P, ...args: any) => any ? P :
|
|
98
|
-
{};
|
|
99
|
-
type __VLS_AsFunctionOrAny<F> = unknown extends F ? any : ((...args: any) => any) extends F ? F : any;
|
|
100
|
-
|
|
101
|
-
function __VLS_normalizeSlot<S>(s: S): S extends () => infer R ? (props: {}) => R : S;
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* emit
|
|
105
|
-
*/
|
|
106
|
-
// fix https://github.com/vuejs/language-tools/issues/926
|
|
107
|
-
type __VLS_UnionToIntersection<U> = (U extends unknown ? (arg: U) => unknown : never) extends ((arg: infer P) => unknown) ? P : never;
|
|
108
|
-
type __VLS_OverloadUnionInner<T, U = unknown> = U & T extends (...args: infer A) => infer R
|
|
109
|
-
? U extends T
|
|
110
|
-
? never
|
|
111
|
-
: __VLS_OverloadUnionInner<T, Pick<T, keyof T> & U & ((...args: A) => R)> | ((...args: A) => R)
|
|
112
|
-
: never;
|
|
113
|
-
type __VLS_OverloadUnion<T> = Exclude<
|
|
114
|
-
__VLS_OverloadUnionInner<(() => never) & T>,
|
|
115
|
-
T extends () => never ? never : () => never
|
|
116
|
-
>;
|
|
117
|
-
type __VLS_ConstructorOverloads<T> = __VLS_OverloadUnion<T> extends infer F
|
|
118
|
-
? F extends (event: infer E, ...args: infer A) => any
|
|
119
|
-
? { [K in E & string]: (...args: A) => void; }
|
|
120
|
-
: never
|
|
121
|
-
: never;
|
|
122
|
-
type __VLS_NormalizeEmits<T> = __VLS_PrettifyGlobal<
|
|
123
|
-
__VLS_UnionToIntersection<
|
|
124
|
-
__VLS_ConstructorOverloads<T> & {
|
|
125
|
-
[K in keyof T]: T[K] extends any[] ? { (...args: T[K]): void } : never
|
|
126
|
-
}
|
|
127
|
-
>
|
|
128
|
-
>;
|
|
129
|
-
type __VLS_PrettifyGlobal<T> = { [K in keyof T]: T[K]; } & {};
|
|
130
|
-
}
|
|
131
|
-
export const __VLS_globalTypesEnd = {};`;
|
|
132
|
-
}
|
|
133
|
-
exports.generateGlobalTypes = generateGlobalTypes;
|
|
134
|
-
;
|
|
135
|
-
//# sourceMappingURL=globalTypes.js.map
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generate = void 0;
|
|
4
|
-
const CompilerDOM = require("@vue/compiler-dom");
|
|
5
|
-
const template_1 = require("./template");
|
|
6
|
-
const utils_1 = require("./utils");
|
|
7
|
-
const codeFeatures = (0, utils_1.enableAllFeatures)({
|
|
8
|
-
format: false,
|
|
9
|
-
structure: false,
|
|
10
|
-
});
|
|
11
|
-
function* generate(templateAst) {
|
|
12
|
-
for (const node of (0, template_1.forEachElementNode)(templateAst)) {
|
|
13
|
-
for (const prop of node.props) {
|
|
14
|
-
if (prop.type === CompilerDOM.NodeTypes.DIRECTIVE
|
|
15
|
-
&& prop.name === 'bind'
|
|
16
|
-
&& prop.arg?.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION
|
|
17
|
-
&& prop.exp?.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION
|
|
18
|
-
&& prop.arg.content === 'style'
|
|
19
|
-
&& prop.exp.constType === CompilerDOM.ConstantTypes.CAN_STRINGIFY) {
|
|
20
|
-
const endCrt = prop.arg.loc.source[prop.arg.loc.source.length - 1]; // " | '
|
|
21
|
-
const start = prop.arg.loc.source.indexOf(endCrt) + 1;
|
|
22
|
-
const end = prop.arg.loc.source.lastIndexOf(endCrt);
|
|
23
|
-
const content = prop.arg.loc.source.substring(start, end);
|
|
24
|
-
yield `x { `;
|
|
25
|
-
yield [
|
|
26
|
-
content,
|
|
27
|
-
'template',
|
|
28
|
-
prop.arg.loc.start.offset + start,
|
|
29
|
-
codeFeatures,
|
|
30
|
-
];
|
|
31
|
-
yield ` }\n`;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
exports.generate = generate;
|
|
37
|
-
//# sourceMappingURL=inlineCss.js.map
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Mapping } from '@volar/language-core';
|
|
2
|
-
import type * as ts from 'typescript';
|
|
3
|
-
import type { ScriptRanges } from '../parsers/scriptRanges';
|
|
4
|
-
import type { ScriptSetupRanges } from '../parsers/scriptSetupRanges';
|
|
5
|
-
import type { Code, CodeAndStack, Sfc, VueCompilerOptions } from '../types';
|
|
6
|
-
export declare function generate(ts: typeof import('typescript'), fileName: string, script: Sfc['script'], scriptSetup: Sfc['scriptSetup'], styles: Sfc['styles'], // TODO: computed it
|
|
7
|
-
lang: string, scriptRanges: ScriptRanges | undefined, scriptSetupRanges: ScriptSetupRanges | undefined, templateCodegen: {
|
|
8
|
-
tsCodes: Code[];
|
|
9
|
-
tsCodegenStacks: string[];
|
|
10
|
-
tagNames: Set<string>;
|
|
11
|
-
accessedGlobalVariables: Set<string>;
|
|
12
|
-
hasSlot: boolean;
|
|
13
|
-
} | undefined, compilerOptions: ts.CompilerOptions, vueCompilerOptions: VueCompilerOptions, globalTypesHolder: string | undefined, getGeneratedLength: () => number, linkedCodeMappings: Mapping<any>[] | undefined, codegenStack: boolean): Generator<CodeAndStack>;
|