@tsslint/core 1.1.4 → 1.1.6

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 (2) hide show
  1. package/lib/watch.js +46 -2
  2. package/package.json +3 -3
package/lib/watch.js CHANGED
@@ -5,6 +5,7 @@ const esbuild = require("esbuild");
5
5
  const _path = require("path");
6
6
  const fs = require("fs");
7
7
  const url = require("url");
8
+ const ErrorStackParser = require("error-stack-parser");
8
9
  async function watchConfigFile(configFilePath, onBuild, watch = true, createHash = btoa, logger = console) {
9
10
  let start;
10
11
  const outDir = _path.resolve(configFilePath, '..', 'node_modules', '.tsslint');
@@ -14,12 +15,55 @@ async function watchConfigFile(configFilePath, onBuild, watch = true, createHash
14
15
  const t1 = Date.now() - start;
15
16
  start = Date.now();
16
17
  let config;
18
+ for (const error of [
19
+ ...result.errors,
20
+ ...result.warnings,
21
+ ]) {
22
+ if (error.id) {
23
+ error.id = 'esbuild:' + error.id;
24
+ }
25
+ else {
26
+ error.id = 'config-build-error';
27
+ }
28
+ }
17
29
  if (!result.errors.length) {
18
30
  try {
19
31
  config = (await import(url.pathToFileURL(outFile).toString() + '?time=' + Date.now())).default;
20
32
  }
21
33
  catch (e) {
22
- result.errors.push({ text: String(e) });
34
+ if (e.stack) {
35
+ const stack = ErrorStackParser.parse(e)[0];
36
+ if (stack.fileName && stack.lineNumber !== undefined && stack.columnNumber !== undefined) {
37
+ let fileName = stack.fileName
38
+ .replace(/\\/g, '/')
39
+ .split('?time=')[0];
40
+ if (fileName.startsWith('file://')) {
41
+ fileName = fileName.substring('file://'.length);
42
+ }
43
+ result.errors.push({
44
+ id: 'config-import-error',
45
+ text: String(e),
46
+ location: {
47
+ file: fileName,
48
+ line: stack.lineNumber,
49
+ column: stack.columnNumber - 1,
50
+ lineText: '',
51
+ },
52
+ });
53
+ }
54
+ else {
55
+ result.errors.push({
56
+ id: 'config-import-error',
57
+ text: String(e),
58
+ });
59
+ }
60
+ }
61
+ else {
62
+ result.errors.push({
63
+ id: 'config-import-error',
64
+ text: String(e),
65
+ });
66
+ }
23
67
  }
24
68
  }
25
69
  const t2 = Date.now() - start;
@@ -54,7 +98,7 @@ async function watchConfigFile(configFilePath, onBuild, watch = true, createHash
54
98
  }
55
99
  return {
56
100
  path: cachePath,
57
- external: true,
101
+ external: !isTsFile(cachePath),
58
102
  };
59
103
  });
60
104
  build.onResolve({ filter: /.*/ }, ({ path, resolveDir }) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsslint/core",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "**/*.js",
@@ -12,11 +12,11 @@
12
12
  "directory": "packages/core"
13
13
  },
14
14
  "dependencies": {
15
- "@tsslint/types": "1.1.4",
15
+ "@tsslint/types": "1.1.6",
16
16
  "error-stack-parser": "^2.1.4",
17
17
  "esbuild": ">=0.17.0",
18
18
  "minimatch": "^10.0.1",
19
19
  "source-map-support": "^0.5.21"
20
20
  },
21
- "gitHead": "03d4e7480fc96c6322d436d34a4af73cb5bc25f2"
21
+ "gitHead": "040024b0c2a08ded87940935090b4aaaebd8c7c4"
22
22
  }