@vue/language-core 2.1.10 → 2.2.2

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 (109) hide show
  1. package/index.d.ts +0 -1
  2. package/index.js +1 -2
  3. package/lib/codeFeatures.d.ts +1 -0
  4. package/lib/codeFeatures.js +3 -0
  5. package/lib/codegen/codeFeatures.d.ts +83 -0
  6. package/lib/codegen/codeFeatures.js +71 -0
  7. package/lib/codegen/globalTypes.d.ts +3 -1
  8. package/lib/codegen/globalTypes.js +39 -14
  9. package/lib/codegen/localTypes.d.ts +1 -1
  10. package/lib/codegen/localTypes.js +7 -7
  11. package/lib/codegen/script/binding.d.ts +4 -0
  12. package/lib/codegen/script/binding.js +41 -0
  13. package/lib/codegen/script/component.d.ts +1 -1
  14. package/lib/codegen/script/component.js +44 -44
  15. package/lib/codegen/script/componentSelf.d.ts +1 -1
  16. package/lib/codegen/script/componentSelf.js +14 -14
  17. package/lib/codegen/script/context.d.ts +1 -1
  18. package/lib/codegen/script/context.js +2 -2
  19. package/lib/codegen/script/index.d.ts +6 -11
  20. package/lib/codegen/script/index.js +21 -63
  21. package/lib/codegen/script/scriptSetup.d.ts +1 -1
  22. package/lib/codegen/script/scriptSetup.js +236 -205
  23. package/lib/codegen/script/src.js +8 -8
  24. package/lib/codegen/script/styleModulesType.d.ts +1 -1
  25. package/lib/codegen/script/styleModulesType.js +7 -7
  26. package/lib/codegen/script/template.d.ts +2 -2
  27. package/lib/codegen/script/template.js +81 -114
  28. package/lib/codegen/template/context.d.ts +29 -15
  29. package/lib/codegen/template/context.js +51 -96
  30. package/lib/codegen/template/element.d.ts +2 -4
  31. package/lib/codegen/template/element.js +124 -317
  32. package/lib/codegen/template/elementChildren.d.ts +1 -1
  33. package/lib/codegen/template/elementChildren.js +10 -11
  34. package/lib/codegen/template/elementDirectives.d.ts +1 -0
  35. package/lib/codegen/template/elementDirectives.js +43 -30
  36. package/lib/codegen/template/elementEvents.d.ts +2 -2
  37. package/lib/codegen/template/elementEvents.js +32 -65
  38. package/lib/codegen/template/elementProps.d.ts +5 -3
  39. package/lib/codegen/template/elementProps.js +116 -123
  40. package/lib/codegen/template/index.d.ts +1 -0
  41. package/lib/codegen/template/index.js +67 -69
  42. package/lib/codegen/template/interpolation.d.ts +5 -3
  43. package/lib/codegen/template/interpolation.js +30 -27
  44. package/lib/codegen/template/objectProperty.js +8 -8
  45. package/lib/codegen/template/propertyAccess.js +4 -4
  46. package/lib/codegen/template/slotOutlet.d.ts +1 -1
  47. package/lib/codegen/template/slotOutlet.js +47 -25
  48. package/lib/codegen/template/styleScopedClasses.d.ts +4 -1
  49. package/lib/codegen/template/styleScopedClasses.js +152 -8
  50. package/lib/codegen/template/templateChild.d.ts +1 -1
  51. package/lib/codegen/template/templateChild.js +39 -20
  52. package/lib/codegen/template/vFor.d.ts +1 -1
  53. package/lib/codegen/template/vFor.js +11 -11
  54. package/lib/codegen/template/vIf.d.ts +1 -1
  55. package/lib/codegen/template/vIf.js +6 -6
  56. package/lib/codegen/template/vSlot.d.ts +5 -0
  57. package/lib/codegen/template/vSlot.js +80 -0
  58. package/lib/codegen/utils/camelized.d.ts +2 -0
  59. package/lib/codegen/utils/camelized.js +31 -0
  60. package/lib/codegen/utils/index.d.ts +21 -0
  61. package/lib/codegen/utils/index.js +79 -0
  62. package/lib/codegen/utils/src.d.ts +2 -0
  63. package/lib/codegen/utils/src.js +19 -0
  64. package/lib/codegen/{template → utils}/stringLiteralKey.js +3 -3
  65. package/lib/codegen/utils/unicode.d.ts +2 -0
  66. package/lib/codegen/utils/unicode.js +25 -0
  67. package/lib/languagePlugin.js +1 -1
  68. package/lib/parsers/scriptRanges.d.ts +7 -2
  69. package/lib/parsers/scriptSetupRanges.d.ts +69 -83
  70. package/lib/parsers/scriptSetupRanges.js +194 -171
  71. package/lib/parsers/vueCompilerOptions.d.ts +2 -0
  72. package/lib/parsers/vueCompilerOptions.js +23 -0
  73. package/lib/plugins/file-html.js +4 -3
  74. package/lib/plugins/file-md.js +1 -1
  75. package/lib/plugins/file-vue.js +4 -4
  76. package/lib/plugins/vue-root-tags.js +2 -2
  77. package/lib/plugins/vue-style-class-names.d.ts +5 -0
  78. package/lib/plugins/vue-style-class-names.js +32 -0
  79. package/lib/plugins/vue-style-reference-link.d.ts +1 -0
  80. package/lib/plugins/vue-style-reference-link.js +3 -0
  81. package/lib/plugins/vue-style-reference-links.d.ts +3 -0
  82. package/lib/plugins/vue-style-reference-links.js +26 -0
  83. package/lib/plugins/vue-template-html.js +6 -2
  84. package/lib/plugins/vue-template-inline-css.js +1 -1
  85. package/lib/plugins/vue-template-inline-ts.js +66 -17
  86. package/lib/plugins/vue-tsx.d.ts +126 -92
  87. package/lib/plugins/vue-tsx.js +114 -97
  88. package/lib/plugins/vue-vine.d.ts +3 -0
  89. package/lib/plugins/vue-vine.js +35 -0
  90. package/lib/types.d.ts +25 -12
  91. package/lib/utils/buildMappings.d.ts +1 -1
  92. package/lib/utils/parseCssImports.d.ts +4 -0
  93. package/lib/utils/parseCssImports.js +19 -0
  94. package/lib/utils/parseSfc.d.ts +5 -0
  95. package/lib/utils/parseSfc.js +11 -5
  96. package/lib/utils/signals.d.ts +2 -0
  97. package/lib/utils/signals.js +54 -0
  98. package/lib/utils/ts.d.ts +14 -2
  99. package/lib/utils/ts.js +134 -91
  100. package/lib/virtualFile/computedEmbeddedCodes.d.ts +1 -2
  101. package/lib/virtualFile/computedEmbeddedCodes.js +11 -11
  102. package/lib/virtualFile/computedSfc.d.ts +1 -2
  103. package/lib/virtualFile/computedSfc.js +87 -79
  104. package/lib/virtualFile/computedVueSfc.d.ts +1 -2
  105. package/lib/virtualFile/computedVueSfc.js +7 -7
  106. package/lib/virtualFile/vueFile.d.ts +5 -5
  107. package/lib/virtualFile/vueFile.js +6 -6
  108. package/package.json +6 -6
  109. /package/lib/codegen/{template → utils}/stringLiteralKey.d.ts +0 -0
@@ -1,17 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generateSrc = generateSrc;
4
- const common_1 = require("../common");
5
- const index_1 = require("./index");
4
+ const codeFeatures_1 = require("../codeFeatures");
5
+ const utils_1 = require("../utils");
6
6
  function* generateSrc(script, src) {
7
7
  if (src.endsWith('.d.ts')) {
8
- src = src.substring(0, src.length - '.d.ts'.length);
8
+ src = src.slice(0, -'.d.ts'.length);
9
9
  }
10
10
  else if (src.endsWith('.ts')) {
11
- src = src.substring(0, src.length - '.ts'.length);
11
+ src = src.slice(0, -'.ts'.length);
12
12
  }
13
13
  else if (src.endsWith('.tsx')) {
14
- src = src.substring(0, src.length - '.tsx'.length) + '.jsx';
14
+ src = src.slice(0, -'.tsx'.length) + '.jsx';
15
15
  }
16
16
  if (!src.endsWith('.js') && !src.endsWith('.jsx')) {
17
17
  src = src + '.js';
@@ -22,7 +22,7 @@ function* generateSrc(script, src) {
22
22
  'script',
23
23
  script.srcOffset - 1,
24
24
  {
25
- ...index_1.codeFeatures.all,
25
+ ...codeFeatures_1.codeFeatures.all,
26
26
  navigation: src === script.src
27
27
  ? true
28
28
  : {
@@ -45,7 +45,7 @@ function* generateSrc(script, src) {
45
45
  },
46
46
  },
47
47
  ];
48
- yield common_1.endOfLine;
49
- yield `export { default } from '${src}'${common_1.endOfLine}`;
48
+ yield utils_1.endOfLine;
49
+ yield `export { default } from '${src}'${utils_1.endOfLine}`;
50
50
  }
51
51
  //# sourceMappingURL=src.js.map
@@ -1,4 +1,4 @@
1
1
  import type { Code } from '../../types';
2
2
  import type { ScriptCodegenContext } from './context';
3
- import { ScriptCodegenOptions } from './index';
3
+ import type { ScriptCodegenOptions } from './index';
4
4
  export declare function generateStyleModulesType(options: ScriptCodegenOptions, ctx: ScriptCodegenContext): Generator<Code>;
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generateStyleModulesType = generateStyleModulesType;
4
- const index_1 = require("./index");
4
+ const codeFeatures_1 = require("../codeFeatures");
5
+ const utils_1 = require("../utils");
5
6
  const template_1 = require("./template");
6
- const common_1 = require("../common");
7
7
  function* generateStyleModulesType(options, ctx) {
8
8
  const styles = options.sfc.styles.map((style, i) => [style, i]).filter(([style]) => style.module);
9
- if (!styles.length && !options.scriptSetupRanges?.cssModules.length) {
9
+ if (!styles.length && !options.scriptSetupRanges?.useCssModule.length) {
10
10
  return;
11
11
  }
12
- yield `type __VLS_StyleModules = {${common_1.newLine}`;
12
+ yield `type __VLS_StyleModules = {${utils_1.newLine}`;
13
13
  for (const [style, i] of styles) {
14
14
  const { name, offset } = style.module;
15
15
  if (offset) {
@@ -17,7 +17,7 @@ function* generateStyleModulesType(options, ctx) {
17
17
  name,
18
18
  'main',
19
19
  offset + 1,
20
- index_1.codeFeatures.all
20
+ codeFeatures_1.codeFeatures.all
21
21
  ];
22
22
  }
23
23
  else {
@@ -27,8 +27,8 @@ function* generateStyleModulesType(options, ctx) {
27
27
  for (const className of style.classNames) {
28
28
  yield* (0, template_1.generateCssClassProperty)(i, className.text, className.offset, 'string', false);
29
29
  }
30
- yield `>${common_1.endOfLine}`;
30
+ yield `>${utils_1.endOfLine}`;
31
31
  }
32
- yield `}${common_1.endOfLine}`;
32
+ yield `}${utils_1.endOfLine}`;
33
33
  }
34
34
  //# sourceMappingURL=styleModulesType.js.map
@@ -1,8 +1,8 @@
1
1
  import type { Code } from '../../types';
2
2
  import { TemplateCodegenContext } from '../template/context';
3
3
  import type { ScriptCodegenContext } from './context';
4
- import { type ScriptCodegenOptions } from './index';
5
- export declare function generateTemplateDirectives(options: ScriptCodegenOptions): Generator<Code>;
4
+ import type { ScriptCodegenOptions } from './index';
6
5
  export declare function generateTemplate(options: ScriptCodegenOptions, ctx: ScriptCodegenContext): Generator<Code, TemplateCodegenContext>;
6
+ export declare function generateTemplateDirectives(options: ScriptCodegenOptions): Generator<Code>;
7
7
  export declare function generateCssClassProperty(styleIndex: number, classNameWithDot: string, offset: number, propertyType: string, optional: boolean): Generator<Code>;
8
8
  export declare function getTemplateUsageVars(options: ScriptCodegenOptions, ctx: ScriptCodegenContext): Set<string>;
@@ -1,16 +1,27 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateTemplateDirectives = generateTemplateDirectives;
4
3
  exports.generateTemplate = generateTemplate;
4
+ exports.generateTemplateDirectives = generateTemplateDirectives;
5
5
  exports.generateCssClassProperty = generateCssClassProperty;
6
6
  exports.getTemplateUsageVars = getTemplateUsageVars;
7
- const path = require("path-browserify");
8
7
  const shared_1 = require("../../utils/shared");
9
- const common_1 = require("../common");
8
+ const codeFeatures_1 = require("../codeFeatures");
10
9
  const context_1 = require("../template/context");
11
10
  const interpolation_1 = require("../template/interpolation");
12
11
  const styleScopedClasses_1 = require("../template/styleScopedClasses");
13
- const index_1 = require("./index");
12
+ const utils_1 = require("../utils");
13
+ function* generateTemplate(options, ctx) {
14
+ ctx.generatedTemplate = true;
15
+ const templateCodegenCtx = (0, context_1.createTemplateCodegenContext)({
16
+ scriptSetupBindingNames: new Set(),
17
+ edited: options.edited,
18
+ });
19
+ yield* generateTemplateCtx(options);
20
+ yield* generateTemplateComponents(options);
21
+ yield* generateTemplateDirectives(options);
22
+ yield* generateTemplateBody(options, templateCodegenCtx);
23
+ return templateCodegenCtx;
24
+ }
14
25
  function* generateTemplateCtx(options) {
15
26
  const exps = [];
16
27
  exps.push(`{} as InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>`);
@@ -23,101 +34,93 @@ function* generateTemplateCtx(options) {
23
34
  yield `const __VLS_ctx = `;
24
35
  if (exps.length === 1) {
25
36
  yield exps[0];
26
- yield `${common_1.endOfLine}`;
37
+ yield `${utils_1.endOfLine}`;
27
38
  }
28
39
  else {
29
- yield `{${common_1.newLine}`;
40
+ yield `{${utils_1.newLine}`;
30
41
  for (const exp of exps) {
31
42
  yield `...`;
32
43
  yield exp;
33
- yield `,${common_1.newLine}`;
44
+ yield `,${utils_1.newLine}`;
34
45
  }
35
- yield `}${common_1.endOfLine}`;
46
+ yield `}${utils_1.endOfLine}`;
36
47
  }
37
48
  }
38
49
  function* generateTemplateComponents(options) {
39
- const exps = [];
50
+ const types = [];
40
51
  if (options.sfc.script && options.scriptRanges?.exportDefault?.componentsOption) {
41
52
  const { componentsOption } = options.scriptRanges.exportDefault;
42
- exps.push([
43
- options.sfc.script.content.substring(componentsOption.start, componentsOption.end),
53
+ yield `const __VLS_componentsOption = `;
54
+ yield [
55
+ options.sfc.script.content.slice(componentsOption.start, componentsOption.end),
44
56
  'script',
45
57
  componentsOption.start,
46
- index_1.codeFeatures.navigation,
47
- ]);
48
- }
49
- let nameType;
50
- if (options.sfc.script && options.scriptRanges?.exportDefault?.nameOption) {
51
- const { nameOption } = options.scriptRanges.exportDefault;
52
- nameType = options.sfc.script.content.substring(nameOption.start, nameOption.end);
53
- }
54
- else if (options.sfc.scriptSetup) {
55
- const baseName = path.basename(options.fileName);
56
- nameType = `'${options.scriptSetupRanges?.options.name ?? baseName.substring(0, baseName.lastIndexOf('.'))}'`;
57
- }
58
- if (nameType) {
59
- exps.push(`{} as {
60
- [K in ${nameType}]: typeof __VLS_self
61
- & (new () => {
62
- ${(0, shared_1.getSlotsPropertyName)(options.vueCompilerOptions.target)}: typeof ${options.scriptSetupRanges?.slots?.name ?? '__VLS_slots'}
63
- })
64
- }`);
65
- }
66
- exps.push(`{} as NonNullable<typeof __VLS_self extends { components: infer C } ? C : {}>`);
67
- exps.push(`__VLS_ctx`);
68
- yield `const __VLS_localComponents = {${common_1.newLine}`;
69
- for (const type of exps) {
70
- yield `...`;
58
+ codeFeatures_1.codeFeatures.navigation,
59
+ ];
60
+ yield utils_1.endOfLine;
61
+ types.push(`typeof __VLS_componentsOption`);
62
+ }
63
+ types.push(`typeof __VLS_ctx`);
64
+ yield `type __VLS_LocalComponents =`;
65
+ for (const type of types) {
66
+ yield ` & `;
71
67
  yield type;
72
- yield `,${common_1.newLine}`;
73
68
  }
74
- yield `}${common_1.endOfLine}`;
75
- yield `let __VLS_components!: typeof __VLS_localComponents & __VLS_GlobalComponents${common_1.endOfLine}`;
69
+ yield utils_1.endOfLine;
70
+ yield `let __VLS_components!: __VLS_LocalComponents & __VLS_GlobalComponents${utils_1.endOfLine}`;
76
71
  }
77
72
  function* generateTemplateDirectives(options) {
78
- const exps = [];
73
+ const types = [];
79
74
  if (options.sfc.script && options.scriptRanges?.exportDefault?.directivesOption) {
80
75
  const { directivesOption } = options.scriptRanges.exportDefault;
81
- exps.push([
82
- options.sfc.script.content.substring(directivesOption.start, directivesOption.end),
76
+ yield `const __VLS_directivesOption = `;
77
+ yield [
78
+ options.sfc.script.content.slice(directivesOption.start, directivesOption.end),
83
79
  'script',
84
80
  directivesOption.start,
85
- index_1.codeFeatures.navigation,
86
- ]);
87
- }
88
- exps.push(`{} as NonNullable<typeof __VLS_self extends { directives: infer D } ? D : {}>`);
89
- exps.push(`__VLS_ctx`);
90
- yield `const __VLS_localDirectives = {${common_1.newLine}`;
91
- for (const type of exps) {
92
- yield `...`;
81
+ codeFeatures_1.codeFeatures.navigation,
82
+ ];
83
+ yield utils_1.endOfLine;
84
+ types.push(`typeof __VLS_directivesOption`);
85
+ }
86
+ types.push(`typeof __VLS_ctx`);
87
+ yield `type __VLS_LocalDirectives =`;
88
+ for (const type of types) {
89
+ yield ` & `;
93
90
  yield type;
94
- yield `,${common_1.newLine}`;
95
91
  }
96
- yield `}${common_1.endOfLine}`;
97
- yield `let __VLS_directives!: typeof __VLS_localDirectives & __VLS_GlobalDirectives${common_1.endOfLine}`;
98
- }
99
- function* generateTemplate(options, ctx) {
100
- ctx.generatedTemplate = true;
101
- const templateCodegenCtx = (0, context_1.createTemplateCodegenContext)({
102
- scriptSetupBindingNames: new Set(),
103
- edited: options.edited,
104
- });
105
- yield* generateTemplateCtx(options);
106
- yield* generateTemplateComponents(options);
107
- yield* generateTemplateDirectives(options);
108
- yield* generateTemplateBody(options, templateCodegenCtx);
109
- return templateCodegenCtx;
92
+ yield utils_1.endOfLine;
93
+ yield `let __VLS_directives!: __VLS_LocalDirectives & __VLS_GlobalDirectives${utils_1.endOfLine}`;
110
94
  }
111
95
  function* generateTemplateBody(options, templateCodegenCtx) {
96
+ yield* generateStyleScopedClasses(options, templateCodegenCtx);
97
+ yield* (0, styleScopedClasses_1.generateStyleScopedClassReferences)(templateCodegenCtx, true);
98
+ yield* generateCssVars(options, templateCodegenCtx);
99
+ if (options.templateCodegen) {
100
+ for (const code of options.templateCodegen.codes) {
101
+ yield code;
102
+ }
103
+ }
104
+ else {
105
+ yield `// no template${utils_1.newLine}`;
106
+ if (!options.scriptSetupRanges?.defineSlots) {
107
+ yield `type __VLS_Slots = {}${utils_1.endOfLine}`;
108
+ }
109
+ yield `type __VLS_InheritedAttrs = {}${utils_1.endOfLine}`;
110
+ yield `type __VLS_TemplateRefs = {}${utils_1.endOfLine}`;
111
+ yield `type __VLS_RootEl = any${utils_1.endOfLine}`;
112
+ }
113
+ }
114
+ function* generateStyleScopedClasses(options, ctx) {
112
115
  const firstClasses = new Set();
113
- yield `let __VLS_styleScopedClasses!: {}`;
116
+ yield `type __VLS_StyleScopedClasses = {}`;
114
117
  for (let i = 0; i < options.sfc.styles.length; i++) {
115
118
  const style = options.sfc.styles[i];
116
119
  const option = options.vueCompilerOptions.experimentalResolveStyleCssClasses;
117
120
  if (option === 'always' || (option === 'scoped' && style.scoped)) {
118
121
  for (const className of style.classNames) {
119
122
  if (firstClasses.has(className.text)) {
120
- templateCodegenCtx.scopedClasses.push({
123
+ ctx.scopedClasses.push({
121
124
  source: 'style_' + i,
122
125
  className: className.text.slice(1),
123
126
  offset: className.offset + 1
@@ -129,51 +132,29 @@ function* generateTemplateBody(options, templateCodegenCtx) {
129
132
  }
130
133
  }
131
134
  }
132
- yield common_1.endOfLine;
133
- yield* (0, styleScopedClasses_1.generateStyleScopedClasses)(templateCodegenCtx, true);
134
- yield* generateCssVars(options, templateCodegenCtx);
135
- if (options.templateCodegen) {
136
- for (const code of options.templateCodegen.codes) {
137
- yield code;
138
- }
139
- }
140
- else {
141
- yield `// no template${common_1.newLine}`;
142
- if (!options.scriptSetupRanges?.slots.define) {
143
- yield `const __VLS_slots = {}${common_1.endOfLine}`;
144
- }
145
- yield `const __VLS_inheritedAttrs = {}${common_1.endOfLine}`;
146
- yield `const $refs = {}${common_1.endOfLine}`;
147
- yield `const $el = {} as any${common_1.endOfLine}`;
148
- }
149
- yield `return {${common_1.newLine}`;
150
- yield ` attrs: {} as Partial<typeof __VLS_inheritedAttrs>,${common_1.newLine}`;
151
- yield ` slots: ${options.scriptSetupRanges?.slots.name ?? '__VLS_slots'},${common_1.newLine}`;
152
- yield ` refs: $refs,${common_1.newLine}`;
153
- yield ` rootEl: $el,${common_1.newLine}`;
154
- yield `}${common_1.endOfLine}`;
135
+ yield utils_1.endOfLine;
155
136
  }
156
137
  function* generateCssClassProperty(styleIndex, classNameWithDot, offset, propertyType, optional) {
157
- yield `${common_1.newLine} & { `;
138
+ yield `${utils_1.newLine} & { `;
158
139
  yield [
159
140
  '',
160
141
  'style_' + styleIndex,
161
142
  offset,
162
- index_1.codeFeatures.navigation,
143
+ codeFeatures_1.codeFeatures.navigation,
163
144
  ];
164
145
  yield `'`;
165
146
  yield [
166
- classNameWithDot.substring(1),
147
+ classNameWithDot.slice(1),
167
148
  'style_' + styleIndex,
168
149
  offset + 1,
169
- index_1.codeFeatures.navigation,
150
+ codeFeatures_1.codeFeatures.navigation,
170
151
  ];
171
152
  yield `'`;
172
153
  yield [
173
154
  '',
174
155
  'style_' + styleIndex,
175
156
  offset + classNameWithDot.length,
176
- index_1.codeFeatures.navigationWithoutRename,
157
+ codeFeatures_1.codeFeatures.navigationWithoutRename,
177
158
  ];
178
159
  yield `${optional ? '?' : ''}: ${propertyType}`;
179
160
  yield ` }`;
@@ -182,28 +163,14 @@ function* generateCssVars(options, ctx) {
182
163
  if (!options.sfc.styles.length) {
183
164
  return;
184
165
  }
185
- yield `// CSS variable injection ${common_1.newLine}`;
166
+ yield `// CSS variable injection ${utils_1.newLine}`;
186
167
  for (const style of options.sfc.styles) {
187
168
  for (const cssBind of style.cssVars) {
188
- for (const [segment, offset, onlyError] of (0, interpolation_1.forEachInterpolationSegment)(options.ts, undefined, undefined, ctx, cssBind.text, cssBind.offset, options.ts.createSourceFile('/a.txt', cssBind.text, 99))) {
189
- if (offset === undefined) {
190
- yield segment;
191
- }
192
- else {
193
- yield [
194
- segment,
195
- style.name,
196
- cssBind.offset + offset,
197
- onlyError
198
- ? index_1.codeFeatures.navigation
199
- : index_1.codeFeatures.all,
200
- ];
201
- }
202
- }
203
- yield common_1.endOfLine;
169
+ yield* (0, interpolation_1.generateInterpolation)(options, ctx, style.name, codeFeatures_1.codeFeatures.all, cssBind.text, cssBind.offset);
170
+ yield utils_1.endOfLine;
204
171
  }
205
172
  }
206
- yield `// CSS variable injection end ${common_1.newLine}`;
173
+ yield `// CSS variable injection end ${utils_1.newLine}`;
207
174
  }
208
175
  function getTemplateUsageVars(options, ctx) {
209
176
  const usageVars = new Set();
@@ -216,7 +183,7 @@ function getTemplateUsageVars(options, ctx) {
216
183
  }
217
184
  }
218
185
  for (const component of components) {
219
- if (component.indexOf('.') >= 0) {
186
+ if (component.includes('.')) {
220
187
  usageVars.add(component.split('.')[0]);
221
188
  }
222
189
  }
@@ -1,37 +1,46 @@
1
1
  import type * as CompilerDOM from '@vue/compiler-dom';
2
2
  import type { Code, VueCodeInformation } from '../../types';
3
- import type { TemplateCodegenOptions } from './index';
4
3
  import { InlayHintInfo } from '../inlayHints';
4
+ import type { TemplateCodegenOptions } from './index';
5
5
  export type TemplateCodegenContext = ReturnType<typeof createTemplateCodegenContext>;
6
6
  export declare function createTemplateCodegenContext(options: Pick<TemplateCodegenOptions, 'scriptSetupBindingNames' | 'edited'>): {
7
- slots: {
8
- name: string;
9
- loc?: number;
10
- tagRange: [number, number];
11
- varName: string;
12
- nodeLoc: any;
13
- }[];
14
- dynamicSlots: {
15
- expVar: string;
16
- varName: string;
17
- }[];
18
7
  codeFeatures: {
19
8
  all: VueCodeInformation;
9
+ none: VueCodeInformation;
20
10
  verification: VueCodeInformation;
21
11
  completion: VueCodeInformation;
22
12
  additionalCompletion: VueCodeInformation;
13
+ withoutCompletion: VueCodeInformation;
23
14
  navigation: VueCodeInformation;
24
15
  navigationWithoutRename: VueCodeInformation;
25
16
  navigationAndCompletion: VueCodeInformation;
26
17
  navigationAndAdditionalCompletion: VueCodeInformation;
18
+ navigationAndVerification: VueCodeInformation;
19
+ withoutNavigation: VueCodeInformation;
27
20
  withoutHighlight: VueCodeInformation;
21
+ withoutHighlightAndNavigation: VueCodeInformation;
28
22
  withoutHighlightAndCompletion: VueCodeInformation;
29
23
  withoutHighlightAndCompletionAndNavigation: VueCodeInformation;
30
24
  };
25
+ resolveCodeFeatures: (features: VueCodeInformation) => VueCodeInformation;
26
+ slots: {
27
+ name: string;
28
+ offset?: number;
29
+ tagRange: [number, number];
30
+ nodeLoc: any;
31
+ propsVar: string;
32
+ }[];
33
+ dynamicSlots: {
34
+ expVar: string;
35
+ propsVar: string;
36
+ }[];
37
+ specialVars: Set<string>;
31
38
  accessExternalVariables: Map<string, Set<number>>;
32
- hasSlotElements: Set<CompilerDOM.ElementNode>;
39
+ lastGenericComment: {
40
+ content: string;
41
+ offset: number;
42
+ } | undefined;
33
43
  blockConditions: string[];
34
- usedComponentCtxVars: Set<string>;
35
44
  scopedClasses: {
36
45
  source: string;
37
46
  className: string;
@@ -40,8 +49,13 @@ export declare function createTemplateCodegenContext(options: Pick<TemplateCodeg
40
49
  emptyClassOffsets: number[];
41
50
  inlayHints: InlayHintInfo[];
42
51
  hasSlot: boolean;
43
- inheritedAttrVars: Set<unknown>;
52
+ bindingAttrLocs: CompilerDOM.SourceLocation[];
53
+ inheritedAttrVars: Set<string>;
44
54
  templateRefs: Map<string, [varName: string, offset: number]>;
55
+ currentComponent: {
56
+ ctxVar: string;
57
+ used: boolean;
58
+ } | undefined;
45
59
  singleRootElType: string | undefined;
46
60
  singleRootNode: CompilerDOM.ElementNode | undefined;
47
61
  accessExternalVariable(name: string, offset?: number): void;