trpc-gen-python 0.1.1 → 0.1.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/dist/bin.js +13 -3
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -2,10 +2,20 @@
|
|
|
2
2
|
import { spawn } from "child_process";
|
|
3
3
|
import { dirname, join } from "path";
|
|
4
4
|
import { fileURLToPath } from "url";
|
|
5
|
+
import { createRequire } from "module";
|
|
5
6
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
6
|
-
|
|
7
|
-
//
|
|
8
|
-
|
|
7
|
+
const require = createRequire(import.meta.url);
|
|
8
|
+
// Resolve tsx loader path using Node's module resolution
|
|
9
|
+
// This works regardless of where npm installs dependencies
|
|
10
|
+
let tsxLoader;
|
|
11
|
+
try {
|
|
12
|
+
// Try to resolve tsx from this package's dependencies
|
|
13
|
+
tsxLoader = require.resolve("tsx/dist/loader.mjs");
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
// Fallback: look in node_modules relative to this file
|
|
17
|
+
tsxLoader = join(__dirname, "..", "node_modules", "tsx", "dist", "loader.mjs");
|
|
18
|
+
}
|
|
9
19
|
const cliPath = join(__dirname, "cli.js");
|
|
10
20
|
const child = spawn(process.execPath, ["--import", tsxLoader, cliPath, ...process.argv.slice(2)], {
|
|
11
21
|
stdio: "inherit",
|