@fudrouter/fsrouter 0.6.39 → 0.6.41

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.
Files changed (2) hide show
  1. package/bin/cli.cjs +14 -1
  2. package/package.json +1 -1
package/bin/cli.cjs CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  const { spawn, exec, execSync } = require("child_process");
4
4
  const path = require("path");
5
+ const { pathToFileURL } = require("node:url");
5
6
  const fs = require("fs");
6
7
  const https = require("https");
7
8
  const os = require("os");
@@ -508,7 +509,19 @@ function startServer(latestVersion) {
508
509
  function spawnServer() {
509
510
  serverStartTime = Date.now();
510
511
  crashLog = [];
511
- const child = spawn(RUNTIME, ["--import", "tsx", "--max-old-space-size=6144", serverPath], {
512
+ // Resolve tsx loader path (works cross-platform; bare --import tsx fails on Windows,
513
+ // absolute paths need file:// URL on Windows ESM loader)
514
+ let tsxImport;
515
+ try {
516
+ tsxImport = pathToFileURL(require.resolve("tsx/esm")).href;
517
+ } catch (_) {
518
+ try {
519
+ tsxImport = pathToFileURL(require.resolve("tsx")).href;
520
+ } catch (_) {
521
+ tsxImport = "tsx";
522
+ }
523
+ }
524
+ const child = spawn(RUNTIME, ["--import", tsxImport, "--max-old-space-size=6144", serverPath], {
512
525
  cwd: standaloneDir,
513
526
  stdio: showLog ? "inherit" : ["ignore", "ignore", "pipe"],
514
527
  detached: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fudrouter/fsrouter",
3
- "version": "0.6.39",
3
+ "version": "0.6.41",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "9Router v2 \u2014 Express Backend (API, SSE, DB, Auth, MITM)",