@vue/language-core 2.0.21 → 2.0.23-alpha.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 (52) hide show
  1. package/index.d.ts +8 -0
  2. package/lib/codegen/common.js +6 -6
  3. package/lib/codegen/script/component.js +4 -5
  4. package/lib/codegen/script/context.js +1 -2
  5. package/lib/codegen/script/globalTypes.js +26 -18
  6. package/lib/codegen/script/index.js +20 -2
  7. package/lib/codegen/script/internalComponent.js +1 -2
  8. package/lib/codegen/script/scriptSetup.js +2 -15
  9. package/lib/codegen/script/src.js +1 -2
  10. package/lib/codegen/script/template.js +2 -3
  11. package/lib/codegen/template/camelized.js +1 -2
  12. package/lib/codegen/template/context.d.ts +1 -1
  13. package/lib/codegen/template/context.js +1 -2
  14. package/lib/codegen/template/element.js +4 -5
  15. package/lib/codegen/template/elementChildren.js +1 -2
  16. package/lib/codegen/template/elementDirectives.js +1 -2
  17. package/lib/codegen/template/elementEvents.js +8 -9
  18. package/lib/codegen/template/elementProps.js +6 -7
  19. package/lib/codegen/template/index.js +2 -3
  20. package/lib/codegen/template/interpolation.js +2 -3
  21. package/lib/codegen/template/objectProperty.js +1 -2
  22. package/lib/codegen/template/propertyAccess.js +1 -2
  23. package/lib/codegen/template/slotOutlet.js +1 -2
  24. package/lib/codegen/template/stringLiteralKey.js +1 -2
  25. package/lib/codegen/template/templateChild.js +3 -4
  26. package/lib/codegen/template/vFor.js +2 -3
  27. package/lib/codegen/template/vIf.js +3 -4
  28. package/lib/languageModule.js +2 -3
  29. package/lib/parsers/scriptRanges.js +1 -2
  30. package/lib/parsers/scriptSetupRanges.d.ts +27 -27
  31. package/lib/parsers/scriptSetupRanges.js +5 -6
  32. package/lib/plugins/file-md.js +6 -4
  33. package/lib/plugins/vue-sfc-scripts.js +4 -4
  34. package/lib/plugins/vue-tsx.d.ts +33 -33
  35. package/lib/plugins/vue-tsx.js +1 -1
  36. package/lib/plugins.d.ts +5 -5
  37. package/lib/plugins.js +1 -2
  38. package/lib/types.d.ts +2 -1
  39. package/lib/utils/buildMappings.d.ts +3 -0
  40. package/lib/utils/buildMappings.js +23 -0
  41. package/lib/utils/parseCssClassNames.js +1 -2
  42. package/lib/utils/parseCssVars.js +2 -3
  43. package/lib/utils/parseSfc.js +1 -2
  44. package/lib/utils/shared.js +3 -3
  45. package/lib/utils/ts.js +3 -4
  46. package/lib/virtualFile/computedFiles.d.ts +1 -1
  47. package/lib/virtualFile/computedFiles.js +6 -6
  48. package/lib/virtualFile/computedMappings.d.ts +1 -1
  49. package/lib/virtualFile/computedMappings.js +3 -4
  50. package/lib/virtualFile/computedSfc.js +1 -2
  51. package/lib/virtualFile/computedVueSfc.js +1 -2
  52. package/package.json +5 -3
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveCommonLanguageId = exports.computedFiles = void 0;
4
- const language_core_1 = require("@volar/language-core");
3
+ exports.computedFiles = computedFiles;
4
+ exports.resolveCommonLanguageId = resolveCommonLanguageId;
5
5
  const computeds_1 = require("computeds");
6
+ const muggle_string_1 = require("muggle-string");
7
+ const buildMappings_1 = require("../utils/buildMappings");
6
8
  const embeddedFile_1 = require("./embeddedFile");
7
9
  function computedFiles(plugins, fileName, sfc) {
8
10
  const nameToBlock = (0, computeds_1.computed)(() => {
@@ -85,7 +87,6 @@ function computedFiles(plugins, fileName, sfc) {
85
87
  });
86
88
  return structuredResult;
87
89
  }
88
- exports.computedFiles = computedFiles;
89
90
  function computedPluginEmbeddedCodes(plugins, plugin, fileName, sfc, nameToBlock) {
90
91
  const computeds = new Map();
91
92
  const getComputedKey = (code) => code.id + '__' + code.lang;
@@ -116,7 +117,7 @@ function computedPluginEmbeddedCodes(plugins, plugin, fileName, sfc, nameToBlock
116
117
  console.error(e);
117
118
  }
118
119
  }
119
- const newText = (0, language_core_1.toString)(code.content);
120
+ const newText = (0, muggle_string_1.toString)(code.content);
120
121
  const changeRanges = new Map();
121
122
  const snapshot = {
122
123
  getText: (start, end) => newText.slice(start, end),
@@ -149,7 +150,7 @@ function computedPluginEmbeddedCodes(plugins, plugin, fileName, sfc, nameToBlock
149
150
  return (0, computeds_1.computed)(() => {
150
151
  return codes().map(_file => {
151
152
  const { code, snapshot } = _file();
152
- const mappings = (0, language_core_1.buildMappings)(code.content.map(segment => {
153
+ const mappings = (0, buildMappings_1.buildMappings)(code.content.map(segment => {
153
154
  if (typeof segment === 'string') {
154
155
  return segment;
155
156
  }
@@ -240,5 +241,4 @@ function resolveCommonLanguageId(lang) {
240
241
  }
241
242
  return lang;
242
243
  }
243
- exports.resolveCommonLanguageId = resolveCommonLanguageId;
244
244
  //# sourceMappingURL=computedFiles.js.map
@@ -1,4 +1,4 @@
1
- import { CodeMapping } from '@volar/language-core';
1
+ import type { CodeMapping } from '@volar/language-core';
2
2
  import type * as ts from 'typescript';
3
3
  import type { Sfc } from '../types';
4
4
  export declare function computedMappings(snapshot: () => ts.IScriptSnapshot, sfc: Sfc): () => CodeMapping[];
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.computedMappings = void 0;
4
- const language_core_1 = require("@volar/language-core");
3
+ exports.computedMappings = computedMappings;
5
4
  const computeds_1 = require("computeds");
5
+ const muggle_string_1 = require("muggle-string");
6
6
  const shared_1 = require("../plugins/shared");
7
7
  function computedMappings(snapshot, sfc) {
8
8
  return (0, computeds_1.computed)(() => {
@@ -15,7 +15,7 @@ function computedMappings(snapshot, sfc) {
15
15
  ...sfc.customBlocks,
16
16
  ]) {
17
17
  if (block) {
18
- (0, language_core_1.replaceSourceRange)(str, undefined, block.startTagEnd, block.endTagStart, '\n\n');
18
+ (0, muggle_string_1.replaceSourceRange)(str, undefined, block.startTagEnd, block.endTagStart, '\n\n');
19
19
  }
20
20
  }
21
21
  const mappings = str
@@ -62,5 +62,4 @@ function computedMappings(snapshot, sfc) {
62
62
  return mappings;
63
63
  });
64
64
  }
65
- exports.computedMappings = computedMappings;
66
65
  //# sourceMappingURL=computedMappings.js.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.computedSfc = void 0;
3
+ exports.computedSfc = computedSfc;
4
4
  const computeds_1 = require("computeds");
5
5
  const parseCssClassNames_1 = require("../utils/parseCssClassNames");
6
6
  const parseCssVars_1 = require("../utils/parseCssVars");
@@ -226,7 +226,6 @@ function computedSfc(ts, plugins, fileName, snapshot, parsed) {
226
226
  };
227
227
  }
228
228
  }
229
- exports.computedSfc = computedSfc;
230
229
  function mergeObject(a, b) {
231
230
  return Object.defineProperties(a, Object.getOwnPropertyDescriptors(b));
232
231
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.computedVueSfc = void 0;
3
+ exports.computedVueSfc = computedVueSfc;
4
4
  const computeds_1 = require("computeds");
5
5
  function computedVueSfc(plugins, fileName, snapshot) {
6
6
  let cache;
@@ -37,5 +37,4 @@ function computedVueSfc(plugins, fileName, snapshot) {
37
37
  }
38
38
  });
39
39
  }
40
- exports.computedVueSfc = computedVueSfc;
41
40
  //# sourceMappingURL=computedVueSfc.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/language-core",
3
- "version": "2.0.21",
3
+ "version": "2.0.23-alpha.0",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "**/*.js",
@@ -12,11 +12,12 @@
12
12
  "directory": "packages/language-core"
13
13
  },
14
14
  "dependencies": {
15
- "@volar/language-core": "~2.3.0-alpha.15",
15
+ "@volar/language-core": "~2.4.0-alpha.0",
16
16
  "@vue/compiler-dom": "^3.4.0",
17
17
  "@vue/shared": "^3.4.0",
18
18
  "computeds": "^0.0.1",
19
19
  "minimatch": "^9.0.3",
20
+ "muggle-string": "^0.4.1",
20
21
  "path-browserify": "^1.0.1",
21
22
  "vue-template-compiler": "^2.7.14"
22
23
  },
@@ -24,6 +25,7 @@
24
25
  "@types/minimatch": "^5.1.2",
25
26
  "@types/node": "latest",
26
27
  "@types/path-browserify": "^1.0.1",
28
+ "@volar/typescript": "~2.4.0-alpha.0",
27
29
  "@vue/compiler-sfc": "^3.4.0"
28
30
  },
29
31
  "peerDependencies": {
@@ -34,5 +36,5 @@
34
36
  "optional": true
35
37
  }
36
38
  },
37
- "gitHead": "a5af80e3939a39694abd9dd09a5496bc5fbf6e06"
39
+ "gitHead": "c1b2f64df85617643c1b4b408d99447df3fa2d5f"
38
40
  }