tsnite 0.1.4 → 0.1.5
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 +6 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -38,7 +38,8 @@ process.on('SIGTERM', function () {
|
|
|
38
38
|
cleanup('SIGTERM');
|
|
39
39
|
});
|
|
40
40
|
function spawn(entry, nodeArgs) {
|
|
41
|
-
const
|
|
41
|
+
const entryPath = isAbsolute(entry) ? entry : resolve(process.cwd(), entry);
|
|
42
|
+
const child = fork(entryPath, {
|
|
42
43
|
stdio: 'inherit',
|
|
43
44
|
execArgv: [
|
|
44
45
|
'--enable-source-maps',
|
|
@@ -130,6 +131,7 @@ function createWatchConfig(options) {
|
|
|
130
131
|
};
|
|
131
132
|
}
|
|
132
133
|
async function handler(entry, options, nodeArgs, isWatch) {
|
|
134
|
+
const runtimeEntry = isAbsolute(entry) ? entry : resolve(process.cwd(), entry);
|
|
133
135
|
async function restart(reason) {
|
|
134
136
|
process.stdout.write('\x1Bc');
|
|
135
137
|
if (reason) {
|
|
@@ -154,14 +156,14 @@ async function handler(entry, options, nodeArgs, isWatch) {
|
|
|
154
156
|
}
|
|
155
157
|
}
|
|
156
158
|
clearResolveCache();
|
|
157
|
-
spawn(
|
|
159
|
+
spawn(runtimeEntry, nodeArgs);
|
|
158
160
|
}
|
|
159
161
|
const restartDebounced = debounce(restart, WATCH_DEBOUNCE_MS);
|
|
160
162
|
process.stdout.write('\x1Bc');
|
|
161
163
|
if (isWatch) {
|
|
162
164
|
console.log(yellow('Watching for changes...'));
|
|
163
165
|
}
|
|
164
|
-
spawn(
|
|
166
|
+
spawn(runtimeEntry, nodeArgs);
|
|
165
167
|
if (!isWatch)
|
|
166
168
|
return;
|
|
167
169
|
const { ignored, paths } = createWatchConfig(options);
|
|
@@ -176,7 +178,7 @@ async function handler(entry, options, nodeArgs, isWatch) {
|
|
|
176
178
|
eventName !== 'unlink') {
|
|
177
179
|
return;
|
|
178
180
|
}
|
|
179
|
-
await invalidateFileCaches(isAbsolute(changedPath) ? changedPath : (resolve(
|
|
181
|
+
await invalidateFileCaches(isAbsolute(changedPath) ? changedPath : (resolve(process.cwd(), changedPath)));
|
|
180
182
|
restartDebounced(`Change detected (${eventName}): ${changedPath}`);
|
|
181
183
|
});
|
|
182
184
|
}
|