@vue/language-core 3.2.6 → 3.2.8

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/index.d.ts +1 -1
  2. package/index.js +3 -24
  3. package/lib/codegen/codeFeatures.d.ts +84 -18
  4. package/lib/codegen/names.d.ts +73 -26
  5. package/lib/codegen/names.js +75 -27
  6. package/lib/codegen/script/component.js +19 -58
  7. package/lib/codegen/script/index.js +12 -12
  8. package/lib/codegen/script/scriptSetup.js +48 -81
  9. package/lib/codegen/script/template.js +29 -63
  10. package/lib/codegen/style/index.d.ts +7 -7
  11. package/lib/codegen/style/modules.js +4 -37
  12. package/lib/codegen/style/scopedClasses.js +2 -1
  13. package/lib/codegen/template/context.d.ts +7 -7
  14. package/lib/codegen/template/element.js +28 -25
  15. package/lib/codegen/template/elementDirectives.js +4 -4
  16. package/lib/codegen/template/elementEvents.js +3 -2
  17. package/lib/codegen/template/elementProps.js +3 -3
  18. package/lib/codegen/template/index.d.ts +7 -7
  19. package/lib/codegen/template/index.js +16 -49
  20. package/lib/codegen/template/interpolation.js +3 -36
  21. package/lib/codegen/template/objectProperty.js +2 -1
  22. package/lib/codegen/template/slotOutlet.js +5 -5
  23. package/lib/codegen/template/styleScopedClasses.js +3 -2
  24. package/lib/codegen/template/vFor.js +2 -1
  25. package/lib/codegen/template/vSlot.js +2 -1
  26. package/lib/compilerOptions.js +2 -6
  27. package/lib/parsers/scriptRanges.d.ts +3 -3
  28. package/lib/plugins/file-md.js +2 -2
  29. package/lib/plugins/vue-tsx.d.ts +10 -10
  30. package/lib/plugins/vue-tsx.js +5 -22
  31. package/lib/types.d.ts +1 -1
  32. package/lib/utils/shared.js +1 -1
  33. package/lib/virtualCode/embeddedCodes.js +2 -6
  34. package/lib/virtualCode/index.js +1 -10
  35. package/package.json +9 -6
  36. package/scripts/generate-names.js +41 -0
package/index.d.ts CHANGED
@@ -10,6 +10,6 @@ export * from './lib/utils/forEachTemplateNode';
10
10
  export * from './lib/utils/parseSfc';
11
11
  export * from './lib/utils/shared';
12
12
  export * from './lib/virtualCode';
13
- export * as names from './lib/codegen/names';
13
+ export { names } from './lib/codegen/names';
14
14
  export { tsCodegen } from './lib/plugins/vue-tsx';
15
15
  export * from '@volar/language-core';
package/index.js CHANGED
@@ -10,31 +10,9 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
10
10
  if (k2 === undefined) k2 = k;
11
11
  o[k2] = m[k];
12
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
13
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
19
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
20
15
  };
21
- var __importStar = (this && this.__importStar) || (function () {
22
- var ownKeys = function(o) {
23
- ownKeys = Object.getOwnPropertyNames || function (o) {
24
- var ar = [];
25
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
- return ar;
27
- };
28
- return ownKeys(o);
29
- };
30
- return function (mod) {
31
- if (mod && mod.__esModule) return mod;
32
- var result = {};
33
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
- __setModuleDefault(result, mod);
35
- return result;
36
- };
37
- })();
38
16
  Object.defineProperty(exports, "__esModule", { value: true });
39
17
  exports.tsCodegen = exports.names = void 0;
40
18
  __exportStar(require("./lib/codegen/template"), exports);
@@ -49,8 +27,9 @@ __exportStar(require("./lib/utils/forEachTemplateNode"), exports);
49
27
  __exportStar(require("./lib/utils/parseSfc"), exports);
50
28
  __exportStar(require("./lib/utils/shared"), exports);
51
29
  __exportStar(require("./lib/virtualCode"), exports);
52
- exports.names = __importStar(require("./lib/codegen/names"));
53
- const vue_tsx_1 = require("./lib/plugins/vue-tsx");
30
+ var names_1 = require("./lib/codegen/names");
31
+ Object.defineProperty(exports, "names", { enumerable: true, get: function () { return names_1.names; } });
32
+ var vue_tsx_1 = require("./lib/plugins/vue-tsx");
54
33
  Object.defineProperty(exports, "tsCodegen", { enumerable: true, get: function () { return vue_tsx_1.tsCodegen; } });
55
34
  __exportStar(require("@volar/language-core"), exports);
56
35
  //# sourceMappingURL=index.js.map
@@ -1,20 +1,86 @@
1
1
  import type { VueCodeInformation } from '../types';
2
- export declare const codeFeatures: {
3
- all: VueCodeInformation;
4
- importCompletionOnly: VueCodeInformation;
5
- verification: VueCodeInformation;
6
- completion: VueCodeInformation;
7
- withoutCompletion: VueCodeInformation;
8
- navigation: VueCodeInformation;
9
- navigationWithoutRename: VueCodeInformation;
10
- navigationAndCompletion: VueCodeInformation;
11
- navigationAndVerification: VueCodeInformation;
12
- withoutNavigation: VueCodeInformation;
13
- semanticWithoutHighlight: VueCodeInformation;
14
- withoutHighlight: VueCodeInformation;
15
- withoutHighlightAndCompletion: VueCodeInformation;
16
- withoutSemantic: VueCodeInformation;
17
- doNotReportTs2339AndTs2551: VueCodeInformation;
18
- doNotReportTs2353AndTs2561: VueCodeInformation;
19
- doNotReportTs6133: VueCodeInformation;
2
+ declare const raw: {
3
+ all: {
4
+ verification: true;
5
+ completion: true;
6
+ semantic: true;
7
+ navigation: true;
8
+ };
9
+ importCompletionOnly: {
10
+ __importCompletion: true;
11
+ };
12
+ verification: {
13
+ verification: true;
14
+ };
15
+ completion: {
16
+ completion: true;
17
+ };
18
+ withoutCompletion: {
19
+ verification: true;
20
+ semantic: true;
21
+ navigation: true;
22
+ };
23
+ navigation: {
24
+ navigation: true;
25
+ };
26
+ navigationWithoutRename: {
27
+ navigation: {
28
+ shouldRename: () => false;
29
+ };
30
+ };
31
+ navigationAndCompletion: {
32
+ navigation: true;
33
+ completion: true;
34
+ };
35
+ navigationAndVerification: {
36
+ navigation: true;
37
+ verification: true;
38
+ };
39
+ withoutNavigation: {
40
+ verification: true;
41
+ completion: true;
42
+ semantic: true;
43
+ };
44
+ semanticWithoutHighlight: {
45
+ semantic: {
46
+ shouldHighlight: () => false;
47
+ };
48
+ };
49
+ withoutHighlight: {
50
+ semantic: {
51
+ shouldHighlight: () => false;
52
+ };
53
+ verification: true;
54
+ navigation: true;
55
+ completion: true;
56
+ };
57
+ withoutHighlightAndCompletion: {
58
+ semantic: {
59
+ shouldHighlight: () => false;
60
+ };
61
+ verification: true;
62
+ navigation: true;
63
+ };
64
+ withoutSemantic: {
65
+ verification: true;
66
+ navigation: true;
67
+ completion: true;
68
+ };
69
+ doNotReportTs2339AndTs2551: {
70
+ verification: {
71
+ shouldReport: (_source: string | undefined, code: string | number | undefined) => boolean;
72
+ };
73
+ };
74
+ doNotReportTs2353AndTs2561: {
75
+ verification: {
76
+ shouldReport: (_source: string | undefined, code: string | number | undefined) => boolean;
77
+ };
78
+ };
79
+ doNotReportTs6133: {
80
+ verification: {
81
+ shouldReport: (_source: string | undefined, code: string | number | undefined) => boolean;
82
+ };
83
+ };
20
84
  };
85
+ export declare const codeFeatures: { [K in keyof typeof raw]: VueCodeInformation; };
86
+ export {};
@@ -1,26 +1,73 @@
1
- export declare const ctx = "__VLS_ctx";
2
- export declare const dollars = "__VLS_dollars";
3
- export declare const slots = "__VLS_slots";
4
- export declare const props = "__VLS_props";
5
- export declare const defaults = "__VLS_defaults";
6
- export declare const defaultModels = "__VLS_defaultModels";
7
- export declare const modelEmit = "__VLS_modelEmit";
8
- export declare const emit = "__VLS_emit";
9
- export declare const exposed = "__VLS_exposed";
10
- export declare const setup = "__VLS_setup";
11
- export declare const components = "__VLS_components";
12
- export declare const directives = "__VLS_directives";
13
- export declare const intrinsics = "__VLS_intrinsics";
14
- export declare const _export = "__VLS_export";
15
- export declare const ModelProps = "__VLS_ModelProps";
16
- export declare const Props = "__VLS_Props";
17
- export declare const Slots = "__VLS_Slots";
18
- export declare const InheritedAttrs = "__VLS_InheritedAttrs";
19
- export declare const TemplateRefs = "__VLS_TemplateRefs";
20
- export declare const RootEl = "__VLS_RootEl";
21
- export declare const ModelEmit = "__VLS_ModelEmit";
22
- export declare const EmitProps = "__VLS_EmitProps";
23
- export declare const Emit = "__VLS_Emit";
24
- export declare const SetupExposed = "__VLS_SetupExposed";
25
- export declare const PublicProps = "__VLS_PublicProps";
26
- export declare const StyleModules = "__VLS_StyleModules";
1
+ declare const raw: {
2
+ base: string;
3
+ export: string;
4
+ components: string;
5
+ componentsOption: string;
6
+ ctx: string;
7
+ defaultModels: string;
8
+ defaults: string;
9
+ directives: string;
10
+ directivesOption: string;
11
+ dollars: string;
12
+ emit: string;
13
+ exposed: string;
14
+ intrinsics: string;
15
+ modelEmit: string;
16
+ props: string;
17
+ propsOption: string;
18
+ self: string;
19
+ setup: string;
20
+ slots: string;
21
+ src: string;
22
+ Emit: string;
23
+ EmitProps: string;
24
+ GlobalComponents: string;
25
+ InheritedAttrs: string;
26
+ LocalComponents: string;
27
+ LocalDirectives: string;
28
+ ModelEmit: string;
29
+ ModelProps: string;
30
+ Props: string;
31
+ PublicProps: string;
32
+ RootEl: string;
33
+ SetupExposed: string;
34
+ Slots: string;
35
+ StyleModules: string;
36
+ StyleScopedClasses: string;
37
+ TemplateRefs: string;
38
+ asFunctionalComponent0: string;
39
+ asFunctionalComponent1: string;
40
+ asFunctionalDirective: string;
41
+ asFunctionalElement0: string;
42
+ asFunctionalElement1: string;
43
+ asFunctionalSlot: string;
44
+ directiveBindingRestFields: string;
45
+ functionalComponentArgsRest: string;
46
+ tryAsConstant: string;
47
+ vFor: string;
48
+ vSlot: string;
49
+ ConstructorOverloads: string;
50
+ Elements: string;
51
+ EmitsToProps: string;
52
+ FunctionalComponent0: string;
53
+ FunctionalComponent1: string;
54
+ FunctionalComponentCtx: string;
55
+ FunctionalComponentProps: string;
56
+ IsAny: string;
57
+ IsFunction: string;
58
+ NormalizeComponentEvent: string;
59
+ NormalizeEmits: string;
60
+ OverloadUnion: string;
61
+ OverloadUnionInner: string;
62
+ PickNotAny: string;
63
+ PrettifyGlobal: string;
64
+ ResolveDirectives: string;
65
+ ResolveEmits: string;
66
+ ShortEmits: string;
67
+ ShortEmitsToObject: string;
68
+ SpreadMerge: string;
69
+ UnionToIntersection: string;
70
+ WithComponent: string;
71
+ };
72
+ export declare const names: typeof raw;
73
+ export {};
@@ -1,30 +1,78 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StyleModules = exports.PublicProps = exports.SetupExposed = exports.Emit = exports.EmitProps = exports.ModelEmit = exports.RootEl = exports.TemplateRefs = exports.InheritedAttrs = exports.Slots = exports.Props = exports.ModelProps = exports._export = exports.intrinsics = exports.directives = exports.components = exports.setup = exports.exposed = exports.emit = exports.modelEmit = exports.defaultModels = exports.defaults = exports.props = exports.slots = exports.dollars = exports.ctx = void 0;
4
- exports.ctx = '__VLS_ctx';
5
- exports.dollars = '__VLS_dollars';
6
- exports.slots = '__VLS_slots';
7
- exports.props = '__VLS_props';
8
- exports.defaults = '__VLS_defaults';
9
- exports.defaultModels = '__VLS_defaultModels';
10
- exports.modelEmit = '__VLS_modelEmit';
11
- exports.emit = '__VLS_emit';
12
- exports.exposed = '__VLS_exposed';
13
- exports.setup = '__VLS_setup';
14
- exports.components = '__VLS_components';
15
- exports.directives = '__VLS_directives';
16
- exports.intrinsics = '__VLS_intrinsics';
17
- exports._export = '__VLS_export';
18
- exports.ModelProps = '__VLS_ModelProps';
19
- exports.Props = '__VLS_Props';
20
- exports.Slots = '__VLS_Slots';
21
- exports.InheritedAttrs = '__VLS_InheritedAttrs';
22
- exports.TemplateRefs = '__VLS_TemplateRefs';
23
- exports.RootEl = '__VLS_RootEl';
24
- exports.ModelEmit = '__VLS_ModelEmit';
25
- exports.EmitProps = '__VLS_EmitProps';
26
- exports.Emit = '__VLS_Emit';
27
- exports.SetupExposed = '__VLS_SetupExposed';
28
- exports.PublicProps = '__VLS_PublicProps';
29
- exports.StyleModules = '__VLS_StyleModules';
3
+ exports.names = void 0;
4
+ const raw = {
5
+ base: '',
6
+ export: '',
7
+ components: '',
8
+ componentsOption: '',
9
+ ctx: '',
10
+ defaultModels: '',
11
+ defaults: '',
12
+ directives: '',
13
+ directivesOption: '',
14
+ dollars: '',
15
+ emit: '',
16
+ exposed: '',
17
+ intrinsics: '',
18
+ modelEmit: '',
19
+ props: '',
20
+ propsOption: '',
21
+ self: '',
22
+ setup: '',
23
+ slots: '',
24
+ src: '',
25
+ Emit: '',
26
+ EmitProps: '',
27
+ GlobalComponents: '',
28
+ InheritedAttrs: '',
29
+ LocalComponents: '',
30
+ LocalDirectives: '',
31
+ ModelEmit: '',
32
+ ModelProps: '',
33
+ Props: '',
34
+ PublicProps: '',
35
+ RootEl: '',
36
+ SetupExposed: '',
37
+ Slots: '',
38
+ StyleModules: '',
39
+ StyleScopedClasses: '',
40
+ TemplateRefs: '',
41
+ // #region template helpers
42
+ asFunctionalComponent0: '',
43
+ asFunctionalComponent1: '',
44
+ asFunctionalDirective: '',
45
+ asFunctionalElement0: '',
46
+ asFunctionalElement1: '',
47
+ asFunctionalSlot: '',
48
+ directiveBindingRestFields: '',
49
+ functionalComponentArgsRest: '',
50
+ tryAsConstant: '',
51
+ vFor: '',
52
+ vSlot: '',
53
+ ConstructorOverloads: '',
54
+ Elements: '',
55
+ EmitsToProps: '',
56
+ FunctionalComponent0: '',
57
+ FunctionalComponent1: '',
58
+ FunctionalComponentCtx: '',
59
+ FunctionalComponentProps: '',
60
+ IsAny: '',
61
+ IsFunction: '',
62
+ NormalizeComponentEvent: '',
63
+ NormalizeEmits: '',
64
+ OverloadUnion: '',
65
+ OverloadUnionInner: '',
66
+ PickNotAny: '',
67
+ PrettifyGlobal: '',
68
+ ResolveDirectives: '',
69
+ ResolveEmits: '',
70
+ ShortEmits: '',
71
+ ShortEmitsToObject: '',
72
+ SpreadMerge: '',
73
+ UnionToIntersection: '',
74
+ WithComponent: '',
75
+ // #endregion
76
+ };
77
+ exports.names = Object.fromEntries(Object.keys(raw).map(key => [key, `__VLS_${key}`]));
30
78
  //# sourceMappingURL=names.js.map
@@ -1,66 +1,27 @@
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
- })();
35
2
  Object.defineProperty(exports, "__esModule", { value: true });
36
3
  exports.generateComponent = generateComponent;
37
4
  const codeFeatures_1 = require("../codeFeatures");
38
- const names = __importStar(require("../names"));
5
+ const names_1 = require("../names");
39
6
  const utils_1 = require("../utils");
40
7
  const merge_1 = require("../utils/merge");
41
8
  function* generateComponent(options, ctx, scriptSetup, scriptSetupRanges) {
42
9
  yield `(await import('${options.vueCompilerOptions.lib}')).defineComponent({${utils_1.newLine}`;
43
- const returns = [];
44
10
  if (scriptSetupRanges.defineExpose) {
45
- returns.push([names.exposed]);
46
- }
47
- if (returns.length) {
48
- yield `setup: () => (`;
49
- yield* (0, merge_1.generateSpreadMerge)(returns);
50
- yield `),${utils_1.newLine}`;
11
+ yield `setup: () => ${names_1.names.exposed},${utils_1.newLine}`;
51
12
  }
52
13
  const emitOptionCodes = [...generateEmitsOption(options, scriptSetupRanges)];
53
14
  yield* emitOptionCodes;
54
15
  yield* generatePropsOption(options, ctx, scriptSetup, scriptSetupRanges, !!emitOptionCodes.length);
55
16
  if (options.vueCompilerOptions.target >= 3.5
56
17
  && options.vueCompilerOptions.inferComponentDollarRefs
57
- && options.templateAndStyleTypes.has(names.TemplateRefs)) {
58
- yield `__typeRefs: {} as ${names.TemplateRefs},${utils_1.newLine}`;
18
+ && options.templateAndStyleTypes.has(names_1.names.TemplateRefs)) {
19
+ yield `__typeRefs: {} as ${names_1.names.TemplateRefs},${utils_1.newLine}`;
59
20
  }
60
21
  if (options.vueCompilerOptions.target >= 3.5
61
22
  && options.vueCompilerOptions.inferComponentDollarEl
62
- && options.templateAndStyleTypes.has(names.RootEl)) {
63
- yield `__typeEl: {} as ${names.RootEl},${utils_1.newLine}`;
23
+ && options.templateAndStyleTypes.has(names_1.names.RootEl)) {
24
+ yield `__typeEl: {} as ${names_1.names.RootEl},${utils_1.newLine}`;
64
25
  }
65
26
  yield `})`;
66
27
  }
@@ -68,14 +29,14 @@ function* generateEmitsOption(options, scriptSetupRanges) {
68
29
  const optionCodes = [];
69
30
  const typeOptionCodes = [];
70
31
  if (scriptSetupRanges.defineModel.length) {
71
- optionCodes.push([`{} as __VLS_NormalizeEmits<typeof ${names.modelEmit}>`]);
72
- typeOptionCodes.push([names.ModelEmit]);
32
+ optionCodes.push([`{} as ${names_1.names.NormalizeEmits}<typeof ${names_1.names.modelEmit}>`]);
33
+ typeOptionCodes.push([names_1.names.ModelEmit]);
73
34
  }
74
35
  if (scriptSetupRanges.defineEmits) {
75
36
  const { name, typeArg, hasUnionTypeArg } = scriptSetupRanges.defineEmits;
76
- optionCodes.push([`{} as __VLS_NormalizeEmits<typeof ${name ?? names.emit}>`]);
37
+ optionCodes.push([`{} as ${names_1.names.NormalizeEmits}<typeof ${name ?? names_1.names.emit}>`]);
77
38
  if (typeArg && !hasUnionTypeArg) {
78
- typeOptionCodes.push([names.Emit]);
39
+ typeOptionCodes.push([names_1.names.Emit]);
79
40
  }
80
41
  else {
81
42
  typeOptionCodes.length = 0;
@@ -95,12 +56,12 @@ function* generateEmitsOption(options, scriptSetupRanges) {
95
56
  function* generatePropsOption(options, ctx, scriptSetup, scriptSetupRanges, hasEmitsOption) {
96
57
  const optionGenerates = [];
97
58
  const typeOptionGenerates = [];
98
- if (options.templateAndStyleTypes.has(names.InheritedAttrs)) {
59
+ if (options.templateAndStyleTypes.has(names_1.names.InheritedAttrs)) {
99
60
  const attrsType = hasEmitsOption
100
- ? `Omit<${names.InheritedAttrs}, keyof ${names.EmitProps}>`
101
- : names.InheritedAttrs;
61
+ ? `Omit<${names_1.names.InheritedAttrs}, keyof ${names_1.names.EmitProps}>`
62
+ : names_1.names.InheritedAttrs;
102
63
  optionGenerates.push(function* () {
103
- const propsType = `__VLS_PickNotAny<${ctx.localTypes.OmitIndexSignature}<${attrsType}>, {}>`;
64
+ const propsType = `${names_1.names.PickNotAny}<${ctx.localTypes.OmitIndexSignature}<${attrsType}>, {}>`;
104
65
  const optionType = `${ctx.localTypes.TypePropsToOption}<${propsType}>`;
105
66
  yield `{} as ${optionType}`;
106
67
  });
@@ -108,18 +69,18 @@ function* generatePropsOption(options, ctx, scriptSetup, scriptSetupRanges, hasE
108
69
  yield `{} as ${attrsType}`;
109
70
  });
110
71
  }
111
- if (ctx.generatedTypes.has(names.PublicProps)) {
72
+ if (ctx.generatedTypes.has(names_1.names.PublicProps)) {
112
73
  if (options.vueCompilerOptions.target < 3.6) {
113
74
  optionGenerates.push(function* () {
114
- let propsType = `${ctx.localTypes.TypePropsToOption}<${names.PublicProps}>`;
75
+ let propsType = `${ctx.localTypes.TypePropsToOption}<${names_1.names.PublicProps}>`;
115
76
  if (scriptSetupRanges.withDefaults?.arg) {
116
- propsType = `${ctx.localTypes.WithDefaults}<${propsType}, typeof ${names.defaults}>`;
77
+ propsType = `${ctx.localTypes.WithDefaults}<${propsType}, typeof ${names_1.names.defaults}>`;
117
78
  }
118
79
  yield `{} as ${propsType}`;
119
80
  });
120
81
  }
121
82
  typeOptionGenerates.push(function* () {
122
- yield `{} as ${names.PublicProps}`;
83
+ yield `{} as ${names_1.names.PublicProps}`;
123
84
  });
124
85
  }
125
86
  if (scriptSetupRanges.defineProps?.arg) {
@@ -132,7 +93,7 @@ function* generatePropsOption(options, ctx, scriptSetup, scriptSetupRanges, hasE
132
93
  if (useTypeOption) {
133
94
  if (options.vueCompilerOptions.target >= 3.6
134
95
  && scriptSetupRanges.withDefaults?.arg) {
135
- yield `__defaults: ${names.defaults},${utils_1.newLine}`;
96
+ yield `__defaults: ${names_1.names.defaults},${utils_1.newLine}`;
136
97
  }
137
98
  yield `__typeProps: `;
138
99
  yield* (0, merge_1.generateSpreadMerge)(typeOptionGenerates.map(g => g()));
@@ -36,13 +36,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.generateScript = generate;
37
37
  const path = __importStar(require("path-browserify"));
38
38
  const codeFeatures_1 = require("../codeFeatures");
39
- const names = __importStar(require("../names"));
39
+ const names_1 = require("../names");
40
40
  const utils_1 = require("../utils");
41
41
  const boundary_1 = require("../utils/boundary");
42
42
  const context_1 = require("./context");
43
43
  const scriptSetup_1 = require("./scriptSetup");
44
44
  const template_1 = require("./template");
45
- const exportExpression = `{} as typeof ${names._export}`;
45
+ const exportExpression = `{} as typeof ${names_1.names.export}`;
46
46
  function generate(options) {
47
47
  const ctx = (0, context_1.createScriptCodegenContext)(options);
48
48
  const codeGenerator = generateWorker(options, ctx);
@@ -60,7 +60,7 @@ function* generateWorker(options, ctx) {
60
60
  else if (src.endsWith('.tsx')) {
61
61
  src = src.slice(0, -'.tsx'.length) + '.jsx';
62
62
  }
63
- yield `import __VLS_default from `;
63
+ yield `import ${names_1.names.src} from `;
64
64
  const token = yield* (0, boundary_1.startBoundary)('main', script.src.offset, {
65
65
  ...codeFeatures_1.codeFeatures.all,
66
66
  ...src !== script.src.text ? codeFeatures_1.codeFeatures.navigationWithoutRename : {},
@@ -71,8 +71,8 @@ function* generateWorker(options, ctx) {
71
71
  yield `'`;
72
72
  yield (0, boundary_1.endBoundary)(token, script.src.offset + script.src.text.length);
73
73
  yield utils_1.endOfLine;
74
- yield `export default __VLS_default;${utils_1.endOfLine}`;
75
- yield* (0, template_1.generateTemplate)(options, ctx, '__VLS_default');
74
+ yield `export default ${names_1.names.src}${utils_1.endOfLine}`;
75
+ yield* (0, template_1.generateTemplate)(options, ctx, names_1.names.src);
76
76
  }
77
77
  // <script> + <script setup>
78
78
  else if (script && scriptRanges && scriptSetup && scriptSetupRanges) {
@@ -81,14 +81,14 @@ function* generateWorker(options, ctx) {
81
81
  let selfType;
82
82
  const { exportDefault } = scriptRanges;
83
83
  if (exportDefault) {
84
- yield* generateScriptWithExportDefault(ctx, script, scriptRanges, exportDefault, vueCompilerOptions, selfType = '__VLS_self');
84
+ yield* generateScriptWithExportDefault(ctx, script, scriptRanges, exportDefault, vueCompilerOptions, selfType = names_1.names.self);
85
85
  }
86
86
  else {
87
87
  yield* (0, utils_1.generateSfcBlockSection)(script, 0, script.content.length, codeFeatures_1.codeFeatures.all);
88
88
  yield `export default ${exportExpression}${utils_1.endOfLine}`;
89
89
  }
90
90
  // <script setup>
91
- yield* generateExportDeclareEqual(scriptSetup, names._export);
91
+ yield* generateExportDeclareEqual(scriptSetup, names_1.names.export);
92
92
  if (scriptSetup.generic) {
93
93
  yield* (0, scriptSetup_1.generateGeneric)(options, ctx, scriptSetup, scriptSetupRanges, scriptSetup.generic, (0, scriptSetup_1.generateSetupFunction)(options, ctx, scriptSetup, scriptSetupRanges, (0, template_1.generateTemplate)(options, ctx, selfType)));
94
94
  }
@@ -102,12 +102,12 @@ function* generateWorker(options, ctx) {
102
102
  else if (scriptSetup && scriptSetupRanges) {
103
103
  yield* (0, scriptSetup_1.generateScriptSetupImports)(scriptSetup, scriptSetupRanges);
104
104
  if (scriptSetup.generic) {
105
- yield* generateExportDeclareEqual(scriptSetup, names._export);
105
+ yield* generateExportDeclareEqual(scriptSetup, names_1.names.export);
106
106
  yield* (0, scriptSetup_1.generateGeneric)(options, ctx, scriptSetup, scriptSetupRanges, scriptSetup.generic, (0, scriptSetup_1.generateSetupFunction)(options, ctx, scriptSetup, scriptSetupRanges, (0, template_1.generateTemplate)(options, ctx)));
107
107
  }
108
108
  else {
109
109
  // no script block, generate script setup code at root
110
- yield* (0, scriptSetup_1.generateSetupFunction)(options, ctx, scriptSetup, scriptSetupRanges, (0, template_1.generateTemplate)(options, ctx), generateExportDeclareEqual(scriptSetup, names._export));
110
+ yield* (0, scriptSetup_1.generateSetupFunction)(options, ctx, scriptSetup, scriptSetupRanges, (0, template_1.generateTemplate)(options, ctx), generateExportDeclareEqual(scriptSetup, names_1.names.export));
111
111
  }
112
112
  yield `export default ${exportExpression}${utils_1.endOfLine}`;
113
113
  }
@@ -115,13 +115,13 @@ function* generateWorker(options, ctx) {
115
115
  else if (script && scriptRanges) {
116
116
  const { exportDefault } = scriptRanges;
117
117
  if (exportDefault) {
118
- yield* generateScriptWithExportDefault(ctx, script, scriptRanges, exportDefault, vueCompilerOptions, names._export, (0, template_1.generateTemplate)(options, ctx, names._export));
118
+ yield* generateScriptWithExportDefault(ctx, script, scriptRanges, exportDefault, vueCompilerOptions, names_1.names.export, (0, template_1.generateTemplate)(options, ctx, names_1.names.export));
119
119
  }
120
120
  else {
121
121
  yield* (0, utils_1.generateSfcBlockSection)(script, 0, script.content.length, codeFeatures_1.codeFeatures.all);
122
- yield* generateExportDeclareEqual(script, names._export);
122
+ yield* generateExportDeclareEqual(script, names_1.names.export);
123
123
  yield `(await import('${vueCompilerOptions.lib}')).defineComponent({})${utils_1.endOfLine}`;
124
- yield* (0, template_1.generateTemplate)(options, ctx, names._export);
124
+ yield* (0, template_1.generateTemplate)(options, ctx, names_1.names.export);
125
125
  yield `export default ${exportExpression}${utils_1.endOfLine}`;
126
126
  }
127
127
  }