node9-ai 1.11.13 → 1.12.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/README.md +1 -1
- package/bin/node9.js +21 -5
- package/package.json +1 -1
package/README.md
CHANGED
package/bin/node9.js
CHANGED
|
@@ -1,15 +1,31 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { spawnSync } from 'child_process';
|
|
3
|
-
import path from 'path';
|
|
4
3
|
import { fileURLToPath } from 'url';
|
|
4
|
+
import path from 'path';
|
|
5
5
|
import fs from 'fs';
|
|
6
6
|
|
|
7
|
-
// Locate @node9/proxy's
|
|
7
|
+
// Locate @node9/proxy's cli.js by walking candidate paths.
|
|
8
|
+
// createRequire('@node9/proxy/dist/cli.js') would be cleaner but
|
|
9
|
+
// @node9/proxy's package.json has a strict exports map that blocks
|
|
10
|
+
// every subpath except '.' — so we resolve by filesystem.
|
|
11
|
+
//
|
|
12
|
+
// npm v7+ hoists @node9/proxy alongside node9-ai in the same
|
|
13
|
+
// node_modules; older setups and pnpm may nest it. Both covered.
|
|
8
14
|
const here = fileURLToPath(new URL('.', import.meta.url));
|
|
9
|
-
const
|
|
15
|
+
const candidates = [
|
|
16
|
+
// hoisted: node_modules/@node9/proxy/... (npm default)
|
|
17
|
+
path.resolve(here, '..', '..', '@node9', 'proxy', 'dist', 'cli.js'),
|
|
18
|
+
// nested: node_modules/node9-ai/node_modules/@node9/proxy/...
|
|
19
|
+
path.resolve(here, '..', 'node_modules', '@node9', 'proxy', 'dist', 'cli.js'),
|
|
20
|
+
];
|
|
21
|
+
const proxyBin = candidates.find((p) => fs.existsSync(p));
|
|
10
22
|
|
|
11
|
-
if (!
|
|
12
|
-
process.stderr.write(
|
|
23
|
+
if (!proxyBin) {
|
|
24
|
+
process.stderr.write(
|
|
25
|
+
'node9: could not locate @node9/proxy. Searched:\n' +
|
|
26
|
+
candidates.map((c) => ' ' + c).join('\n') +
|
|
27
|
+
'\nTry `npm install -g node9-ai` again, or file an issue at https://github.com/node9-ai/node9-proxy\n'
|
|
28
|
+
);
|
|
13
29
|
process.exit(1);
|
|
14
30
|
}
|
|
15
31
|
|