@tsslint/core 2.0.6 → 3.0.0-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.
- package/index.d.ts +0 -2
- package/index.js +0 -16
- package/package.json +6 -7
- package/lib/build.d.ts +0 -1
- package/lib/build.js +0 -30
- package/lib/watch.d.ts +0 -14
- package/lib/watch.js +0 -73
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -1,24 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
3
|
exports.createLinter = createLinter;
|
|
18
4
|
exports.combineCodeFixes = combineCodeFixes;
|
|
19
5
|
exports.applyTextChanges = applyTextChanges;
|
|
20
|
-
__exportStar(require("./lib/build"), exports);
|
|
21
|
-
__exportStar(require("./lib/watch"), exports);
|
|
22
6
|
const path = require("path");
|
|
23
7
|
const minimatch = require("minimatch");
|
|
24
8
|
function createLinter(ctx, rootDir, config, handleError, syntaxOnlyLanguageService) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsslint/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-alpha.0",
|
|
4
4
|
"license": "MIT",
|
|
5
|
+
"engines": {
|
|
6
|
+
"node": ">=23.6.0"
|
|
7
|
+
},
|
|
5
8
|
"files": [
|
|
6
9
|
"**/*.js",
|
|
7
10
|
"**/*.d.ts"
|
|
@@ -12,15 +15,11 @@
|
|
|
12
15
|
"directory": "packages/core"
|
|
13
16
|
},
|
|
14
17
|
"dependencies": {
|
|
15
|
-
"@tsslint/types": "
|
|
16
|
-
"esbuild": ">=0.17.0",
|
|
18
|
+
"@tsslint/types": "3.0.0-alpha.0",
|
|
17
19
|
"minimatch": "^10.0.1"
|
|
18
20
|
},
|
|
19
|
-
"devDependencies": {
|
|
20
|
-
"@clack/prompts": "^0.8.2"
|
|
21
|
-
},
|
|
22
21
|
"scripts": {
|
|
23
22
|
"postinstall": "node scripts/cleanCache.js"
|
|
24
23
|
},
|
|
25
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "ec683ca05f4360fac720bd8c567f4d9460d255e1"
|
|
26
25
|
}
|
package/lib/build.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function buildConfig(configFilePath: string, createHash?: (path: string) => string, spinner?: ReturnType<typeof import('@clack/prompts').spinner>, stopSnipper?: (message: string, code?: number) => void): Promise<string | undefined>;
|
package/lib/build.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildConfig = buildConfig;
|
|
4
|
-
const watch_1 = require("./watch");
|
|
5
|
-
const _path = require("path");
|
|
6
|
-
function buildConfig(configFilePath, createHash,
|
|
7
|
-
// @ts-expect-error
|
|
8
|
-
spinner, stopSnipper) {
|
|
9
|
-
const buildStart = Date.now();
|
|
10
|
-
const configFileDisplayPath = _path.relative(process.cwd(), configFilePath);
|
|
11
|
-
spinner?.message('Building ' + configFileDisplayPath);
|
|
12
|
-
return new Promise(async (resolve) => {
|
|
13
|
-
try {
|
|
14
|
-
await (0, watch_1.watchConfig)(configFilePath, builtConfig => {
|
|
15
|
-
if (builtConfig) {
|
|
16
|
-
stopSnipper?.('Built ' + configFileDisplayPath + ' in ' + (Date.now() - buildStart) + 'ms');
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
stopSnipper?.('Failed to build ' + configFileDisplayPath + ' in ' + (Date.now() - buildStart) + 'ms', 1);
|
|
20
|
-
}
|
|
21
|
-
resolve(builtConfig);
|
|
22
|
-
}, false, createHash);
|
|
23
|
-
}
|
|
24
|
-
catch (e) {
|
|
25
|
-
stopSnipper?.('Failed to build ' + configFileDisplayPath + ' in ' + (Date.now() - buildStart) + 'ms', 1);
|
|
26
|
-
resolve(undefined);
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=build.js.map
|
package/lib/watch.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import esbuild = require('esbuild');
|
|
2
|
-
export declare function watchConfig(configFilePath: string, onBuild: (config: string | undefined, result: esbuild.BuildResult) => void, watch?: boolean, createHash?: (path: string) => string): Promise<esbuild.BuildContext<{
|
|
3
|
-
entryPoints: string[];
|
|
4
|
-
bundle: true;
|
|
5
|
-
sourcemap: true;
|
|
6
|
-
outfile: string;
|
|
7
|
-
format: "esm";
|
|
8
|
-
platform: "node";
|
|
9
|
-
plugins: {
|
|
10
|
-
name: string;
|
|
11
|
-
setup(build: esbuild.PluginBuild): void;
|
|
12
|
-
}[];
|
|
13
|
-
}>>;
|
|
14
|
-
export declare function getDotTsslintPath(configFilePath: string): string;
|
package/lib/watch.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.watchConfig = watchConfig;
|
|
4
|
-
exports.getDotTsslintPath = getDotTsslintPath;
|
|
5
|
-
const esbuild = require("esbuild");
|
|
6
|
-
const _path = require("path");
|
|
7
|
-
const fs = require("fs");
|
|
8
|
-
const url = require("url");
|
|
9
|
-
async function watchConfig(configFilePath, onBuild, watch = true, createHash = btoa) {
|
|
10
|
-
const outDir = getDotTsslintPath(configFilePath);
|
|
11
|
-
const outFileName = createHash(_path.relative(outDir, configFilePath)) + '.mjs';
|
|
12
|
-
const outFile = _path.join(outDir, outFileName);
|
|
13
|
-
const resultHandler = (result) => {
|
|
14
|
-
if (!result.errors.length) {
|
|
15
|
-
onBuild(outFile, result);
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
onBuild(undefined, result);
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
const ctx = await esbuild.context({
|
|
22
|
-
entryPoints: [configFilePath],
|
|
23
|
-
bundle: true,
|
|
24
|
-
sourcemap: true,
|
|
25
|
-
outfile: outFile,
|
|
26
|
-
format: 'esm',
|
|
27
|
-
platform: 'node',
|
|
28
|
-
plugins: [{
|
|
29
|
-
name: 'tsslint',
|
|
30
|
-
setup(build) {
|
|
31
|
-
build.onResolve({ filter: /.*/ }, ({ path, resolveDir }) => {
|
|
32
|
-
if (!isTsFile(path)) {
|
|
33
|
-
try {
|
|
34
|
-
const maybeJsPath = require.resolve(path, { paths: [resolveDir] });
|
|
35
|
-
if (!isTsFile(maybeJsPath) && fs.existsSync(maybeJsPath)) {
|
|
36
|
-
return {
|
|
37
|
-
path: url.pathToFileURL(maybeJsPath).toString(),
|
|
38
|
-
external: true,
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
catch { }
|
|
43
|
-
}
|
|
44
|
-
return {};
|
|
45
|
-
});
|
|
46
|
-
if (watch) {
|
|
47
|
-
build.onEnd(resultHandler);
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
}],
|
|
51
|
-
});
|
|
52
|
-
if (watch) {
|
|
53
|
-
await ctx.watch();
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
try {
|
|
57
|
-
const result = await ctx.rebuild(); // could throw
|
|
58
|
-
await ctx.dispose();
|
|
59
|
-
resultHandler(result);
|
|
60
|
-
}
|
|
61
|
-
catch (e) {
|
|
62
|
-
throw e;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return ctx;
|
|
66
|
-
}
|
|
67
|
-
function isTsFile(path) {
|
|
68
|
-
return path.endsWith('.ts') || path.endsWith('.tsx') || path.endsWith('.cts') || path.endsWith('.mts');
|
|
69
|
-
}
|
|
70
|
-
function getDotTsslintPath(configFilePath) {
|
|
71
|
-
return _path.resolve(configFilePath, '..', 'node_modules', '.tsslint');
|
|
72
|
-
}
|
|
73
|
-
//# sourceMappingURL=watch.js.map
|