@vue/language-core 2.0.29 → 2.1.0

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 (72) hide show
  1. package/index.d.ts +4 -3
  2. package/index.js +4 -3
  3. package/lib/codegen/common.d.ts +2 -1
  4. package/lib/codegen/common.js +16 -5
  5. package/lib/codegen/globalTypes.d.ts +1 -0
  6. package/lib/codegen/globalTypes.js +123 -0
  7. package/lib/codegen/localTypes.d.ts +14 -0
  8. package/lib/codegen/localTypes.js +120 -0
  9. package/lib/codegen/script/component.d.ts +1 -4
  10. package/lib/codegen/script/component.js +112 -63
  11. package/lib/codegen/script/context.d.ts +14 -10
  12. package/lib/codegen/script/context.js +5 -107
  13. package/lib/codegen/script/index.d.ts +3 -2
  14. package/lib/codegen/script/index.js +37 -53
  15. package/lib/codegen/script/internalComponent.d.ts +1 -1
  16. package/lib/codegen/script/internalComponent.js +13 -5
  17. package/lib/codegen/script/scriptSetup.js +144 -62
  18. package/lib/codegen/script/template.d.ts +3 -0
  19. package/lib/codegen/script/template.js +80 -79
  20. package/lib/codegen/template/context.d.ts +6 -1
  21. package/lib/codegen/template/context.js +9 -2
  22. package/lib/codegen/template/element.d.ts +1 -1
  23. package/lib/codegen/template/element.js +214 -92
  24. package/lib/codegen/template/elementChildren.js +1 -0
  25. package/lib/codegen/template/elementDirectives.js +8 -4
  26. package/lib/codegen/template/elementEvents.js +13 -14
  27. package/lib/codegen/template/elementProps.js +43 -22
  28. package/lib/codegen/template/index.d.ts +3 -0
  29. package/lib/codegen/template/index.js +29 -41
  30. package/lib/codegen/template/interpolation.d.ts +1 -1
  31. package/lib/codegen/template/interpolation.js +24 -15
  32. package/lib/codegen/template/objectProperty.d.ts +1 -1
  33. package/lib/codegen/template/objectProperty.js +7 -2
  34. package/lib/codegen/template/styleScopedClasses.d.ts +3 -0
  35. package/lib/codegen/template/styleScopedClasses.js +72 -0
  36. package/lib/codegen/template/templateChild.js +5 -1
  37. package/lib/codegen/types.d.ts +9 -0
  38. package/lib/codegen/types.js +3 -0
  39. package/lib/languagePlugin.d.ts +2 -4
  40. package/lib/languagePlugin.js +4 -57
  41. package/lib/parsers/scriptRanges.d.ts +1 -0
  42. package/lib/parsers/scriptRanges.js +5 -0
  43. package/lib/parsers/scriptSetupRanges.d.ts +17 -3
  44. package/lib/parsers/scriptSetupRanges.js +127 -44
  45. package/lib/plugins/file-md.js +9 -6
  46. package/lib/plugins/vue-root-tags.js +51 -0
  47. package/lib/plugins/vue-tsx.d.ts +40 -3
  48. package/lib/plugins/vue-tsx.js +17 -4
  49. package/lib/plugins.js +2 -0
  50. package/lib/types.d.ts +14 -10
  51. package/lib/utils/findDestructuredProps.js +3 -0
  52. package/lib/utils/parseCssClassNames.js +4 -6
  53. package/lib/utils/parseCssVars.js +5 -7
  54. package/lib/utils/parseSfc.js +4 -1
  55. package/lib/utils/ts.js +8 -2
  56. package/lib/virtualFile/{computedFiles.d.ts → computedEmbeddedCodes.d.ts} +1 -1
  57. package/lib/virtualFile/{computedFiles.js → computedEmbeddedCodes.js} +3 -3
  58. package/lib/virtualFile/computedSfc.d.ts +1 -1
  59. package/lib/virtualFile/computedSfc.js +14 -3
  60. package/lib/virtualFile/vueFile.d.ts +13 -3
  61. package/lib/virtualFile/vueFile.js +17 -9
  62. package/package.json +4 -4
  63. package/lib/codegen/script/globalTypes.d.ts +0 -2
  64. package/lib/codegen/script/globalTypes.js +0 -134
  65. package/lib/codegen/template/objectKey.js +0 -34
  66. package/lib/languageModule.d.ts +0 -5
  67. package/lib/languageModule.js +0 -159
  68. package/lib/plugins/file-dot-setup.js +0 -34
  69. package/lib/virtualFile/computedMappings.d.ts +0 -4
  70. package/lib/virtualFile/computedMappings.js +0 -65
  71. /package/lib/plugins/{file-dot-setup.d.ts → vue-root-tags.d.ts} +0 -0
  72. /package/lib/{codegen/template/objectKey.d.ts → utils/findDestructuredProps.d.ts} +0 -0
@@ -1,65 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.computedMappings = computedMappings;
4
- const computeds_1 = require("computeds");
5
- const muggle_string_1 = require("muggle-string");
6
- const shared_1 = require("../plugins/shared");
7
- function computedMappings(snapshot, sfc) {
8
- return (0, computeds_1.computed)(() => {
9
- const str = [[snapshot().getText(0, snapshot().getLength()), undefined, 0, shared_1.allCodeFeatures]];
10
- for (const block of [
11
- sfc.script,
12
- sfc.scriptSetup,
13
- sfc.template,
14
- ...sfc.styles,
15
- ...sfc.customBlocks,
16
- ]) {
17
- if (block) {
18
- (0, muggle_string_1.replaceSourceRange)(str, undefined, block.startTagEnd, block.endTagStart, '\n\n');
19
- }
20
- }
21
- const mappings = str
22
- .filter(s => typeof s !== 'string')
23
- .map(m => {
24
- const text = m[0];
25
- const start = m[2];
26
- return {
27
- sourceOffsets: [start],
28
- generatedOffsets: [start],
29
- lengths: [text.length],
30
- data: m[3],
31
- };
32
- });
33
- // fix folding range end position failed to mapping
34
- for (const block of [
35
- sfc.script,
36
- sfc.scriptSetup,
37
- sfc.template,
38
- ...sfc.styles,
39
- ...sfc.customBlocks,
40
- ]) {
41
- const offsets = [];
42
- if (block) {
43
- let content = block.content;
44
- if (content.endsWith('\r\n')) {
45
- content = content.slice(0, -2);
46
- }
47
- else if (content.endsWith('\n')) {
48
- content = content.slice(0, -1);
49
- }
50
- const offset = content.lastIndexOf('\n') + 1;
51
- offsets.push(block.startTagEnd + offset);
52
- }
53
- if (offsets.length) {
54
- mappings.push({
55
- sourceOffsets: offsets,
56
- generatedOffsets: offsets,
57
- lengths: offsets.map(() => 0),
58
- data: { structure: true },
59
- });
60
- }
61
- }
62
- return mappings;
63
- });
64
- }
65
- //# sourceMappingURL=computedMappings.js.map