@vue/language-core 1.8.8 → 1.8.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/out/generators/script.d.ts +3 -3
  2. package/out/generators/script.js +45 -9
  3. package/out/generators/template.d.ts +3 -2
  4. package/out/generators/template.js +72 -20
  5. package/out/index.d.ts +3 -0
  6. package/out/index.js +15 -2
  7. package/out/languageModule.d.ts +2 -1
  8. package/out/languageModule.js +25 -2
  9. package/out/parsers/scriptRanges.d.ts +1 -0
  10. package/out/parsers/scriptSetupRanges.d.ts +1 -0
  11. package/out/parsers/scriptSetupRanges.js +1 -1
  12. package/out/plugins/file-html.d.ts +2 -1
  13. package/out/plugins/file-html.js +2 -1
  14. package/out/plugins/file-md.d.ts +2 -1
  15. package/out/plugins/file-md.js +2 -1
  16. package/out/plugins/file-vue.d.ts +2 -1
  17. package/out/plugins/file-vue.js +2 -1
  18. package/out/plugins/vue-sfc-customblocks.d.ts +2 -1
  19. package/out/plugins/vue-sfc-customblocks.js +2 -1
  20. package/out/plugins/vue-sfc-scripts.d.ts +2 -1
  21. package/out/plugins/vue-sfc-scripts.js +2 -1
  22. package/out/plugins/vue-sfc-styles.d.ts +2 -1
  23. package/out/plugins/vue-sfc-styles.js +2 -1
  24. package/out/plugins/vue-sfc-template.d.ts +2 -1
  25. package/out/plugins/vue-sfc-template.js +2 -1
  26. package/out/plugins/vue-template-html.d.ts +2 -1
  27. package/out/plugins/vue-template-html.js +2 -1
  28. package/out/plugins/vue-tsx.d.ts +1 -0
  29. package/out/plugins/vue-tsx.js +25 -2
  30. package/out/plugins.d.ts +1 -0
  31. package/out/plugins.js +51 -20
  32. package/out/sourceFile.d.ts +9 -8
  33. package/out/sourceFile.js +24 -1
  34. package/out/types.d.ts +10 -7
  35. package/out/utils/globalTypes.d.ts +1 -0
  36. package/out/utils/parseCssClassNames.d.ts +1 -0
  37. package/out/utils/parseCssVars.d.ts +1 -0
  38. package/out/utils/parseSfc.d.ts +1 -0
  39. package/out/utils/parseSfc.js +24 -1
  40. package/out/utils/shared.d.ts +3 -0
  41. package/out/utils/shared.js +13 -1
  42. package/out/utils/transform.d.ts +1 -0
  43. package/out/utils/ts.d.ts +2 -1
  44. package/out/utils/ts.js +37 -7
  45. package/out/utils/vue2TemplateCompiler.d.ts +3 -3
  46. package/out/utils/vue2TemplateCompiler.js +23 -15
  47. package/package.json +2 -2
  48. package/out/utils/directorySharedTypes.d.ts +0 -4
  49. package/out/utils/directorySharedTypes.js +0 -150
@@ -1,14 +1,14 @@
1
- import { Segment } from '@volar/source-map';
2
1
  import { FileRangeCapabilities, MirrorBehaviorCapabilities } from '@volar/language-core';
3
2
  import * as SourceMaps from '@volar/source-map';
4
3
  import type * as ts from 'typescript/lib/tsserverlibrary';
5
4
  import type * as templateGen from '../generators/template';
6
5
  import type { ScriptRanges } from '../parsers/scriptRanges';
7
6
  import type { ScriptSetupRanges } from '../parsers/scriptSetupRanges';
8
- import { Sfc } from '../types';
9
7
  import type { VueCompilerOptions } from '../types';
8
+ import { Sfc } from '../types';
10
9
  export declare function generate(ts: typeof import('typescript/lib/tsserverlibrary'), fileName: string, _sfc: Sfc, lang: string, scriptRanges: ScriptRanges | undefined, scriptSetupRanges: ScriptSetupRanges | undefined, htmlGen: ReturnType<typeof templateGen['generate']> | undefined, compilerOptions: ts.CompilerOptions, vueCompilerOptions: VueCompilerOptions, codegenStack: boolean): {
11
- codes: Segment<FileRangeCapabilities>[];
10
+ codes: SourceMaps.Segment<FileRangeCapabilities>[];
12
11
  codeStacks: SourceMaps.StackNode[];
13
12
  mirrorBehaviorMappings: SourceMaps.Mapping<[MirrorBehaviorCapabilities, MirrorBehaviorCapabilities]>[];
14
13
  };
14
+ //# sourceMappingURL=script.d.ts.map
@@ -1,14 +1,36 @@
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 (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
26
  exports.generate = void 0;
4
- const source_map_1 = require("@volar/source-map");
5
27
  const language_core_1 = require("@volar/language-core");
6
- const shared_1 = require("@vue/shared");
28
+ const source_map_1 = require("@volar/source-map");
29
+ const muggle = __importStar(require("muggle-string"));
7
30
  const path_1 = require("path");
8
- const shared_2 = require("../utils/shared");
31
+ const sharedTypes = __importStar(require("../utils/globalTypes"));
32
+ const shared_1 = require("../utils/shared");
9
33
  const transform_1 = require("../utils/transform");
10
- const sharedTypes = require("../utils/globalTypes");
11
- const muggle = require("muggle-string");
12
34
  function generate(ts, fileName, _sfc, lang, scriptRanges, scriptSetupRanges, htmlGen, compilerOptions, vueCompilerOptions, codegenStack) {
13
35
  const [codes, codeStacks] = codegenStack ? muggle.track([]) : [[], []];
14
36
  const mirrorBehaviorMappings = [];
@@ -230,7 +252,7 @@ function generate(ts, fileName, _sfc, lang, scriptRanges, scriptSetupRanges, htm
230
252
  if (!scriptSetupRanges)
231
253
  return;
232
254
  codes.push([
233
- sfc.scriptSetup.content.substring(0, Math.max(scriptSetupRanges.importSectionEndOffset, scriptSetupRanges.leadingCommentEndOffset)),
255
+ sfc.scriptSetup.content.substring(0, Math.max(scriptSetupRanges.importSectionEndOffset, scriptSetupRanges.leadingCommentEndOffset)) + '\n',
234
256
  'scriptSetup',
235
257
  0,
236
258
  language_core_1.FileRangeCapabilities.full,
@@ -273,6 +295,7 @@ function generate(ts, fileName, _sfc, lang, scriptRanges, scriptSetupRanges, htm
273
295
  codes.push('(\n');
274
296
  codes.push(`__VLS_props: Awaited<typeof __VLS_setup>['props']`, `& import('${vueCompilerOptions.lib}').VNodeProps`, `& import('${vueCompilerOptions.lib}').AllowedComponentProps`, `& import('${vueCompilerOptions.lib}').ComponentCustomProps,\n`);
275
297
  codes.push(`__VLS_ctx?: Pick<Awaited<typeof __VLS_setup>, 'attrs' | 'emit' | 'slots'>,\n`);
298
+ codes.push(`__VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>['expose'],\n`);
276
299
  codes.push('__VLS_setup = (async () => {\n');
277
300
  scriptSetupGeneratedOffset = generateSetupFunction(true, 'none', definePropMirrors);
278
301
  //#region exposed
@@ -410,7 +433,20 @@ function generate(ts, fileName, _sfc, lang, scriptRanges, scriptSetupRanges, htm
410
433
  const definePropProposalA = sfc.scriptSetup.content.trimStart().startsWith('// @experimentalDefinePropProposal=kevinEdition') || vueCompilerOptions.experimentalDefinePropProposal === 'kevinEdition';
411
434
  const definePropProposalB = sfc.scriptSetup.content.trimStart().startsWith('// @experimentalDefinePropProposal=johnsonEdition') || vueCompilerOptions.experimentalDefinePropProposal === 'johnsonEdition';
412
435
  if (vueCompilerOptions.target >= 3.3) {
413
- codes.push(`const { defineProps, defineEmits, defineExpose, defineOptions, defineSlots, defineModel, withDefaults } = await import('${vueCompilerOptions.lib}');\n`);
436
+ const bindings = new Set(scriptSetupRanges.bindings.map(range => sfc.scriptSetup.content.substring(range.start, range.end)));
437
+ codes.push('const { ');
438
+ for (const [macro, aliases] of Object.entries(vueCompilerOptions.macros)) {
439
+ for (const alias of aliases) {
440
+ if (!bindings.has(alias)) {
441
+ codes.push(macro);
442
+ if (alias !== macro) {
443
+ codes.push(` : ${alias}`);
444
+ }
445
+ codes.push(`, `);
446
+ }
447
+ }
448
+ }
449
+ codes.push(`} = await import('${vueCompilerOptions.lib}');\n`);
414
450
  }
415
451
  if (definePropProposalA) {
416
452
  codes.push(`
@@ -733,7 +769,7 @@ declare function defineProp<T>(value?: T | (() => T), required?: boolean, rest?:
733
769
  /* Components */
734
770
  codes.push('/* Components */\n');
735
771
  codes.push(`let __VLS_otherComponents!: NonNullable<typeof __VLS_internalComponent extends { components: infer C } ? C : {}> & typeof __VLS_componentsOption;\n`);
736
- codes.push(`let __VLS_own!: __VLS_SelfComponent<typeof __VLS_name, typeof __VLS_internalComponent & typeof __VLS_publicComponent & (new () => { ${(0, shared_2.getSlotsPropertyName)(vueCompilerOptions.target)}: typeof __VLS_slots })>;\n`);
772
+ codes.push(`let __VLS_own!: __VLS_SelfComponent<typeof __VLS_name, typeof __VLS_internalComponent & typeof __VLS_publicComponent & (new () => { ${(0, shared_1.getSlotsPropertyName)(vueCompilerOptions.target)}: typeof __VLS_slots })>;\n`);
737
773
  codes.push(`let __VLS_localComponents!: typeof __VLS_otherComponents & Omit<typeof __VLS_own, keyof typeof __VLS_otherComponents>;\n`);
738
774
  codes.push(`let __VLS_components!: typeof __VLS_localComponents & __VLS_GlobalComponents & typeof __VLS_ctx;\n`); // for html completion, TS references...
739
775
  /* Style Scoped */
@@ -847,7 +883,7 @@ declare function defineProp<T>(value?: T | (() => T), required?: boolean, rest?:
847
883
  }
848
884
  // fix import components unused report
849
885
  for (const varName of bindingNames) {
850
- if (!!htmlGen.tagNames[varName] || !!htmlGen.tagNames[(0, shared_1.hyphenate)(varName)]) {
886
+ if (!!htmlGen.tagNames[varName] || !!htmlGen.tagNames[(0, shared_1.hyphenateTag)(varName)]) {
851
887
  usageVars.add(varName);
852
888
  }
853
889
  }
@@ -1,9 +1,9 @@
1
- import { Segment } from '@volar/source-map';
2
1
  import { FileRangeCapabilities } from '@volar/language-core';
2
+ import { Segment } from '@volar/source-map';
3
3
  import * as CompilerDOM from '@vue/compiler-dom';
4
+ import * as muggle from 'muggle-string';
4
5
  import type * as ts from 'typescript/lib/tsserverlibrary';
5
6
  import { Sfc, VueCompilerOptions } from '../types';
6
- import * as muggle from 'muggle-string';
7
7
  type Code = Segment<FileRangeCapabilities>;
8
8
  export declare function generate(ts: typeof import('typescript/lib/tsserverlibrary'), compilerOptions: ts.CompilerOptions, vueCompilerOptions: VueCompilerOptions, sourceTemplate: string, sourceLang: string, sfc: Sfc, hasScriptSetupSlots: boolean, codegenStack: boolean): {
9
9
  codes: Code[];
@@ -18,3 +18,4 @@ export declare function generate(ts: typeof import('typescript/lib/tsserverlibra
18
18
  };
19
19
  export declare function walkElementNodes(node: CompilerDOM.RootNode | CompilerDOM.TemplateChildNode, cb: (node: CompilerDOM.ElementNode) => void): void;
20
20
  export {};
21
+ //# sourceMappingURL=template.d.ts.map
@@ -1,12 +1,36 @@
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 (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
26
  exports.walkElementNodes = exports.generate = void 0;
4
27
  const language_core_1 = require("@volar/language-core");
5
- const CompilerDOM = require("@vue/compiler-dom");
28
+ const CompilerDOM = __importStar(require("@vue/compiler-dom"));
6
29
  const shared_1 = require("@vue/shared");
7
- const transform_1 = require("../utils/transform");
8
30
  const minimatch_1 = require("minimatch");
9
- const muggle = require("muggle-string");
31
+ const muggle = __importStar(require("muggle-string"));
32
+ const shared_2 = require("../utils/shared");
33
+ const transform_1 = require("../utils/transform");
10
34
  const capabilitiesPresets = {
11
35
  all: language_core_1.FileRangeCapabilities.full,
12
36
  allWithHiddenParam: {
@@ -71,6 +95,7 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
71
95
  const identifiers = new Set();
72
96
  const scopedClasses = [];
73
97
  const blockConditions = [];
98
+ const hasSlotElements = new Set();
74
99
  let hasSlot = false;
75
100
  let elementIndex = 0;
76
101
  let ignoreStart;
@@ -182,7 +207,7 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
182
207
  ...capabilitiesPresets.tagReference,
183
208
  rename: {
184
209
  normalize: tagName === name ? capabilitiesPresets.tagReference.rename.normalize : camelizeComponentName,
185
- apply: getRenameApply(tagName),
210
+ apply: getTagRenameApply(tagName),
186
211
  },
187
212
  },
188
213
  ]), ';');
@@ -288,7 +313,7 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
288
313
  }
289
314
  }
290
315
  codes.push([
291
- '// @ts-expect-error',
316
+ '// @ts-expect-error __VLS_TS_EXPECT_ERROR',
292
317
  'template',
293
318
  [expectedErrorNode.loc.start.offset, expectedErrorNode.loc.end.offset],
294
319
  {
@@ -547,7 +572,16 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
547
572
  // diagnostic start
548
573
  tagOffsets.length ? ['', 'template', tagOffsets[0], capabilitiesPresets.diagnosticOnly]
549
574
  : dynamicTagExp ? ['', 'template', startTagOffset, capabilitiesPresets.diagnosticOnly]
550
- : '', '{ ', ...createPropsCode(node, props, 'normal', propsFailedExps), '}',
575
+ : '', '{ ');
576
+ if (!vueCompilerOptions.strictTemplates) {
577
+ // fix https://github.com/vuejs/language-tools/issues/3318
578
+ codes.push('...{ ');
579
+ }
580
+ codes.push(...createPropsCode(node, props, 'normal', propsFailedExps));
581
+ if (!vueCompilerOptions.strictTemplates) {
582
+ codes.push('}, ');
583
+ }
584
+ codes.push('}',
551
585
  // diagnostic end
552
586
  tagOffsets.length ? ['', 'template', tagOffsets[0] + tag.length, capabilitiesPresets.diagnosticOnly]
553
587
  : dynamicTagExp ? ['', 'template', startTagOffset + tag.length, capabilitiesPresets.diagnosticOnly]
@@ -603,6 +637,9 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
603
637
  //#endregion
604
638
  const slotDir = node.props.find(p => p.type === 7 /* CompilerDOM.NodeTypes.DIRECTIVE */ && p.name === 'slot');
605
639
  if (slotDir && componentCtxVar) {
640
+ if (parentEl) {
641
+ hasSlotElements.add(parentEl);
642
+ }
606
643
  const slotBlockVars = [];
607
644
  codes.push(`{\n`);
608
645
  let hasProps = false;
@@ -679,6 +716,18 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
679
716
  prev = childNode;
680
717
  }
681
718
  resolveComment();
719
+ // fix https://github.com/vuejs/language-tools/issues/932
720
+ if (!hasSlotElements.has(node) && node.children.length) {
721
+ codes.push(`(${componentCtxVar}.slots!)`, ...createPropertyAccessCode([
722
+ 'default',
723
+ 'template',
724
+ [
725
+ node.children[0].loc.start.offset,
726
+ node.children[node.children.length - 1].loc.end.offset,
727
+ ],
728
+ { references: true },
729
+ ]), ';\n');
730
+ }
682
731
  }
683
732
  codes.push(`}\n`);
684
733
  }
@@ -701,8 +750,8 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
701
750
  },
702
751
  // onClickOutside -> @click-outside
703
752
  apply(newName) {
704
- const hName = (0, shared_1.hyphenate)(newName);
705
- if ((0, shared_1.hyphenate)(newName).startsWith('on-')) {
753
+ const hName = (0, shared_2.hyphenateAttr)(newName);
754
+ if ((0, shared_2.hyphenateAttr)(newName).startsWith('on-')) {
706
755
  return (0, shared_1.camelize)(hName.slice('on-'.length));
707
756
  }
708
757
  return newName;
@@ -843,7 +892,7 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
843
892
  }
844
893
  let camelized = false;
845
894
  if ((!prop.arg || (prop.arg.type === 4 /* CompilerDOM.NodeTypes.SIMPLE_EXPRESSION */ && prop.arg.isStatic)) // isStatic
846
- && (0, shared_1.hyphenate)(attrNameText) === attrNameText
895
+ && (0, shared_2.hyphenateAttr)(attrNameText) === attrNameText
847
896
  && !vueCompilerOptions.htmlAttributes.some(pattern => (0, minimatch_1.minimatch)(attrNameText, pattern))) {
848
897
  attrNameText = (0, shared_1.camelize)(attrNameText);
849
898
  camelized = true;
@@ -872,7 +921,7 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
872
921
  ...caps_attr,
873
922
  rename: {
874
923
  normalize: shared_1.camelize,
875
- apply: camelized ? shared_1.hyphenate : noEditApply,
924
+ apply: camelized ? shared_2.hyphenateAttr : noEditApply,
876
925
  },
877
926
  },
878
927
  ], prop.loc.name_2 ?? (prop.loc.name_2 = {})));
@@ -886,7 +935,7 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
886
935
  ...caps_attr,
887
936
  rename: {
888
937
  normalize: shared_1.camelize,
889
- apply: camelized ? shared_1.hyphenate : noEditApply,
938
+ apply: camelized ? shared_2.hyphenateAttr : noEditApply,
890
939
  },
891
940
  },
892
941
  ], prop.loc.name_2 ?? (prop.loc.name_2 = {})));
@@ -920,7 +969,7 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
920
969
  continue;
921
970
  }
922
971
  let camelized = false;
923
- if ((0, shared_1.hyphenate)(prop.name) === prop.name
972
+ if ((0, shared_2.hyphenateAttr)(prop.name) === prop.name
924
973
  && !vueCompilerOptions.htmlAttributes.some(pattern => (0, minimatch_1.minimatch)(attrNameText, pattern))) {
925
974
  attrNameText = (0, shared_1.camelize)(prop.name);
926
975
  camelized = true;
@@ -940,7 +989,7 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
940
989
  ...caps_attr,
941
990
  rename: {
942
991
  normalize: shared_1.camelize,
943
- apply: camelized ? shared_1.hyphenate : noEditApply,
992
+ apply: camelized ? shared_2.hyphenateAttr : noEditApply,
944
993
  },
945
994
  },
946
995
  ], prop.loc.name_1 ?? (prop.loc.name_1 = {})));
@@ -1049,7 +1098,7 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
1049
1098
  },
1050
1099
  rename: {
1051
1100
  normalize: shared_1.camelize,
1052
- apply: getRenameApply(prop.name),
1101
+ apply: getPropRenameApply(prop.name),
1053
1102
  },
1054
1103
  },
1055
1104
  ], ')', '(');
@@ -1136,7 +1185,7 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
1136
1185
  ...capabilitiesPresets.slotProp,
1137
1186
  rename: {
1138
1187
  normalize: shared_1.camelize,
1139
- apply: getRenameApply(prop.arg.content),
1188
+ apply: getPropRenameApply(prop.arg.content),
1140
1189
  },
1141
1190
  },
1142
1191
  ], prop.arg.loc), ': ', ...createInterpolationCode(prop.exp.content, prop.exp.loc, prop.exp.loc.start.offset, capabilitiesPresets.attrReference, '(', ')'), ',\n');
@@ -1152,7 +1201,7 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
1152
1201
  ...capabilitiesPresets.attr,
1153
1202
  rename: {
1154
1203
  normalize: shared_1.camelize,
1155
- apply: getRenameApply(prop.name),
1204
+ apply: getPropRenameApply(prop.name),
1156
1205
  },
1157
1206
  },
1158
1207
  ], prop.loc), ': (', prop.value !== undefined ? `"${toUnicodeIfNeed(prop.value.content)}"` : 'true', '),\n');
@@ -1381,8 +1430,11 @@ function toUnicode(str) {
1381
1430
  function camelizeComponentName(newName) {
1382
1431
  return (0, shared_1.camelize)('-' + newName);
1383
1432
  }
1384
- function getRenameApply(oldName) {
1385
- return oldName === (0, shared_1.hyphenate)(oldName) ? shared_1.hyphenate : noEditApply;
1433
+ function getTagRenameApply(oldName) {
1434
+ return oldName === (0, shared_2.hyphenateTag)(oldName) ? shared_2.hyphenateTag : noEditApply;
1435
+ }
1436
+ function getPropRenameApply(oldName) {
1437
+ return oldName === (0, shared_2.hyphenateAttr)(oldName) ? shared_2.hyphenateAttr : noEditApply;
1386
1438
  }
1387
1439
  function noEditApply(n) {
1388
1440
  return n;
@@ -1391,7 +1443,7 @@ function getModelValuePropName(node, vueVersion, vueCompilerOptions) {
1391
1443
  for (const modelName in vueCompilerOptions.experimentalModelPropName) {
1392
1444
  const tags = vueCompilerOptions.experimentalModelPropName[modelName];
1393
1445
  for (const tag in tags) {
1394
- if (node.tag === tag || node.tag === (0, shared_1.hyphenate)(tag)) {
1446
+ if (node.tag === tag || node.tag === (0, shared_2.hyphenateTag)(tag)) {
1395
1447
  const v = tags[tag];
1396
1448
  if (typeof v === 'object') {
1397
1449
  const arr = Array.isArray(v) ? v : [v];
@@ -1416,7 +1468,7 @@ function getModelValuePropName(node, vueVersion, vueCompilerOptions) {
1416
1468
  for (const modelName in vueCompilerOptions.experimentalModelPropName) {
1417
1469
  const tags = vueCompilerOptions.experimentalModelPropName[modelName];
1418
1470
  for (const tag in tags) {
1419
- if (node.tag === tag || node.tag === (0, shared_1.hyphenate)(tag)) {
1471
+ if (node.tag === tag || node.tag === (0, shared_2.hyphenateTag)(tag)) {
1420
1472
  const attrs = tags[tag];
1421
1473
  if (attrs === true) {
1422
1474
  return modelName || undefined;
package/out/index.d.ts CHANGED
@@ -8,6 +8,9 @@ export * from './utils/ts';
8
8
  export * from './utils/parseSfc';
9
9
  export * as scriptRanges from './parsers/scriptRanges';
10
10
  export * as sharedTypes from './utils/globalTypes';
11
+ export * from './utils/shared';
11
12
  export { tsCodegen } from './plugins/vue-tsx';
12
13
  export * from '@volar/language-core';
13
14
  export * from '@volar/source-map';
15
+ export type * as CompilerDOM from '@vue/compiler-dom';
16
+ //# sourceMappingURL=index.d.ts.map
package/out/index.js CHANGED
@@ -10,9 +10,21 @@ 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
+ });
13
18
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
19
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
20
  };
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
16
28
  Object.defineProperty(exports, "__esModule", { value: true });
17
29
  exports.tsCodegen = exports.sharedTypes = exports.scriptRanges = void 0;
18
30
  __exportStar(require("./generators/template"), exports);
@@ -23,8 +35,9 @@ __exportStar(require("./sourceFile"), exports);
23
35
  __exportStar(require("./types"), exports);
24
36
  __exportStar(require("./utils/ts"), exports);
25
37
  __exportStar(require("./utils/parseSfc"), exports);
26
- exports.scriptRanges = require("./parsers/scriptRanges");
27
- exports.sharedTypes = require("./utils/globalTypes");
38
+ exports.scriptRanges = __importStar(require("./parsers/scriptRanges"));
39
+ exports.sharedTypes = __importStar(require("./utils/globalTypes"));
40
+ __exportStar(require("./utils/shared"), exports);
28
41
  var vue_tsx_1 = require("./plugins/vue-tsx");
29
42
  Object.defineProperty(exports, "tsCodegen", { enumerable: true, get: function () { return vue_tsx_1.tsCodegen; } });
30
43
  __exportStar(require("@volar/language-core"), exports);
@@ -4,6 +4,7 @@ import { VueCompilerOptions } from './types';
4
4
  import type * as ts from 'typescript/lib/tsserverlibrary';
5
5
  export declare function createVueLanguage(ts: typeof import('typescript/lib/tsserverlibrary'), compilerOptions?: ts.CompilerOptions, _vueCompilerOptions?: Partial<VueCompilerOptions>, codegenStack?: boolean): Language<VueFile>;
6
6
  /**
7
- * @deprecated planed to remove in 2.0, please use getOrCreateVueLanguage instead of
7
+ * @deprecated planed to remove in 2.0, please use createVueLanguage instead of
8
8
  */
9
9
  export declare function createLanguages(compilerOptions?: ts.CompilerOptions, vueCompilerOptions?: Partial<VueCompilerOptions>, ts?: typeof import('typescript/lib/tsserverlibrary'), codegenStack?: boolean): Language[];
10
+ //# sourceMappingURL=languageModule.d.ts.map
@@ -1,10 +1,33 @@
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 (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
26
  exports.createLanguages = exports.createVueLanguage = void 0;
4
27
  const path_1 = require("path");
5
28
  const plugins_1 = require("./plugins");
6
29
  const sourceFile_1 = require("./sourceFile");
7
- const sharedTypes = require("./utils/globalTypes");
30
+ const sharedTypes = __importStar(require("./utils/globalTypes"));
8
31
  const ts_1 = require("./utils/ts");
9
32
  const fileRegistries = [];
10
33
  function getVueFileRegistry(key, plugins) {
@@ -87,7 +110,7 @@ function createVueLanguage(ts, compilerOptions = {}, _vueCompilerOptions = {}, c
87
110
  }
88
111
  exports.createVueLanguage = createVueLanguage;
89
112
  /**
90
- * @deprecated planed to remove in 2.0, please use getOrCreateVueLanguage instead of
113
+ * @deprecated planed to remove in 2.0, please use createVueLanguage instead of
91
114
  */
92
115
  function createLanguages(compilerOptions = {}, vueCompilerOptions = {}, ts = require('typescript'), codegenStack = false) {
93
116
  return [
@@ -13,3 +13,4 @@ export declare function parseScriptRanges(ts: typeof import('typescript/lib/tsse
13
13
  }) | undefined;
14
14
  bindings: TextRange[];
15
15
  };
16
+ //# sourceMappingURL=scriptRanges.d.ts.map
@@ -31,3 +31,4 @@ export declare function getStartEnd(node: ts.Node, sourceFile: ts.SourceFile): {
31
31
  start: number;
32
32
  end: number;
33
33
  };
34
+ //# sourceMappingURL=scriptSetupRanges.d.ts.map
@@ -65,7 +65,7 @@ function parseScriptSetupRanges(ts, ast, vueCompilerOptions) {
65
65
  if (ts.isCallExpression(node)
66
66
  && ts.isIdentifier(node.expression)) {
67
67
  const callText = node.expression.getText(ast);
68
- if (callText === 'defineModel') {
68
+ if (vueCompilerOptions.macros.defineModel.includes(callText)) {
69
69
  let name;
70
70
  let options;
71
71
  if (node.arguments.length >= 2) {
@@ -1,3 +1,4 @@
1
1
  import { VueLanguagePlugin } from '../types';
2
2
  declare const plugin: VueLanguagePlugin;
3
- export = plugin;
3
+ export default plugin;
4
+ //# sourceMappingURL=file-html.d.ts.map
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
2
3
  const sfcBlockReg = /\<(script|style)\b([\s\S]*?)\>([\s\S]*?)\<\/\1\>/g;
3
4
  const langReg = /\blang\s*=\s*(['\"]?)(\S*)\b\1/;
4
5
  const plugin = () => {
@@ -76,5 +77,5 @@ const plugin = () => {
76
77
  }
77
78
  };
78
79
  };
79
- module.exports = plugin;
80
+ exports.default = plugin;
80
81
  //# sourceMappingURL=file-html.js.map
@@ -1,3 +1,4 @@
1
1
  import { VueLanguagePlugin } from '../types';
2
2
  declare const plugin: VueLanguagePlugin;
3
- export = plugin;
3
+ export default plugin;
4
+ //# sourceMappingURL=file-md.d.ts.map
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
2
3
  const source_map_1 = require("@volar/source-map");
3
4
  const parseSfc_1 = require("../utils/parseSfc");
4
5
  const codeblockReg = /```[\s\S]+?```/g;
@@ -63,5 +64,5 @@ const plugin = () => {
63
64
  }
64
65
  };
65
66
  };
66
- module.exports = plugin;
67
+ exports.default = plugin;
67
68
  //# sourceMappingURL=file-md.js.map
@@ -1,3 +1,4 @@
1
1
  import { VueLanguagePlugin } from '../types';
2
2
  declare const plugin: VueLanguagePlugin;
3
- export = plugin;
3
+ export default plugin;
4
+ //# sourceMappingURL=file-vue.d.ts.map
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
2
3
  const parseSfc_1 = require("../utils/parseSfc");
3
4
  const plugin = (_ctx) => {
4
5
  return {
@@ -35,5 +36,5 @@ const plugin = (_ctx) => {
35
36
  },
36
37
  };
37
38
  };
38
- module.exports = plugin;
39
+ exports.default = plugin;
39
40
  //# sourceMappingURL=file-vue.js.map
@@ -1,3 +1,4 @@
1
1
  import { VueLanguagePlugin } from '../types';
2
2
  declare const plugin: VueLanguagePlugin;
3
- export = plugin;
3
+ export default plugin;
4
+ //# sourceMappingURL=vue-sfc-customblocks.d.ts.map
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
2
3
  const language_core_1 = require("@volar/language-core");
3
4
  const customBlockReg = /^(.*)\.customBlock_([^_]+)_(\d+)\.([^.]+)$/;
4
5
  const plugin = () => {
@@ -28,5 +29,5 @@ const plugin = () => {
28
29
  },
29
30
  };
30
31
  };
31
- module.exports = plugin;
32
+ exports.default = plugin;
32
33
  //# sourceMappingURL=vue-sfc-customblocks.js.map
@@ -1,3 +1,4 @@
1
1
  import { VueLanguagePlugin } from '../types';
2
2
  declare const plugin: VueLanguagePlugin;
3
- export = plugin;
3
+ export default plugin;
4
+ //# sourceMappingURL=vue-sfc-scripts.d.ts.map
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
2
3
  const language_core_1 = require("@volar/language-core");
3
4
  const scriptFormatReg = /^(.*)\.script_format\.([^.]+)$/;
4
5
  const scriptSetupFormatReg = /^(.*)\.scriptSetup_format\.([^.]+)$/;
@@ -37,5 +38,5 @@ const plugin = () => {
37
38
  },
38
39
  };
39
40
  };
40
- module.exports = plugin;
41
+ exports.default = plugin;
41
42
  //# sourceMappingURL=vue-sfc-scripts.js.map
@@ -1,3 +1,4 @@
1
1
  import { VueLanguagePlugin } from '../types';
2
2
  declare const plugin: VueLanguagePlugin;
3
- export = plugin;
3
+ export default plugin;
4
+ //# sourceMappingURL=vue-sfc-styles.d.ts.map
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
2
3
  const language_core_1 = require("@volar/language-core");
3
4
  const styleReg = /^(.*)\.style_(\d+)\.([^.]+)$/;
4
5
  const plugin = () => {
@@ -28,5 +29,5 @@ const plugin = () => {
28
29
  },
29
30
  };
30
31
  };
31
- module.exports = plugin;
32
+ exports.default = plugin;
32
33
  //# sourceMappingURL=vue-sfc-styles.js.map
@@ -1,3 +1,4 @@
1
1
  import { VueLanguagePlugin } from '../types';
2
2
  declare const plugin: VueLanguagePlugin;
3
- export = plugin;
3
+ export default plugin;
4
+ //# sourceMappingURL=vue-sfc-template.d.ts.map
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
2
3
  const language_core_1 = require("@volar/language-core");
3
4
  const templateReg = /^(.*)\.template\.([^.]+)$/;
4
5
  const plugin = () => {
@@ -24,5 +25,5 @@ const plugin = () => {
24
25
  },
25
26
  };
26
27
  };
27
- module.exports = plugin;
28
+ exports.default = plugin;
28
29
  //# sourceMappingURL=vue-sfc-template.js.map
@@ -1,3 +1,4 @@
1
1
  import { VueLanguagePlugin } from '../types';
2
2
  declare const plugin: VueLanguagePlugin;
3
- export = plugin;
3
+ export default plugin;
4
+ //# sourceMappingURL=vue-template-html.d.ts.map