@creatorem/cli 1.0.4 → 1.0.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@creatorem/cli",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "CLI tool for Creatorem SaaS Kit",
5
5
  "author": "Creatorem",
6
6
  "license": "MIT",
@@ -1,9 +1,32 @@
1
- // Bypass the alias by importing from the specific file in node_modules
2
- // We use a relative path that we hope resolves correctly from dist/
3
- // But since we are bundling, we need the path relative to THIS file (src/shims/signal-exit.js)
4
- // AND we need to make sure esbuild doesn't treat it as the aliased package.
5
- // Using a relative path to node_modules/signal-exit/dist/mjs/index.js usually works.
6
- import { onExit, load, unload } from '../../node_modules/signal-exit/dist/mjs/index.js';
1
+ import { createRequire } from 'module';
2
+
3
+ const require = createRequire(import.meta.url);
4
+
5
+ function resolveSignalExitModule() {
6
+ // Try direct package first, then common nested locations used by pnpm trees.
7
+ const candidates = [
8
+ 'signal-exit',
9
+ 'execa/node_modules/signal-exit',
10
+ 'foreground-child/node_modules/signal-exit',
11
+ ];
12
+
13
+ for (const modId of candidates) {
14
+ try {
15
+ return require(modId);
16
+ } catch {
17
+ // try next candidate
18
+ }
19
+ }
20
+
21
+ throw new Error('Could not resolve signal-exit from known locations');
22
+ }
23
+
24
+ const signalExit = resolveSignalExitModule();
25
+
26
+ // v4 exports named onExit/load/unload. v3 exports a function with load/unload props.
27
+ const onExit = signalExit.onExit ?? signalExit.default ?? signalExit;
28
+ const load = signalExit.load ?? (() => {});
29
+ const unload = signalExit.unload ?? (() => {});
7
30
 
8
31
  export default onExit;
9
32
  export { onExit, load, unload };