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.
Files changed (58) hide show
  1. package/bin/exec.js +27 -0
  2. package/bin/exec.js.map +1 -1
  3. package/lib/Cli/main.d.ts.map +1 -1
  4. package/lib/Cli/main.js +2 -0
  5. package/lib/Cli/main.js.map +1 -1
  6. package/lib/Cloudflare/Images/Images.d.ts +103 -0
  7. package/lib/Cloudflare/Images/Images.d.ts.map +1 -0
  8. package/lib/Cloudflare/Images/Images.js +82 -0
  9. package/lib/Cloudflare/Images/Images.js.map +1 -0
  10. package/lib/Cloudflare/Images/ImagesBinding.d.ts +73 -0
  11. package/lib/Cloudflare/Images/ImagesBinding.d.ts.map +1 -0
  12. package/lib/Cloudflare/Images/ImagesBinding.js +83 -0
  13. package/lib/Cloudflare/Images/ImagesBinding.js.map +1 -0
  14. package/lib/Cloudflare/Images/index.d.ts +3 -0
  15. package/lib/Cloudflare/Images/index.d.ts.map +1 -0
  16. package/lib/Cloudflare/Images/index.js +3 -0
  17. package/lib/Cloudflare/Images/index.js.map +1 -0
  18. package/lib/Cloudflare/Providers.d.ts.map +1 -1
  19. package/lib/Cloudflare/Providers.js +3 -1
  20. package/lib/Cloudflare/Providers.js.map +1 -1
  21. package/lib/Cloudflare/R2/R2Bucket.d.ts +135 -0
  22. package/lib/Cloudflare/R2/R2Bucket.d.ts.map +1 -1
  23. package/lib/Cloudflare/R2/R2Bucket.js +130 -7
  24. package/lib/Cloudflare/R2/R2Bucket.js.map +1 -1
  25. package/lib/Cloudflare/Workers/InferEnv.d.ts +1 -1
  26. package/lib/Cloudflare/Workers/InferEnv.d.ts.map +1 -1
  27. package/lib/Cloudflare/Workers/Worker.d.ts +5 -5
  28. package/lib/Cloudflare/Workers/Worker.d.ts.map +1 -1
  29. package/lib/Cloudflare/Workers/Worker.js +34 -23
  30. package/lib/Cloudflare/Workers/Worker.js.map +1 -1
  31. package/lib/Cloudflare/index.d.ts +1 -0
  32. package/lib/Cloudflare/index.d.ts.map +1 -1
  33. package/lib/Cloudflare/index.js +1 -0
  34. package/lib/Cloudflare/index.js.map +1 -1
  35. package/lib/Test/Vitest.d.ts.map +1 -1
  36. package/lib/Test/Vitest.js +2 -0
  37. package/lib/Test/Vitest.js.map +1 -1
  38. package/lib/Util/LocalhostDns.d.ts +19 -0
  39. package/lib/Util/LocalhostDns.d.ts.map +1 -0
  40. package/lib/Util/LocalhostDns.js +55 -0
  41. package/lib/Util/LocalhostDns.js.map +1 -0
  42. package/lib/Util/PlatformServices.d.ts.map +1 -1
  43. package/lib/Util/PlatformServices.js +2 -0
  44. package/lib/Util/PlatformServices.js.map +1 -1
  45. package/lib/tsconfig.test.tsbuildinfo +1 -1
  46. package/package.json +2 -1
  47. package/src/Cli/main.ts +3 -0
  48. package/src/Cloudflare/Images/Images.ts +121 -0
  49. package/src/Cloudflare/Images/ImagesBinding.ts +192 -0
  50. package/src/Cloudflare/Images/index.ts +2 -0
  51. package/src/Cloudflare/Providers.ts +3 -0
  52. package/src/Cloudflare/R2/R2Bucket.ts +240 -7
  53. package/src/Cloudflare/Workers/InferEnv.ts +7 -3
  54. package/src/Cloudflare/Workers/Worker.ts +47 -28
  55. package/src/Cloudflare/index.ts +1 -0
  56. package/src/Test/Vitest.ts +3 -0
  57. package/src/Util/LocalhostDns.ts +58 -0
  58. 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
  };