@awsless/cli 0.1.16 → 0.1.18

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 (2) hide show
  1. package/dist/bin.js +243 -1842
  2. package/package.json +11 -10
package/dist/bin.js CHANGED
@@ -118797,7 +118797,7 @@ var require_client4 = __commonJS((exports) => {
118797
118797
  };
118798
118798
  };
118799
118799
  var sleep2 = (seconds9) => {
118800
- return new Promise((resolve7) => setTimeout(resolve7, seconds9 * 1000));
118800
+ return new Promise((resolve5) => setTimeout(resolve5, seconds9 * 1000));
118801
118801
  };
118802
118802
  var waiterServiceDefaults = {
118803
118803
  minDelay: 2,
@@ -118926,8 +118926,8 @@ var require_client4 = __commonJS((exports) => {
118926
118926
  };
118927
118927
  var abortTimeout = (abortSignal) => {
118928
118928
  let onAbort;
118929
- const promise2 = new Promise((resolve7) => {
118930
- onAbort = () => resolve7({ state: WaiterState.ABORTED });
118929
+ const promise2 = new Promise((resolve5) => {
118930
+ onAbort = () => resolve5({ state: WaiterState.ABORTED });
118931
118931
  if (typeof abortSignal.addEventListener === "function") {
118932
118932
  abortSignal.addEventListener("abort", onAbort);
118933
118933
  } else {
@@ -119581,7 +119581,7 @@ var require_client4 = __commonJS((exports) => {
119581
119581
  // ../../node_modules/.pnpm/@smithy+core@3.29.7/node_modules/@smithy/core/dist-cjs/submodules/config/index.js
119582
119582
  var require_config2 = __commonJS((exports) => {
119583
119583
  var { homedir: homedir3 } = __require("os");
119584
- var { sep: sep4, join: join53 } = __require("path");
119584
+ var { sep: sep6, join: join51 } = __require("path");
119585
119585
  var { createHash: createHash22 } = __require("crypto");
119586
119586
  var { readFile: readFile$1 } = __require("fs/promises");
119587
119587
  var { IniSectionType: IniSectionType2 } = require_dist_cjs();
@@ -119721,7 +119721,7 @@ var require_config2 = __commonJS((exports) => {
119721
119721
  return "DEFAULT";
119722
119722
  };
119723
119723
  var getHomeDir = () => {
119724
- const { HOME, USERPROFILE, HOMEPATH, HOMEDRIVE = `C:${sep4}` } = process.env;
119724
+ const { HOME, USERPROFILE, HOMEPATH, HOMEDRIVE = `C:${sep6}` } = process.env;
119725
119725
  if (HOME)
119726
119726
  return HOME;
119727
119727
  if (USERPROFILE)
@@ -119739,7 +119739,7 @@ var require_config2 = __commonJS((exports) => {
119739
119739
  var getSSOTokenFilepath2 = (id) => {
119740
119740
  const hasher = createHash22("sha1");
119741
119741
  const cacheName = hasher.update(id).digest("hex");
119742
- return join53(getHomeDir(), ".aws", "sso", "cache", `${cacheName}.json`);
119742
+ return join51(getHomeDir(), ".aws", "sso", "cache", `${cacheName}.json`);
119743
119743
  };
119744
119744
  var tokenIntercept = {};
119745
119745
  var getSSOTokenFromFile3 = async (id) => {
@@ -119766,9 +119766,9 @@ var require_config2 = __commonJS((exports) => {
119766
119766
  ...data.default && { default: data.default }
119767
119767
  });
119768
119768
  var ENV_CONFIG_PATH = "AWS_CONFIG_FILE";
119769
- var getConfigFilepath = () => process.env[ENV_CONFIG_PATH] || join53(getHomeDir(), ".aws", "config");
119769
+ var getConfigFilepath = () => process.env[ENV_CONFIG_PATH] || join51(getHomeDir(), ".aws", "config");
119770
119770
  var ENV_CREDENTIALS_PATH = "AWS_SHARED_CREDENTIALS_FILE";
119771
- var getCredentialsFilepath = () => process.env[ENV_CREDENTIALS_PATH] || join53(getHomeDir(), ".aws", "credentials");
119771
+ var getCredentialsFilepath = () => process.env[ENV_CREDENTIALS_PATH] || join51(getHomeDir(), ".aws", "credentials");
119772
119772
  var prefixKeyRegex = /^([\w-]+)\s(["'])?([\w-@+.%:/]+)\2$/;
119773
119773
  var profileNameBlockList = ["__proto__", "profile __proto__"];
119774
119774
  var parseIni = (iniData) => {
@@ -119834,11 +119834,11 @@ var require_config2 = __commonJS((exports) => {
119834
119834
  const relativeHomeDirPrefix = "~/";
119835
119835
  let resolvedFilepath = filepath;
119836
119836
  if (filepath.startsWith(relativeHomeDirPrefix)) {
119837
- resolvedFilepath = join53(homeDir, filepath.slice(2));
119837
+ resolvedFilepath = join51(homeDir, filepath.slice(2));
119838
119838
  }
119839
119839
  let resolvedConfigFilepath = configFilepath;
119840
119840
  if (configFilepath.startsWith(relativeHomeDirPrefix)) {
119841
- resolvedConfigFilepath = join53(homeDir, configFilepath.slice(2));
119841
+ resolvedConfigFilepath = join51(homeDir, configFilepath.slice(2));
119842
119842
  }
119843
119843
  const parsedFiles = await Promise.all([
119844
119844
  readFile21(resolvedConfigFilepath, {
@@ -120055,7 +120055,7 @@ var require_config2 = __commonJS((exports) => {
120055
120055
  };
120056
120056
  var imdsRequest = async (options) => {
120057
120057
  const { request } = __require("http");
120058
- return new Promise((resolve7, reject) => {
120058
+ return new Promise((resolve5, reject) => {
120059
120059
  const req = request({
120060
120060
  hostname: options.hostname,
120061
120061
  port: options.port,
@@ -120083,7 +120083,7 @@ var require_config2 = __commonJS((exports) => {
120083
120083
  const chunks = [];
120084
120084
  res.on("data", (chunk3) => chunks.push(chunk3));
120085
120085
  res.on("end", () => {
120086
- resolve7(Buffer.concat(chunks));
120086
+ resolve5(Buffer.concat(chunks));
120087
120087
  req.destroy();
120088
120088
  });
120089
120089
  });
@@ -121091,7 +121091,7 @@ var require_serde2 = __commonJS((exports) => {
121091
121091
  var { ReadStream: ReadStream2, lstatSync, fstatSync } = __require("fs");
121092
121092
  var { HttpResponse: HttpResponse2 } = require_transport3();
121093
121093
  var { toEndpointV1 } = require_endpoints2();
121094
- var { Readable: Readable2, Writable, PassThrough } = __require("stream");
121094
+ var { Readable, Writable, PassThrough } = __require("stream");
121095
121095
  var isArrayBuffer = (arg) => typeof ArrayBuffer === "function" && arg instanceof ArrayBuffer || Object.prototype.toString.call(arg) === "[object ArrayBuffer]";
121096
121096
  var fromArrayBuffer = (input, offset = 0, length2 = input.byteLength - offset) => {
121097
121097
  if (!isArrayBuffer(input)) {
@@ -122004,7 +122004,7 @@ var require_serde2 = __commonJS((exports) => {
122004
122004
  }
122005
122005
  return fromArrayBuffer(toCast);
122006
122006
  }
122007
- var ChecksumStream$1 = class ChecksumStream2 extends Readable2 {
122007
+ var ChecksumStream$1 = class ChecksumStream2 extends Readable {
122008
122008
  expectedChecksum;
122009
122009
  checksumSourceLocation;
122010
122010
  checksum;
@@ -122288,7 +122288,7 @@ var require_serde2 = __commonJS((exports) => {
122288
122288
  if (isReadableStream(upstream)) {
122289
122289
  return createBufferedReadableStream(upstream, size, logger2);
122290
122290
  }
122291
- const downstream = new Readable2({ read() {} });
122291
+ const downstream = new Readable({ read() {} });
122292
122292
  let streamBufferingLoggedWarning = false;
122293
122293
  let bytesSeen = 0;
122294
122294
  const buffers = [
@@ -122372,7 +122372,7 @@ ${value}\r
122372
122372
  const { base64Encoder, bodyLengthChecker, checksumAlgorithmFn, checksumLocationName, streamHasher } = options;
122373
122373
  const checksumRequired = base64Encoder !== undefined && checksumAlgorithmFn !== undefined && checksumLocationName !== undefined && streamHasher !== undefined;
122374
122374
  const digest = checksumRequired ? streamHasher(checksumAlgorithmFn, readable) : undefined;
122375
- const awsChunkedEncodingStream = new Readable2({
122375
+ const awsChunkedEncodingStream = new Readable({
122376
122376
  read: () => {}
122377
122377
  });
122378
122378
  readable.on("data", (data) => {
@@ -122434,7 +122434,7 @@ ${value}\r
122434
122434
  if (isReadableStream(stream)) {
122435
122435
  return headStream$1(stream, bytes2);
122436
122436
  }
122437
- return new Promise((resolve7, reject) => {
122437
+ return new Promise((resolve5, reject) => {
122438
122438
  const collector = new Collector$1;
122439
122439
  collector.limit = bytes2;
122440
122440
  stream.pipe(collector);
@@ -122445,7 +122445,7 @@ ${value}\r
122445
122445
  collector.on("error", reject);
122446
122446
  collector.on("finish", function() {
122447
122447
  const bytes3 = concatBytes(this.buffers);
122448
- resolve7(bytes3);
122448
+ resolve5(bytes3);
122449
122449
  });
122450
122450
  });
122451
122451
  };
@@ -122559,7 +122559,7 @@ ${value}\r
122559
122559
  if (isReadableStream(stream)) {
122560
122560
  return collectReadableStream(stream);
122561
122561
  }
122562
- return new Promise((resolve7, reject) => {
122562
+ return new Promise((resolve5, reject) => {
122563
122563
  const collector = new Collector;
122564
122564
  const nodeStream = stream;
122565
122565
  nodeStream.pipe(collector);
@@ -122570,7 +122570,7 @@ ${value}\r
122570
122570
  collector.on("error", reject);
122571
122571
  collector.on("finish", function() {
122572
122572
  const bytes2 = concatBytes(this.bufferedBytes);
122573
- resolve7(bytes2);
122573
+ resolve5(bytes2);
122574
122574
  });
122575
122575
  });
122576
122576
  };
@@ -122584,7 +122584,7 @@ ${value}\r
122584
122584
  }
122585
122585
  var ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED = "The stream has already been transformed.";
122586
122586
  var sdkStreamMixin2 = (stream) => {
122587
- if (!(stream instanceof Readable2)) {
122587
+ if (!(stream instanceof Readable)) {
122588
122588
  try {
122589
122589
  return sdkStreamMixin$1(stream);
122590
122590
  } catch (ignored) {
@@ -122618,11 +122618,11 @@ ${value}\r
122618
122618
  if (stream.readableFlowing !== null) {
122619
122619
  throw new Error("The stream has been consumed by other callbacks.");
122620
122620
  }
122621
- if (typeof Readable2.toWeb !== "function") {
122621
+ if (typeof Readable.toWeb !== "function") {
122622
122622
  throw new Error("Readable.toWeb() is not supported. Please ensure a polyfill is available.");
122623
122623
  }
122624
122624
  transformed = true;
122625
- return Readable2.toWeb(stream);
122625
+ return Readable.toWeb(stream);
122626
122626
  }
122627
122627
  });
122628
122628
  };
@@ -122762,7 +122762,7 @@ var require_checksum2 = __commonJS((exports) => {
122762
122762
  callback();
122763
122763
  }
122764
122764
  }
122765
- var fileStreamHasher = (hashCtor, fileStream) => new Promise((resolve7, reject) => {
122765
+ var fileStreamHasher = (hashCtor, fileStream) => new Promise((resolve5, reject) => {
122766
122766
  if (!isReadStream(fileStream)) {
122767
122767
  reject(new Error("Unable to calculate hash for non-file streams."));
122768
122768
  return;
@@ -122780,7 +122780,7 @@ var require_checksum2 = __commonJS((exports) => {
122780
122780
  });
122781
122781
  hashCalculator.on("error", reject);
122782
122782
  hashCalculator.on("finish", function() {
122783
- hash3.digest().then(resolve7).catch(reject);
122783
+ hash3.digest().then(resolve5).catch(reject);
122784
122784
  });
122785
122785
  });
122786
122786
  var isReadStream = (stream) => typeof stream.path === "string";
@@ -122791,14 +122791,14 @@ var require_checksum2 = __commonJS((exports) => {
122791
122791
  const hash3 = new hashCtor;
122792
122792
  const hashCalculator = new HashCalculator(hash3);
122793
122793
  readableStream.pipe(hashCalculator);
122794
- return new Promise((resolve7, reject) => {
122794
+ return new Promise((resolve5, reject) => {
122795
122795
  readableStream.on("error", (err) => {
122796
122796
  hashCalculator.end();
122797
122797
  reject(err);
122798
122798
  });
122799
122799
  hashCalculator.on("error", reject);
122800
122800
  hashCalculator.on("finish", () => {
122801
- hash3.digest().then(resolve7).catch(reject);
122801
+ hash3.digest().then(resolve5).catch(reject);
122802
122802
  });
122803
122803
  });
122804
122804
  };
@@ -123343,7 +123343,7 @@ var require_checksum2 = __commonJS((exports) => {
123343
123343
  var require_event_streams2 = __commonJS((exports) => {
123344
123344
  var { Crc32 } = require_checksum2();
123345
123345
  var { toHex, fromHex, toUtf8: toUtf83, fromUtf8: fromUtf83 } = require_serde2();
123346
- var { Readable: Readable2 } = __require("stream");
123346
+ var { Readable } = __require("stream");
123347
123347
  var { TypeRegistry: TypeRegistry3 } = require_schema2();
123348
123348
 
123349
123349
  class Int64 {
@@ -123881,7 +123881,7 @@ var require_event_streams2 = __commonJS((exports) => {
123881
123881
  return this.universalMarshaller.deserialize(bodyIterable, deserializer);
123882
123882
  }
123883
123883
  serialize(input, serializer) {
123884
- return Readable2.from(this.universalMarshaller.serialize(input, serializer));
123884
+ return Readable.from(this.universalMarshaller.serialize(input, serializer));
123885
123885
  }
123886
123886
  }
123887
123887
  var eventStreamSerdeProvider = (options) => new EventStreamMarshaller(options);
@@ -123904,7 +123904,7 @@ var require_event_streams2 = __commonJS((exports) => {
123904
123904
  streamEnded = true;
123905
123905
  });
123906
123906
  while (!generationEnded) {
123907
- const value = await new Promise((resolve7) => setTimeout(() => resolve7(records.shift()), 0));
123907
+ const value = await new Promise((resolve5) => setTimeout(() => resolve5(records.shift()), 0));
123908
123908
  if (value) {
123909
123909
  yield value;
123910
123910
  }
@@ -126747,7 +126747,7 @@ var init_node_http2 = () => {};
126747
126747
 
126748
126748
  // ../../node_modules/.pnpm/@smithy+credential-provider-imds@4.4.10/node_modules/@smithy/credential-provider-imds/dist-es/remoteProvider/httpRequest.js
126749
126749
  function httpRequest2(options) {
126750
- return new Promise((resolve7, reject) => {
126750
+ return new Promise((resolve5, reject) => {
126751
126751
  const req = node_http2.request({
126752
126752
  method: "GET",
126753
126753
  ...options,
@@ -126772,7 +126772,7 @@ function httpRequest2(options) {
126772
126772
  chunks.push(chunk3);
126773
126773
  });
126774
126774
  res.on("end", () => {
126775
- resolve7(Buffer.concat(chunks));
126775
+ resolve5(Buffer.concat(chunks));
126776
126776
  req.destroy();
126777
126777
  });
126778
126778
  });
@@ -127217,7 +127217,7 @@ var retryWrapper2 = (toRetry, maxRetries, delayMs) => {
127217
127217
  try {
127218
127218
  return await toRetry();
127219
127219
  } catch (e4) {
127220
- await new Promise((resolve7) => setTimeout(resolve7, delayMs));
127220
+ await new Promise((resolve5) => setTimeout(resolve5, delayMs));
127221
127221
  }
127222
127222
  }
127223
127223
  return await toRetry();
@@ -127229,12 +127229,12 @@ import fs7 from "fs/promises";
127229
127229
  var import_client27, import_config42, import_node_http_handler3, AWS_CONTAINER_CREDENTIALS_RELATIVE_URI2 = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI", DEFAULT_LINK_LOCAL_HOST2 = "http://169.254.170.2", AWS_CONTAINER_CREDENTIALS_FULL_URI2 = "AWS_CONTAINER_CREDENTIALS_FULL_URI", AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE2 = "AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE", AWS_CONTAINER_AUTHORIZATION_TOKEN2 = "AWS_CONTAINER_AUTHORIZATION_TOKEN", fromHttp2 = (options = {}) => {
127230
127230
  options.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");
127231
127231
  let host;
127232
- const relative15 = options.awsContainerCredentialsRelativeUri ?? process.env[AWS_CONTAINER_CREDENTIALS_RELATIVE_URI2];
127232
+ const relative13 = options.awsContainerCredentialsRelativeUri ?? process.env[AWS_CONTAINER_CREDENTIALS_RELATIVE_URI2];
127233
127233
  const full = options.awsContainerCredentialsFullUri ?? process.env[AWS_CONTAINER_CREDENTIALS_FULL_URI2];
127234
127234
  const token = options.awsContainerAuthorizationToken ?? process.env[AWS_CONTAINER_AUTHORIZATION_TOKEN2];
127235
127235
  const tokenFile = options.awsContainerAuthorizationTokenFile ?? process.env[AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE2];
127236
127236
  const warn = options.logger?.constructor?.name === "NoOpLogger" || !options.logger?.warn ? console.warn : options.logger.warn.bind(options.logger);
127237
- if (relative15 && full) {
127237
+ if (relative13 && full) {
127238
127238
  warn("@aws-sdk/credential-provider-http: " + "you have set both awsContainerCredentialsRelativeUri and awsContainerCredentialsFullUri.");
127239
127239
  warn("awsContainerCredentialsRelativeUri will take precedence.");
127240
127240
  }
@@ -127242,8 +127242,8 @@ var import_client27, import_config42, import_node_http_handler3, AWS_CONTAINER_C
127242
127242
  warn("@aws-sdk/credential-provider-http: " + "you have set both awsContainerAuthorizationToken and awsContainerAuthorizationTokenFile.");
127243
127243
  warn("awsContainerAuthorizationTokenFile will take precedence.");
127244
127244
  }
127245
- if (relative15) {
127246
- host = `${DEFAULT_LINK_LOCAL_HOST2}${relative15}`;
127245
+ if (relative13) {
127246
+ host = `${DEFAULT_LINK_LOCAL_HOST2}${relative13}`;
127247
127247
  } else if (full) {
127248
127248
  host = full;
127249
127249
  } else {
@@ -130717,7 +130717,7 @@ var require_signin2 = __commonJS((exports) => {
130717
130717
  import { createHash as createHash22, createPrivateKey as createPrivateKey2, createPublicKey as createPublicKey2, sign as sign2 } from "crypto";
130718
130718
  import { promises as fs8 } from "fs";
130719
130719
  import { homedir as homedir4 } from "os";
130720
- import { dirname as dirname27, join as join56 } from "path";
130720
+ import { dirname as dirname26, join as join54 } from "path";
130721
130721
  var import_config53, import_protocols10, LoginCredentialsFetcher2;
130722
130722
  var init_LoginCredentialsFetcher2 = __esm(() => {
130723
130723
  import_config53 = __toESM(require_config(), 1);
@@ -130869,17 +130869,17 @@ var init_LoginCredentialsFetcher2 = __esm(() => {
130869
130869
  }
130870
130870
  async saveToken(token) {
130871
130871
  const tokenFilePath = this.getTokenFilePath();
130872
- const directory = dirname27(tokenFilePath);
130872
+ const directory = dirname26(tokenFilePath);
130873
130873
  try {
130874
130874
  await fs8.mkdir(directory, { recursive: true });
130875
130875
  } catch (error52) {}
130876
130876
  await fs8.writeFile(tokenFilePath, JSON.stringify(token, null, 2), "utf8");
130877
130877
  }
130878
130878
  getTokenFilePath() {
130879
- const directory = process.env.AWS_LOGIN_CACHE_DIRECTORY ?? join56(homedir4(), ".aws", "login", "cache");
130879
+ const directory = process.env.AWS_LOGIN_CACHE_DIRECTORY ?? join54(homedir4(), ".aws", "login", "cache");
130880
130880
  const loginSessionBytes = Buffer.from(this.loginSession, "utf8");
130881
130881
  const loginSessionSha256 = createHash22("sha256").update(loginSessionBytes).digest("hex");
130882
- return join56(directory, `${loginSessionSha256}.json`);
130882
+ return join54(directory, `${loginSessionSha256}.json`);
130883
130883
  }
130884
130884
  derToRawSignature(derSignature) {
130885
130885
  let offset = 2;
@@ -197428,1673 +197428,58 @@ var bind = (program3) => {
197428
197428
  });
197429
197429
  };
197430
197430
 
197431
- // ../../node_modules/.pnpm/chokidar@5.0.0/node_modules/chokidar/index.js
197432
- import { EventEmitter as EventEmitter3 } from "events";
197433
- import { stat as statcb, Stats } from "fs";
197434
- import { readdir as readdir7, stat as stat8 } from "fs/promises";
197435
- import * as sp2 from "path";
197436
-
197437
- // ../../node_modules/.pnpm/readdirp@5.1.1/node_modules/readdirp/index.js
197438
- import { lstat as lstat3, readdir as readdir6, realpath, stat as stat6 } from "fs/promises";
197439
- import { join as pjoin, resolve as presolve, sep as psep } from "path";
197440
- import { Readable } from "stream";
197441
- var EntryTypes = {
197442
- FILE_TYPE: "files",
197443
- DIR_TYPE: "directories",
197444
- FILE_DIR_TYPE: "files_directories",
197445
- EVERYTHING_TYPE: "all"
197446
- };
197447
- var defaultOptions3 = {
197448
- root: ".",
197449
- fileFilter: (_entryInfo) => true,
197450
- directoryFilter: (_entryInfo) => true,
197451
- type: EntryTypes.FILE_TYPE,
197452
- lstat: false,
197453
- depth: 2147483648,
197454
- alwaysStat: false,
197455
- highWaterMark: 256
197456
- };
197457
- Object.freeze(defaultOptions3);
197458
- var RECURSIVE_ERROR_CODE = "READDIRP_RECURSIVE_ERROR";
197459
- var NORMAL_FLOW_ERRORS = new Set(["ENOENT", "EPERM", "EACCES", "ELOOP", RECURSIVE_ERROR_CODE]);
197460
- var ALL_TYPES = [
197461
- EntryTypes.DIR_TYPE,
197462
- EntryTypes.EVERYTHING_TYPE,
197463
- EntryTypes.FILE_DIR_TYPE,
197464
- EntryTypes.FILE_TYPE
197465
- ];
197466
- var DIR_TYPES = new Set([
197467
- EntryTypes.DIR_TYPE,
197468
- EntryTypes.EVERYTHING_TYPE,
197469
- EntryTypes.FILE_DIR_TYPE
197470
- ]);
197471
- var FILE_TYPES = new Set([
197472
- EntryTypes.EVERYTHING_TYPE,
197473
- EntryTypes.FILE_DIR_TYPE,
197474
- EntryTypes.FILE_TYPE
197475
- ]);
197476
- var isNormalFlowError = (error52) => NORMAL_FLOW_ERRORS.has(error52.code);
197477
- var wantBigintFsStats = process.platform === "win32";
197478
- var emptyFn = (_entryInfo) => true;
197479
- var normalizeFilter = (filter2) => {
197480
- if (filter2 === undefined)
197481
- return emptyFn;
197482
- if (typeof filter2 === "function")
197483
- return filter2;
197484
- if (typeof filter2 === "string") {
197485
- const fl = filter2.trim();
197486
- return (entry) => entry.basename === fl;
197487
- }
197488
- if (Array.isArray(filter2)) {
197489
- const trItems = filter2.map((item) => item.trim());
197490
- return (entry) => trItems.some((f4) => entry.basename === f4);
197491
- }
197492
- return emptyFn;
197493
- };
197494
-
197495
- class ReaddirpStream extends Readable {
197496
- parents;
197497
- reading;
197498
- parent;
197499
- _stat;
197500
- _maxDepth;
197501
- _wantsDir;
197502
- _wantsFile;
197503
- _wantsEverything;
197504
- _root;
197505
- _isDirent;
197506
- _statsProp;
197507
- _rdOptions;
197508
- _fileFilter;
197509
- _directoryFilter;
197510
- _relStart;
197511
- constructor(options = {}) {
197512
- super({
197513
- objectMode: true,
197514
- autoDestroy: true,
197515
- highWaterMark: options.highWaterMark ?? defaultOptions3.highWaterMark
197516
- });
197517
- const opts = { ...defaultOptions3, ...options };
197518
- const root4 = opts.root ?? defaultOptions3.root;
197519
- const type = opts.type ?? defaultOptions3.type;
197520
- this._fileFilter = normalizeFilter(opts.fileFilter);
197521
- this._directoryFilter = normalizeFilter(opts.directoryFilter);
197522
- const statMethod = opts.lstat ? lstat3 : stat6;
197523
- if (wantBigintFsStats) {
197524
- this._stat = (path7) => statMethod(path7, { bigint: true });
197525
- } else {
197526
- this._stat = statMethod;
197527
- }
197528
- this._maxDepth = opts.depth != null && Number.isSafeInteger(opts.depth) ? opts.depth : defaultOptions3.depth;
197529
- this._wantsDir = DIR_TYPES.has(type);
197530
- this._wantsFile = FILE_TYPES.has(type);
197531
- this._wantsEverything = type === EntryTypes.EVERYTHING_TYPE;
197532
- this._root = presolve(root4);
197533
- this._relStart = this._root.endsWith(psep) ? this._root.length : this._root.length + 1;
197534
- this._isDirent = !opts.alwaysStat;
197535
- this._statsProp = this._isDirent ? "dirent" : "stats";
197536
- this._rdOptions = { encoding: "utf8", withFileTypes: this._isDirent };
197537
- const rootDir = { path: this._root, depth: 1 };
197538
- rootDir.pending = this._exploreDir(this._root, 1);
197539
- this.parents = [rootDir];
197540
- this.reading = false;
197541
- this.parent = undefined;
197542
- }
197543
- async _read(batch) {
197544
- if (this.reading)
197545
- return;
197546
- this.reading = true;
197547
- try {
197548
- while (!this.destroyed && batch > 0) {
197549
- const par = this.parent;
197550
- const fil = par && par.files;
197551
- if (fil && fil.length > 0) {
197552
- const { path: path7, depth } = par;
197553
- const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path7));
197554
- const awaited = this._isDirent ? slice : await Promise.all(slice);
197555
- for (const entry of awaited) {
197556
- if (!entry)
197557
- continue;
197558
- if (this.destroyed)
197559
- return;
197560
- let entryType = this._getEntryType(entry);
197561
- if (typeof entryType !== "string")
197562
- entryType = await entryType;
197563
- if (entryType === "directory" && this._directoryFilter(entry)) {
197564
- if (depth <= this._maxDepth) {
197565
- this.parents.push({ path: entry.fullPath, depth: depth + 1 });
197566
- }
197567
- if (this._wantsDir) {
197568
- this.push(entry);
197569
- batch--;
197570
- }
197571
- } else if ((entryType === "file" || this._includeAsFile(entry)) && this._fileFilter(entry)) {
197572
- if (this._wantsFile) {
197573
- this.push(entry);
197574
- batch--;
197575
- }
197576
- }
197577
- }
197578
- } else {
197579
- const parent = this.parents.pop();
197580
- if (!parent) {
197581
- this.push(null);
197582
- break;
197583
- }
197584
- const dir = parent.pending ?? this._exploreDir(parent.path, parent.depth);
197585
- const next = this.parents[this.parents.length - 1];
197586
- if (next && !next.pending) {
197587
- next.pending = this._exploreDir(next.path, next.depth);
197588
- }
197589
- this.parent = await dir;
197590
- if (this.destroyed)
197591
- return;
197592
- }
197593
- }
197594
- } catch (error52) {
197595
- this.destroy(error52);
197596
- } finally {
197597
- this.reading = false;
197598
- }
197599
- }
197600
- async _exploreDir(path7, depth) {
197601
- let files;
197602
- try {
197603
- files = await readdir6(path7, this._rdOptions);
197604
- } catch (error52) {
197605
- this._onError(error52);
197606
- }
197607
- return { files, depth, path: path7 };
197608
- }
197609
- _formatEntry(dirent, path7) {
197610
- const basename4 = this._isDirent ? dirent.name : dirent;
197611
- const fullPath = pjoin(path7, basename4);
197612
- const entry = { path: fullPath.slice(this._relStart), fullPath, basename: basename4 };
197613
- if (this._isDirent) {
197614
- entry.dirent = dirent;
197615
- return entry;
197616
- }
197617
- return this._stat(fullPath).then((stats2) => {
197618
- entry.stats = stats2;
197619
- return entry;
197620
- }, (err) => {
197621
- this._onError(err);
197622
- return;
197623
- });
197624
- }
197625
- _onError(err) {
197626
- if (isNormalFlowError(err) && !this.destroyed) {
197627
- this.emit("warn", err);
197628
- } else {
197629
- this.destroy(err);
197630
- }
197631
- }
197632
- _getEntryType(entry) {
197633
- if (!entry || !(this._statsProp in entry)) {
197634
- return "";
197635
- }
197636
- const stats2 = entry[this._statsProp];
197637
- if (stats2.isFile())
197638
- return "file";
197639
- if (stats2.isDirectory())
197640
- return "directory";
197641
- if (stats2.isSymbolicLink())
197642
- return this._getSymlinkEntryType(entry);
197643
- return "";
197644
- }
197645
- async _getSymlinkEntryType(entry) {
197646
- const full = entry.fullPath;
197647
- try {
197648
- const entryRealPath = await realpath(full);
197649
- const entryRealPathStats = await lstat3(entryRealPath);
197650
- if (entryRealPathStats.isFile()) {
197651
- return "file";
197652
- }
197653
- if (entryRealPathStats.isDirectory()) {
197654
- const len = entryRealPath.length;
197655
- if (full.startsWith(entryRealPath) && full[len] === psep) {
197656
- const recursiveError = new Error(`Circular symlink detected: "${full}" points to "${entryRealPath}"`);
197657
- recursiveError.code = RECURSIVE_ERROR_CODE;
197658
- this._onError(recursiveError);
197659
- return "";
197660
- }
197661
- return "directory";
197662
- }
197663
- } catch (error52) {
197664
- this._onError(error52);
197665
- }
197666
- return "";
197667
- }
197668
- _includeAsFile(entry) {
197669
- const stats2 = entry && entry[this._statsProp];
197670
- return stats2 && this._wantsEverything && !stats2.isDirectory();
197671
- }
197672
- }
197673
- function readdirp(root4, options = {}) {
197674
- let type = options.entryType || options.type;
197675
- if (type === "both")
197676
- type = EntryTypes.FILE_DIR_TYPE;
197677
- if (!root4) {
197678
- throw new Error("readdirp: root argument is required. Usage: readdirp(root, options)");
197679
- } else if (typeof root4 !== "string") {
197680
- throw new TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");
197681
- } else if (type && !ALL_TYPES.includes(type)) {
197682
- throw new Error(`readdirp: Invalid type passed. Use one of ${ALL_TYPES.join(", ")}`);
197683
- }
197684
- const opts = { ...options, root: root4 };
197685
- if (type)
197686
- opts.type = type;
197687
- return new ReaddirpStream(opts);
197688
- }
197689
-
197690
- // ../../node_modules/.pnpm/chokidar@5.0.0/node_modules/chokidar/handler.js
197691
- import { watch as fs_watch, unwatchFile, watchFile } from "fs";
197692
- import { realpath as fsrealpath, lstat as lstat4, open as open2, stat as stat7 } from "fs/promises";
197693
- import { type as osType } from "os";
197694
- import * as sp from "path";
197695
- var STR_DATA = "data";
197696
- var STR_END = "end";
197697
- var STR_CLOSE = "close";
197698
- var EMPTY_FN = () => {};
197699
- var pl = process.platform;
197700
- var isWindows = pl === "win32";
197701
- var isMacos = pl === "darwin";
197702
- var isLinux = pl === "linux";
197703
- var isFreeBSD = pl === "freebsd";
197704
- var isIBMi = osType() === "OS400";
197705
- var EVENTS = {
197706
- ALL: "all",
197707
- READY: "ready",
197708
- ADD: "add",
197709
- CHANGE: "change",
197710
- ADD_DIR: "addDir",
197711
- UNLINK: "unlink",
197712
- UNLINK_DIR: "unlinkDir",
197713
- RAW: "raw",
197714
- ERROR: "error"
197715
- };
197716
- var EV = EVENTS;
197717
- var THROTTLE_MODE_WATCH = "watch";
197718
- var statMethods = { lstat: lstat4, stat: stat7 };
197719
- var KEY_LISTENERS = "listeners";
197720
- var KEY_ERR = "errHandlers";
197721
- var KEY_RAW = "rawEmitters";
197722
- var HANDLER_KEYS = [KEY_LISTENERS, KEY_ERR, KEY_RAW];
197723
- var binaryExtensions = new Set([
197724
- "3dm",
197725
- "3ds",
197726
- "3g2",
197727
- "3gp",
197728
- "7z",
197729
- "a",
197730
- "aac",
197731
- "adp",
197732
- "afdesign",
197733
- "afphoto",
197734
- "afpub",
197735
- "ai",
197736
- "aif",
197737
- "aiff",
197738
- "alz",
197739
- "ape",
197740
- "apk",
197741
- "appimage",
197742
- "ar",
197743
- "arj",
197744
- "asf",
197745
- "au",
197746
- "avi",
197747
- "bak",
197748
- "baml",
197749
- "bh",
197750
- "bin",
197751
- "bk",
197752
- "bmp",
197753
- "btif",
197754
- "bz2",
197755
- "bzip2",
197756
- "cab",
197757
- "caf",
197758
- "cgm",
197759
- "class",
197760
- "cmx",
197761
- "cpio",
197762
- "cr2",
197763
- "cur",
197764
- "dat",
197765
- "dcm",
197766
- "deb",
197767
- "dex",
197768
- "djvu",
197769
- "dll",
197770
- "dmg",
197771
- "dng",
197772
- "doc",
197773
- "docm",
197774
- "docx",
197775
- "dot",
197776
- "dotm",
197777
- "dra",
197778
- "DS_Store",
197779
- "dsk",
197780
- "dts",
197781
- "dtshd",
197782
- "dvb",
197783
- "dwg",
197784
- "dxf",
197785
- "ecelp4800",
197786
- "ecelp7470",
197787
- "ecelp9600",
197788
- "egg",
197789
- "eol",
197790
- "eot",
197791
- "epub",
197792
- "exe",
197793
- "f4v",
197794
- "fbs",
197795
- "fh",
197796
- "fla",
197797
- "flac",
197798
- "flatpak",
197799
- "fli",
197800
- "flv",
197801
- "fpx",
197802
- "fst",
197803
- "fvt",
197804
- "g3",
197805
- "gh",
197806
- "gif",
197807
- "graffle",
197808
- "gz",
197809
- "gzip",
197810
- "h261",
197811
- "h263",
197812
- "h264",
197813
- "icns",
197814
- "ico",
197815
- "ief",
197816
- "img",
197817
- "ipa",
197818
- "iso",
197819
- "jar",
197820
- "jpeg",
197821
- "jpg",
197822
- "jpgv",
197823
- "jpm",
197824
- "jxr",
197825
- "key",
197826
- "ktx",
197827
- "lha",
197828
- "lib",
197829
- "lvp",
197830
- "lz",
197831
- "lzh",
197832
- "lzma",
197833
- "lzo",
197834
- "m3u",
197835
- "m4a",
197836
- "m4v",
197837
- "mar",
197838
- "mdi",
197839
- "mht",
197840
- "mid",
197841
- "midi",
197842
- "mj2",
197843
- "mka",
197844
- "mkv",
197845
- "mmr",
197846
- "mng",
197847
- "mobi",
197848
- "mov",
197849
- "movie",
197850
- "mp3",
197851
- "mp4",
197852
- "mp4a",
197853
- "mpeg",
197854
- "mpg",
197855
- "mpga",
197856
- "mxu",
197857
- "nef",
197858
- "npx",
197859
- "numbers",
197860
- "nupkg",
197861
- "o",
197862
- "odp",
197863
- "ods",
197864
- "odt",
197865
- "oga",
197866
- "ogg",
197867
- "ogv",
197868
- "otf",
197869
- "ott",
197870
- "pages",
197871
- "pbm",
197872
- "pcx",
197873
- "pdb",
197874
- "pdf",
197875
- "pea",
197876
- "pgm",
197877
- "pic",
197878
- "png",
197879
- "pnm",
197880
- "pot",
197881
- "potm",
197882
- "potx",
197883
- "ppa",
197884
- "ppam",
197885
- "ppm",
197886
- "pps",
197887
- "ppsm",
197888
- "ppsx",
197889
- "ppt",
197890
- "pptm",
197891
- "pptx",
197892
- "psd",
197893
- "pya",
197894
- "pyc",
197895
- "pyo",
197896
- "pyv",
197897
- "qt",
197898
- "rar",
197899
- "ras",
197900
- "raw",
197901
- "resources",
197902
- "rgb",
197903
- "rip",
197904
- "rlc",
197905
- "rmf",
197906
- "rmvb",
197907
- "rpm",
197908
- "rtf",
197909
- "rz",
197910
- "s3m",
197911
- "s7z",
197912
- "scpt",
197913
- "sgi",
197914
- "shar",
197915
- "snap",
197916
- "sil",
197917
- "sketch",
197918
- "slk",
197919
- "smv",
197920
- "snk",
197921
- "so",
197922
- "stl",
197923
- "suo",
197924
- "sub",
197925
- "swf",
197926
- "tar",
197927
- "tbz",
197928
- "tbz2",
197929
- "tga",
197930
- "tgz",
197931
- "thmx",
197932
- "tif",
197933
- "tiff",
197934
- "tlz",
197935
- "ttc",
197936
- "ttf",
197937
- "txz",
197938
- "udf",
197939
- "uvh",
197940
- "uvi",
197941
- "uvm",
197942
- "uvp",
197943
- "uvs",
197944
- "uvu",
197945
- "viv",
197946
- "vob",
197947
- "war",
197948
- "wav",
197949
- "wax",
197950
- "wbmp",
197951
- "wdp",
197952
- "weba",
197953
- "webm",
197954
- "webp",
197955
- "whl",
197956
- "wim",
197957
- "wm",
197958
- "wma",
197959
- "wmv",
197960
- "wmx",
197961
- "woff",
197962
- "woff2",
197963
- "wrm",
197964
- "wvx",
197965
- "xbm",
197966
- "xif",
197967
- "xla",
197968
- "xlam",
197969
- "xls",
197970
- "xlsb",
197971
- "xlsm",
197972
- "xlsx",
197973
- "xlt",
197974
- "xltm",
197975
- "xltx",
197976
- "xm",
197977
- "xmind",
197978
- "xpi",
197979
- "xpm",
197980
- "xwd",
197981
- "xz",
197982
- "z",
197983
- "zip",
197984
- "zipx"
197985
- ]);
197986
- var isBinaryPath = (filePath) => binaryExtensions.has(sp.extname(filePath).slice(1).toLowerCase());
197987
- var foreach = (val, fn) => {
197988
- if (val instanceof Set) {
197989
- val.forEach(fn);
197990
- } else {
197991
- fn(val);
197992
- }
197993
- };
197994
- var addAndConvert = (main, prop, item) => {
197995
- let container = main[prop];
197996
- if (!(container instanceof Set)) {
197997
- main[prop] = container = new Set([container]);
197998
- }
197999
- container.add(item);
198000
- };
198001
- var clearItem = (cont) => (key) => {
198002
- const set4 = cont[key];
198003
- if (set4 instanceof Set) {
198004
- set4.clear();
198005
- } else {
198006
- delete cont[key];
198007
- }
198008
- };
198009
- var delFromSet = (main, prop, item) => {
198010
- const container = main[prop];
198011
- if (container instanceof Set) {
198012
- container.delete(item);
198013
- } else if (container === item) {
198014
- delete main[prop];
198015
- }
198016
- };
198017
- var isEmptySet = (val) => val instanceof Set ? val.size === 0 : !val;
198018
- var FsWatchInstances = new Map;
198019
- function createFsWatchInstance(path7, options, listener, errHandler, emitRaw) {
198020
- const handleEvent = (rawEvent, evPath) => {
198021
- listener(path7);
198022
- emitRaw(rawEvent, evPath, { watchedPath: path7 });
198023
- if (evPath && path7 !== evPath) {
198024
- fsWatchBroadcast(sp.resolve(path7, evPath), KEY_LISTENERS, sp.join(path7, evPath));
198025
- }
198026
- };
198027
- try {
198028
- return fs_watch(path7, {
198029
- persistent: options.persistent
198030
- }, handleEvent);
198031
- } catch (error52) {
198032
- errHandler(error52);
198033
- return;
198034
- }
198035
- }
198036
- var fsWatchBroadcast = (fullPath, listenerType, val1, val2, val3) => {
198037
- const cont = FsWatchInstances.get(fullPath);
198038
- if (!cont)
198039
- return;
198040
- foreach(cont[listenerType], (listener) => {
198041
- listener(val1, val2, val3);
198042
- });
198043
- };
198044
- var setFsWatchListener = (path7, fullPath, options, handlers) => {
198045
- const { listener, errHandler, rawEmitter } = handlers;
198046
- let cont = FsWatchInstances.get(fullPath);
198047
- let watcher;
198048
- if (!options.persistent) {
198049
- watcher = createFsWatchInstance(path7, options, listener, errHandler, rawEmitter);
198050
- if (!watcher)
198051
- return;
198052
- return watcher.close.bind(watcher);
198053
- }
198054
- if (cont) {
198055
- addAndConvert(cont, KEY_LISTENERS, listener);
198056
- addAndConvert(cont, KEY_ERR, errHandler);
198057
- addAndConvert(cont, KEY_RAW, rawEmitter);
198058
- } else {
198059
- watcher = createFsWatchInstance(path7, options, fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS), errHandler, fsWatchBroadcast.bind(null, fullPath, KEY_RAW));
198060
- if (!watcher)
198061
- return;
198062
- watcher.on(EV.ERROR, async (error52) => {
198063
- const broadcastErr = fsWatchBroadcast.bind(null, fullPath, KEY_ERR);
198064
- if (cont)
198065
- cont.watcherUnusable = true;
198066
- if (isWindows && error52.code === "EPERM") {
198067
- try {
198068
- const fd = await open2(path7, "r");
198069
- await fd.close();
198070
- broadcastErr(error52);
198071
- } catch (err) {}
198072
- } else {
198073
- broadcastErr(error52);
198074
- }
198075
- });
198076
- cont = {
198077
- listeners: listener,
198078
- errHandlers: errHandler,
198079
- rawEmitters: rawEmitter,
198080
- watcher
198081
- };
198082
- FsWatchInstances.set(fullPath, cont);
198083
- }
198084
- return () => {
198085
- delFromSet(cont, KEY_LISTENERS, listener);
198086
- delFromSet(cont, KEY_ERR, errHandler);
198087
- delFromSet(cont, KEY_RAW, rawEmitter);
198088
- if (isEmptySet(cont.listeners)) {
198089
- cont.watcher.close();
198090
- FsWatchInstances.delete(fullPath);
198091
- HANDLER_KEYS.forEach(clearItem(cont));
198092
- cont.watcher = undefined;
198093
- Object.freeze(cont);
198094
- }
198095
- };
198096
- };
198097
- var FsWatchFileInstances = new Map;
198098
- var setFsWatchFileListener = (path7, fullPath, options, handlers) => {
198099
- const { listener, rawEmitter } = handlers;
198100
- let cont = FsWatchFileInstances.get(fullPath);
198101
- const copts = cont && cont.options;
198102
- if (copts && (copts.persistent < options.persistent || copts.interval > options.interval)) {
198103
- unwatchFile(fullPath);
198104
- cont = undefined;
198105
- }
198106
- if (cont) {
198107
- addAndConvert(cont, KEY_LISTENERS, listener);
198108
- addAndConvert(cont, KEY_RAW, rawEmitter);
198109
- } else {
198110
- cont = {
198111
- listeners: listener,
198112
- rawEmitters: rawEmitter,
198113
- options,
198114
- watcher: watchFile(fullPath, options, (curr, prev) => {
198115
- foreach(cont.rawEmitters, (rawEmitter2) => {
198116
- rawEmitter2(EV.CHANGE, fullPath, { curr, prev });
198117
- });
198118
- const currmtime = curr.mtimeMs;
198119
- if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) {
198120
- foreach(cont.listeners, (listener2) => listener2(path7, curr));
198121
- }
198122
- })
198123
- };
198124
- FsWatchFileInstances.set(fullPath, cont);
198125
- }
198126
- return () => {
198127
- delFromSet(cont, KEY_LISTENERS, listener);
198128
- delFromSet(cont, KEY_RAW, rawEmitter);
198129
- if (isEmptySet(cont.listeners)) {
198130
- FsWatchFileInstances.delete(fullPath);
198131
- unwatchFile(fullPath);
198132
- cont.options = cont.watcher = undefined;
198133
- Object.freeze(cont);
198134
- }
198135
- };
198136
- };
198137
-
198138
- class NodeFsHandler {
198139
- fsw;
198140
- _boundHandleError;
198141
- constructor(fsW) {
198142
- this.fsw = fsW;
198143
- this._boundHandleError = (error52) => fsW._handleError(error52);
198144
- }
198145
- _watchWithNodeFs(path7, listener) {
198146
- const opts = this.fsw.options;
198147
- const directory = sp.dirname(path7);
198148
- const basename5 = sp.basename(path7);
198149
- const parent = this.fsw._getWatchedDir(directory);
198150
- parent.add(basename5);
198151
- const absolutePath = sp.resolve(path7);
198152
- const options = {
198153
- persistent: opts.persistent
198154
- };
198155
- if (!listener)
198156
- listener = EMPTY_FN;
198157
- let closer;
198158
- if (opts.usePolling) {
198159
- const enableBin = opts.interval !== opts.binaryInterval;
198160
- options.interval = enableBin && isBinaryPath(basename5) ? opts.binaryInterval : opts.interval;
198161
- closer = setFsWatchFileListener(path7, absolutePath, options, {
198162
- listener,
198163
- rawEmitter: this.fsw._emitRaw
198164
- });
198165
- } else {
198166
- closer = setFsWatchListener(path7, absolutePath, options, {
198167
- listener,
198168
- errHandler: this._boundHandleError,
198169
- rawEmitter: this.fsw._emitRaw
198170
- });
198171
- }
198172
- return closer;
198173
- }
198174
- _handleFile(file3, stats2, initialAdd) {
198175
- if (this.fsw.closed) {
198176
- return;
198177
- }
198178
- const dirname23 = sp.dirname(file3);
198179
- const basename5 = sp.basename(file3);
198180
- const parent = this.fsw._getWatchedDir(dirname23);
198181
- let prevStats = stats2;
198182
- if (parent.has(basename5))
198183
- return;
198184
- const listener = async (path7, newStats) => {
198185
- if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file3, 5))
198186
- return;
198187
- if (!newStats || newStats.mtimeMs === 0) {
198188
- try {
198189
- const newStats2 = await stat7(file3);
198190
- if (this.fsw.closed)
198191
- return;
198192
- const at2 = newStats2.atimeMs;
198193
- const mt2 = newStats2.mtimeMs;
198194
- if (!at2 || at2 <= mt2 || mt2 !== prevStats.mtimeMs) {
198195
- this.fsw._emit(EV.CHANGE, file3, newStats2);
198196
- }
198197
- if ((isMacos || isLinux || isFreeBSD) && prevStats.ino !== newStats2.ino) {
198198
- this.fsw._closeFile(path7);
198199
- prevStats = newStats2;
198200
- const closer2 = this._watchWithNodeFs(file3, listener);
198201
- if (closer2)
198202
- this.fsw._addPathCloser(path7, closer2);
198203
- } else {
198204
- prevStats = newStats2;
198205
- }
198206
- } catch (error52) {
198207
- this.fsw._remove(dirname23, basename5);
198208
- }
198209
- } else if (parent.has(basename5)) {
198210
- const at2 = newStats.atimeMs;
198211
- const mt2 = newStats.mtimeMs;
198212
- if (!at2 || at2 <= mt2 || mt2 !== prevStats.mtimeMs) {
198213
- this.fsw._emit(EV.CHANGE, file3, newStats);
198214
- }
198215
- prevStats = newStats;
198216
- }
198217
- };
198218
- const closer = this._watchWithNodeFs(file3, listener);
198219
- if (!(initialAdd && this.fsw.options.ignoreInitial) && this.fsw._isntIgnored(file3)) {
198220
- if (!this.fsw._throttle(EV.ADD, file3, 0))
198221
- return;
198222
- this.fsw._emit(EV.ADD, file3, stats2);
198223
- }
198224
- return closer;
198225
- }
198226
- async _handleSymlink(entry, directory, path7, item) {
198227
- if (this.fsw.closed) {
198228
- return;
198229
- }
198230
- const full = entry.fullPath;
198231
- const dir = this.fsw._getWatchedDir(directory);
198232
- if (!this.fsw.options.followSymlinks) {
198233
- this.fsw._incrReadyCount();
198234
- let linkPath;
198235
- try {
198236
- linkPath = await fsrealpath(path7);
198237
- } catch (e4) {
198238
- this.fsw._emitReady();
198239
- return true;
198240
- }
198241
- if (this.fsw.closed)
198242
- return;
198243
- if (dir.has(item)) {
198244
- if (this.fsw._symlinkPaths.get(full) !== linkPath) {
198245
- this.fsw._symlinkPaths.set(full, linkPath);
198246
- this.fsw._emit(EV.CHANGE, path7, entry.stats);
198247
- }
198248
- } else {
198249
- dir.add(item);
198250
- this.fsw._symlinkPaths.set(full, linkPath);
198251
- this.fsw._emit(EV.ADD, path7, entry.stats);
198252
- }
198253
- this.fsw._emitReady();
198254
- return true;
198255
- }
198256
- if (this.fsw._symlinkPaths.has(full)) {
198257
- return true;
198258
- }
198259
- this.fsw._symlinkPaths.set(full, true);
198260
- }
198261
- _handleRead(directory, initialAdd, wh, target2, dir, depth, throttler) {
198262
- directory = sp.join(directory, "");
198263
- const throttleKey = target2 ? `${directory}:${target2}` : directory;
198264
- throttler = this.fsw._throttle("readdir", throttleKey, 1000);
198265
- if (!throttler)
198266
- return;
198267
- const previous = this.fsw._getWatchedDir(wh.path);
198268
- const current = new Set;
198269
- let stream = this.fsw._readdirp(directory, {
198270
- fileFilter: (entry) => wh.filterPath(entry),
198271
- directoryFilter: (entry) => wh.filterDir(entry)
198272
- });
198273
- if (!stream)
198274
- return;
198275
- stream.on(STR_DATA, async (entry) => {
198276
- if (this.fsw.closed) {
198277
- stream = undefined;
198278
- return;
198279
- }
198280
- const item = entry.path;
198281
- let path7 = sp.join(directory, item);
198282
- current.add(item);
198283
- if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path7, item)) {
198284
- return;
198285
- }
198286
- if (this.fsw.closed) {
198287
- stream = undefined;
198288
- return;
198289
- }
198290
- if (item === target2 || !target2 && !previous.has(item)) {
198291
- this.fsw._incrReadyCount();
198292
- path7 = sp.join(dir, sp.relative(dir, path7));
198293
- this._addToNodeFs(path7, initialAdd, wh, depth + 1);
198294
- }
198295
- }).on(EV.ERROR, this._boundHandleError);
198296
- return new Promise((resolve6, reject) => {
198297
- if (!stream)
198298
- return reject();
198299
- stream.once(STR_END, () => {
198300
- if (this.fsw.closed) {
198301
- stream = undefined;
198302
- return;
198303
- }
198304
- const wasThrottled = throttler ? throttler.clear() : false;
198305
- resolve6(undefined);
198306
- previous.getChildren().filter((item) => {
198307
- return item !== directory && !current.has(item);
198308
- }).forEach((item) => {
198309
- this.fsw._remove(directory, item);
198310
- });
198311
- stream = undefined;
198312
- if (wasThrottled)
198313
- this._handleRead(directory, false, wh, target2, dir, depth, throttler);
198314
- });
198315
- });
198316
- }
198317
- async _handleDir(dir, stats2, initialAdd, depth, target2, wh, realpath2) {
198318
- const parentDir = this.fsw._getWatchedDir(sp.dirname(dir));
198319
- const tracked = parentDir.has(sp.basename(dir));
198320
- if (!(initialAdd && this.fsw.options.ignoreInitial) && !target2 && !tracked) {
198321
- this.fsw._emit(EV.ADD_DIR, dir, stats2);
198322
- }
198323
- parentDir.add(sp.basename(dir));
198324
- this.fsw._getWatchedDir(dir);
198325
- let throttler;
198326
- let closer;
198327
- const oDepth = this.fsw.options.depth;
198328
- if ((oDepth == null || depth <= oDepth) && !this.fsw._symlinkPaths.has(realpath2)) {
198329
- if (!target2) {
198330
- await this._handleRead(dir, initialAdd, wh, target2, dir, depth, throttler);
198331
- if (this.fsw.closed)
198332
- return;
198333
- }
198334
- closer = this._watchWithNodeFs(dir, (dirPath, stats3) => {
198335
- if (stats3 && stats3.mtimeMs === 0)
198336
- return;
198337
- this._handleRead(dirPath, false, wh, target2, dir, depth, throttler);
198338
- });
198339
- }
198340
- return closer;
198341
- }
198342
- async _addToNodeFs(path7, initialAdd, priorWh, depth, target2) {
198343
- const ready2 = this.fsw._emitReady;
198344
- if (this.fsw._isIgnored(path7) || this.fsw.closed) {
198345
- ready2();
198346
- return false;
198347
- }
198348
- const wh = this.fsw._getWatchHelpers(path7);
198349
- if (priorWh) {
198350
- wh.filterPath = (entry) => priorWh.filterPath(entry);
198351
- wh.filterDir = (entry) => priorWh.filterDir(entry);
198352
- }
198353
- try {
198354
- const stats2 = await statMethods[wh.statMethod](wh.watchPath);
198355
- if (this.fsw.closed)
198356
- return;
198357
- if (this.fsw._isIgnored(wh.watchPath, stats2)) {
198358
- ready2();
198359
- return false;
198360
- }
198361
- const follow = this.fsw.options.followSymlinks;
198362
- let closer;
198363
- if (stats2.isDirectory()) {
198364
- const absPath = sp.resolve(path7);
198365
- const targetPath = follow ? await fsrealpath(path7) : path7;
198366
- if (this.fsw.closed)
198367
- return;
198368
- closer = await this._handleDir(wh.watchPath, stats2, initialAdd, depth, target2, wh, targetPath);
198369
- if (this.fsw.closed)
198370
- return;
198371
- if (absPath !== targetPath && targetPath !== undefined) {
198372
- this.fsw._symlinkPaths.set(absPath, targetPath);
198373
- }
198374
- } else if (stats2.isSymbolicLink()) {
198375
- const targetPath = follow ? await fsrealpath(path7) : path7;
198376
- if (this.fsw.closed)
198377
- return;
198378
- const parent = sp.dirname(wh.watchPath);
198379
- this.fsw._getWatchedDir(parent).add(wh.watchPath);
198380
- this.fsw._emit(EV.ADD, wh.watchPath, stats2);
198381
- closer = await this._handleDir(parent, stats2, initialAdd, depth, path7, wh, targetPath);
198382
- if (this.fsw.closed)
198383
- return;
198384
- if (targetPath !== undefined) {
198385
- this.fsw._symlinkPaths.set(sp.resolve(path7), targetPath);
198386
- }
198387
- } else {
198388
- closer = this._handleFile(wh.watchPath, stats2, initialAdd);
198389
- }
198390
- ready2();
198391
- if (closer)
198392
- this.fsw._addPathCloser(path7, closer);
198393
- return false;
198394
- } catch (error52) {
198395
- if (this.fsw._handleError(error52)) {
198396
- ready2();
198397
- return path7;
198398
- }
198399
- }
198400
- }
198401
- }
198402
-
198403
- // ../../node_modules/.pnpm/chokidar@5.0.0/node_modules/chokidar/index.js
198404
- /*! chokidar - MIT License (c) 2012 Paul Miller (paulmillr.com) */
198405
- var SLASH = "/";
198406
- var SLASH_SLASH = "//";
198407
- var ONE_DOT = ".";
198408
- var TWO_DOTS = "..";
198409
- var STRING_TYPE = "string";
198410
- var BACK_SLASH_RE = /\\/g;
198411
- var DOUBLE_SLASH_RE = /\/\//g;
198412
- var DOT_RE = /\..*\.(sw[px])$|~$|\.subl.*\.tmp/;
198413
- var REPLACER_RE = /^\.[/\\]/;
198414
- function arrify(item) {
198415
- return Array.isArray(item) ? item : [item];
198416
- }
198417
- var isMatcherObject = (matcher) => typeof matcher === "object" && matcher !== null && !(matcher instanceof RegExp);
198418
- function createPattern(matcher) {
198419
- if (typeof matcher === "function")
198420
- return matcher;
198421
- if (typeof matcher === "string")
198422
- return (string6) => matcher === string6;
198423
- if (matcher instanceof RegExp)
198424
- return (string6) => matcher.test(string6);
198425
- if (typeof matcher === "object" && matcher !== null) {
198426
- return (string6) => {
198427
- if (matcher.path === string6)
198428
- return true;
198429
- if (matcher.recursive) {
198430
- const relative12 = sp2.relative(matcher.path, string6);
198431
- if (!relative12) {
198432
- return false;
198433
- }
198434
- return !relative12.startsWith("..") && !sp2.isAbsolute(relative12);
198435
- }
198436
- return false;
198437
- };
198438
- }
198439
- return () => false;
198440
- }
198441
- function normalizePath3(path7) {
198442
- if (typeof path7 !== "string")
198443
- throw new Error("string expected");
198444
- path7 = sp2.normalize(path7);
198445
- path7 = path7.replace(/\\/g, "/");
198446
- let prepend = false;
198447
- if (path7.startsWith("//"))
198448
- prepend = true;
198449
- path7 = path7.replace(DOUBLE_SLASH_RE, "/");
198450
- if (prepend)
198451
- path7 = "/" + path7;
198452
- return path7;
198453
- }
198454
- function matchPatterns(patterns, testString, stats2) {
198455
- const path7 = normalizePath3(testString);
198456
- for (let index = 0;index < patterns.length; index++) {
198457
- const pattern = patterns[index];
198458
- if (pattern(path7, stats2)) {
198459
- return true;
198460
- }
198461
- }
198462
- return false;
198463
- }
198464
- function anymatch(matchers, testString) {
198465
- if (matchers == null) {
198466
- throw new TypeError("anymatch: specify first argument");
198467
- }
198468
- const matchersArray = arrify(matchers);
198469
- const patterns = matchersArray.map((matcher) => createPattern(matcher));
198470
- if (testString == null) {
198471
- return (testString2, stats2) => {
198472
- return matchPatterns(patterns, testString2, stats2);
198473
- };
198474
- }
198475
- return matchPatterns(patterns, testString);
198476
- }
198477
- var unifyPaths = (paths_) => {
198478
- const paths = arrify(paths_).flat();
198479
- if (!paths.every((p4) => typeof p4 === STRING_TYPE)) {
198480
- throw new TypeError(`Non-string provided as watch path: ${paths}`);
198481
- }
198482
- return paths.map(normalizePathToUnix);
198483
- };
198484
- var toUnix = (string6) => {
198485
- let str = string6.replace(BACK_SLASH_RE, SLASH);
198486
- let prepend = false;
198487
- if (str.startsWith(SLASH_SLASH)) {
198488
- prepend = true;
198489
- }
198490
- str = str.replace(DOUBLE_SLASH_RE, SLASH);
198491
- if (prepend) {
198492
- str = SLASH + str;
198493
- }
198494
- return str;
198495
- };
198496
- var normalizePathToUnix = (path7) => toUnix(sp2.normalize(toUnix(path7)));
198497
- var normalizeIgnored = (cwd2 = "") => (path7) => {
198498
- if (typeof path7 === "string") {
198499
- return normalizePathToUnix(sp2.isAbsolute(path7) ? path7 : sp2.join(cwd2, path7));
198500
- } else {
198501
- return path7;
198502
- }
198503
- };
198504
- var getAbsolutePath = (path7, cwd2) => {
198505
- if (sp2.isAbsolute(path7)) {
198506
- return path7;
198507
- }
198508
- return sp2.join(cwd2, path7);
198509
- };
198510
- var EMPTY_SET = Object.freeze(new Set);
198511
-
198512
- class DirEntry {
198513
- path;
198514
- _removeWatcher;
198515
- items;
198516
- constructor(dir, removeWatcher) {
198517
- this.path = dir;
198518
- this._removeWatcher = removeWatcher;
198519
- this.items = new Set;
198520
- }
198521
- add(item) {
198522
- const { items } = this;
198523
- if (!items)
198524
- return;
198525
- if (item !== ONE_DOT && item !== TWO_DOTS)
198526
- items.add(item);
198527
- }
198528
- async remove(item) {
198529
- const { items } = this;
198530
- if (!items)
198531
- return;
198532
- items.delete(item);
198533
- if (items.size > 0)
197431
+ // src/config/load/watch.ts
197432
+ import { watch } from "fs";
197433
+ import { basename as basename4, sep as sep2 } from "path";
197434
+ var ignoredDirectories = new Set(["node_modules", ".awsless", "dist", ".git"]);
197435
+ var isConfigFile = (path7) => {
197436
+ const base = basename4(path7);
197437
+ return /^app\.(json|jsonc|json5)$/.test(base) || /(^|\.)stack\.(json|jsonc|json5)$/.test(base);
197438
+ };
197439
+ var watchConfig = async (options, resolve5, reject) => {
197440
+ await loadAppConfig(options);
197441
+ debug("Start watching...");
197442
+ let reloadTimer;
197443
+ const watcher = watch(directories.root, { recursive: true }, (_event, filename) => {
197444
+ if (!filename) {
198534
197445
  return;
198535
- const dir = this.path;
198536
- try {
198537
- await readdir7(dir);
198538
- } catch (err) {
198539
- if (this._removeWatcher) {
198540
- this._removeWatcher(sp2.dirname(dir), sp2.basename(dir));
198541
- }
198542
197446
  }
198543
- }
198544
- has(item) {
198545
- const { items } = this;
198546
- if (!items)
197447
+ if (filename.split(sep2).some((segment) => ignoredDirectories.has(segment))) {
198547
197448
  return;
198548
- return items.has(item);
198549
- }
198550
- getChildren() {
198551
- const { items } = this;
198552
- if (!items)
198553
- return [];
198554
- return [...items.values()];
198555
- }
198556
- dispose() {
198557
- this.items.clear();
198558
- this.path = "";
198559
- this._removeWatcher = EMPTY_FN;
198560
- this.items = EMPTY_SET;
198561
- Object.freeze(this);
198562
- }
198563
- }
198564
- var STAT_METHOD_F = "stat";
198565
- var STAT_METHOD_L = "lstat";
198566
-
198567
- class WatchHelper {
198568
- fsw;
198569
- path;
198570
- watchPath;
198571
- fullWatchPath;
198572
- dirParts;
198573
- followSymlinks;
198574
- statMethod;
198575
- constructor(path7, follow, fsw) {
198576
- this.fsw = fsw;
198577
- const watchPath = path7;
198578
- this.path = path7 = path7.replace(REPLACER_RE, "");
198579
- this.watchPath = watchPath;
198580
- this.fullWatchPath = sp2.resolve(watchPath);
198581
- this.dirParts = [];
198582
- this.dirParts.forEach((parts) => {
198583
- if (parts.length > 1)
198584
- parts.pop();
198585
- });
198586
- this.followSymlinks = follow;
198587
- this.statMethod = follow ? STAT_METHOD_F : STAT_METHOD_L;
198588
- }
198589
- entryPath(entry) {
198590
- return sp2.join(this.watchPath, sp2.relative(this.watchPath, entry.fullPath));
198591
- }
198592
- filterPath(entry) {
198593
- const { stats: stats2 } = entry;
198594
- if (stats2 && stats2.isSymbolicLink())
198595
- return this.filterDir(entry);
198596
- const resolvedPath = this.entryPath(entry);
198597
- return this.fsw._isntIgnored(resolvedPath, stats2) && this.fsw._hasReadPermissions(stats2);
198598
- }
198599
- filterDir(entry) {
198600
- return this.fsw._isntIgnored(this.entryPath(entry), entry.stats);
198601
- }
198602
- }
198603
-
198604
- class FSWatcher extends EventEmitter3 {
198605
- closed;
198606
- options;
198607
- _closers;
198608
- _ignoredPaths;
198609
- _throttled;
198610
- _streams;
198611
- _symlinkPaths;
198612
- _watched;
198613
- _pendingWrites;
198614
- _pendingUnlinks;
198615
- _readyCount;
198616
- _emitReady;
198617
- _closePromise;
198618
- _userIgnored;
198619
- _readyEmitted;
198620
- _emitRaw;
198621
- _boundRemove;
198622
- _nodeFsHandler;
198623
- constructor(_opts = {}) {
198624
- super();
198625
- this.closed = false;
198626
- this._closers = new Map;
198627
- this._ignoredPaths = new Set;
198628
- this._throttled = new Map;
198629
- this._streams = new Set;
198630
- this._symlinkPaths = new Map;
198631
- this._watched = new Map;
198632
- this._pendingWrites = new Map;
198633
- this._pendingUnlinks = new Map;
198634
- this._readyCount = 0;
198635
- this._readyEmitted = false;
198636
- const awf = _opts.awaitWriteFinish;
198637
- const DEF_AWF = { stabilityThreshold: 2000, pollInterval: 100 };
198638
- const opts = {
198639
- persistent: true,
198640
- ignoreInitial: false,
198641
- ignorePermissionErrors: false,
198642
- interval: 100,
198643
- binaryInterval: 300,
198644
- followSymlinks: true,
198645
- usePolling: false,
198646
- atomic: true,
198647
- ..._opts,
198648
- ignored: _opts.ignored ? arrify(_opts.ignored) : arrify([]),
198649
- awaitWriteFinish: awf === true ? DEF_AWF : typeof awf === "object" ? { ...DEF_AWF, ...awf } : false
198650
- };
198651
- if (isIBMi)
198652
- opts.usePolling = true;
198653
- if (opts.atomic === undefined)
198654
- opts.atomic = !opts.usePolling;
198655
- const envPoll = process.env.CHOKIDAR_USEPOLLING;
198656
- if (envPoll !== undefined) {
198657
- const envLower = envPoll.toLowerCase();
198658
- if (envLower === "false" || envLower === "0")
198659
- opts.usePolling = false;
198660
- else if (envLower === "true" || envLower === "1")
198661
- opts.usePolling = true;
198662
- else
198663
- opts.usePolling = !!envLower;
198664
- }
198665
- const envInterval = process.env.CHOKIDAR_INTERVAL;
198666
- if (envInterval)
198667
- opts.interval = Number.parseInt(envInterval, 10);
198668
- let readyCalls = 0;
198669
- this._emitReady = () => {
198670
- readyCalls++;
198671
- if (readyCalls >= this._readyCount) {
198672
- this._emitReady = EMPTY_FN;
198673
- this._readyEmitted = true;
198674
- process.nextTick(() => this.emit(EVENTS.READY));
198675
- }
198676
- };
198677
- this._emitRaw = (...args) => this.emit(EVENTS.RAW, ...args);
198678
- this._boundRemove = this._remove.bind(this);
198679
- this.options = opts;
198680
- this._nodeFsHandler = new NodeFsHandler(this);
198681
- Object.freeze(opts);
198682
- }
198683
- _addIgnoredPath(matcher) {
198684
- if (isMatcherObject(matcher)) {
198685
- for (const ignored of this._ignoredPaths) {
198686
- if (isMatcherObject(ignored) && ignored.path === matcher.path && ignored.recursive === matcher.recursive) {
198687
- return;
198688
- }
198689
- }
198690
197449
  }
198691
- this._ignoredPaths.add(matcher);
198692
- }
198693
- _removeIgnoredPath(matcher) {
198694
- this._ignoredPaths.delete(matcher);
198695
- if (typeof matcher === "string") {
198696
- for (const ignored of this._ignoredPaths) {
198697
- if (isMatcherObject(ignored) && ignored.path === matcher) {
198698
- this._ignoredPaths.delete(ignored);
198699
- }
198700
- }
198701
- }
198702
- }
198703
- add(paths_, _origAdd, _internal) {
198704
- const { cwd: cwd2 } = this.options;
198705
- this.closed = false;
198706
- this._closePromise = undefined;
198707
- let paths = unifyPaths(paths_);
198708
- if (cwd2) {
198709
- paths = paths.map((path7) => {
198710
- const absPath = getAbsolutePath(path7, cwd2);
198711
- return absPath;
198712
- });
198713
- }
198714
- paths.forEach((path7) => {
198715
- this._removeIgnoredPath(path7);
198716
- });
198717
- this._userIgnored = undefined;
198718
- if (!this._readyCount)
198719
- this._readyCount = 0;
198720
- this._readyCount += paths.length;
198721
- Promise.all(paths.map(async (path7) => {
198722
- const res = await this._nodeFsHandler._addToNodeFs(path7, !_internal, undefined, 0, _origAdd);
198723
- if (res)
198724
- this._emitReady();
198725
- return res;
198726
- })).then((results) => {
198727
- if (this.closed)
198728
- return;
198729
- results.forEach((item) => {
198730
- if (item)
198731
- this.add(sp2.dirname(item), sp2.basename(_origAdd || item));
198732
- });
198733
- });
198734
- return this;
198735
- }
198736
- unwatch(paths_) {
198737
- if (this.closed)
198738
- return this;
198739
- const paths = unifyPaths(paths_);
198740
- const { cwd: cwd2 } = this.options;
198741
- paths.forEach((path7) => {
198742
- if (!sp2.isAbsolute(path7) && !this._closers.has(path7)) {
198743
- if (cwd2)
198744
- path7 = sp2.join(cwd2, path7);
198745
- path7 = sp2.resolve(path7);
198746
- }
198747
- this._closePath(path7);
198748
- this._addIgnoredPath(path7);
198749
- if (this._watched.has(path7)) {
198750
- this._addIgnoredPath({
198751
- path: path7,
198752
- recursive: true
198753
- });
198754
- }
198755
- this._userIgnored = undefined;
198756
- });
198757
- return this;
198758
- }
198759
- close() {
198760
- if (this._closePromise) {
198761
- return this._closePromise;
198762
- }
198763
- this.closed = true;
198764
- this.removeAllListeners();
198765
- const closers = [];
198766
- this._closers.forEach((closerList) => closerList.forEach((closer) => {
198767
- const promise2 = closer();
198768
- if (promise2 instanceof Promise)
198769
- closers.push(promise2);
198770
- }));
198771
- this._streams.forEach((stream) => stream.destroy());
198772
- this._userIgnored = undefined;
198773
- this._readyCount = 0;
198774
- this._readyEmitted = false;
198775
- this._watched.forEach((dirent) => dirent.dispose());
198776
- this._closers.clear();
198777
- this._watched.clear();
198778
- this._streams.clear();
198779
- this._symlinkPaths.clear();
198780
- this._throttled.clear();
198781
- this._closePromise = closers.length ? Promise.all(closers).then(() => {
197450
+ if (!isConfigFile(filename)) {
198782
197451
  return;
198783
- }) : Promise.resolve();
198784
- return this._closePromise;
198785
- }
198786
- getWatched() {
198787
- const watchList = {};
198788
- this._watched.forEach((entry, dir) => {
198789
- const key = this.options.cwd ? sp2.relative(this.options.cwd, dir) : dir;
198790
- const index = key || ONE_DOT;
198791
- watchList[index] = entry.getChildren().sort();
198792
- });
198793
- return watchList;
198794
- }
198795
- emitWithAll(event, args) {
198796
- this.emit(event, ...args);
198797
- if (event !== EVENTS.ERROR)
198798
- this.emit(EVENTS.ALL, event, ...args);
198799
- }
198800
- async _emit(event, path7, stats2) {
198801
- if (this.closed)
198802
- return;
198803
- const opts = this.options;
198804
- if (isWindows)
198805
- path7 = sp2.normalize(path7);
198806
- if (opts.cwd)
198807
- path7 = sp2.relative(opts.cwd, path7);
198808
- const args = [path7];
198809
- if (stats2 != null)
198810
- args.push(stats2);
198811
- const awf = opts.awaitWriteFinish;
198812
- let pw;
198813
- if (awf && (pw = this._pendingWrites.get(path7))) {
198814
- pw.lastChange = new Date;
198815
- return this;
198816
197452
  }
198817
- if (opts.atomic) {
198818
- if (event === EVENTS.UNLINK) {
198819
- this._pendingUnlinks.set(path7, [event, ...args]);
198820
- setTimeout(() => {
198821
- this._pendingUnlinks.forEach((entry, path8) => {
198822
- this.emit(...entry);
198823
- this.emit(EVENTS.ALL, ...entry);
198824
- this._pendingUnlinks.delete(path8);
198825
- });
198826
- }, typeof opts.atomic === "number" ? opts.atomic : 100);
198827
- return this;
198828
- }
198829
- if (event === EVENTS.ADD && this._pendingUnlinks.has(path7)) {
198830
- event = EVENTS.CHANGE;
198831
- this._pendingUnlinks.delete(path7);
198832
- }
198833
- }
198834
- if (awf && (event === EVENTS.ADD || event === EVENTS.CHANGE) && this._readyEmitted) {
198835
- const awfEmit = (err, stats3) => {
198836
- if (err) {
198837
- event = EVENTS.ERROR;
198838
- args[0] = err;
198839
- this.emitWithAll(event, args);
198840
- } else if (stats3) {
198841
- if (args.length > 1) {
198842
- args[1] = stats3;
198843
- } else {
198844
- args.push(stats3);
198845
- }
198846
- this.emitWithAll(event, args);
198847
- }
198848
- };
198849
- this._awaitWriteFinish(path7, awf.stabilityThreshold, event, awfEmit);
198850
- return this;
198851
- }
198852
- if (event === EVENTS.CHANGE) {
198853
- const isThrottled = !this._throttle(EVENTS.CHANGE, path7, 50);
198854
- if (isThrottled)
198855
- return this;
198856
- }
198857
- if (opts.alwaysStat && stats2 === undefined && (event === EVENTS.ADD || event === EVENTS.ADD_DIR || event === EVENTS.CHANGE)) {
198858
- const fullPath = opts.cwd ? sp2.join(opts.cwd, path7) : path7;
198859
- let stats3;
197453
+ clearTimeout(reloadTimer);
197454
+ reloadTimer = setTimeout(async () => {
198860
197455
  try {
198861
- stats3 = await stat8(fullPath);
198862
- } catch (err) {}
198863
- if (!stats3 || this.closed)
198864
- return;
198865
- args.push(stats3);
198866
- }
198867
- this.emitWithAll(event, args);
198868
- return this;
198869
- }
198870
- _handleError(error52) {
198871
- const code = error52 && error52.code;
198872
- if (error52 && code !== "ENOENT" && code !== "ENOTDIR" && (!this.options.ignorePermissionErrors || code !== "EPERM" && code !== "EACCES")) {
198873
- this.emit(EVENTS.ERROR, error52);
198874
- }
198875
- return error52 || this.closed;
198876
- }
198877
- _throttle(actionType, path7, timeout) {
198878
- if (!this._throttled.has(actionType)) {
198879
- this._throttled.set(actionType, new Map);
198880
- }
198881
- const action = this._throttled.get(actionType);
198882
- if (!action)
198883
- throw new Error("invalid throttle");
198884
- const actionPath = action.get(path7);
198885
- if (actionPath) {
198886
- actionPath.count++;
198887
- return false;
198888
- }
198889
- let timeoutObject;
198890
- const clear = () => {
198891
- const item = action.get(path7);
198892
- const count = item ? item.count : 0;
198893
- action.delete(path7);
198894
- clearTimeout(timeoutObject);
198895
- if (item)
198896
- clearTimeout(item.timeoutObject);
198897
- return count;
198898
- };
198899
- timeoutObject = setTimeout(clear, timeout);
198900
- const thr = { timeoutObject, clear, count: 0 };
198901
- action.set(path7, thr);
198902
- return thr;
198903
- }
198904
- _incrReadyCount() {
198905
- return this._readyCount++;
198906
- }
198907
- _awaitWriteFinish(path7, threshold, event, awfEmit) {
198908
- const awf = this.options.awaitWriteFinish;
198909
- if (typeof awf !== "object")
198910
- return;
198911
- const pollInterval = awf.pollInterval;
198912
- let timeoutHandler;
198913
- let fullPath = path7;
198914
- if (this.options.cwd && !sp2.isAbsolute(path7)) {
198915
- fullPath = sp2.join(this.options.cwd, path7);
198916
- }
198917
- const now = new Date;
198918
- const writes = this._pendingWrites;
198919
- function awaitWriteFinishFn(prevStat) {
198920
- statcb(fullPath, (err, curStat) => {
198921
- if (err || !writes.has(path7)) {
198922
- if (err && err.code !== "ENOENT")
198923
- awfEmit(err);
198924
- return;
198925
- }
198926
- const now2 = Number(new Date);
198927
- if (prevStat && curStat.size !== prevStat.size) {
198928
- writes.get(path7).lastChange = now2;
198929
- }
198930
- const pw = writes.get(path7);
198931
- const df = now2 - pw.lastChange;
198932
- if (df >= threshold) {
198933
- writes.delete(path7);
198934
- awfEmit(undefined, curStat);
198935
- } else {
198936
- timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval, curStat);
198937
- }
198938
- });
198939
- }
198940
- if (!writes.has(path7)) {
198941
- writes.set(path7, {
198942
- lastChange: now,
198943
- cancelWait: () => {
198944
- writes.delete(path7);
198945
- clearTimeout(timeoutHandler);
198946
- return event;
198947
- }
198948
- });
198949
- timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval);
198950
- }
198951
- }
198952
- _isIgnored(path7, stats2) {
198953
- if (this.options.atomic && DOT_RE.test(path7))
198954
- return true;
198955
- if (!this._userIgnored) {
198956
- const { cwd: cwd2 } = this.options;
198957
- const ign = this.options.ignored;
198958
- const ignored = (ign || []).map(normalizeIgnored(cwd2));
198959
- const ignoredPaths = [...this._ignoredPaths];
198960
- const list3 = [...ignoredPaths.map(normalizeIgnored(cwd2)), ...ignored];
198961
- this._userIgnored = anymatch(list3, undefined);
198962
- }
198963
- return this._userIgnored(path7, stats2);
198964
- }
198965
- _isntIgnored(path7, stat9) {
198966
- return !this._isIgnored(path7, stat9);
198967
- }
198968
- _getWatchHelpers(path7) {
198969
- return new WatchHelper(path7, this.options.followSymlinks, this);
198970
- }
198971
- _getWatchedDir(directory) {
198972
- const dir = sp2.resolve(directory);
198973
- if (!this._watched.has(dir))
198974
- this._watched.set(dir, new DirEntry(dir, this._boundRemove));
198975
- return this._watched.get(dir);
198976
- }
198977
- _hasReadPermissions(stats2) {
198978
- if (this.options.ignorePermissionErrors)
198979
- return true;
198980
- return Boolean(Number(stats2.mode) & 256);
198981
- }
198982
- _remove(directory, item, isDirectory) {
198983
- const path7 = sp2.join(directory, item);
198984
- const fullPath = sp2.resolve(path7);
198985
- isDirectory = isDirectory != null ? isDirectory : this._watched.has(path7) || this._watched.has(fullPath);
198986
- if (!this._throttle("remove", path7, 100))
198987
- return;
198988
- if (!isDirectory && this._watched.size === 1) {
198989
- this.add(directory, item, true);
198990
- }
198991
- const wp = this._getWatchedDir(path7);
198992
- const nestedDirectoryChildren = wp.getChildren();
198993
- nestedDirectoryChildren.forEach((nested) => this._remove(path7, nested));
198994
- const parent = this._getWatchedDir(directory);
198995
- const wasTracked = parent.has(item);
198996
- parent.remove(item);
198997
- if (this._symlinkPaths.has(fullPath)) {
198998
- this._symlinkPaths.delete(fullPath);
198999
- }
199000
- let relPath = path7;
199001
- if (this.options.cwd)
199002
- relPath = sp2.relative(this.options.cwd, path7);
199003
- if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
199004
- const event = this._pendingWrites.get(relPath).cancelWait();
199005
- if (event === EVENTS.ADD)
199006
- return;
199007
- }
199008
- this._watched.delete(path7);
199009
- this._watched.delete(fullPath);
199010
- const eventName = isDirectory ? EVENTS.UNLINK_DIR : EVENTS.UNLINK;
199011
- if (wasTracked && !this._isIgnored(path7))
199012
- this._emit(eventName, path7);
199013
- this._closePath(path7);
199014
- }
199015
- _closePath(path7) {
199016
- this._closeFile(path7);
199017
- const dir = sp2.dirname(path7);
199018
- this._getWatchedDir(dir).remove(sp2.basename(path7));
199019
- }
199020
- _closeFile(path7) {
199021
- const closers = this._closers.get(path7);
199022
- if (!closers)
199023
- return;
199024
- closers.forEach((closer) => closer());
199025
- this._closers.delete(path7);
199026
- }
199027
- _addPathCloser(path7, closer) {
199028
- if (!closer)
199029
- return;
199030
- let list3 = this._closers.get(path7);
199031
- if (!list3) {
199032
- list3 = [];
199033
- this._closers.set(path7, list3);
199034
- }
199035
- list3.push(closer);
199036
- }
199037
- _readdirp(root4, opts) {
199038
- if (this.closed)
199039
- return;
199040
- const options = { type: EVENTS.ALL, alwaysStat: true, lstat: true, ...opts, depth: 0 };
199041
- let stream = readdirp(root4, options);
199042
- this._streams.add(stream);
199043
- stream.once(STR_CLOSE, () => {
199044
- stream = undefined;
199045
- });
199046
- stream.once(STR_END, () => {
199047
- if (stream) {
199048
- this._streams.delete(stream);
199049
- stream = undefined;
197456
+ const appConfig = await loadAppConfig(options);
197457
+ const stackConfigs = await loadStackConfigs(options);
197458
+ validateFeatures({ appConfig, stackConfigs });
197459
+ resolve5({ appConfig, stackConfigs });
197460
+ } catch (error52) {
197461
+ reject(error52);
199050
197462
  }
199051
- });
199052
- return stream;
199053
- }
199054
- }
199055
- function watch(paths, options = {}) {
199056
- const watcher = new FSWatcher(options);
199057
- watcher.add(paths);
199058
- return watcher;
199059
- }
199060
-
199061
- // src/config/load/watch.ts
199062
- var watchConfig = async (options, resolve7, reject) => {
199063
- await loadAppConfig(options);
199064
- debug("Start watching...");
199065
- const ext2 = "{json,jsonc,json5}";
199066
- const watcher = watch([`app.${ext2}`, `**/stack.${ext2}`, `**/*.stack.${ext2}`], {
199067
- cwd: directories.root,
199068
- ignored: ["**/node_modules/**", "**/dist/**"],
199069
- awaitWriteFinish: true
199070
- });
199071
- watcher.on("change", async () => {
199072
- try {
199073
- const appConfig = await loadAppConfig(options);
199074
- const stackConfigs = await loadStackConfigs(options);
199075
- validateFeatures({ appConfig, stackConfigs });
199076
- resolve7({ appConfig, stackConfigs });
199077
- } catch (error52) {
199078
- reject(error52);
199079
- }
197463
+ }, 150);
199080
197464
  });
199081
197465
  return watcher;
199082
197466
  };
199083
197467
 
199084
197468
  // src/dev/index.ts
199085
197469
  import { loadWorkspace as loadWorkspace3 } from "@awsless/ts-file-cache";
197470
+ import { watch as watch2 } from "fs";
199086
197471
  import { mkdir as mkdir11, rm as rm12, writeFile as writeFile15 } from "fs/promises";
199087
- import { join as join51 } from "path";
197472
+ import { basename as basename5, dirname as dirname24, join as join49, sep as sep5 } from "path";
199088
197473
 
199089
197474
  // src/dev/context.ts
199090
197475
  import { DynamoDBServer } from "@awsless/dynamodb-server";
199091
- import { join as join46 } from "path";
197476
+ import { join as join44 } from "path";
199092
197477
 
199093
197478
  // src/dev/servers/s3.ts
199094
197479
  import { createHash as createHash20 } from "crypto";
199095
- import { mkdir as mkdir9, readdir as readdir8, readFile as readFile18, rm as rm10, stat as stat9, writeFile as writeFile12 } from "fs/promises";
197480
+ import { mkdir as mkdir9, readdir as readdir6, readFile as readFile18, rm as rm10, stat as stat6, writeFile as writeFile12 } from "fs/promises";
199096
197481
  import { createServer as createServer7 } from "http";
199097
- import { dirname as dirname24, isAbsolute as isAbsolute7, join as join45, relative as relative12, sep as sep2 } from "path";
197482
+ import { dirname as dirname22, isAbsolute as isAbsolute6, join as join43, relative as relative10, sep as sep3 } from "path";
199098
197483
  var escapeXml = (value) => {
199099
197484
  return value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&apos;");
199100
197485
  };
@@ -199159,11 +197544,11 @@ var createS3Server = (props) => {
199159
197544
  res.end(xmlError("InvalidRequest", "Missing bucket name"));
199160
197545
  return;
199161
197546
  }
199162
- const bucketDir = join45(props.root, bucket);
199163
- const file3 = join45(bucketDir, ...keyParts);
197547
+ const bucketDir = join43(props.root, bucket);
197548
+ const file3 = join43(bucketDir, ...keyParts);
199164
197549
  const escapes = (base, path7) => {
199165
- const rel = relative12(base, path7);
199166
- return rel.startsWith("..") || isAbsolute7(rel);
197550
+ const rel = relative10(base, path7);
197551
+ return rel.startsWith("..") || isAbsolute6(rel);
199167
197552
  };
199168
197553
  if (escapes(props.root, bucketDir) || escapes(bucketDir, file3)) {
199169
197554
  res.writeHead(400, { "content-type": "application/xml" });
@@ -199176,20 +197561,20 @@ var createS3Server = (props) => {
199176
197561
  const walk2 = async (dir) => {
199177
197562
  let entries2;
199178
197563
  try {
199179
- entries2 = await readdir8(dir, { withFileTypes: true });
197564
+ entries2 = await readdir6(dir, { withFileTypes: true });
199180
197565
  } catch (_5) {
199181
197566
  return;
199182
197567
  }
199183
197568
  for (const entry of entries2) {
199184
- const path7 = join45(dir, entry.name);
197569
+ const path7 = join43(dir, entry.name);
199185
197570
  if (entry.isDirectory()) {
199186
197571
  await walk2(path7);
199187
197572
  } else {
199188
- const objectKey = relative12(bucketDir, path7).split(sep2).join("/");
197573
+ const objectKey = relative10(bucketDir, path7).split(sep3).join("/");
199189
197574
  if (!objectKey.startsWith(prefix)) {
199190
197575
  continue;
199191
197576
  }
199192
- const info2 = await stat9(path7);
197577
+ const info2 = await stat6(path7);
199193
197578
  contents.push(`<Contents><Key>${escapeXml(objectKey)}</Key><Size>${info2.size}</Size><LastModified>${info2.mtime.toISOString()}</LastModified><ETag>&quot;local&quot;</ETag></Contents>`);
199194
197579
  }
199195
197580
  }
@@ -199207,7 +197592,7 @@ var createS3Server = (props) => {
199207
197592
  if (typeof encoding === "string" && encoding.includes("aws-chunked") || typeof sha === "string" && sha.startsWith("STREAMING")) {
199208
197593
  body = decodeAwsChunked(body);
199209
197594
  }
199210
- await mkdir9(dirname24(file3), { recursive: true });
197595
+ await mkdir9(dirname22(file3), { recursive: true });
199211
197596
  await writeFile12(file3, body);
199212
197597
  const eTag = createHash20("md5").update(body).digest("hex");
199213
197598
  res.writeHead(200, { etag: `"${eTag}"` });
@@ -199253,10 +197638,10 @@ var createS3Server = (props) => {
199253
197638
  res.end(xmlError("InternalError", error52 instanceof Error ? error52.message : String(error52)));
199254
197639
  });
199255
197640
  });
199256
- await new Promise((resolve7, reject) => {
197641
+ await new Promise((resolve5, reject) => {
199257
197642
  server.once("error", reject);
199258
197643
  closeServer = trackConnections(server);
199259
- server.listen(port, "127.0.0.1", () => resolve7());
197644
+ server.listen(port, "127.0.0.1", () => resolve5());
199260
197645
  });
199261
197646
  return server.address().port;
199262
197647
  },
@@ -199471,7 +197856,7 @@ var createSqsServer = (props) => {
199471
197856
  if (now >= deadline || signal.aborted) {
199472
197857
  return {};
199473
197858
  }
199474
- await new Promise((resolve7) => setTimeout(resolve7, 100));
197859
+ await new Promise((resolve5) => setTimeout(resolve5, 100));
199475
197860
  }
199476
197861
  },
199477
197862
  DeleteMessage(input) {
@@ -199577,10 +197962,10 @@ var createSqsServer = (props) => {
199577
197962
  }
199578
197963
  });
199579
197964
  });
199580
- await new Promise((resolve7, reject) => {
197965
+ await new Promise((resolve5, reject) => {
199581
197966
  server.once("error", reject);
199582
197967
  closeServer = trackConnections(server);
199583
- server.listen(port, "127.0.0.1", () => resolve7());
197968
+ server.listen(port, "127.0.0.1", () => resolve5());
199584
197969
  });
199585
197970
  boundPort = server.address().port;
199586
197971
  return boundPort;
@@ -199655,7 +198040,7 @@ var createDevContext = (props) => {
199655
198040
  const value = await props.pool.keep("store", null, async () => {
199656
198041
  const rules = [];
199657
198042
  const server = createS3Server({
199658
- root: join46(directories.output, "local", "store"),
198043
+ root: join44(directories.output, "local", "store"),
199659
198044
  region: props.appConfig.region,
199660
198045
  rules
199661
198046
  });
@@ -199782,9 +198167,9 @@ var createDevContext = (props) => {
199782
198167
 
199783
198168
  // src/dev/seed.ts
199784
198169
  import { spawn as spawn6 } from "child_process";
199785
- import { isAbsolute as isAbsolute8, join as join47 } from "path";
198170
+ import { isAbsolute as isAbsolute7, join as join45 } from "path";
199786
198171
  var createSeedRunner = (props) => {
199787
- const file3 = props.seed && (isAbsolute8(props.seed) ? props.seed : join47(directories.root, props.seed));
198172
+ const file3 = props.seed && (isAbsolute7(props.seed) ? props.seed : join45(directories.root, props.seed));
199788
198173
  let running;
199789
198174
  const run = () => {
199790
198175
  running ??= (async () => {
@@ -199793,7 +198178,7 @@ var createSeedRunner = (props) => {
199793
198178
  return;
199794
198179
  }
199795
198180
  debug(`Seeding from ${props.seed}`);
199796
- await new Promise((resolve7, reject) => {
198181
+ await new Promise((resolve5, reject) => {
199797
198182
  const child = spawn6("bun", [file3], {
199798
198183
  cwd: directories.root,
199799
198184
  stdio: ["ignore", "pipe", "pipe"],
@@ -199812,7 +198197,7 @@ var createSeedRunner = (props) => {
199812
198197
  debug(logs);
199813
198198
  }
199814
198199
  if (code === 0) {
199815
- resolve7();
198200
+ resolve5();
199816
198201
  } else {
199817
198202
  reject(new Error(`The seed exited with code ${code}:
199818
198203
  ${logs}`));
@@ -199833,15 +198218,15 @@ var import_ioredis4 = __toESM(require_built5(), 1);
199833
198218
  import { DynamoDBClient as DynamoDBClient5 } from "@aws-sdk/client-dynamodb";
199834
198219
  import { DynamoDBDocumentClient, ScanCommand as ScanCommand2 } from "@aws-sdk/lib-dynamodb";
199835
198220
  import { randomUUID as randomUUID8 } from "crypto";
199836
- import { readdir as readdir9, readFile as readFile19, stat as stat10, writeFile as writeFile14 } from "fs/promises";
198221
+ import { readdir as readdir7, readFile as readFile19, stat as stat7, writeFile as writeFile14 } from "fs/promises";
199837
198222
  import { createServer as createServer9 } from "http";
199838
- import { join as join49, relative as relative13, sep as sep3 } from "path";
198223
+ import { join as join47, relative as relative11, sep as sep4 } from "path";
199839
198224
 
199840
198225
  // src/dev/worker.ts
199841
198226
  import { spawn as spawn7 } from "child_process";
199842
198227
  import { writeFile as writeFile13 } from "fs/promises";
199843
198228
  import { availableParallelism } from "os";
199844
- import { join as join48 } from "path";
198229
+ import { join as join46 } from "path";
199845
198230
  class WorkerError extends Error {
199846
198231
  name;
199847
198232
  constructor(name, message3, stack) {
@@ -200033,12 +198418,12 @@ var createBundleWorker = (props) => {
200033
198418
  return;
200034
198419
  }
200035
198420
  } catch (_5) {}
200036
- await new Promise((resolve7) => setTimeout(resolve7, 50));
198421
+ await new Promise((resolve5) => setTimeout(resolve5, 50));
200037
198422
  }
200038
198423
  throw new Error("The bundle worker never became ready.");
200039
198424
  };
200040
198425
  const startWorker = async () => {
200041
- const entry = join48(props.buildDir, "worker.mjs");
198426
+ const entry = join46(props.buildDir, "worker.mjs");
200042
198427
  const port = await findFreePort();
200043
198428
  const child = spawn7("node", ["--enable-source-maps", entry], {
200044
198429
  cwd: props.buildDir,
@@ -200099,7 +198484,7 @@ var createBundleWorker = (props) => {
200099
198484
  return worker;
200100
198485
  };
200101
198486
  const doStart = async () => {
200102
- await writeFile13(join48(props.buildDir, "worker.mjs"), WORKER_ENTRY);
198487
+ await writeFile13(join46(props.buildDir, "worker.mjs"), WORKER_ENTRY);
200103
198488
  const results = await Promise.allSettled(Array.from({ length: concurrency }, () => startWorker()));
200104
198489
  const started = results.filter((result) => result.status === "fulfilled").map((result) => result.value);
200105
198490
  const failed = results.find((result) => result.status === "rejected");
@@ -202513,18 +200898,18 @@ var createDashboardServer = (props) => {
202513
200898
  const walk2 = async (dir) => {
202514
200899
  let entries2;
202515
200900
  try {
202516
- entries2 = await readdir9(dir, { withFileTypes: true });
200901
+ entries2 = await readdir7(dir, { withFileTypes: true });
202517
200902
  } catch (_5) {
202518
200903
  return;
202519
200904
  }
202520
200905
  for (const entry of entries2) {
202521
- const path7 = join49(dir, entry.name);
200906
+ const path7 = join47(dir, entry.name);
202522
200907
  if (entry.isDirectory()) {
202523
200908
  await walk2(path7);
202524
200909
  } else {
202525
- const key = relative13(props.storeRoot, path7).split(sep3).slice(1).join("/");
200910
+ const key = relative11(props.storeRoot, path7).split(sep4).slice(1).join("/");
202526
200911
  if (key.startsWith(prefix)) {
202527
- const info2 = await stat10(path7);
200912
+ const info2 = await stat7(path7);
202528
200913
  files.push({ key, size: info2.size, modified: info2.mtime.toISOString() });
202529
200914
  }
202530
200915
  }
@@ -202650,10 +201035,10 @@ var createDashboardServer = (props) => {
202650
201035
  res.end(JSON.stringify({ error: message3 }));
202651
201036
  });
202652
201037
  });
202653
- await new Promise((resolve7, reject) => {
201038
+ await new Promise((resolve5, reject) => {
202654
201039
  server.once("error", reject);
202655
201040
  closeServer = trackConnections(server);
202656
- server.listen(port, "127.0.0.1", () => resolve7());
201041
+ server.listen(port, "127.0.0.1", () => resolve5());
202657
201042
  });
202658
201043
  },
202659
201044
  stop() {
@@ -202740,10 +201125,10 @@ var createBlockedServer = (props) => {
202740
201125
  res.writeHead(400, { "content-type": "application/x-amz-json-1.1" });
202741
201126
  res.end(JSON.stringify({ __type: "NotEmulatedLocally", message: message3 }));
202742
201127
  });
202743
- await new Promise((resolve7, reject) => {
201128
+ await new Promise((resolve5, reject) => {
202744
201129
  server.once("error", reject);
202745
201130
  closeServer = trackConnections(server);
202746
- server.listen(port, "127.0.0.1", () => resolve7());
201131
+ server.listen(port, "127.0.0.1", () => resolve5());
202747
201132
  });
202748
201133
  return server.address().port;
202749
201134
  },
@@ -202821,10 +201206,10 @@ var createLambdaServer = (props) => {
202821
201206
  }
202822
201207
  }).catch(fail);
202823
201208
  });
202824
- await new Promise((resolve7, reject) => {
201209
+ await new Promise((resolve5, reject) => {
202825
201210
  server.once("error", reject);
202826
201211
  closeServer = trackConnections(server);
202827
- server.listen(port, "127.0.0.1", () => resolve7());
201212
+ server.listen(port, "127.0.0.1", () => resolve5());
202828
201213
  });
202829
201214
  return server.address().port;
202830
201215
  },
@@ -202835,17 +201220,17 @@ var createLambdaServer = (props) => {
202835
201220
  };
202836
201221
 
202837
201222
  // src/dev/sdk.ts
202838
- import { readdir as readdir10, readFile as readFile20, mkdir as mkdir10, rm as rm11, stat as stat11, symlink } from "fs/promises";
201223
+ import { readdir as readdir8, readFile as readFile20, mkdir as mkdir10, rm as rm11, stat as stat8, symlink } from "fs/promises";
202839
201224
  import { createRequire } from "module";
202840
- import { dirname as dirname25, join as join50 } from "path";
201225
+ import { dirname as dirname23, join as join48 } from "path";
202841
201226
  var linkSdkPackages = async (buildDir, onWarn) => {
202842
- const filesDir = join50(buildDir, "files");
201227
+ const filesDir = join48(buildDir, "files");
202843
201228
  const packages = new Set;
202844
- for (const file3 of await readdir10(filesDir)) {
201229
+ for (const file3 of await readdir8(filesDir)) {
202845
201230
  if (!file3.endsWith(".mjs")) {
202846
201231
  continue;
202847
201232
  }
202848
- const code = await readFile20(join50(filesDir, file3), "utf8");
201233
+ const code = await readFile20(join48(filesDir, file3), "utf8");
202849
201234
  for (const match3 of code.matchAll(/(?:from\s*|import\()\s*["'](@aws-sdk\/[a-z0-9-]+|sharp)["']/g)) {
202850
201235
  packages.add(match3[1]);
202851
201236
  }
@@ -202853,25 +201238,25 @@ var linkSdkPackages = async (buildDir, onWarn) => {
202853
201238
  const ownRequire = createRequire(import.meta.url);
202854
201239
  const isProjectDep = async (name) => {
202855
201240
  try {
202856
- await stat11(join50(directories.root, "node_modules", name, "package.json"));
201241
+ await stat8(join48(directories.root, "node_modules", name, "package.json"));
202857
201242
  return true;
202858
201243
  } catch (_5) {
202859
201244
  return false;
202860
201245
  }
202861
201246
  };
202862
201247
  const resolveFromStore = async (name) => {
202863
- const store = join50(directories.root, "node_modules", ".pnpm");
201248
+ const store = join48(directories.root, "node_modules", ".pnpm");
202864
201249
  const prefix = name.replaceAll("/", "+") + "@";
202865
201250
  try {
202866
- const entries2 = (await readdir10(store)).filter((entry) => entry.startsWith(prefix));
201251
+ const entries2 = (await readdir8(store)).filter((entry) => entry.startsWith(prefix));
202867
201252
  const best = entries2.sort((a4, b6) => a4.slice(prefix.length).localeCompare(b6.slice(prefix.length), undefined, { numeric: true })).at(-1);
202868
- return best ? join50(store, best, "node_modules", name) : undefined;
201253
+ return best ? join48(store, best, "node_modules", name) : undefined;
202869
201254
  } catch (_5) {
202870
201255
  return;
202871
201256
  }
202872
201257
  };
202873
201258
  for (const name of packages) {
202874
- const target2 = join50(buildDir, "node_modules", name);
201259
+ const target2 = join48(buildDir, "node_modules", name);
202875
201260
  try {
202876
201261
  if (await isProjectDep(name)) {
202877
201262
  await rm11(target2, { recursive: true, force: true });
@@ -202881,16 +201266,16 @@ var linkSdkPackages = async (buildDir, onWarn) => {
202881
201266
  let source = await resolveFromStore(name);
202882
201267
  if (!source) {
202883
201268
  try {
202884
- source = dirname25(ownRequire.resolve(`${name}/package.json`));
201269
+ source = dirname23(ownRequire.resolve(`${name}/package.json`));
202885
201270
  } catch (_5) {
202886
201271
  onWarn?.(`The bundle imports "${name}", which is neither a project dependency nor shipped with the cli. Add it to your project dependencies.`);
202887
201272
  continue;
202888
201273
  }
202889
201274
  }
202890
- await mkdir10(dirname25(target2), { recursive: true });
201275
+ await mkdir10(dirname23(target2), { recursive: true });
202891
201276
  await rm11(target2, { recursive: true, force: true });
202892
201277
  await symlink(source, target2, "dir");
202893
- await stat11(join50(target2, "package.json"));
201278
+ await stat8(join48(target2, "package.json"));
202894
201279
  debug(`Sdk link ${name}: ${source}`);
202895
201280
  } catch (error52) {
202896
201281
  onWarn?.(`Linking the "${name}" sdk package failed: ${error52 instanceof Error ? error52.message : String(error52)}`);
@@ -202916,7 +201301,7 @@ var startDev = async (props) => {
202916
201301
  dev: true
202917
201302
  });
202918
201303
  ready2();
202919
- await mkdir11(join51(directories.output, "local"), { recursive: true });
201304
+ await mkdir11(join49(directories.output, "local"), { recursive: true });
202920
201305
  const routerPorts = {};
202921
201306
  Object.keys(appConfig.router ?? {}).forEach((id, index) => {
202922
201307
  routerPorts[id] = props.port + 1 + index;
@@ -202974,7 +201359,7 @@ var startDev = async (props) => {
202974
201359
  for (const [id, port] of Object.entries(routerPorts)) {
202975
201360
  env4[`ROUTER_${constantCase(id)}_ENDPOINT`] = `localhost:${port}`;
202976
201361
  }
202977
- await writeFile15(join51(directories.output, "local", "env.json"), JSON.stringify(env4, null, "\t") + `
201362
+ await writeFile15(join49(directories.output, "local", "env.json"), JSON.stringify(env4, null, "\t") + `
202978
201363
  `);
202979
201364
  return { env: env4, lambda: lambda2 };
202980
201365
  });
@@ -203211,8 +201596,8 @@ var startDev = async (props) => {
203211
201596
  resources: dev.resources,
203212
201597
  routes: dev.routes,
203213
201598
  env: env3,
203214
- storeRoot: join51(directories.output, "local", "store"),
203215
- configFile: join51(directories.output, "local", "config.json"),
201599
+ storeRoot: join49(directories.output, "local", "store"),
201600
+ configFile: join49(directories.output, "local", "config.json"),
203216
201601
  getEmails: () => props.pool.peek("shim:ses-email")?.server.list() ?? [],
203217
201602
  getAlerts: () => props.pool.peek("shim:sns")?.alerts ?? [],
203218
201603
  getSession: () => ({ startedAt, workers: worker.size() }),
@@ -203226,13 +201611,19 @@ var startDev = async (props) => {
203226
201611
  });
203227
201612
  dashboard.connect(dispatch);
203228
201613
  await dashboard.listen(dashboardPort);
203229
- const watcher = watch(directories.root, {
203230
- ignored: ["**/node_modules/**", "**/.awsless/**", "**/dist/**", "**/.git/**", "**/*.stack.*", "**/app.json*"],
203231
- ignoreInitial: true,
203232
- awaitWriteFinish: { stabilityThreshold: 100, pollInterval: 50 }
203233
- });
201614
+ const ignoredDirectories2 = new Set(["node_modules", ".awsless", "dist", ".git"]);
203234
201615
  let rebuildTimer;
203235
- watcher.on("all", () => {
201616
+ const watcher = watch2(directories.root, { recursive: true }, (_event, filename) => {
201617
+ if (!filename) {
201618
+ return;
201619
+ }
201620
+ if (filename.split(sep5).some((segment) => ignoredDirectories2.has(segment))) {
201621
+ return;
201622
+ }
201623
+ const base = basename5(filename);
201624
+ if (base.includes(".stack.") || base.startsWith("app.json")) {
201625
+ return;
201626
+ }
203236
201627
  dirty = true;
203237
201628
  clearTimeout(rebuildTimer);
203238
201629
  rebuildTimer = setTimeout(() => {
@@ -203241,8 +201632,7 @@ var startDev = async (props) => {
203241
201632
  });
203242
201633
  }, 150);
203243
201634
  });
203244
- const restartWatcher = dev.restartPaths.length > 0 ? watch(dev.restartPaths, { ignoreInitial: true }) : undefined;
203245
- restartWatcher?.on("all", () => {
201635
+ const restartWorker = () => {
203246
201636
  if (stopping) {
203247
201637
  return;
203248
201638
  }
@@ -203255,16 +201645,27 @@ var startDev = async (props) => {
203255
201645
  dev.context.reportHealth("workers", "down", error52 instanceof Error ? error52.message : String(error52));
203256
201646
  log(`The bundle worker failed to restart: ${error52 instanceof Error ? error52.message : String(error52)}`);
203257
201647
  });
203258
- });
201648
+ };
201649
+ const restartWatchers = [];
201650
+ for (const path7 of dev.restartPaths) {
201651
+ await mkdir11(dirname24(path7), { recursive: true });
201652
+ restartWatchers.push(watch2(dirname24(path7), (_event, filename) => {
201653
+ if (filename === basename5(path7)) {
201654
+ restartWorker();
201655
+ }
201656
+ }));
201657
+ }
203259
201658
  return {
203260
201659
  dashboardPort,
203261
201660
  routerPorts,
203262
201661
  async stop() {
203263
201662
  stopping = true;
203264
- await rm12(join51(directories.output, "local", "env.json"), { force: true });
201663
+ await rm12(join49(directories.output, "local", "env.json"), { force: true });
203265
201664
  clearTimeout(rebuildTimer);
203266
- await watcher.close();
203267
- await restartWatcher?.close();
201665
+ watcher.close();
201666
+ for (const restartWatcher of restartWatchers) {
201667
+ restartWatcher.close();
201668
+ }
203268
201669
  await fresh?.catch(() => {});
203269
201670
  for (const router of routers) {
203270
201671
  await router.stop();
@@ -203327,7 +201728,7 @@ var createServerPool = () => {
203327
201728
 
203328
201729
  // src/type-gen/generate.ts
203329
201730
  import { mkdir as mkdir12, writeFile as writeFile16 } from "fs/promises";
203330
- import { dirname as dirname26, join as join52, relative as relative14 } from "path";
201731
+ import { dirname as dirname25, join as join50, relative as relative12 } from "path";
203331
201732
  var generateTypes = async (props) => {
203332
201733
  const files = [];
203333
201734
  await Promise.all(features.map((feature) => {
@@ -203335,12 +201736,12 @@ var generateTypes = async (props) => {
203335
201736
  ...props,
203336
201737
  async write(file3, data, include = false) {
203337
201738
  const code = data?.toString("utf8");
203338
- const path7 = join52(directories.types, file3);
201739
+ const path7 = join50(directories.types, file3);
203339
201740
  if (code) {
203340
201741
  if (include) {
203341
- files.push(relative14(directories.root, path7));
201742
+ files.push(relative12(directories.root, path7));
203342
201743
  }
203343
- await mkdir12(dirname26(path7), { recursive: true });
201744
+ await mkdir12(dirname25(path7), { recursive: true });
203344
201745
  await writeFile16(path7, code);
203345
201746
  }
203346
201747
  }
@@ -203349,7 +201750,7 @@ var generateTypes = async (props) => {
203349
201750
  if (files.length) {
203350
201751
  const code = files.map((file3) => `/// <reference path='${file3}' />`).join(`
203351
201752
  `);
203352
- await writeFile16(join52(directories.root, `awsless.d.ts`), code);
201753
+ await writeFile16(join50(directories.root, `awsless.d.ts`), code);
203353
201754
  }
203354
201755
  };
203355
201756
 
@@ -203368,8 +201769,8 @@ var dev = (program3) => {
203368
201769
  const pool = createServerPool();
203369
201770
  let instance;
203370
201771
  let resolveShutdown;
203371
- const shutdown = new Promise((resolve7) => {
203372
- resolveShutdown = resolve7;
201772
+ const shutdown = new Promise((resolve5) => {
201773
+ resolveShutdown = resolve5;
203373
201774
  });
203374
201775
  const claimSignals = () => {
203375
201776
  process.removeAllListeners("SIGINT");
@@ -204889,7 +203290,7 @@ class DefaultRateLimiter {
204889
203290
  this.refillTokenBucket();
204890
203291
  if (amount > this.availableTokens) {
204891
203292
  const delay = (amount - this.availableTokens) / this.fillRate * 1000;
204892
- await new Promise((resolve7) => DefaultRateLimiter.setTimeoutFn(resolve7, delay));
203293
+ await new Promise((resolve5) => DefaultRateLimiter.setTimeoutFn(resolve5, delay));
204893
203294
  }
204894
203295
  this.availableTokens = this.availableTokens - amount;
204895
203296
  }
@@ -205640,7 +204041,7 @@ var fromEnv3 = (envVarSelector, options) => async () => {
205640
204041
 
205641
204042
  // ../../node_modules/.pnpm/@smithy+shared-ini-file-loader@4.4.7/node_modules/@smithy/shared-ini-file-loader/dist-es/getHomeDir.js
205642
204043
  import { homedir as homedir3 } from "os";
205643
- import { sep as sep4 } from "path";
204044
+ import { sep as sep6 } from "path";
205644
204045
  var homeDirCache = {};
205645
204046
  var getHomeDirCacheKey = () => {
205646
204047
  if (process && process.geteuid) {
@@ -205649,7 +204050,7 @@ var getHomeDirCacheKey = () => {
205649
204050
  return "DEFAULT";
205650
204051
  };
205651
204052
  var getHomeDir = () => {
205652
- const { HOME, USERPROFILE, HOMEPATH, HOMEDRIVE = `C:${sep4}` } = process.env;
204053
+ const { HOME, USERPROFILE, HOMEPATH, HOMEDRIVE = `C:${sep6}` } = process.env;
205653
204054
  if (HOME)
205654
204055
  return HOME;
205655
204056
  if (USERPROFILE)
@@ -205668,7 +204069,7 @@ var DEFAULT_PROFILE = "default";
205668
204069
  var getProfileName7 = (init) => init.profile || process.env[ENV_PROFILE2] || DEFAULT_PROFILE;
205669
204070
 
205670
204071
  // ../../node_modules/.pnpm/@smithy+shared-ini-file-loader@4.4.7/node_modules/@smithy/shared-ini-file-loader/dist-es/loadSharedConfigFiles.js
205671
- import { join as join55 } from "path";
204072
+ import { join as join53 } from "path";
205672
204073
 
205673
204074
  // ../../node_modules/.pnpm/@smithy+shared-ini-file-loader@4.4.7/node_modules/@smithy/shared-ini-file-loader/dist-es/constants.js
205674
204075
  var CONFIG_PREFIX_SEPARATOR = ".";
@@ -205690,14 +204091,14 @@ var getConfigData = (data) => Object.entries(data).filter(([key]) => {
205690
204091
  });
205691
204092
 
205692
204093
  // ../../node_modules/.pnpm/@smithy+shared-ini-file-loader@4.4.7/node_modules/@smithy/shared-ini-file-loader/dist-es/getConfigFilepath.js
205693
- import { join as join53 } from "path";
204094
+ import { join as join51 } from "path";
205694
204095
  var ENV_CONFIG_PATH = "AWS_CONFIG_FILE";
205695
- var getConfigFilepath = () => process.env[ENV_CONFIG_PATH] || join53(getHomeDir(), ".aws", "config");
204096
+ var getConfigFilepath = () => process.env[ENV_CONFIG_PATH] || join51(getHomeDir(), ".aws", "config");
205696
204097
 
205697
204098
  // ../../node_modules/.pnpm/@smithy+shared-ini-file-loader@4.4.7/node_modules/@smithy/shared-ini-file-loader/dist-es/getCredentialsFilepath.js
205698
- import { join as join54 } from "path";
204099
+ import { join as join52 } from "path";
205699
204100
  var ENV_CREDENTIALS_PATH = "AWS_SHARED_CREDENTIALS_FILE";
205700
- var getCredentialsFilepath = () => process.env[ENV_CREDENTIALS_PATH] || join54(getHomeDir(), ".aws", "credentials");
204101
+ var getCredentialsFilepath = () => process.env[ENV_CREDENTIALS_PATH] || join52(getHomeDir(), ".aws", "credentials");
205701
204102
 
205702
204103
  // ../../node_modules/.pnpm/@smithy+shared-ini-file-loader@4.4.7/node_modules/@smithy/shared-ini-file-loader/dist-es/parseIni.js
205703
204104
  var prefixKeyRegex = /^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/;
@@ -205770,11 +204171,11 @@ var loadSharedConfigFiles = async (init = {}) => {
205770
204171
  const relativeHomeDirPrefix = "~/";
205771
204172
  let resolvedFilepath = filepath;
205772
204173
  if (filepath.startsWith(relativeHomeDirPrefix)) {
205773
- resolvedFilepath = join55(homeDir, filepath.slice(2));
204174
+ resolvedFilepath = join53(homeDir, filepath.slice(2));
205774
204175
  }
205775
204176
  let resolvedConfigFilepath = configFilepath;
205776
204177
  if (configFilepath.startsWith(relativeHomeDirPrefix)) {
205777
- resolvedConfigFilepath = join55(homeDir, configFilepath.slice(2));
204178
+ resolvedConfigFilepath = join53(homeDir, configFilepath.slice(2));
205778
204179
  }
205779
204180
  const parsedFiles = await Promise.all([
205780
204181
  readFile21(resolvedConfigFilepath, {
@@ -206435,8 +204836,8 @@ class NoOpLogger3 {
206435
204836
  }
206436
204837
 
206437
204838
  // ../../node_modules/.pnpm/@smithy+middleware-retry@4.4.46/node_modules/@smithy/middleware-retry/dist-es/isStreamingPayload/isStreamingPayload.js
206438
- import { Readable as Readable2 } from "stream";
206439
- var isStreamingPayload = (request) => request?.body instanceof Readable2 || typeof ReadableStream !== "undefined" && request?.body instanceof ReadableStream;
204839
+ import { Readable } from "stream";
204840
+ var isStreamingPayload = (request) => request?.body instanceof Readable || typeof ReadableStream !== "undefined" && request?.body instanceof ReadableStream;
206440
204841
 
206441
204842
  // ../../node_modules/.pnpm/@smithy+middleware-retry@4.4.46/node_modules/@smithy/middleware-retry/dist-es/retryMiddleware.js
206442
204843
  var retryMiddleware = (options) => (next, context) => async (args) => {
@@ -206483,7 +204884,7 @@ var retryMiddleware = (options) => (next, context) => async (args) => {
206483
204884
  attempts = retryToken.getRetryCount();
206484
204885
  const delay = retryToken.getRetryDelay();
206485
204886
  totalRetryDelay += delay;
206486
- await new Promise((resolve7) => setTimeout(resolve7, delay));
204887
+ await new Promise((resolve5) => setTimeout(resolve5, delay));
206487
204888
  }
206488
204889
  }
206489
204890
  } else {
@@ -207109,19 +205510,19 @@ var getRuntimeUserAgentPair = () => {
207109
205510
 
207110
205511
  // ../../node_modules/.pnpm/@aws-sdk+util-user-agent-node@3.973.14_aws-crt@1.33.1/node_modules/@aws-sdk/util-user-agent-node/dist-es/getTypeScriptUserAgentPair.js
207111
205512
  import { readFile as readFile23 } from "fs/promises";
207112
- import { join as join57 } from "path";
205513
+ import { join as join55 } from "path";
207113
205514
 
207114
205515
  // ../../node_modules/.pnpm/@aws-sdk+util-user-agent-node@3.973.14_aws-crt@1.33.1/node_modules/@aws-sdk/util-user-agent-node/dist-es/getNodeModulesParentDirs.js
207115
- import { normalize as normalize4, sep as sep5 } from "path";
207116
- var getNodeModulesParentDirs = (dirname28) => {
205516
+ import { normalize as normalize3, sep as sep7 } from "path";
205517
+ var getNodeModulesParentDirs = (dirname27) => {
207117
205518
  const cwd2 = process.cwd();
207118
- if (!dirname28) {
205519
+ if (!dirname27) {
207119
205520
  return [cwd2];
207120
205521
  }
207121
- const normalizedPath = normalize4(dirname28);
207122
- const parts = normalizedPath.split(sep5);
205522
+ const normalizedPath = normalize3(dirname27);
205523
+ const parts = normalizedPath.split(sep7);
207123
205524
  const nodeModulesIndex = parts.indexOf("node_modules");
207124
- const parentDir = nodeModulesIndex !== -1 ? parts.slice(0, nodeModulesIndex).join(sep5) : normalizedPath;
205525
+ const parentDir = nodeModulesIndex !== -1 ? parts.slice(0, nodeModulesIndex).join(sep7) : normalizedPath;
207125
205526
  if (cwd2 === parentDir) {
207126
205527
  return [cwd2];
207127
205528
  }
@@ -207157,7 +205558,7 @@ var getSanitizedDevTypeScriptVersion = (version4 = "") => {
207157
205558
  // ../../node_modules/.pnpm/@aws-sdk+util-user-agent-node@3.973.14_aws-crt@1.33.1/node_modules/@aws-sdk/util-user-agent-node/dist-es/getTypeScriptUserAgentPair.js
207158
205559
  var __dirname = "/Users/work/Code/awsless/node_modules/.pnpm/@aws-sdk+util-user-agent-node@3.973.14_aws-crt@1.33.1/node_modules/@aws-sdk/util-user-agent-node/dist-es";
207159
205560
  var tscVersion;
207160
- var TS_PACKAGE_JSON = join57("node_modules", "typescript", "package.json");
205561
+ var TS_PACKAGE_JSON = join55("node_modules", "typescript", "package.json");
207161
205562
  var getTypeScriptUserAgentPair = async () => {
207162
205563
  if (tscVersion === null) {
207163
205564
  return;
@@ -207172,12 +205573,12 @@ var getTypeScriptUserAgentPair = async () => {
207172
205573
  tscVersion = null;
207173
205574
  return;
207174
205575
  }
207175
- const dirname28 = typeof __dirname !== "undefined" ? __dirname : undefined;
207176
- const nodeModulesParentDirs = getNodeModulesParentDirs(dirname28);
205576
+ const dirname27 = typeof __dirname !== "undefined" ? __dirname : undefined;
205577
+ const nodeModulesParentDirs = getNodeModulesParentDirs(dirname27);
207177
205578
  let versionFromApp;
207178
205579
  for (const nodeModulesParentDir of nodeModulesParentDirs) {
207179
205580
  try {
207180
- const appPackageJsonPath = join57(nodeModulesParentDir, "package.json");
205581
+ const appPackageJsonPath = join55(nodeModulesParentDir, "package.json");
207181
205582
  const packageJson = await readFile23(appPackageJsonPath, "utf-8");
207182
205583
  const { dependencies, devDependencies } = JSON.parse(packageJson);
207183
205584
  const version4 = devDependencies?.typescript ?? dependencies?.typescript;
@@ -207195,7 +205596,7 @@ var getTypeScriptUserAgentPair = async () => {
207195
205596
  let versionFromNodeModules;
207196
205597
  for (const nodeModulesParentDir of nodeModulesParentDirs) {
207197
205598
  try {
207198
- const tsPackageJsonPath = join57(nodeModulesParentDir, TS_PACKAGE_JSON);
205599
+ const tsPackageJsonPath = join55(nodeModulesParentDir, TS_PACKAGE_JSON);
207199
205600
  const packageJson = await readFile23(tsPackageJsonPath, "utf-8");
207200
205601
  const { version: version4 } = JSON.parse(packageJson);
207201
205602
  const sanitizedVersion2 = getSanitizedTypeScriptVersion(version4);
@@ -207523,7 +205924,7 @@ var setSocketTimeout = (request, reject, timeoutInMs = 0) => {
207523
205924
  };
207524
205925
 
207525
205926
  // ../../node_modules/.pnpm/@smithy+node-http-handler@4.5.1/node_modules/@smithy/node-http-handler/dist-es/write-request-body.js
207526
- import { Readable as Readable3 } from "stream";
205927
+ import { Readable as Readable2 } from "stream";
207527
205928
  var MIN_WAIT_TIME = 6000;
207528
205929
  async function writeRequestBody(httpRequest3, request, maxContinueTimeoutMs = MIN_WAIT_TIME, externalAgent = false) {
207529
205930
  const headers = request.headers ?? {};
@@ -207532,21 +205933,21 @@ async function writeRequestBody(httpRequest3, request, maxContinueTimeoutMs = MI
207532
205933
  let sendBody = true;
207533
205934
  if (!externalAgent && expect === "100-continue") {
207534
205935
  sendBody = await Promise.race([
207535
- new Promise((resolve7) => {
207536
- timeoutId = Number(timing.setTimeout(() => resolve7(true), Math.max(MIN_WAIT_TIME, maxContinueTimeoutMs)));
205936
+ new Promise((resolve5) => {
205937
+ timeoutId = Number(timing.setTimeout(() => resolve5(true), Math.max(MIN_WAIT_TIME, maxContinueTimeoutMs)));
207537
205938
  }),
207538
- new Promise((resolve7) => {
205939
+ new Promise((resolve5) => {
207539
205940
  httpRequest3.on("continue", () => {
207540
205941
  timing.clearTimeout(timeoutId);
207541
- resolve7(true);
205942
+ resolve5(true);
207542
205943
  });
207543
205944
  httpRequest3.on("response", () => {
207544
205945
  timing.clearTimeout(timeoutId);
207545
- resolve7(false);
205946
+ resolve5(false);
207546
205947
  });
207547
205948
  httpRequest3.on("error", () => {
207548
205949
  timing.clearTimeout(timeoutId);
207549
- resolve7(false);
205950
+ resolve5(false);
207550
205951
  });
207551
205952
  })
207552
205953
  ]);
@@ -207556,7 +205957,7 @@ async function writeRequestBody(httpRequest3, request, maxContinueTimeoutMs = MI
207556
205957
  }
207557
205958
  }
207558
205959
  function writeBody(httpRequest3, body) {
207559
- if (body instanceof Readable3) {
205960
+ if (body instanceof Readable2) {
207560
205961
  body.pipe(httpRequest3);
207561
205962
  return;
207562
205963
  }
@@ -207622,13 +206023,13 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
207622
206023
  return socketWarningTimestamp;
207623
206024
  }
207624
206025
  constructor(options) {
207625
- this.configProvider = new Promise((resolve7, reject) => {
206026
+ this.configProvider = new Promise((resolve5, reject) => {
207626
206027
  if (typeof options === "function") {
207627
206028
  options().then((_options) => {
207628
- resolve7(this.resolveDefaultConfig(_options));
206029
+ resolve5(this.resolveDefaultConfig(_options));
207629
206030
  }).catch(reject);
207630
206031
  } else {
207631
- resolve7(this.resolveDefaultConfig(options));
206032
+ resolve5(this.resolveDefaultConfig(options));
207632
206033
  }
207633
206034
  });
207634
206035
  }
@@ -207648,7 +206049,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
207648
206049
  return new Promise((_resolve, _reject) => {
207649
206050
  let writeRequestBodyPromise = undefined;
207650
206051
  const timeouts = [];
207651
- const resolve7 = async (arg) => {
206052
+ const resolve5 = async (arg) => {
207652
206053
  await writeRequestBodyPromise;
207653
206054
  timeouts.forEach(timing.clearTimeout);
207654
206055
  _resolve(arg);
@@ -207712,7 +206113,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
207712
206113
  headers: getTransformedHeaders(res.headers),
207713
206114
  body: res
207714
206115
  });
207715
- resolve7({ response: httpResponse });
206116
+ resolve5({ response: httpResponse });
207716
206117
  });
207717
206118
  req.on("error", (err) => {
207718
206119
  if (NODEJS_TIMEOUT_ERROR_CODES2.includes(err.code)) {
@@ -207812,7 +206213,7 @@ var streamCollector4 = (stream) => {
207812
206213
  if (isReadableStreamInstance(stream)) {
207813
206214
  return collectReadableStream(stream);
207814
206215
  }
207815
- return new Promise((resolve7, reject) => {
206216
+ return new Promise((resolve5, reject) => {
207816
206217
  const collector = new Collector;
207817
206218
  stream.pipe(collector);
207818
206219
  stream.on("error", (err) => {
@@ -207822,7 +206223,7 @@ var streamCollector4 = (stream) => {
207822
206223
  collector.on("error", reject);
207823
206224
  collector.on("finish", function() {
207824
206225
  const bytes2 = new Uint8Array(Buffer.concat(this.bufferedBytes));
207825
- resolve7(bytes2);
206226
+ resolve5(bytes2);
207826
206227
  });
207827
206228
  });
207828
206229
  };
@@ -210354,7 +208755,7 @@ var sinon;
210354
208755
  const arraySlice = arrayProto.slice;
210355
208756
  const concat = arrayProto.concat;
210356
208757
  const forEach = arrayProto.forEach;
210357
- const join58 = arrayProto.join;
208758
+ const join56 = arrayProto.join;
210358
208759
  const splice = arrayProto.splice;
210359
208760
  function applyDefaults(obj, defaults2) {
210360
208761
  for (const key of Object.keys(defaults2)) {
@@ -210390,7 +208791,7 @@ var sinon;
210390
208791
  let actual = "";
210391
208792
  if (!calledInOrder(arguments)) {
210392
208793
  try {
210393
- expected = join58(arguments, ", ");
208794
+ expected = join56(arguments, ", ");
210394
208795
  const calls = arraySlice(arguments);
210395
208796
  let i6 = calls.length;
210396
208797
  while (i6) {
@@ -210398,7 +208799,7 @@ var sinon;
210398
208799
  splice(calls, i6, 1);
210399
208800
  }
210400
208801
  }
210401
- actual = join58(orderByFirstCall(calls), ", ");
208802
+ actual = join56(orderByFirstCall(calls), ", ");
210402
208803
  } catch (e7) {}
210403
208804
  failAssertion(this, `expected ${expected} to be called in order but were called as ${actual}`);
210404
208805
  } else {
@@ -210443,7 +208844,7 @@ var sinon;
210443
208844
  ` expected = ${inspect(expectation)}`,
210444
208845
  ` actual = ${inspect(actual)}`
210445
208846
  ];
210446
- failAssertion(this, join58(formatted, `
208847
+ failAssertion(this, join56(formatted, `
210447
208848
  `));
210448
208849
  }
210449
208850
  }
@@ -210548,7 +208949,7 @@ var sinon;
210548
208949
  const valueToString = require2("@sinonjs/commons").valueToString;
210549
208950
  const exportAsyncBehaviors = require2("./util/core/export-async-behaviors");
210550
208951
  const concat = arrayProto.concat;
210551
- const join58 = arrayProto.join;
208952
+ const join56 = arrayProto.join;
210552
208953
  const reverse = arrayProto.reverse;
210553
208954
  const slice = arrayProto.slice;
210554
208955
  const useLeftMostCallback = -1;
@@ -210585,7 +208986,7 @@ var sinon;
210585
208986
  msg = `${functionName(behavior.stub)} expected to yield, but no callback was passed.`;
210586
208987
  }
210587
208988
  if (args.length > 0) {
210588
- msg += ` Received [${join58(args, ", ")}]`;
208989
+ msg += ` Received [${join56(args, ", ")}]`;
210589
208990
  }
210590
208991
  return msg;
210591
208992
  }
@@ -211395,7 +209796,7 @@ var sinon;
211395
209796
  const filter2 = arrayProto.filter;
211396
209797
  const forEach = arrayProto.forEach;
211397
209798
  const every = arrayProto.every;
211398
- const join58 = arrayProto.join;
209799
+ const join56 = arrayProto.join;
211399
209800
  const push = arrayProto.push;
211400
209801
  const slice = arrayProto.slice;
211401
209802
  const unshift = arrayProto.unshift;
@@ -211472,10 +209873,10 @@ var sinon;
211472
209873
  });
211473
209874
  this.restore();
211474
209875
  if (messages.length > 0) {
211475
- mockExpectation.fail(join58(concat(messages, met), `
209876
+ mockExpectation.fail(join56(concat(messages, met), `
211476
209877
  `));
211477
209878
  } else if (met.length > 0) {
211478
- mockExpectation.pass(join58(concat(messages, met), `
209879
+ mockExpectation.pass(join56(concat(messages, met), `
211479
209880
  `));
211480
209881
  }
211481
209882
  return true;
@@ -211528,7 +209929,7 @@ var sinon;
211528
209929
  args,
211529
209930
  stack: err.stack
211530
209931
  })}`);
211531
- mockExpectation.fail(join58(messages, `
209932
+ mockExpectation.fail(join56(messages, `
211532
209933
  `));
211533
209934
  }
211534
209935
  });
@@ -211572,8 +209973,8 @@ var sinon;
211572
209973
  };
211573
209974
  sinonPromise.reject = function(reason) {
211574
209975
  finalize2(STATUS_REJECTED, reason, fakeExecutor.firstCall.args[1]);
211575
- return new Promise(function(resolve7) {
211576
- sinonPromise.catch(() => resolve7());
209976
+ return new Promise(function(resolve5) {
209977
+ sinonPromise.catch(() => resolve5());
211577
209978
  });
211578
209979
  };
211579
209980
  return sinonPromise;
@@ -211635,14 +210036,14 @@ var sinon;
211635
210036
  const valueToString = require2("@sinonjs/commons").valueToString;
211636
210037
  const concat = arrayProto.concat;
211637
210038
  const filter2 = arrayProto.filter;
211638
- const join58 = arrayProto.join;
210039
+ const join56 = arrayProto.join;
211639
210040
  const map2 = arrayProto.map;
211640
210041
  const reduce = arrayProto.reduce;
211641
210042
  const slice = arrayProto.slice;
211642
210043
  function throwYieldError(proxy, text, args) {
211643
210044
  let msg = functionName(proxy) + text;
211644
210045
  if (args.length) {
211645
- msg += ` Received [${join58(slice(args), ", ")}]`;
210046
+ msg += ` Received [${join56(slice(args), ", ")}]`;
211646
210047
  }
211647
210048
  throw new Error(msg);
211648
210049
  }
@@ -211764,7 +210165,7 @@ var sinon;
211764
210165
  const formattedArgs = map2(this.args, function(arg) {
211765
210166
  return inspect(arg);
211766
210167
  });
211767
- callStr = `${callStr + join58(formattedArgs, ", ")})`;
210168
+ callStr = `${callStr + join56(formattedArgs, ", ")})`;
211768
210169
  if (typeof this.returnValue !== "undefined") {
211769
210170
  callStr += ` => ${inspect(this.returnValue)}`;
211770
210171
  }
@@ -212495,7 +210896,7 @@ var sinon;
212495
210896
  const timesInWords = require2("./util/core/times-in-words");
212496
210897
  const inspect = require2("util").inspect;
212497
210898
  const jsDiff = require2("diff");
212498
- const join58 = arrayProto.join;
210899
+ const join56 = arrayProto.join;
212499
210900
  const map2 = arrayProto.map;
212500
210901
  const push = arrayProto.push;
212501
210902
  const slice = arrayProto.slice;
@@ -212523,7 +210924,7 @@ var sinon;
212523
210924
  }
212524
210925
  return text;
212525
210926
  });
212526
- return join58(objects, "");
210927
+ return join56(objects, "");
212527
210928
  }
212528
210929
  function quoteStringValue(value) {
212529
210930
  if (typeof value === "string") {
@@ -212581,7 +210982,7 @@ ${stringifiedCall}`;
212581
210982
  push(calls, stringifiedCall);
212582
210983
  }
212583
210984
  return calls.length > 0 ? `
212584
- ${join58(calls, `
210985
+ ${join56(calls, `
212585
210986
  `)}` : "";
212586
210987
  },
212587
210988
  t: function(spyInstance) {
@@ -212589,10 +210990,10 @@ ${join58(calls, `
212589
210990
  for (let i6 = 0, l5 = spyInstance.callCount;i6 < l5; ++i6) {
212590
210991
  push(objects, inspect(spyInstance.thisValues[i6]));
212591
210992
  }
212592
- return join58(objects, ", ");
210993
+ return join56(objects, ", ");
212593
210994
  },
212594
210995
  "*": function(spyInstance, args) {
212595
- return join58(map2(args, function(arg) {
210996
+ return join56(map2(args, function(arg) {
212596
210997
  return inspect(arg);
212597
210998
  }), ", ");
212598
210999
  }
@@ -212924,7 +211325,7 @@ ${join58(calls, `
212924
211325
  }, { "@sinonjs/commons": 48 }], 26: [function(require2, module, exports) {
212925
211326
  const arrayProto = require2("@sinonjs/commons").prototypes.array;
212926
211327
  const hasOwnProperty2 = require2("@sinonjs/commons").prototypes.object.hasOwnProperty;
212927
- const join58 = arrayProto.join;
211328
+ const join56 = arrayProto.join;
212928
211329
  const push = arrayProto.push;
212929
211330
  const hasDontEnumBug = function() {
212930
211331
  const obj = {
@@ -212965,7 +211366,7 @@ ${join58(calls, `
212965
211366
  push(result, obj[prop]());
212966
211367
  }
212967
211368
  }
212968
- return join58(result, "") !== "0123456789";
211369
+ return join56(result, "") !== "0123456789";
212969
211370
  }();
212970
211371
  function extendCommon(target2, sources, doCopy) {
212971
211372
  let source, i6, prop;
@@ -214199,9 +212600,9 @@ ${job.error.stack.split(`
214199
212600
  };
214200
212601
  if (typeof _global.Promise !== "undefined" && utilPromisify) {
214201
212602
  clock.setTimeout[utilPromisify.custom] = function promisifiedSetTimeout(timeout, arg) {
214202
- return new _global.Promise(function setTimeoutExecutor(resolve7) {
212603
+ return new _global.Promise(function setTimeoutExecutor(resolve5) {
214203
212604
  addTimer(clock, {
214204
- func: resolve7,
212605
+ func: resolve5,
214205
212606
  args: [arg],
214206
212607
  delay: timeout
214207
212608
  });
@@ -214243,9 +212644,9 @@ ${job.error.stack.split(`
214243
212644
  };
214244
212645
  if (typeof _global.Promise !== "undefined" && utilPromisify) {
214245
212646
  clock.setImmediate[utilPromisify.custom] = function promisifiedSetImmediate(arg) {
214246
- return new _global.Promise(function setImmediateExecutor(resolve7) {
212647
+ return new _global.Promise(function setImmediateExecutor(resolve5) {
214247
212648
  addTimer(clock, {
214248
- func: resolve7,
212649
+ func: resolve5,
214249
212650
  args: [arg],
214250
212651
  immediate: true
214251
212652
  });
@@ -214276,7 +212677,7 @@ ${job.error.stack.split(`
214276
212677
  clock.runMicrotasks = function runMicrotasks() {
214277
212678
  runJobs(clock);
214278
212679
  };
214279
- function doTick(tickValue, isAsync, resolve7, reject) {
212680
+ function doTick(tickValue, isAsync, resolve5, reject) {
214280
212681
  const msFloat = typeof tickValue === "number" ? tickValue : parseTime(tickValue);
214281
212682
  const ms2 = Math.floor(msFloat);
214282
212683
  const remainder = nanoRemainder(msFloat);
@@ -214343,7 +212744,7 @@ ${job.error.stack.split(`
214343
212744
  throw firstException;
214344
212745
  }
214345
212746
  if (isAsync) {
214346
- resolve7(clock.now);
212747
+ resolve5(clock.now);
214347
212748
  } else {
214348
212749
  return clock.now;
214349
212750
  }
@@ -214375,10 +212776,10 @@ ${job.error.stack.split(`
214375
212776
  };
214376
212777
  if (typeof _global.Promise !== "undefined") {
214377
212778
  clock.tickAsync = function tickAsync(tickValue) {
214378
- return new _global.Promise(function(resolve7, reject) {
212779
+ return new _global.Promise(function(resolve5, reject) {
214379
212780
  originalSetTimeout(function() {
214380
212781
  try {
214381
- doTick(tickValue, true, resolve7, reject);
212782
+ doTick(tickValue, true, resolve5, reject);
214382
212783
  } catch (e7) {
214383
212784
  reject(e7);
214384
212785
  }
@@ -214404,12 +212805,12 @@ ${job.error.stack.split(`
214404
212805
  };
214405
212806
  if (typeof _global.Promise !== "undefined") {
214406
212807
  clock.nextAsync = function nextAsync() {
214407
- return new _global.Promise(function(resolve7, reject) {
212808
+ return new _global.Promise(function(resolve5, reject) {
214408
212809
  originalSetTimeout(function() {
214409
212810
  try {
214410
212811
  const timer = firstTimer(clock);
214411
212812
  if (!timer) {
214412
- resolve7(clock.now);
212813
+ resolve5(clock.now);
214413
212814
  return;
214414
212815
  }
214415
212816
  let err;
@@ -214425,7 +212826,7 @@ ${job.error.stack.split(`
214425
212826
  if (err) {
214426
212827
  reject(err);
214427
212828
  } else {
214428
- resolve7(clock.now);
212829
+ resolve5(clock.now);
214429
212830
  }
214430
212831
  });
214431
212832
  } catch (e7) {
@@ -214459,7 +212860,7 @@ ${job.error.stack.split(`
214459
212860
  };
214460
212861
  if (typeof _global.Promise !== "undefined") {
214461
212862
  clock.runAllAsync = function runAllAsync() {
214462
- return new _global.Promise(function(resolve7, reject) {
212863
+ return new _global.Promise(function(resolve5, reject) {
214463
212864
  let i6 = 0;
214464
212865
  function doRun() {
214465
212866
  originalSetTimeout(function() {
@@ -214469,13 +212870,13 @@ ${job.error.stack.split(`
214469
212870
  if (i6 < clock.loopLimit) {
214470
212871
  if (!clock.timers) {
214471
212872
  resetIsNearInfiniteLimit();
214472
- resolve7(clock.now);
212873
+ resolve5(clock.now);
214473
212874
  return;
214474
212875
  }
214475
212876
  numTimers = Object.keys(clock.timers).length;
214476
212877
  if (numTimers === 0) {
214477
212878
  resetIsNearInfiniteLimit();
214478
- resolve7(clock.now);
212879
+ resolve5(clock.now);
214479
212880
  return;
214480
212881
  }
214481
212882
  clock.next();
@@ -214505,15 +212906,15 @@ ${job.error.stack.split(`
214505
212906
  };
214506
212907
  if (typeof _global.Promise !== "undefined") {
214507
212908
  clock.runToLastAsync = function runToLastAsync() {
214508
- return new _global.Promise(function(resolve7, reject) {
212909
+ return new _global.Promise(function(resolve5, reject) {
214509
212910
  originalSetTimeout(function() {
214510
212911
  try {
214511
212912
  const timer = lastTimer(clock);
214512
212913
  if (!timer) {
214513
212914
  runJobs(clock);
214514
- resolve7(clock.now);
212915
+ resolve5(clock.now);
214515
212916
  }
214516
- resolve7(clock.tickAsync(timer.callAt - clock.now));
212917
+ resolve5(clock.tickAsync(timer.callAt - clock.now));
214517
212918
  } catch (e7) {
214518
212919
  reject(e7);
214519
212920
  }
@@ -215030,7 +213431,7 @@ ${job.error.stack.split(`
215030
213431
  module.exports = matcherPrototype;
215031
213432
  }, { "../create-matcher": 63 }], 71: [function(require2, module, exports) {
215032
213433
  var functionName = require2("@sinonjs/commons").functionName;
215033
- var join58 = require2("@sinonjs/commons").prototypes.array.join;
213434
+ var join56 = require2("@sinonjs/commons").prototypes.array.join;
215034
213435
  var map2 = require2("@sinonjs/commons").prototypes.array.map;
215035
213436
  var stringIndexOf = require2("@sinonjs/commons").prototypes.string.indexOf;
215036
213437
  var valueToString = require2("@sinonjs/commons").valueToString;
@@ -215061,7 +213462,7 @@ ${job.error.stack.split(`
215061
213462
  m5.test = function(actual) {
215062
213463
  return matchObject(actual, expectation, match3);
215063
213464
  };
215064
- m5.message = `match(${join58(array3, ", ")})`;
213465
+ m5.message = `match(${join56(array3, ", ")})`;
215065
213466
  return m5;
215066
213467
  },
215067
213468
  regexp: function(m5, expectation) {
@@ -218385,7 +216786,7 @@ ${job.error.stack.split(`
218385
216786
  tokenize: function tokenize(value) {
218386
216787
  return value.split("");
218387
216788
  },
218388
- join: function join58(chars) {
216789
+ join: function join56(chars) {
218389
216790
  return chars.join("");
218390
216791
  }
218391
216792
  };
@@ -221144,7 +219545,7 @@ ${inspect(response)}
221144
219545
  };
221145
219546
  extend2(FakeXMLHttpRequest.prototype, sinonEvent.EventTarget, {
221146
219547
  async: true,
221147
- open: function open3(method, url2, async, username, password) {
219548
+ open: function open2(method, url2, async, username, password) {
221148
219549
  this.method = method;
221149
219550
  this.url = url2;
221150
219551
  this.async = typeof async === "boolean" ? async : true;
@@ -221818,8 +220219,8 @@ ${inspect(response)}
221818
220219
  });
221819
220220
  continue;
221820
220221
  }
221821
- const open3 = it2.tryConsume("{");
221822
- if (open3) {
220222
+ const open2 = it2.tryConsume("{");
220223
+ if (open2) {
221823
220224
  tokens2.push({
221824
220225
  type: "group",
221825
220226
  tokens: consume("}")