vue-tsc 0.28.5 → 0.28.9

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.
package/README.md CHANGED
@@ -10,8 +10,19 @@ Roadmap:
10
10
  - [x] Use released LSP module
11
11
  - [x] Make `typescript` as peerDependencies
12
12
  - [x] Cleaner dependencies (remove `prettyhtml`, `prettier` etc.) (with `vscode-vue-languageservice` version >= 0.26.4)
13
+ - [x] dts emit support
13
14
  - [ ] Watch mode support
14
15
 
16
+ ## Using
17
+
18
+ Type check:
19
+
20
+ `vue-tsc --noEmit`
21
+
22
+ Build dts:
23
+
24
+ `vue-tsc --declaration --emitDeclarationOnly`
25
+
15
26
  ## Sponsors
16
27
 
17
28
  This company is [sponsoring this project](https://github.com/sponsors/johnsoncodehk) to improve your DX. 💪
package/bin/vue-tsc.js CHANGED
@@ -9,11 +9,11 @@ fs.readFileSync = (...args) => {
9
9
  let tsc = readFileSync(...args);
10
10
  tsc = tsc.replace(
11
11
  `function createIncrementalProgram(_a) {`,
12
- `function createIncrementalProgram(_a) { throw 'incremental mode is not yet support';`,
12
+ `function createIncrementalProgram(_a) { console.error('incremental mode is not yet support'); throw 'incremental mode is not yet support';`,
13
13
  );
14
14
  tsc = tsc.replace(
15
15
  `function createWatchProgram(host) {`,
16
- `function createWatchProgram(host) { throw 'watch mode is not yet support';`,
16
+ `function createWatchProgram(host) { console.error('watch mode is not yet support'); throw 'watch mode is not yet support';`,
17
17
  );
18
18
  tsc = tsc.replace(
19
19
  `function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) {`,
package/out/proxy.js CHANGED
@@ -4,15 +4,16 @@ exports.createProgramProxy = void 0;
4
4
  const ts = require("typescript/lib/tsserverlibrary");
5
5
  const vue = require("vscode-vue-languageservice");
6
6
  const path = require("path");
7
+ const shared = require("@volar/shared");
7
8
  function createProgramProxy(options) {
8
- if (!options.options.noEmit)
9
- throw 'emit mode is not yet support';
9
+ if (!options.options.noEmit && !options.options.emitDeclarationOnly)
10
+ return doThrow('js emit is not support');
10
11
  if (!options.host)
11
- throw '!options.host';
12
+ return doThrow('!options.host');
12
13
  if (!options.host.realpath)
13
- throw '!options.host.realpath';
14
+ return doThrow('!options.host.realpath');
14
15
  if (!options.host.readDirectory)
15
- throw '!options.host.readDirectory';
16
+ return doThrow('!options.host.readDirectory');
16
17
  const host = options.host;
17
18
  const realpath = options.host.realpath;
18
19
  const readDirectory = options.host.readDirectory;
@@ -28,15 +29,19 @@ function createProgramProxy(options) {
28
29
  ...options.rootNames.map(rootName => realpath(rootName)),
29
30
  ...getVueFileNames(),
30
31
  ];
32
+ const vueCompilerOptions = getVueCompilerOptions();
31
33
  const scriptSnapshots = new Map();
32
34
  const vueLsHost = {
33
35
  ...host,
34
36
  writeFile: undefined,
35
37
  getCompilationSettings: () => options.options,
38
+ getVueCompilationSettings: () => vueCompilerOptions,
36
39
  getScriptFileNames: () => fileNames,
37
40
  getScriptVersion: () => '',
38
41
  getScriptSnapshot,
39
42
  getProjectVersion: () => '',
43
+ getVueProjectVersion: () => '',
44
+ getProjectReferences: () => options.projectReferences,
40
45
  };
41
46
  const vueLs = vue.createLanguageService({ typescript: ts }, vueLsHost);
42
47
  const program = vueLs.__internal__.tsProgramProxy;
@@ -50,6 +55,14 @@ function createProgramProxy(options) {
50
55
  }
51
56
  return [];
52
57
  }
58
+ function getVueCompilerOptions() {
59
+ var _a, _b;
60
+ const tsConfig = options.options.configFilePath;
61
+ if (typeof tsConfig === 'string') {
62
+ return (_b = (_a = shared.createParsedCommandLine(ts, ts.sys, tsConfig).raw) === null || _a === void 0 ? void 0 : _a.vueCompilerOptions) !== null && _b !== void 0 ? _b : {};
63
+ }
64
+ return {};
65
+ }
53
66
  function getScriptSnapshot(fileName) {
54
67
  const scriptSnapshot = scriptSnapshots.get(fileName);
55
68
  if (scriptSnapshot) {
@@ -66,4 +79,8 @@ function createProgramProxy(options) {
66
79
  }
67
80
  }
68
81
  exports.createProgramProxy = createProgramProxy;
82
+ function doThrow(msg) {
83
+ console.error(msg);
84
+ throw msg;
85
+ }
69
86
  //# sourceMappingURL=proxy.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-tsc",
3
- "version": "0.28.5",
3
+ "version": "0.28.9",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "bin",
@@ -15,10 +15,11 @@
15
15
  "vue-tsc": "./bin/vue-tsc.js"
16
16
  },
17
17
  "dependencies": {
18
- "vscode-vue-languageservice": "0.28.5"
18
+ "@volar/shared": "0.28.9",
19
+ "vscode-vue-languageservice": "0.28.9"
19
20
  },
20
21
  "peerDependencies": {
21
22
  "typescript": "*"
22
23
  },
23
- "gitHead": "fbfe320fec237a169d217a868345c3da6410d46b"
24
+ "gitHead": "ed014c79bb485d95444f81d967cd095b4e0d88a6"
24
25
  }