@vue/language-core 2.1.5 → 2.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/lib/codegen/globalTypes.d.ts +1 -1
  2. package/lib/codegen/globalTypes.js +123 -125
  3. package/lib/codegen/script/component.js +35 -32
  4. package/lib/codegen/script/{internalComponent.d.ts → componentSelf.d.ts} +1 -1
  5. package/lib/codegen/script/{internalComponent.js → componentSelf.js} +6 -6
  6. package/lib/codegen/script/index.d.ts +1 -0
  7. package/lib/codegen/script/index.js +14 -6
  8. package/lib/codegen/script/scriptSetup.js +10 -37
  9. package/lib/codegen/script/styleModulesType.d.ts +4 -0
  10. package/lib/codegen/script/styleModulesType.js +36 -0
  11. package/lib/codegen/script/template.d.ts +3 -3
  12. package/lib/codegen/script/template.js +53 -66
  13. package/lib/codegen/template/context.d.ts +1 -0
  14. package/lib/codegen/template/context.js +2 -0
  15. package/lib/codegen/template/element.js +4 -4
  16. package/lib/codegen/template/elementDirectives.js +1 -1
  17. package/lib/codegen/template/elementEvents.js +4 -1
  18. package/lib/codegen/template/elementProps.js +27 -18
  19. package/lib/codegen/template/index.d.ts +2 -2
  20. package/lib/codegen/template/index.js +2 -2
  21. package/lib/codegen/template/interpolation.d.ts +1 -1
  22. package/lib/codegen/template/interpolation.js +26 -12
  23. package/lib/parsers/scriptRanges.d.ts +1 -0
  24. package/lib/parsers/scriptRanges.js +7 -2
  25. package/lib/parsers/scriptSetupRanges.js +1 -1
  26. package/lib/plugins/vue-sfc-template.js +2 -2
  27. package/lib/plugins/vue-tsx.d.ts +2 -0
  28. package/lib/plugins/vue-tsx.js +25 -10
  29. package/lib/types.d.ts +2 -2
  30. package/lib/utils/ts.d.ts +8 -2
  31. package/lib/utils/ts.js +45 -8
  32. package/package.json +2 -2
  33. package/lib/codegen/script/globalTypes.d.ts +0 -2
  34. package/lib/codegen/script/globalTypes.js +0 -147
  35. package/lib/codegen/template/vBindShorthand.d.ts +0 -3
  36. package/lib/codegen/template/vBindShorthand.js +0 -18
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.tsCodegen = void 0;
4
4
  const computeds_1 = require("computeds");
5
- const path = require("path-browserify");
5
+ const path_browserify_1 = require("path-browserify");
6
6
  const script_1 = require("../codegen/script");
7
7
  const template_1 = require("../codegen/template");
8
8
  const scriptRanges_1 = require("../parsers/scriptRanges");
@@ -10,6 +10,7 @@ const scriptSetupRanges_1 = require("../parsers/scriptSetupRanges");
10
10
  exports.tsCodegen = new WeakMap();
11
11
  const fileEditTimes = new Map();
12
12
  const plugin = ctx => {
13
+ let appendedGlobalTypes = false;
13
14
  return {
14
15
  version: 2.1,
15
16
  requiredCompilerOptions: [
@@ -38,13 +39,18 @@ const plugin = ctx => {
38
39
  };
39
40
  function useTsx(fileName, sfc) {
40
41
  if (!exports.tsCodegen.has(sfc)) {
41
- exports.tsCodegen.set(sfc, createTsx(fileName, sfc, ctx));
42
+ let appendGlobalTypes = false;
43
+ if (!ctx.vueCompilerOptions.__setupedGlobalTypes && !appendedGlobalTypes) {
44
+ appendGlobalTypes = true;
45
+ appendedGlobalTypes = true;
46
+ }
47
+ exports.tsCodegen.set(sfc, createTsx(fileName, sfc, ctx, appendGlobalTypes));
42
48
  }
43
49
  return exports.tsCodegen.get(sfc);
44
50
  }
45
51
  };
46
52
  exports.default = plugin;
47
- function createTsx(fileName, _sfc, ctx) {
53
+ function createTsx(fileName, _sfc, ctx, appendGlobalTypes) {
48
54
  const ts = ctx.modules.typescript;
49
55
  const lang = (0, computeds_1.computed)(() => {
50
56
  return !_sfc.script && !_sfc.scriptSetup ? 'ts'
@@ -59,7 +65,7 @@ function createTsx(fileName, _sfc, ctx) {
59
65
  ? (0, scriptSetupRanges_1.parseScriptSetupRanges)(ts, _sfc.scriptSetup.ast, ctx.vueCompilerOptions)
60
66
  : undefined);
61
67
  const generatedTemplate = (0, computeds_1.computed)(() => {
62
- if (!_sfc.template) {
68
+ if (ctx.vueCompilerOptions.skipTemplateCodegen || !_sfc.template) {
63
69
  return;
64
70
  }
65
71
  const codes = [];
@@ -71,7 +77,7 @@ function createTsx(fileName, _sfc, ctx) {
71
77
  edited: ctx.vueCompilerOptions.__test || (fileEditTimes.get(fileName) ?? 0) >= 2,
72
78
  scriptSetupBindingNames: scriptSetupBindingNames(),
73
79
  scriptSetupImportComponentNames: scriptSetupImportComponentNames(),
74
- templateRefNames: new Map(),
80
+ templateRefNames: templateRefNames(),
75
81
  hasDefineSlots: hasDefineSlots(),
76
82
  slotsAssignName: slotsAssignName(),
77
83
  propsAssignName: propsAssignName(),
@@ -88,7 +94,6 @@ function createTsx(fileName, _sfc, ctx) {
88
94
  codes: codes,
89
95
  };
90
96
  });
91
- const hasDefineSlots = (0, computeds_1.computed)(() => !!scriptSetupRanges()?.slots.define);
92
97
  const scriptSetupBindingNames = (0, computeds_1.computed)(oldNames => {
93
98
  const newNames = new Set();
94
99
  const bindings = scriptSetupRanges()?.bindings;
@@ -104,11 +109,21 @@ function createTsx(fileName, _sfc, ctx) {
104
109
  });
105
110
  const scriptSetupImportComponentNames = (0, computeds_1.computed)(oldNames => {
106
111
  const newNames = scriptSetupRanges()?.importComponentNames ?? new Set();
107
- if (newNames && oldNames && twoSetsEqual(newNames, oldNames)) {
112
+ if (oldNames && twoSetsEqual(newNames, oldNames)) {
113
+ return oldNames;
114
+ }
115
+ return newNames;
116
+ });
117
+ const templateRefNames = (0, computeds_1.computed)(oldNames => {
118
+ const newNames = new Set(scriptSetupRanges()?.templateRefs
119
+ .map(({ name }) => name)
120
+ .filter(name => name !== undefined));
121
+ if (oldNames && twoSetsEqual(newNames, oldNames)) {
108
122
  return oldNames;
109
123
  }
110
124
  return newNames;
111
125
  });
126
+ const hasDefineSlots = (0, computeds_1.computed)(() => !!scriptSetupRanges()?.slots.define);
112
127
  const slotsAssignName = (0, computeds_1.computed)(() => scriptSetupRanges()?.slots.name);
113
128
  const propsAssignName = (0, computeds_1.computed)(() => scriptSetupRanges()?.props.name);
114
129
  const inheritAttrs = (0, computeds_1.computed)(() => {
@@ -118,21 +133,21 @@ function createTsx(fileName, _sfc, ctx) {
118
133
  const generatedScript = (0, computeds_1.computed)(() => {
119
134
  const codes = [];
120
135
  const linkedCodeMappings = [];
121
- const _template = generatedTemplate();
122
136
  let generatedLength = 0;
123
137
  const codegen = (0, script_1.generateScript)({
124
138
  ts,
125
- fileBaseName: path.basename(fileName),
139
+ fileBaseName: path_browserify_1.posix.basename(fileName),
126
140
  sfc: _sfc,
127
141
  lang: lang(),
128
142
  scriptRanges: scriptRanges(),
129
143
  scriptSetupRanges: scriptSetupRanges(),
130
- templateCodegen: _template,
144
+ templateCodegen: generatedTemplate(),
131
145
  compilerOptions: ctx.compilerOptions,
132
146
  vueCompilerOptions: ctx.vueCompilerOptions,
133
147
  edited: ctx.vueCompilerOptions.__test || (fileEditTimes.get(fileName) ?? 0) >= 2,
134
148
  getGeneratedLength: () => generatedLength,
135
149
  linkedCodeMappings,
150
+ appendGlobalTypes,
136
151
  });
137
152
  fileEditTimes.set(fileName, (fileEditTimes.get(fileName) ?? 0) + 1);
138
153
  let current = codegen.next();
package/lib/types.d.ts CHANGED
@@ -36,16 +36,16 @@ export interface VueCompilerOptions {
36
36
  defineModel: string[];
37
37
  defineOptions: string[];
38
38
  withDefaults: string[];
39
- templateRef: string[];
40
39
  };
41
40
  composibles: {
42
41
  useCssModule: string[];
42
+ useTemplateRef: string[];
43
43
  };
44
44
  plugins: VueLanguagePlugin[];
45
45
  experimentalDefinePropProposal: 'kevinEdition' | 'johnsonEdition' | false;
46
46
  experimentalResolveStyleCssClasses: 'scoped' | 'always' | 'never';
47
47
  experimentalModelPropName: Record<string, Record<string, boolean | Record<string, string> | Record<string, string>[]>>;
48
- __setupedGlobalTypes?: () => boolean;
48
+ __setupedGlobalTypes?: boolean;
49
49
  __test?: boolean;
50
50
  }
51
51
  export declare const validVersions: readonly [2, 2.1];
package/lib/utils/ts.d.ts CHANGED
@@ -3,6 +3,12 @@ import type { VueCompilerOptions } from '../types';
3
3
  export type ParsedCommandLine = ts.ParsedCommandLine & {
4
4
  vueOptions: VueCompilerOptions;
5
5
  };
6
- export declare function createParsedCommandLineByJson(ts: typeof import('typescript'), parseConfigHost: ts.ParseConfigHost, rootDir: string, json: any, configFileName?: string): ParsedCommandLine;
7
- export declare function createParsedCommandLine(ts: typeof import('typescript'), parseConfigHost: ts.ParseConfigHost, tsConfigPath: string): ParsedCommandLine;
6
+ export declare function createParsedCommandLineByJson(ts: typeof import('typescript'), parseConfigHost: ts.ParseConfigHost & {
7
+ writeFile?(path: string, data: string): void;
8
+ }, rootDir: string, json: any, configFileName?: string, skipGlobalTypesSetup?: boolean): ParsedCommandLine;
9
+ export declare function createParsedCommandLine(ts: typeof import('typescript'), parseConfigHost: ts.ParseConfigHost, tsConfigPath: string, skipGlobalTypesSetup?: boolean): ParsedCommandLine;
8
10
  export declare function resolveVueCompilerOptions(vueOptions: Partial<VueCompilerOptions>): VueCompilerOptions;
11
+ export declare function setupGlobalTypes(rootDir: string, vueOptions: VueCompilerOptions, host: {
12
+ fileExists(path: string): boolean;
13
+ writeFile?(path: string, data: string): void;
14
+ }): boolean;
package/lib/utils/ts.js CHANGED
@@ -3,10 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createParsedCommandLineByJson = createParsedCommandLineByJson;
4
4
  exports.createParsedCommandLine = createParsedCommandLine;
5
5
  exports.resolveVueCompilerOptions = resolveVueCompilerOptions;
6
+ exports.setupGlobalTypes = setupGlobalTypes;
6
7
  const shared_1 = require("@vue/shared");
7
- const path = require("path-browserify");
8
+ const path_browserify_1 = require("path-browserify");
8
9
  const languagePlugin_1 = require("../languagePlugin");
9
- function createParsedCommandLineByJson(ts, parseConfigHost, rootDir, json, configFileName = rootDir + '/jsconfig.json') {
10
+ const globalTypes_1 = require("../codegen/globalTypes");
11
+ function createParsedCommandLineByJson(ts, parseConfigHost, rootDir, json, configFileName = rootDir + '/jsconfig.json', skipGlobalTypesSetup = false) {
10
12
  const proxyHost = proxyParseConfigHostForExtendConfigPaths(parseConfigHost);
11
13
  ts.parseJsonConfigFileContent(json, proxyHost.host, rootDir, {}, configFileName);
12
14
  let vueOptions = {};
@@ -20,6 +22,12 @@ function createParsedCommandLineByJson(ts, parseConfigHost, rootDir, json, confi
20
22
  catch (err) { }
21
23
  }
22
24
  const resolvedVueOptions = resolveVueCompilerOptions(vueOptions);
25
+ if (skipGlobalTypesSetup) {
26
+ resolvedVueOptions.__setupedGlobalTypes = true;
27
+ }
28
+ else {
29
+ resolvedVueOptions.__setupedGlobalTypes = setupGlobalTypes(rootDir, resolvedVueOptions, parseConfigHost);
30
+ }
23
31
  const parsed = ts.parseJsonConfigFileContent(json, proxyHost.host, rootDir, {}, configFileName, undefined, (0, languagePlugin_1.getAllExtensions)(resolvedVueOptions)
24
32
  .map(extension => ({
25
33
  extension: extension.slice(1),
@@ -35,11 +43,11 @@ function createParsedCommandLineByJson(ts, parseConfigHost, rootDir, json, confi
35
43
  vueOptions: resolvedVueOptions,
36
44
  };
37
45
  }
38
- function createParsedCommandLine(ts, parseConfigHost, tsConfigPath) {
46
+ function createParsedCommandLine(ts, parseConfigHost, tsConfigPath, skipGlobalTypesSetup = false) {
39
47
  try {
40
48
  const proxyHost = proxyParseConfigHostForExtendConfigPaths(parseConfigHost);
41
49
  const config = ts.readJsonConfigFile(tsConfigPath, proxyHost.host.readFile);
42
- ts.parseJsonSourceFileConfigFileContent(config, proxyHost.host, path.dirname(tsConfigPath), {}, tsConfigPath);
50
+ ts.parseJsonSourceFileConfigFileContent(config, proxyHost.host, path_browserify_1.posix.dirname(tsConfigPath), {}, tsConfigPath);
43
51
  let vueOptions = {};
44
52
  for (const extendPath of proxyHost.extendConfigPaths.reverse()) {
45
53
  try {
@@ -51,7 +59,13 @@ function createParsedCommandLine(ts, parseConfigHost, tsConfigPath) {
51
59
  catch (err) { }
52
60
  }
53
61
  const resolvedVueOptions = resolveVueCompilerOptions(vueOptions);
54
- const parsed = ts.parseJsonSourceFileConfigFileContent(config, proxyHost.host, path.dirname(tsConfigPath), {}, tsConfigPath, undefined, (0, languagePlugin_1.getAllExtensions)(resolvedVueOptions)
62
+ if (skipGlobalTypesSetup) {
63
+ resolvedVueOptions.__setupedGlobalTypes = true;
64
+ }
65
+ else {
66
+ resolvedVueOptions.__setupedGlobalTypes = setupGlobalTypes(path_browserify_1.posix.dirname(tsConfigPath), resolvedVueOptions, parseConfigHost);
67
+ }
68
+ const parsed = ts.parseJsonSourceFileConfigFileContent(config, proxyHost.host, path_browserify_1.posix.dirname(tsConfigPath), {}, tsConfigPath, undefined, (0, languagePlugin_1.getAllExtensions)(resolvedVueOptions)
55
69
  .map(extension => ({
56
70
  extension: extension.slice(1),
57
71
  isMixedContent: true,
@@ -97,7 +111,7 @@ function proxyParseConfigHostForExtendConfigPaths(parseConfigHost) {
97
111
  };
98
112
  }
99
113
  function getPartialVueCompilerOptions(ts, tsConfigSourceFile) {
100
- const folder = path.dirname(tsConfigSourceFile.fileName);
114
+ const folder = path_browserify_1.posix.dirname(tsConfigSourceFile.fileName);
101
115
  const obj = ts.convertToObject(tsConfigSourceFile, []);
102
116
  const rawOptions = obj?.vueCompilerOptions ?? {};
103
117
  const result = {
@@ -181,11 +195,12 @@ function resolveVueCompilerOptions(vueOptions) {
181
195
  defineModel: ['defineModel'],
182
196
  defineOptions: ['defineOptions'],
183
197
  withDefaults: ['withDefaults'],
184
- templateRef: ['templateRef', 'useTemplateRef'],
185
198
  ...vueOptions.macros,
186
199
  },
187
200
  composibles: {
188
- useCssModule: ['useCssModule']
201
+ useCssModule: ['useCssModule'],
202
+ useTemplateRef: ['useTemplateRef', 'templateRef'],
203
+ ...vueOptions.composibles,
189
204
  },
190
205
  plugins: vueOptions.plugins ?? [],
191
206
  // experimental
@@ -205,4 +220,26 @@ function resolveVueCompilerOptions(vueOptions) {
205
220
  }).map(([k, v]) => [(0, shared_1.camelize)(k), v])),
206
221
  };
207
222
  }
223
+ function setupGlobalTypes(rootDir, vueOptions, host) {
224
+ if (!host.writeFile) {
225
+ return false;
226
+ }
227
+ try {
228
+ let dir = rootDir;
229
+ while (!host.fileExists(path_browserify_1.posix.join(dir, 'node_modules', vueOptions.lib, 'package.json'))) {
230
+ const parentDir = path_browserify_1.posix.dirname(dir);
231
+ if (dir === parentDir) {
232
+ throw 0;
233
+ }
234
+ dir = parentDir;
235
+ }
236
+ const globalTypesPath = path_browserify_1.posix.join(dir, 'node_modules', '.vue-global-types', `${vueOptions.lib}_${vueOptions.target}_${vueOptions.strictTemplates}.d.ts`);
237
+ const globalTypesContents = `// @ts-nocheck\nexport {};\n` + (0, globalTypes_1.generateGlobalTypes)(vueOptions.lib, vueOptions.target, vueOptions.strictTemplates);
238
+ host.writeFile(globalTypesPath, globalTypesContents);
239
+ return true;
240
+ }
241
+ catch {
242
+ return false;
243
+ }
244
+ }
208
245
  //# sourceMappingURL=ts.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/language-core",
3
- "version": "2.1.5",
3
+ "version": "2.1.6",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "**/*.js",
@@ -36,5 +36,5 @@
36
36
  "optional": true
37
37
  }
38
38
  },
39
- "gitHead": "a95b51ac0b0db8825f77fbba37e29932b5be61e4"
39
+ "gitHead": "fd61953ce9eb924eeaf4df0bf8d2237267321194"
40
40
  }
@@ -1,2 +0,0 @@
1
- import type { VueCompilerOptions } from '../../types';
2
- export declare function generateGlobalTypes(vueCompilerOptions: VueCompilerOptions): string;
@@ -1,147 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateGlobalTypes = generateGlobalTypes;
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 `export const __VLS_globalTypesStart = {};
8
- declare module '${vueCompilerOptions.lib}' {
9
- interface GlobalComponents {}
10
- }
11
- declare global {
12
- type __VLS_IntrinsicElements = ${vueCompilerOptions.target >= 3.3
13
- ? `import('${vueCompilerOptions.lib}/jsx-runtime').JSX.IntrinsicElements;`
14
- : `globalThis.JSX.IntrinsicElements;`}
15
- type __VLS_Element = ${vueCompilerOptions.target >= 3.3
16
- ? `import('${vueCompilerOptions.lib}/jsx-runtime').JSX.Element;`
17
- : `globalThis.JSX.Element;`}
18
- type __VLS_GlobalComponents = ${vueCompilerOptions.target >= 3.5
19
- ? `import('${vueCompilerOptions.lib}').GlobalComponents;`
20
- : `import('${vueCompilerOptions.lib}').GlobalComponents & Pick<typeof import('${vueCompilerOptions.lib}'), 'Transition' | 'TransitionGroup' | 'KeepAlive' | 'Suspense' | 'Teleport'>;`}
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
-
56
- // Custom Directives
57
- type __VLS_unknownDirective = (arg1: unknown, arg2: unknown, arg3: unknown, arg4: unknown) => void;
58
- function __VLS_directiveAsFunction<T extends import('${vueCompilerOptions.lib}').Directive>(dir: T): T extends (...args: any) => any
59
- ? T | __VLS_unknownDirective
60
- : NonNullable<(T & Record<string, __VLS_unknownDirective>)['created' | 'beforeMount' | 'mounted' | 'beforeUpdate' | 'updated' | 'beforeUnmount' | 'unmounted']>;
61
- const __VLS_directiveBindingRestFields = { instance: null, oldValue: null, modifiers: null as any, dir: null as any };
62
-
63
- function __VLS_withScope<T, K>(ctx: T, scope: K): ctx is T & K;
64
- function __VLS_makeOptional<T>(t: T): { [K in keyof T]?: T[K] };
65
- function __VLS_nonNullable<T>(t: T): T extends null | undefined ? never : T;
66
-
67
- type __VLS_SelfComponent<N, C> = string extends N ? {} : N extends string ? { [P in N]: C } : {};
68
- type __VLS_WithComponent<N0 extends string, LocalComponents, N1 extends string, N2 extends string, N3 extends string> =
69
- N1 extends keyof LocalComponents ? N1 extends N0 ? Pick<LocalComponents, N0 extends keyof LocalComponents ? N0 : never> : { [K in N0]: LocalComponents[N1] } :
70
- N2 extends keyof LocalComponents ? N2 extends N0 ? Pick<LocalComponents, N0 extends keyof LocalComponents ? N0 : never> : { [K in N0]: LocalComponents[N2] } :
71
- N3 extends keyof LocalComponents ? N3 extends N0 ? Pick<LocalComponents, N0 extends keyof LocalComponents ? N0 : never> : { [K in N0]: LocalComponents[N3] } :
72
- N1 extends keyof __VLS_GlobalComponents ? N1 extends N0 ? Pick<__VLS_GlobalComponents, N0 extends keyof __VLS_GlobalComponents ? N0 : never> : { [K in N0]: __VLS_GlobalComponents[N1] } :
73
- N2 extends keyof __VLS_GlobalComponents ? N2 extends N0 ? Pick<__VLS_GlobalComponents, N0 extends keyof __VLS_GlobalComponents ? N0 : never> : { [K in N0]: __VLS_GlobalComponents[N2] } :
74
- N3 extends keyof __VLS_GlobalComponents ? N3 extends N0 ? Pick<__VLS_GlobalComponents, N0 extends keyof __VLS_GlobalComponents ? N0 : never> : { [K in N0]: __VLS_GlobalComponents[N3] } :
75
- ${vueCompilerOptions.strictTemplates ? '{}' : '{ [K in N0]: unknown }'}
76
-
77
- function __VLS_asFunctionalComponent<T, K = T extends new (...args: any) => any ? InstanceType<T> : unknown>(t: T, instance?: K):
78
- T extends new (...args: any) => any
79
- ? (props: ${fnPropsType}, ctx?: any) => __VLS_Element & { __ctx?: {
80
- attrs?: any,
81
- slots?: K extends { ${(0, shared_1.getSlotsPropertyName)(vueCompilerOptions.target)}: infer Slots } ? Slots : any,
82
- emit?: K extends { $emit: infer Emit } ? Emit : any
83
- } & { props?: ${fnPropsType}; expose?(exposed: K): void; } }
84
- : T extends () => any ? (props: {}, ctx?: any) => ReturnType<T>
85
- : T extends (...args: any) => any ? T
86
- : (_: {}${vueCompilerOptions.strictTemplates ? '' : ' & Record<string, unknown>'}, ctx?: any) => { __ctx?: { attrs?: any, expose?: any, slots?: any, emit?: any, props?: {}${vueCompilerOptions.strictTemplates ? '' : ' & Record<string, unknown>'} } };
87
- function __VLS_elementAsFunction<T>(tag: T, endTag?: T): (_: T${vueCompilerOptions.strictTemplates ? '' : ' & Record<string, unknown>'}) => void;
88
- function __VLS_functionalComponentArgsRest<T extends (...args: any) => any>(t: T): Parameters<T>['length'] extends 2 ? [any] : [];
89
- function __VLS_pickFunctionalComponentCtx<T, K>(comp: T, compInstance: K): __VLS_PickNotAny<
90
- '__ctx' extends keyof __VLS_PickNotAny<K, {}> ? K extends { __ctx?: infer Ctx } ? Ctx : never : any
91
- , T extends (props: any, ctx: infer Ctx) => any ? Ctx : any
92
- >;
93
- type __VLS_FunctionalComponentProps<T, K> =
94
- '__ctx' extends keyof __VLS_PickNotAny<K, {}> ? K extends { __ctx?: { props?: infer P } } ? NonNullable<P> : never
95
- : T extends (props: infer P, ...args: any) => any ? P :
96
- {};
97
- type __VLS_IsFunction<T, K> = K extends keyof T
98
- ? __VLS_IsAny<T[K]> extends false
99
- ? unknown extends T[K]
100
- ? false
101
- : true
102
- : false
103
- : false;
104
-
105
- function __VLS_normalizeSlot<S>(s: S): S extends () => infer R ? (props: {}) => R : S;
106
- function __VLS_tryAsConstant<const T>(t: T): T;
107
-
108
- /**
109
- * emit
110
- */
111
- // fix https://github.com/vuejs/language-tools/issues/926
112
- type __VLS_UnionToIntersection<U> = (U extends unknown ? (arg: U) => unknown : never) extends ((arg: infer P) => unknown) ? P : never;
113
- type __VLS_OverloadUnionInner<T, U = unknown> = U & T extends (...args: infer A) => infer R
114
- ? U extends T
115
- ? never
116
- : __VLS_OverloadUnionInner<T, Pick<T, keyof T> & U & ((...args: A) => R)> | ((...args: A) => R)
117
- : never;
118
- type __VLS_OverloadUnion<T> = Exclude<
119
- __VLS_OverloadUnionInner<(() => never) & T>,
120
- T extends () => never ? never : () => never
121
- >;
122
- type __VLS_ConstructorOverloads<T> = __VLS_OverloadUnion<T> extends infer F
123
- ? F extends (event: infer E, ...args: infer A) => any
124
- ? { [K in E & string]: (...args: A) => void; }
125
- : never
126
- : never;
127
- type __VLS_NormalizeEmits<T> = __VLS_PrettifyGlobal<
128
- __VLS_UnionToIntersection<
129
- __VLS_ConstructorOverloads<T> & {
130
- [K in keyof T]: T[K] extends any[] ? { (...args: T[K]): void } : never
131
- }
132
- >
133
- >;
134
- type __VLS_PrettifyGlobal<T> = { [K in keyof T]: T[K]; } & {};
135
- type __VLS_PickRefsExpose<T> = T extends object
136
- ? { [K in keyof T]: (T[K] extends any[]
137
- ? Parameters<T[K][0]['expose']>[0][]
138
- : T[K] extends { expose?: (exposed: infer E) => void }
139
- ? E
140
- : T[K]) | null }
141
- : never;
142
- }
143
- export const __VLS_globalTypesEnd = {};
144
- `;
145
- }
146
- ;
147
- //# sourceMappingURL=globalTypes.js.map
@@ -1,3 +0,0 @@
1
- import type * as CompilerDOM from '@vue/compiler-dom';
2
- import type { InlayHintInfo } from "../types";
3
- export declare function generateVBindShorthandInlayHint(loc: CompilerDOM.SourceLocation, variableName: string): InlayHintInfo;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateVBindShorthandInlayHint = generateVBindShorthandInlayHint;
4
- function generateVBindShorthandInlayHint(loc, variableName) {
5
- return {
6
- blockName: 'template',
7
- offset: loc.end.offset,
8
- setting: 'vue.inlayHints.vBindShorthand',
9
- label: `="${variableName}"`,
10
- tooltip: [
11
- `This is a shorthand for \`${loc.source}="${variableName}"\`.`,
12
- 'To hide this hint, set `vue.inlayHints.vBindShorthand` to `false` in IDE settings.',
13
- '[More info](https://github.com/vuejs/core/pull/9451)',
14
- ].join('\n\n'),
15
- };
16
- }
17
- ;
18
- //# sourceMappingURL=vBindShorthand.js.map