@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,91 +1,77 @@
1
1
  import type * as ts from 'typescript';
2
- import type { VueCompilerOptions, TextRange } from '../types';
2
+ import type { TextRange, VueCompilerOptions } from '../types';
3
+ type CallExpressionRange = {
4
+ callExp: TextRange;
5
+ exp: TextRange;
6
+ arg?: TextRange;
7
+ typeArg?: TextRange;
8
+ };
9
+ type DefineProp = {
10
+ localName?: TextRange;
11
+ name?: TextRange;
12
+ type?: TextRange;
13
+ modifierType?: TextRange;
14
+ runtimeType?: TextRange;
15
+ defaultValue?: TextRange;
16
+ required?: boolean;
17
+ isModel?: boolean;
18
+ };
19
+ type DefineProps = CallExpressionRange & {
20
+ name?: string;
21
+ destructured?: Map<string, ts.Expression | undefined>;
22
+ destructuredRest?: string;
23
+ statement: TextRange;
24
+ argNode?: ts.Expression;
25
+ };
26
+ type WithDefaults = Omit<CallExpressionRange, 'typeArg'> & {
27
+ argNode?: ts.Expression;
28
+ };
29
+ type DefineEmits = CallExpressionRange & {
30
+ name?: string;
31
+ hasUnionTypeArg?: boolean;
32
+ statement: TextRange;
33
+ };
34
+ type DefineSlots = CallExpressionRange & {
35
+ name?: string;
36
+ statement: TextRange;
37
+ };
38
+ type DefineOptions = {
39
+ name?: string;
40
+ inheritAttrs?: string;
41
+ };
42
+ type UseTemplateRef = CallExpressionRange & {
43
+ name?: string;
44
+ };
3
45
  export interface ScriptSetupRanges extends ReturnType<typeof parseScriptSetupRanges> {
4
46
  }
5
47
  export declare function parseScriptSetupRanges(ts: typeof import('typescript'), ast: ts.SourceFile, vueCompilerOptions: VueCompilerOptions): {
6
48
  leadingCommentEndOffset: number;
7
49
  importSectionEndOffset: number;
8
- bindings: TextRange[];
9
- importComponentNames: Set<string>;
10
- props: {
11
- name?: string;
12
- destructured?: Set<string>;
13
- destructuredRest?: string;
14
- define?: ReturnType<(node: ts.CallExpression) => TextRange & {
15
- exp: TextRange;
16
- arg?: TextRange;
17
- typeArg?: TextRange;
18
- }> & {
19
- statement: TextRange;
20
- };
21
- withDefaults?: TextRange & {
22
- arg?: TextRange;
23
- };
24
- };
25
- slots: {
26
- name?: string;
27
- isObjectBindingPattern?: boolean;
28
- define?: ReturnType<(node: ts.CallExpression) => TextRange & {
29
- exp: TextRange;
30
- arg?: TextRange;
31
- typeArg?: TextRange;
32
- }> & {
33
- statement: TextRange;
34
- };
35
- };
36
- emits: {
37
- name?: string;
38
- define?: ReturnType<(node: ts.CallExpression) => TextRange & {
39
- exp: TextRange;
40
- arg?: TextRange;
41
- typeArg?: TextRange;
42
- }> & {
43
- statement: TextRange;
44
- hasUnionTypeArg?: boolean;
45
- };
46
- };
47
- expose: {
48
- name?: string;
49
- define?: ReturnType<(node: ts.CallExpression) => TextRange & {
50
- exp: TextRange;
51
- arg?: TextRange;
52
- typeArg?: TextRange;
53
- }>;
54
- };
55
- options: {
56
- name?: string;
57
- inheritAttrs?: string;
58
- };
59
- cssModules: {
60
- define: ReturnType<(node: ts.CallExpression) => TextRange & {
61
- exp: TextRange;
62
- arg?: TextRange;
63
- typeArg?: TextRange;
64
- }>;
65
- }[];
66
- defineProp: {
67
- localName: TextRange | undefined;
68
- name: TextRange | undefined;
69
- type: TextRange | undefined;
70
- modifierType?: TextRange | undefined;
71
- runtimeType: TextRange | undefined;
72
- defaultValue: TextRange | undefined;
73
- required: boolean;
74
- isModel?: boolean;
50
+ bindings: {
51
+ range: TextRange;
52
+ moduleName?: string;
53
+ isDefaultImport?: boolean;
54
+ isNamespace?: boolean;
75
55
  }[];
76
- templateRefs: {
77
- name?: string;
78
- define: ReturnType<(node: ts.CallExpression) => TextRange & {
79
- exp: TextRange;
80
- arg?: TextRange;
81
- typeArg?: TextRange;
82
- }>;
83
- }[];
84
- };
85
- export declare function parseBindingRanges(ts: typeof import('typescript'), sourceFile: ts.SourceFile): TextRange[];
86
- export declare function findBindingVars(ts: typeof import('typescript'), left: ts.BindingName, sourceFile: ts.SourceFile): TextRange[];
87
- export declare function getStartEnd(ts: typeof import('typescript'), node: ts.Node, sourceFile: ts.SourceFile): {
88
- start: number;
89
- end: number;
56
+ defineProp: DefineProp[];
57
+ defineProps: DefineProps | undefined;
58
+ withDefaults: WithDefaults | undefined;
59
+ defineEmits: DefineEmits | undefined;
60
+ defineSlots: DefineSlots | undefined;
61
+ defineExpose: CallExpressionRange | undefined;
62
+ defineOptions: DefineOptions | undefined;
63
+ useAttrs: CallExpressionRange[];
64
+ useCssModule: CallExpressionRange[];
65
+ useSlots: CallExpressionRange[];
66
+ useTemplateRef: UseTemplateRef[];
90
67
  };
91
- export declare function getNodeText(ts: typeof import('typescript'), node: ts.Node, sourceFile: ts.SourceFile): string;
68
+ export declare function parseBindingRanges(ts: typeof import('typescript'), ast: ts.SourceFile): {
69
+ range: TextRange;
70
+ moduleName?: string;
71
+ isDefaultImport?: boolean;
72
+ isNamespace?: boolean;
73
+ }[];
74
+ export declare function findBindingVars(ts: typeof import('typescript'), left: ts.BindingName, ast: ts.SourceFile): TextRange[];
75
+ export declare function getStartEnd(ts: typeof import('typescript'), node: ts.Node, ast: ts.SourceFile): TextRange;
76
+ export declare function getNodeText(ts: typeof import('typescript'), node: ts.Node, ast: ts.SourceFile): string;
77
+ export {};