@vue/language-core 2.0.7 → 2.0.11

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.
@@ -0,0 +1,2 @@
1
+ import type { VueCompilerOptions } from '../types';
2
+ export declare function generateGlobalTypes(vueCompilerOptions: VueCompilerOptions): string;
@@ -0,0 +1,135 @@
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
@@ -0,0 +1,3 @@
1
+ import * as CompilerDOM from '@vue/compiler-dom';
2
+ import type { Code } from '../types';
3
+ export declare function generate(templateAst: NonNullable<CompilerDOM.RootNode>): Generator<Code>;
@@ -0,0 +1,37 @@
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
@@ -5,6 +5,7 @@ const path = require("path-browserify");
5
5
  const shared_1 = require("../utils/shared");
6
6
  const transform_1 = require("../utils/transform");
7
7
  const utils_1 = require("./utils");
8
+ const globalTypes_1 = require("./globalTypes");
8
9
  function* generate(ts, fileName, script, scriptSetup, styles, // TODO: computed it
9
10
  lang, scriptRanges, scriptSetupRanges, templateCodegen, compilerOptions, vueCompilerOptions, globalTypesHolder, getGeneratedLength, linkedCodeMappings = [], codegenStack) {
10
11
  //#region monkey fix: https://github.com/vuejs/language-tools/pull/2113
@@ -39,7 +40,18 @@ lang, scriptRanges, scriptSetupRanges, templateCodegen, compilerOptions, vueComp
39
40
  ...scriptSetupRanges?.bindings.map(range => scriptSetup.content.substring(range.start, range.end)) ?? [],
40
41
  ]);
41
42
  const bypassDefineComponent = lang === 'js' || lang === 'jsx';
42
- const _ = codegenStack ? utils_1.withStack : (code) => [code, ''];
43
+ const _ = (code) => {
44
+ if (typeof code !== 'string') {
45
+ code[3].structure = false;
46
+ code[3].format = false;
47
+ }
48
+ if (!codegenStack) {
49
+ return [code, ''];
50
+ }
51
+ else {
52
+ return [code, (0, utils_1.getStack)()];
53
+ }
54
+ };
43
55
  const helperTypes = {
44
56
  OmitKeepDiscriminatedUnion: {
45
57
  get name() {
@@ -139,7 +151,7 @@ lang, scriptRanges, scriptSetupRanges, templateCodegen, compilerOptions, vueComp
139
151
  yield* generateScriptSetupAndTemplate();
140
152
  yield* generateScriptContentAfterExportDefault();
141
153
  if (globalTypesHolder === fileName) {
142
- yield* generateGlobalHelperTypes();
154
+ yield _((0, globalTypes_1.generateGlobalTypes)(vueCompilerOptions));
143
155
  }
144
156
  yield* generateLocalHelperTypes();
145
157
  yield _(`\ntype __VLS_IntrinsicElementsCompletion = __VLS_IntrinsicElements;\n`);
@@ -149,133 +161,6 @@ lang, scriptRanges, scriptSetupRanges, templateCodegen, compilerOptions, vueComp
149
161
  if (scriptSetup) {
150
162
  yield _(['', 'scriptSetup', scriptSetup.content.length, (0, utils_1.disableAllFeatures)({ verification: true })]);
151
163
  }
152
- function* generateGlobalHelperTypes() {
153
- const fnPropsType = `(K extends { $props: infer Props } ? Props : any)${vueCompilerOptions.strictTemplates ? '' : ' & Record<string, unknown>'}`;
154
- yield _(`
155
- ; declare global {
156
- // @ts-ignore
157
- type __VLS_IntrinsicElements = __VLS_PickNotAny<import('vue/jsx-runtime').JSX.IntrinsicElements, __VLS_PickNotAny<JSX.IntrinsicElements, Record<string, any>>>;
158
- // @ts-ignore
159
- type __VLS_Element = __VLS_PickNotAny<import('vue/jsx-runtime').JSX.Element, JSX.Element>;
160
- // @ts-ignore
161
- type __VLS_GlobalComponents = ${[
162
- `__VLS_PickNotAny<import('vue').GlobalComponents, {}>`,
163
- `__VLS_PickNotAny<import('@vue/runtime-core').GlobalComponents, {}>`,
164
- `__VLS_PickNotAny<import('@vue/runtime-dom').GlobalComponents, {}>`,
165
- `Pick<typeof import('${vueCompilerOptions.lib}'), 'Transition' | 'TransitionGroup' | 'KeepAlive' | 'Suspense' | 'Teleport'>`
166
- ].join(' & ')};
167
- type __VLS_IsAny<T> = 0 extends 1 & T ? true : false;
168
- type __VLS_PickNotAny<A, B> = __VLS_IsAny<A> extends true ? B : A;
169
-
170
- const __VLS_intrinsicElements: __VLS_IntrinsicElements;
171
-
172
- // v-for
173
- function __VLS_getVForSourceType(source: number): [number, number, number][];
174
- function __VLS_getVForSourceType(source: string): [string, number, number][];
175
- function __VLS_getVForSourceType<T extends any[]>(source: T): [
176
- item: T[number],
177
- key: number,
178
- index: number,
179
- ][];
180
- function __VLS_getVForSourceType<T extends { [Symbol.iterator](): Iterator<any> }>(source: T): [
181
- item: T extends { [Symbol.iterator](): Iterator<infer T1> } ? T1 : never,
182
- key: number,
183
- index: undefined,
184
- ][];
185
- // #3845
186
- function __VLS_getVForSourceType<T extends number | { [Symbol.iterator](): Iterator<any> }>(source: T): [
187
- item: number | (Exclude<T, number> extends { [Symbol.iterator](): Iterator<infer T1> } ? T1 : never),
188
- key: number,
189
- index: undefined,
190
- ][];
191
- function __VLS_getVForSourceType<T>(source: T): [
192
- item: T[keyof T],
193
- key: keyof T,
194
- index: number,
195
- ][];
196
-
197
- // @ts-ignore
198
- function __VLS_getSlotParams<T>(slot: T): Parameters<__VLS_PickNotAny<NonNullable<T>, (...args: any[]) => any>>;
199
- // @ts-ignore
200
- function __VLS_getSlotParam<T>(slot: T): Parameters<__VLS_PickNotAny<NonNullable<T>, (...args: any[]) => any>>[0];
201
- function __VLS_directiveFunction<T>(dir: T):
202
- T extends import('${vueCompilerOptions.lib}').ObjectDirective<infer E, infer V> | import('${vueCompilerOptions.lib}').FunctionDirective<infer E, infer V> ? (value: V) => void
203
- : T;
204
- function __VLS_withScope<T, K>(ctx: T, scope: K): ctx is T & K;
205
- function __VLS_makeOptional<T>(t: T): { [K in keyof T]?: T[K] };
206
-
207
- type __VLS_SelfComponent<N, C> = string extends N ? {} : N extends string ? { [P in N]: C } : {};
208
- type __VLS_WithComponent<N0 extends string, LocalComponents, N1 extends string, N2 extends string, N3 extends string> =
209
- N1 extends keyof LocalComponents ? N1 extends N0 ? Pick<LocalComponents, N0 extends keyof LocalComponents ? N0 : never> : { [K in N0]: LocalComponents[N1] } :
210
- N2 extends keyof LocalComponents ? N2 extends N0 ? Pick<LocalComponents, N0 extends keyof LocalComponents ? N0 : never> : { [K in N0]: LocalComponents[N2] } :
211
- N3 extends keyof LocalComponents ? N3 extends N0 ? Pick<LocalComponents, N0 extends keyof LocalComponents ? N0 : never> : { [K in N0]: LocalComponents[N3] } :
212
- N1 extends keyof __VLS_GlobalComponents ? N1 extends N0 ? Pick<__VLS_GlobalComponents, N0 extends keyof __VLS_GlobalComponents ? N0 : never> : { [K in N0]: __VLS_GlobalComponents[N1] } :
213
- N2 extends keyof __VLS_GlobalComponents ? N2 extends N0 ? Pick<__VLS_GlobalComponents, N0 extends keyof __VLS_GlobalComponents ? N0 : never> : { [K in N0]: __VLS_GlobalComponents[N2] } :
214
- N3 extends keyof __VLS_GlobalComponents ? N3 extends N0 ? Pick<__VLS_GlobalComponents, N0 extends keyof __VLS_GlobalComponents ? N0 : never> : { [K in N0]: __VLS_GlobalComponents[N3] } :
215
- ${vueCompilerOptions.strictTemplates ? '{}' : '{ [K in N0]: unknown }'}
216
-
217
- type __VLS_FillingEventArg_ParametersLength<E extends (...args: any) => any> = __VLS_IsAny<Parameters<E>> extends true ? -1 : Parameters<E>['length'];
218
- type __VLS_FillingEventArg<E> = E extends (...args: any) => any ? __VLS_FillingEventArg_ParametersLength<E> extends 0 ? ($event?: undefined) => ReturnType<E> : E : E;
219
- function __VLS_asFunctionalComponent<T, K = T extends new (...args: any) => any ? InstanceType<T> : unknown>(t: T, instance?: K):
220
- T extends new (...args: any) => any
221
- ? (props: ${fnPropsType}, ctx?: any) => __VLS_Element & { __ctx?: {
222
- attrs?: any,
223
- slots?: K extends { ${(0, shared_1.getSlotsPropertyName)(vueCompilerOptions.target)}: infer Slots } ? Slots : any,
224
- emit?: K extends { $emit: infer Emit } ? Emit : any
225
- } & { props?: ${fnPropsType}; expose?(exposed: K): void; } }
226
- : T extends () => any ? (props: {}, ctx?: any) => ReturnType<T>
227
- : T extends (...args: any) => any ? T
228
- : (_: {}${vueCompilerOptions.strictTemplates ? '' : ' & Record<string, unknown>'}, ctx?: any) => { __ctx?: { attrs?: any, expose?: any, slots?: any, emit?: any, props?: {}${vueCompilerOptions.strictTemplates ? '' : ' & Record<string, unknown>'} } };
229
- 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>'} } };
230
- function __VLS_functionalComponentArgsRest<T extends (...args: any) => any>(t: T): Parameters<T>['length'] extends 2 ? [any] : [];
231
- function __VLS_pickEvent<E1, E2>(emitEvent: E1, propEvent: E2): __VLS_FillingEventArg<
232
- __VLS_PickNotAny<
233
- __VLS_AsFunctionOrAny<E2>,
234
- __VLS_AsFunctionOrAny<E1>
235
- >
236
- > | undefined;
237
- function __VLS_pickFunctionalComponentCtx<T, K>(comp: T, compInstance: K): __VLS_PickNotAny<
238
- '__ctx' extends keyof __VLS_PickNotAny<K, {}> ? K extends { __ctx?: infer Ctx } ? Ctx : never : any
239
- , T extends (props: any, ctx: infer Ctx) => any ? Ctx : any
240
- >;
241
- type __VLS_FunctionalComponentProps<T, K> =
242
- '__ctx' extends keyof __VLS_PickNotAny<K, {}> ? K extends { __ctx?: { props?: infer P } } ? NonNullable<P> : never
243
- : T extends (props: infer P, ...args: any) => any ? P :
244
- {};
245
- type __VLS_AsFunctionOrAny<F> = unknown extends F ? any : ((...args: any) => any) extends F ? F : any;
246
-
247
- function __VLS_normalizeSlot<S>(s: S): S extends () => infer R ? (props: {}) => R : S;
248
-
249
- /**
250
- * emit
251
- */
252
- // fix https://github.com/vuejs/language-tools/issues/926
253
- type __VLS_UnionToIntersection<U> = (U extends unknown ? (arg: U) => unknown : never) extends ((arg: infer P) => unknown) ? P : never;
254
- type __VLS_OverloadUnionInner<T, U = unknown> = U & T extends (...args: infer A) => infer R
255
- ? U extends T
256
- ? never
257
- : __VLS_OverloadUnionInner<T, Pick<T, keyof T> & U & ((...args: A) => R)> | ((...args: A) => R)
258
- : never;
259
- type __VLS_OverloadUnion<T> = Exclude<
260
- __VLS_OverloadUnionInner<(() => never) & T>,
261
- T extends () => never ? never : () => never
262
- >;
263
- type __VLS_ConstructorOverloads<T> = __VLS_OverloadUnion<T> extends infer F
264
- ? F extends (event: infer E, ...args: infer A) => any
265
- ? { [K in E & string]: (...args: A) => void; }
266
- : never
267
- : never;
268
- type __VLS_NormalizeEmits<T> = __VLS_PrettifyGlobal<
269
- __VLS_UnionToIntersection<
270
- __VLS_ConstructorOverloads<T> & {
271
- [K in keyof T]: T[K] extends any[] ? { (...args: T[K]): void } : never
272
- }
273
- >
274
- >;
275
- type __VLS_PrettifyGlobal<T> = { [K in keyof T]: T[K]; } & {};
276
- }
277
- `);
278
- }
279
164
  function* generateLocalHelperTypes() {
280
165
  let shouldCheck = true;
281
166
  while (shouldCheck) {
@@ -699,6 +584,18 @@ type __VLS_PrettifyGlobal<T> = { [K in keyof T]: T[K]; } & {};
699
584
  else {
700
585
  yield _(`import('${vueCompilerOptions.lib}').PropType<${type}>,\n`);
701
586
  }
587
+ if (defineProp.modifierType) {
588
+ let propModifierName = 'modelModifiers';
589
+ if (defineProp.name) {
590
+ propModifierName = `${scriptSetup.content.substring(defineProp.name.start + 1, defineProp.name.end - 1)}Modifiers`;
591
+ }
592
+ const modifierType = scriptSetup.content.substring(defineProp.modifierType.start, defineProp.modifierType.end);
593
+ const start = getGeneratedLength();
594
+ definePropMirrors.set(propModifierName, start);
595
+ yield _(propModifierName);
596
+ yield _(`: `);
597
+ yield _(`import('${vueCompilerOptions.lib}').PropType<Record<${modifierType}, true>>,\n`);
598
+ }
702
599
  }
703
600
  yield _(`};\n`);
704
601
  }
@@ -1,9 +1,19 @@
1
1
  import * as CompilerDOM from '@vue/compiler-dom';
2
2
  import type * as ts from 'typescript';
3
- import type { Code, Sfc, VueCompilerOptions } from '../types';
4
- export declare function generate(ts: typeof import('typescript'), compilerOptions: ts.CompilerOptions, vueCompilerOptions: VueCompilerOptions, template: NonNullable<Sfc['template']>, shouldGenerateScopedClasses: boolean, stylesScopedClasses: Set<string>, hasScriptSetupSlots: boolean, slotsAssignName: string | undefined, propsAssignName: string | undefined, codegenStack: boolean): Generator<[codeType: "ts" | "tsFormat" | "inlineCss", code: Code, stack: string], {
3
+ import type { CodeAndStack, Sfc, VueCompilerOptions } from '../types';
4
+ export declare function generate(ts: typeof import('typescript'), compilerOptions: ts.CompilerOptions, vueCompilerOptions: VueCompilerOptions, template: NonNullable<Sfc['template']>, shouldGenerateScopedClasses: boolean, stylesScopedClasses: Set<string>, hasScriptSetupSlots: boolean, slotsAssignName: string | undefined, propsAssignName: string | undefined, codegenStack: boolean): Generator<CodeAndStack, {
5
5
  tagOffsetsMap: Map<string, number[]>;
6
6
  accessedGlobalVariables: Set<string>;
7
7
  hasSlot: boolean;
8
8
  }, unknown>;
9
- export declare function eachElementNode(node: CompilerDOM.RootNode | CompilerDOM.TemplateChildNode): Generator<CompilerDOM.ElementNode>;
9
+ export declare function createTsAst(ts: typeof import('typescript'), astHolder: any, text: string): ts.SourceFile;
10
+ export declare function isCompoundExpression(ts: typeof import('typescript'), ast: ts.SourceFile): boolean;
11
+ export declare function parseInterpolationNode(node: CompilerDOM.InterpolationNode, template: string): readonly [string, number];
12
+ export declare function parseVForNode(node: CompilerDOM.ForNode): {
13
+ leftExpressionRange: {
14
+ start: number;
15
+ end: number;
16
+ } | undefined;
17
+ leftExpressionText: string | undefined;
18
+ };
19
+ export declare function forEachElementNode(node: CompilerDOM.RootNode | CompilerDOM.TemplateChildNode): Generator<CompilerDOM.ElementNode>;