alchemy 0.65.1 → 0.67.0

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 (185) hide show
  1. package/bin/alchemy.js +139 -79
  2. package/bin/commands/init.ts +6 -3
  3. package/bin/services/cdp-manager/server.ts +3 -2
  4. package/bin/services/execute-alchemy.ts +33 -3
  5. package/bin/services/find-workspace-root.ts +48 -0
  6. package/lib/alchemy.d.ts +20 -3
  7. package/lib/alchemy.d.ts.map +1 -1
  8. package/lib/alchemy.js +18 -5
  9. package/lib/alchemy.js.map +1 -1
  10. package/lib/apply.d.ts.map +1 -1
  11. package/lib/apply.js +51 -1
  12. package/lib/apply.js.map +1 -1
  13. package/lib/cloudflare/bindings.d.ts +17 -5
  14. package/lib/cloudflare/bindings.d.ts.map +1 -1
  15. package/lib/cloudflare/bindings.js +3 -1
  16. package/lib/cloudflare/bindings.js.map +1 -1
  17. package/lib/cloudflare/bound.d.ts +4 -3
  18. package/lib/cloudflare/bound.d.ts.map +1 -1
  19. package/lib/cloudflare/bucket.js +1 -1
  20. package/lib/cloudflare/bucket.js.map +1 -1
  21. package/lib/cloudflare/bundle/internal-worker-bundle.d.ts +1 -1
  22. package/lib/cloudflare/bundle/internal-worker-bundle.d.ts.map +1 -1
  23. package/lib/cloudflare/bundle/internal-worker-bundle.js.map +1 -1
  24. package/lib/cloudflare/cloudflare-env-proxy.js +3 -3
  25. package/lib/cloudflare/cloudflare-env-proxy.js.map +1 -1
  26. package/lib/cloudflare/compatibility-date.gen.d.ts +1 -1
  27. package/lib/cloudflare/compatibility-date.gen.js +1 -1
  28. package/lib/cloudflare/d1-database.d.ts.map +1 -1
  29. package/lib/cloudflare/d1-database.js +2 -1
  30. package/lib/cloudflare/d1-database.js.map +1 -1
  31. package/lib/cloudflare/d1-local-migrations.d.ts +1 -0
  32. package/lib/cloudflare/d1-local-migrations.d.ts.map +1 -1
  33. package/lib/cloudflare/d1-local-migrations.js +3 -2
  34. package/lib/cloudflare/d1-local-migrations.js.map +1 -1
  35. package/lib/cloudflare/hyperdrive-ref.d.ts +23 -0
  36. package/lib/cloudflare/hyperdrive-ref.d.ts.map +1 -0
  37. package/lib/cloudflare/hyperdrive-ref.js +52 -0
  38. package/lib/cloudflare/hyperdrive-ref.js.map +1 -0
  39. package/lib/cloudflare/index.d.ts +2 -0
  40. package/lib/cloudflare/index.d.ts.map +1 -1
  41. package/lib/cloudflare/index.js +2 -0
  42. package/lib/cloudflare/index.js.map +1 -1
  43. package/lib/cloudflare/kv-namespace.js +1 -1
  44. package/lib/cloudflare/kv-namespace.js.map +1 -1
  45. package/lib/cloudflare/miniflare/build-worker-options.d.ts +2 -1
  46. package/lib/cloudflare/miniflare/build-worker-options.d.ts.map +1 -1
  47. package/lib/cloudflare/miniflare/build-worker-options.js +11 -6
  48. package/lib/cloudflare/miniflare/build-worker-options.js.map +1 -1
  49. package/lib/cloudflare/miniflare/delete.d.ts +3 -2
  50. package/lib/cloudflare/miniflare/delete.d.ts.map +1 -1
  51. package/lib/cloudflare/miniflare/delete.js +13 -12
  52. package/lib/cloudflare/miniflare/delete.js.map +1 -1
  53. package/lib/cloudflare/miniflare/miniflare-controller.d.ts +3 -1
  54. package/lib/cloudflare/miniflare/miniflare-controller.d.ts.map +1 -1
  55. package/lib/cloudflare/miniflare/miniflare-controller.js +29 -13
  56. package/lib/cloudflare/miniflare/miniflare-controller.js.map +1 -1
  57. package/lib/cloudflare/miniflare/miniflare-worker-proxy.d.ts +24 -13
  58. package/lib/cloudflare/miniflare/miniflare-worker-proxy.d.ts.map +1 -1
  59. package/lib/cloudflare/miniflare/miniflare-worker-proxy.js +95 -79
  60. package/lib/cloudflare/miniflare/miniflare-worker-proxy.js.map +1 -1
  61. package/lib/cloudflare/miniflare/paths.d.ts +4 -4
  62. package/lib/cloudflare/miniflare/paths.d.ts.map +1 -1
  63. package/lib/cloudflare/miniflare/paths.js +10 -4
  64. package/lib/cloudflare/miniflare/paths.js.map +1 -1
  65. package/lib/cloudflare/miniflare/symlink-miniflare-state.d.ts +2 -0
  66. package/lib/cloudflare/miniflare/symlink-miniflare-state.d.ts.map +1 -0
  67. package/lib/cloudflare/miniflare/symlink-miniflare-state.js +19 -0
  68. package/lib/cloudflare/miniflare/symlink-miniflare-state.js.map +1 -0
  69. package/lib/cloudflare/miniflare/tunnel.d.ts +18 -0
  70. package/lib/cloudflare/miniflare/tunnel.d.ts.map +1 -0
  71. package/lib/cloudflare/miniflare/tunnel.js +79 -0
  72. package/lib/cloudflare/miniflare/tunnel.js.map +1 -0
  73. package/lib/cloudflare/next.d.ts.map +1 -1
  74. package/lib/cloudflare/next.js +3 -0
  75. package/lib/cloudflare/next.js.map +1 -1
  76. package/lib/cloudflare/nuxt/plugin.d.ts.map +1 -1
  77. package/lib/cloudflare/nuxt/plugin.js +3 -3
  78. package/lib/cloudflare/nuxt/plugin.js.map +1 -1
  79. package/lib/cloudflare/quick-tunnel.d.ts +1 -1
  80. package/lib/cloudflare/redwood/plugin.js +2 -2
  81. package/lib/cloudflare/redwood/plugin.js.map +1 -1
  82. package/lib/cloudflare/secret-ref.d.ts +38 -0
  83. package/lib/cloudflare/secret-ref.d.ts.map +1 -0
  84. package/lib/cloudflare/secret-ref.js +38 -0
  85. package/lib/cloudflare/secret-ref.js.map +1 -0
  86. package/lib/cloudflare/vite/plugin.d.ts.map +1 -1
  87. package/lib/cloudflare/vite/plugin.js +6 -3
  88. package/lib/cloudflare/vite/plugin.js.map +1 -1
  89. package/lib/cloudflare/website.d.ts.map +1 -1
  90. package/lib/cloudflare/website.js +5 -16
  91. package/lib/cloudflare/website.js.map +1 -1
  92. package/lib/cloudflare/worker-metadata.d.ts +1 -1
  93. package/lib/cloudflare/worker-metadata.d.ts.map +1 -1
  94. package/lib/cloudflare/worker-metadata.js +7 -9
  95. package/lib/cloudflare/worker-metadata.js.map +1 -1
  96. package/lib/cloudflare/worker.d.ts +16 -1
  97. package/lib/cloudflare/worker.d.ts.map +1 -1
  98. package/lib/cloudflare/worker.js +16 -2
  99. package/lib/cloudflare/worker.js.map +1 -1
  100. package/lib/cloudflare/wrangler.json.d.ts +2 -1
  101. package/lib/cloudflare/wrangler.json.d.ts.map +1 -1
  102. package/lib/cloudflare/wrangler.json.js +5 -6
  103. package/lib/cloudflare/wrangler.json.js.map +1 -1
  104. package/lib/llms.cloudflare.txt +1 -1
  105. package/lib/scope.d.ts +26 -1
  106. package/lib/scope.d.ts.map +1 -1
  107. package/lib/scope.js +12 -5
  108. package/lib/scope.js.map +1 -1
  109. package/lib/state/file-system-state-store.d.ts.map +1 -1
  110. package/lib/state/file-system-state-store.js +1 -2
  111. package/lib/state/file-system-state-store.js.map +1 -1
  112. package/lib/state/sqlite-state-store.d.ts +11 -0
  113. package/lib/state/sqlite-state-store.d.ts.map +1 -1
  114. package/lib/state/sqlite-state-store.js +22 -14
  115. package/lib/state/sqlite-state-store.js.map +1 -1
  116. package/lib/stripe/customer.d.ts +0 -8
  117. package/lib/stripe/customer.d.ts.map +1 -1
  118. package/lib/stripe/customer.js +0 -6
  119. package/lib/stripe/customer.js.map +1 -1
  120. package/lib/stripe/price.d.ts +23 -23
  121. package/lib/stripe/price.d.ts.map +1 -1
  122. package/lib/stripe/price.js +6 -22
  123. package/lib/stripe/price.js.map +1 -1
  124. package/lib/test/vitest.d.ts.map +1 -1
  125. package/lib/test/vitest.js +1 -1
  126. package/lib/test/vitest.js.map +1 -1
  127. package/lib/util/assert-never.js +1 -1
  128. package/lib/util/assert-never.js.map +1 -1
  129. package/lib/util/cli.d.ts.map +1 -1
  130. package/lib/util/cli.js +12 -13
  131. package/lib/util/cli.js.map +1 -1
  132. package/lib/util/idempotent-spawn.d.ts.map +1 -1
  133. package/lib/util/idempotent-spawn.js +5 -8
  134. package/lib/util/idempotent-spawn.js.map +1 -1
  135. package/lib/util/root-dir.d.ts +2 -0
  136. package/lib/util/root-dir.d.ts.map +1 -0
  137. package/lib/util/root-dir.js +2 -0
  138. package/lib/util/root-dir.js.map +1 -0
  139. package/package.json +4 -4
  140. package/src/alchemy.ts +43 -8
  141. package/src/apply.ts +58 -3
  142. package/src/cloudflare/bindings.ts +21 -4
  143. package/src/cloudflare/bound.ts +50 -52
  144. package/src/cloudflare/bucket.ts +1 -1
  145. package/src/cloudflare/bundle/internal-worker-bundle.ts +2 -1
  146. package/src/cloudflare/cloudflare-env-proxy.ts +5 -5
  147. package/src/cloudflare/compatibility-date.gen.ts +1 -1
  148. package/src/cloudflare/d1-database.ts +2 -1
  149. package/src/cloudflare/d1-local-migrations.ts +10 -6
  150. package/src/cloudflare/hyperdrive-ref.ts +98 -0
  151. package/src/cloudflare/index.ts +2 -0
  152. package/src/cloudflare/kv-namespace.ts +1 -1
  153. package/src/cloudflare/miniflare/build-worker-options.ts +21 -12
  154. package/src/cloudflare/miniflare/delete.ts +19 -11
  155. package/src/cloudflare/miniflare/miniflare-controller.ts +33 -14
  156. package/src/cloudflare/miniflare/miniflare-worker-proxy.ts +122 -102
  157. package/src/cloudflare/miniflare/paths.ts +11 -7
  158. package/src/cloudflare/miniflare/symlink-miniflare-state.ts +19 -0
  159. package/src/cloudflare/miniflare/tunnel.ts +116 -0
  160. package/src/cloudflare/next.ts +3 -0
  161. package/src/cloudflare/nuxt/plugin.ts +12 -3
  162. package/src/cloudflare/redwood/plugin.ts +2 -2
  163. package/src/cloudflare/secret-ref.ts +56 -0
  164. package/src/cloudflare/vite/plugin.ts +8 -3
  165. package/src/cloudflare/website.ts +5 -19
  166. package/src/cloudflare/worker-metadata.ts +14 -12
  167. package/src/cloudflare/worker.ts +36 -3
  168. package/src/cloudflare/wrangler.json.ts +14 -11
  169. package/src/llms.cloudflare.txt +1 -1
  170. package/src/scope.ts +38 -6
  171. package/src/state/file-system-state-store.ts +1 -2
  172. package/src/state/sqlite-state-store.ts +41 -14
  173. package/src/stripe/customer.ts +0 -14
  174. package/src/stripe/price.ts +59 -56
  175. package/src/test/vitest.ts +4 -1
  176. package/src/util/assert-never.ts +1 -1
  177. package/src/util/cli.ts +15 -13
  178. package/src/util/idempotent-spawn.ts +5 -6
  179. package/src/util/root-dir.ts +1 -0
  180. package/templates/nextjs/alchemy.run.ts +2 -2
  181. package/templates/rwsdk/.cursor/rules/alchemy_cloudflare.mdc +1 -1
  182. package/templates/rwsdk/package.json +3 -3
  183. package/workers/cloudflare-state-store.js +1 -1
  184. package/workers/tunnel-proxy.js +110 -0
  185. package/workers/tunnel-proxy.ts +121 -0
package/bin/alchemy.js CHANGED
@@ -25541,7 +25541,7 @@ var require_polyfills = /* @__PURE__ */ __commonJS$1({ "../node_modules/.bun/gra
25541
25541
  return rename$1;
25542
25542
  })(fs$36.rename);
25543
25543
  fs$36.read = typeof fs$36.read !== "function" ? fs$36.read : (function(fs$read) {
25544
- function read$4(fd, buffer, offset, length, position, callback_) {
25544
+ function read$5(fd, buffer, offset, length, position, callback_) {
25545
25545
  var callback;
25546
25546
  if (callback_ && typeof callback_ === "function") {
25547
25547
  var eagCounter = 0;
@@ -25555,8 +25555,8 @@ var require_polyfills = /* @__PURE__ */ __commonJS$1({ "../node_modules/.bun/gra
25555
25555
  }
25556
25556
  return fs$read.call(fs$36, fd, buffer, offset, length, position, callback);
25557
25557
  }
25558
- if (Object.setPrototypeOf) Object.setPrototypeOf(read$4, fs$read);
25559
- return read$4;
25558
+ if (Object.setPrototypeOf) Object.setPrototypeOf(read$5, fs$read);
25559
+ return read$5;
25560
25560
  })(fs$36.read);
25561
25561
  fs$36.readSync = typeof fs$36.readSync !== "function" ? fs$36.readSync : (function(fs$readSync) {
25562
25562
  return function(fd, buffer, offset, length, position) {
@@ -26945,8 +26945,8 @@ var require_symlink_paths = /* @__PURE__ */ __commonJS$1({ "../node_modules/.bun
26945
26945
  }
26946
26946
  const dstdir = path$24.dirname(dstpath);
26947
26947
  const relativeToDst = path$24.join(dstdir, srcpath);
26948
- const exists$1 = await pathExists$3(relativeToDst);
26949
- if (exists$1) return {
26948
+ const exists$2 = await pathExists$3(relativeToDst);
26949
+ if (exists$2) return {
26950
26950
  toCwd: relativeToDst,
26951
26951
  toDst: srcpath
26952
26952
  };
@@ -26963,8 +26963,8 @@ var require_symlink_paths = /* @__PURE__ */ __commonJS$1({ "../node_modules/.bun
26963
26963
  }
26964
26964
  function symlinkPathsSync$1(srcpath, dstpath) {
26965
26965
  if (path$24.isAbsolute(srcpath)) {
26966
- const exists$2 = fs$22.existsSync(srcpath);
26967
- if (!exists$2) throw new Error("absolute srcpath does not exist");
26966
+ const exists$3 = fs$22.existsSync(srcpath);
26967
+ if (!exists$3) throw new Error("absolute srcpath does not exist");
26968
26968
  return {
26969
26969
  toCwd: srcpath,
26970
26970
  toDst: srcpath
@@ -26972,8 +26972,8 @@ var require_symlink_paths = /* @__PURE__ */ __commonJS$1({ "../node_modules/.bun
26972
26972
  }
26973
26973
  const dstdir = path$24.dirname(dstpath);
26974
26974
  const relativeToDst = path$24.join(dstdir, srcpath);
26975
- const exists$1 = fs$22.existsSync(relativeToDst);
26976
- if (exists$1) return {
26975
+ const exists$2 = fs$22.existsSync(relativeToDst);
26976
+ if (exists$2) return {
26977
26977
  toCwd: relativeToDst,
26978
26978
  toDst: srcpath
26979
26979
  };
@@ -27062,8 +27062,8 @@ var require_symlink = /* @__PURE__ */ __commonJS$1({ "../node_modules/.bun/fs-ex
27062
27062
  srcpath = relative$2.toDst;
27063
27063
  type$1 = symlinkTypeSync(relative$2.toCwd, type$1);
27064
27064
  const dir = path$23.dirname(dstpath);
27065
- const exists$1 = fs$20.existsSync(dir);
27066
- if (exists$1) return fs$20.symlinkSync(srcpath, dstpath, type$1);
27065
+ const exists$2 = fs$20.existsSync(dir);
27066
+ if (exists$2) return fs$20.symlinkSync(srcpath, dstpath, type$1);
27067
27067
  mkdirsSync(dir);
27068
27068
  return fs$20.symlinkSync(srcpath, dstpath, type$1);
27069
27069
  }
@@ -44007,7 +44007,7 @@ const createReadable = ({ subprocess, concurrentStreams, encoding }, { from, bin
44007
44007
  const binary = binaryOption || BINARY_ENCODINGS.has(encoding);
44008
44008
  const { subprocessStdout, waitReadableDestroy } = getSubprocessStdout(subprocess, from, concurrentStreams);
44009
44009
  const { readableEncoding, readableObjectMode, readableHighWaterMark } = getReadableOptions(subprocessStdout, binary);
44010
- const { read: read$4, onStdoutDataDone } = getReadableMethods({
44010
+ const { read: read$5, onStdoutDataDone } = getReadableMethods({
44011
44011
  subprocessStdout,
44012
44012
  subprocess,
44013
44013
  binary,
@@ -44015,7 +44015,7 @@ const createReadable = ({ subprocess, concurrentStreams, encoding }, { from, bin
44015
44015
  preserveNewlines
44016
44016
  });
44017
44017
  const readable$1 = new Readable({
44018
- read: read$4,
44018
+ read: read$5,
44019
44019
  destroy: callbackify(onReadableDestroy.bind(void 0, {
44020
44020
  subprocessStdout,
44021
44021
  subprocess,
@@ -44165,7 +44165,7 @@ const createDuplex = ({ subprocess, concurrentStreams, encoding }, { from, to, b
44165
44165
  const { subprocessStdout, waitReadableDestroy } = getSubprocessStdout(subprocess, from, concurrentStreams);
44166
44166
  const { subprocessStdin, waitWritableFinal, waitWritableDestroy } = getSubprocessStdin(subprocess, to, concurrentStreams);
44167
44167
  const { readableEncoding, readableObjectMode, readableHighWaterMark } = getReadableOptions(subprocessStdout, binary);
44168
- const { read: read$4, onStdoutDataDone } = getReadableMethods({
44168
+ const { read: read$5, onStdoutDataDone } = getReadableMethods({
44169
44169
  subprocessStdout,
44170
44170
  subprocess,
44171
44171
  binary,
@@ -44173,7 +44173,7 @@ const createDuplex = ({ subprocess, concurrentStreams, encoding }, { from, to, b
44173
44173
  preserveNewlines
44174
44174
  });
44175
44175
  const duplex$1 = new Duplex({
44176
- read: read$4,
44176
+ read: read$5,
44177
44177
  ...getWritableMethods(subprocessStdin, subprocess, waitWritableFinal),
44178
44178
  destroy: callbackify(onDuplexDestroy.bind(void 0, {
44179
44179
  subprocessStdout,
@@ -48869,7 +48869,7 @@ var require_tasks = /* @__PURE__ */ __commonJS$1({ "../node_modules/.bun/fast-gl
48869
48869
  var require_async$5 = /* @__PURE__ */ __commonJS$1({ "../node_modules/.bun/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/providers/async.js": ((exports) => {
48870
48870
  Object.defineProperty(exports, "__esModule", { value: true });
48871
48871
  exports.read = void 0;
48872
- function read$3(path$33, settings, callback) {
48872
+ function read$4(path$33, settings, callback) {
48873
48873
  settings.fs.lstat(path$33, (lstatError, lstat) => {
48874
48874
  if (lstatError !== null) {
48875
48875
  callFailureCallback$2(callback, lstatError);
@@ -48893,7 +48893,7 @@ var require_async$5 = /* @__PURE__ */ __commonJS$1({ "../node_modules/.bun/@node
48893
48893
  });
48894
48894
  });
48895
48895
  }
48896
- exports.read = read$3;
48896
+ exports.read = read$4;
48897
48897
  function callFailureCallback$2(callback, error$81) {
48898
48898
  callback(error$81);
48899
48899
  }
@@ -48907,7 +48907,7 @@ var require_async$5 = /* @__PURE__ */ __commonJS$1({ "../node_modules/.bun/@node
48907
48907
  var require_sync$5 = /* @__PURE__ */ __commonJS$1({ "../node_modules/.bun/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/providers/sync.js": ((exports) => {
48908
48908
  Object.defineProperty(exports, "__esModule", { value: true });
48909
48909
  exports.read = void 0;
48910
- function read$2(path$33, settings) {
48910
+ function read$3(path$33, settings) {
48911
48911
  const lstat = settings.fs.lstatSync(path$33);
48912
48912
  if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) return lstat;
48913
48913
  try {
@@ -48919,7 +48919,7 @@ var require_sync$5 = /* @__PURE__ */ __commonJS$1({ "../node_modules/.bun/@nodel
48919
48919
  throw error$81;
48920
48920
  }
48921
48921
  }
48922
- exports.read = read$2;
48922
+ exports.read = read$3;
48923
48923
  }) });
48924
48924
 
48925
48925
  //#endregion
@@ -49119,14 +49119,14 @@ var require_async$4 = /* @__PURE__ */ __commonJS$1({ "../node_modules/.bun/@node
49119
49119
  const constants_1$1 = require_constants();
49120
49120
  const utils$8 = require_utils();
49121
49121
  const common$5 = require_common$1();
49122
- function read$1(directory, settings, callback) {
49122
+ function read$2(directory, settings, callback) {
49123
49123
  if (!settings.stats && constants_1$1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
49124
49124
  readdirWithFileTypes$1(directory, settings, callback);
49125
49125
  return;
49126
49126
  }
49127
49127
  readdir$1(directory, settings, callback);
49128
49128
  }
49129
- exports.read = read$1;
49129
+ exports.read = read$2;
49130
49130
  function readdirWithFileTypes$1(directory, settings, callback) {
49131
49131
  settings.fs.readdir(directory, { withFileTypes: true }, (readdirError, dirents) => {
49132
49132
  if (readdirError !== null) {
@@ -49224,11 +49224,11 @@ var require_sync$4 = /* @__PURE__ */ __commonJS$1({ "../node_modules/.bun/@nodel
49224
49224
  const constants_1 = require_constants();
49225
49225
  const utils$7 = require_utils();
49226
49226
  const common$4 = require_common$1();
49227
- function read(directory, settings) {
49227
+ function read$1(directory, settings) {
49228
49228
  if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) return readdirWithFileTypes(directory, settings);
49229
49229
  return readdir(directory, settings);
49230
49230
  }
49231
- exports.read = read;
49231
+ exports.read = read$1;
49232
49232
  function readdirWithFileTypes(directory, settings) {
49233
49233
  const dirents = settings.fs.readdirSync(directory, { withFileTypes: true });
49234
49234
  return dirents.map((dirent) => {
@@ -51366,7 +51366,7 @@ const POSTHOG_PROJECT_ID = process.env.ALCHEMY_POSTHOG_PROJECT_ID ?? "phc_A51Mi7
51366
51366
  //#endregion
51367
51367
  //#region package.json
51368
51368
  var name = "alchemy";
51369
- var version = "0.65.1";
51369
+ var version = "0.67.0";
51370
51370
  var license = "Apache-2.0";
51371
51371
  var author = "Sam Goodwin <sam@alchemy.run>";
51372
51372
  var homepage = "https://alchemy.run";
@@ -51524,7 +51524,7 @@ var dependencies = {
51524
51524
  "glob": "^10.0.0",
51525
51525
  "jszip": "^3.0.0",
51526
51526
  "libsodium-wrappers": "^0.7.15",
51527
- "miniflare": "^4.20250712.0",
51527
+ "miniflare": "^4.20250906.0",
51528
51528
  "neverthrow": "^8.2.0",
51529
51529
  "open": "^10.1.2",
51530
51530
  "openapi-types": "^12.1.3",
@@ -51553,7 +51553,7 @@ var peerDependencies = {
51553
51553
  "astro": "^5.13.2",
51554
51554
  "drizzle-orm": "^0.44.2",
51555
51555
  "rwsdk": "^0.1.36",
51556
- "stripe": "^17.0.0"
51556
+ "stripe": "^18.5.0"
51557
51557
  };
51558
51558
  var peerDependenciesMeta = {
51559
51559
  "@astrojs/cloudflare": { "optional": true },
@@ -51617,7 +51617,7 @@ var devDependencies = {
51617
51617
  "listr2": "^8.0.0",
51618
51618
  "nitropack": "^2.12.4",
51619
51619
  "rwsdk": "^0.1.36",
51620
- "stripe": "^17.0.0",
51620
+ "stripe": "^18.5.0",
51621
51621
  "trpc-cli": "^0.10.2",
51622
51622
  "ts-morph": "^26.0.0",
51623
51623
  "tsdown": "^0.14.2",
@@ -52361,10 +52361,14 @@ async function isPortAvailable(host, port) {
52361
52361
  });
52362
52362
  }
52363
52363
 
52364
+ //#endregion
52365
+ //#region src/util/root-dir.ts
52366
+ const ALCHEMY_ROOT = process.env.ALCHEMY_ROOT ?? process.cwd();
52367
+
52364
52368
  //#endregion
52365
52369
  //#region bin/services/cdp-manager/server.ts
52366
- const LOGS_DIRECTORY = path$1.join(process.cwd(), ".alchemy", "logs");
52367
- const DEBUGGER_URLS_FILE = path$1.join(process.cwd(), ".alchemy", ".debugger-urls");
52370
+ const LOGS_DIRECTORY = path$1.join(ALCHEMY_ROOT, ".alchemy", "logs");
52371
+ const DEBUGGER_URLS_FILE = path$1.join(ALCHEMY_ROOT, ".alchemy", ".debugger-urls");
52368
52372
  var CDPManager = class {
52369
52373
  server;
52370
52374
  url;
@@ -52513,6 +52517,27 @@ var CDPProxy = class extends CDPServer {
52513
52517
  }
52514
52518
  };
52515
52519
 
52520
+ //#endregion
52521
+ //#region bin/services/find-workspace-root.ts
52522
+ async function findWorkspaceRoot(dir = process.cwd()) {
52523
+ if ((await fs$1.stat(dir)).isDirectory()) {
52524
+ if (await exists$1(dir, ".git")) return dir;
52525
+ else if ((await read(dir, "package.json"))?.workspaces) return dir;
52526
+ else if (await anyExists(dir, ...rootFiles)) return dir;
52527
+ }
52528
+ return findWorkspaceRoot(path.resolve(dir, ".."));
52529
+ }
52530
+ const read = (...p$1) => fs$1.readFile(path.join(...p$1), "utf8").then(JSON.parse).catch(() => void 0);
52531
+ const exists$1 = (...p$1) => fs$1.access(path.join(...p$1)).then(() => true).catch(() => false);
52532
+ const anyExists = (base, ...files$1) => Promise.all(files$1.map((file$2) => exists$1(base, file$2))).then((results) => results.some(Boolean));
52533
+ const rootFiles = [
52534
+ "pnpm-workspace.yaml",
52535
+ "pnpm-workspace.yml",
52536
+ "lerna.json",
52537
+ "nx.json",
52538
+ "rush.json"
52539
+ ];
52540
+
52516
52541
  //#endregion
52517
52542
  //#region bin/services/execute-alchemy.ts
52518
52543
  const entrypoint = zod_default.string().optional().describe("Path to the entrypoint file");
@@ -52526,14 +52551,16 @@ const execArgs = {
52526
52551
  inspect: zod_default.boolean().optional().describe("Enable inspector"),
52527
52552
  inspectBrk: zod_default.boolean().optional().describe("Enable inspector and break on start"),
52528
52553
  inspectWait: zod_default.boolean().optional().describe("Enable inspector and wait for connection"),
52529
- envFile: zod_default.string().optional().default(".env").describe("Path to environment file to load")
52554
+ envFile: zod_default.string().optional().describe("Path to environment file to load"),
52555
+ app: zod_default.string().optional().describe("Select a specific application to target"),
52556
+ rootDir: zod_default.string().optional().describe("Path to the root directory of the project")
52530
52557
  };
52531
- async function execAlchemy(main, { cwd: cwd$1 = process.cwd(), quiet, force: force$1, stage, destroy: destroy$2, watch: watch$1, envFile, read: read$4, dev: dev$1, inspect: inspect$1, inspectBrk, inspectWait, adopt: adopt$1 }) {
52558
+ async function execAlchemy(main, { cwd: cwd$1 = process.cwd(), quiet, force: force$1, stage, destroy: destroy$2, watch: watch$1, envFile, read: read$5, dev: dev$1, inspect: inspect$1, inspectBrk, inspectWait, adopt: adopt$1, app, rootDir }) {
52532
52559
  const args = [];
52533
52560
  const execArgs$1 = [];
52534
52561
  const shouldInspect = (inspect$1 || inspectBrk || inspectWait) ?? false;
52535
52562
  if (quiet) args.push("--quiet");
52536
- if (read$4) args.push("--read");
52563
+ if (read$5) args.push("--read");
52537
52564
  if (force$1) args.push("--force");
52538
52565
  if (stage) args.push(`--stage ${stage}`);
52539
52566
  if (destroy$2) args.push("--destroy");
@@ -52547,6 +52574,22 @@ async function execAlchemy(main, { cwd: cwd$1 = process.cwd(), quiet, force: for
52547
52574
  if (inspectWait) execArgs$1.push("--inspect-wait");
52548
52575
  if (inspectBrk) execArgs$1.push("--inspect-brk");
52549
52576
  if (adopt$1) args.push("--adopt");
52577
+ if (app) args.push(`--app ${app}`);
52578
+ if (rootDir) args.push(`--root-dir ${rootDir}`);
52579
+ else if (app) {
52580
+ console.log("finding root dir");
52581
+ try {
52582
+ const rootDir$1 = await findWorkspaceRoot(cwd$1);
52583
+ args.push(`--root-dir ${rootDir$1}`);
52584
+ if (!envFile) {
52585
+ const rootEnv = resolve(rootDir$1, ".env");
52586
+ if (await exists(rootEnv)) execArgs$1.push(`--env-file ${rootEnv}`);
52587
+ }
52588
+ } catch (error$81) {
52589
+ console.error("error finding monorepo root", error$81);
52590
+ throw error$81;
52591
+ }
52592
+ }
52550
52593
  if (!main) {
52551
52594
  const candidates = [
52552
52595
  "alchemy.run.ts",
@@ -53306,14 +53349,13 @@ async function ignore(codes, fn) {
53306
53349
 
53307
53350
  //#endregion
53308
53351
  //#region src/state/file-system-state-store.ts
53309
- const stateRootDir = path.join(process.cwd(), ".alchemy");
53310
53352
  const ALCHEMY_SEPERATOR_CHAR = process.platform === "win32" ? "-" : ":";
53311
53353
  var FileSystemStateStore = class {
53312
53354
  dir;
53313
53355
  initialized = false;
53314
53356
  constructor(scope, options) {
53315
53357
  this.scope = scope;
53316
- this.dir = path.join(options?.rootDir ?? stateRootDir, ...scope.chain);
53358
+ this.dir = path.join(options?.rootDir ?? scope.dotAlchemy, ...scope.chain);
53317
53359
  }
53318
53360
  async init() {
53319
53361
  if (this.initialized) return;
@@ -53492,11 +53534,9 @@ const colorize = (text, color) => {
53492
53534
  if (shouldDisableColors()) return text;
53493
53535
  return `${colors[color]}${text}${colors.reset}`;
53494
53536
  };
53495
- let loggerApi = null;
53537
+ let loggers = {};
53496
53538
  const createLoggerInstance = (alchemyInfo, customLogger) => {
53497
- if (loggerApi) return loggerApi;
53498
- loggerApi = customLogger ?? createFallbackLogger(alchemyInfo);
53499
- return loggerApi;
53539
+ return loggers[alchemyInfo.appName] ??= customLogger ?? createFallbackLogger(alchemyInfo);
53500
53540
  };
53501
53541
  const createDummyLogger = () => {
53502
53542
  return {
@@ -53509,13 +53549,13 @@ const createDummyLogger = () => {
53509
53549
  };
53510
53550
  };
53511
53551
  const createFallbackLogger = (alchemyInfo) => {
53512
- console.log(dedent`
53513
- ${colorize("Alchemy", "cyanBright")} (v${package_default.version})
53514
- App: ${alchemyInfo.appName}
53515
- Phase: ${alchemyInfo.phase}
53516
- Stage: ${alchemyInfo.stage}
53517
-
53518
- `);
53552
+ if (alchemyInfo.phase !== "read") console.log(dedent`
53553
+ ${colorize("Alchemy", "cyanBright")} (v${package_default.version})
53554
+ App: ${alchemyInfo.appName}
53555
+ Phase: ${alchemyInfo.phase}
53556
+ Stage: ${alchemyInfo.stage}
53557
+
53558
+ `);
53519
53559
  return {
53520
53560
  log: console.log,
53521
53561
  error: (...args) => console.error(colorize("ERROR", "redBright"), ...args),
@@ -53652,7 +53692,7 @@ async function idempotentSpawn({ cmd, cwd: cwd$1, env: env$2, stateFile = "state
53652
53692
  await Promise.all([fs$1.rm(stateFile).catch(() => {}), fs$1.rm(log).catch(() => {})]);
53653
53693
  return (await spawnLoggedChild()).pid;
53654
53694
  }
53655
- async function followFilePersisted(logPath, { write: write$1, chunkSize = 64 * 1024 }) {
53695
+ async function followFilePersisted(logPath, { write: write$1, chunkSize = 64 * 1024, tickMs = 100 }) {
53656
53696
  logPath = path.resolve(logPath);
53657
53697
  let state = await readJson(stateFile) ?? {};
53658
53698
  let fh = await fs$1.open(logPath, "r");
@@ -53691,9 +53731,13 @@ async function idempotentSpawn({ cmd, cwd: cwd$1, env: env$2, stateFile = "state
53691
53731
  } catch {}
53692
53732
  await drain();
53693
53733
  });
53734
+ const tick = setInterval(() => {
53735
+ drain().catch(() => {});
53736
+ }, tickMs);
53694
53737
  return async function stop() {
53695
53738
  closed = true;
53696
53739
  watcher.close();
53740
+ clearInterval(tick);
53697
53741
  await fh.close().catch(() => {});
53698
53742
  await persist();
53699
53743
  };
@@ -53831,13 +53875,16 @@ var Scope = class Scope {
53831
53875
  phase;
53832
53876
  local;
53833
53877
  watch;
53878
+ tunnel;
53834
53879
  force;
53835
53880
  adopt;
53836
53881
  destroyStrategy;
53837
53882
  logger;
53838
53883
  telemetryClient;
53839
53884
  dataMutex;
53885
+ rootDir;
53840
53886
  dotAlchemy;
53887
+ isSelected;
53841
53888
  providerCredentials;
53842
53889
  isErrored = false;
53843
53890
  isSkipped = false;
@@ -53850,11 +53897,13 @@ var Scope = class Scope {
53850
53897
  return this.scopeName;
53851
53898
  }
53852
53899
  constructor(options) {
53853
- const { scopeName, parent, stage, password, stateStore, quiet, phase, local, watch: watch$1, force: force$1, destroyStrategy, telemetryClient, logger: logger$1, adopt: adopt$1, dotAlchemy,...providerCredentials } = options;
53854
- this.dotAlchemy = dotAlchemy ?? this.parent?.dotAlchemy ?? path.join(process.cwd(), ".alchemy");
53900
+ const { scopeName, parent, stage, password, stateStore, quiet, phase, local, watch: watch$1, tunnel, force: force$1, destroyStrategy, telemetryClient, logger: logger$1, adopt: adopt$1, dotAlchemy, rootDir, isSelected,...providerCredentials } = options;
53855
53901
  this.scopeName = scopeName;
53856
53902
  this.name = this.scopeName;
53857
53903
  this.parent = parent ?? Scope.getScope();
53904
+ this.rootDir = rootDir ?? this.parent?.rootDir ?? ALCHEMY_ROOT;
53905
+ this.isSelected = isSelected ?? this.parent?.isSelected;
53906
+ this.dotAlchemy = dotAlchemy ?? this.parent?.dotAlchemy ?? path.resolve(this.rootDir, ".alchemy");
53858
53907
  this.providerCredentials = providerCredentials;
53859
53908
  const isChild = this.parent !== void 0;
53860
53909
  if (this.scopeName?.includes(":") && isChild) throw new Error(`Scope name "${this.scopeName}" cannot contain double colons`);
@@ -53873,6 +53922,7 @@ var Scope = class Scope {
53873
53922
  }, logger$1);
53874
53923
  this.local = local ?? this.parent?.local ?? false;
53875
53924
  this.watch = watch$1 ?? this.parent?.watch ?? false;
53925
+ this.tunnel = tunnel ?? this.parent?.tunnel ?? false;
53876
53926
  this.force = force$1 ?? this.parent?.force ?? false;
53877
53927
  this.adopt = adopt$1 ?? this.parent?.adopt ?? false;
53878
53928
  this.destroyStrategy = destroyStrategy ?? this.parent?.destroyStrategy ?? "sequential";
@@ -54397,18 +54447,25 @@ _alchemy.env = env;
54397
54447
  */
54398
54448
  async function _alchemy(appName, options) {
54399
54449
  const cliArgs = process.argv.slice(2);
54450
+ const app = parseOption("--app");
54451
+ function parseOption(option, defaultValue) {
54452
+ const i$2 = cliArgs.indexOf(option);
54453
+ return i$2 !== -1 && i$2 + 1 < cliArgs.length ? cliArgs[i$2 + 1] : defaultValue;
54454
+ }
54400
54455
  const cliOptions = {
54401
- phase: cliArgs.includes("--destroy") ? "destroy" : cliArgs.includes("--read") ? "read" : "up",
54456
+ phase: app && app !== appName ? "read" : cliArgs.includes("--destroy") ? "destroy" : cliArgs.includes("--read") ? "read" : "up",
54402
54457
  local: cliArgs.includes("--local") || cliArgs.includes("--dev"),
54403
54458
  watch: cliArgs.includes("--watch") || execArgv.includes("--watch"),
54404
54459
  quiet: cliArgs.includes("--quiet"),
54405
54460
  force: cliArgs.includes("--force"),
54461
+ tunnel: cliArgs.includes("--tunnel"),
54406
54462
  stage: (function parseStage() {
54407
54463
  const i$2 = cliArgs.indexOf("--stage");
54408
54464
  return i$2 !== -1 && i$2 + 1 < cliArgs.length ? cliArgs[i$2 + 1] : process.env.STAGE;
54409
54465
  })(),
54410
54466
  password: process.env.ALCHEMY_PASSWORD,
54411
- adopt: cliArgs.includes("--adopt")
54467
+ adopt: cliArgs.includes("--adopt"),
54468
+ rootDir: path.resolve(parseOption("--root-dir", ALCHEMY_ROOT))
54412
54469
  };
54413
54470
  const mergedOptions = {
54414
54471
  ...cliOptions,
@@ -54437,7 +54494,8 @@ If this is a mistake, you can disable this check by setting the ALCHEMY_CI_STATE
54437
54494
  scopeName: appName,
54438
54495
  phase,
54439
54496
  password: mergedOptions?.password ?? process.env.ALCHEMY_PASSWORD,
54440
- telemetryClient
54497
+ telemetryClient,
54498
+ isSelected: app === void 0 ? void 0 : app === appName
54441
54499
  });
54442
54500
  onExit((code) => {
54443
54501
  root.cleanup().then(() => {
@@ -157026,9 +157084,9 @@ ${lanes.join("\n")}
157026
157084
  host.extraFileExtensions = extraFileExtensions;
157027
157085
  return host;
157028
157086
  }
157029
- function createWatchCompilerHostOfFilesAndCompilerOptions({ rootFiles, options, watchOptions, projectReferences, system: system$1, createProgram: createProgram2, reportDiagnostic, reportWatchStatus: reportWatchStatus2 }) {
157087
+ function createWatchCompilerHostOfFilesAndCompilerOptions({ rootFiles: rootFiles$1, options, watchOptions, projectReferences, system: system$1, createProgram: createProgram2, reportDiagnostic, reportWatchStatus: reportWatchStatus2 }) {
157030
157088
  const host = createWatchCompilerHost(system$1, createProgram2, reportDiagnostic || createDiagnosticReporter(system$1), reportWatchStatus2);
157031
- host.rootFiles = rootFiles;
157089
+ host.rootFiles = rootFiles$1;
157032
157090
  host.options = options;
157033
157091
  host.watchOptions = watchOptions;
157034
157092
  host.projectReferences = projectReferences;
@@ -159415,9 +159473,9 @@ ${lanes.join("\n")}
159415
159473
  watchCompilerHost.extendedConfigCache = extendedConfigCache;
159416
159474
  return createWatchProgram(watchCompilerHost);
159417
159475
  }
159418
- function createWatchOfFilesAndCompilerOptions(system$1, cb, reportDiagnostic, rootFiles, options, watchOptions) {
159476
+ function createWatchOfFilesAndCompilerOptions(system$1, cb, reportDiagnostic, rootFiles$1, options, watchOptions) {
159419
159477
  const watchCompilerHost = createWatchCompilerHostOfFilesAndCompilerOptions({
159420
- rootFiles,
159478
+ rootFiles: rootFiles$1,
159421
159479
  options,
159422
159480
  watchOptions,
159423
159481
  system: system$1,
@@ -198316,12 +198374,12 @@ ${options.prefix}` : "\n" : options.prefix
198316
198374
  getFileNames(excludeFilesFromExternalLibraries, excludeConfigFiles) {
198317
198375
  if (!this.program) return [];
198318
198376
  if (!this.languageServiceEnabled) {
198319
- let rootFiles = this.getRootFiles();
198377
+ let rootFiles$1 = this.getRootFiles();
198320
198378
  if (this.compilerOptions) {
198321
198379
  const defaultLibrary = getDefaultLibFilePath(this.compilerOptions);
198322
- if (defaultLibrary) (rootFiles || (rootFiles = [])).push(asNormalizedPath(defaultLibrary));
198380
+ if (defaultLibrary) (rootFiles$1 || (rootFiles$1 = [])).push(asNormalizedPath(defaultLibrary));
198323
198381
  }
198324
- return rootFiles;
198382
+ return rootFiles$1;
198325
198383
  }
198326
198384
  const result = [];
198327
198385
  for (const f of this.program.getSourceFiles()) {
@@ -200636,12 +200694,12 @@ ${options.prefix}` : "\n" : options.prefix
200636
200694
  if (this.openFiles.has(info.path) && (!isAncestorConfigFileInfo(info) || info.isForDefaultProject)) if (configFileExistenceInfo) (configFileExistenceInfo.openFilesImpactedByConfigFile ?? (configFileExistenceInfo.openFilesImpactedByConfigFile = /* @__PURE__ */ new Set())).add(info.path);
200637
200695
  else (openFilesImpactedByConfigFile = /* @__PURE__ */ new Set()).add(info.path);
200638
200696
  if (configFileExistenceInfo) return configFileExistenceInfo.exists;
200639
- const exists$1 = this.host.fileExists(configFileName);
200697
+ const exists$2 = this.host.fileExists(configFileName);
200640
200698
  this.configFileExistenceInfoCache.set(canonicalConfigFilePath, {
200641
- exists: exists$1,
200699
+ exists: exists$2,
200642
200700
  openFilesImpactedByConfigFile
200643
200701
  });
200644
- return exists$1;
200702
+ return exists$2;
200645
200703
  }
200646
200704
  createConfigFileWatcherForParsedConfig(configFileName, canonicalConfigFilePath, forProject) {
200647
200705
  var _a, _b;
@@ -201037,9 +201095,9 @@ ${options.prefix}` : "\n" : options.prefix
201037
201095
  return configFileExistenceInfo;
201038
201096
  }
201039
201097
  /** @internal */
201040
- watchWildcards(configFileName, { exists: exists$1, config: config$2 }, forProject) {
201098
+ watchWildcards(configFileName, { exists: exists$2, config: config$2 }, forProject) {
201041
201099
  config$2.projects.set(forProject.canonicalConfigFilePath, true);
201042
- if (exists$1) {
201100
+ if (exists$2) {
201043
201101
  if (config$2.watchedDirectories && !config$2.watchedDirectoriesStale) return;
201044
201102
  config$2.watchedDirectoriesStale = false;
201045
201103
  updateWatchingWildcardDirectories(config$2.watchedDirectories || (config$2.watchedDirectories = /* @__PURE__ */ new Map()), config$2.parsedCommandLine.wildcardDirectories, (directory, flags) => this.watchWildcardDirectory(directory, flags, configFileName, config$2));
@@ -202169,11 +202227,11 @@ Dynamic files must always be opened with service's current directory or service
202169
202227
  const result = this.applySafeListWorker(proj, proj.rootFiles, typeAcquisition);
202170
202228
  return (result == null ? void 0 : result.excludedFiles) ?? [];
202171
202229
  }
202172
- applySafeListWorker(proj, rootFiles, typeAcquisition) {
202230
+ applySafeListWorker(proj, rootFiles$1, typeAcquisition) {
202173
202231
  if (typeAcquisition.enable === false || typeAcquisition.disableFilenameBasedTypeAcquisition) return void 0;
202174
202232
  const typeAcqInclude = typeAcquisition.include || (typeAcquisition.include = []);
202175
202233
  const excludeRules = [];
202176
- const normalizedNames = rootFiles.map((f) => normalizeSlashes(f.fileName));
202234
+ const normalizedNames = rootFiles$1.map((f) => normalizeSlashes(f.fileName));
202177
202235
  for (const name$1 of Object.keys(this.safelist)) {
202178
202236
  const rule2 = this.safelist[name$1];
202179
202237
  for (const root of normalizedNames) if (rule2.match.test(root)) {
@@ -202205,7 +202263,7 @@ Dynamic files must always be opened with service's current directory or service
202205
202263
  const excludeRegexes = excludeRules.map((e) => new RegExp(e, "i"));
202206
202264
  let filesToKeep;
202207
202265
  let excludedFiles;
202208
- for (let i$2 = 0; i$2 < rootFiles.length; i$2++) if (excludeRegexes.some((re) => re.test(normalizedNames[i$2]))) addExcludedFile(i$2);
202266
+ for (let i$2 = 0; i$2 < rootFiles$1.length; i$2++) if (excludeRegexes.some((re) => re.test(normalizedNames[i$2]))) addExcludedFile(i$2);
202209
202267
  else {
202210
202268
  if (typeAcquisition.enable) {
202211
202269
  const baseName = getBaseFileName(toFileNameLowerCase(normalizedNames[i$2]));
@@ -202222,7 +202280,7 @@ Dynamic files must always be opened with service's current directory or service
202222
202280
  }
202223
202281
  }
202224
202282
  if (/^.+[.-]min\.js$/.test(normalizedNames[i$2])) addExcludedFile(i$2);
202225
- else filesToKeep?.push(rootFiles[i$2]);
202283
+ else filesToKeep?.push(rootFiles$1[i$2]);
202226
202284
  }
202227
202285
  return excludedFiles ? {
202228
202286
  rootFiles: filesToKeep,
@@ -202231,7 +202289,7 @@ Dynamic files must always be opened with service's current directory or service
202231
202289
  function addExcludedFile(index) {
202232
202290
  if (!excludedFiles) {
202233
202291
  Debug.assert(!filesToKeep);
202234
- filesToKeep = rootFiles.slice(0, index);
202292
+ filesToKeep = rootFiles$1.slice(0, index);
202235
202293
  excludedFiles = [];
202236
202294
  }
202237
202295
  excludedFiles.push(normalizedNames[index]);
@@ -202240,7 +202298,7 @@ Dynamic files must always be opened with service's current directory or service
202240
202298
  openExternalProject(proj, cleanupAfter) {
202241
202299
  const existingExternalProject = this.findExternalProjectByProjectName(proj.projectFileName);
202242
202300
  let configuredProjects;
202243
- let rootFiles = [];
202301
+ let rootFiles$1 = [];
202244
202302
  for (const file$2 of proj.rootFiles) {
202245
202303
  const normalized = toNormalizedPath(file$2.fileName);
202246
202304
  if (getBaseConfigFileName(normalized)) {
@@ -202253,7 +202311,7 @@ Dynamic files must always be opened with service's current directory or service
202253
202311
  (configuredProjects ?? (configuredProjects = /* @__PURE__ */ new Set())).add(project);
202254
202312
  Debug.assert(!project.isClosed());
202255
202313
  }
202256
- } else rootFiles.push(file$2);
202314
+ } else rootFiles$1.push(file$2);
202257
202315
  }
202258
202316
  if (configuredProjects) {
202259
202317
  this.externalProjectToConfiguredProjectMap.set(proj.projectFileName, configuredProjects);
@@ -202263,22 +202321,22 @@ Dynamic files must always be opened with service's current directory or service
202263
202321
  const typeAcquisition = proj.typeAcquisition || {};
202264
202322
  typeAcquisition.include = typeAcquisition.include || [];
202265
202323
  typeAcquisition.exclude = typeAcquisition.exclude || [];
202266
- if (typeAcquisition.enable === void 0) typeAcquisition.enable = hasNoTypeScriptSource(rootFiles.map((f) => f.fileName));
202267
- const excludeResult = this.applySafeListWorker(proj, rootFiles, typeAcquisition);
202324
+ if (typeAcquisition.enable === void 0) typeAcquisition.enable = hasNoTypeScriptSource(rootFiles$1.map((f) => f.fileName));
202325
+ const excludeResult = this.applySafeListWorker(proj, rootFiles$1, typeAcquisition);
202268
202326
  const excludedFiles = (excludeResult == null ? void 0 : excludeResult.excludedFiles) ?? [];
202269
- rootFiles = (excludeResult == null ? void 0 : excludeResult.rootFiles) ?? rootFiles;
202327
+ rootFiles$1 = (excludeResult == null ? void 0 : excludeResult.rootFiles) ?? rootFiles$1;
202270
202328
  if (existingExternalProject) {
202271
202329
  existingExternalProject.excludedFiles = excludedFiles;
202272
202330
  const compilerOptions = convertCompilerOptions(proj.options);
202273
202331
  const watchOptionsAndErrors = convertWatchOptions(proj.options, existingExternalProject.getCurrentDirectory());
202274
- const lastFileExceededProgramSize = this.getFilenameForExceededTotalSizeLimitForNonTsFiles(proj.projectFileName, compilerOptions, rootFiles, externalFilePropertyReader);
202332
+ const lastFileExceededProgramSize = this.getFilenameForExceededTotalSizeLimitForNonTsFiles(proj.projectFileName, compilerOptions, rootFiles$1, externalFilePropertyReader);
202275
202333
  if (lastFileExceededProgramSize) existingExternalProject.disableLanguageService(lastFileExceededProgramSize);
202276
202334
  else existingExternalProject.enableLanguageService();
202277
202335
  existingExternalProject.setProjectErrors(watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.errors);
202278
- this.updateRootAndOptionsOfNonInferredProject(existingExternalProject, rootFiles, externalFilePropertyReader, compilerOptions, typeAcquisition, proj.options.compileOnSave, watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.watchOptions);
202336
+ this.updateRootAndOptionsOfNonInferredProject(existingExternalProject, rootFiles$1, externalFilePropertyReader, compilerOptions, typeAcquisition, proj.options.compileOnSave, watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.watchOptions);
202279
202337
  existingExternalProject.updateGraph();
202280
202338
  } else {
202281
- const project = this.createExternalProject(proj.projectFileName, rootFiles, proj.options, typeAcquisition, excludedFiles);
202339
+ const project = this.createExternalProject(proj.projectFileName, rootFiles$1, proj.options, typeAcquisition, excludedFiles);
202282
202340
  project.updateGraph();
202283
202341
  }
202284
202342
  }
@@ -231680,6 +231738,7 @@ const init = loggedProcedure.meta({ description: "initialize alchemy in an exist
231680
231738
  console.error("Failed to initialize Alchemy:", _error);
231681
231739
  throw new ExitSignal(1);
231682
231740
  }
231741
+ throw new ExitSignal(0);
231683
231742
  });
231684
231743
  function sanitizeProjectName(name$1) {
231685
231744
  return name$1.toLowerCase().replace(/[@/]/g, "").replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "").substring(0, 63).replace(/-$/, "");
@@ -232038,7 +232097,7 @@ const FRAMEWORK_DEPENDENCIES = {
232038
232097
  sveltekit: ["alchemy", "@sveltejs/adapter-cloudflare"],
232039
232098
  typescript: ["alchemy"],
232040
232099
  vite: ["alchemy"],
232041
- astro: ["alchemy"],
232100
+ astro: ["alchemy", "@astrojs/cloudflare"],
232042
232101
  "react-router": ["alchemy", "@cloudflare/vite-plugin"],
232043
232102
  "tanstack-start": ["alchemy"],
232044
232103
  rwsdk: ["alchemy"]
@@ -232057,6 +232116,7 @@ async function updatePackageJson(context$2) {
232057
232116
  });
232058
232117
  const packageJsonPath = resolve(context$2.cwd, "package.json");
232059
232118
  await safelyUpdateJson(packageJsonPath, (packageJson) => {
232119
+ packageJson.type = "module";
232060
232120
  if (!packageJson.scripts) packageJson.scripts = {};
232061
232121
  for (const [script, command] of Object.entries(DEFAULT_SCRIPTS)) if (!packageJson.scripts[script]) packageJson.scripts[script] = command;
232062
232122
  });
@@ -232179,7 +232239,7 @@ export default defineCloudflareConfig({
232179
232239
  // incrementalCache: r2IncrementalCache,
232180
232240
  });
232181
232241
  `);
232182
- await import_lib.writeFile(resolve(context$2.cwd, "env.d.ts"), `// Auto-generated Cloudflare binding types.
232242
+ await import_lib.writeFile(resolve(context$2.cwd, "./env.d.ts"), `// Auto-generated Cloudflare binding types.
232183
232243
  // @see https://alchemy.run/concepts/bindings/#type-safe-bindings
232184
232244
 
232185
232245
  import type { website } from "./alchemy.run.ts";
@@ -232194,7 +232254,7 @@ declare module "cloudflare:workers" {
232194
232254
  }
232195
232255
  }`);
232196
232256
  const tsConfigPath = resolve(context$2.cwd, "tsconfig.json");
232197
- await updateTsConfig(tsConfigPath, { compilerOptions: { types: ["@cloudflare/workers-types", "env.d.ts"] } });
232257
+ await updateTsConfig(tsConfigPath, { compilerOptions: { types: ["@cloudflare/workers-types", "./env.d.ts"] } });
232198
232258
  }
232199
232259
  async function updateReactRouterProject(context$2) {
232200
232260
  const tsConfigPath = resolve(context$2.cwd, "tsconfig.json");