@tsslint/core 1.3.0 → 1.3.2
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/lib/watch.js +18 -10
- package/package.json +3 -3
- package/lib/cache.d.ts +0 -4
- package/lib/cache.js +0 -33
package/lib/watch.js
CHANGED
|
@@ -84,23 +84,31 @@ async function watchConfigFile(configFilePath, onBuild, watch = true, createHash
|
|
|
84
84
|
build.onStart(() => {
|
|
85
85
|
start = Date.now();
|
|
86
86
|
});
|
|
87
|
-
build.onResolve({ filter: /^https?:\/\// }, async ({ path:
|
|
88
|
-
const cachePath = _path.join(outDir,
|
|
87
|
+
build.onResolve({ filter: /^https?:\/\// }, async ({ path: importUrl }) => {
|
|
88
|
+
const cachePath = _path.join(outDir, importUrl.split('://')[0], ...importUrl.split('://')[1].split('/'));
|
|
89
89
|
if (!fs.existsSync(cachePath)) {
|
|
90
|
-
console.time('Download ' +
|
|
91
|
-
const response = await fetch(
|
|
90
|
+
console.time('Download ' + importUrl);
|
|
91
|
+
const response = await fetch(importUrl);
|
|
92
92
|
if (!response.ok) {
|
|
93
|
-
throw new Error(`Failed to load ${
|
|
93
|
+
throw new Error(`Failed to load ${importUrl}`);
|
|
94
94
|
}
|
|
95
|
-
console.timeEnd('Download ' +
|
|
95
|
+
console.timeEnd('Download ' + importUrl);
|
|
96
96
|
const text = await response.text();
|
|
97
97
|
fs.mkdirSync(_path.dirname(cachePath), { recursive: true });
|
|
98
98
|
fs.writeFileSync(cachePath, text, 'utf8');
|
|
99
99
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
100
|
+
if (isTsFile(cachePath)) {
|
|
101
|
+
return {
|
|
102
|
+
path: cachePath,
|
|
103
|
+
external: false,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
return {
|
|
108
|
+
path: url.pathToFileURL(cachePath).toString(),
|
|
109
|
+
external: true,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
104
112
|
});
|
|
105
113
|
build.onResolve({ filter: /.*/ }, ({ path, resolveDir }) => {
|
|
106
114
|
if (!isTsFile(path)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsslint/core",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
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.3.
|
|
15
|
+
"@tsslint/types": "1.3.2",
|
|
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": "
|
|
21
|
+
"gitHead": "5685591d29322054ecb4f8b94eb35eab370d8288"
|
|
22
22
|
}
|
package/lib/cache.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { ProjectContext } from '@tsslint/types';
|
|
2
|
-
export declare function loadCache(configFilePath: string, createHash?: (path: string) => string): ProjectContext['cache'];
|
|
3
|
-
export declare function saveCache(configFilePath: string, cache: ProjectContext['cache'], createHash?: (path: string) => string): void;
|
|
4
|
-
export declare function getDotTsslintPath(configFilePath: string): string;
|
package/lib/cache.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.loadCache = loadCache;
|
|
4
|
-
exports.saveCache = saveCache;
|
|
5
|
-
exports.getDotTsslintPath = getDotTsslintPath;
|
|
6
|
-
const path = require("path");
|
|
7
|
-
const fs = require("fs");
|
|
8
|
-
function loadCache(configFilePath, createHash = btoa) {
|
|
9
|
-
const outDir = getDotTsslintPath(configFilePath);
|
|
10
|
-
const cacheFileName = createHash(path.relative(outDir, configFilePath)) + '.cache.json';
|
|
11
|
-
const cacheFilePath = path.join(outDir, cacheFileName);
|
|
12
|
-
const cacheFileStat = fs.statSync(cacheFilePath);
|
|
13
|
-
const configFileStat = fs.statSync(configFilePath);
|
|
14
|
-
if (cacheFileStat.isFile() && cacheFileStat.mtimeMs > configFileStat.mtimeMs) {
|
|
15
|
-
try {
|
|
16
|
-
return require(cacheFilePath);
|
|
17
|
-
}
|
|
18
|
-
catch {
|
|
19
|
-
return {};
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return {};
|
|
23
|
-
}
|
|
24
|
-
function saveCache(configFilePath, cache, createHash = btoa) {
|
|
25
|
-
const outDir = getDotTsslintPath(configFilePath);
|
|
26
|
-
const cacheFileName = createHash(path.relative(outDir, configFilePath)) + '.cache.json';
|
|
27
|
-
const cacheFilePath = path.join(outDir, cacheFileName);
|
|
28
|
-
fs.writeFileSync(cacheFilePath, JSON.stringify(cache));
|
|
29
|
-
}
|
|
30
|
-
function getDotTsslintPath(configFilePath) {
|
|
31
|
-
return path.resolve(configFilePath, '..', 'node_modules', '.tsslint');
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=cache.js.map
|