tsnite 0.0.9 → 0.0.10
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 +13 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -7,6 +7,7 @@ import { createRequire } from 'node:module';
|
|
|
7
7
|
import { gradient } from './gradient.js';
|
|
8
8
|
const require = createRequire(import.meta.dirname);
|
|
9
9
|
const { name, description, version } = require(join(import.meta.dirname, '..', 'package.json'));
|
|
10
|
+
const pids = new Set();
|
|
10
11
|
program
|
|
11
12
|
.name(name)
|
|
12
13
|
.description(description)
|
|
@@ -23,7 +24,7 @@ async function handler() {
|
|
|
23
24
|
try {
|
|
24
25
|
process.stdout.write('\x1Bc');
|
|
25
26
|
const starts = performance.now();
|
|
26
|
-
fork(join(process.cwd(), entry), {
|
|
27
|
+
const { pid } = fork(join(process.cwd(), entry), {
|
|
27
28
|
stdio: 'inherit',
|
|
28
29
|
execArgv: [
|
|
29
30
|
'--enable-source-maps',
|
|
@@ -33,6 +34,7 @@ async function handler() {
|
|
|
33
34
|
...nodeArgs
|
|
34
35
|
]
|
|
35
36
|
});
|
|
37
|
+
pids.add(pid);
|
|
36
38
|
const ends = performance.now();
|
|
37
39
|
process.stdout.write(`\x1b[1m${gradient(['#5e23e6', '#f88bc7'])(`➤ Compiled successfully in ${(ends - starts).toFixed(2)}ms`)}\x1b[0m\n`);
|
|
38
40
|
}
|
|
@@ -49,8 +51,16 @@ async function handler() {
|
|
|
49
51
|
watcher.on('change', async function () {
|
|
50
52
|
try {
|
|
51
53
|
process.stdout.write('\x1Bc');
|
|
54
|
+
for (const pid of pids.values()) {
|
|
55
|
+
try {
|
|
56
|
+
process.kill(pid);
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
//
|
|
60
|
+
}
|
|
61
|
+
}
|
|
52
62
|
const starts = performance.now();
|
|
53
|
-
fork(join(process.cwd(), entry), {
|
|
63
|
+
const { pid } = fork(join(process.cwd(), entry), {
|
|
54
64
|
stdio: 'inherit',
|
|
55
65
|
execArgv: [
|
|
56
66
|
'--enable-source-maps',
|
|
@@ -60,6 +70,7 @@ async function handler() {
|
|
|
60
70
|
...nodeArgs
|
|
61
71
|
]
|
|
62
72
|
});
|
|
73
|
+
pids.add(pid);
|
|
63
74
|
const ends = performance.now();
|
|
64
75
|
process.stdout.write(`\x1b[1m${gradient(['#5e23e6', '#f88bc7'])(`➤ Compiled successfully in ${(ends - starts).toFixed(2)}ms`)}\x1b[0m\n`);
|
|
65
76
|
}
|