dimcode 0.0.37 → 0.0.39
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/cli.mjs +28 -0
- package/dist/cli.mjs +437 -437
- package/dist/next-api-oauth.json +1 -1
- package/package.json +2 -1
package/cli.mjs
CHANGED
|
@@ -27,6 +27,33 @@ function canRelayToBunSource() {
|
|
|
27
27
|
return probe.status === 0
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
async function installEnvProxyDispatcher() {
|
|
31
|
+
// Node's native fetch (undici) ignores HTTP_PROXY/HTTPS_PROXY env vars unless
|
|
32
|
+
// a proxy-aware dispatcher is installed. Bun's fetch honors them natively, so
|
|
33
|
+
// this is only needed on the Node-bundled path. Skip silently if no proxy env
|
|
34
|
+
// is set, or if undici is unavailable.
|
|
35
|
+
const env = process.env
|
|
36
|
+
const hasProxyEnv = Boolean(
|
|
37
|
+
env.HTTP_PROXY || env.http_proxy
|
|
38
|
+
|| env.HTTPS_PROXY || env.https_proxy
|
|
39
|
+
|| env.NO_PROXY || env.no_proxy,
|
|
40
|
+
)
|
|
41
|
+
if (!hasProxyEnv)
|
|
42
|
+
return
|
|
43
|
+
try {
|
|
44
|
+
const { setGlobalDispatcher, EnvHttpProxyAgent } = await import('undici')
|
|
45
|
+
setGlobalDispatcher(new EnvHttpProxyAgent())
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
if (env.DIMCODE_DEBUG === '1' || env.DIMCODE_DEBUG === 'true') {
|
|
49
|
+
console.error(
|
|
50
|
+
'[dimcode] failed to install EnvHttpProxyAgent:',
|
|
51
|
+
err instanceof Error ? err.message : String(err),
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
30
57
|
async function relayToBunSource() {
|
|
31
58
|
const child = spawn(resolveBunCommand(), [cliPath, ...process.argv.slice(2)], {
|
|
32
59
|
stdio: 'inherit',
|
|
@@ -67,5 +94,6 @@ else if (canRelayToBunSource()) {
|
|
|
67
94
|
await relayToBunSource()
|
|
68
95
|
}
|
|
69
96
|
else {
|
|
97
|
+
await installEnvProxyDispatcher()
|
|
70
98
|
await import(bundledEntryUrl)
|
|
71
99
|
}
|