@vue/language-core 1.7.11 → 1.7.13

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.
@@ -52,7 +52,7 @@ function generate(ts, fileName, _sfc, lang, scriptRanges, scriptSetupRanges, htm
52
52
  const usedHelperTypes = {
53
53
  DefinePropsToOptions: false,
54
54
  mergePropDefaults: false,
55
- ConstructorOverloads: false,
55
+ EmitsTypeHelpers: false,
56
56
  WithTemplateSlots: false,
57
57
  PropsChildren: false,
58
58
  };
@@ -101,7 +101,7 @@ function generate(ts, fileName, _sfc, lang, scriptRanges, scriptSetupRanges, htm
101
101
  };\n`);
102
102
  usedPrettify = true;
103
103
  }
104
- if (usedHelperTypes.ConstructorOverloads) {
104
+ if (usedHelperTypes.EmitsTypeHelpers) {
105
105
  // fix https://github.com/vuejs/language-tools/issues/926
106
106
  codes.push('type __VLS_UnionToIntersection<U> = __VLS_Prettify<(U extends unknown ? (arg: U) => unknown : never) extends ((arg: infer P) => unknown) ? P : never>;\n');
107
107
  usedPrettify = true;
@@ -111,6 +111,10 @@ function generate(ts, fileName, _sfc, lang, scriptRanges, scriptSetupRanges, htm
111
111
  else {
112
112
  codes.push(sharedTypes.genConstructorOverloads('__VLS_ConstructorOverloads'));
113
113
  }
114
+ codes.push(`type __VLS_NormalizeEmits<T> = __VLS_ConstructorOverloads<T> & {
115
+ [K in keyof T]: T[K] extends any[] ? { (...args: T[K]): void } : never
116
+ }`);
117
+ ;
114
118
  }
115
119
  if (usedHelperTypes.WithTemplateSlots) {
116
120
  codes.push(`type __VLS_WithTemplateSlots<T, S> = T & { new(): {\n`, `$slots: S;\n`);
@@ -506,8 +510,8 @@ declare function defineProp<T>(value?: T | (() => T), required?: boolean, rest?:
506
510
  codes.push(`},\n`);
507
511
  }
508
512
  if (scriptSetupRanges.emitsTypeArg) {
509
- usedHelperTypes.ConstructorOverloads = true;
510
- codes.push(`emits: ({} as __VLS_UnionToIntersection<__VLS_ConstructorOverloads<`);
513
+ usedHelperTypes.EmitsTypeHelpers = true;
514
+ codes.push(`emits: ({} as __VLS_UnionToIntersection<__VLS_NormalizeEmits<`);
511
515
  addExtraReferenceVirtualCode('scriptSetup', scriptSetupRanges.emitsTypeArg.start, scriptSetupRanges.emitsTypeArg.end);
512
516
  codes.push(`>>),\n`);
513
517
  }
@@ -58,6 +58,7 @@ const transformContext = {
58
58
  expressionPlugins: ['typescript'],
59
59
  };
60
60
  function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourceLang, sfc, hasScriptSetupSlots, codegenStack) {
61
+ const nativeTags = new Set(vueCompilerOptions.nativeTags);
61
62
  const [codes, codeStacks] = codegenStack ? muggle.track([]) : [[], []];
62
63
  const [formatCodes, formatCodeStacks] = codegenStack ? muggle.track([]) : [[], []];
63
64
  const [cssCodes, cssCodeStacks] = codegenStack ? muggle.track([]) : [[], []];
@@ -144,25 +145,24 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
144
145
  }
145
146
  function generateComponentVars() {
146
147
  const data = {};
147
- codes.push(`let __VLS_templateComponents!: __VLS_IntrinsicElements\n`);
148
+ codes.push(`let __VLS_templateComponents!: {}\n`);
148
149
  for (const tagName in tagNames) {
150
+ if (nativeTags.has(tagName))
151
+ continue;
149
152
  const isNamespacedTag = tagName.indexOf('.') >= 0;
150
153
  if (isNamespacedTag)
151
154
  continue;
152
- const varName = validTsVar.test(tagName) ? tagName : (0, shared_1.capitalize)((0, shared_1.camelize)(tagName.replace(/:/g, '-')));
153
- codes.push(`& __VLS_WithComponent<'${varName}', typeof __VLS_components, `,
155
+ const validName = validTsVar.test(tagName) ? tagName : (0, shared_1.capitalize)((0, shared_1.camelize)(tagName.replace(/:/g, '-')));
156
+ codes.push(`& __VLS_WithComponent<'${validName}', typeof __VLS_components, `,
154
157
  // order is important: https://github.com/vuejs/language-tools/issues/2010
155
158
  `"${(0, shared_1.capitalize)((0, shared_1.camelize)(tagName))}", `, `"${(0, shared_1.camelize)(tagName)}", `, `"${tagName}"`, '>\n');
156
- data[tagName] = varName;
159
+ data[tagName] = validName;
157
160
  }
158
161
  codes.push(`;\n`);
159
162
  for (const tagName in tagNames) {
160
- const varName = data[tagName];
161
- if (!varName)
162
- continue;
163
163
  const tagOffsets = tagNames[tagName];
164
164
  const tagRanges = tagOffsets.map(offset => [offset, offset + tagName.length]);
165
- const names = new Set([
165
+ const names = new Set(nativeTags.has(tagName) ? [tagName] : [
166
166
  // order is important: https://github.com/vuejs/language-tools/issues/2010
167
167
  (0, shared_1.capitalize)((0, shared_1.camelize)(tagName)),
168
168
  (0, shared_1.camelize)(tagName),
@@ -170,7 +170,7 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
170
170
  ]);
171
171
  for (const name of names) {
172
172
  for (const tagRange of tagRanges) {
173
- codes.push(name === tagName ? '__VLS_templateComponents' : '__VLS_components', ...createPropertyAccessCode([
173
+ codes.push(nativeTags.has(tagName) ? '({} as __VLS_IntrinsicElements)' : '__VLS_components', ...createPropertyAccessCode([
174
174
  name,
175
175
  'template',
176
176
  tagRange,
@@ -185,23 +185,26 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
185
185
  }
186
186
  }
187
187
  codes.push('\n');
188
- codes.push('// @ts-ignore\n', // #2304
189
- '[');
190
- for (const tagRange of tagRanges) {
191
- codes.push([
192
- varName,
193
- 'template',
194
- tagRange,
195
- {
196
- completion: {
197
- additional: true,
198
- autoImportOnly: true,
188
+ const validName = data[tagName];
189
+ if (validName) {
190
+ codes.push('// @ts-ignore\n', // #2304
191
+ '[');
192
+ for (const tagRange of tagRanges) {
193
+ codes.push([
194
+ validName,
195
+ 'template',
196
+ tagRange,
197
+ {
198
+ completion: {
199
+ additional: true,
200
+ autoImportOnly: true,
201
+ },
199
202
  },
200
- },
201
- ]);
202
- codes.push(',');
203
+ ]);
204
+ codes.push(',');
205
+ }
206
+ codes.push(`];\n`);
203
207
  }
204
- codes.push(`];\n`);
205
208
  }
206
209
  return data;
207
210
  }
@@ -295,14 +298,14 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
295
298
  function visitNode(node, parentEl, prevNode, componentCtxVar) {
296
299
  resolveComment();
297
300
  if (prevNode?.type === 3 /* CompilerDOM.NodeTypes.COMMENT */) {
298
- const commentText = prevNode.content.trim();
299
- if (commentText === '@vue-skip') {
301
+ const commentText = prevNode.content.trim().split(' ')[0];
302
+ if (commentText.match(/^@vue-skip\b[\s\S]*/)) {
300
303
  return;
301
304
  }
302
- else if (commentText === '@vue-ignore') {
305
+ else if (commentText.match(/^@vue-ignore\b[\s\S]*/)) {
303
306
  ignoreStart = codes.length;
304
307
  }
305
- else if (commentText === '@vue-expect-error') {
308
+ else if (commentText.match(/^@vue-expect-error\b[\s\S]*/)) {
306
309
  expectedErrorStart = codes.length;
307
310
  expectedErrorNode = prevNode;
308
311
  }
@@ -474,7 +477,16 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
474
477
  }
475
478
  }
476
479
  }
477
- if (isNamespacedTag) {
480
+ const isIntrinsicElement = nativeTags.has(tag) && tagOffsets.length;
481
+ if (isIntrinsicElement) {
482
+ codes.push('const ', var_originalComponent, ` = ({} as __VLS_IntrinsicElements)[`, ...createStringLiteralKeyCode([
483
+ tag,
484
+ 'template',
485
+ tagOffsets[0],
486
+ capabilitiesPresets.diagnosticOnly,
487
+ ]), '];\n');
488
+ }
489
+ else if (isNamespacedTag) {
478
490
  codes.push(`const ${var_originalComponent} = `, ...createInterpolationCode(tag, node.loc, startTagOffset, capabilitiesPresets.all, '', ''), ';\n');
479
491
  }
480
492
  else if (dynamicTagExp) {
@@ -486,7 +498,14 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
486
498
  else {
487
499
  codes.push(`const ${var_originalComponent} = {} as any;\n`);
488
500
  }
489
- codes.push(`const ${var_functionalComponent} = __VLS_asFunctionalComponent(`, `${var_originalComponent}, `, `new ${var_originalComponent}({`, ...createPropsCode(node, props, 'extraReferences'), '}));\n');
501
+ codes.push(`const ${var_functionalComponent} = __VLS_asFunctionalComponent(`, `${var_originalComponent}, `);
502
+ if (isIntrinsicElement) {
503
+ codes.push('{}');
504
+ }
505
+ else {
506
+ codes.push(`new ${var_originalComponent}({`, ...createPropsCode(node, props, 'extraReferences'), '})');
507
+ }
508
+ codes.push(');\n');
490
509
  for (const offset of tagOffsets) {
491
510
  if (isNamespacedTag) {
492
511
  continue;
@@ -495,7 +514,10 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
495
514
  continue;
496
515
  }
497
516
  else {
498
- if (componentVars[tag]) {
517
+ if (isIntrinsicElement) {
518
+ codes.push(`({} as __VLS_IntrinsicElements).`);
519
+ }
520
+ else {
499
521
  codes.push(`__VLS_templateComponents.`);
500
522
  }
501
523
  codes.push([
@@ -661,9 +683,11 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
661
683
  {
662
684
  ...capabilitiesPresets.attrReference,
663
685
  rename: {
686
+ // @click-outside -> onClickOutside
664
687
  normalize(newName) {
665
688
  return (0, shared_1.camelize)('on-' + newName);
666
689
  },
690
+ // onClickOutside -> @click-outside
667
691
  apply(newName) {
668
692
  const hName = (0, shared_1.hyphenate)(newName);
669
693
  if ((0, shared_1.hyphenate)(newName).startsWith('on-')) {
@@ -805,14 +829,12 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
805
829
  }
806
830
  continue;
807
831
  }
808
- const isStatic = !prop.arg || (prop.arg.type === 4 /* CompilerDOM.NodeTypes.SIMPLE_EXPRESSION */ && prop.arg.isStatic);
809
- const propName = isStatic
832
+ let camelized = false;
833
+ if ((!prop.arg || (prop.arg.type === 4 /* CompilerDOM.NodeTypes.SIMPLE_EXPRESSION */ && prop.arg.isStatic)) // isStatic
810
834
  && (0, shared_1.hyphenate)(attrNameText) === attrNameText
811
- && !vueCompilerOptions.htmlAttributes.some(pattern => (0, minimatch_1.minimatch)(attrNameText, pattern))
812
- ? (0, shared_1.camelize)(attrNameText)
813
- : attrNameText;
814
- if (vueCompilerOptions.strictTemplates) {
815
- attrNameText = propName;
835
+ && !vueCompilerOptions.htmlAttributes.some(pattern => (0, minimatch_1.minimatch)(attrNameText, pattern))) {
836
+ attrNameText = (0, shared_1.camelize)(attrNameText);
837
+ camelized = true;
816
838
  }
817
839
  // camelize name
818
840
  codes.push([
@@ -831,28 +853,28 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
831
853
  }
832
854
  else if (prop.exp?.constType === 3 /* CompilerDOM.ConstantTypes.CAN_STRINGIFY */) {
833
855
  codes.push(...createObjectPropertyCode([
834
- propName,
856
+ attrNameText,
835
857
  'template',
836
858
  [prop.arg.loc.start.offset, prop.arg.loc.start.offset + attrNameText.length],
837
859
  {
838
860
  ...caps_attr,
839
861
  rename: {
840
862
  normalize: shared_1.camelize,
841
- apply: getRenameApply(attrNameText),
863
+ apply: camelized ? shared_1.hyphenate : noEditApply,
842
864
  },
843
865
  },
844
866
  ], prop.loc.name_2 ?? (prop.loc.name_2 = {})));
845
867
  }
846
868
  else {
847
869
  codes.push(...createObjectPropertyCode([
848
- propName,
870
+ attrNameText,
849
871
  'template',
850
872
  [prop.arg.loc.start.offset, prop.arg.loc.end.offset],
851
873
  {
852
874
  ...caps_attr,
853
875
  rename: {
854
876
  normalize: shared_1.camelize,
855
- apply: getRenameApply(attrNameText),
877
+ apply: camelized ? shared_1.hyphenate : noEditApply,
856
878
  },
857
879
  },
858
880
  ], prop.loc.name_2 ?? (prop.loc.name_2 = {})));
@@ -875,30 +897,6 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
875
897
  caps_diagnosticOnly,
876
898
  ]);
877
899
  codes.push(', ');
878
- // original name
879
- if (prop.arg && attrNameText !== propName) {
880
- codes.push(...createObjectPropertyCode([
881
- attrNameText,
882
- 'template',
883
- [prop.arg.loc.start.offset, prop.arg.loc.end.offset],
884
- {
885
- ...caps_attr,
886
- rename: {
887
- normalize: shared_1.camelize,
888
- apply: getRenameApply(attrNameText),
889
- },
890
- },
891
- ], prop.loc.name_1 ?? (prop.loc.name_1 = {})));
892
- codes.push(': (');
893
- if (prop.exp) {
894
- codes.push(...createInterpolationCode(prop.exp.loc.source, prop.exp.loc, undefined, undefined, '(', ')'));
895
- }
896
- else {
897
- codes.push('undefined');
898
- }
899
- codes.push(')');
900
- codes.push(', ');
901
- }
902
900
  }
903
901
  else if (prop.type === 6 /* CompilerDOM.NodeTypes.ATTRIBUTE */) {
904
902
  let attrNameText = prop.name;
@@ -909,12 +907,11 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
909
907
  ) {
910
908
  continue;
911
909
  }
912
- const propName = (0, shared_1.hyphenate)(prop.name) === prop.name
913
- && !vueCompilerOptions.htmlAttributes.some(pattern => (0, minimatch_1.minimatch)(attrNameText, pattern))
914
- ? (0, shared_1.camelize)(prop.name)
915
- : prop.name;
916
- if (vueCompilerOptions.strictTemplates) {
917
- attrNameText = propName;
910
+ let camelized = false;
911
+ if ((0, shared_1.hyphenate)(prop.name) === prop.name
912
+ && !vueCompilerOptions.htmlAttributes.some(pattern => (0, minimatch_1.minimatch)(attrNameText, pattern))) {
913
+ attrNameText = (0, shared_1.camelize)(prop.name);
914
+ camelized = true;
918
915
  }
919
916
  // camelize name
920
917
  codes.push([
@@ -924,14 +921,14 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
924
921
  caps_diagnosticOnly,
925
922
  ]);
926
923
  codes.push(...createObjectPropertyCode([
927
- propName,
924
+ attrNameText,
928
925
  'template',
929
926
  [prop.loc.start.offset, prop.loc.start.offset + prop.name.length],
930
927
  {
931
928
  ...caps_attr,
932
929
  rename: {
933
930
  normalize: shared_1.camelize,
934
- apply: getRenameApply(prop.name),
931
+ apply: camelized ? shared_1.hyphenate : noEditApply,
935
932
  },
936
933
  },
937
934
  ], prop.loc.name_1 ?? (prop.loc.name_1 = {})));
@@ -950,30 +947,6 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
950
947
  caps_diagnosticOnly,
951
948
  ]);
952
949
  codes.push(', ');
953
- // original name
954
- if (attrNameText !== propName) {
955
- codes.push(...createObjectPropertyCode([
956
- attrNameText,
957
- 'template',
958
- prop.loc.start.offset,
959
- {
960
- ...caps_attr,
961
- rename: {
962
- normalize: shared_1.camelize,
963
- apply: getRenameApply(prop.name),
964
- },
965
- },
966
- ], prop.loc.name_2 ?? (prop.loc.name_2 = {})));
967
- codes.push(': (');
968
- if (prop.value) {
969
- generateAttrValue(prop.value);
970
- }
971
- else {
972
- codes.push('true');
973
- }
974
- codes.push(')');
975
- codes.push(', ');
976
- }
977
950
  }
978
951
  else if (prop.type === 7 /* CompilerDOM.NodeTypes.DIRECTIVE */
979
952
  && prop.name === 'bind'
package/out/types.d.ts CHANGED
@@ -14,6 +14,7 @@ export interface VueCompilerOptions {
14
14
  jsxSlots: boolean;
15
15
  strictTemplates: boolean;
16
16
  skipTemplateCodegen: boolean;
17
+ nativeTags: string[];
17
18
  dataAttributes: string[];
18
19
  htmlAttributes: string[];
19
20
  optionsWrapper: [string, string] | [];
@@ -11,21 +11,17 @@ type __VLS_IntrinsicElements = __VLS_PickNotAny<import('vue/jsx-runtime').JSX.In
11
11
  type __VLS_Element = __VLS_PickNotAny<import('vue/jsx-runtime').JSX.Element, JSX.Element>;
12
12
 
13
13
  type __VLS_IsAny<T> = boolean extends (T extends never ? true : false) ? true : false;
14
- type __VLS_PickNotAny<A, B> = __VLS_IsAny<A> extends true ? B : A;
14
+ type __VLS_PickNotAny<A, B> = __VLS_IsAny<A & {}> extends true ? B : A; // & {} for https://github.com/microsoft/TypeScript/issues/54630
15
15
 
16
16
  type __VLS_Prettify<T> = {
17
17
  [K in keyof T]: T[K];
18
18
  } & {};
19
19
 
20
20
  type __VLS_GlobalComponents =
21
- // @ts-ignore
22
21
  __VLS_PickNotAny<import('vue').GlobalComponents, {}>
23
- // @ts-ignore
24
22
  & __VLS_PickNotAny<import('@vue/runtime-core').GlobalComponents, {}>
25
- // @ts-ignore
26
23
  & __VLS_PickNotAny<import('@vue/runtime-dom').GlobalComponents, {}>
27
24
  & Pick<typeof import('${vueCompilerOptions.lib}'),
28
- // @ts-ignore
29
25
  'Transition'
30
26
  | 'TransitionGroup'
31
27
  | 'KeepAlive'
@@ -88,8 +88,7 @@ function walkInterpolationFragment(ts, code, ast, cb, localVars, identifiers, vu
88
88
  return ctxVars;
89
89
  }
90
90
  exports.walkInterpolationFragment = walkInterpolationFragment;
91
- function walkIdentifiers(ts, node, cb, localVars) {
92
- const blockVars = [];
91
+ function walkIdentifiers(ts, node, cb, localVars, blockVars = [], isRoot = true) {
93
92
  if (ts.isIdentifier(node)) {
94
93
  cb(node, false);
95
94
  }
@@ -97,26 +96,27 @@ function walkIdentifiers(ts, node, cb, localVars) {
97
96
  cb(node.name, true);
98
97
  }
99
98
  else if (ts.isPropertyAccessExpression(node)) {
100
- walkIdentifiers(ts, node.expression, cb, localVars);
99
+ walkIdentifiers(ts, node.expression, cb, localVars, blockVars, false);
101
100
  }
102
101
  else if (ts.isVariableDeclaration(node)) {
103
102
  colletVars(ts, node.name, blockVars);
104
- for (const varName of blockVars)
103
+ for (const varName of blockVars) {
105
104
  localVars[varName] = (localVars[varName] ?? 0) + 1;
105
+ }
106
106
  if (node.initializer)
107
- walkIdentifiers(ts, node.initializer, cb, localVars);
107
+ walkIdentifiers(ts, node.initializer, cb, localVars, blockVars, false);
108
108
  }
109
109
  else if (ts.isArrowFunction(node)) {
110
110
  const functionArgs = [];
111
111
  for (const param of node.parameters) {
112
112
  colletVars(ts, param.name, functionArgs);
113
113
  if (param.type) {
114
- walkIdentifiers(ts, param.type, cb, localVars);
114
+ walkIdentifiers(ts, param.type, cb, localVars, blockVars, false);
115
115
  }
116
116
  }
117
117
  for (const varName of functionArgs)
118
118
  localVars[varName] = (localVars[varName] ?? 0) + 1;
119
- walkIdentifiers(ts, node.body, cb, localVars);
119
+ walkIdentifiers(ts, node.body, cb, localVars, blockVars, false);
120
120
  for (const varName of functionArgs)
121
121
  localVars[varName]--;
122
122
  }
@@ -125,18 +125,18 @@ function walkIdentifiers(ts, node, cb, localVars) {
125
125
  if (ts.isPropertyAssignment(prop)) {
126
126
  // fix https://github.com/vuejs/language-tools/issues/1176
127
127
  if (ts.isComputedPropertyName(prop.name)) {
128
- walkIdentifiers(ts, prop.name.expression, cb, localVars);
128
+ walkIdentifiers(ts, prop.name.expression, cb, localVars, blockVars, false);
129
129
  }
130
- walkIdentifiers(ts, prop.initializer, cb, localVars);
130
+ walkIdentifiers(ts, prop.initializer, cb, localVars, blockVars, false);
131
131
  }
132
132
  // fix https://github.com/vuejs/language-tools/issues/1156
133
133
  else if (ts.isShorthandPropertyAssignment(prop)) {
134
- walkIdentifiers(ts, prop, cb, localVars);
134
+ walkIdentifiers(ts, prop, cb, localVars, blockVars, false);
135
135
  }
136
136
  // fix https://github.com/vuejs/language-tools/issues/1148#issuecomment-1094378126
137
137
  else if (ts.isSpreadAssignment(prop)) {
138
138
  // TODO: cannot report "Spread types may only be created from object types.ts(2698)"
139
- walkIdentifiers(ts, prop.expression, cb, localVars);
139
+ walkIdentifiers(ts, prop.expression, cb, localVars, blockVars, false);
140
140
  }
141
141
  }
142
142
  }
@@ -145,10 +145,23 @@ function walkIdentifiers(ts, node, cb, localVars) {
145
145
  node.forEachChild(node => walkIdentifiersInTypeReference(ts, node, cb));
146
146
  }
147
147
  else {
148
- node.forEachChild(node => walkIdentifiers(ts, node, cb, localVars));
148
+ const _blockVars = blockVars;
149
+ if (ts.isBlock(node)) {
150
+ blockVars = [];
151
+ }
152
+ node.forEachChild(node => walkIdentifiers(ts, node, cb, localVars, blockVars, false));
153
+ if (ts.isBlock(node)) {
154
+ for (const varName of blockVars) {
155
+ localVars[varName]--;
156
+ }
157
+ }
158
+ blockVars = _blockVars;
159
+ }
160
+ if (isRoot) {
161
+ for (const varName of blockVars) {
162
+ localVars[varName]--;
163
+ }
149
164
  }
150
- for (const varName of blockVars)
151
- localVars[varName]--;
152
165
  }
153
166
  function walkIdentifiersInTypeReference(ts, node, cb) {
154
167
  if (ts.isTypeQueryNode(node) && ts.isIdentifier(node.exprName)) {
package/out/utils/ts.js CHANGED
@@ -153,6 +153,27 @@ function getPartialVueCompilerOptions(ts, tsConfigSourceFile) {
153
153
  }
154
154
  }
155
155
  }
156
+ // https://developer.mozilla.org/en-US/docs/Web/HTML/Element
157
+ const HTML_TAGS = 'html,body,base,head,link,meta,style,title,address,article,aside,footer,' +
158
+ 'header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,' +
159
+ 'figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,' +
160
+ 'data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,' +
161
+ 'time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,' +
162
+ 'canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,' +
163
+ 'th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,' +
164
+ 'option,output,progress,select,textarea,details,dialog,menu,' +
165
+ 'summary,template,blockquote,iframe,tfoot';
166
+ // https://developer.mozilla.org/en-US/docs/Web/SVG/Element
167
+ const SVG_TAGS = 'svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,' +
168
+ 'defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,' +
169
+ 'feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,' +
170
+ 'feDistanceLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,' +
171
+ 'feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,' +
172
+ 'fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,' +
173
+ 'foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,' +
174
+ 'mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,' +
175
+ 'polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,' +
176
+ 'text,textPath,title,tspan,unknown,use,view';
156
177
  function resolveVueCompilerOptions(vueOptions) {
157
178
  const target = vueOptions.target ?? 3.3;
158
179
  const lib = vueOptions.lib || (target < 2.7 ? '@vue/runtime-dom' : 'vue');
@@ -164,6 +185,14 @@ function resolveVueCompilerOptions(vueOptions) {
164
185
  jsxSlots: vueOptions.jsxSlots ?? false,
165
186
  strictTemplates: vueOptions.strictTemplates ?? false,
166
187
  skipTemplateCodegen: vueOptions.skipTemplateCodegen ?? false,
188
+ nativeTags: vueOptions.nativeTags ?? [...new Set([
189
+ ...HTML_TAGS.split(','),
190
+ ...SVG_TAGS.split(','),
191
+ // fix https://github.com/johnsoncodehk/volar/issues/1340
192
+ 'hgroup',
193
+ 'slot',
194
+ 'component',
195
+ ])],
167
196
  dataAttributes: vueOptions.dataAttributes ?? [],
168
197
  htmlAttributes: vueOptions.htmlAttributes ?? ['aria-*'],
169
198
  optionsWrapper: vueOptions.optionsWrapper ?? (target >= 2.7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/language-core",
3
- "version": "1.7.11",
3
+ "version": "1.7.13",
4
4
  "main": "out/index.js",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -13,8 +13,8 @@
13
13
  "directory": "packages/vue-language-core"
14
14
  },
15
15
  "dependencies": {
16
- "@volar/language-core": "1.7.4",
17
- "@volar/source-map": "1.7.4",
16
+ "@volar/language-core": "1.7.5",
17
+ "@volar/source-map": "1.7.5",
18
18
  "@vue/compiler-dom": "^3.3.0",
19
19
  "@vue/reactivity": "^3.3.0",
20
20
  "@vue/shared": "^3.3.0",
@@ -34,5 +34,5 @@
34
34
  "optional": true
35
35
  }
36
36
  },
37
- "gitHead": "8ed51477115bf67f73eb74653b2770e5d9d586f0"
37
+ "gitHead": "32d5d5e4414f97b0dc28cd727a9cecf60acd4e97"
38
38
  }