alchemy 0.65.1 → 0.66.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 (119) hide show
  1. package/bin/alchemy.js +132 -78
  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 +14 -3
  7. package/lib/alchemy.d.ts.map +1 -1
  8. package/lib/alchemy.js +17 -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/bucket.js +1 -1
  14. package/lib/cloudflare/bucket.js.map +1 -1
  15. package/lib/cloudflare/cloudflare-env-proxy.js +3 -3
  16. package/lib/cloudflare/cloudflare-env-proxy.js.map +1 -1
  17. package/lib/cloudflare/compatibility-date.gen.d.ts +1 -1
  18. package/lib/cloudflare/compatibility-date.gen.js +1 -1
  19. package/lib/cloudflare/d1-database.d.ts.map +1 -1
  20. package/lib/cloudflare/d1-database.js +2 -1
  21. package/lib/cloudflare/d1-database.js.map +1 -1
  22. package/lib/cloudflare/d1-local-migrations.d.ts +1 -0
  23. package/lib/cloudflare/d1-local-migrations.d.ts.map +1 -1
  24. package/lib/cloudflare/d1-local-migrations.js +3 -2
  25. package/lib/cloudflare/d1-local-migrations.js.map +1 -1
  26. package/lib/cloudflare/kv-namespace.js +1 -1
  27. package/lib/cloudflare/kv-namespace.js.map +1 -1
  28. package/lib/cloudflare/miniflare/delete.d.ts +3 -2
  29. package/lib/cloudflare/miniflare/delete.d.ts.map +1 -1
  30. package/lib/cloudflare/miniflare/delete.js +13 -12
  31. package/lib/cloudflare/miniflare/delete.js.map +1 -1
  32. package/lib/cloudflare/miniflare/miniflare-controller.d.ts.map +1 -1
  33. package/lib/cloudflare/miniflare/miniflare-controller.js +5 -4
  34. package/lib/cloudflare/miniflare/miniflare-controller.js.map +1 -1
  35. package/lib/cloudflare/miniflare/paths.d.ts +4 -4
  36. package/lib/cloudflare/miniflare/paths.d.ts.map +1 -1
  37. package/lib/cloudflare/miniflare/paths.js +10 -4
  38. package/lib/cloudflare/miniflare/paths.js.map +1 -1
  39. package/lib/cloudflare/miniflare/symlink-miniflare-state.d.ts +2 -0
  40. package/lib/cloudflare/miniflare/symlink-miniflare-state.d.ts.map +1 -0
  41. package/lib/cloudflare/miniflare/symlink-miniflare-state.js +19 -0
  42. package/lib/cloudflare/miniflare/symlink-miniflare-state.js.map +1 -0
  43. package/lib/cloudflare/nuxt/plugin.d.ts.map +1 -1
  44. package/lib/cloudflare/nuxt/plugin.js +3 -3
  45. package/lib/cloudflare/nuxt/plugin.js.map +1 -1
  46. package/lib/cloudflare/redwood/plugin.js +2 -2
  47. package/lib/cloudflare/redwood/plugin.js.map +1 -1
  48. package/lib/cloudflare/vite/plugin.d.ts.map +1 -1
  49. package/lib/cloudflare/vite/plugin.js +6 -3
  50. package/lib/cloudflare/vite/plugin.js.map +1 -1
  51. package/lib/cloudflare/website.d.ts.map +1 -1
  52. package/lib/cloudflare/website.js +5 -16
  53. package/lib/cloudflare/website.js.map +1 -1
  54. package/lib/cloudflare/worker.d.ts.map +1 -1
  55. package/lib/cloudflare/worker.js +4 -2
  56. package/lib/cloudflare/worker.js.map +1 -1
  57. package/lib/cloudflare/wrangler.json.js +1 -0
  58. package/lib/cloudflare/wrangler.json.js.map +1 -1
  59. package/lib/scope.d.ts +16 -0
  60. package/lib/scope.d.ts.map +1 -1
  61. package/lib/scope.js +10 -5
  62. package/lib/scope.js.map +1 -1
  63. package/lib/state/file-system-state-store.d.ts.map +1 -1
  64. package/lib/state/file-system-state-store.js +1 -2
  65. package/lib/state/file-system-state-store.js.map +1 -1
  66. package/lib/state/sqlite-state-store.d.ts +11 -0
  67. package/lib/state/sqlite-state-store.d.ts.map +1 -1
  68. package/lib/state/sqlite-state-store.js +22 -14
  69. package/lib/state/sqlite-state-store.js.map +1 -1
  70. package/lib/stripe/customer.d.ts +0 -8
  71. package/lib/stripe/customer.d.ts.map +1 -1
  72. package/lib/stripe/customer.js +0 -6
  73. package/lib/stripe/customer.js.map +1 -1
  74. package/lib/stripe/price.d.ts +23 -23
  75. package/lib/stripe/price.d.ts.map +1 -1
  76. package/lib/stripe/price.js +6 -22
  77. package/lib/stripe/price.js.map +1 -1
  78. package/lib/test/vitest.d.ts.map +1 -1
  79. package/lib/test/vitest.js +1 -1
  80. package/lib/test/vitest.js.map +1 -1
  81. package/lib/util/assert-never.js +1 -1
  82. package/lib/util/assert-never.js.map +1 -1
  83. package/lib/util/cli.d.ts.map +1 -1
  84. package/lib/util/cli.js +12 -13
  85. package/lib/util/cli.js.map +1 -1
  86. package/lib/util/root-dir.d.ts +2 -0
  87. package/lib/util/root-dir.d.ts.map +1 -0
  88. package/lib/util/root-dir.js +2 -0
  89. package/lib/util/root-dir.js.map +1 -0
  90. package/package.json +4 -4
  91. package/src/alchemy.ts +36 -8
  92. package/src/apply.ts +58 -3
  93. package/src/cloudflare/bucket.ts +1 -1
  94. package/src/cloudflare/cloudflare-env-proxy.ts +5 -5
  95. package/src/cloudflare/compatibility-date.gen.ts +1 -1
  96. package/src/cloudflare/d1-database.ts +2 -1
  97. package/src/cloudflare/d1-local-migrations.ts +10 -6
  98. package/src/cloudflare/kv-namespace.ts +1 -1
  99. package/src/cloudflare/miniflare/delete.ts +19 -11
  100. package/src/cloudflare/miniflare/miniflare-controller.ts +10 -6
  101. package/src/cloudflare/miniflare/paths.ts +11 -7
  102. package/src/cloudflare/miniflare/symlink-miniflare-state.ts +19 -0
  103. package/src/cloudflare/nuxt/plugin.ts +12 -3
  104. package/src/cloudflare/redwood/plugin.ts +2 -2
  105. package/src/cloudflare/vite/plugin.ts +8 -3
  106. package/src/cloudflare/website.ts +5 -19
  107. package/src/cloudflare/worker.ts +4 -2
  108. package/src/cloudflare/wrangler.json.ts +1 -0
  109. package/src/scope.ts +26 -5
  110. package/src/state/file-system-state-store.ts +1 -2
  111. package/src/state/sqlite-state-store.ts +41 -14
  112. package/src/stripe/customer.ts +0 -14
  113. package/src/stripe/price.ts +59 -56
  114. package/src/test/vitest.ts +4 -1
  115. package/src/util/assert-never.ts +1 -1
  116. package/src/util/cli.ts +15 -13
  117. package/src/util/root-dir.ts +1 -0
  118. package/templates/nextjs/alchemy.run.ts +2 -2
  119. package/workers/cloudflare-state-store.js +1 -1
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.66.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,28 @@ 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
+ "turbo.json",
52539
+ "rush.json"
52540
+ ];
52541
+
52516
52542
  //#endregion
52517
52543
  //#region bin/services/execute-alchemy.ts
52518
52544
  const entrypoint = zod_default.string().optional().describe("Path to the entrypoint file");
@@ -52526,14 +52552,16 @@ const execArgs = {
52526
52552
  inspect: zod_default.boolean().optional().describe("Enable inspector"),
52527
52553
  inspectBrk: zod_default.boolean().optional().describe("Enable inspector and break on start"),
52528
52554
  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")
52555
+ envFile: zod_default.string().optional().describe("Path to environment file to load"),
52556
+ app: zod_default.string().optional().describe("Select a specific application to target"),
52557
+ rootDir: zod_default.string().optional().describe("Path to the root directory of the project")
52530
52558
  };
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 }) {
52559
+ 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
52560
  const args = [];
52533
52561
  const execArgs$1 = [];
52534
52562
  const shouldInspect = (inspect$1 || inspectBrk || inspectWait) ?? false;
52535
52563
  if (quiet) args.push("--quiet");
52536
- if (read$4) args.push("--read");
52564
+ if (read$5) args.push("--read");
52537
52565
  if (force$1) args.push("--force");
52538
52566
  if (stage) args.push(`--stage ${stage}`);
52539
52567
  if (destroy$2) args.push("--destroy");
@@ -52547,6 +52575,22 @@ async function execAlchemy(main, { cwd: cwd$1 = process.cwd(), quiet, force: for
52547
52575
  if (inspectWait) execArgs$1.push("--inspect-wait");
52548
52576
  if (inspectBrk) execArgs$1.push("--inspect-brk");
52549
52577
  if (adopt$1) args.push("--adopt");
52578
+ if (app) args.push(`--app ${app}`);
52579
+ if (rootDir) args.push(`--root-dir ${rootDir}`);
52580
+ else if (app) {
52581
+ console.log("finding root dir");
52582
+ try {
52583
+ const rootDir$1 = await findWorkspaceRoot(cwd$1);
52584
+ args.push(`--root-dir ${rootDir$1}`);
52585
+ if (!envFile) {
52586
+ const rootEnv = resolve(rootDir$1, ".env");
52587
+ if (await exists(rootEnv)) execArgs$1.push(`--env-file ${rootEnv}`);
52588
+ }
52589
+ } catch (error$81) {
52590
+ console.error("error finding monorepo root", error$81);
52591
+ throw error$81;
52592
+ }
52593
+ }
52550
52594
  if (!main) {
52551
52595
  const candidates = [
52552
52596
  "alchemy.run.ts",
@@ -53306,14 +53350,13 @@ async function ignore(codes, fn) {
53306
53350
 
53307
53351
  //#endregion
53308
53352
  //#region src/state/file-system-state-store.ts
53309
- const stateRootDir = path.join(process.cwd(), ".alchemy");
53310
53353
  const ALCHEMY_SEPERATOR_CHAR = process.platform === "win32" ? "-" : ":";
53311
53354
  var FileSystemStateStore = class {
53312
53355
  dir;
53313
53356
  initialized = false;
53314
53357
  constructor(scope, options) {
53315
53358
  this.scope = scope;
53316
- this.dir = path.join(options?.rootDir ?? stateRootDir, ...scope.chain);
53359
+ this.dir = path.join(options?.rootDir ?? scope.dotAlchemy, ...scope.chain);
53317
53360
  }
53318
53361
  async init() {
53319
53362
  if (this.initialized) return;
@@ -53492,11 +53535,9 @@ const colorize = (text, color) => {
53492
53535
  if (shouldDisableColors()) return text;
53493
53536
  return `${colors[color]}${text}${colors.reset}`;
53494
53537
  };
53495
- let loggerApi = null;
53538
+ let loggers = {};
53496
53539
  const createLoggerInstance = (alchemyInfo, customLogger) => {
53497
- if (loggerApi) return loggerApi;
53498
- loggerApi = customLogger ?? createFallbackLogger(alchemyInfo);
53499
- return loggerApi;
53540
+ return loggers[alchemyInfo.appName] ??= customLogger ?? createFallbackLogger(alchemyInfo);
53500
53541
  };
53501
53542
  const createDummyLogger = () => {
53502
53543
  return {
@@ -53509,13 +53550,13 @@ const createDummyLogger = () => {
53509
53550
  };
53510
53551
  };
53511
53552
  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
- `);
53553
+ if (alchemyInfo.phase !== "read") console.log(dedent`
53554
+ ${colorize("Alchemy", "cyanBright")} (v${package_default.version})
53555
+ App: ${alchemyInfo.appName}
53556
+ Phase: ${alchemyInfo.phase}
53557
+ Stage: ${alchemyInfo.stage}
53558
+
53559
+ `);
53519
53560
  return {
53520
53561
  log: console.log,
53521
53562
  error: (...args) => console.error(colorize("ERROR", "redBright"), ...args),
@@ -53837,7 +53878,9 @@ var Scope = class Scope {
53837
53878
  logger;
53838
53879
  telemetryClient;
53839
53880
  dataMutex;
53881
+ rootDir;
53840
53882
  dotAlchemy;
53883
+ isSelected;
53841
53884
  providerCredentials;
53842
53885
  isErrored = false;
53843
53886
  isSkipped = false;
@@ -53850,11 +53893,13 @@ var Scope = class Scope {
53850
53893
  return this.scopeName;
53851
53894
  }
53852
53895
  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");
53896
+ const { scopeName, parent, stage, password, stateStore, quiet, phase, local, watch: watch$1, force: force$1, destroyStrategy, telemetryClient, logger: logger$1, adopt: adopt$1, dotAlchemy, rootDir, isSelected,...providerCredentials } = options;
53855
53897
  this.scopeName = scopeName;
53856
53898
  this.name = this.scopeName;
53857
53899
  this.parent = parent ?? Scope.getScope();
53900
+ this.rootDir = rootDir ?? this.parent?.rootDir ?? ALCHEMY_ROOT;
53901
+ this.isSelected = isSelected ?? this.parent?.isSelected;
53902
+ this.dotAlchemy = dotAlchemy ?? this.parent?.dotAlchemy ?? path.resolve(this.rootDir, ".alchemy");
53858
53903
  this.providerCredentials = providerCredentials;
53859
53904
  const isChild = this.parent !== void 0;
53860
53905
  if (this.scopeName?.includes(":") && isChild) throw new Error(`Scope name "${this.scopeName}" cannot contain double colons`);
@@ -54397,8 +54442,13 @@ _alchemy.env = env;
54397
54442
  */
54398
54443
  async function _alchemy(appName, options) {
54399
54444
  const cliArgs = process.argv.slice(2);
54445
+ const app = parseOption("--app");
54446
+ function parseOption(option, defaultValue) {
54447
+ const i$2 = cliArgs.indexOf(option);
54448
+ return i$2 !== -1 && i$2 + 1 < cliArgs.length ? cliArgs[i$2 + 1] : defaultValue;
54449
+ }
54400
54450
  const cliOptions = {
54401
- phase: cliArgs.includes("--destroy") ? "destroy" : cliArgs.includes("--read") ? "read" : "up",
54451
+ phase: app && app !== appName ? "read" : cliArgs.includes("--destroy") ? "destroy" : cliArgs.includes("--read") ? "read" : "up",
54402
54452
  local: cliArgs.includes("--local") || cliArgs.includes("--dev"),
54403
54453
  watch: cliArgs.includes("--watch") || execArgv.includes("--watch"),
54404
54454
  quiet: cliArgs.includes("--quiet"),
@@ -54408,7 +54458,8 @@ async function _alchemy(appName, options) {
54408
54458
  return i$2 !== -1 && i$2 + 1 < cliArgs.length ? cliArgs[i$2 + 1] : process.env.STAGE;
54409
54459
  })(),
54410
54460
  password: process.env.ALCHEMY_PASSWORD,
54411
- adopt: cliArgs.includes("--adopt")
54461
+ adopt: cliArgs.includes("--adopt"),
54462
+ rootDir: path.resolve(parseOption("--root-dir", ALCHEMY_ROOT))
54412
54463
  };
54413
54464
  const mergedOptions = {
54414
54465
  ...cliOptions,
@@ -54437,7 +54488,8 @@ If this is a mistake, you can disable this check by setting the ALCHEMY_CI_STATE
54437
54488
  scopeName: appName,
54438
54489
  phase,
54439
54490
  password: mergedOptions?.password ?? process.env.ALCHEMY_PASSWORD,
54440
- telemetryClient
54491
+ telemetryClient,
54492
+ isSelected: app === void 0 ? void 0 : app === appName
54441
54493
  });
54442
54494
  onExit((code) => {
54443
54495
  root.cleanup().then(() => {
@@ -157026,9 +157078,9 @@ ${lanes.join("\n")}
157026
157078
  host.extraFileExtensions = extraFileExtensions;
157027
157079
  return host;
157028
157080
  }
157029
- function createWatchCompilerHostOfFilesAndCompilerOptions({ rootFiles, options, watchOptions, projectReferences, system: system$1, createProgram: createProgram2, reportDiagnostic, reportWatchStatus: reportWatchStatus2 }) {
157081
+ function createWatchCompilerHostOfFilesAndCompilerOptions({ rootFiles: rootFiles$1, options, watchOptions, projectReferences, system: system$1, createProgram: createProgram2, reportDiagnostic, reportWatchStatus: reportWatchStatus2 }) {
157030
157082
  const host = createWatchCompilerHost(system$1, createProgram2, reportDiagnostic || createDiagnosticReporter(system$1), reportWatchStatus2);
157031
- host.rootFiles = rootFiles;
157083
+ host.rootFiles = rootFiles$1;
157032
157084
  host.options = options;
157033
157085
  host.watchOptions = watchOptions;
157034
157086
  host.projectReferences = projectReferences;
@@ -159415,9 +159467,9 @@ ${lanes.join("\n")}
159415
159467
  watchCompilerHost.extendedConfigCache = extendedConfigCache;
159416
159468
  return createWatchProgram(watchCompilerHost);
159417
159469
  }
159418
- function createWatchOfFilesAndCompilerOptions(system$1, cb, reportDiagnostic, rootFiles, options, watchOptions) {
159470
+ function createWatchOfFilesAndCompilerOptions(system$1, cb, reportDiagnostic, rootFiles$1, options, watchOptions) {
159419
159471
  const watchCompilerHost = createWatchCompilerHostOfFilesAndCompilerOptions({
159420
- rootFiles,
159472
+ rootFiles: rootFiles$1,
159421
159473
  options,
159422
159474
  watchOptions,
159423
159475
  system: system$1,
@@ -198316,12 +198368,12 @@ ${options.prefix}` : "\n" : options.prefix
198316
198368
  getFileNames(excludeFilesFromExternalLibraries, excludeConfigFiles) {
198317
198369
  if (!this.program) return [];
198318
198370
  if (!this.languageServiceEnabled) {
198319
- let rootFiles = this.getRootFiles();
198371
+ let rootFiles$1 = this.getRootFiles();
198320
198372
  if (this.compilerOptions) {
198321
198373
  const defaultLibrary = getDefaultLibFilePath(this.compilerOptions);
198322
- if (defaultLibrary) (rootFiles || (rootFiles = [])).push(asNormalizedPath(defaultLibrary));
198374
+ if (defaultLibrary) (rootFiles$1 || (rootFiles$1 = [])).push(asNormalizedPath(defaultLibrary));
198323
198375
  }
198324
- return rootFiles;
198376
+ return rootFiles$1;
198325
198377
  }
198326
198378
  const result = [];
198327
198379
  for (const f of this.program.getSourceFiles()) {
@@ -200636,12 +200688,12 @@ ${options.prefix}` : "\n" : options.prefix
200636
200688
  if (this.openFiles.has(info.path) && (!isAncestorConfigFileInfo(info) || info.isForDefaultProject)) if (configFileExistenceInfo) (configFileExistenceInfo.openFilesImpactedByConfigFile ?? (configFileExistenceInfo.openFilesImpactedByConfigFile = /* @__PURE__ */ new Set())).add(info.path);
200637
200689
  else (openFilesImpactedByConfigFile = /* @__PURE__ */ new Set()).add(info.path);
200638
200690
  if (configFileExistenceInfo) return configFileExistenceInfo.exists;
200639
- const exists$1 = this.host.fileExists(configFileName);
200691
+ const exists$2 = this.host.fileExists(configFileName);
200640
200692
  this.configFileExistenceInfoCache.set(canonicalConfigFilePath, {
200641
- exists: exists$1,
200693
+ exists: exists$2,
200642
200694
  openFilesImpactedByConfigFile
200643
200695
  });
200644
- return exists$1;
200696
+ return exists$2;
200645
200697
  }
200646
200698
  createConfigFileWatcherForParsedConfig(configFileName, canonicalConfigFilePath, forProject) {
200647
200699
  var _a, _b;
@@ -201037,9 +201089,9 @@ ${options.prefix}` : "\n" : options.prefix
201037
201089
  return configFileExistenceInfo;
201038
201090
  }
201039
201091
  /** @internal */
201040
- watchWildcards(configFileName, { exists: exists$1, config: config$2 }, forProject) {
201092
+ watchWildcards(configFileName, { exists: exists$2, config: config$2 }, forProject) {
201041
201093
  config$2.projects.set(forProject.canonicalConfigFilePath, true);
201042
- if (exists$1) {
201094
+ if (exists$2) {
201043
201095
  if (config$2.watchedDirectories && !config$2.watchedDirectoriesStale) return;
201044
201096
  config$2.watchedDirectoriesStale = false;
201045
201097
  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 +202221,11 @@ Dynamic files must always be opened with service's current directory or service
202169
202221
  const result = this.applySafeListWorker(proj, proj.rootFiles, typeAcquisition);
202170
202222
  return (result == null ? void 0 : result.excludedFiles) ?? [];
202171
202223
  }
202172
- applySafeListWorker(proj, rootFiles, typeAcquisition) {
202224
+ applySafeListWorker(proj, rootFiles$1, typeAcquisition) {
202173
202225
  if (typeAcquisition.enable === false || typeAcquisition.disableFilenameBasedTypeAcquisition) return void 0;
202174
202226
  const typeAcqInclude = typeAcquisition.include || (typeAcquisition.include = []);
202175
202227
  const excludeRules = [];
202176
- const normalizedNames = rootFiles.map((f) => normalizeSlashes(f.fileName));
202228
+ const normalizedNames = rootFiles$1.map((f) => normalizeSlashes(f.fileName));
202177
202229
  for (const name$1 of Object.keys(this.safelist)) {
202178
202230
  const rule2 = this.safelist[name$1];
202179
202231
  for (const root of normalizedNames) if (rule2.match.test(root)) {
@@ -202205,7 +202257,7 @@ Dynamic files must always be opened with service's current directory or service
202205
202257
  const excludeRegexes = excludeRules.map((e) => new RegExp(e, "i"));
202206
202258
  let filesToKeep;
202207
202259
  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);
202260
+ 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
202261
  else {
202210
202262
  if (typeAcquisition.enable) {
202211
202263
  const baseName = getBaseFileName(toFileNameLowerCase(normalizedNames[i$2]));
@@ -202222,7 +202274,7 @@ Dynamic files must always be opened with service's current directory or service
202222
202274
  }
202223
202275
  }
202224
202276
  if (/^.+[.-]min\.js$/.test(normalizedNames[i$2])) addExcludedFile(i$2);
202225
- else filesToKeep?.push(rootFiles[i$2]);
202277
+ else filesToKeep?.push(rootFiles$1[i$2]);
202226
202278
  }
202227
202279
  return excludedFiles ? {
202228
202280
  rootFiles: filesToKeep,
@@ -202231,7 +202283,7 @@ Dynamic files must always be opened with service's current directory or service
202231
202283
  function addExcludedFile(index) {
202232
202284
  if (!excludedFiles) {
202233
202285
  Debug.assert(!filesToKeep);
202234
- filesToKeep = rootFiles.slice(0, index);
202286
+ filesToKeep = rootFiles$1.slice(0, index);
202235
202287
  excludedFiles = [];
202236
202288
  }
202237
202289
  excludedFiles.push(normalizedNames[index]);
@@ -202240,7 +202292,7 @@ Dynamic files must always be opened with service's current directory or service
202240
202292
  openExternalProject(proj, cleanupAfter) {
202241
202293
  const existingExternalProject = this.findExternalProjectByProjectName(proj.projectFileName);
202242
202294
  let configuredProjects;
202243
- let rootFiles = [];
202295
+ let rootFiles$1 = [];
202244
202296
  for (const file$2 of proj.rootFiles) {
202245
202297
  const normalized = toNormalizedPath(file$2.fileName);
202246
202298
  if (getBaseConfigFileName(normalized)) {
@@ -202253,7 +202305,7 @@ Dynamic files must always be opened with service's current directory or service
202253
202305
  (configuredProjects ?? (configuredProjects = /* @__PURE__ */ new Set())).add(project);
202254
202306
  Debug.assert(!project.isClosed());
202255
202307
  }
202256
- } else rootFiles.push(file$2);
202308
+ } else rootFiles$1.push(file$2);
202257
202309
  }
202258
202310
  if (configuredProjects) {
202259
202311
  this.externalProjectToConfiguredProjectMap.set(proj.projectFileName, configuredProjects);
@@ -202263,22 +202315,22 @@ Dynamic files must always be opened with service's current directory or service
202263
202315
  const typeAcquisition = proj.typeAcquisition || {};
202264
202316
  typeAcquisition.include = typeAcquisition.include || [];
202265
202317
  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);
202318
+ if (typeAcquisition.enable === void 0) typeAcquisition.enable = hasNoTypeScriptSource(rootFiles$1.map((f) => f.fileName));
202319
+ const excludeResult = this.applySafeListWorker(proj, rootFiles$1, typeAcquisition);
202268
202320
  const excludedFiles = (excludeResult == null ? void 0 : excludeResult.excludedFiles) ?? [];
202269
- rootFiles = (excludeResult == null ? void 0 : excludeResult.rootFiles) ?? rootFiles;
202321
+ rootFiles$1 = (excludeResult == null ? void 0 : excludeResult.rootFiles) ?? rootFiles$1;
202270
202322
  if (existingExternalProject) {
202271
202323
  existingExternalProject.excludedFiles = excludedFiles;
202272
202324
  const compilerOptions = convertCompilerOptions(proj.options);
202273
202325
  const watchOptionsAndErrors = convertWatchOptions(proj.options, existingExternalProject.getCurrentDirectory());
202274
- const lastFileExceededProgramSize = this.getFilenameForExceededTotalSizeLimitForNonTsFiles(proj.projectFileName, compilerOptions, rootFiles, externalFilePropertyReader);
202326
+ const lastFileExceededProgramSize = this.getFilenameForExceededTotalSizeLimitForNonTsFiles(proj.projectFileName, compilerOptions, rootFiles$1, externalFilePropertyReader);
202275
202327
  if (lastFileExceededProgramSize) existingExternalProject.disableLanguageService(lastFileExceededProgramSize);
202276
202328
  else existingExternalProject.enableLanguageService();
202277
202329
  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);
202330
+ this.updateRootAndOptionsOfNonInferredProject(existingExternalProject, rootFiles$1, externalFilePropertyReader, compilerOptions, typeAcquisition, proj.options.compileOnSave, watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.watchOptions);
202279
202331
  existingExternalProject.updateGraph();
202280
202332
  } else {
202281
- const project = this.createExternalProject(proj.projectFileName, rootFiles, proj.options, typeAcquisition, excludedFiles);
202333
+ const project = this.createExternalProject(proj.projectFileName, rootFiles$1, proj.options, typeAcquisition, excludedFiles);
202282
202334
  project.updateGraph();
202283
202335
  }
202284
202336
  }
@@ -231680,6 +231732,7 @@ const init = loggedProcedure.meta({ description: "initialize alchemy in an exist
231680
231732
  console.error("Failed to initialize Alchemy:", _error);
231681
231733
  throw new ExitSignal(1);
231682
231734
  }
231735
+ throw new ExitSignal(0);
231683
231736
  });
231684
231737
  function sanitizeProjectName(name$1) {
231685
231738
  return name$1.toLowerCase().replace(/[@/]/g, "").replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "").substring(0, 63).replace(/-$/, "");
@@ -232038,7 +232091,7 @@ const FRAMEWORK_DEPENDENCIES = {
232038
232091
  sveltekit: ["alchemy", "@sveltejs/adapter-cloudflare"],
232039
232092
  typescript: ["alchemy"],
232040
232093
  vite: ["alchemy"],
232041
- astro: ["alchemy"],
232094
+ astro: ["alchemy", "@astrojs/cloudflare"],
232042
232095
  "react-router": ["alchemy", "@cloudflare/vite-plugin"],
232043
232096
  "tanstack-start": ["alchemy"],
232044
232097
  rwsdk: ["alchemy"]
@@ -232057,6 +232110,7 @@ async function updatePackageJson(context$2) {
232057
232110
  });
232058
232111
  const packageJsonPath = resolve(context$2.cwd, "package.json");
232059
232112
  await safelyUpdateJson(packageJsonPath, (packageJson) => {
232113
+ packageJson.type = "module";
232060
232114
  if (!packageJson.scripts) packageJson.scripts = {};
232061
232115
  for (const [script, command] of Object.entries(DEFAULT_SCRIPTS)) if (!packageJson.scripts[script]) packageJson.scripts[script] = command;
232062
232116
  });
@@ -232179,7 +232233,7 @@ export default defineCloudflareConfig({
232179
232233
  // incrementalCache: r2IncrementalCache,
232180
232234
  });
232181
232235
  `);
232182
- await import_lib.writeFile(resolve(context$2.cwd, "env.d.ts"), `// Auto-generated Cloudflare binding types.
232236
+ await import_lib.writeFile(resolve(context$2.cwd, "./env.d.ts"), `// Auto-generated Cloudflare binding types.
232183
232237
  // @see https://alchemy.run/concepts/bindings/#type-safe-bindings
232184
232238
 
232185
232239
  import type { website } from "./alchemy.run.ts";
@@ -232194,7 +232248,7 @@ declare module "cloudflare:workers" {
232194
232248
  }
232195
232249
  }`);
232196
232250
  const tsConfigPath = resolve(context$2.cwd, "tsconfig.json");
232197
- await updateTsConfig(tsConfigPath, { compilerOptions: { types: ["@cloudflare/workers-types", "env.d.ts"] } });
232251
+ await updateTsConfig(tsConfigPath, { compilerOptions: { types: ["@cloudflare/workers-types", "./env.d.ts"] } });
232198
232252
  }
232199
232253
  async function updateReactRouterProject(context$2) {
232200
232254
  const tsConfigPath = resolve(context$2.cwd, "tsconfig.json");
@@ -66,6 +66,8 @@ export const init = loggedProcedure
66
66
  console.error("Failed to initialize Alchemy:", _error);
67
67
  throw new ExitSignal(1);
68
68
  }
69
+ // TODO(sam): adding this seemed to stop the CLI from hanging after success (which happens sometimes, not clear why)
70
+ throw new ExitSignal(0);
69
71
  });
70
72
 
71
73
  function sanitizeProjectName(name: string): string {
@@ -467,7 +469,7 @@ const FRAMEWORK_DEPENDENCIES: Record<TemplateType, DependencyVersionMap[]> = {
467
469
  sveltekit: ["alchemy", "@sveltejs/adapter-cloudflare"],
468
470
  typescript: ["alchemy"],
469
471
  vite: ["alchemy"],
470
- astro: ["alchemy"],
472
+ astro: ["alchemy", "@astrojs/cloudflare"],
471
473
  "react-router": ["alchemy", "@cloudflare/vite-plugin"],
472
474
  "tanstack-start": ["alchemy"],
473
475
  rwsdk: ["alchemy"],
@@ -489,6 +491,7 @@ async function updatePackageJson(context: InitContext): Promise<void> {
489
491
 
490
492
  const packageJsonPath = resolve(context.cwd, "package.json");
491
493
  await safelyUpdateJson(packageJsonPath, (packageJson) => {
494
+ packageJson.type = "module";
492
495
  if (!packageJson.scripts) {
493
496
  packageJson.scripts = {};
494
497
  }
@@ -726,7 +729,7 @@ export default defineCloudflareConfig({
726
729
  );
727
730
  }
728
731
  await fs.writeFile(
729
- resolve(context.cwd, "env.d.ts"),
732
+ resolve(context.cwd, "./env.d.ts"),
730
733
  `// Auto-generated Cloudflare binding types.
731
734
  // @see https://alchemy.run/concepts/bindings/#type-safe-bindings
732
735
 
@@ -746,7 +749,7 @@ declare module "cloudflare:workers" {
746
749
  const tsConfigPath = resolve(context.cwd, "tsconfig.json");
747
750
  await updateTsConfig(tsConfigPath, {
748
751
  compilerOptions: {
749
- types: ["@cloudflare/workers-types", "env.d.ts"],
752
+ types: ["@cloudflare/workers-types", "./env.d.ts"],
750
753
  },
751
754
  });
752
755
  }
@@ -3,10 +3,11 @@ import { createServer, type Server } from "node:http";
3
3
  import path from "pathe";
4
4
  import { WebSocketServer, type WebSocket as WsWebSocket } from "ws";
5
5
  import { findOpenPort } from "../../../src/util/find-open-port.ts";
6
+ import { ALCHEMY_ROOT } from "../../../src/util/root-dir.ts";
6
7
 
7
- export const LOGS_DIRECTORY = path.join(process.cwd(), ".alchemy", "logs");
8
+ export const LOGS_DIRECTORY = path.join(ALCHEMY_ROOT, ".alchemy", "logs");
8
9
  const DEBUGGER_URLS_FILE = path.join(
9
- process.cwd(),
10
+ ALCHEMY_ROOT,
10
11
  ".alchemy",
11
12
  ".debugger-urls",
12
13
  );