tsnite 0.0.20 → 0.1.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/dist/cli.js +20 -24
- package/package.json +6 -6
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { program } from 'commander';
|
|
3
|
-
import { extname, join,
|
|
3
|
+
import { extname, join, relative } from 'node:path';
|
|
4
4
|
import { pathToFileURL } from 'node:url';
|
|
5
5
|
import { fork } from 'node:child_process';
|
|
6
6
|
import { watch } from 'chokidar';
|
|
@@ -39,7 +39,8 @@ function spawn(entry, nodeArgs) {
|
|
|
39
39
|
...nodeArgs
|
|
40
40
|
]
|
|
41
41
|
});
|
|
42
|
-
|
|
42
|
+
if (pid)
|
|
43
|
+
pids.add(pid);
|
|
43
44
|
}
|
|
44
45
|
function normalizePath(value) {
|
|
45
46
|
return value
|
|
@@ -51,43 +52,37 @@ function normalizeExt(value) {
|
|
|
51
52
|
return value.trim().replace(/^\./, '').toLowerCase();
|
|
52
53
|
}
|
|
53
54
|
function createWatchConfig(options) {
|
|
54
|
-
const
|
|
55
|
-
const includePaths = options.include.map((value) => resolve(sourceRoot, value));
|
|
55
|
+
const includePaths = options.include.map((value) => join(options.sourceRoot, value));
|
|
56
56
|
const excludePaths = options.exclude.map(normalizePath).filter(Boolean);
|
|
57
57
|
const excludeSet = new Set(excludePaths);
|
|
58
58
|
const allowedExts = new Set(options.ext.map(normalizeExt).filter(Boolean));
|
|
59
|
-
function
|
|
59
|
+
function toRelativeFromRoot(sourceRoot, filePath) {
|
|
60
60
|
const rel = normalizePath(relative(sourceRoot, filePath));
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
return rel === '' ? '.' : rel;
|
|
62
|
+
}
|
|
63
|
+
function ignored(filePath, stats) {
|
|
64
|
+
const rel = toRelativeFromRoot(options.sourceRoot, filePath);
|
|
65
|
+
if (rel === '..' || rel.startsWith('../'))
|
|
63
66
|
return true;
|
|
64
|
-
|
|
65
|
-
// raiz do sourceRoot
|
|
66
|
-
if (rel === '') {
|
|
67
|
+
if (rel === '.')
|
|
67
68
|
return false;
|
|
68
|
-
}
|
|
69
69
|
const segments = rel.split('/');
|
|
70
|
-
|
|
71
|
-
if (segments.some((segment) => excludeSet.has(segment))) {
|
|
70
|
+
if (segments.some((segment) => INTERNAL_IGNORED_PATHS.includes(segment)))
|
|
72
71
|
return true;
|
|
73
|
-
|
|
74
|
-
// ignora por caminho relativo completo
|
|
75
|
-
if (excludePaths.some((excluded) => rel === excluded || rel.startsWith(excluded + '/'))) {
|
|
72
|
+
if (segments.some((segment) => excludeSet.has(segment)))
|
|
76
73
|
return true;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
const isExcludedByPath = excludePaths.some((excluded) => rel === excluded || rel.startsWith(excluded + '/'));
|
|
75
|
+
if (isExcludedByPath)
|
|
76
|
+
return true;
|
|
77
|
+
if (!stats || stats.isDirectory())
|
|
80
78
|
return false;
|
|
81
|
-
}
|
|
82
79
|
const extension = extname(rel).slice(1).toLowerCase();
|
|
83
|
-
|
|
84
|
-
if (allowedExts.size > 0 && !allowedExts.has(extension)) {
|
|
80
|
+
if (allowedExts.size > 0 && !allowedExts.has(extension))
|
|
85
81
|
return true;
|
|
86
|
-
}
|
|
87
82
|
return false;
|
|
88
83
|
}
|
|
89
84
|
return {
|
|
90
|
-
sourceRoot,
|
|
85
|
+
sourceRoot: options.sourceRoot,
|
|
91
86
|
paths: includePaths,
|
|
92
87
|
ignored
|
|
93
88
|
};
|
|
@@ -113,6 +108,7 @@ async function handler(entry, options, nodeArgs, isWatch) {
|
|
|
113
108
|
//
|
|
114
109
|
}
|
|
115
110
|
}
|
|
111
|
+
pids.clear();
|
|
116
112
|
spawn(entry, nodeArgs);
|
|
117
113
|
});
|
|
118
114
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tsnite",
|
|
3
3
|
"description": "TypeScript at full throttle—fast, safe, unstoppable. 🚀",
|
|
4
|
-
"version": "0.0
|
|
4
|
+
"version": "0.1.0",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
7
7
|
"esm",
|
|
@@ -40,22 +40,22 @@
|
|
|
40
40
|
"@commitlint/cli": "^20.4.3",
|
|
41
41
|
"@commitlint/config-conventional": "^20.4.3",
|
|
42
42
|
"@eslint/js": "^10.0.1",
|
|
43
|
-
"@jest/globals": "^30.
|
|
43
|
+
"@jest/globals": "^30.3.0",
|
|
44
44
|
"@swc/jest": "^0.2.39",
|
|
45
45
|
"eslint": "^10.0.3",
|
|
46
46
|
"eslint-plugin-jest": "^29.15.0",
|
|
47
47
|
"eslint-plugin-prettier": "^5.5.5",
|
|
48
48
|
"globals": "^17.4.0",
|
|
49
49
|
"husky": "^9.1.7",
|
|
50
|
-
"jest": "^30.
|
|
51
|
-
"jest-environment-node": "^30.
|
|
50
|
+
"jest": "^30.3.0",
|
|
51
|
+
"jest-environment-node": "^30.3.0",
|
|
52
52
|
"jest-mock-extended": "^4.0.0",
|
|
53
|
-
"lint-staged": "^16.3.
|
|
53
|
+
"lint-staged": "^16.3.3",
|
|
54
54
|
"prettier": "^3.8.1",
|
|
55
55
|
"rimraf": "^6.1.3",
|
|
56
56
|
"tsc-alias": "^1.8.16",
|
|
57
57
|
"typescript": "^5.9.3",
|
|
58
|
-
"typescript-eslint": "^8.
|
|
58
|
+
"typescript-eslint": "^8.57.0"
|
|
59
59
|
},
|
|
60
60
|
"engines": {
|
|
61
61
|
"node": "^20.9.0 || ^22.11.0 || ^24.11.0"
|