@vue/language-core 1.8.8 → 1.8.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.
Files changed (49) hide show
  1. package/out/generators/script.d.ts +3 -3
  2. package/out/generators/script.js +45 -9
  3. package/out/generators/template.d.ts +3 -2
  4. package/out/generators/template.js +72 -20
  5. package/out/index.d.ts +3 -0
  6. package/out/index.js +15 -2
  7. package/out/languageModule.d.ts +2 -1
  8. package/out/languageModule.js +25 -2
  9. package/out/parsers/scriptRanges.d.ts +1 -0
  10. package/out/parsers/scriptSetupRanges.d.ts +1 -0
  11. package/out/parsers/scriptSetupRanges.js +1 -1
  12. package/out/plugins/file-html.d.ts +2 -1
  13. package/out/plugins/file-html.js +2 -1
  14. package/out/plugins/file-md.d.ts +2 -1
  15. package/out/plugins/file-md.js +2 -1
  16. package/out/plugins/file-vue.d.ts +2 -1
  17. package/out/plugins/file-vue.js +2 -1
  18. package/out/plugins/vue-sfc-customblocks.d.ts +2 -1
  19. package/out/plugins/vue-sfc-customblocks.js +2 -1
  20. package/out/plugins/vue-sfc-scripts.d.ts +2 -1
  21. package/out/plugins/vue-sfc-scripts.js +2 -1
  22. package/out/plugins/vue-sfc-styles.d.ts +2 -1
  23. package/out/plugins/vue-sfc-styles.js +2 -1
  24. package/out/plugins/vue-sfc-template.d.ts +2 -1
  25. package/out/plugins/vue-sfc-template.js +2 -1
  26. package/out/plugins/vue-template-html.d.ts +2 -1
  27. package/out/plugins/vue-template-html.js +2 -1
  28. package/out/plugins/vue-tsx.d.ts +1 -0
  29. package/out/plugins/vue-tsx.js +25 -2
  30. package/out/plugins.d.ts +1 -0
  31. package/out/plugins.js +51 -20
  32. package/out/sourceFile.d.ts +9 -8
  33. package/out/sourceFile.js +24 -1
  34. package/out/types.d.ts +10 -7
  35. package/out/utils/globalTypes.d.ts +1 -0
  36. package/out/utils/parseCssClassNames.d.ts +1 -0
  37. package/out/utils/parseCssVars.d.ts +1 -0
  38. package/out/utils/parseSfc.d.ts +1 -0
  39. package/out/utils/parseSfc.js +24 -1
  40. package/out/utils/shared.d.ts +3 -0
  41. package/out/utils/shared.js +13 -1
  42. package/out/utils/transform.d.ts +1 -0
  43. package/out/utils/ts.d.ts +2 -1
  44. package/out/utils/ts.js +37 -7
  45. package/out/utils/vue2TemplateCompiler.d.ts +3 -3
  46. package/out/utils/vue2TemplateCompiler.js +23 -15
  47. package/package.json +2 -2
  48. package/out/utils/directorySharedTypes.d.ts +0 -4
  49. package/out/utils/directorySharedTypes.js +0 -150
@@ -1,150 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.genConstructorOverloads = exports.getTypesCode = exports.baseName = void 0;
4
- const shared_1 = require("./shared");
5
- exports.baseName = '__VLS_types.d.ts';
6
- function getTypesCode(vueCompilerOptions) {
7
- return `
8
- // @ts-nocheck
9
-
10
- type __VLS_IntrinsicElements = __VLS_PickNotAny<import('vue/jsx-runtime').JSX.IntrinsicElements, __VLS_PickNotAny<JSX.IntrinsicElements, Record<string, any>>>;
11
- type __VLS_Element = __VLS_PickNotAny<import('vue/jsx-runtime').JSX.Element, JSX.Element>;
12
-
13
- type __VLS_IsAny<T> = 0 extends 1 & T ? true : false;
14
- type __VLS_PickNotAny<A, B> = __VLS_IsAny<A> extends true ? B : A;
15
-
16
- type __VLS_Prettify<T> = {
17
- [K in keyof T]: T[K];
18
- } & {};
19
-
20
- type __VLS_GlobalComponents =
21
- __VLS_PickNotAny<import('vue').GlobalComponents, {}>
22
- & __VLS_PickNotAny<import('@vue/runtime-core').GlobalComponents, {}>
23
- & __VLS_PickNotAny<import('@vue/runtime-dom').GlobalComponents, {}>
24
- & Pick<typeof import('${vueCompilerOptions.lib}'),
25
- 'Transition'
26
- | 'TransitionGroup'
27
- | 'KeepAlive'
28
- | 'Suspense'
29
- | 'Teleport'
30
- >;
31
-
32
- // v-for
33
- declare function __VLS_getVForSourceType(source: number): [number, number, number][];
34
- declare function __VLS_getVForSourceType(source: string): [string, number, number][];
35
- declare function __VLS_getVForSourceType<T extends any[]>(source: T): [
36
- T[number], // item
37
- number, // key
38
- number, // index
39
- ][];
40
- declare function __VLS_getVForSourceType<T extends { [Symbol.iterator](): Iterator<any> }>(source: T): [
41
- T extends { [Symbol.iterator](): Iterator<infer T1> } ? T1 : never, // item
42
- number, // key
43
- undefined, // index
44
- ][];
45
- declare function __VLS_getVForSourceType<T>(source: T): [
46
- T[keyof T], // item
47
- keyof T, // key
48
- number, // index
49
- ][];
50
-
51
- declare function __VLS_getSlotParams<T>(slot: T): Parameters<__VLS_PickNotAny<NonNullable<T>, (...args: any[]) => any>>;
52
- declare function __VLS_getSlotParam<T>(slot: T): Parameters<__VLS_PickNotAny<NonNullable<T>, (...args: any[]) => any>>[0];
53
- declare function __VLS_directiveFunction<T>(dir: T):
54
- T extends import('${vueCompilerOptions.lib}').ObjectDirective<infer E, infer V> | import('${vueCompilerOptions.lib}').FunctionDirective<infer E, infer V> ? (el: E, value: V) => void
55
- : T;
56
- declare function __VLS_withScope<T, K>(ctx: T, scope: K): ctx is T & K;
57
- declare function __VLS_makeOptional<T>(t: T): { [K in keyof T]?: T[K] };
58
-
59
- type __VLS_SelfComponent<N, C> = string extends N ? {} : N extends string ? { [P in N]: C } : {};
60
- type __VLS_WithComponent<N0 extends string, Components, N1 extends string, N2 extends string, N3 extends string> =
61
- N1 extends keyof Components ? N1 extends N0 ? Pick<Components, N0> : { [K in N0]: Components[N1] } :
62
- N2 extends keyof Components ? N2 extends N0 ? Pick<Components, N0> : { [K in N0]: Components[N2] } :
63
- N3 extends keyof Components ? N3 extends N0 ? Pick<Components, N0> : { [K in N0]: Components[N3] } :
64
- ${vueCompilerOptions.strictTemplates ? '{}' : '{ [K in N0]: unknown }'}
65
-
66
- type __VLS_FillingEventArg_ParametersLength<E extends (...args: any) => any> = __VLS_IsAny<Parameters<E>> extends true ? -1 : Parameters<E>['length'];
67
- type __VLS_FillingEventArg<E> = E extends (...args: any) => any ? __VLS_FillingEventArg_ParametersLength<E> extends 0 ? ($event?: undefined) => ReturnType<E> : E : E;
68
- type __VLS_EmitEvent<F, E> =
69
- F extends {
70
- (event: E, ...payload: infer P): any
71
- } ? (...payload: P) => void
72
- : F extends {
73
- (event: E, ...payload: infer P): any
74
- (...args: any): any
75
- } ? (...payload: P) => void
76
- : F extends {
77
- (event: E, ...payload: infer P): any
78
- (...args: any): any
79
- (...args: any): any
80
- } ? (...payload: P) => void
81
- : F extends {
82
- (event: E, ...payload: infer P): any
83
- (...args: any): any
84
- (...args: any): any
85
- (...args: any): any
86
- } ? (...payload: P) => void
87
- : unknown | '[Type Warning] Volar could not infer $emit event more than 4 overloads without DefineComponent. see https://github.com/vuejs/language-tools/issues/60';
88
- declare function __VLS_asFunctionalComponent<T, K = T extends new (...args: any) => any ? InstanceType<T> : unknown>(t: T, instance?: K):
89
- T extends new (...args: any) => any
90
- ? (props: (K extends { $props: infer Props } ? Props : any)${vueCompilerOptions.strictTemplates ? '' : ' & Record<string, unknown>'}, ctx?: {
91
- attrs?: any,
92
- slots?: K extends { ${(0, shared_1.getSlotsPropertyName)(vueCompilerOptions.target)}: infer Slots } ? Slots : any,
93
- emit?: K extends { $emit: infer Emit } ? Emit : any
94
- }) => JSX.Element & { __ctx?: typeof ctx & { props?: typeof props; expose?(exposed: K): void; } }
95
- : T extends () => any ? (props: {}, ctx?: any) => ReturnType<T>
96
- : T extends (...args: any) => any ? T
97
- : (_: T extends import('${vueCompilerOptions.lib}').VNode | import('${vueCompilerOptions.lib}').VNode[] | string ? {}: T${vueCompilerOptions.strictTemplates ? '' : ' & Record<string, unknown>'}, ctx?: any) => { __ctx?: { attrs?: any, expose?: any, slots?: any, emit?: any, props?: T${vueCompilerOptions.strictTemplates ? '' : ' & Record<string, unknown>'} } }; // IntrinsicElement
98
- declare function __VLS_functionalComponentArgsRest<T extends (...args: any) => any>(t: T): Parameters<T>['length'] extends 2 ? [any] : [];
99
- declare function __VLS_pickEvent<Emit, K, E>(emit: Emit, emitKey: K, event: E): __VLS_FillingEventArg<
100
- __VLS_PickNotAny<
101
- __VLS_AsFunctionOrAny<E>,
102
- __VLS_AsFunctionOrAny<__VLS_EmitEvent<Emit, K>>
103
- >
104
- > | undefined;
105
- declare function __VLS_pickFunctionalComponentCtx<T, K>(comp: T, compInstance: K): __VLS_PickNotAny<
106
- K extends { __ctx?: infer Ctx } ? Ctx : any,
107
- T extends (props: any, ctx: infer Ctx) => any ? Ctx : any
108
- >;
109
- type __VLS_AsFunctionOrAny<F> = unknown extends F ? any : ((...args: any) => any) extends F ? F : any;
110
-
111
- declare function __VLS_componentProps<T, K>(comp: T, fnReturn: K):
112
- __VLS_PickNotAny<K, {}> extends { __ctx: { props: infer P } } ? NonNullable<P>
113
- : T extends (props: infer P, ...args: any) => any ? NonNullable<P> :
114
- {};
115
- `.trim();
116
- }
117
- exports.getTypesCode = getTypesCode;
118
- // TODO: not working for overloads > n (n = 8)
119
- // see: https://github.com/vuejs/language-tools/issues/60
120
- function genConstructorOverloads(name = 'ConstructorOverloads', nums) {
121
- let code = '';
122
- code += `type ${name}<T> =\n`;
123
- if (nums === undefined) {
124
- for (let i = 8; i >= 1; i--) {
125
- gen(i);
126
- }
127
- }
128
- else if (nums > 0) {
129
- gen(nums);
130
- }
131
- code += `// 0\n`;
132
- code += `{};\n`;
133
- return code;
134
- function gen(i) {
135
- code += `// ${i}\n`;
136
- code += `T extends {\n`;
137
- for (let j = 1; j <= i; j++) {
138
- code += `(event: infer E${j}, ...payload: infer P${j}): void;\n`;
139
- }
140
- code += `} ? (\n`;
141
- for (let j = 1; j <= i; j++) {
142
- if (j > 1)
143
- code += '& ';
144
- code += `(E${j} extends string ? { [K${j} in E${j}]: (...payload: P${j}) => void } : {})\n`;
145
- }
146
- code += `) :\n`;
147
- }
148
- }
149
- exports.genConstructorOverloads = genConstructorOverloads;
150
- //# sourceMappingURL=directorySharedTypes.js.map