@awsless/cli 0.1.25 → 0.1.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin.js CHANGED
@@ -69413,7 +69413,7 @@ var require_client2 = __commonJS(function(exports) {
69413
69413
  // ../../node_modules/.pnpm/@smithy+core@3.33.2/node_modules/@smithy/core/dist-cjs/submodules/config/index.js
69414
69414
  var require_config = __commonJS(function(exports) {
69415
69415
  var { homedir: homedir2 } = __require("os");
69416
- var { sep: sep2, join: join27 } = __require("path");
69416
+ var { sep: sep2, join: join28 } = __require("path");
69417
69417
  var { createHash: createHash15 } = __require("crypto");
69418
69418
  var { readFile: readFile$1 } = __require("fs/promises");
69419
69419
  var { IniSectionType } = require_dist_cjs();
@@ -69571,7 +69571,7 @@ var require_config = __commonJS(function(exports) {
69571
69571
  var getSSOTokenFilepath = (id) => {
69572
69572
  const hasher = createHash15("sha1");
69573
69573
  const cacheName = hasher.update(id).digest("hex");
69574
- return join27(getHomeDir(), ".aws", "sso", "cache", `${cacheName}.json`);
69574
+ return join28(getHomeDir(), ".aws", "sso", "cache", `${cacheName}.json`);
69575
69575
  };
69576
69576
  var tokenIntercept = {};
69577
69577
  var getSSOTokenFromFile = async (id) => {
@@ -69598,9 +69598,9 @@ var require_config = __commonJS(function(exports) {
69598
69598
  ...data.default && { default: data.default }
69599
69599
  });
69600
69600
  var ENV_CONFIG_PATH = "AWS_CONFIG_FILE";
69601
- var getConfigFilepath = () => process.env[ENV_CONFIG_PATH] || join27(getHomeDir(), ".aws", "config");
69601
+ var getConfigFilepath = () => process.env[ENV_CONFIG_PATH] || join28(getHomeDir(), ".aws", "config");
69602
69602
  var ENV_CREDENTIALS_PATH = "AWS_SHARED_CREDENTIALS_FILE";
69603
- var getCredentialsFilepath = () => process.env[ENV_CREDENTIALS_PATH] || join27(getHomeDir(), ".aws", "credentials");
69603
+ var getCredentialsFilepath = () => process.env[ENV_CREDENTIALS_PATH] || join28(getHomeDir(), ".aws", "credentials");
69604
69604
  var prefixKeyRegex = /^([\w-]+)\s(["'])?([\w-@+.%:/]+)\2$/;
69605
69605
  var profileNameBlockList = ["__proto__", "profile __proto__"];
69606
69606
  var parseIni = (iniData) => {
@@ -69666,11 +69666,11 @@ var require_config = __commonJS(function(exports) {
69666
69666
  const relativeHomeDirPrefix = "~/";
69667
69667
  let resolvedFilepath = filepath;
69668
69668
  if (filepath.startsWith(relativeHomeDirPrefix)) {
69669
- resolvedFilepath = join27(homeDir, filepath.slice(2));
69669
+ resolvedFilepath = join28(homeDir, filepath.slice(2));
69670
69670
  }
69671
69671
  let resolvedConfigFilepath = configFilepath;
69672
69672
  if (configFilepath.startsWith(relativeHomeDirPrefix)) {
69673
- resolvedConfigFilepath = join27(homeDir, configFilepath.slice(2));
69673
+ resolvedConfigFilepath = join28(homeDir, configFilepath.slice(2));
69674
69674
  }
69675
69675
  const parsedFiles = await Promise.all([
69676
69676
  readFile13(resolvedConfigFilepath, {
@@ -89498,7 +89498,7 @@ var require_signin = __commonJS(function(exports) {
89498
89498
  import { createHash as createHash15, createPrivateKey, createPublicKey, sign } from "crypto";
89499
89499
  import { promises as fs4 } from "fs";
89500
89500
  import { homedir as homedir2 } from "os";
89501
- import { dirname as dirname16, join as join27 } from "path";
89501
+ import { dirname as dirname16, join as join28 } from "path";
89502
89502
  var import_config20, import_protocols3, LoginCredentialsFetcher;
89503
89503
  var init_LoginCredentialsFetcher = __esm(() => {
89504
89504
  import_config20 = __toESM(require_config(), 1);
@@ -89665,10 +89665,10 @@ var init_LoginCredentialsFetcher = __esm(() => {
89665
89665
  await fs4.writeFile(tokenFilePath, JSON.stringify(token, null, 2), "utf8");
89666
89666
  }
89667
89667
  getTokenFilePath() {
89668
- const directory = process.env.AWS_LOGIN_CACHE_DIRECTORY ?? join27(homedir2(), ".aws", "login", "cache");
89668
+ const directory = process.env.AWS_LOGIN_CACHE_DIRECTORY ?? join28(homedir2(), ".aws", "login", "cache");
89669
89669
  const loginSessionBytes = Buffer.from(this.loginSession, "utf8");
89670
89670
  const loginSessionSha256 = createHash15("sha256").update(loginSessionBytes).digest("hex");
89671
- return join27(directory, `${loginSessionSha256}.json`);
89671
+ return join28(directory, `${loginSessionSha256}.json`);
89672
89672
  }
89673
89673
  derToRawSignature(derSignature) {
89674
89674
  let offset = 2;
@@ -98123,7 +98123,7 @@ import { Client as Client3 } from "@opensearch-project/opensearch";
98123
98123
  import { AwsSigv4Signer as AwsSigv4Signer2 } from "@opensearch-project/opensearch/aws";
98124
98124
  import { createHash as createHash17 } from "crypto";
98125
98125
  import { mkdir as mkdir6, rename as rename3, rm as rm8, stat as stat3 } from "fs/promises";
98126
- import { join as join29, resolve as resolve4 } from "path";
98126
+ import { join as join30, resolve as resolve4 } from "path";
98127
98127
  import { execFile as execFile2, spawn as spawn3 } from "child_process";
98128
98128
  import { promisify as promisify3 } from "util";
98129
98129
  import { BigFloat, parse as parse10 } from "@awsless/big-float";
@@ -98170,9 +98170,9 @@ var import_decompress, import_sleep_await, mock, searchClient = (options = {}, s
98170
98170
  }
98171
98171
  return true;
98172
98172
  }, download = async ({ version: version3 }) => {
98173
- const path6 = join29(getDownloadPath(), "min");
98173
+ const path6 = join30(getDownloadPath(), "min");
98174
98174
  const name = `opensearch-${version3}`;
98175
- const file3 = join29(path6, name);
98175
+ const file3 = join30(path6, name);
98176
98176
  if (await exists$1(file3))
98177
98177
  return file3;
98178
98178
  console.log(`Downloading OpenSearch ${version3}`);
@@ -98188,14 +98188,14 @@ var import_decompress, import_sleep_await, mock, searchClient = (options = {}, s
98188
98188
  const checksum = (await checksumResponse.text()).split(/\s+/)[0];
98189
98189
  if (createHash17("sha512").update(buffer).digest("hex") !== checksum)
98190
98190
  throw new Error(`The OpenSearch archive doesn't match its published sha512 checksum: ${url2}`);
98191
- const staging = join29(path6, `staging-${process.pid}`);
98191
+ const staging = join30(path6, `staging-${process.pid}`);
98192
98192
  await mkdir6(staging, {
98193
98193
  recursive: true,
98194
98194
  mode: "0777"
98195
98195
  });
98196
98196
  await import_decompress.default(buffer, staging);
98197
98197
  try {
98198
- await rename3(join29(staging, name), file3);
98198
+ await rename3(join30(staging, name), file3);
98199
98199
  } catch (error52) {
98200
98200
  if (!await exists$1(file3))
98201
98201
  throw error52;
@@ -98207,7 +98207,7 @@ var import_decompress, import_sleep_await, mock, searchClient = (options = {}, s
98207
98207
  return file3;
98208
98208
  }, exec4, MINIMUM_JAVA_VERSION = 21, getJavaVersion = async (home) => {
98209
98209
  try {
98210
- const result = await exec4(join29(home, "bin/java"), ["-version"]);
98210
+ const result = await exec4(join30(home, "bin/java"), ["-version"]);
98211
98211
  const match2 = `${result.stdout}${result.stderr}`.match(/version "(\d+)/);
98212
98212
  if (match2)
98213
98213
  return Number(match2[1]);
@@ -98245,13 +98245,13 @@ var import_decompress, import_sleep_await, mock, searchClient = (options = {}, s
98245
98245
  return ["-E", `${key}=${value}`];
98246
98246
  }).flat();
98247
98247
  }, launch = async ({ path: path6, host, port, version: version3, debug: debug4, onExit: onDied, onOutput }) => {
98248
- const cache3 = join29(path6, "cache", String(port));
98248
+ const cache3 = join30(path6, "cache", String(port));
98249
98249
  const cleanUp = async () => {
98250
98250
  if (await exists2(cache3))
98251
98251
  await rm8(cache3, { recursive: true });
98252
98252
  };
98253
98253
  await cleanUp();
98254
- const binary = join29(path6, "bin/opensearch");
98254
+ const binary = join30(path6, "bin/opensearch");
98255
98255
  const env3 = { ...process.env };
98256
98256
  if (process.platform === "darwin") {
98257
98257
  const javaHome = await findJavaHome();
@@ -143374,7 +143374,7 @@ var commandFeature = defineFeature({
143374
143374
  });
143375
143375
 
143376
143376
  // src/feature/config/index.ts
143377
- import { join as join9 } from "path";
143377
+ import { join as join10 } from "path";
143378
143378
 
143379
143379
  // src/dev/servers/ssm.ts
143380
143380
  import { readFile as readFile7 } from "fs/promises";
@@ -143383,6 +143383,7 @@ import { createServer as createServer2 } from "http";
143383
143383
  // src/dev/util.ts
143384
143384
  import { randomBytes } from "crypto";
143385
143385
  import { createServer } from "net";
143386
+ import { join as join9 } from "path";
143386
143387
 
143387
143388
  // src/dev/children.ts
143388
143389
  var import_tree_kill = __toESM(require_tree_kill(), 1);
@@ -143453,6 +143454,27 @@ process.once("exit", () => {
143453
143454
 
143454
143455
  // src/dev/util.ts
143455
143456
  var LOCAL_ACCOUNT_ID = "000000000000";
143457
+ var WATCHDOG_FILE = "parent-watchdog.cjs";
143458
+ var WATCHDOG_SOURCE = `const parent = process.ppid
143459
+ const timer = setInterval(() => {
143460
+ // Probing the parent instead of watching process.ppid: bun caches
143461
+ // the ppid at startup, so a reparenting is invisible there.
143462
+ try {
143463
+ process.kill(parent, 0)
143464
+ } catch (_) {
143465
+ process.exit(0)
143466
+ }
143467
+ }, 2000)
143468
+
143469
+ // An unref'd timer never fires on bun, so only node children get the
143470
+ // unref that lets them exit naturally.
143471
+ if (typeof Bun === 'undefined') {
143472
+ timer.unref()
143473
+ }
143474
+ `;
143475
+ var watchdogPath = () => {
143476
+ return join9(directories.output, "local", WATCHDOG_FILE);
143477
+ };
143456
143478
  var TRACE_HEADER = "x-awsless-trace";
143457
143479
  var traceId = () => randomBytes(4).toString("hex");
143458
143480
  var formatTraceHeader = (trace) => `${trace.traceId}:${trace.spanId}`;
@@ -143781,7 +143803,7 @@ var configFeature = defineFeature({
143781
143803
  for (const name of names) {
143782
143804
  ctx.registerResource({ kind: "config", id: name });
143783
143805
  }
143784
- const file3 = join9(directories.output, "local", "config.json");
143806
+ const file3 = join10(directories.output, "local", "config.json");
143785
143807
  const { server, port } = await ctx.keep("shim:ssm", file3, async () => {
143786
143808
  const server2 = createSsmServer({ file: file3 });
143787
143809
  const port2 = await server2.listen();
@@ -144371,7 +144393,7 @@ var import_deepmerge2 = __toESM(require_cjs2(), 1);
144371
144393
  // src/feature/function/util.ts
144372
144394
  import { createHash as createHash8 } from "crypto";
144373
144395
  import { readdir as readdir3, readFile as readFile8, rm as rm7, writeFile as writeFile7 } from "fs/promises";
144374
- import { dirname as dirname5, join as join10 } from "path";
144396
+ import { dirname as dirname5, join as join11 } from "path";
144375
144397
  import { fileURLToPath as fileURLToPath2 } from "url";
144376
144398
  import { days, seconds, toDays as toDays3, toSeconds as toSeconds4 } from "@awsless/duration";
144377
144399
  import { generateFileHash as generateFileHash2 } from "@awsless/ts-file-cache";
@@ -144464,7 +144486,7 @@ export default (event, context) => {
144464
144486
  }
144465
144487
  `;
144466
144488
  const temp = await createTempFolder(name);
144467
- const entryFile = join10(temp.path, "entry.ts");
144489
+ const entryFile = join11(temp.path, "entry.ts");
144468
144490
  await writeFile7(entryFile, entry);
144469
144491
  const result = await bundleTypeScriptWithRolldown({
144470
144492
  file: entryFile,
@@ -144507,7 +144529,7 @@ export default (event, context) => {
144507
144529
  const dir = getBuildPath("function", name, "files");
144508
144530
  const files = await readdir3(dir);
144509
144531
  const archive = await zipFiles([
144510
- ...files.filter((file3) => !file3.endsWith(".map")).map((file3) => ({ name: file3, path: join10(dir, file3) })),
144532
+ ...files.filter((file3) => !file3.endsWith(".map")).map((file3) => ({ name: file3, path: join11(dir, file3) })),
144511
144533
  { name: "awsless-env.mjs", code: Buffer.from(envFile, "utf8") }
144512
144534
  ]);
144513
144535
  await writeFile7(zipFile, archive);
@@ -144725,8 +144747,8 @@ var createLambdaFunction = (ctx, id, local) => {
144725
144747
  const bundle = ctx.shared.get("bundle", "main");
144726
144748
  const distDir = dirname5(fileURLToPath2(import.meta.url));
144727
144749
  const proxy = createLambdaFunctionFromZip(group, ctx, "function", `${id}-proxy`, {
144728
- zipFile: join10(distDir, "/prebuild/sandbox-proxy/bundle.zip"),
144729
- sourceHash: $file(join10(distDir, "/prebuild/sandbox-proxy/HASH")),
144750
+ zipFile: join11(distDir, "/prebuild/sandbox-proxy/bundle.zip"),
144751
+ sourceHash: $file(join11(distDir, "/prebuild/sandbox-proxy/HASH")),
144730
144752
  runtime: "nodejs24.x",
144731
144753
  handler: "index.default",
144732
144754
  publish: true,
@@ -145110,7 +145132,7 @@ var functionFeature = defineFeature({
145110
145132
  });
145111
145133
 
145112
145134
  // src/feature/icon/index.ts
145113
- import { dirname as dirname6, join as join12 } from "path";
145135
+ import { dirname as dirname6, join as join13 } from "path";
145114
145136
  import { fileURLToPath as fileURLToPath3 } from "url";
145115
145137
  import { toDays as toDays4 } from "@awsless/duration";
145116
145138
  import { formatRouteEnvName as formatRouteEnvName2 } from "awsless";
@@ -148405,7 +148427,7 @@ Ze.glob = Ze;
148405
148427
 
148406
148428
  // src/feature/icon/dev.ts
148407
148429
  import { cp } from "fs/promises";
148408
- import { isAbsolute as isAbsolute2, join as join11 } from "path";
148430
+ import { isAbsolute as isAbsolute2, join as join12 } from "path";
148409
148431
  import { formatRouteEnvName } from "awsless";
148410
148432
  var iconOnDev = async (ctx) => {
148411
148433
  const icons = ctx.stackConfigs.flatMap((stack) => Object.keys(stack.icons ?? {}));
@@ -148444,8 +148466,8 @@ var iconOnDev = async (ctx) => {
148444
148466
  }
148445
148467
  if (props.origin.static) {
148446
148468
  ctx.addEnv(formatRouteEnvName(routeKey, "ICON_ORIGIN_S3"), "true");
148447
- const source = isAbsolute2(props.origin.static) ? props.origin.static : join11(directories.root, props.origin.static);
148448
- await cp(source, join11(directories.output, "local", "store", bucket, folder, "origin"), {
148469
+ const source = isAbsolute2(props.origin.static) ? props.origin.static : join12(directories.root, props.origin.static);
148470
+ await cp(source, join12(directories.output, "local", "store", bucket, folder, "origin"), {
148449
148471
  recursive: true
148450
148472
  });
148451
148473
  }
@@ -148492,7 +148514,7 @@ var iconFeature = defineFeature({
148492
148514
  const serverRouteKey = formatRouteKey(ctx.stack.name, "icon", id);
148493
148515
  bundle.addHandler({
148494
148516
  routeKey: serverRouteKey,
148495
- file: join12(dirname6(fileURLToPath3(import.meta.url)), "/handlers/icon.js"),
148517
+ file: join13(dirname6(fileURLToPath3(import.meta.url)), "/handlers/icon.js"),
148496
148518
  exportName: "default"
148497
148519
  });
148498
148520
  addRoutes({
@@ -148532,8 +148554,8 @@ var iconFeature = defineFeature({
148532
148554
  new aws.s3.BucketObject(group, `static-${file3}`, {
148533
148555
  bucket: bucket.name,
148534
148556
  key: `${folder}origin/${file3}`,
148535
- source: join12(props.origin.static, file3),
148536
- sourceHash: $hash(join12(props.origin.static, file3))
148557
+ source: join13(props.origin.static, file3),
148558
+ sourceHash: $hash(join13(props.origin.static, file3))
148537
148559
  }, {
148538
148560
  replaceOnChanges: ["bucket", "key"]
148539
148561
  });
@@ -148549,14 +148571,14 @@ var iconFeature = defineFeature({
148549
148571
  // src/feature/image/index.ts
148550
148572
  import { createHash as createHash9 } from "crypto";
148551
148573
  import { readFile as readFile9 } from "fs/promises";
148552
- import { dirname as dirname7, join as join14 } from "path";
148574
+ import { dirname as dirname7, join as join15 } from "path";
148553
148575
  import { fileURLToPath as fileURLToPath4 } from "url";
148554
148576
  import { toDays as toDays5 } from "@awsless/duration";
148555
148577
  import { formatRouteEnvName as formatRouteEnvName4 } from "awsless";
148556
148578
 
148557
148579
  // src/feature/image/dev.ts
148558
148580
  import { cp as cp2 } from "fs/promises";
148559
- import { isAbsolute as isAbsolute3, join as join13 } from "path";
148581
+ import { isAbsolute as isAbsolute3, join as join14 } from "path";
148560
148582
  import { formatRouteEnvName as formatRouteEnvName3 } from "awsless";
148561
148583
  var imageOnDev = async (ctx) => {
148562
148584
  const images = ctx.stackConfigs.flatMap((stack) => Object.keys(stack.images ?? {}));
@@ -148595,8 +148617,8 @@ var imageOnDev = async (ctx) => {
148595
148617
  }
148596
148618
  if (props.origin.static) {
148597
148619
  ctx.addEnv(formatRouteEnvName3(routeKey, "IMAGE_ORIGIN_S3"), "true");
148598
- const source = isAbsolute3(props.origin.static) ? props.origin.static : join13(directories.root, props.origin.static);
148599
- await cp2(source, join13(directories.output, "local", "store", bucket, folder, "origin"), {
148620
+ const source = isAbsolute3(props.origin.static) ? props.origin.static : join14(directories.root, props.origin.static);
148621
+ await cp2(source, join14(directories.output, "local", "store", bucket, folder, "origin"), {
148600
148622
  recursive: true
148601
148623
  });
148602
148624
  }
@@ -148626,7 +148648,7 @@ var imageFeature = defineFeature({
148626
148648
  throw new FileError("app.json", "The image feature requires an arm64 function bundle.");
148627
148649
  }
148628
148650
  const group = new Group(ctx.base, "image", "layer");
148629
- const path3 = join14(dirname7(fileURLToPath4(import.meta.url)), "/layers/sharp-arm.zip");
148651
+ const path3 = join15(dirname7(fileURLToPath4(import.meta.url)), "/layers/sharp-arm.zip");
148630
148652
  const layerId = formatGlobalResourceName({
148631
148653
  appName: ctx.appConfig.name,
148632
148654
  resourceType: "layer",
@@ -148706,7 +148728,7 @@ var imageFeature = defineFeature({
148706
148728
  const serverRouteKey = formatRouteKey(ctx.stack.name, "image", id);
148707
148729
  bundle.addHandler({
148708
148730
  routeKey: serverRouteKey,
148709
- file: join14(dirname7(fileURLToPath4(import.meta.url)), "/handlers/image.js"),
148731
+ file: join15(dirname7(fileURLToPath4(import.meta.url)), "/handlers/image.js"),
148710
148732
  exportName: "default",
148711
148733
  external: ["sharp"]
148712
148734
  });
@@ -148744,8 +148766,8 @@ var imageFeature = defineFeature({
148744
148766
  new aws.s3.BucketObject(group, `static-${file3}`, {
148745
148767
  bucket: bucket.name,
148746
148768
  key: `${folder}origin/${file3}`,
148747
- source: join14(props.origin.static, file3),
148748
- sourceHash: $hash(join14(props.origin.static, file3))
148769
+ source: join15(props.origin.static, file3),
148770
+ sourceHash: $hash(join15(props.origin.static, file3))
148749
148771
  }, {
148750
148772
  replaceOnChanges: ["bucket", "key"]
148751
148773
  });
@@ -148762,14 +148784,14 @@ var imageFeature = defineFeature({
148762
148784
  import { days as days2, seconds as seconds2, toSeconds as toSeconds6 } from "@awsless/duration";
148763
148785
 
148764
148786
  // src/feature/instance/dev.ts
148765
- import { dirname as dirname10, join as join17 } from "path";
148787
+ import { dirname as dirname10, join as join18 } from "path";
148766
148788
  var import_deepmerge3 = __toESM(require_cjs2(), 1);
148767
148789
 
148768
148790
  // src/feature/site/dev.ts
148769
- import { delimiter, dirname as dirname9, isAbsolute as isAbsolute4, join as join16, normalize as normalize2, relative as relative4 } from "path";
148791
+ import { delimiter, dirname as dirname9, isAbsolute as isAbsolute4, join as join17, normalize as normalize2, relative as relative4 } from "path";
148770
148792
 
148771
148793
  // src/feature/site/static-routes.ts
148772
- import { basename, dirname as dirname8, join as join15 } from "path";
148794
+ import { basename, dirname as dirname8, join as join16 } from "path";
148773
148795
  var isPageFile = (file3) => {
148774
148796
  return file3.endsWith(".html") || !basename(file3).includes(".");
148775
148797
  };
@@ -148788,10 +148810,10 @@ var planStaticRoutes = (files, sitePath) => {
148788
148810
  const pages = files.filter((file3) => isPageFile(file3));
148789
148811
  const assets = files.filter((file3) => !isPageFile(file3));
148790
148812
  for (const page of pages) {
148791
- plan.files[join15(sitePath, pageUrl(page))] = page;
148813
+ plan.files[join16(sitePath, pageUrl(page))] = page;
148792
148814
  }
148793
148815
  if (sitePath !== "/") {
148794
- plan.catchAll = join15(sitePath, "*.");
148816
+ plan.catchAll = join16(sitePath, "*.");
148795
148817
  return plan;
148796
148818
  }
148797
148819
  const folders = new Set;
@@ -148801,9 +148823,9 @@ var planStaticRoutes = (files, sitePath) => {
148801
148823
  folders.add(folder);
148802
148824
  continue;
148803
148825
  }
148804
- plan.files[join15(sitePath, asset)] = asset;
148826
+ plan.files[join16(sitePath, asset)] = asset;
148805
148827
  }
148806
- plan.dirs = [...folders].map((folder) => join15(sitePath, folder, "*."));
148828
+ plan.dirs = [...folders].map((folder) => join16(sitePath, folder, "*."));
148807
148829
  return plan;
148808
148830
  };
148809
148831
 
@@ -148812,7 +148834,7 @@ var binPath = (from) => {
148812
148834
  const paths = [];
148813
148835
  let dir = from;
148814
148836
  while (true) {
148815
- paths.push(join16(dir, "node_modules", ".bin"));
148837
+ paths.push(join17(dir, "node_modules", ".bin"));
148816
148838
  const parent = dirname9(dir);
148817
148839
  if (parent === dir) {
148818
148840
  break;
@@ -148844,7 +148866,7 @@ var siteOnDev = async (ctx) => {
148844
148866
  async start({ env: env2 }) {
148845
148867
  const value = await ctx.keep(key, { command, port, env: env2 }, async () => {
148846
148868
  const [bin, ...args] = command.split(" ");
148847
- const cwd = join16(directories.root, dirname9(stackConfig.file));
148869
+ const cwd = join17(directories.root, dirname9(stackConfig.file));
148848
148870
  const sink3 = {
148849
148871
  emit: () => {},
148850
148872
  stopping: false
@@ -148923,7 +148945,7 @@ ${tail.join(`
148923
148945
  hostname: "127.0.0.1",
148924
148946
  async fetch(request) {
148925
148947
  const pathname = decodeURIComponent(new URL(request.url).pathname);
148926
- const path3 = normalize2(join16(staticDir, pathname));
148948
+ const path3 = normalize2(join17(staticDir, pathname));
148927
148949
  const rel = relative4(normalize2(staticDir), path3);
148928
148950
  if (rel.startsWith("..") || isAbsolute4(rel)) {
148929
148951
  return new Response("Forbidden", { status: 403 });
@@ -148977,7 +148999,11 @@ ${tail.join(`
148977
148999
  // src/feature/instance/dev.ts
148978
149000
  var instanceOnDev = async (ctx) => {
148979
149001
  const instances = ctx.stackConfigs.flatMap((stackConfig) => {
148980
- return Object.entries(stackConfig.instances ?? {}).map(([id, props]) => ({ stackConfig, id, props }));
149002
+ return Object.entries(stackConfig.instances ?? {}).map(([id, props]) => ({
149003
+ stackConfig,
149004
+ id,
149005
+ props
149006
+ }));
148981
149007
  });
148982
149008
  if (instances.length === 0) {
148983
149009
  return;
@@ -148997,7 +149023,7 @@ var instanceOnDev = async (ctx) => {
148997
149023
  const healthPort = await findFreePort();
148998
149024
  const merged = import_deepmerge3.default(ctx.appConfig.instance ?? {}, props);
148999
149025
  const file3 = merged.code.file;
149000
- const cwd = join17(directories.root, dirname10(stackConfig.file));
149026
+ const cwd = join18(directories.root, dirname10(stackConfig.file));
149001
149027
  let child;
149002
149028
  let stopping = false;
149003
149029
  let restarting = false;
@@ -149025,7 +149051,7 @@ var instanceOnDev = async (ctx) => {
149025
149051
  const tail = [];
149026
149052
  boot = () => {
149027
149053
  ctx.reportHealth(`instance ${id}`, "up");
149028
- child = spawnDevChild("bun", [file3], {
149054
+ child = spawnDevChild("bun", ["-r", watchdogPath(), file3], {
149029
149055
  cwd,
149030
149056
  stdio: ["ignore", "pipe", "pipe"],
149031
149057
  env: {
@@ -149061,7 +149087,11 @@ var instanceOnDev = async (ctx) => {
149061
149087
  logs_exports.error(`The instance "${id}" exited with code ${code}:
149062
149088
  ${tail.join(`
149063
149089
  `)}`);
149064
- ctx.emitEvent(channel, { date: Date.now(), line: `Exited with code ${code}`, error: true });
149090
+ ctx.emitEvent(channel, {
149091
+ date: Date.now(),
149092
+ line: `Exited with code ${code}`,
149093
+ error: true
149094
+ });
149065
149095
  }
149066
149096
  ctx.reportHealth(`instance ${id}`, "down", code !== null ? `exited with code ${code}` : `killed by ${signal}`);
149067
149097
  });
@@ -149089,7 +149119,7 @@ ${tail.join(`
149089
149119
 
149090
149120
  // src/feature/instance/util.ts
149091
149121
  import { createHash as createHash11 } from "crypto";
149092
- import { join as join19 } from "path";
149122
+ import { join as join20 } from "path";
149093
149123
  import { toDays as toDays6, toSeconds as toSeconds5 } from "@awsless/duration";
149094
149124
  import { stringify } from "@awsless/json";
149095
149125
  import { generateFileHash as generateFileHash3 } from "@awsless/ts-file-cache";
@@ -149098,9 +149128,9 @@ var import_deepmerge4 = __toESM(require_cjs2(), 1);
149098
149128
  // src/feature/instance/build/executable.ts
149099
149129
  import { createHash as createHash10 } from "crypto";
149100
149130
  import { readFile as readFile10 } from "fs/promises";
149101
- import { join as join18 } from "path";
149131
+ import { join as join19 } from "path";
149102
149132
  var buildExecutable = async (input, outputPath, architecture) => {
149103
- const filePath = join18(outputPath, "program");
149133
+ const filePath = join19(outputPath, "program");
149104
149134
  const target2 = architecture === "x86_64" ? "bun-linux-x64" : "bun-linux-arm64";
149105
149135
  let result;
149106
149136
  try {
@@ -149346,7 +149376,7 @@ var createFargateTask = (parentGroup, ctx, ns2, id, local) => {
149346
149376
  healthCheck: props.healthCheck ? {
149347
149377
  command: [
149348
149378
  "CMD-SHELL",
149349
- `curl -f http://${join19("localhost", props.healthCheck.path)} || exit 1`
149379
+ `curl -f http://${join20("localhost", props.healthCheck.path)} || exit 1`
149350
149380
  ],
149351
149381
  interval: toSeconds5(props.healthCheck.interval),
149352
149382
  retries: props.healthCheck.retries,
@@ -149559,10 +149589,10 @@ var import_deepmerge5 = __toESM(require_cjs2(), 1);
149559
149589
  // src/feature/job/build/executable.ts
149560
149590
  import { createHash as createHash12 } from "crypto";
149561
149591
  import { readFile as readFile11, writeFile as writeFile8 } from "fs/promises";
149562
- import { join as join20, resolve as resolve3 } from "path";
149592
+ import { join as join21, resolve as resolve3 } from "path";
149563
149593
  var buildJobExecutable = async (input, outputPath, architecture) => {
149564
- const filePath = join20(outputPath, "program");
149565
- const wrapperPath = join20(outputPath, "wrapper.ts");
149594
+ const filePath = join21(outputPath, "program");
149595
+ const wrapperPath = join21(outputPath, "wrapper.ts");
149566
149596
  const handlerPath = resolve3(input);
149567
149597
  await writeFile8(wrapperPath, `import { parse } from '@awsless/json'
149568
149598
  import { getObject } from '@awsless/s3'
@@ -150249,7 +150279,7 @@ var metricFeature = defineFeature({
150249
150279
  });
150250
150280
 
150251
150281
  // src/feature/on-error-log/index.ts
150252
- import { dirname as dirname11, join as join21 } from "path";
150282
+ import { dirname as dirname11, join as join22 } from "path";
150253
150283
  import { fileURLToPath as fileURLToPath5 } from "url";
150254
150284
  import { days as days3 } from "@awsless/duration";
150255
150285
  var onErrorLogFeature = defineFeature({
@@ -150275,7 +150305,7 @@ var onErrorLogFeature = defineFeature({
150275
150305
  const build2 = registerFunctionBuild(ctx, name, {
150276
150306
  code: consumer.code,
150277
150307
  handler: consumer.handler,
150278
- wrapper: join21(dirname11(fileURLToPath5(import.meta.url)), "/handlers/on-error-log.js")
150308
+ wrapper: join22(dirname11(fileURLToPath5(import.meta.url)), "/handlers/on-error-log.js")
150279
150309
  });
150280
150310
  const handler = createLambdaFunctionFromZip(group, ctx, "on-error-log", "handler", {
150281
150311
  zipFile: build2.zipFile,
@@ -150315,7 +150345,7 @@ var onErrorLogFeature = defineFeature({
150315
150345
  });
150316
150346
 
150317
150347
  // src/feature/on-failure/index.ts
150318
- import { dirname as dirname12, join as join22 } from "path";
150348
+ import { dirname as dirname12, join as join23 } from "path";
150319
150349
  import { fileURLToPath as fileURLToPath6 } from "url";
150320
150350
  import { days as days4, toSeconds as toSeconds9 } from "@awsless/duration";
150321
150351
  var onFailureFeature = defineFeature({
@@ -150499,7 +150529,7 @@ var onFailureFeature = defineFeature({
150499
150529
  const build2 = registerFunctionBuild(ctx, name, {
150500
150530
  code: consumer.code,
150501
150531
  handler: consumer.handler,
150502
- wrapper: join22(dirname12(fileURLToPath6(import.meta.url)), "/handlers/on-failure.js")
150532
+ wrapper: join23(dirname12(fileURLToPath6(import.meta.url)), "/handlers/on-failure.js")
150503
150533
  });
150504
150534
  const handler = createLambdaFunctionFromZip(group, ctx, "on-failure", "handler", {
150505
150535
  zipFile: build2.zipFile,
@@ -150586,11 +150616,11 @@ var onFailureFeature = defineFeature({
150586
150616
  // src/feature/pubsub/index.ts
150587
150617
  import { createHmac as createHmac2 } from "crypto";
150588
150618
  import { fileURLToPath as fileURLToPath9 } from "url";
150589
- import { dirname as dirname15, join as join26 } from "path";
150619
+ import { dirname as dirname15, join as join27 } from "path";
150590
150620
  import { formatRouteEnvName as formatRouteEnvName6 } from "awsless";
150591
150621
 
150592
150622
  // src/feature/pubsub/dev.ts
150593
- import { dirname as dirname13, join as join23 } from "path";
150623
+ import { dirname as dirname13, join as join24 } from "path";
150594
150624
  import { fileURLToPath as fileURLToPath7 } from "url";
150595
150625
  var import_ioredis2 = __toESM(require_built3(), 1);
150596
150626
  import { formatRouteEnvName as formatRouteEnvName5 } from "awsless";
@@ -150845,8 +150875,8 @@ var pubsubOnDev = async (ctx) => {
150845
150875
  const sink3 = {
150846
150876
  stopping: false
150847
150877
  };
150848
- const runtime = join23(dirname13(fileURLToPath7(import.meta.url)), "handlers", "pubsub-server.js");
150849
- const child = spawnDevChild(process.execPath, [runtime], {
150878
+ const runtime = join24(dirname13(fileURLToPath7(import.meta.url)), "handlers", "pubsub-server.js");
150879
+ const child = spawnDevChild(process.execPath, ["-r", watchdogPath(), runtime], {
150850
150880
  stdio: ["ignore", "ignore", "pipe"],
150851
150881
  env: {
150852
150882
  PATH: process.env.PATH,
@@ -150921,14 +150951,14 @@ var durationMax = (max) => {
150921
150951
  import { stat as stat2 } from "fs/promises";
150922
150952
 
150923
150953
  // src/config/schema/relative-path.ts
150924
- import { join as join24 } from "path";
150954
+ import { join as join25 } from "path";
150925
150955
  var basePath;
150926
150956
  var setLocalBasePath = (path3) => {
150927
150957
  basePath = path3;
150928
150958
  };
150929
150959
  var resolvePath = (path3) => {
150930
150960
  if (path3.startsWith(".") && basePath) {
150931
- return join24(basePath, path3);
150961
+ return join25(basePath, path3);
150932
150962
  }
150933
150963
  return path3;
150934
150964
  };
@@ -151455,7 +151485,7 @@ var pubsubEventTypes = ["connected", "disconnected", "subscribed", "unsubscribed
151455
151485
  import { createHash as createHash14 } from "crypto";
151456
151486
  import { readFile as readFile12 } from "fs/promises";
151457
151487
  import { fileURLToPath as fileURLToPath8 } from "url";
151458
- import { dirname as dirname14, join as join25 } from "path";
151488
+ import { dirname as dirname14, join as join26 } from "path";
151459
151489
  import { toDays as toDays10 } from "@awsless/duration";
151460
151490
  import { stringify as stringify3 } from "@awsless/json";
151461
151491
  var __dirname2 = dirname14(fileURLToPath8(import.meta.url));
@@ -151474,7 +151504,7 @@ var createPubSubService = (parentGroup, ctx, id, props, inputs) => {
151474
151504
  });
151475
151505
  const shortName = shortId(`${ctx.app.name}:pubsub:${id}:${ctx.appId}`);
151476
151506
  const image = "public.ecr.aws/aws-cli/aws-cli:arm64";
151477
- const bundleFile = join25(__dirname2, "handlers/pubsub-server.js");
151507
+ const bundleFile = join26(__dirname2, "handlers/pubsub-server.js");
151478
151508
  ctx.registerBuild("pubsub", name, async (build2) => {
151479
151509
  const hash3 = createHash14("sha1").update(await readFile12(bundleFile)).digest("hex");
151480
151510
  const fingerprint = `${hash3}-${ARCHITECTURE}`;
@@ -152009,7 +152039,7 @@ var pubsubFeature = defineFeature({
152009
152039
  const publisherRouteKey = formatRouteKey("base", "pubsub", `${id}-publisher`);
152010
152040
  bundle.addHandler({
152011
152041
  routeKey: publisherRouteKey,
152012
- file: join26(__dirname3, "/handlers/pubsub-publisher.js"),
152042
+ file: join27(__dirname3, "/handlers/pubsub-publisher.js"),
152013
152043
  exportName: "default"
152014
152044
  });
152015
152045
  bundle.addEnv(formatRouteEnvName6(publisherRouteKey, "REDIS_HOST"), redisHost);
@@ -165807,7 +165837,7 @@ var routerFeature = defineFeature({
165807
165837
  });
165808
165838
 
165809
165839
  // src/feature/rpc/index.ts
165810
- import { dirname as dirname17, join as join28, relative as relative7 } from "path";
165840
+ import { dirname as dirname17, join as join29, relative as relative7 } from "path";
165811
165841
  import { fileURLToPath as fileURLToPath10 } from "url";
165812
165842
  import { toSeconds as toSeconds14 } from "@awsless/duration";
165813
165843
  import { formatRouteEnvName as formatRouteEnvName8 } from "awsless";
@@ -165924,7 +165954,7 @@ var rpcFeature = defineFeature({
165924
165954
  const serverRouteKey = formatRouteKey("base", "rpc", id);
165925
165955
  bundle.addHandler({
165926
165956
  routeKey: serverRouteKey,
165927
- file: join28(dirname17(fileURLToPath10(import.meta.url)), "/handlers/rpc.js"),
165957
+ file: join29(dirname17(fileURLToPath10(import.meta.url)), "/handlers/rpc.js"),
165928
165958
  exportName: "default"
165929
165959
  });
165930
165960
  bundle.addEnv(formatRouteEnvName8(serverRouteKey, "TIMEOUT"), toSeconds14(ctx.appConfig.function.timeout).toString());
@@ -166288,11 +166318,11 @@ var searchFeature = defineFeature({
166288
166318
 
166289
166319
  // src/feature/site/index.ts
166290
166320
  import { createHash as createHash18 } from "crypto";
166291
- import { dirname as dirname18, join as join32 } from "path";
166321
+ import { dirname as dirname18, join as join33 } from "path";
166292
166322
 
166293
166323
  // src/formation/s3.ts
166294
166324
  import { readFile as readFile13 } from "fs/promises";
166295
- import { join as join30, posix as posix2 } from "path";
166325
+ import { join as join31, posix as posix2 } from "path";
166296
166326
  import { PutObjectCommand as PutObjectCommand2, S3Client as S3Client2 } from "@aws-sdk/client-s3";
166297
166327
 
166298
166328
  // ../../node_modules/.pnpm/p-limit@7.3.1/node_modules/p-limit/index.js
@@ -166524,7 +166554,7 @@ var createS3Provider = ({ credentials: credentials2, region }) => {
166524
166554
  await client.send(new PutObjectCommand2({
166525
166555
  Bucket: state.bucket,
166526
166556
  Key: posix2.join(state.prefix, `v-${state.version}`, file3),
166527
- Body: await readFile13(join30(state.source, file3)),
166557
+ Body: await readFile13(join31(state.source, file3)),
166528
166558
  ContentType: getContentType(file3),
166529
166559
  CacheControl: getCacheControl(file3)
166530
166560
  }));
@@ -166551,7 +166581,7 @@ var createS3Provider = ({ credentials: credentials2, region }) => {
166551
166581
 
166552
166582
  // src/util/cache.ts
166553
166583
  import { lstat as lstat2, readdir as readdir4 } from "fs/promises";
166554
- import { join as join31 } from "path";
166584
+ import { join as join32 } from "path";
166555
166585
  var generateCacheKey = async (directories2) => {
166556
166586
  const files = await listAllFiles(directories2);
166557
166587
  const sortedFiles = files.toSorted();
@@ -166578,7 +166608,7 @@ var listAllFiles = async (list2) => {
166578
166608
  recursive: true,
166579
166609
  withFileTypes: true
166580
166610
  });
166581
- files.push(...dirents.filter((d3) => d3.isFile()).map((file3) => join31(file3.parentPath, file3.name)));
166611
+ files.push(...dirents.filter((d3) => d3.isFile()).map((file3) => join32(file3.parentPath, file3.name)));
166582
166612
  } else if (stat4.isFile()) {
166583
166613
  files.push(entry);
166584
166614
  }
@@ -166608,7 +166638,7 @@ var siteFeature = defineFeature({
166608
166638
  return build2(fingerprint, async (write2) => {
166609
166639
  const credentialProvider = await getCredentials(ctx.appConfig.profile);
166610
166640
  const credentials2 = await credentialProvider();
166611
- const cwd2 = join32(directories.root, dirname18(ctx.stackConfig.file));
166641
+ const cwd2 = join33(directories.root, dirname18(ctx.stackConfig.file));
166612
166642
  const env3 = {
166613
166643
  ...process.env,
166614
166644
  PATH: binPath(cwd2),
@@ -166693,7 +166723,7 @@ ${(errors4.trim() || output.trim()).slice(-2000)}`);
166693
166723
  cwd: staticDir,
166694
166724
  nodir: true
166695
166725
  }).toSorted();
166696
- const hashes = files.map((file3) => $hash(join32(staticDir, file3)));
166726
+ const hashes = files.map((file3) => $hash(join33(staticDir, file3)));
166697
166727
  const version3 = $combine(...hashes).pipe((hashes2) => {
166698
166728
  const hash3 = createHash18("sha1");
166699
166729
  for (const [index, file3] of files.entries()) {
@@ -166742,7 +166772,7 @@ ${(errors4.trim() || output.trim()).slice(-2000)}`);
166742
166772
 
166743
166773
  // src/feature/store/index.ts
166744
166774
  import { cp as cp3 } from "fs/promises";
166745
- import { join as join33 } from "path";
166775
+ import { join as join34 } from "path";
166746
166776
  import { toDays as toDays11 } from "@awsless/duration";
166747
166777
  var typeGenCode11 = `
166748
166778
  import { Body, PutObjectProps, BodyStream } from '@awsless/s3'
@@ -166808,7 +166838,7 @@ var storeFeature = defineFeature({
166808
166838
  for (const [id, props] of Object.entries(stack.stores ?? {})) {
166809
166839
  if (typeof props.static === "string") {
166810
166840
  const folder = getFeatureFolder("store", stack.name, id);
166811
- await cp3(props.static, join33(directories.output, "local", "store", bucket, folder), {
166841
+ await cp3(props.static, join34(directories.output, "local", "store", bucket, folder), {
166812
166842
  recursive: true,
166813
166843
  force: true
166814
166844
  });
@@ -166893,8 +166923,8 @@ var storeFeature = defineFeature({
166893
166923
  key: `${folder}${file3}`,
166894
166924
  cacheControl: getCacheControl(file3),
166895
166925
  contentType: getContentType(file3),
166896
- source: join33(props.static, file3),
166897
- sourceHash: $hash(join33(props.static, file3))
166926
+ source: join34(props.static, file3),
166927
+ sourceHash: $hash(join34(props.static, file3))
166898
166928
  }, {
166899
166929
  replaceOnChanges: ["bucket", "key"]
166900
166930
  });
@@ -166915,14 +166945,14 @@ import { toSeconds as toSeconds15 } from "@awsless/duration";
166915
166945
 
166916
166946
  // src/feature/table/dev.ts
166917
166947
  import { readFile as readFile14 } from "fs/promises";
166918
- import { join as join35 } from "path";
166948
+ import { join as join36 } from "path";
166919
166949
  import { CreateTableCommand as CreateTableCommand2, DeleteTableCommand } from "@aws-sdk/client-dynamodb";
166920
166950
  import { PutCommand } from "@aws-sdk/lib-dynamodb";
166921
166951
 
166922
166952
  // src/dev/reset.ts
166923
166953
  var import_ioredis3 = __toESM(require_built3(), 1);
166924
166954
  import { readdir as readdir5, rm as rm9 } from "fs/promises";
166925
- import { join as join34 } from "path";
166955
+ import { join as join35 } from "path";
166926
166956
  import { DeleteCommand, ScanCommand } from "@aws-sdk/lib-dynamodb";
166927
166957
  import { Client as Client5 } from "@opensearch-project/opensearch";
166928
166958
  var wiping = false;
@@ -166978,14 +167008,14 @@ var createDataReset = (props) => {
166978
167008
  }
166979
167009
  }
166980
167010
  }
166981
- const storeRoot = join34(directories.output, "local", "store");
167011
+ const storeRoot = join35(directories.output, "local", "store");
166982
167012
  try {
166983
167013
  for (const bucket of await readdir5(storeRoot)) {
166984
- for (const entry of await readdir5(join34(storeRoot, bucket))) {
167014
+ for (const entry of await readdir5(join35(storeRoot, bucket))) {
166985
167015
  if (entry === "image" || entry === "icon") {
166986
167016
  continue;
166987
167017
  }
166988
- await rm9(join34(storeRoot, bucket, entry), { recursive: true, force: true });
167018
+ await rm9(join35(storeRoot, bucket, entry), { recursive: true, force: true });
166989
167019
  }
166990
167020
  }
166991
167021
  } catch {}
@@ -167053,7 +167083,7 @@ var createTableInput = (name, props) => {
167053
167083
  };
167054
167084
  };
167055
167085
  var loadSeed = async (stackName, id) => {
167056
- const file3 = join35(directories.output, "local", "seed", "table", stackName, `${id}.json`);
167086
+ const file3 = join36(directories.output, "local", "seed", "table", stackName, `${id}.json`);
167057
167087
  try {
167058
167088
  const items = JSON.parse(await readFile14(file3, "utf8"));
167059
167089
  return Array.isArray(items) ? items : [];
@@ -168102,7 +168132,7 @@ var createApp = (props) => {
168102
168132
 
168103
168133
  // src/util/workspace.ts
168104
168134
  import { mkdir as mkdir7, readFile as readFile15, rm as rm10, writeFile as writeFile10 } from "fs/promises";
168105
- import { dirname as dirname19, join as join36 } from "path";
168135
+ import { dirname as dirname19, join as join37 } from "path";
168106
168136
  var getStateBucketName = (region, accountId) => {
168107
168137
  return `awsless-state-${region}-${accountId}`;
168108
168138
  };
@@ -168166,7 +168196,7 @@ var createWorkSpace = async (props) => {
168166
168196
  };
168167
168197
  };
168168
168198
  var pullRemoteState = async (app, stateBackend) => {
168169
- const file3 = join36(directories.state, `${app.urn}.json`);
168199
+ const file3 = join37(directories.state, `${app.urn}.json`);
168170
168200
  const state = await stateBackend.get(app.urn);
168171
168201
  await mkdir7(dirname19(file3), { recursive: true });
168172
168202
  if (typeof state === "undefined") {
@@ -168179,14 +168209,14 @@ var pullRemoteState = async (app, stateBackend) => {
168179
168209
  }
168180
168210
  };
168181
168211
  var pushRemoteState = async (app, stateBackend) => {
168182
- const file3 = join36(directories.state, `${app.urn}.json`);
168212
+ const file3 = join37(directories.state, `${app.urn}.json`);
168183
168213
  const data = await readFile15(file3, "utf8");
168184
168214
  const state = JSON.parse(data);
168185
168215
  await stateBackend.update(app.urn, state);
168186
168216
  };
168187
168217
 
168188
168218
  // src/config/load/load.ts
168189
- import { basename as basename3, dirname as dirname21, join as join38 } from "path";
168219
+ import { basename as basename3, dirname as dirname21, join as join39 } from "path";
168190
168220
 
168191
168221
  // src/feature/alert/schema.ts
168192
168222
  var AlertNameSchema = exports_external.string().min(3).max(256).regex(/^[a-z0-9-]+$/i, "Invalid alert name").transform((value) => kebabCase(value)).describe("Define alert name.");
@@ -169065,7 +169095,7 @@ var StackSchema = exports_external.object({
169065
169095
 
169066
169096
  // src/config/load/read.ts
169067
169097
  import { readFile as readFile16 } from "fs/promises";
169068
- import { basename as basename2, dirname as dirname20, extname as extname5, join as join37 } from "path";
169098
+ import { basename as basename2, dirname as dirname20, extname as extname5, join as join38 } from "path";
169069
169099
 
169070
169100
  // ../../node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/module/core.mjs
169071
169101
  var exports_core3 = {};
@@ -169816,7 +169846,7 @@ var readConfigWithStage = async (file3, stage) => {
169816
169846
  }
169817
169847
  const ext2 = extname5(file3);
169818
169848
  const stageFileName = basename2(file3, ext2) + "." + stage + ext2;
169819
- const stageFile = join37(dirname20(file3), stageFileName);
169849
+ const stageFile = join38(dirname20(file3), stageFileName);
169820
169850
  const stageFileExists = await fileExist(stageFile);
169821
169851
  if (!stageFileExists) {
169822
169852
  return {
@@ -169836,7 +169866,7 @@ var readConfigWithStage = async (file3, stage) => {
169836
169866
  // src/config/load/load.ts
169837
169867
  var loadAppConfig = async (options) => {
169838
169868
  debug("Find the root directory");
169839
- const cwd2 = options.configFile ? dirname21(join38(process.cwd(), options.configFile)) : process.cwd();
169869
+ const cwd2 = options.configFile ? dirname21(join39(process.cwd(), options.configFile)) : process.cwd();
169840
169870
  const configFileOptions = options.configFile ? [basename3(options.configFile)] : ["app.json", "app.jsonc", "app.json5"];
169841
169871
  const [appFileName, root4] = await findRootDir(cwd2, configFileOptions);
169842
169872
  setRoot(root4);
@@ -169864,8 +169894,8 @@ var loadStackConfigs = async (options) => {
169864
169894
  continue;
169865
169895
  }
169866
169896
  debug("Load stack file:", color2.info(file3));
169867
- const stackConfig = await readConfigWithStage(join38(directories.root, file3), options.stage);
169868
- setLocalBasePath(join38(directories.root, dirname21(file3)));
169897
+ const stackConfig = await readConfigWithStage(join39(directories.root, file3), options.stage);
169898
+ setLocalBasePath(join39(directories.root, dirname21(file3)));
169869
169899
  const stack = await validateConfig(StackSchema, stackConfig.file, stackConfig.data);
169870
169900
  stacks.push({
169871
169901
  ...stack,
@@ -170631,12 +170661,12 @@ var auth = (program3) => {
170631
170661
 
170632
170662
  // src/cli/command/bind.ts
170633
170663
  import { readFile as readFile17 } from "fs/promises";
170634
- import { join as join39 } from "path";
170664
+ import { join as join40 } from "path";
170635
170665
  var bind = (program3) => {
170636
170666
  program3.command("bind").argument("[command...]", "The command to execute").option("--config <string...>", "List of config values that will be accessable", (v3) => v3.split(",")).option("--local", "Bind against the running local dev environment instead of the deployed app").description(`Bind your site environment variables to a command`).action(async (commands4 = [], opts) => {
170637
170667
  await layout("bind", async ({ appConfig, stackConfigs }) => {
170638
170668
  if (opts.local) {
170639
- const file3 = join39(directories.output, "local", "env.json");
170669
+ const file3 = join40(directories.output, "local", "env.json");
170640
170670
  let env4;
170641
170671
  try {
170642
170672
  env4 = JSON.parse(await readFile17(file3, "utf8"));
@@ -173195,12 +173225,12 @@ import { DynamoDBClient as DynamoDBClient4 } from "@awsless/dynamodb";
173195
173225
 
173196
173226
  // src/test/environment.ts
173197
173227
  import { mkdir as mkdir8, writeFile as writeFile11 } from "fs/promises";
173198
- import { join as join41 } from "path";
173228
+ import { join as join42 } from "path";
173199
173229
 
173200
173230
  // src/test/manifest.ts
173201
- import { isAbsolute as isAbsolute5, join as join40 } from "path";
173231
+ import { isAbsolute as isAbsolute5, join as join41 } from "path";
173202
173232
  var absolute = (file3) => {
173203
- return isAbsolute5(file3) ? file3 : join40(directories.root, file3);
173233
+ return isAbsolute5(file3) ? file3 : join41(directories.root, file3);
173204
173234
  };
173205
173235
  var createTestManifest = (appConfig, stackConfigs) => {
173206
173236
  const manifest = {
@@ -173291,7 +173321,7 @@ var waitForSearch2 = async (port, timeoutMs) => {
173291
173321
  };
173292
173322
  var withTestEnvironment = async (appConfig, stackConfigs, run) => {
173293
173323
  const manifest = createTestManifest(appConfig, stackConfigs);
173294
- const manifestFile = join41(directories.output, "test", "manifest.json");
173324
+ const manifestFile = join42(directories.output, "test", "manifest.json");
173295
173325
  let redis;
173296
173326
  let killSearch;
173297
173327
  let booting;
@@ -173318,7 +173348,7 @@ var withTestEnvironment = async (appConfig, stackConfigs, run) => {
173318
173348
  await redis.ping();
173319
173349
  manifest.servers.redis = { host: "127.0.0.1", port: await redis.getPort() };
173320
173350
  }
173321
- await mkdir8(join41(directories.output, "test"), { recursive: true });
173351
+ await mkdir8(join42(directories.output, "test"), { recursive: true });
173322
173352
  await writeFile11(manifestFile, JSON.stringify(manifest));
173323
173353
  })();
173324
173354
  return booting;
@@ -173335,14 +173365,14 @@ var withTestEnvironment = async (appConfig, stackConfigs, run) => {
173335
173365
  import { createHash as createHash19 } from "crypto";
173336
173366
  import { mkdir as mkdir9, readdir as readdir6, readFile as readFile18, writeFile as writeFile12 } from "fs/promises";
173337
173367
  import { availableParallelism } from "os";
173338
- import { join as join43, relative as relative10, sep as sep2 } from "path";
173368
+ import { join as join44, relative as relative10, sep as sep2 } from "path";
173339
173369
  import { inspect } from "util";
173340
173370
  var import_wildstring2 = __toESM(require_wildstring(), 1);
173341
173371
  import { parse as parse11, stringify as stringify4 } from "@awsless/json";
173342
173372
  import { generateFileHash as generateFileHash5, generateFolderHash, loadWorkspace as loadWorkspace2 } from "@awsless/ts-file-cache";
173343
173373
 
173344
173374
  // src/test/start.ts
173345
- import { dirname as dirname22, join as join42 } from "path";
173375
+ import { dirname as dirname22, join as join43 } from "path";
173346
173376
  import { fileURLToPath as fileURLToPath12 } from "url";
173347
173377
  import { configDefaults } from "vitest/config";
173348
173378
  import { startVitest } from "vitest/node";
@@ -173436,7 +173466,7 @@ var startProjectsTest = async (props) => {
173436
173466
  exclude: ["**/_*", "**/_*/**", ...configDefaults.exclude],
173437
173467
  globals: true,
173438
173468
  env: project.env,
173439
- setupFiles: [join42(__dirname4, "test-global-setup.js")]
173469
+ setupFiles: [join43(__dirname4, "test-global-setup.js")]
173440
173470
  }
173441
173471
  }))
173442
173472
  }, {
@@ -173637,7 +173667,7 @@ var countTestFiles = async (dir) => {
173637
173667
  if (!entry.isFile() || !/\.(js|jsx|ts|tsx)$/.test(entry.name)) {
173638
173668
  return false;
173639
173669
  }
173640
- const relativePath2 = relative10(dir, join43(entry.parentPath, entry.name));
173670
+ const relativePath2 = relative10(dir, join44(entry.parentPath, entry.name));
173641
173671
  return relativePath2.split(sep2).every((segment) => !segment.startsWith("_"));
173642
173672
  }).length;
173643
173673
  };
@@ -173684,7 +173714,7 @@ var runTests = async (tests, stackFilters = [], testFilters = [], opts) => {
173684
173714
  if (files === 0) {
173685
173715
  continue;
173686
173716
  }
173687
- const file3 = join43(directories.test, `${test.name}.json`);
173717
+ const file3 = join44(directories.test, `${test.name}.json`);
173688
173718
  const fingerprint = fingerprints.get(dir);
173689
173719
  const cached2 = await readCachedResult(file3, fingerprint);
173690
173720
  if (cached2) {
@@ -174225,18 +174255,18 @@ var watchConfig = async (options, resolve5, reject) => {
174225
174255
  // src/dev/index.ts
174226
174256
  import { watch as watch2 } from "fs";
174227
174257
  import { mkdir as mkdir12, rm as rm13, writeFile as writeFile16 } from "fs/promises";
174228
- import { basename as basename5, dirname as dirname25, join as join50, sep as sep6 } from "path";
174258
+ import { basename as basename5, dirname as dirname25, join as join51, sep as sep6 } from "path";
174229
174259
  import { loadWorkspace as loadWorkspace3 } from "@awsless/ts-file-cache";
174230
174260
 
174231
174261
  // src/dev/context.ts
174232
- import { join as join45 } from "path";
174262
+ import { join as join46 } from "path";
174233
174263
  import { DynamoDBServer } from "@awsless/dynamodb-server";
174234
174264
 
174235
174265
  // src/dev/servers/s3.ts
174236
174266
  import { createHash as createHash20 } from "crypto";
174237
174267
  import { mkdir as mkdir10, readdir as readdir7, readFile as readFile19, rm as rm11, stat as stat6, writeFile as writeFile13 } from "fs/promises";
174238
174268
  import { createServer as createServer7 } from "http";
174239
- import { dirname as dirname23, isAbsolute as isAbsolute6, join as join44, relative as relative11, sep as sep4 } from "path";
174269
+ import { dirname as dirname23, isAbsolute as isAbsolute6, join as join45, relative as relative11, sep as sep4 } from "path";
174240
174270
  var escapeXml = (value) => {
174241
174271
  return value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&apos;");
174242
174272
  };
@@ -174301,8 +174331,8 @@ var createS3Server = (props) => {
174301
174331
  res.end(xmlError("InvalidRequest", "Missing bucket name"));
174302
174332
  return;
174303
174333
  }
174304
- const bucketDir = join44(props.root, bucket);
174305
- const file3 = join44(bucketDir, ...keyParts);
174334
+ const bucketDir = join45(props.root, bucket);
174335
+ const file3 = join45(bucketDir, ...keyParts);
174306
174336
  const escapes = (base, path6) => {
174307
174337
  const rel = relative11(base, path6);
174308
174338
  return rel.startsWith("..") || isAbsolute6(rel);
@@ -174323,7 +174353,7 @@ var createS3Server = (props) => {
174323
174353
  return;
174324
174354
  }
174325
174355
  for (const entry of entries2) {
174326
- const path6 = join44(dir, entry.name);
174356
+ const path6 = join45(dir, entry.name);
174327
174357
  if (entry.isDirectory()) {
174328
174358
  await walk2(path6);
174329
174359
  } else {
@@ -174797,7 +174827,7 @@ var createDevContext = (props) => {
174797
174827
  const value = await props.pool.keep("store", null, async () => {
174798
174828
  const rules = [];
174799
174829
  const server = createS3Server({
174800
- root: join45(directories.output, "local", "store"),
174830
+ root: join46(directories.output, "local", "store"),
174801
174831
  region: props.appConfig.region,
174802
174832
  rules
174803
174833
  });
@@ -174927,14 +174957,14 @@ var import_ioredis4 = __toESM(require_built3(), 1);
174927
174957
  import { randomUUID as randomUUID8 } from "crypto";
174928
174958
  import { readdir as readdir8, readFile as readFile20, stat as stat7, writeFile as writeFile15 } from "fs/promises";
174929
174959
  import { createServer as createServer9 } from "http";
174930
- import { join as join47, relative as relative12, sep as sep5 } from "path";
174960
+ import { join as join48, relative as relative12, sep as sep5 } from "path";
174931
174961
  import { DynamoDBClient as DynamoDBClient6 } from "@aws-sdk/client-dynamodb";
174932
174962
  import { DynamoDBDocumentClient, ScanCommand as ScanCommand2 } from "@aws-sdk/lib-dynamodb";
174933
174963
 
174934
174964
  // src/dev/worker.ts
174935
174965
  import { writeFile as writeFile14 } from "fs/promises";
174936
174966
  import { availableParallelism as availableParallelism2 } from "os";
174937
- import { join as join46 } from "path";
174967
+ import { join as join47 } from "path";
174938
174968
  class WorkerError extends Error {
174939
174969
  name;
174940
174970
  constructor(name, message3, stack) {
@@ -174965,6 +174995,19 @@ import { format } from 'node:util'
174965
174995
  let handler
174966
174996
  let getCurrentRoute = () => undefined
174967
174997
 
174998
+ // A dev server dying without a graceful stop (a crash, kill -9) can
174999
+ // never ask its workers to exit - so the worker probes the parent &
175000
+ // exits on its own instead of lingering forever. Probing instead of
175001
+ // watching process.ppid, which bun caches at startup.
175002
+ const parentPid = process.ppid
175003
+ setInterval(() => {
175004
+ try {
175005
+ process.kill(parentPid, 0)
175006
+ } catch (_) {
175007
+ process.exit(0)
175008
+ }
175009
+ }, 2000).unref()
175010
+
174968
175011
  // The trace of the running invocation, set per dispatch by the dev
174969
175012
  // server. The async context keeps it accurate under concurrent
174970
175013
  // requests, exactly like the route context.
@@ -175141,7 +175184,7 @@ var createBundleWorker = (props) => {
175141
175184
  throw new Error("The bundle worker never became ready.");
175142
175185
  };
175143
175186
  const startWorker = async () => {
175144
- const entry = join46(props.buildDir, "worker.mjs");
175187
+ const entry = join47(props.buildDir, "worker.mjs");
175145
175188
  const port = await findFreePort();
175146
175189
  const child = spawnDevChild("node", ["--enable-source-maps", entry], {
175147
175190
  cwd: props.buildDir,
@@ -175202,7 +175245,7 @@ var createBundleWorker = (props) => {
175202
175245
  return worker;
175203
175246
  };
175204
175247
  const doStart = async () => {
175205
- await writeFile14(join46(props.buildDir, "worker.mjs"), WORKER_ENTRY);
175248
+ await writeFile14(join47(props.buildDir, "worker.mjs"), WORKER_ENTRY);
175206
175249
  const results = await Promise.allSettled(Array.from({ length: concurrency }, () => startWorker()));
175207
175250
  const started = results.filter((result) => result.status === "fulfilled").map((result) => result.value);
175208
175251
  const failed = results.find((result) => result.status === "rejected");
@@ -177621,7 +177664,7 @@ var createDashboardServer = (props) => {
177621
177664
  return;
177622
177665
  }
177623
177666
  for (const entry of entries2) {
177624
- const path6 = join47(dir, entry.name);
177667
+ const path6 = join48(dir, entry.name);
177625
177668
  if (entry.isDirectory()) {
177626
177669
  await walk2(path6);
177627
177670
  } else {
@@ -177830,15 +177873,15 @@ var createFailureReporter = (props) => {
177830
177873
  // src/dev/sdk.ts
177831
177874
  import { readdir as readdir9, readFile as readFile21, mkdir as mkdir11, rm as rm12, stat as stat8, symlink } from "fs/promises";
177832
177875
  import { createRequire } from "module";
177833
- import { dirname as dirname24, join as join48 } from "path";
177876
+ import { dirname as dirname24, join as join49 } from "path";
177834
177877
  var linkSdkPackages = async (workspace, buildDir, onWarn) => {
177835
- const filesDir = join48(buildDir, "files");
177878
+ const filesDir = join49(buildDir, "files");
177836
177879
  const packages = new Set;
177837
177880
  for (const file3 of await readdir9(filesDir)) {
177838
177881
  if (!file3.endsWith(".mjs")) {
177839
177882
  continue;
177840
177883
  }
177841
- const code = await readFile21(join48(filesDir, file3), "utf8");
177884
+ const code = await readFile21(join49(filesDir, file3), "utf8");
177842
177885
  for (const match3 of code.matchAll(/(?:from\s*|import\()\s*["'](@aws-sdk\/[a-z0-9-]+|sharp)["']/g)) {
177843
177886
  packages.add(match3[1]);
177844
177887
  }
@@ -177846,7 +177889,7 @@ var linkSdkPackages = async (workspace, buildDir, onWarn) => {
177846
177889
  const ownRequire = createRequire(import.meta.url);
177847
177890
  const isProjectDep = async (name) => {
177848
177891
  try {
177849
- await stat8(join48(directories.root, "node_modules", name, "package.json"));
177892
+ await stat8(join49(directories.root, "node_modules", name, "package.json"));
177850
177893
  return true;
177851
177894
  } catch {
177852
177895
  return false;
@@ -177855,19 +177898,19 @@ var linkSdkPackages = async (workspace, buildDir, onWarn) => {
177855
177898
  const resolveFromDependents = async (name) => {
177856
177899
  const roots = Object.values(workspace.packages).flatMap((pkg) => [
177857
177900
  pkg.path,
177858
- ...Object.entries(pkg.dependencies).map(([dependency, info2]) => info2.type === "workspace" ? workspace.packages[info2.link]?.path : join48(pkg.path, "node_modules", dependency))
177901
+ ...Object.entries(pkg.dependencies).map(([dependency, info2]) => info2.type === "workspace" ? workspace.packages[info2.link]?.path : join49(pkg.path, "node_modules", dependency))
177859
177902
  ]);
177860
177903
  for (const root4 of roots.filter((root5) => typeof root5 === "string").toSorted()) {
177861
- const path6 = join48(root4, "node_modules", name);
177904
+ const path6 = join49(root4, "node_modules", name);
177862
177905
  try {
177863
- await stat8(join48(path6, "package.json"));
177906
+ await stat8(join49(path6, "package.json"));
177864
177907
  return path6;
177865
177908
  } catch {}
177866
177909
  }
177867
177910
  return;
177868
177911
  };
177869
177912
  for (const name of packages) {
177870
- const target2 = join48(buildDir, "node_modules", name);
177913
+ const target2 = join49(buildDir, "node_modules", name);
177871
177914
  try {
177872
177915
  if (await isProjectDep(name)) {
177873
177916
  await rm12(target2, { recursive: true, force: true });
@@ -177886,7 +177929,7 @@ var linkSdkPackages = async (workspace, buildDir, onWarn) => {
177886
177929
  await mkdir11(dirname24(target2), { recursive: true });
177887
177930
  await rm12(target2, { recursive: true, force: true });
177888
177931
  await symlink(source, target2, "dir");
177889
- await stat8(join48(target2, "package.json"));
177932
+ await stat8(join49(target2, "package.json"));
177890
177933
  debug(`Sdk link ${name}: ${source}`);
177891
177934
  } catch (error52) {
177892
177935
  onWarn?.(`Linking the "${name}" sdk package failed: ${error52 instanceof Error ? error52.message : String(error52)}`);
@@ -177896,9 +177939,9 @@ var linkSdkPackages = async (workspace, buildDir, onWarn) => {
177896
177939
 
177897
177940
  // src/dev/seed.ts
177898
177941
  import { spawn as spawn4 } from "child_process";
177899
- import { isAbsolute as isAbsolute7, join as join49 } from "path";
177942
+ import { isAbsolute as isAbsolute7, join as join50 } from "path";
177900
177943
  var createSeedRunner = (props) => {
177901
- const file3 = props.seed && (isAbsolute7(props.seed) ? props.seed : join49(directories.root, props.seed));
177944
+ const file3 = props.seed && (isAbsolute7(props.seed) ? props.seed : join50(directories.root, props.seed));
177902
177945
  let running;
177903
177946
  const run = () => {
177904
177947
  running ??= (async () => {
@@ -178074,21 +178117,39 @@ var startDev = async (props) => {
178074
178117
  dev: true
178075
178118
  });
178076
178119
  ready2();
178077
- await mkdir12(join50(directories.output, "local"), { recursive: true });
178120
+ await mkdir12(join51(directories.output, "local"), { recursive: true });
178121
+ await writeFile16(watchdogPath(), WATCHDOG_SOURCE);
178078
178122
  const routerPorts = {};
178079
178123
  Object.keys(appConfig.router ?? {}).forEach((id, index) => {
178080
178124
  routerPorts[id] = props.port + 1 + index;
178081
178125
  });
178082
178126
  const firstBoot = props.pool.peek("session") === undefined;
178083
178127
  props.pool.begin();
178084
- await props.pool.keep("session", null, async () => ({ value: true, stop: () => {} }));
178085
- const dev = createDevContext({ appConfig, stackConfigs, appId, routerPorts, log: log2, pool: props.pool });
178128
+ await props.pool.keep("session", null, async () => ({
178129
+ value: true,
178130
+ stop: () => {}
178131
+ }));
178132
+ const dev = createDevContext({
178133
+ appConfig,
178134
+ stackConfigs,
178135
+ appId,
178136
+ routerPorts,
178137
+ log: log2,
178138
+ pool: props.pool
178139
+ });
178086
178140
  setDebugSink((type, message3) => {
178087
- dev.events.emit("debug", { date: Date.now(), line: message3, error: type === "error" });
178141
+ dev.events.emit("debug", {
178142
+ date: Date.now(),
178143
+ line: message3,
178144
+ error: type === "error"
178145
+ });
178088
178146
  });
178089
178147
  const bundleName = getBundleFunctionName(appConfig.name);
178090
178148
  const buildDir = getBuildPath("bundle", bundleName, ".");
178091
- const { env: env3, lambda } = await phase({ start: "Preparing the local resources...", done: "Prepared the local resources" }, async (detail) => {
178149
+ const { env: env3, lambda } = await phase({
178150
+ start: "Preparing the local resources...",
178151
+ done: "Prepared the local resources"
178152
+ }, async (detail) => {
178092
178153
  const timings = [];
178093
178154
  for (const feature of features) {
178094
178155
  if (!feature.onDev) {
@@ -178103,7 +178164,9 @@ var startDev = async (props) => {
178103
178164
  props.pool.retain("lambda");
178104
178165
  await props.pool.sweep();
178105
178166
  const blocked = await props.pool.keep("blocked", null, async () => {
178106
- const server = createBlockedServer({ onLog: (message3) => debug(message3) });
178167
+ const server = createBlockedServer({
178168
+ onLog: (message3) => debug(message3)
178169
+ });
178107
178170
  const port = await server.listen();
178108
178171
  return { value: { server, port }, stop: () => server.stop() };
178109
178172
  });
@@ -178132,7 +178195,7 @@ var startDev = async (props) => {
178132
178195
  for (const [id, port] of Object.entries(routerPorts)) {
178133
178196
  env4[`ROUTER_${constantCase(id)}_ENDPOINT`] = `localhost:${port}`;
178134
178197
  }
178135
- await writeFile16(join50(directories.output, "local", "env.json"), JSON.stringify(env4, null, "\t") + `
178198
+ await writeFile16(join51(directories.output, "local", "env.json"), JSON.stringify(env4, null, "\t") + `
178136
178199
  `);
178137
178200
  return { env: env4, lambda: lambda2 };
178138
178201
  });
@@ -178141,7 +178204,9 @@ var startDev = async (props) => {
178141
178204
  const buildAll = async () => {
178142
178205
  let changed = false;
178143
178206
  for (const builder of sorted) {
178144
- const meta3 = await build(builder.type, builder.name, builder.builder, { workspace });
178207
+ const meta3 = await build(builder.type, builder.name, builder.builder, {
178208
+ workspace
178209
+ });
178145
178210
  if (!meta3?.cached) {
178146
178211
  changed = true;
178147
178212
  }
@@ -178251,7 +178316,10 @@ var startDev = async (props) => {
178251
178316
  const started = Date.now();
178252
178317
  const route = describeDispatch(event);
178253
178318
  const payload = describePayload(event);
178254
- const trace = { traceId: parent?.traceId ?? traceId(), spanId: traceId() };
178319
+ const trace = {
178320
+ traceId: parent?.traceId ?? traceId(),
178321
+ spanId: traceId()
178322
+ };
178255
178323
  try {
178256
178324
  const result = await worker.dispatch(event, formatTraceHeader(trace));
178257
178325
  dev.events.emit("activity", {
@@ -178303,7 +178371,10 @@ var startDev = async (props) => {
178303
178371
  report(failure);
178304
178372
  };
178305
178373
  lambda.connect(dispatch, reportFailure);
178306
- await phase({ start: "Starting the local servers...", done: "Started the local servers" }, async (detail) => {
178374
+ await phase({
178375
+ start: "Starting the local servers...",
178376
+ done: "Started the local servers"
178377
+ }, async (detail) => {
178307
178378
  const timings = [];
178308
178379
  for (const server of dev.servers) {
178309
178380
  const started = Date.now();
@@ -178312,7 +178383,10 @@ var startDev = async (props) => {
178312
178383
  }
178313
178384
  detail(breakdown(timings));
178314
178385
  });
178315
- await phase({ start: "Starting the bundle worker...", done: "Started the bundle worker" }, async (detail) => {
178386
+ await phase({
178387
+ start: "Starting the bundle worker...",
178388
+ done: "Started the bundle worker"
178389
+ }, async (detail) => {
178316
178390
  try {
178317
178391
  await worker.start();
178318
178392
  dev.context.reportHealth("workers", "up", String(worker.size()));
@@ -178375,8 +178449,8 @@ var startDev = async (props) => {
178375
178449
  resources: dev.resources,
178376
178450
  routes: dev.routes,
178377
178451
  env: env3,
178378
- storeRoot: join50(directories.output, "local", "store"),
178379
- configFile: join50(directories.output, "local", "config.json"),
178452
+ storeRoot: join51(directories.output, "local", "store"),
178453
+ configFile: join51(directories.output, "local", "config.json"),
178380
178454
  getEmails: () => props.pool.peek("shim:ses-email")?.server.list() ?? [],
178381
178455
  getAlerts: () => props.pool.peek("shim:sns")?.alerts ?? [],
178382
178456
  getSession: () => ({ startedAt, workers: worker.size() }),
@@ -178439,7 +178513,7 @@ var startDev = async (props) => {
178439
178513
  routerPorts,
178440
178514
  async stop() {
178441
178515
  stopping = true;
178442
- await rm13(join50(directories.output, "local", "env.json"), { force: true });
178516
+ await rm13(join51(directories.output, "local", "env.json"), { force: true });
178443
178517
  clearTimeout(rebuildTimer);
178444
178518
  watcher.close();
178445
178519
  for (const restartWatcher of restartWatchers) {
@@ -178507,7 +178581,7 @@ var createServerPool = () => {
178507
178581
 
178508
178582
  // src/type-gen/generate.ts
178509
178583
  import { mkdir as mkdir13, writeFile as writeFile17 } from "fs/promises";
178510
- import { dirname as dirname26, join as join51, relative as relative13 } from "path";
178584
+ import { dirname as dirname26, join as join52, relative as relative13 } from "path";
178511
178585
  var generateTypes = async (props) => {
178512
178586
  const files = [];
178513
178587
  await Promise.all(features.map(async (feature) => {
@@ -178515,7 +178589,7 @@ var generateTypes = async (props) => {
178515
178589
  ...props,
178516
178590
  async write(file3, data, include = false) {
178517
178591
  const code = data?.toString("utf8");
178518
- const path6 = join51(directories.types, file3);
178592
+ const path6 = join52(directories.types, file3);
178519
178593
  if (code) {
178520
178594
  if (include) {
178521
178595
  files.push(relative13(directories.root, path6));
@@ -178529,7 +178603,7 @@ var generateTypes = async (props) => {
178529
178603
  if (files.length) {
178530
178604
  const code = files.map((file3) => `/// <reference path='${file3}' />`).join(`
178531
178605
  `);
178532
- await writeFile17(join51(directories.root, `awsless.d.ts`), code);
178606
+ await writeFile17(join52(directories.root, `awsless.d.ts`), code);
178533
178607
  }
178534
178608
  };
178535
178609
 
@@ -178557,6 +178631,7 @@ var dev = (program3) => {
178557
178631
  process.once("SIGINT", () => resolveShutdown());
178558
178632
  process.once("SIGTERM", () => resolveShutdown());
178559
178633
  };
178634
+ claimSignals();
178560
178635
  const start = async (appConfig = props.appConfig, stackConfigs = props.stackConfigs) => {
178561
178636
  let logger = (message3) => logs_exports.step(message3);
178562
178637
  const phase = async (titles, fn) => {
@@ -178596,7 +178671,12 @@ var dev = (program3) => {
178596
178671
  });
178597
178672
  claimSignals();
178598
178673
  };
178599
- await start();
178674
+ try {
178675
+ await start();
178676
+ } catch (error52) {
178677
+ await pool.stopAll().catch(() => {});
178678
+ throw error52;
178679
+ }
178600
178680
  let queuedConfig;
178601
178681
  let restartRun = Promise.resolve();
178602
178682
  let restarting = false;
@@ -180670,7 +180750,7 @@ var sinon;
180670
180750
  const arraySlice = arrayProto.slice;
180671
180751
  const concat = arrayProto.concat;
180672
180752
  const forEach = arrayProto.forEach;
180673
- const join52 = arrayProto.join;
180753
+ const join53 = arrayProto.join;
180674
180754
  const splice = arrayProto.splice;
180675
180755
  function applyDefaults(obj, defaults2) {
180676
180756
  for (const key of Object.keys(defaults2)) {
@@ -180706,7 +180786,7 @@ var sinon;
180706
180786
  let actual = "";
180707
180787
  if (!calledInOrder(arguments)) {
180708
180788
  try {
180709
- expected = join52(arguments, ", ");
180789
+ expected = join53(arguments, ", ");
180710
180790
  const calls = arraySlice(arguments);
180711
180791
  let i5 = calls.length;
180712
180792
  while (i5) {
@@ -180714,7 +180794,7 @@ var sinon;
180714
180794
  splice(calls, i5, 1);
180715
180795
  }
180716
180796
  }
180717
- actual = join52(orderByFirstCall(calls), ", ");
180797
+ actual = join53(orderByFirstCall(calls), ", ");
180718
180798
  } catch (e5) {}
180719
180799
  failAssertion(this, `expected ${expected} to be called in order but were called as ${actual}`);
180720
180800
  } else {
@@ -180759,7 +180839,7 @@ var sinon;
180759
180839
  ` expected = ${inspect2(expectation)}`,
180760
180840
  ` actual = ${inspect2(actual)}`
180761
180841
  ];
180762
- failAssertion(this, join52(formatted, `
180842
+ failAssertion(this, join53(formatted, `
180763
180843
  `));
180764
180844
  }
180765
180845
  }
@@ -180864,7 +180944,7 @@ var sinon;
180864
180944
  const valueToString = require2("@sinonjs/commons").valueToString;
180865
180945
  const exportAsyncBehaviors = require2("./util/core/export-async-behaviors");
180866
180946
  const concat = arrayProto.concat;
180867
- const join52 = arrayProto.join;
180947
+ const join53 = arrayProto.join;
180868
180948
  const reverse = arrayProto.reverse;
180869
180949
  const slice = arrayProto.slice;
180870
180950
  const useLeftMostCallback = -1;
@@ -180901,7 +180981,7 @@ var sinon;
180901
180981
  msg = `${functionName(behavior.stub)} expected to yield, but no callback was passed.`;
180902
180982
  }
180903
180983
  if (args.length > 0) {
180904
- msg += ` Received [${join52(args, ", ")}]`;
180984
+ msg += ` Received [${join53(args, ", ")}]`;
180905
180985
  }
180906
180986
  return msg;
180907
180987
  }
@@ -181711,7 +181791,7 @@ var sinon;
181711
181791
  const filter2 = arrayProto.filter;
181712
181792
  const forEach = arrayProto.forEach;
181713
181793
  const every = arrayProto.every;
181714
- const join52 = arrayProto.join;
181794
+ const join53 = arrayProto.join;
181715
181795
  const push = arrayProto.push;
181716
181796
  const slice = arrayProto.slice;
181717
181797
  const unshift = arrayProto.unshift;
@@ -181788,10 +181868,10 @@ var sinon;
181788
181868
  });
181789
181869
  this.restore();
181790
181870
  if (messages.length > 0) {
181791
- mockExpectation.fail(join52(concat(messages, met), `
181871
+ mockExpectation.fail(join53(concat(messages, met), `
181792
181872
  `));
181793
181873
  } else if (met.length > 0) {
181794
- mockExpectation.pass(join52(concat(messages, met), `
181874
+ mockExpectation.pass(join53(concat(messages, met), `
181795
181875
  `));
181796
181876
  }
181797
181877
  return true;
@@ -181844,7 +181924,7 @@ var sinon;
181844
181924
  args,
181845
181925
  stack: err.stack
181846
181926
  })}`);
181847
- mockExpectation.fail(join52(messages, `
181927
+ mockExpectation.fail(join53(messages, `
181848
181928
  `));
181849
181929
  }
181850
181930
  });
@@ -181951,14 +182031,14 @@ var sinon;
181951
182031
  const valueToString = require2("@sinonjs/commons").valueToString;
181952
182032
  const concat = arrayProto.concat;
181953
182033
  const filter2 = arrayProto.filter;
181954
- const join52 = arrayProto.join;
182034
+ const join53 = arrayProto.join;
181955
182035
  const map2 = arrayProto.map;
181956
182036
  const reduce = arrayProto.reduce;
181957
182037
  const slice = arrayProto.slice;
181958
182038
  function throwYieldError(proxy, text2, args) {
181959
182039
  let msg = functionName(proxy) + text2;
181960
182040
  if (args.length) {
181961
- msg += ` Received [${join52(slice(args), ", ")}]`;
182041
+ msg += ` Received [${join53(slice(args), ", ")}]`;
181962
182042
  }
181963
182043
  throw new Error(msg);
181964
182044
  }
@@ -182080,7 +182160,7 @@ var sinon;
182080
182160
  const formattedArgs = map2(this.args, function(arg) {
182081
182161
  return inspect2(arg);
182082
182162
  });
182083
- callStr = `${callStr + join52(formattedArgs, ", ")})`;
182163
+ callStr = `${callStr + join53(formattedArgs, ", ")})`;
182084
182164
  if (typeof this.returnValue !== "undefined") {
182085
182165
  callStr += ` => ${inspect2(this.returnValue)}`;
182086
182166
  }
@@ -182811,7 +182891,7 @@ var sinon;
182811
182891
  const timesInWords = require2("./util/core/times-in-words");
182812
182892
  const inspect2 = require2("util").inspect;
182813
182893
  const jsDiff = require2("diff");
182814
- const join52 = arrayProto.join;
182894
+ const join53 = arrayProto.join;
182815
182895
  const map2 = arrayProto.map;
182816
182896
  const push = arrayProto.push;
182817
182897
  const slice = arrayProto.slice;
@@ -182839,7 +182919,7 @@ var sinon;
182839
182919
  }
182840
182920
  return text2;
182841
182921
  });
182842
- return join52(objects, "");
182922
+ return join53(objects, "");
182843
182923
  }
182844
182924
  function quoteStringValue(value) {
182845
182925
  if (typeof value === "string") {
@@ -182897,7 +182977,7 @@ ${stringifiedCall}`;
182897
182977
  push(calls, stringifiedCall);
182898
182978
  }
182899
182979
  return calls.length > 0 ? `
182900
- ${join52(calls, `
182980
+ ${join53(calls, `
182901
182981
  `)}` : "";
182902
182982
  },
182903
182983
  t: function(spyInstance) {
@@ -182905,10 +182985,10 @@ ${join52(calls, `
182905
182985
  for (let i5 = 0, l4 = spyInstance.callCount;i5 < l4; ++i5) {
182906
182986
  push(objects, inspect2(spyInstance.thisValues[i5]));
182907
182987
  }
182908
- return join52(objects, ", ");
182988
+ return join53(objects, ", ");
182909
182989
  },
182910
182990
  "*": function(spyInstance, args) {
182911
- return join52(map2(args, function(arg) {
182991
+ return join53(map2(args, function(arg) {
182912
182992
  return inspect2(arg);
182913
182993
  }), ", ");
182914
182994
  }
@@ -183240,7 +183320,7 @@ ${join52(calls, `
183240
183320
  }, { "@sinonjs/commons": 48 }], 26: [function(require2, module, exports) {
183241
183321
  const arrayProto = require2("@sinonjs/commons").prototypes.array;
183242
183322
  const hasOwnProperty2 = require2("@sinonjs/commons").prototypes.object.hasOwnProperty;
183243
- const join52 = arrayProto.join;
183323
+ const join53 = arrayProto.join;
183244
183324
  const push = arrayProto.push;
183245
183325
  const hasDontEnumBug = function() {
183246
183326
  const obj = {
@@ -183281,7 +183361,7 @@ ${join52(calls, `
183281
183361
  push(result, obj[prop]());
183282
183362
  }
183283
183363
  }
183284
- return join52(result, "") !== "0123456789";
183364
+ return join53(result, "") !== "0123456789";
183285
183365
  }();
183286
183366
  function extendCommon(target2, sources, doCopy) {
183287
183367
  let source, i5, prop;
@@ -185346,7 +185426,7 @@ ${job.error.stack.split(`
185346
185426
  module.exports = matcherPrototype;
185347
185427
  }, { "../create-matcher": 63 }], 71: [function(require2, module, exports) {
185348
185428
  var functionName = require2("@sinonjs/commons").functionName;
185349
- var join52 = require2("@sinonjs/commons").prototypes.array.join;
185429
+ var join53 = require2("@sinonjs/commons").prototypes.array.join;
185350
185430
  var map2 = require2("@sinonjs/commons").prototypes.array.map;
185351
185431
  var stringIndexOf = require2("@sinonjs/commons").prototypes.string.indexOf;
185352
185432
  var valueToString = require2("@sinonjs/commons").valueToString;
@@ -185377,7 +185457,7 @@ ${job.error.stack.split(`
185377
185457
  m4.test = function(actual) {
185378
185458
  return matchObject(actual, expectation, match3);
185379
185459
  };
185380
- m4.message = `match(${join52(array3, ", ")})`;
185460
+ m4.message = `match(${join53(array3, ", ")})`;
185381
185461
  return m4;
185382
185462
  },
185383
185463
  regexp: function(m4, expectation) {
@@ -188701,7 +188781,7 @@ ${job.error.stack.split(`
188701
188781
  tokenize: function tokenize(value) {
188702
188782
  return value.split("");
188703
188783
  },
188704
- join: function join52(chars) {
188784
+ join: function join53(chars) {
188705
188785
  return chars.join("");
188706
188786
  }
188707
188787
  };