@geekmidas/cli 10.0.0-alpha.47 → 10.0.0-alpha.48

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/index.mjs CHANGED
@@ -42,7 +42,7 @@ import { Queue } from "@geekmidas/constructs/queue";
42
42
  import { Topic } from "@geekmidas/constructs/topic";
43
43
  import { lookup } from "node:dns/promises";
44
44
  //#region package.json
45
- var version = "10.0.0-alpha.47";
45
+ var version = "10.0.0-alpha.48";
46
46
  //#endregion
47
47
  //#region src/auth/credentials.ts
48
48
  /**
@@ -338,6 +338,45 @@ function normalizeRoutes(routes) {
338
338
  return Array.isArray(routes) ? routes : [routes];
339
339
  }
340
340
  //#endregion
341
+ //#region src/owningTsconfigJsx.ts
342
+ const REGISTER = "owning-tsconfig-jsx-register.mjs";
343
+ /** The CLI's `bin/` was not found above the module looking for it. */
344
+ var OwningTsconfigJsxHookMissing = class extends Error {
345
+ from;
346
+ constructor(from) {
347
+ super(`Could not find bin/${REGISTER} in any directory above '${from}'. It ships with @geekmidas/cli beside bin/gkm.mjs; reinstall the package if it is missing.`);
348
+ this.from = from;
349
+ this.name = "OwningTsconfigJsxHookMissing";
350
+ }
351
+ };
352
+ /**
353
+ * The CLI's `bin/owning-tsconfig-jsx-register.mjs`, as a file URL. Searched
354
+ * upward because this module runs from `src/` in the repo and from a chunk in
355
+ * `dist/` once built, and `bin/` sits beside both.
356
+ */
357
+ function registerUrl() {
358
+ const from = dirname(fileURLToPath(import.meta.url));
359
+ for (let dir = from;; dir = dirname(dir)) {
360
+ const candidate = join(dir, "bin", REGISTER);
361
+ if (existsSync(candidate)) return pathToFileURL(candidate).href;
362
+ if (dirname(dir) === dir) throw new OwningTsconfigJsxHookMissing(from);
363
+ }
364
+ }
365
+ /**
366
+ * `NODE_OPTIONS` for a process that runs app code through tsx, with the hook
367
+ * that compiles each `.tsx` with its own tsconfig's JSX settings (see
368
+ * `bin/owning-tsconfig-jsx.mjs`) put in front of every other `--import`, so it
369
+ * is registered before tsx and reads the source on tsx's behalf.
370
+ *
371
+ * `bin/gkm.mjs` already starts the CLI this way, and its children inherit it;
372
+ * this is for those that set `NODE_OPTIONS` themselves, or whose CLI was
373
+ * started with tsx already imported.
374
+ */
375
+ function withOwningTsconfigJsx(nodeOptions = "") {
376
+ if (nodeOptions.includes(REGISTER)) return nodeOptions;
377
+ return [`--import=${registerUrl()}`, nodeOptions].filter(Boolean).join(" ");
378
+ }
379
+ //#endregion
341
380
  //#region src/trust/index.ts
342
381
  /**
343
382
  * Installing the local edge's certificate authority into the OS trust store.
@@ -1690,7 +1729,8 @@ var EntryRunner = class {
1690
1729
  async runProcess() {
1691
1730
  const env = {
1692
1731
  ...process.env,
1693
- PORT: String(this.port)
1732
+ PORT: String(this.port),
1733
+ NODE_OPTIONS: withOwningTsconfigJsx(process.env.NODE_OPTIONS)
1694
1734
  };
1695
1735
  this.childProcess = spawn(...tsxCommand(dirname(this.wrapperPath), [this.wrapperPath]), {
1696
1736
  stdio: "inherit",
@@ -1940,7 +1980,8 @@ var DevServer = class {
1940
1980
  env: {
1941
1981
  ...process.env,
1942
1982
  NODE_ENV: "development",
1943
- GKM_DEV_PID: String(process.pid)
1983
+ GKM_DEV_PID: String(process.pid),
1984
+ NODE_OPTIONS: withOwningTsconfigJsx(process.env.NODE_OPTIONS)
1944
1985
  },
1945
1986
  detached: true
1946
1987
  });
@@ -6766,7 +6807,7 @@ async function sniffEntryFile(entryPath, appPath, workspacePath) {
6766
6807
  ],
6767
6808
  env: {
6768
6809
  ...process.env,
6769
- NODE_OPTIONS: "--import=tsx"
6810
+ NODE_OPTIONS: withOwningTsconfigJsx("--import=tsx")
6770
6811
  }
6771
6812
  });
6772
6813
  let stdout = "";
@@ -9082,26 +9123,26 @@ function loadPackageJson() {
9082
9123
  * Run: pnpm --filter @geekmidas/cli sync-versions
9083
9124
  */
9084
9125
  const GEEKMIDAS_VERSIONS = {
9085
- "@geekmidas/audit": "~10.0.0-alpha.47",
9086
- "@geekmidas/auth": "~10.0.0-alpha.47",
9087
- "@geekmidas/cache": "~10.0.0-alpha.47",
9088
- "@geekmidas/client": "~10.0.0-alpha.47",
9089
- "@geekmidas/cloud": "~10.0.0-alpha.47",
9090
- "@geekmidas/constructs": "~10.0.0-alpha.47",
9091
- "@geekmidas/db": "~10.0.0-alpha.47",
9092
- "@geekmidas/emailkit": "~10.0.0-alpha.47",
9093
- "@geekmidas/envkit": "~10.0.0-alpha.47",
9094
- "@geekmidas/errors": "~10.0.0-alpha.47",
9095
- "@geekmidas/events": "~10.0.0-alpha.47",
9096
- "@geekmidas/logger": "~10.0.0-alpha.47",
9097
- "@geekmidas/manifest": "~10.0.0-alpha.47",
9098
- "@geekmidas/rate-limit": "~10.0.0-alpha.47",
9099
- "@geekmidas/schema": "~10.0.0-alpha.47",
9100
- "@geekmidas/services": "~10.0.0-alpha.47",
9101
- "@geekmidas/storage": "~10.0.0-alpha.47",
9102
- "@geekmidas/studio": "~10.0.0-alpha.47",
9103
- "@geekmidas/telescope": "~10.0.0-alpha.47",
9104
- "@geekmidas/testkit": "~10.0.0-alpha.47",
9126
+ "@geekmidas/audit": "~10.0.0-alpha.48",
9127
+ "@geekmidas/auth": "~10.0.0-alpha.48",
9128
+ "@geekmidas/cache": "~10.0.0-alpha.48",
9129
+ "@geekmidas/client": "~10.0.0-alpha.48",
9130
+ "@geekmidas/cloud": "~10.0.0-alpha.48",
9131
+ "@geekmidas/constructs": "~10.0.0-alpha.48",
9132
+ "@geekmidas/db": "~10.0.0-alpha.48",
9133
+ "@geekmidas/emailkit": "~10.0.0-alpha.48",
9134
+ "@geekmidas/envkit": "~10.0.0-alpha.48",
9135
+ "@geekmidas/errors": "~10.0.0-alpha.48",
9136
+ "@geekmidas/events": "~10.0.0-alpha.48",
9137
+ "@geekmidas/logger": "~10.0.0-alpha.48",
9138
+ "@geekmidas/manifest": "~10.0.0-alpha.48",
9139
+ "@geekmidas/rate-limit": "~10.0.0-alpha.48",
9140
+ "@geekmidas/schema": "~10.0.0-alpha.48",
9141
+ "@geekmidas/services": "~10.0.0-alpha.48",
9142
+ "@geekmidas/storage": "~10.0.0-alpha.48",
9143
+ "@geekmidas/studio": "~10.0.0-alpha.48",
9144
+ "@geekmidas/telescope": "~10.0.0-alpha.48",
9145
+ "@geekmidas/testkit": "~10.0.0-alpha.48",
9105
9146
  "@geekmidas/cli": `~${loadPackageJson().version}`
9106
9147
  };
9107
9148
  //#endregion