@orxataguy/tyr 1.0.11-beta.0 → 1.0.11-beta.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/bin/loader.mjs +9 -2
- package/bin/tyr.js +3 -2
- package/package.json +1 -1
package/bin/loader.mjs
CHANGED
|
@@ -20,10 +20,17 @@ const TS_RE = /\.m?[ct]?ts$/;
|
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* load() — intercept every ESM import whose URL ends in a TypeScript extension.
|
|
23
|
-
*
|
|
23
|
+
*
|
|
24
|
+
* We do NOT exclude node_modules: the tyr package itself ships as .ts source
|
|
25
|
+
* (bin/tyr.ts, src/core/Kernel.ts, etc.) and those files ARE under node_modules
|
|
26
|
+
* when installed globally. Node.js 24's built-in strip-types refuses to handle
|
|
27
|
+
* .ts files under node_modules, so our loader must cover them.
|
|
28
|
+
*
|
|
29
|
+
* The TS_RE regex already limits interception to .ts/.mts/.cts files — the
|
|
30
|
+
* compiled .js files that third-party packages ship will never match it.
|
|
24
31
|
*/
|
|
25
32
|
export function load(url, context, next) {
|
|
26
|
-
const isTs = TS_RE.test(url)
|
|
33
|
+
const isTs = TS_RE.test(url);
|
|
27
34
|
if (!isTs) return next(url, context);
|
|
28
35
|
|
|
29
36
|
const filePath = fileURLToPath(url);
|
package/bin/tyr.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* NODE_NO_WARNINGS suppresses the deprecation notice.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import { fileURLToPath } from 'url';
|
|
15
|
+
import { fileURLToPath, pathToFileURL } from 'url';
|
|
16
16
|
import { dirname, join } from 'path';
|
|
17
17
|
import { spawn } from 'child_process';
|
|
18
18
|
|
|
@@ -20,12 +20,13 @@ const __filename = fileURLToPath(import.meta.url);
|
|
|
20
20
|
const __dirname = dirname(__filename);
|
|
21
21
|
|
|
22
22
|
const loaderPath = join(__dirname, 'loader.mjs');
|
|
23
|
+
const loaderUrl = pathToFileURL(loaderPath).href; // file:// URL — required on Windows
|
|
23
24
|
const entry = join(__dirname, 'tyr.ts');
|
|
24
25
|
|
|
25
26
|
const child = spawn(
|
|
26
27
|
process.execPath,
|
|
27
28
|
[
|
|
28
|
-
'--loader',
|
|
29
|
+
'--loader', loaderUrl,
|
|
29
30
|
'--no-warnings', // suppress ExperimentalWarning for --loader in Node 22
|
|
30
31
|
entry,
|
|
31
32
|
...process.argv.slice(2),
|