vue-tsc 0.34.4 → 0.34.7

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
@@ -29,8 +29,16 @@ Check out https://github.com/johnsoncodehk/volar/discussions/640#discussioncomme
29
29
 
30
30
  ## Sponsors
31
31
 
32
+ <p align="center">
33
+ <a href="https://cdn.jsdelivr.net/gh/johnsoncodehk/sponsors/company/sponsors.svg">
34
+ <img src="https://cdn.jsdelivr.net/gh/johnsoncodehk/sponsors/company/sponsors.svg"/>
35
+ </a>
36
+ </p>
37
+
38
+ ---
39
+
32
40
  <p align="center">
33
41
  <a href="https://cdn.jsdelivr.net/gh/johnsoncodehk/sponsors/sponsors.svg">
34
- <img src='https://cdn.jsdelivr.net/gh/johnsoncodehk/sponsors/sponsors.svg'/>
42
+ <img src="https://cdn.jsdelivr.net/gh/johnsoncodehk/sponsors/sponsors.svg"/>
35
43
  </a>
36
44
  </p>
package/out/apis.js CHANGED
@@ -11,7 +11,7 @@ function register(ts, context) {
11
11
  getBindAndCheckDiagnostics,
12
12
  };
13
13
  function getRootFileNames() {
14
- return getProgram().getRootFileNames().filter(fileName => context.getTsLsHost().fileExists?.(fileName));
14
+ return getProgram().getRootFileNames().filter(fileName => { var _a, _b; return (_b = (_a = context.getTsLsHost()).fileExists) === null || _b === void 0 ? void 0 : _b.call(_a, fileName); });
15
15
  }
16
16
  // for vue-tsc --noEmit --watch
17
17
  function getBindAndCheckDiagnostics(sourceFile, cancellationToken) {
@@ -25,23 +25,26 @@ function register(ts, context) {
25
25
  return getSourceFileDiagnosticsWorker(sourceFile, cancellationToken, 'getSemanticDiagnostics');
26
26
  }
27
27
  function getSourceFileDiagnosticsWorker(sourceFile, cancellationToken, api) {
28
+ var _a, _b;
28
29
  if (sourceFile) {
29
30
  const mapped = context.vueFiles.fromEmbeddedFileName(sourceFile.fileName);
30
31
  if (mapped) {
31
32
  if (!mapped.embedded.file.capabilities.diagnostics)
32
33
  return [];
33
34
  const program = getProgram();
34
- const errors = transformDiagnostics(program?.[api](sourceFile, cancellationToken) ?? []);
35
+ const errors = transformDiagnostics((_a = program === null || program === void 0 ? void 0 : program[api](sourceFile, cancellationToken)) !== null && _a !== void 0 ? _a : []);
35
36
  return errors;
36
37
  }
37
38
  }
38
- return transformDiagnostics(getProgram()[api](sourceFile, cancellationToken) ?? []);
39
+ return transformDiagnostics((_b = getProgram()[api](sourceFile, cancellationToken)) !== null && _b !== void 0 ? _b : []);
39
40
  }
40
41
  function getGlobalDiagnostics(cancellationToken) {
41
- return transformDiagnostics(getProgram().getGlobalDiagnostics(cancellationToken) ?? []);
42
+ var _a;
43
+ return transformDiagnostics((_a = getProgram().getGlobalDiagnostics(cancellationToken)) !== null && _a !== void 0 ? _a : []);
42
44
  }
43
45
  function emit(targetSourceFile, _writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
44
- const scriptResult = getProgram().emit(targetSourceFile, (context.vueLsHost.writeFile ?? ts.sys.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
46
+ var _a;
47
+ const scriptResult = getProgram().emit(targetSourceFile, ((_a = context.vueLsHost.writeFile) !== null && _a !== void 0 ? _a : ts.sys.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
45
48
  return {
46
49
  emitSkipped: scriptResult.emitSkipped,
47
50
  emittedFiles: scriptResult.emittedFiles,
@@ -53,19 +56,20 @@ function register(ts, context) {
53
56
  }
54
57
  // transform
55
58
  function transformDiagnostics(diagnostics) {
59
+ var _a, _b, _c;
56
60
  const result = [];
57
61
  for (const diagnostic of diagnostics) {
58
62
  if (diagnostic.file !== undefined
59
63
  && diagnostic.start !== undefined
60
64
  && diagnostic.length !== undefined) {
61
65
  for (const tsOrVueLoc of context.vueFiles.fromEmbeddedLocation(diagnostic.file.fileName, diagnostic.start, diagnostic.start + diagnostic.length, data => !!data.capabilities.diagnostic)) {
62
- if (!context.vueLsHost.fileExists?.(tsOrVueLoc.fileName))
66
+ if (!((_b = (_a = context.vueLsHost).fileExists) === null || _b === void 0 ? void 0 : _b.call(_a, tsOrVueLoc.fileName)))
63
67
  continue;
64
68
  let file = tsOrVueLoc.fileName === diagnostic.file.fileName
65
69
  ? diagnostic.file
66
70
  : undefined;
67
71
  if (!file) {
68
- let docText = tsOrVueLoc.mapped?.vueFile.getContent();
72
+ let docText = (_c = tsOrVueLoc.mapped) === null || _c === void 0 ? void 0 : _c.vueFile.getContent();
69
73
  if (docText === undefined) {
70
74
  const snapshot = context.vueLsHost.getScriptSnapshot(tsOrVueLoc.fileName);
71
75
  if (snapshot) {
@@ -76,12 +80,7 @@ function register(ts, context) {
76
80
  file = ts.createSourceFile(tsOrVueLoc.fileName, docText, tsOrVueLoc.fileName.endsWith('.vue') ? ts.ScriptTarget.JSON : ts.ScriptTarget.Latest);
77
81
  }
78
82
  }
79
- const newDiagnostic = {
80
- ...diagnostic,
81
- file,
82
- start: tsOrVueLoc.range.start,
83
- length: tsOrVueLoc.range.end - tsOrVueLoc.range.start,
84
- };
83
+ const newDiagnostic = Object.assign(Object.assign({}, diagnostic), { file, start: tsOrVueLoc.range.start, length: tsOrVueLoc.range.end - tsOrVueLoc.range.start });
85
84
  const relatedInformation = diagnostic.relatedInformation;
86
85
  if (relatedInformation) {
87
86
  newDiagnostic.relatedInformation = transformDiagnostics(relatedInformation);
package/out/proxy.js CHANGED
@@ -8,6 +8,7 @@ const vue_typescript_2 = require("@volar/vue-typescript");
8
8
  let projectVersion = 0;
9
9
  function createProgramProxy(options, // rootNamesOrOptions: readonly string[] | CreateProgramOptions,
10
10
  _options, _host, _oldProgram, _configFileParsingDiagnostics) {
11
+ var _a, _b;
11
12
  if (!options.options.noEmit && !options.options.emitDeclarationOnly)
12
13
  return doThrow('js emit is not support');
13
14
  if (!options.host)
@@ -16,30 +17,19 @@ _options, _host, _oldProgram, _configFileParsingDiagnostics) {
16
17
  const host = options.host;
17
18
  const vueCompilerOptions = getVueCompilerOptions();
18
19
  const scripts = new Map();
19
- const vueLsHost = {
20
- ...host,
21
- resolveModuleNames: undefined,
22
- writeFile: (fileName, content) => {
20
+ const vueLsHost = Object.assign(Object.assign({}, host), { resolveModuleNames: undefined, writeFile: (fileName, content) => {
23
21
  if (fileName.indexOf('__VLS_') === -1) {
24
22
  host.writeFile(fileName, content, false);
25
23
  }
26
- },
27
- getCompilationSettings: () => options.options,
28
- getVueCompilationSettings: () => vueCompilerOptions,
29
- getScriptFileNames: () => {
24
+ }, getCompilationSettings: () => options.options, getVueCompilationSettings: () => vueCompilerOptions, getScriptFileNames: () => {
30
25
  return options.rootNames;
31
- },
32
- getScriptVersion,
33
- getScriptSnapshot,
34
- getProjectVersion: () => {
26
+ }, getScriptVersion,
27
+ getScriptSnapshot, getProjectVersion: () => {
35
28
  return projectVersion.toString();
36
- },
37
- getVueProjectVersion: () => {
29
+ }, getVueProjectVersion: () => {
38
30
  return projectVersion.toString();
39
- },
40
- getProjectReferences: () => options.projectReferences,
41
- };
42
- const tsRuntime = options.oldProgram?.__VLS_tsRuntime ?? (0, vue_typescript_1.createTypeScriptRuntime)({
31
+ }, getProjectReferences: () => options.projectReferences });
32
+ const tsRuntime = (_b = (_a = options.oldProgram) === null || _a === void 0 ? void 0 : _a.__VLS_tsRuntime) !== null && _b !== void 0 ? _b : (0, vue_typescript_1.createTypeScriptRuntime)({
43
33
  typescript: ts,
44
34
  baseCssModuleType: 'any',
45
35
  getCssClasses: () => ({}),
@@ -72,18 +62,21 @@ _options, _host, _oldProgram, _configFileParsingDiagnostics) {
72
62
  return {};
73
63
  }
74
64
  function getScriptVersion(fileName) {
75
- return getScript(fileName)?.version ?? '';
65
+ var _a, _b;
66
+ return (_b = (_a = getScript(fileName)) === null || _a === void 0 ? void 0 : _a.version) !== null && _b !== void 0 ? _b : '';
76
67
  }
77
68
  function getScriptSnapshot(fileName) {
78
- return getScript(fileName)?.scriptSnapshot;
69
+ var _a;
70
+ return (_a = getScript(fileName)) === null || _a === void 0 ? void 0 : _a.scriptSnapshot;
79
71
  }
80
72
  function getScript(fileName) {
73
+ var _a, _b, _c, _d, _e, _f;
81
74
  const script = scripts.get(fileName);
82
- if (script?.projectVersion === projectVersion) {
75
+ if ((script === null || script === void 0 ? void 0 : script.projectVersion) === projectVersion) {
83
76
  return script;
84
77
  }
85
- const modifiedTime = ts.sys.getModifiedTime?.(fileName)?.valueOf() ?? 0;
86
- if (script?.modifiedTime === modifiedTime) {
78
+ const modifiedTime = (_d = (_c = (_b = (_a = ts.sys).getModifiedTime) === null || _b === void 0 ? void 0 : _b.call(_a, fileName)) === null || _c === void 0 ? void 0 : _c.valueOf()) !== null && _d !== void 0 ? _d : 0;
79
+ if ((script === null || script === void 0 ? void 0 : script.modifiedTime) === modifiedTime) {
87
80
  return script;
88
81
  }
89
82
  if (host.fileExists(fileName)) {
@@ -93,7 +86,7 @@ _options, _host, _oldProgram, _configFileParsingDiagnostics) {
93
86
  projectVersion,
94
87
  modifiedTime,
95
88
  scriptSnapshot: ts.ScriptSnapshot.fromString(fileContent),
96
- version: host.createHash?.(fileContent) ?? fileContent,
89
+ version: (_f = (_e = host.createHash) === null || _e === void 0 ? void 0 : _e.call(host, fileContent)) !== null && _f !== void 0 ? _f : fileContent,
97
90
  };
98
91
  scripts.set(fileName, script);
99
92
  return script;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-tsc",
3
- "version": "0.34.4",
3
+ "version": "0.34.7",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "bin",
@@ -16,10 +16,10 @@
16
16
  "vue-tsc": "./bin/vue-tsc.js"
17
17
  },
18
18
  "dependencies": {
19
- "@volar/vue-typescript": "0.34.4"
19
+ "@volar/vue-typescript": "0.34.7"
20
20
  },
21
21
  "peerDependencies": {
22
22
  "typescript": "*"
23
23
  },
24
- "gitHead": "ba5106415fb5106b2cd9108186e8278517b592d6"
24
+ "gitHead": "308b7dc440031c2f7adf0d4564f8cfd7417523e5"
25
25
  }