alchemy 2.0.0-beta.35 → 2.0.0-beta.36
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/bin/exec.js +27 -0
- package/bin/exec.js.map +1 -1
- package/lib/Cli/main.d.ts.map +1 -1
- package/lib/Cli/main.js +2 -0
- package/lib/Cli/main.js.map +1 -1
- package/lib/Cloudflare/Images/Images.d.ts +103 -0
- package/lib/Cloudflare/Images/Images.d.ts.map +1 -0
- package/lib/Cloudflare/Images/Images.js +82 -0
- package/lib/Cloudflare/Images/Images.js.map +1 -0
- package/lib/Cloudflare/Images/ImagesBinding.d.ts +73 -0
- package/lib/Cloudflare/Images/ImagesBinding.d.ts.map +1 -0
- package/lib/Cloudflare/Images/ImagesBinding.js +83 -0
- package/lib/Cloudflare/Images/ImagesBinding.js.map +1 -0
- package/lib/Cloudflare/Images/index.d.ts +3 -0
- package/lib/Cloudflare/Images/index.d.ts.map +1 -0
- package/lib/Cloudflare/Images/index.js +3 -0
- package/lib/Cloudflare/Images/index.js.map +1 -0
- package/lib/Cloudflare/Providers.d.ts.map +1 -1
- package/lib/Cloudflare/Providers.js +3 -1
- package/lib/Cloudflare/Providers.js.map +1 -1
- package/lib/Cloudflare/R2/R2Bucket.d.ts +135 -0
- package/lib/Cloudflare/R2/R2Bucket.d.ts.map +1 -1
- package/lib/Cloudflare/R2/R2Bucket.js +130 -7
- package/lib/Cloudflare/R2/R2Bucket.js.map +1 -1
- package/lib/Cloudflare/Workers/InferEnv.d.ts +1 -1
- package/lib/Cloudflare/Workers/InferEnv.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Worker.d.ts +5 -5
- package/lib/Cloudflare/Workers/Worker.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Worker.js +34 -23
- package/lib/Cloudflare/Workers/Worker.js.map +1 -1
- package/lib/Cloudflare/index.d.ts +1 -0
- package/lib/Cloudflare/index.d.ts.map +1 -1
- package/lib/Cloudflare/index.js +1 -0
- package/lib/Cloudflare/index.js.map +1 -1
- package/lib/Test/Vitest.d.ts.map +1 -1
- package/lib/Test/Vitest.js +2 -0
- package/lib/Test/Vitest.js.map +1 -1
- package/lib/Util/LocalhostDns.d.ts +19 -0
- package/lib/Util/LocalhostDns.d.ts.map +1 -0
- package/lib/Util/LocalhostDns.js +55 -0
- package/lib/Util/LocalhostDns.js.map +1 -0
- package/lib/Util/PlatformServices.d.ts.map +1 -1
- package/lib/Util/PlatformServices.js +2 -0
- package/lib/Util/PlatformServices.js.map +1 -1
- package/lib/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +2 -1
- package/src/Cli/main.ts +3 -0
- package/src/Cloudflare/Images/Images.ts +121 -0
- package/src/Cloudflare/Images/ImagesBinding.ts +192 -0
- package/src/Cloudflare/Images/index.ts +2 -0
- package/src/Cloudflare/Providers.ts +3 -0
- package/src/Cloudflare/R2/R2Bucket.ts +240 -7
- package/src/Cloudflare/Workers/InferEnv.ts +7 -3
- package/src/Cloudflare/Workers/Worker.ts +47 -28
- package/src/Cloudflare/index.ts +1 -0
- package/src/Test/Vitest.ts +3 -0
- package/src/Util/LocalhostDns.ts +58 -0
- package/src/Util/PlatformServices.ts +2 -0
package/bin/exec.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
1
2
|
import * as ConfigProvider from "effect/ConfigProvider";
|
|
2
3
|
import * as Effect from "effect/Effect";
|
|
3
4
|
import * as Layer from "effect/Layer";
|
|
@@ -144,6 +145,31 @@ const CredentialsStoreLive = Layer.effect(CredentialsStore, Effect.gen(function*
|
|
|
144
145
|
};
|
|
145
146
|
}));
|
|
146
147
|
|
|
148
|
+
//#endregion
|
|
149
|
+
//#region lib/Util/LocalhostDns.js
|
|
150
|
+
let installed = false;
|
|
151
|
+
const isLocalhost = (hostname) => hostname === "localhost" || hostname === "[::1]" || hostname.endsWith(".localhost");
|
|
152
|
+
const installLocalhostDns = () => {
|
|
153
|
+
if (installed) return;
|
|
154
|
+
installed = true;
|
|
155
|
+
if (typeof globalThis.Bun !== "undefined") return;
|
|
156
|
+
try {
|
|
157
|
+
const require = createRequire(import.meta.url);
|
|
158
|
+
const undici = require("undici");
|
|
159
|
+
const dns = require("node:dns");
|
|
160
|
+
undici.setGlobalDispatcher(new undici.Agent({ connect: { lookup: (hostname, options, cb) => {
|
|
161
|
+
if (isLocalhost(hostname)) {
|
|
162
|
+
if (options && options.all) return cb(null, [{
|
|
163
|
+
address: "127.0.0.1",
|
|
164
|
+
family: 4
|
|
165
|
+
}]);
|
|
166
|
+
return cb(null, "127.0.0.1", 4);
|
|
167
|
+
}
|
|
168
|
+
return dns.lookup(hostname, options, cb);
|
|
169
|
+
} } }));
|
|
170
|
+
} catch {}
|
|
171
|
+
};
|
|
172
|
+
|
|
147
173
|
//#endregion
|
|
148
174
|
//#region lib/Util/PlatformServices.js
|
|
149
175
|
const isBun = typeof Bun !== "undefined";
|
|
@@ -157,6 +183,7 @@ const PlatformServices = Effect.promise(async () => {
|
|
|
157
183
|
}
|
|
158
184
|
}).pipe(Layer.unwrap);
|
|
159
185
|
const runMain = (effect, options) => {
|
|
186
|
+
installLocalhostDns();
|
|
160
187
|
if (isBun) import("@effect/platform-bun/BunRuntime").then((BunRuntime) => BunRuntime.runMain(effect, options));
|
|
161
188
|
else import("@effect/platform-node/NodeRuntime").then((NodeRuntime) => NodeRuntime.runMain(effect, options));
|
|
162
189
|
};
|