@ayoxx/kundex 2.0.0 → 2.0.1
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/kundex.mjs +8 -4
- package/package.json +1 -1
package/bin/kundex.mjs
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// Thin launcher: re-
|
|
3
|
-
// so we can run the TypeScript source directly without a separate build
|
|
4
|
-
// step, then hands off to the real entrypoint.
|
|
2
|
+
// Thin launcher: re-executes node with tsx's ESM loader registered via --import,
|
|
3
|
+
// so we can run the TypeScript source directly without a separate build step.
|
|
5
4
|
import { spawnSync } from "node:child_process";
|
|
6
5
|
import { fileURLToPath } from "node:url";
|
|
7
6
|
import path from "node:path";
|
|
7
|
+
import { createRequire } from "node:module";
|
|
8
8
|
|
|
9
9
|
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
10
10
|
const entry = path.join(here, "..", "src", "index.ts");
|
|
11
11
|
|
|
12
|
+
// Resolve tsx from the package's own dependencies, not from cwd
|
|
13
|
+
const require = createRequire(import.meta.url);
|
|
14
|
+
const tsxPath = require.resolve("tsx/esm");
|
|
15
|
+
|
|
12
16
|
const result = spawnSync(
|
|
13
17
|
process.execPath,
|
|
14
|
-
["--import",
|
|
18
|
+
["--import", tsxPath, entry, ...process.argv.slice(2)],
|
|
15
19
|
{ stdio: "inherit" },
|
|
16
20
|
);
|
|
17
21
|
|