@go-to-k/cdkd 0.74.0 → 0.75.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -4374,16 +4374,16 @@ var require_printer = __commonJS({
4374
4374
  },
4375
4375
  // Document
4376
4376
  Document: {
4377
- leave: (node) => join9(node.definitions, "\n\n")
4377
+ leave: (node) => join11(node.definitions, "\n\n")
4378
4378
  },
4379
4379
  OperationDefinition: {
4380
4380
  leave(node) {
4381
- const varDefs = hasMultilineItems(node.variableDefinitions) ? wrap("(\n", join9(node.variableDefinitions, "\n"), "\n)") : wrap("(", join9(node.variableDefinitions, ", "), ")");
4382
- const prefix = wrap("", node.description, "\n") + join9(
4381
+ const varDefs = hasMultilineItems(node.variableDefinitions) ? wrap("(\n", join11(node.variableDefinitions, "\n"), "\n)") : wrap("(", join11(node.variableDefinitions, ", "), ")");
4382
+ const prefix = wrap("", node.description, "\n") + join11(
4383
4383
  [
4384
4384
  node.operation,
4385
- join9([node.name, varDefs]),
4386
- join9(node.directives, " ")
4385
+ join11([node.name, varDefs]),
4386
+ join11(node.directives, " ")
4387
4387
  ],
4388
4388
  " "
4389
4389
  );
@@ -4391,7 +4391,7 @@ var require_printer = __commonJS({
4391
4391
  }
4392
4392
  },
4393
4393
  VariableDefinition: {
4394
- leave: ({ variable, type, defaultValue, directives, description }) => wrap("", description, "\n") + variable + ": " + type + wrap(" = ", defaultValue) + wrap(" ", join9(directives, " "))
4394
+ leave: ({ variable, type, defaultValue, directives, description }) => wrap("", description, "\n") + variable + ": " + type + wrap(" = ", defaultValue) + wrap(" ", join11(directives, " "))
4395
4395
  },
4396
4396
  SelectionSet: {
4397
4397
  leave: ({ selections }) => block(selections)
@@ -4399,11 +4399,11 @@ var require_printer = __commonJS({
4399
4399
  Field: {
4400
4400
  leave({ alias, name, arguments: args, directives, selectionSet }) {
4401
4401
  const prefix = wrap("", alias, ": ") + name;
4402
- let argsLine = prefix + wrap("(", join9(args, ", "), ")");
4402
+ let argsLine = prefix + wrap("(", join11(args, ", "), ")");
4403
4403
  if (argsLine.length > MAX_LINE_LENGTH) {
4404
- argsLine = prefix + wrap("(\n", indent(join9(args, "\n")), "\n)");
4404
+ argsLine = prefix + wrap("(\n", indent(join11(args, "\n")), "\n)");
4405
4405
  }
4406
- return join9([argsLine, join9(directives, " "), selectionSet], " ");
4406
+ return join11([argsLine, join11(directives, " "), selectionSet], " ");
4407
4407
  }
4408
4408
  },
4409
4409
  Argument: {
@@ -4411,14 +4411,14 @@ var require_printer = __commonJS({
4411
4411
  },
4412
4412
  // Fragments
4413
4413
  FragmentSpread: {
4414
- leave: ({ name, directives }) => "..." + name + wrap(" ", join9(directives, " "))
4414
+ leave: ({ name, directives }) => "..." + name + wrap(" ", join11(directives, " "))
4415
4415
  },
4416
4416
  InlineFragment: {
4417
- leave: ({ typeCondition, directives, selectionSet }) => join9(
4417
+ leave: ({ typeCondition, directives, selectionSet }) => join11(
4418
4418
  [
4419
4419
  "...",
4420
4420
  wrap("on ", typeCondition),
4421
- join9(directives, " "),
4421
+ join11(directives, " "),
4422
4422
  selectionSet
4423
4423
  ],
4424
4424
  " "
@@ -4434,7 +4434,7 @@ var require_printer = __commonJS({
4434
4434
  description
4435
4435
  }) => wrap("", description, "\n") + // Note: fragment variable definitions are experimental and may be changed
4436
4436
  // or removed in the future.
4437
- `fragment ${name}${wrap("(", join9(variableDefinitions, ", "), ")")} on ${typeCondition} ${wrap("", join9(directives, " "), " ")}` + selectionSet
4437
+ `fragment ${name}${wrap("(", join11(variableDefinitions, ", "), ")")} on ${typeCondition} ${wrap("", join11(directives, " "), " ")}` + selectionSet
4438
4438
  },
4439
4439
  // Value
4440
4440
  IntValue: {
@@ -4456,17 +4456,17 @@ var require_printer = __commonJS({
4456
4456
  leave: ({ value }) => value
4457
4457
  },
4458
4458
  ListValue: {
4459
- leave: ({ values }) => "[" + join9(values, ", ") + "]"
4459
+ leave: ({ values }) => "[" + join11(values, ", ") + "]"
4460
4460
  },
4461
4461
  ObjectValue: {
4462
- leave: ({ fields }) => "{" + join9(fields, ", ") + "}"
4462
+ leave: ({ fields }) => "{" + join11(fields, ", ") + "}"
4463
4463
  },
4464
4464
  ObjectField: {
4465
4465
  leave: ({ name, value }) => name + ": " + value
4466
4466
  },
4467
4467
  // Directive
4468
4468
  Directive: {
4469
- leave: ({ name, arguments: args }) => "@" + name + wrap("(", join9(args, ", "), ")")
4469
+ leave: ({ name, arguments: args }) => "@" + name + wrap("(", join11(args, ", "), ")")
4470
4470
  },
4471
4471
  // Type
4472
4472
  NamedType: {
@@ -4480,61 +4480,61 @@ var require_printer = __commonJS({
4480
4480
  },
4481
4481
  // Type System Definitions
4482
4482
  SchemaDefinition: {
4483
- leave: ({ description, directives, operationTypes }) => wrap("", description, "\n") + join9(["schema", join9(directives, " "), block(operationTypes)], " ")
4483
+ leave: ({ description, directives, operationTypes }) => wrap("", description, "\n") + join11(["schema", join11(directives, " "), block(operationTypes)], " ")
4484
4484
  },
4485
4485
  OperationTypeDefinition: {
4486
4486
  leave: ({ operation, type }) => operation + ": " + type
4487
4487
  },
4488
4488
  ScalarTypeDefinition: {
4489
- leave: ({ description, name, directives }) => wrap("", description, "\n") + join9(["scalar", name, join9(directives, " ")], " ")
4489
+ leave: ({ description, name, directives }) => wrap("", description, "\n") + join11(["scalar", name, join11(directives, " ")], " ")
4490
4490
  },
4491
4491
  ObjectTypeDefinition: {
4492
- leave: ({ description, name, interfaces, directives, fields }) => wrap("", description, "\n") + join9(
4492
+ leave: ({ description, name, interfaces, directives, fields }) => wrap("", description, "\n") + join11(
4493
4493
  [
4494
4494
  "type",
4495
4495
  name,
4496
- wrap("implements ", join9(interfaces, " & ")),
4497
- join9(directives, " "),
4496
+ wrap("implements ", join11(interfaces, " & ")),
4497
+ join11(directives, " "),
4498
4498
  block(fields)
4499
4499
  ],
4500
4500
  " "
4501
4501
  )
4502
4502
  },
4503
4503
  FieldDefinition: {
4504
- leave: ({ description, name, arguments: args, type, directives }) => wrap("", description, "\n") + name + (hasMultilineItems(args) ? wrap("(\n", indent(join9(args, "\n")), "\n)") : wrap("(", join9(args, ", "), ")")) + ": " + type + wrap(" ", join9(directives, " "))
4504
+ leave: ({ description, name, arguments: args, type, directives }) => wrap("", description, "\n") + name + (hasMultilineItems(args) ? wrap("(\n", indent(join11(args, "\n")), "\n)") : wrap("(", join11(args, ", "), ")")) + ": " + type + wrap(" ", join11(directives, " "))
4505
4505
  },
4506
4506
  InputValueDefinition: {
4507
- leave: ({ description, name, type, defaultValue, directives }) => wrap("", description, "\n") + join9(
4508
- [name + ": " + type, wrap("= ", defaultValue), join9(directives, " ")],
4507
+ leave: ({ description, name, type, defaultValue, directives }) => wrap("", description, "\n") + join11(
4508
+ [name + ": " + type, wrap("= ", defaultValue), join11(directives, " ")],
4509
4509
  " "
4510
4510
  )
4511
4511
  },
4512
4512
  InterfaceTypeDefinition: {
4513
- leave: ({ description, name, interfaces, directives, fields }) => wrap("", description, "\n") + join9(
4513
+ leave: ({ description, name, interfaces, directives, fields }) => wrap("", description, "\n") + join11(
4514
4514
  [
4515
4515
  "interface",
4516
4516
  name,
4517
- wrap("implements ", join9(interfaces, " & ")),
4518
- join9(directives, " "),
4517
+ wrap("implements ", join11(interfaces, " & ")),
4518
+ join11(directives, " "),
4519
4519
  block(fields)
4520
4520
  ],
4521
4521
  " "
4522
4522
  )
4523
4523
  },
4524
4524
  UnionTypeDefinition: {
4525
- leave: ({ description, name, directives, types }) => wrap("", description, "\n") + join9(
4526
- ["union", name, join9(directives, " "), wrap("= ", join9(types, " | "))],
4525
+ leave: ({ description, name, directives, types }) => wrap("", description, "\n") + join11(
4526
+ ["union", name, join11(directives, " "), wrap("= ", join11(types, " | "))],
4527
4527
  " "
4528
4528
  )
4529
4529
  },
4530
4530
  EnumTypeDefinition: {
4531
- leave: ({ description, name, directives, values }) => wrap("", description, "\n") + join9(["enum", name, join9(directives, " "), block(values)], " ")
4531
+ leave: ({ description, name, directives, values }) => wrap("", description, "\n") + join11(["enum", name, join11(directives, " "), block(values)], " ")
4532
4532
  },
4533
4533
  EnumValueDefinition: {
4534
- leave: ({ description, name, directives }) => wrap("", description, "\n") + join9([name, join9(directives, " ")], " ")
4534
+ leave: ({ description, name, directives }) => wrap("", description, "\n") + join11([name, join11(directives, " ")], " ")
4535
4535
  },
4536
4536
  InputObjectTypeDefinition: {
4537
- leave: ({ description, name, directives, fields }) => wrap("", description, "\n") + join9(["input", name, join9(directives, " "), block(fields)], " ")
4537
+ leave: ({ description, name, directives, fields }) => wrap("", description, "\n") + join11(["input", name, join11(directives, " "), block(fields)], " ")
4538
4538
  },
4539
4539
  DirectiveDefinition: {
4540
4540
  leave: ({
@@ -4544,84 +4544,84 @@ var require_printer = __commonJS({
4544
4544
  directives,
4545
4545
  repeatable,
4546
4546
  locations
4547
- }) => wrap("", description, "\n") + "directive @" + name + (hasMultilineItems(args) ? wrap("(\n", indent(join9(args, "\n")), "\n)") : wrap("(", join9(args, ", "), ")")) + wrap(" ", join9(directives, " ")) + (repeatable ? " repeatable" : "") + " on " + join9(locations, " | ")
4547
+ }) => wrap("", description, "\n") + "directive @" + name + (hasMultilineItems(args) ? wrap("(\n", indent(join11(args, "\n")), "\n)") : wrap("(", join11(args, ", "), ")")) + wrap(" ", join11(directives, " ")) + (repeatable ? " repeatable" : "") + " on " + join11(locations, " | ")
4548
4548
  },
4549
4549
  SchemaExtension: {
4550
- leave: ({ directives, operationTypes }) => join9(
4551
- ["extend schema", join9(directives, " "), block(operationTypes)],
4550
+ leave: ({ directives, operationTypes }) => join11(
4551
+ ["extend schema", join11(directives, " "), block(operationTypes)],
4552
4552
  " "
4553
4553
  )
4554
4554
  },
4555
4555
  ScalarTypeExtension: {
4556
- leave: ({ name, directives }) => join9(["extend scalar", name, join9(directives, " ")], " ")
4556
+ leave: ({ name, directives }) => join11(["extend scalar", name, join11(directives, " ")], " ")
4557
4557
  },
4558
4558
  ObjectTypeExtension: {
4559
- leave: ({ name, interfaces, directives, fields }) => join9(
4559
+ leave: ({ name, interfaces, directives, fields }) => join11(
4560
4560
  [
4561
4561
  "extend type",
4562
4562
  name,
4563
- wrap("implements ", join9(interfaces, " & ")),
4564
- join9(directives, " "),
4563
+ wrap("implements ", join11(interfaces, " & ")),
4564
+ join11(directives, " "),
4565
4565
  block(fields)
4566
4566
  ],
4567
4567
  " "
4568
4568
  )
4569
4569
  },
4570
4570
  InterfaceTypeExtension: {
4571
- leave: ({ name, interfaces, directives, fields }) => join9(
4571
+ leave: ({ name, interfaces, directives, fields }) => join11(
4572
4572
  [
4573
4573
  "extend interface",
4574
4574
  name,
4575
- wrap("implements ", join9(interfaces, " & ")),
4576
- join9(directives, " "),
4575
+ wrap("implements ", join11(interfaces, " & ")),
4576
+ join11(directives, " "),
4577
4577
  block(fields)
4578
4578
  ],
4579
4579
  " "
4580
4580
  )
4581
4581
  },
4582
4582
  UnionTypeExtension: {
4583
- leave: ({ name, directives, types }) => join9(
4583
+ leave: ({ name, directives, types }) => join11(
4584
4584
  [
4585
4585
  "extend union",
4586
4586
  name,
4587
- join9(directives, " "),
4588
- wrap("= ", join9(types, " | "))
4587
+ join11(directives, " "),
4588
+ wrap("= ", join11(types, " | "))
4589
4589
  ],
4590
4590
  " "
4591
4591
  )
4592
4592
  },
4593
4593
  EnumTypeExtension: {
4594
- leave: ({ name, directives, values }) => join9(["extend enum", name, join9(directives, " "), block(values)], " ")
4594
+ leave: ({ name, directives, values }) => join11(["extend enum", name, join11(directives, " "), block(values)], " ")
4595
4595
  },
4596
4596
  InputObjectTypeExtension: {
4597
- leave: ({ name, directives, fields }) => join9(["extend input", name, join9(directives, " "), block(fields)], " ")
4597
+ leave: ({ name, directives, fields }) => join11(["extend input", name, join11(directives, " "), block(fields)], " ")
4598
4598
  },
4599
4599
  DirectiveExtension: {
4600
- leave: ({ name, directives }) => join9(["extend directive @" + name, join9(directives, " ")], " ")
4600
+ leave: ({ name, directives }) => join11(["extend directive @" + name, join11(directives, " ")], " ")
4601
4601
  },
4602
4602
  // Schema Coordinates
4603
4603
  TypeCoordinate: {
4604
4604
  leave: ({ name }) => name
4605
4605
  },
4606
4606
  MemberCoordinate: {
4607
- leave: ({ name, memberName }) => join9([name, wrap(".", memberName)])
4607
+ leave: ({ name, memberName }) => join11([name, wrap(".", memberName)])
4608
4608
  },
4609
4609
  ArgumentCoordinate: {
4610
- leave: ({ name, fieldName, argumentName }) => join9([name, wrap(".", fieldName), wrap("(", argumentName, ":)")])
4610
+ leave: ({ name, fieldName, argumentName }) => join11([name, wrap(".", fieldName), wrap("(", argumentName, ":)")])
4611
4611
  },
4612
4612
  DirectiveCoordinate: {
4613
- leave: ({ name }) => join9(["@", name])
4613
+ leave: ({ name }) => join11(["@", name])
4614
4614
  },
4615
4615
  DirectiveArgumentCoordinate: {
4616
- leave: ({ name, argumentName }) => join9(["@", name, wrap("(", argumentName, ":)")])
4616
+ leave: ({ name, argumentName }) => join11(["@", name, wrap("(", argumentName, ":)")])
4617
4617
  }
4618
4618
  };
4619
- function join9(maybeArray, separator = "") {
4619
+ function join11(maybeArray, separator = "") {
4620
4620
  var _maybeArray$filter$jo;
4621
4621
  return (_maybeArray$filter$jo = maybeArray === null || maybeArray === void 0 ? void 0 : maybeArray.filter((x) => x).join(separator)) !== null && _maybeArray$filter$jo !== void 0 ? _maybeArray$filter$jo : "";
4622
4622
  }
4623
4623
  function block(array) {
4624
- return wrap("{\n", indent(join9(array, "\n")), "\n}");
4624
+ return wrap("{\n", indent(join11(array, "\n")), "\n}");
4625
4625
  }
4626
4626
  function wrap(start, maybeString, end = "") {
4627
4627
  return maybeString != null && maybeString !== "" ? start + maybeString + end : "";
@@ -12448,7 +12448,7 @@ var require_graphql = __commonJS({
12448
12448
  var _validate2 = require_validate2();
12449
12449
  var _execute = require_execute();
12450
12450
  function graphql(args) {
12451
- return new Promise((resolve6) => resolve6(graphqlImpl(args)));
12451
+ return new Promise((resolve8) => resolve8(graphqlImpl(args)));
12452
12452
  }
12453
12453
  function graphqlSync(args) {
12454
12454
  const result = graphqlImpl(args);
@@ -18869,7 +18869,7 @@ var IntrinsicFunctionResolver = class {
18869
18869
  this.logger.debug(
18870
18870
  `VPC ${physicalId} IPv6 CIDR still associating (attempt ${attempt}/${maxAttempts}), waiting...`
18871
18871
  );
18872
- await new Promise((resolve6) => setTimeout(resolve6, 2e3));
18872
+ await new Promise((resolve8) => setTimeout(resolve8, 2e3));
18873
18873
  }
18874
18874
  this.logger.warn(
18875
18875
  `VPC ${physicalId} IPv6 CIDR did not reach 'associated' state after ${maxAttempts} attempts`
@@ -19754,7 +19754,7 @@ var DagExecutor = class {
19754
19754
  async execute(concurrency, fn, cancelled = () => false) {
19755
19755
  let active = 0;
19756
19756
  const errors = [];
19757
- return new Promise((resolve6, reject) => {
19757
+ return new Promise((resolve8, reject) => {
19758
19758
  const dispatch = () => {
19759
19759
  let changed = true;
19760
19760
  while (changed) {
@@ -19816,7 +19816,7 @@ var DagExecutor = class {
19816
19816
  );
19817
19817
  return;
19818
19818
  }
19819
- resolve6();
19819
+ resolve8();
19820
19820
  }
19821
19821
  };
19822
19822
  dispatch();
@@ -20497,7 +20497,7 @@ Error: ${err.message || "Unknown error"}`,
20497
20497
  * Sleep for specified milliseconds
20498
20498
  */
20499
20499
  sleep(ms) {
20500
- return new Promise((resolve6) => setTimeout(resolve6, ms));
20500
+ return new Promise((resolve8) => setTimeout(resolve8, ms));
20501
20501
  }
20502
20502
  /**
20503
20503
  * Check if a resource type is supported by Cloud Control API
@@ -21231,7 +21231,7 @@ var CustomResourceProvider = class _CustomResourceProvider {
21231
21231
  return result;
21232
21232
  }
21233
21233
  sleep(ms) {
21234
- return new Promise((resolve6) => setTimeout(resolve6, ms));
21234
+ return new Promise((resolve8) => setTimeout(resolve8, ms));
21235
21235
  }
21236
21236
  /**
21237
21237
  * Adopt an existing custom resource into cdkd state.
@@ -21661,7 +21661,7 @@ function isRetryableTransientError(error, message) {
21661
21661
  }
21662
21662
 
21663
21663
  // src/deployment/retry.ts
21664
- var defaultSleep = (ms) => new Promise((resolve6) => setTimeout(resolve6, ms));
21664
+ var defaultSleep = (ms) => new Promise((resolve8) => setTimeout(resolve8, ms));
21665
21665
  async function withRetry(operation, logicalId, opts = {}) {
21666
21666
  const maxRetries = opts.maxRetries ?? 8;
21667
21667
  const initialDelayMs = opts.initialDelayMs ?? 1e3;
@@ -21716,7 +21716,7 @@ function validateOptions(opts) {
21716
21716
  async function withResourceDeadline(operation, opts) {
21717
21717
  validateOptions(opts);
21718
21718
  const startedAt = Date.now();
21719
- return new Promise((resolve6, reject) => {
21719
+ return new Promise((resolve8, reject) => {
21720
21720
  let settled = false;
21721
21721
  let warnTimer;
21722
21722
  let timeoutTimer;
@@ -21756,7 +21756,7 @@ async function withResourceDeadline(operation, opts) {
21756
21756
  return;
21757
21757
  settled = true;
21758
21758
  cleanup();
21759
- resolve6(value);
21759
+ resolve8(value);
21760
21760
  },
21761
21761
  (err) => {
21762
21762
  if (settled)
@@ -23791,7 +23791,7 @@ var AppExecutor = class {
23791
23791
  * Spawn subprocess and wait for completion
23792
23792
  */
23793
23793
  spawn(commandLine, env) {
23794
- return new Promise((resolve6, reject) => {
23794
+ return new Promise((resolve8, reject) => {
23795
23795
  const proc = spawn(commandLine, {
23796
23796
  stdio: ["ignore", "pipe", "pipe"],
23797
23797
  shell: true,
@@ -23817,7 +23817,7 @@ var AppExecutor = class {
23817
23817
  });
23818
23818
  proc.on("close", (code) => {
23819
23819
  if (code === 0) {
23820
- resolve6();
23820
+ resolve8();
23821
23821
  } else {
23822
23822
  const stderr = stderrChunks.join("\n");
23823
23823
  reject(
@@ -25323,14 +25323,14 @@ var FileAssetPublisher = class {
25323
25323
  * Upload a single file to S3
25324
25324
  */
25325
25325
  async uploadFile(client, filePath, bucket, key) {
25326
- const stat = statSync2(filePath);
25326
+ const stat4 = statSync2(filePath);
25327
25327
  const stream = createReadStream(filePath);
25328
25328
  await client.send(
25329
25329
  new PutObjectCommand2({
25330
25330
  Bucket: bucket,
25331
25331
  Key: key,
25332
25332
  Body: stream,
25333
- ContentLength: stat.size
25333
+ ContentLength: stat4.size
25334
25334
  })
25335
25335
  );
25336
25336
  }
@@ -25339,14 +25339,14 @@ var FileAssetPublisher = class {
25339
25339
  */
25340
25340
  async uploadZip(client, dirPath, bucket, key) {
25341
25341
  const archiver = await import("archiver");
25342
- const body = await new Promise((resolve6, reject) => {
25342
+ const body = await new Promise((resolve8, reject) => {
25343
25343
  const chunks = [];
25344
25344
  const archive = archiver.default("zip", { zlib: { level: 9 } });
25345
25345
  archive.on("data", (chunk) => chunks.push(chunk));
25346
- archive.on("end", () => resolve6(Buffer.concat(chunks)));
25346
+ archive.on("end", () => resolve8(Buffer.concat(chunks)));
25347
25347
  archive.on("error", reject);
25348
- const stat = statSync2(dirPath);
25349
- if (stat.isDirectory()) {
25348
+ const stat4 = statSync2(dirPath);
25349
+ if (stat4.isDirectory()) {
25350
25350
  archive.directory(dirPath, false);
25351
25351
  } else {
25352
25352
  archive.file(dirPath, { name: basename(dirPath) });
@@ -25528,7 +25528,7 @@ var DockerAssetPublisher = class {
25528
25528
  const token = Buffer.from(authData.authorizationToken, "base64").toString();
25529
25529
  const [username, password] = token.split(":");
25530
25530
  const endpoint = authData.proxyEndpoint || `https://${accountId}.dkr.ecr.${region}.amazonaws.com`;
25531
- await new Promise((resolve6, reject) => {
25531
+ await new Promise((resolve8, reject) => {
25532
25532
  const proc = spawn2(
25533
25533
  "docker",
25534
25534
  ["login", "--username", username, "--password-stdin", endpoint],
@@ -25542,7 +25542,7 @@ var DockerAssetPublisher = class {
25542
25542
  });
25543
25543
  proc.on("close", (code) => {
25544
25544
  if (code === 0) {
25545
- resolve6();
25545
+ resolve8();
25546
25546
  } else {
25547
25547
  reject(new AssetError(`ECR login failed: ${stderr.trim()}`));
25548
25548
  }
@@ -25595,7 +25595,7 @@ var WorkGraph = class {
25595
25595
  async execute(concurrency, fn) {
25596
25596
  const active = { "asset-build": 0, "asset-publish": 0, stack: 0 };
25597
25597
  const errors = [];
25598
- return new Promise((resolve6, reject) => {
25598
+ return new Promise((resolve8, reject) => {
25599
25599
  const dispatch = () => {
25600
25600
  const ready = [];
25601
25601
  for (const node of this.nodes.values()) {
@@ -25667,7 +25667,7 @@ ${msg}`
25667
25667
  );
25668
25668
  return;
25669
25669
  }
25670
- resolve6();
25670
+ resolve8();
25671
25671
  }
25672
25672
  };
25673
25673
  dispatch();
@@ -26658,7 +26658,7 @@ var LockManager = class {
26658
26658
  this.logger.info(
26659
26659
  `Stack '${stackName}' (${region}) is locked by ${lockInfo2.owner}${lockInfo2.operation ? ` (operation: ${lockInfo2.operation})` : ""}. Lock expires in ${this.formatDuration(remainingMs)}. Retrying in ${this.formatDuration(retryDelay)}... (attempt ${attempt + 1}/${maxRetries})`
26660
26660
  );
26661
- await new Promise((resolve6) => setTimeout(resolve6, retryDelay));
26661
+ await new Promise((resolve8) => setTimeout(resolve8, retryDelay));
26662
26662
  continue;
26663
26663
  }
26664
26664
  }
@@ -28356,8 +28356,8 @@ var IAMRoleProvider = class {
28356
28356
  const statePolicies = properties?.["Policies"] ?? [];
28357
28357
  const remaining = new Set(bodies.keys());
28358
28358
  const inline = [];
28359
- for (const sp of statePolicies) {
28360
- const name = sp?.PolicyName;
28359
+ for (const sp3 of statePolicies) {
28360
+ const name = sp3?.PolicyName;
28361
28361
  if (typeof name !== "string")
28362
28362
  continue;
28363
28363
  if (bodies.has(name)) {
@@ -30439,8 +30439,8 @@ var IAMUserGroupProvider = class {
30439
30439
  );
30440
30440
  const remaining = new Set(bodies.keys());
30441
30441
  const inline = [];
30442
- for (const sp of statePolicies) {
30443
- const name = sp?.PolicyName;
30442
+ for (const sp3 of statePolicies) {
30443
+ const name = sp3?.PolicyName;
30444
30444
  if (typeof name !== "string")
30445
30445
  continue;
30446
30446
  if (bodies.has(name)) {
@@ -30703,7 +30703,7 @@ var S3BucketProvider = class {
30703
30703
  * are equal, we skip the call entirely.
30704
30704
  */
30705
30705
  async applyTagDiff(bucketName, oldTagsRaw, newTagsRaw) {
30706
- const normalize = (tags) => {
30706
+ const normalize2 = (tags) => {
30707
30707
  const out = [];
30708
30708
  for (const t of tags ?? []) {
30709
30709
  if (t.Key !== void 0 && t.Value !== void 0)
@@ -30711,8 +30711,8 @@ var S3BucketProvider = class {
30711
30711
  }
30712
30712
  return out;
30713
30713
  };
30714
- const oldNorm = normalize(oldTagsRaw);
30715
- const newNorm = normalize(newTagsRaw);
30714
+ const oldNorm = normalize2(oldTagsRaw);
30715
+ const newNorm = normalize2(newTagsRaw);
30716
30716
  if (JSON.stringify(oldNorm) === JSON.stringify(newNorm))
30717
30717
  return;
30718
30718
  if (newNorm.length === 0) {
@@ -35152,7 +35152,7 @@ var LambdaFunctionProvider = class {
35152
35152
  return enis;
35153
35153
  }
35154
35154
  sleep(ms) {
35155
- return new Promise((resolve6) => setTimeout(resolve6, ms));
35155
+ return new Promise((resolve8) => setTimeout(resolve8, ms));
35156
35156
  }
35157
35157
  /**
35158
35158
  * Build Lambda Code parameter from CDK properties
@@ -37029,7 +37029,7 @@ var DynamoDBTableProvider = class {
37029
37029
  if (status !== "CREATING") {
37030
37030
  throw new Error(`Unexpected table status: ${status}`);
37031
37031
  }
37032
- await new Promise((resolve6) => setTimeout(resolve6, 1e3));
37032
+ await new Promise((resolve8) => setTimeout(resolve8, 1e3));
37033
37033
  }
37034
37034
  throw new Error(`Table ${tableName} did not reach ACTIVE status within ${maxAttempts} seconds`);
37035
37035
  }
@@ -37049,7 +37049,7 @@ var DynamoDBTableProvider = class {
37049
37049
  if (status === "ACTIVE") {
37050
37050
  return;
37051
37051
  }
37052
- await new Promise((resolve6) => setTimeout(resolve6, 1e3));
37052
+ await new Promise((resolve8) => setTimeout(resolve8, 1e3));
37053
37053
  }
37054
37054
  throw new Error(
37055
37055
  `Table ${tableName} did not reach ACTIVE status within ${maxAttempts} seconds after UpdateTable`
@@ -38021,17 +38021,17 @@ var CloudWatchAlarmProvider = class {
38021
38021
  if (m["Period"] !== void 0)
38022
38022
  entry["Period"] = m["Period"];
38023
38023
  if (m["MetricStat"] !== void 0) {
38024
- const stat = m["MetricStat"];
38025
- const metric = stat["Metric"];
38024
+ const stat4 = m["MetricStat"];
38025
+ const metric = stat4["Metric"];
38026
38026
  entry["MetricStat"] = {
38027
38027
  Metric: {
38028
38028
  MetricName: metric["MetricName"],
38029
38029
  Namespace: metric["Namespace"],
38030
38030
  Dimensions: metric["Dimensions"]
38031
38031
  },
38032
- Period: stat["Period"],
38033
- Stat: stat["Stat"],
38034
- Unit: stat["Unit"]
38032
+ Period: stat4["Period"],
38033
+ Stat: stat4["Stat"],
38034
+ Unit: stat4["Unit"]
38035
38035
  };
38036
38036
  }
38037
38037
  return entry;
@@ -40229,7 +40229,7 @@ var EC2Provider = class {
40229
40229
  this.logger.debug(
40230
40230
  `VPC ${physicalId} has dependencies (attempt ${attempt}/${maxAttempts}), retrying in ${attempt * 5}s...`
40231
40231
  );
40232
- await new Promise((resolve6) => setTimeout(resolve6, attempt * 5e3));
40232
+ await new Promise((resolve8) => setTimeout(resolve8, attempt * 5e3));
40233
40233
  continue;
40234
40234
  }
40235
40235
  const cause = error instanceof Error ? error : void 0;
@@ -40393,7 +40393,7 @@ var EC2Provider = class {
40393
40393
  this.logger.debug(
40394
40394
  `Subnet ${physicalId} has dependencies (attempt ${attempt}/${maxAttempts}), retrying in ${attempt * 5}s...`
40395
40395
  );
40396
- await new Promise((resolve6) => setTimeout(resolve6, attempt * 5e3));
40396
+ await new Promise((resolve8) => setTimeout(resolve8, attempt * 5e3));
40397
40397
  continue;
40398
40398
  }
40399
40399
  const cause = error instanceof Error ? error : void 0;
@@ -41151,7 +41151,7 @@ var EC2Provider = class {
41151
41151
  this.logger.debug(
41152
41152
  `SecurityGroup ${physicalId} has dependent objects (attempt ${attempt}/${maxAttempts}), retrying in ${attempt * 5}s...`
41153
41153
  );
41154
- await new Promise((resolve6) => setTimeout(resolve6, attempt * 5e3));
41154
+ await new Promise((resolve8) => setTimeout(resolve8, attempt * 5e3));
41155
41155
  continue;
41156
41156
  }
41157
41157
  const cause = error instanceof Error ? error : void 0;
@@ -42095,7 +42095,7 @@ var EC2Provider = class {
42095
42095
  * `setTimeout` globally.
42096
42096
  */
42097
42097
  sleep(ms) {
42098
- return new Promise((resolve6) => setTimeout(resolve6, ms));
42098
+ return new Promise((resolve8) => setTimeout(resolve8, ms));
42099
42099
  }
42100
42100
  /**
42101
42101
  * Check if an error indicates the resource was not found
@@ -42896,17 +42896,17 @@ function flattenIpPermissions(perms, direction) {
42896
42896
  rule["Description"] = grp.Description;
42897
42897
  out.push(rule);
42898
42898
  }
42899
- for (const pl of p.PrefixListIds ?? []) {
42899
+ for (const pl2 of p.PrefixListIds ?? []) {
42900
42900
  const rule = { ...base };
42901
42901
  if (direction === "ingress") {
42902
- if (pl.PrefixListId !== void 0)
42903
- rule["SourcePrefixListId"] = pl.PrefixListId;
42902
+ if (pl2.PrefixListId !== void 0)
42903
+ rule["SourcePrefixListId"] = pl2.PrefixListId;
42904
42904
  } else {
42905
- if (pl.PrefixListId !== void 0)
42906
- rule["DestinationPrefixListId"] = pl.PrefixListId;
42905
+ if (pl2.PrefixListId !== void 0)
42906
+ rule["DestinationPrefixListId"] = pl2.PrefixListId;
42907
42907
  }
42908
- if (pl.Description !== void 0)
42909
- rule["Description"] = pl.Description;
42908
+ if (pl2.Description !== void 0)
42909
+ rule["Description"] = pl2.Description;
42910
42910
  out.push(rule);
42911
42911
  }
42912
42912
  if ((p.IpRanges?.length ?? 0) === 0 && (p.Ipv6Ranges?.length ?? 0) === 0 && (p.UserIdGroupPairs?.length ?? 0) === 0 && (p.PrefixListIds?.length ?? 0) === 0) {
@@ -44195,7 +44195,7 @@ var ApiGatewayProvider = class _ApiGatewayProvider {
44195
44195
  * Sleep for specified milliseconds
44196
44196
  */
44197
44197
  sleep(ms) {
44198
- return new Promise((resolve6) => setTimeout(resolve6, ms));
44198
+ return new Promise((resolve8) => setTimeout(resolve8, ms));
44199
44199
  }
44200
44200
  /**
44201
44201
  * Convert CloudFormation Tags (Array<{Key, Value}>) to SDK tags (Record<string, string>).
@@ -44850,8 +44850,8 @@ var ApiGatewayV2Provider = class {
44850
44850
  async createRoute(logicalId, resourceType, properties) {
44851
44851
  this.logger.debug(`Creating API Gateway V2 Route ${logicalId}`);
44852
44852
  const apiId = properties["ApiId"];
44853
- const routeKey = properties["RouteKey"];
44854
- if (!apiId || !routeKey) {
44853
+ const routeKey2 = properties["RouteKey"];
44854
+ if (!apiId || !routeKey2) {
44855
44855
  throw new ProvisioningError(
44856
44856
  `ApiId and RouteKey are required for API Gateway V2 Route ${logicalId}`,
44857
44857
  resourceType,
@@ -44862,7 +44862,7 @@ var ApiGatewayV2Provider = class {
44862
44862
  const response = await this.getClient().send(
44863
44863
  new CreateRouteCommand2({
44864
44864
  ApiId: apiId,
44865
- RouteKey: routeKey,
44865
+ RouteKey: routeKey2,
44866
44866
  Target: properties["Target"],
44867
44867
  AuthorizationType: properties["AuthorizationType"],
44868
44868
  AuthorizerId: properties["AuthorizerId"]
@@ -46087,7 +46087,7 @@ var CloudFrontDistributionProvider = class {
46087
46087
  );
46088
46088
  const sleepEnd = Date.now() + delay2;
46089
46089
  while (Date.now() < sleepEnd && !interrupted) {
46090
- await new Promise((resolve6) => setTimeout(resolve6, 1e3));
46090
+ await new Promise((resolve8) => setTimeout(resolve8, 1e3));
46091
46091
  }
46092
46092
  delay2 = Math.min(delay2 * 1.5, maxDelay);
46093
46093
  }
@@ -49899,7 +49899,7 @@ var RDSProvider = class {
49899
49899
  throw new Error(`Timed out waiting for DBInstance ${dbInstanceIdentifier} to be deleted`);
49900
49900
  }
49901
49901
  sleep(ms) {
49902
- return new Promise((resolve6) => setTimeout(resolve6, ms));
49902
+ return new Promise((resolve8) => setTimeout(resolve8, ms));
49903
49903
  }
49904
49904
  /**
49905
49905
  * Adopt an existing RDS resource into cdkd state.
@@ -50884,7 +50884,7 @@ var DocDBProvider = class {
50884
50884
  throw new Error(`Timed out waiting for DocDB DBInstance ${dbInstanceIdentifier} to be deleted`);
50885
50885
  }
50886
50886
  sleep(ms) {
50887
- return new Promise((resolve6) => setTimeout(resolve6, ms));
50887
+ return new Promise((resolve8) => setTimeout(resolve8, ms));
50888
50888
  }
50889
50889
  /**
50890
50890
  * Adopt an existing DocDB resource into cdkd state.
@@ -51874,7 +51874,7 @@ var NeptuneProvider = class {
51874
51874
  );
51875
51875
  }
51876
51876
  sleep(ms) {
51877
- return new Promise((resolve6) => setTimeout(resolve6, ms));
51877
+ return new Promise((resolve8) => setTimeout(resolve8, ms));
51878
51878
  }
51879
51879
  /**
51880
51880
  * Adopt an existing Neptune resource into cdkd state.
@@ -54414,7 +54414,7 @@ var ElastiCacheProvider = class {
54414
54414
  throw new Error(`Timed out waiting for CacheCluster ${cacheClusterId} to be deleted`);
54415
54415
  }
54416
54416
  sleep(ms) {
54417
- return new Promise((resolve6) => setTimeout(resolve6, ms));
54417
+ return new Promise((resolve8) => setTimeout(resolve8, ms));
54418
54418
  }
54419
54419
  /**
54420
54420
  * Read the AWS-current ElastiCache resource configuration in CFn-property shape.
@@ -55129,7 +55129,7 @@ var ServiceDiscoveryProvider = class {
55129
55129
  logicalId
55130
55130
  );
55131
55131
  }
55132
- await new Promise((resolve6) => setTimeout(resolve6, delay2));
55132
+ await new Promise((resolve8) => setTimeout(resolve8, delay2));
55133
55133
  delay2 = Math.min(delay2 * 2, 1e4);
55134
55134
  }
55135
55135
  throw new ProvisioningError(
@@ -59654,7 +59654,7 @@ var KinesisStreamProvider = class {
59654
59654
  if (status !== "CREATING" && status !== "UPDATING") {
59655
59655
  throw new Error(`Unexpected stream status: ${status}`);
59656
59656
  }
59657
- await new Promise((resolve6) => setTimeout(resolve6, 2e3));
59657
+ await new Promise((resolve8) => setTimeout(resolve8, 2e3));
59658
59658
  }
59659
59659
  throw new Error(
59660
59660
  `Stream ${streamName} did not reach ACTIVE status within ${maxAttempts * 2} seconds`
@@ -59987,7 +59987,7 @@ var KinesisStreamConsumerProvider = class {
59987
59987
  if (status !== "CREATING") {
59988
59988
  throw new Error(`Unexpected consumer status: ${status}`);
59989
59989
  }
59990
- await new Promise((resolve6) => setTimeout(resolve6, 1e3));
59990
+ await new Promise((resolve8) => setTimeout(resolve8, 1e3));
59991
59991
  }
59992
59992
  throw new Error(
59993
59993
  `Consumer ${consumerArn} did not reach ACTIVE status within ${maxAttempts} seconds`
@@ -60292,7 +60292,7 @@ var EFSProvider = class {
60292
60292
  this.logger.debug(
60293
60293
  `FileSystem ${fileSystemId} state: ${fs?.LifeCycleState ?? "unknown"}, waiting...`
60294
60294
  );
60295
- await new Promise((resolve6) => setTimeout(resolve6, pollIntervalMs));
60295
+ await new Promise((resolve8) => setTimeout(resolve8, pollIntervalMs));
60296
60296
  }
60297
60297
  throw new ProvisioningError(
60298
60298
  `Timed out waiting for EFS FileSystem ${fileSystemId} to become available (60s)`,
@@ -60370,7 +60370,7 @@ var EFSProvider = class {
60370
60370
  this.logger.debug(
60371
60371
  `MountTarget ${mountTargetId} state: ${mountTarget?.LifeCycleState ?? "unknown"}, waiting...`
60372
60372
  );
60373
- await new Promise((resolve6) => setTimeout(resolve6, pollIntervalMs));
60373
+ await new Promise((resolve8) => setTimeout(resolve8, pollIntervalMs));
60374
60374
  }
60375
60375
  throw new ProvisioningError(
60376
60376
  `Timed out waiting for EFS MountTarget ${mountTargetId} to become available (120s)`,
@@ -60436,7 +60436,7 @@ var EFSProvider = class {
60436
60436
  }
60437
60437
  throw error;
60438
60438
  }
60439
- await new Promise((resolve6) => setTimeout(resolve6, pollIntervalMs));
60439
+ await new Promise((resolve8) => setTimeout(resolve8, pollIntervalMs));
60440
60440
  }
60441
60441
  this.logger.warn(
60442
60442
  `Timed out waiting for EFS MountTarget ${mountTargetId} deletion for ${logicalId} (120s)`
@@ -61394,7 +61394,7 @@ var FirehoseProvider = class {
61394
61394
  this.logger.debug(
61395
61395
  `Firehose ${logicalId} status: ${status} (attempt ${attempt}/${maxAttempts})`
61396
61396
  );
61397
- await new Promise((resolve6) => setTimeout(resolve6, 2e3));
61397
+ await new Promise((resolve8) => setTimeout(resolve8, 2e3));
61398
61398
  }
61399
61399
  this.logger.warn(`Firehose ${logicalId} did not reach ACTIVE after ${maxAttempts} attempts`);
61400
61400
  }
@@ -64864,7 +64864,7 @@ var ASGProvider = class {
64864
64864
  );
64865
64865
  }
64866
64866
  sleep(ms) {
64867
- return new Promise((resolve6) => setTimeout(resolve6, ms));
64867
+ return new Promise((resolve8) => setTimeout(resolve8, ms));
64868
64868
  }
64869
64869
  // ─── Sub-shape diff helpers ───────────────────────────────────────
64870
64870
  // Each helper is a no-op when before/after JSON is identical (the cheap
@@ -66804,7 +66804,7 @@ Acquiring lock for stack ${stackName}...`);
66804
66804
  logger.debug(
66805
66805
  ` \u23F3 Retrying delete ${logicalId} in ${delay2 / 1e3}s (attempt ${attempt + 1}/${maxAttempts})`
66806
66806
  );
66807
- await new Promise((resolve6) => setTimeout(resolve6, delay2));
66807
+ await new Promise((resolve8) => setTimeout(resolve8, delay2));
66808
66808
  }
66809
66809
  }
66810
66810
  if (lastDeleteError)
@@ -70036,7 +70036,7 @@ async function captureObservedForImportedResources(stackState, providerRegistry,
70036
70036
  // src/cli/commands/local-invoke.ts
70037
70037
  import { cpSync as cpSync2, mkdtempSync as mkdtempSync3, mkdirSync as mkdirSync3, readFileSync as readFileSync7, rmSync as rmSync3, writeFileSync as writeFileSync6 } from "node:fs";
70038
70038
  import { tmpdir as tmpdir3 } from "node:os";
70039
- import { dirname as dirname3 } from "node:path";
70039
+ import { dirname as dirname5 } from "node:path";
70040
70040
  import * as path2 from "node:path";
70041
70041
  import { Command as Command15, Option as Option8 } from "commander";
70042
70042
 
@@ -70305,8 +70305,6 @@ function pickLayerLogicalId(entry) {
70305
70305
  const arg = obj["Fn::GetAtt"];
70306
70306
  if (Array.isArray(arg) && typeof arg[0] === "string")
70307
70307
  return arg[0];
70308
- if (typeof arg === "string")
70309
- return arg.split(".")[0];
70310
70308
  }
70311
70309
  return void 0;
70312
70310
  }
@@ -70855,7 +70853,7 @@ async function ecrLogin(client, accountId, region) {
70855
70853
  const token = Buffer.from(authData.authorizationToken, "base64").toString();
70856
70854
  const [username, password] = token.split(":");
70857
70855
  const endpoint = authData.proxyEndpoint || `https://${accountId}.dkr.ecr.${region}.amazonaws.com`;
70858
- await new Promise((resolve6, reject) => {
70856
+ await new Promise((resolve8, reject) => {
70859
70857
  const proc = spawn4("docker", ["login", "--username", username, "--password-stdin", endpoint], {
70860
70858
  stdio: ["pipe", "pipe", "pipe"]
70861
70859
  });
@@ -70865,7 +70863,7 @@ async function ecrLogin(client, accountId, region) {
70865
70863
  });
70866
70864
  proc.on("close", (code) => {
70867
70865
  if (code === 0)
70868
- resolve6();
70866
+ resolve8();
70869
70867
  else
70870
70868
  reject(new LocalInvokeBuildError(`ECR login failed: ${stderr.trim()}`));
70871
70869
  });
@@ -70894,12 +70892,12 @@ async function isImageInLocalCache(imageRef) {
70894
70892
  }
70895
70893
  }
70896
70894
  function runForeground2(cmd, args) {
70897
- return new Promise((resolve6, reject) => {
70895
+ return new Promise((resolve8, reject) => {
70898
70896
  const proc = spawn4(cmd, args, { stdio: "inherit" });
70899
70897
  proc.on("error", (err) => reject(new LocalInvokeBuildError(`${cmd} failed: ${err.message}`)));
70900
70898
  proc.on("close", (code) => {
70901
70899
  if (code === 0)
70902
- resolve6();
70900
+ resolve8();
70903
70901
  else
70904
70902
  reject(new LocalInvokeBuildError(`${cmd} exited with code ${code}`));
70905
70903
  });
@@ -71246,6 +71244,7 @@ function discoverRestV1Method(logicalId, resource, template, stackName) {
71246
71244
  source: "rest-v1",
71247
71245
  apiVersion: "v1",
71248
71246
  stage,
71247
+ apiLogicalId: restApiLogicalId,
71249
71248
  declaredAt: `${stackName}/${logicalId}`
71250
71249
  }
71251
71250
  ];
@@ -71342,8 +71341,8 @@ function discoverHttpApiRoute(logicalId, resource, template, stackName) {
71342
71341
  );
71343
71342
  }
71344
71343
  }
71345
- const routeKey = props["RouteKey"];
71346
- if (typeof routeKey !== "string" || routeKey.length === 0) {
71344
+ const routeKey2 = props["RouteKey"];
71345
+ if (typeof routeKey2 !== "string" || routeKey2.length === 0) {
71347
71346
  throw new Error(
71348
71347
  `${stackName}/${logicalId} (AWS::ApiGatewayV2::Route): RouteKey must be a string`
71349
71348
  );
@@ -71379,7 +71378,7 @@ function discoverHttpApiRoute(logicalId, resource, template, stackName) {
71379
71378
  integrationProps["IntegrationUri"],
71380
71379
  `${stackName}/${integrationLogicalId}.IntegrationUri`
71381
71380
  );
71382
- const { method, pathPattern } = parseRouteKey(routeKey);
71381
+ const { method, pathPattern } = parseRouteKey(routeKey2);
71383
71382
  return [
71384
71383
  {
71385
71384
  method,
@@ -71388,6 +71387,7 @@ function discoverHttpApiRoute(logicalId, resource, template, stackName) {
71388
71387
  source: "http-api",
71389
71388
  apiVersion: "v2",
71390
71389
  stage: "$default",
71390
+ apiLogicalId,
71391
71391
  declaredAt: `${stackName}/${logicalId}`
71392
71392
  }
71393
71393
  ];
@@ -71438,9 +71438,9 @@ function resolveLambdaArnIntrinsic(value, location) {
71438
71438
  }
71439
71439
  }
71440
71440
  if ("Fn::Join" in obj) {
71441
- const join9 = obj["Fn::Join"];
71442
- if (Array.isArray(join9) && join9.length === 2 && Array.isArray(join9[1])) {
71443
- const parts = join9[1];
71441
+ const join11 = obj["Fn::Join"];
71442
+ if (Array.isArray(join11) && join11.length === 2 && Array.isArray(join11[1])) {
71443
+ const parts = join11[1];
71444
71444
  const literalParts = parts.filter((p) => typeof p === "string").join("");
71445
71445
  if (literalParts.includes(":lambda:path/2015-03-31/functions/")) {
71446
71446
  for (const p of parts) {
@@ -71471,10 +71471,10 @@ function parseHttpApiTargetIntegration(target, location) {
71471
71471
  }
71472
71472
  if (target && typeof target === "object" && !Array.isArray(target)) {
71473
71473
  const obj = target;
71474
- const join9 = obj["Fn::Join"];
71475
- if (Array.isArray(join9) && join9.length === 2 && Array.isArray(join9[1])) {
71476
- const sep = join9[0];
71477
- const parts = join9[1];
71474
+ const join11 = obj["Fn::Join"];
71475
+ if (Array.isArray(join11) && join11.length === 2 && Array.isArray(join11[1])) {
71476
+ const sep = join11[0];
71477
+ const parts = join11[1];
71478
71478
  if (sep === "/" && parts.length === 2 && parts[0] === "integrations") {
71479
71479
  const ref = pickRefLogicalId(parts[1]);
71480
71480
  if (ref)
@@ -71493,14 +71493,14 @@ function parseHttpApiTargetIntegration(target, location) {
71493
71493
  )}).`
71494
71494
  );
71495
71495
  }
71496
- function parseRouteKey(routeKey) {
71497
- if (routeKey === "$default") {
71496
+ function parseRouteKey(routeKey2) {
71497
+ if (routeKey2 === "$default") {
71498
71498
  return { method: "ANY", pathPattern: "$default" };
71499
71499
  }
71500
- const m = /^([A-Za-z]+)\s+(\S+)$/.exec(routeKey);
71500
+ const m = /^([A-Za-z]+)\s+(\S+)$/.exec(routeKey2);
71501
71501
  if (!m) {
71502
71502
  throw new Error(
71503
- `RouteKey '${routeKey}' is malformed: expected '<METHOD> <path>' (e.g. 'GET /items/{id}') or '$default'.`
71503
+ `RouteKey '${routeKey2}' is malformed: expected '<METHOD> <path>' (e.g. 'GET /items/{id}') or '$default'.`
71504
71504
  );
71505
71505
  }
71506
71506
  return { method: m[1].toUpperCase(), pathPattern: m[2] };
@@ -71532,6 +71532,7 @@ function createContainerPool(specs, options) {
71532
71532
  const idleMs = options.idleMs ?? DEFAULT_IDLE_MS;
71533
71533
  const streamingEnabled = options.streamLogs !== false;
71534
71534
  const entries = /* @__PURE__ */ new Map();
71535
+ let disposed = false;
71535
71536
  const inFlightStarts = /* @__PURE__ */ new Set();
71536
71537
  for (const logicalId of specs.keys()) {
71537
71538
  entries.set(logicalId, emptyEntry(logicalId));
@@ -71543,7 +71544,8 @@ function createContainerPool(specs, options) {
71543
71544
  inUse: /* @__PURE__ */ new Set(),
71544
71545
  waitQueue: [],
71545
71546
  idleTimer: null,
71546
- growthMutex: Promise.resolve()
71547
+ growthMutex: Promise.resolve(),
71548
+ drainResolvers: []
71547
71549
  };
71548
71550
  }
71549
71551
  async function startOne(spec) {
@@ -71680,6 +71682,18 @@ function createContainerPool(specs, options) {
71680
71682
  if (!entry)
71681
71683
  return;
71682
71684
  entry.inUse.delete(handle);
71685
+ if (disposed) {
71686
+ entry.warm.push(handle);
71687
+ if (entry.inUse.size === 0) {
71688
+ for (const resolve8 of entry.drainResolvers.splice(0, entry.drainResolvers.length)) {
71689
+ try {
71690
+ resolve8();
71691
+ } catch {
71692
+ }
71693
+ }
71694
+ }
71695
+ return;
71696
+ }
71683
71697
  const waiter = entry.waitQueue.shift();
71684
71698
  if (waiter) {
71685
71699
  entry.inUse.add(handle);
@@ -71688,10 +71702,22 @@ function createContainerPool(specs, options) {
71688
71702
  }
71689
71703
  entry.warm.push(handle);
71690
71704
  resetIdleTimer(entry);
71705
+ if (entry.inUse.size === 0 && entry.drainResolvers.length > 0) {
71706
+ for (const resolve8 of entry.drainResolvers.splice(0, entry.drainResolvers.length)) {
71707
+ try {
71708
+ resolve8();
71709
+ } catch {
71710
+ }
71711
+ }
71712
+ }
71691
71713
  },
71692
71714
  async dispose() {
71715
+ if (disposed) {
71716
+ logger.debug("Container pool dispose() called more than once; ignoring");
71717
+ return;
71718
+ }
71719
+ disposed = true;
71693
71720
  logger.debug("Disposing container pool");
71694
- const allHandles = [];
71695
71721
  for (const entry of entries.values()) {
71696
71722
  if (entry.idleTimer) {
71697
71723
  clearTimeout(entry.idleTimer);
@@ -71705,6 +71731,43 @@ function createContainerPool(specs, options) {
71705
71731
  } catch {
71706
71732
  }
71707
71733
  }
71734
+ }
71735
+ const drainTimeoutMs = 3e4;
71736
+ const drainStart = Date.now();
71737
+ const entryDrains = [];
71738
+ for (const entry of entries.values()) {
71739
+ if (entry.inUse.size === 0)
71740
+ continue;
71741
+ entryDrains.push(
71742
+ new Promise((resolveDrain) => {
71743
+ entry.drainResolvers.push(() => resolveDrain({ entry, timedOut: false }));
71744
+ const t = setTimeout(() => {
71745
+ resolveDrain({ entry, timedOut: true });
71746
+ }, drainTimeoutMs);
71747
+ t.unref?.();
71748
+ })
71749
+ );
71750
+ }
71751
+ if (entryDrains.length > 0) {
71752
+ logger.debug(
71753
+ `Waiting for ${entryDrains.length} entry/entries' in-flight handle(s) to drain before teardown`
71754
+ );
71755
+ const drainResults = await Promise.all(entryDrains);
71756
+ let anyTimedOut = false;
71757
+ for (const r of drainResults) {
71758
+ if (r.timedOut) {
71759
+ anyTimedOut = true;
71760
+ logger.warn(
71761
+ `Container pool dispose timed out waiting for ${r.entry.inUse.size} in-flight handle(s) on ${r.entry.logicalId} after ${drainTimeoutMs}ms; tearing down anyway. The verify.sh \`docker rm -f cdkd-local-*\` sweep is the safety net.`
71762
+ );
71763
+ }
71764
+ }
71765
+ if (!anyTimedOut) {
71766
+ logger.debug(`In-flight drain completed in ${Date.now() - drainStart}ms`);
71767
+ }
71768
+ }
71769
+ const allHandles = [];
71770
+ for (const entry of entries.values()) {
71708
71771
  allHandles.push(...entry.warm.splice(0, entry.warm.length));
71709
71772
  for (const h of entry.inUse)
71710
71773
  allHandles.push(h);
@@ -71715,12 +71778,12 @@ function createContainerPool(specs, options) {
71715
71778
  logger.debug(
71716
71779
  `Waiting for ${startPromises.length} in-flight container start(s) to settle before teardown`
71717
71780
  );
71718
- const drainTimeoutMs = 5e3;
71781
+ const drainTimeoutMs2 = 5e3;
71719
71782
  const wrapped = startPromises.map(
71720
71783
  (p) => Promise.race([
71721
71784
  p.then((h) => ({ kind: "ok", handle: h })),
71722
71785
  new Promise((r) => {
71723
- const t = setTimeout(() => r({ kind: "timeout" }), drainTimeoutMs);
71786
+ const t = setTimeout(() => r({ kind: "timeout" }), drainTimeoutMs2);
71724
71787
  t.unref?.();
71725
71788
  })
71726
71789
  ]).catch((err) => {
@@ -71741,7 +71804,7 @@ function createContainerPool(specs, options) {
71741
71804
  }
71742
71805
  if (timedOut > 0) {
71743
71806
  logger.warn(
71744
- `Container pool disposed with ${timedOut} in-flight start(s) still pending after ${drainTimeoutMs}ms; relying on docker --rm + the verify.sh sweep to clean up.`
71807
+ `Container pool disposed with ${timedOut} in-flight start(s) still pending after ${drainTimeoutMs2}ms; relying on docker --rm + the verify.sh sweep to clean up.`
71745
71808
  );
71746
71809
  }
71747
71810
  inFlightStarts.clear();
@@ -71777,17 +71840,20 @@ function buildHttpApiV2Event(req, ctx, opts = {}) {
71777
71840
  const contentType = headers["content-type"] ?? "";
71778
71841
  const { body, isBase64Encoded } = encodeBody(req.body, contentType);
71779
71842
  const now = opts.now ? opts.now() : /* @__PURE__ */ new Date();
71780
- const routeKey = ctx.route.pathPattern === "$default" ? "$default" : `${ctx.route.method} ${ctx.route.pathPattern}`;
71843
+ const routeKey2 = ctx.route.pathPattern === "$default" ? "$default" : `${ctx.route.method} ${ctx.route.pathPattern}`;
71781
71844
  const event = {
71782
71845
  version: "2.0",
71783
- routeKey,
71846
+ routeKey: routeKey2,
71784
71847
  rawPath,
71785
71848
  rawQueryString,
71786
71849
  cookies,
71787
71850
  headers,
71788
71851
  queryStringParameters,
71789
71852
  pathParameters: decodePathParameters(ctx.pathParameters),
71790
- stageVariables: null,
71853
+ // PR 8c: surface the route's resolved Stage Variables (or `null`
71854
+ // for routes without a Stage — Function URLs, plus HTTP API routes
71855
+ // when no Stage with matching variables was attached).
71856
+ stageVariables: ctx.route.stageVariables ?? null,
71791
71857
  requestContext: {
71792
71858
  accountId: MOCK_ACCOUNT_ID,
71793
71859
  apiId: MOCK_API_ID,
@@ -71801,7 +71867,7 @@ function buildHttpApiV2Event(req, ctx, opts = {}) {
71801
71867
  userAgent
71802
71868
  },
71803
71869
  requestId: randomUUID(),
71804
- routeKey,
71870
+ routeKey: routeKey2,
71805
71871
  stage: ctx.route.stage,
71806
71872
  time: formatRequestTime(now),
71807
71873
  timeEpoch: now.getTime(),
@@ -71830,7 +71896,10 @@ function buildRestV1Event(req, ctx, opts = {}) {
71830
71896
  queryStringParameters: Object.keys(queryStringParameters).length > 0 ? queryStringParameters : null,
71831
71897
  multiValueQueryStringParameters: Object.keys(multiValueQueryStringParameters).length > 0 ? multiValueQueryStringParameters : null,
71832
71898
  pathParameters: Object.keys(pathParams).length > 0 ? pathParams : null,
71833
- stageVariables: null,
71899
+ // PR 8c: surface the route's resolved Stage Variables (or `null`).
71900
+ // REST v1 hardcoded `null` pre-PR; with `attachStageContext` the
71901
+ // route now carries the deployed Stage's `Variables` map.
71902
+ stageVariables: ctx.route.stageVariables ?? null,
71834
71903
  requestContext: {
71835
71904
  accountId: MOCK_ACCOUNT_ID,
71836
71905
  apiId: MOCK_API_ID,
@@ -72263,6 +72332,143 @@ function isPlaceholder(segment) {
72263
72332
  return /^\{[^/{}+]+\}$/.test(segment);
72264
72333
  }
72265
72334
 
72335
+ // src/local/cors-handler.ts
72336
+ function buildCorsConfigByApiId(template) {
72337
+ const out = /* @__PURE__ */ new Map();
72338
+ const resources = template.Resources ?? {};
72339
+ for (const [logicalId, resource] of Object.entries(resources)) {
72340
+ if (resource.Type !== "AWS::ApiGatewayV2::Api")
72341
+ continue;
72342
+ const props = resource.Properties ?? {};
72343
+ const raw = props["CorsConfiguration"];
72344
+ if (!raw || typeof raw !== "object" || Array.isArray(raw))
72345
+ continue;
72346
+ const parsed = parseCorsConfiguration(raw);
72347
+ if (parsed)
72348
+ out.set(logicalId, parsed);
72349
+ }
72350
+ return out;
72351
+ }
72352
+ function parseCorsConfiguration(raw) {
72353
+ const allowOrigins = pickStringArray(raw["AllowOrigins"]);
72354
+ const allowMethods = pickStringArray(raw["AllowMethods"]);
72355
+ const allowHeaders = pickStringArray(raw["AllowHeaders"]);
72356
+ const exposeHeaders = pickStringArray(raw["ExposeHeaders"]);
72357
+ const maxAgeRaw = raw["MaxAge"];
72358
+ const allowCreds = raw["AllowCredentials"];
72359
+ if (allowOrigins.length === 0 && allowMethods.length === 0 && allowHeaders.length === 0 && exposeHeaders.length === 0 && maxAgeRaw === void 0 && allowCreds === void 0) {
72360
+ return void 0;
72361
+ }
72362
+ const config = {
72363
+ AllowOrigins: allowOrigins,
72364
+ AllowMethods: allowMethods,
72365
+ AllowHeaders: allowHeaders,
72366
+ ExposeHeaders: exposeHeaders
72367
+ };
72368
+ if (typeof maxAgeRaw === "number" && Number.isFinite(maxAgeRaw)) {
72369
+ config.MaxAge = Math.trunc(maxAgeRaw);
72370
+ }
72371
+ if (typeof allowCreds === "boolean") {
72372
+ config.AllowCredentials = allowCreds;
72373
+ }
72374
+ return config;
72375
+ }
72376
+ function pickStringArray(value) {
72377
+ if (!Array.isArray(value))
72378
+ return [];
72379
+ const out = [];
72380
+ for (const v of value)
72381
+ if (typeof v === "string")
72382
+ out.push(v);
72383
+ return out;
72384
+ }
72385
+ function matchPreflight(req, config) {
72386
+ if (req.method.toUpperCase() !== "OPTIONS")
72387
+ return null;
72388
+ const headersLower = {};
72389
+ for (const [name, values] of Object.entries(req.headers)) {
72390
+ if (values.length === 0)
72391
+ continue;
72392
+ headersLower[name.toLowerCase()] = values.join(",");
72393
+ }
72394
+ const origin = headersLower["origin"];
72395
+ const requestedMethod = headersLower["access-control-request-method"];
72396
+ if (!origin || !requestedMethod) {
72397
+ return null;
72398
+ }
72399
+ const originMatch = matchOrigin(origin, config.AllowOrigins);
72400
+ if (!originMatch)
72401
+ return null;
72402
+ const methodMatch = matchToken(requestedMethod, config.AllowMethods);
72403
+ if (!methodMatch)
72404
+ return null;
72405
+ const requestedHeaders = headersLower["access-control-request-headers"] ?? "";
72406
+ if (!matchHeaderList(requestedHeaders, config.AllowHeaders))
72407
+ return null;
72408
+ const responseHeaders = {
72409
+ "access-control-allow-origin": originMatch === "*" ? "*" : origin,
72410
+ "access-control-allow-methods": methodMatch === "*" ? requestedMethod : methodMatch
72411
+ };
72412
+ if (requestedHeaders.length > 0) {
72413
+ responseHeaders["access-control-allow-headers"] = requestedHeaders;
72414
+ } else if (config.AllowHeaders.length > 0 && !config.AllowHeaders.includes("*")) {
72415
+ responseHeaders["access-control-allow-headers"] = config.AllowHeaders.join(",");
72416
+ }
72417
+ if (config.ExposeHeaders.length > 0) {
72418
+ responseHeaders["access-control-expose-headers"] = config.ExposeHeaders.join(",");
72419
+ }
72420
+ if (config.MaxAge !== void 0) {
72421
+ responseHeaders["access-control-max-age"] = String(config.MaxAge);
72422
+ }
72423
+ if (config.AllowCredentials === true) {
72424
+ responseHeaders["access-control-allow-origin"] = origin;
72425
+ responseHeaders["access-control-allow-credentials"] = "true";
72426
+ }
72427
+ responseHeaders["vary"] = "Origin";
72428
+ return { statusCode: 204, headers: responseHeaders };
72429
+ }
72430
+ function matchOrigin(requestOrigin, allowOrigins) {
72431
+ if (allowOrigins.length === 0)
72432
+ return null;
72433
+ if (allowOrigins.includes("*"))
72434
+ return "*";
72435
+ for (const allowed of allowOrigins) {
72436
+ if (allowed === requestOrigin)
72437
+ return allowed;
72438
+ }
72439
+ return null;
72440
+ }
72441
+ function matchToken(token, allowed) {
72442
+ if (allowed.length === 0)
72443
+ return null;
72444
+ if (allowed.includes("*"))
72445
+ return "*";
72446
+ const lower = token.toLowerCase();
72447
+ for (const a of allowed) {
72448
+ if (a.toLowerCase() === lower)
72449
+ return a;
72450
+ }
72451
+ return null;
72452
+ }
72453
+ function matchHeaderList(headerList, allowed) {
72454
+ const trimmed = headerList.trim();
72455
+ if (trimmed.length === 0)
72456
+ return true;
72457
+ if (allowed.includes("*"))
72458
+ return true;
72459
+ if (allowed.length === 0)
72460
+ return false;
72461
+ const allowedLower = new Set(allowed.map((s) => s.toLowerCase()));
72462
+ for (const entry of trimmed.split(",")) {
72463
+ const e = entry.trim().toLowerCase();
72464
+ if (e.length === 0)
72465
+ return false;
72466
+ if (!allowedLower.has(e))
72467
+ return false;
72468
+ }
72469
+ return true;
72470
+ }
72471
+
72266
72472
  // src/local/authorizer-resolver.ts
72267
72473
  function resolveRestV1Authorizer(authorizerLogicalId, template, stackName, declaredAt) {
72268
72474
  const authResource = template.Resources?.[authorizerLogicalId];
@@ -72399,9 +72605,9 @@ function resolveLambdaArn(value, location) {
72399
72605
  }
72400
72606
  }
72401
72607
  if ("Fn::Join" in obj) {
72402
- const join9 = obj["Fn::Join"];
72403
- if (Array.isArray(join9) && join9.length === 2 && Array.isArray(join9[1])) {
72404
- const parts = join9[1];
72608
+ const join11 = obj["Fn::Join"];
72609
+ if (Array.isArray(join11) && join11.length === 2 && Array.isArray(join11[1])) {
72610
+ const parts = join11[1];
72405
72611
  const literal = parts.filter((p) => typeof p === "string").join("");
72406
72612
  if (literal.includes(":lambda:path/2015-03-31/functions/")) {
72407
72613
  for (const p of parts) {
@@ -73075,8 +73281,9 @@ function base64UrlDecodeToBuffer(input) {
73075
73281
  // src/local/http-server.ts
73076
73282
  async function startApiServer(opts) {
73077
73283
  const logger = getLogger().child("start-api");
73284
+ let currentState = opts.state;
73078
73285
  const server = createServer2((req, res) => {
73079
- handleRequest(req, res, opts).catch((err) => {
73286
+ handleRequest(req, res, currentState, opts).catch((err) => {
73080
73287
  logger.error(
73081
73288
  `Unhandled request error: ${err instanceof Error ? err.stack ?? err.message : String(err)}`
73082
73289
  );
@@ -73114,22 +73321,31 @@ async function startApiServer(opts) {
73114
73321
  server.close(() => resolveClose());
73115
73322
  server.closeAllConnections?.();
73116
73323
  });
73117
- }
73324
+ },
73325
+ setServerState: (next) => {
73326
+ const prev = currentState;
73327
+ currentState = next;
73328
+ return prev;
73329
+ },
73330
+ getServerState: () => currentState
73118
73331
  };
73119
73332
  }
73120
- async function handleRequest(req, res, opts) {
73333
+ async function handleRequest(req, res, state, opts) {
73121
73334
  const logger = getLogger().child("start-api");
73122
73335
  const bodyBuf = await readBody(req);
73123
73336
  const rawUrl = req.url ?? "/";
73124
73337
  const method = (req.method ?? "GET").toUpperCase();
73125
73338
  const requestPath = rawUrl.split("?")[0] ?? "/";
73126
- const flatRoutes = opts.routes.map((r) => r.route);
73339
+ const preflightHandled = method === "OPTIONS" ? maybeHandleCorsPreflight(req, res, requestPath, state) : false;
73340
+ if (preflightHandled)
73341
+ return;
73342
+ const flatRoutes = state.routes.map((r) => r.route);
73127
73343
  const match = matchRoute(method, requestPath, flatRoutes);
73128
73344
  if (!match) {
73129
73345
  writeError(res, 404, '{"message":"Not Found"}');
73130
73346
  return;
73131
73347
  }
73132
- const matchedEntry = opts.routes.find(
73348
+ const matchedEntry = state.routes.find(
73133
73349
  (r) => r.route.declaredAt === match.route.declaredAt && r.route.method === match.route.method
73134
73350
  );
73135
73351
  const authorizer = matchedEntry?.authorizer;
@@ -73154,6 +73370,7 @@ async function handleRequest(req, res, opts) {
73154
73370
  authorizer,
73155
73371
  snapshot,
73156
73372
  matchCtx,
73373
+ state,
73157
73374
  opts,
73158
73375
  baseEvent["requestContext"]
73159
73376
  );
@@ -73176,7 +73393,7 @@ async function handleRequest(req, res, opts) {
73176
73393
  }
73177
73394
  let handle;
73178
73395
  try {
73179
- handle = await opts.pool.acquire(match.route.lambdaLogicalId);
73396
+ handle = await state.pool.acquire(match.route.lambdaLogicalId);
73180
73397
  } catch (err) {
73181
73398
  logger.error(
73182
73399
  `Failed to acquire container for ${match.route.lambdaLogicalId}: ${err instanceof Error ? err.message : String(err)}`
@@ -73210,10 +73427,85 @@ async function handleRequest(req, res, opts) {
73210
73427
  res.end();
73211
73428
  }
73212
73429
  } finally {
73213
- opts.pool.release(handle);
73430
+ state.pool.release(handle);
73431
+ }
73432
+ }
73433
+ function maybeHandleCorsPreflight(req, res, requestPath, state) {
73434
+ if (state.corsConfigByApiId.size === 0)
73435
+ return false;
73436
+ const headers = collectHeaders(req);
73437
+ const requestedMethodHeader = pickFirstHeaderValue(headers, "access-control-request-method");
73438
+ if (!requestedMethodHeader)
73439
+ return false;
73440
+ const flatRoutes = state.routes.map((r) => r.route);
73441
+ const surrogateMatch = matchRoute(requestedMethodHeader, requestPath, flatRoutes);
73442
+ if (!surrogateMatch)
73443
+ return false;
73444
+ const route = surrogateMatch.route;
73445
+ if (route.apiVersion !== "v2" || !route.apiLogicalId)
73446
+ return false;
73447
+ const surrogateApiId = route.apiLogicalId;
73448
+ const explicitOptionsRoute = flatRoutes.find(
73449
+ (r) => r.apiLogicalId === surrogateApiId && r.method.toUpperCase() === "OPTIONS" && pathPatternMatchesPath(r.pathPattern, requestPath)
73450
+ );
73451
+ if (explicitOptionsRoute)
73452
+ return false;
73453
+ const cors = state.corsConfigByApiId.get(surrogateApiId);
73454
+ if (!cors)
73455
+ return false;
73456
+ const preflight = matchPreflight({ method: "OPTIONS", headers }, cors);
73457
+ if (!preflight)
73458
+ return false;
73459
+ res.statusCode = preflight.statusCode;
73460
+ for (const [name, value] of Object.entries(preflight.headers)) {
73461
+ res.setHeader(name, value);
73462
+ }
73463
+ res.end();
73464
+ return true;
73465
+ }
73466
+ function pathPatternMatchesPath(pattern, requestPath) {
73467
+ if (pattern === "$default")
73468
+ return true;
73469
+ const requestSegments = requestPath.split("/").filter((s) => s.length > 0);
73470
+ const patternSegments = pattern.split("/").filter((s) => s.length > 0);
73471
+ if (patternSegments.length > 0) {
73472
+ const tail = patternSegments[patternSegments.length - 1];
73473
+ if (/^\{[^/{}]+\+\}$/.test(tail)) {
73474
+ const fixed = patternSegments.length - 1;
73475
+ if (requestSegments.length < fixed)
73476
+ return false;
73477
+ for (let i = 0; i < fixed; i++) {
73478
+ const ps = patternSegments[i];
73479
+ const rs = requestSegments[i];
73480
+ if (/^\{[^/{}+]+\}$/.test(ps))
73481
+ continue;
73482
+ if (ps !== rs)
73483
+ return false;
73484
+ }
73485
+ return true;
73486
+ }
73487
+ }
73488
+ if (patternSegments.length !== requestSegments.length)
73489
+ return false;
73490
+ for (let i = 0; i < patternSegments.length; i++) {
73491
+ const ps = patternSegments[i];
73492
+ const rs = requestSegments[i];
73493
+ if (/^\{[^/{}+]+\}$/.test(ps))
73494
+ continue;
73495
+ if (ps !== rs)
73496
+ return false;
73497
+ }
73498
+ return true;
73499
+ }
73500
+ function pickFirstHeaderValue(headers, name) {
73501
+ const lower = name.toLowerCase();
73502
+ for (const [k, v] of Object.entries(headers)) {
73503
+ if (k.toLowerCase() === lower && v.length > 0)
73504
+ return v[0];
73214
73505
  }
73506
+ return null;
73215
73507
  }
73216
- async function runAuthorizerPass(authorizer, snapshot, matchCtx, opts, requestContextV2) {
73508
+ async function runAuthorizerPass(authorizer, snapshot, matchCtx, state, opts, requestContextV2) {
73217
73509
  const headers = lowercaseSingularHeaders(snapshot.headers);
73218
73510
  const queryStringParameters = parseQueryStringSingular(snapshot.rawUrl);
73219
73511
  const sourceIp = pickSourceIp(matchCtx.route.apiVersion, requestContextV2, snapshot);
@@ -73249,7 +73541,7 @@ async function runAuthorizerPass(authorizer, snapshot, matchCtx, opts, requestCo
73249
73541
  }
73250
73542
  }
73251
73543
  const result2 = await invokeTokenAuthorizer(authorizer, reqSnap, {
73252
- pool: opts.pool,
73544
+ pool: state.pool,
73253
73545
  rieTimeoutMs: opts.rieTimeoutMs,
73254
73546
  methodArn,
73255
73547
  mockAccountId: "123456789012",
@@ -73280,7 +73572,7 @@ async function runAuthorizerPass(authorizer, snapshot, matchCtx, opts, requestCo
73280
73572
  }
73281
73573
  }
73282
73574
  const result2 = await invokeRequestAuthorizer(authorizer, reqSnap, {
73283
- pool: opts.pool,
73575
+ pool: state.pool,
73284
73576
  rieTimeoutMs: opts.rieTimeoutMs,
73285
73577
  methodArn,
73286
73578
  mockAccountId: "123456789012",
@@ -73462,6 +73754,1983 @@ function writeError(res, statusCode, body = '{"message":"Internal server error"}
73462
73754
  res.end(body);
73463
73755
  }
73464
73756
 
73757
+ // src/local/stage-resolver.ts
73758
+ function buildStageMap(template, stageOverride) {
73759
+ const out = /* @__PURE__ */ new Map();
73760
+ const resources = template.Resources ?? {};
73761
+ const restStagesByApi = /* @__PURE__ */ new Map();
73762
+ const v2StagesByApi = /* @__PURE__ */ new Map();
73763
+ for (const [logicalId, resource] of Object.entries(resources)) {
73764
+ if (resource.Type === "AWS::ApiGateway::Stage") {
73765
+ const apiId = pickRefLogicalId3((resource.Properties ?? {})["RestApiId"]);
73766
+ if (apiId)
73767
+ appendByApi(restStagesByApi, apiId, logicalId, resource);
73768
+ } else if (resource.Type === "AWS::ApiGatewayV2::Stage") {
73769
+ const apiId = pickRefLogicalId3((resource.Properties ?? {})["ApiId"]);
73770
+ if (apiId)
73771
+ appendByApi(v2StagesByApi, apiId, logicalId, resource);
73772
+ }
73773
+ }
73774
+ for (const [apiId, stages] of restStagesByApi) {
73775
+ const picked = pickStage(stages, stageOverride);
73776
+ if (picked)
73777
+ out.set(apiId, toResolvedStage(picked, "v1"));
73778
+ }
73779
+ for (const [apiId, stages] of v2StagesByApi) {
73780
+ const picked = pickStage(stages, stageOverride);
73781
+ if (picked)
73782
+ out.set(apiId, toResolvedStage(picked, "v2"));
73783
+ }
73784
+ return out;
73785
+ }
73786
+ function appendByApi(bucket, apiId, stageId, resource) {
73787
+ const list = bucket.get(apiId) ?? [];
73788
+ list.push({ id: stageId, resource });
73789
+ bucket.set(apiId, list);
73790
+ }
73791
+ function pickStage(stages, stageOverride) {
73792
+ if (stages.length === 0)
73793
+ return void 0;
73794
+ if (stageOverride) {
73795
+ for (const s of stages) {
73796
+ const props = s.resource.Properties ?? {};
73797
+ if (props["StageName"] === stageOverride)
73798
+ return s;
73799
+ }
73800
+ return void 0;
73801
+ }
73802
+ return stages[0];
73803
+ }
73804
+ function toResolvedStage(stage, apiVersion) {
73805
+ const props = stage.resource.Properties ?? {};
73806
+ const stageName = typeof props["StageName"] === "string" ? props["StageName"] : "$default";
73807
+ const rawVars = apiVersion === "v1" ? props["Variables"] : props["StageVariables"];
73808
+ let variables = null;
73809
+ if (rawVars && typeof rawVars === "object" && !Array.isArray(rawVars)) {
73810
+ const map = {};
73811
+ for (const [k, v] of Object.entries(rawVars)) {
73812
+ if (typeof v === "string") {
73813
+ map[k] = v;
73814
+ }
73815
+ }
73816
+ variables = Object.keys(map).length > 0 ? map : null;
73817
+ }
73818
+ return { stageLogicalId: stage.id, stageName, apiVersion, variables };
73819
+ }
73820
+ function attachStageContext(routes, stageMap) {
73821
+ for (const route of routes) {
73822
+ if (!route.apiLogicalId) {
73823
+ route.stageVariables = null;
73824
+ continue;
73825
+ }
73826
+ const stage = stageMap.get(route.apiLogicalId);
73827
+ if (!stage) {
73828
+ route.stageVariables = null;
73829
+ continue;
73830
+ }
73831
+ route.stageVariables = stage.variables;
73832
+ route.stage = stage.stageName;
73833
+ }
73834
+ }
73835
+ function pickRefLogicalId3(value) {
73836
+ if (value && typeof value === "object" && !Array.isArray(value)) {
73837
+ const ref = value["Ref"];
73838
+ if (typeof ref === "string")
73839
+ return ref;
73840
+ }
73841
+ return null;
73842
+ }
73843
+
73844
+ // node_modules/.pnpm/chokidar@5.0.0/node_modules/chokidar/index.js
73845
+ import { EventEmitter } from "node:events";
73846
+ import { stat as statcb, Stats } from "node:fs";
73847
+ import { readdir as readdir2, stat as stat3 } from "node:fs/promises";
73848
+ import * as sp2 from "node:path";
73849
+
73850
+ // node_modules/.pnpm/readdirp@5.0.0/node_modules/readdirp/index.js
73851
+ import { lstat, readdir, realpath, stat } from "node:fs/promises";
73852
+ import { join as pjoin, relative as prelative, resolve as presolve, sep as psep } from "node:path";
73853
+ import { Readable } from "node:stream";
73854
+ var EntryTypes = {
73855
+ FILE_TYPE: "files",
73856
+ DIR_TYPE: "directories",
73857
+ FILE_DIR_TYPE: "files_directories",
73858
+ EVERYTHING_TYPE: "all"
73859
+ };
73860
+ var defaultOptions = {
73861
+ root: ".",
73862
+ fileFilter: (_entryInfo) => true,
73863
+ directoryFilter: (_entryInfo) => true,
73864
+ type: EntryTypes.FILE_TYPE,
73865
+ lstat: false,
73866
+ depth: 2147483648,
73867
+ alwaysStat: false,
73868
+ highWaterMark: 4096
73869
+ };
73870
+ Object.freeze(defaultOptions);
73871
+ var RECURSIVE_ERROR_CODE = "READDIRP_RECURSIVE_ERROR";
73872
+ var NORMAL_FLOW_ERRORS = /* @__PURE__ */ new Set(["ENOENT", "EPERM", "EACCES", "ELOOP", RECURSIVE_ERROR_CODE]);
73873
+ var ALL_TYPES = [
73874
+ EntryTypes.DIR_TYPE,
73875
+ EntryTypes.EVERYTHING_TYPE,
73876
+ EntryTypes.FILE_DIR_TYPE,
73877
+ EntryTypes.FILE_TYPE
73878
+ ];
73879
+ var DIR_TYPES = /* @__PURE__ */ new Set([
73880
+ EntryTypes.DIR_TYPE,
73881
+ EntryTypes.EVERYTHING_TYPE,
73882
+ EntryTypes.FILE_DIR_TYPE
73883
+ ]);
73884
+ var FILE_TYPES = /* @__PURE__ */ new Set([
73885
+ EntryTypes.EVERYTHING_TYPE,
73886
+ EntryTypes.FILE_DIR_TYPE,
73887
+ EntryTypes.FILE_TYPE
73888
+ ]);
73889
+ var isNormalFlowError = (error) => NORMAL_FLOW_ERRORS.has(error.code);
73890
+ var wantBigintFsStats = process.platform === "win32";
73891
+ var emptyFn = (_entryInfo) => true;
73892
+ var normalizeFilter = (filter) => {
73893
+ if (filter === void 0)
73894
+ return emptyFn;
73895
+ if (typeof filter === "function")
73896
+ return filter;
73897
+ if (typeof filter === "string") {
73898
+ const fl = filter.trim();
73899
+ return (entry) => entry.basename === fl;
73900
+ }
73901
+ if (Array.isArray(filter)) {
73902
+ const trItems = filter.map((item) => item.trim());
73903
+ return (entry) => trItems.some((f) => entry.basename === f);
73904
+ }
73905
+ return emptyFn;
73906
+ };
73907
+ var ReaddirpStream = class extends Readable {
73908
+ parents;
73909
+ reading;
73910
+ parent;
73911
+ _stat;
73912
+ _maxDepth;
73913
+ _wantsDir;
73914
+ _wantsFile;
73915
+ _wantsEverything;
73916
+ _root;
73917
+ _isDirent;
73918
+ _statsProp;
73919
+ _rdOptions;
73920
+ _fileFilter;
73921
+ _directoryFilter;
73922
+ constructor(options = {}) {
73923
+ super({
73924
+ objectMode: true,
73925
+ autoDestroy: true,
73926
+ highWaterMark: options.highWaterMark
73927
+ });
73928
+ const opts = { ...defaultOptions, ...options };
73929
+ const { root, type } = opts;
73930
+ this._fileFilter = normalizeFilter(opts.fileFilter);
73931
+ this._directoryFilter = normalizeFilter(opts.directoryFilter);
73932
+ const statMethod = opts.lstat ? lstat : stat;
73933
+ if (wantBigintFsStats) {
73934
+ this._stat = (path3) => statMethod(path3, { bigint: true });
73935
+ } else {
73936
+ this._stat = statMethod;
73937
+ }
73938
+ this._maxDepth = opts.depth != null && Number.isSafeInteger(opts.depth) ? opts.depth : defaultOptions.depth;
73939
+ this._wantsDir = type ? DIR_TYPES.has(type) : false;
73940
+ this._wantsFile = type ? FILE_TYPES.has(type) : false;
73941
+ this._wantsEverything = type === EntryTypes.EVERYTHING_TYPE;
73942
+ this._root = presolve(root);
73943
+ this._isDirent = !opts.alwaysStat;
73944
+ this._statsProp = this._isDirent ? "dirent" : "stats";
73945
+ this._rdOptions = { encoding: "utf8", withFileTypes: this._isDirent };
73946
+ this.parents = [this._exploreDir(root, 1)];
73947
+ this.reading = false;
73948
+ this.parent = void 0;
73949
+ }
73950
+ async _read(batch) {
73951
+ if (this.reading)
73952
+ return;
73953
+ this.reading = true;
73954
+ try {
73955
+ while (!this.destroyed && batch > 0) {
73956
+ const par = this.parent;
73957
+ const fil = par && par.files;
73958
+ if (fil && fil.length > 0) {
73959
+ const { path: path3, depth } = par;
73960
+ const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path3));
73961
+ const awaited = await Promise.all(slice);
73962
+ for (const entry of awaited) {
73963
+ if (!entry)
73964
+ continue;
73965
+ if (this.destroyed)
73966
+ return;
73967
+ const entryType = await this._getEntryType(entry);
73968
+ if (entryType === "directory" && this._directoryFilter(entry)) {
73969
+ if (depth <= this._maxDepth) {
73970
+ this.parents.push(this._exploreDir(entry.fullPath, depth + 1));
73971
+ }
73972
+ if (this._wantsDir) {
73973
+ this.push(entry);
73974
+ batch--;
73975
+ }
73976
+ } else if ((entryType === "file" || this._includeAsFile(entry)) && this._fileFilter(entry)) {
73977
+ if (this._wantsFile) {
73978
+ this.push(entry);
73979
+ batch--;
73980
+ }
73981
+ }
73982
+ }
73983
+ } else {
73984
+ const parent = this.parents.pop();
73985
+ if (!parent) {
73986
+ this.push(null);
73987
+ break;
73988
+ }
73989
+ this.parent = await parent;
73990
+ if (this.destroyed)
73991
+ return;
73992
+ }
73993
+ }
73994
+ } catch (error) {
73995
+ this.destroy(error);
73996
+ } finally {
73997
+ this.reading = false;
73998
+ }
73999
+ }
74000
+ async _exploreDir(path3, depth) {
74001
+ let files;
74002
+ try {
74003
+ files = await readdir(path3, this._rdOptions);
74004
+ } catch (error) {
74005
+ this._onError(error);
74006
+ }
74007
+ return { files, depth, path: path3 };
74008
+ }
74009
+ async _formatEntry(dirent, path3) {
74010
+ let entry;
74011
+ const basename4 = this._isDirent ? dirent.name : dirent;
74012
+ try {
74013
+ const fullPath = presolve(pjoin(path3, basename4));
74014
+ entry = { path: prelative(this._root, fullPath), fullPath, basename: basename4 };
74015
+ entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
74016
+ } catch (err) {
74017
+ this._onError(err);
74018
+ return;
74019
+ }
74020
+ return entry;
74021
+ }
74022
+ _onError(err) {
74023
+ if (isNormalFlowError(err) && !this.destroyed) {
74024
+ this.emit("warn", err);
74025
+ } else {
74026
+ this.destroy(err);
74027
+ }
74028
+ }
74029
+ async _getEntryType(entry) {
74030
+ if (!entry && this._statsProp in entry) {
74031
+ return "";
74032
+ }
74033
+ const stats = entry[this._statsProp];
74034
+ if (stats.isFile())
74035
+ return "file";
74036
+ if (stats.isDirectory())
74037
+ return "directory";
74038
+ if (stats && stats.isSymbolicLink()) {
74039
+ const full = entry.fullPath;
74040
+ try {
74041
+ const entryRealPath = await realpath(full);
74042
+ const entryRealPathStats = await lstat(entryRealPath);
74043
+ if (entryRealPathStats.isFile()) {
74044
+ return "file";
74045
+ }
74046
+ if (entryRealPathStats.isDirectory()) {
74047
+ const len = entryRealPath.length;
74048
+ if (full.startsWith(entryRealPath) && full.substr(len, 1) === psep) {
74049
+ const recursiveError = new Error(`Circular symlink detected: "${full}" points to "${entryRealPath}"`);
74050
+ recursiveError.code = RECURSIVE_ERROR_CODE;
74051
+ return this._onError(recursiveError);
74052
+ }
74053
+ return "directory";
74054
+ }
74055
+ } catch (error) {
74056
+ this._onError(error);
74057
+ return "";
74058
+ }
74059
+ }
74060
+ }
74061
+ _includeAsFile(entry) {
74062
+ const stats = entry && entry[this._statsProp];
74063
+ return stats && this._wantsEverything && !stats.isDirectory();
74064
+ }
74065
+ };
74066
+ function readdirp(root, options = {}) {
74067
+ let type = options.entryType || options.type;
74068
+ if (type === "both")
74069
+ type = EntryTypes.FILE_DIR_TYPE;
74070
+ if (type)
74071
+ options.type = type;
74072
+ if (!root) {
74073
+ throw new Error("readdirp: root argument is required. Usage: readdirp(root, options)");
74074
+ } else if (typeof root !== "string") {
74075
+ throw new TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");
74076
+ } else if (type && !ALL_TYPES.includes(type)) {
74077
+ throw new Error(`readdirp: Invalid type passed. Use one of ${ALL_TYPES.join(", ")}`);
74078
+ }
74079
+ options.root = root;
74080
+ return new ReaddirpStream(options);
74081
+ }
74082
+
74083
+ // node_modules/.pnpm/chokidar@5.0.0/node_modules/chokidar/handler.js
74084
+ import { watch as fs_watch, unwatchFile, watchFile } from "node:fs";
74085
+ import { realpath as fsrealpath, lstat as lstat2, open, stat as stat2 } from "node:fs/promises";
74086
+ import { type as osType } from "node:os";
74087
+ import * as sp from "node:path";
74088
+ var STR_DATA = "data";
74089
+ var STR_END = "end";
74090
+ var STR_CLOSE = "close";
74091
+ var EMPTY_FN = () => {
74092
+ };
74093
+ var pl = process.platform;
74094
+ var isWindows = pl === "win32";
74095
+ var isMacos = pl === "darwin";
74096
+ var isLinux = pl === "linux";
74097
+ var isFreeBSD = pl === "freebsd";
74098
+ var isIBMi = osType() === "OS400";
74099
+ var EVENTS = {
74100
+ ALL: "all",
74101
+ READY: "ready",
74102
+ ADD: "add",
74103
+ CHANGE: "change",
74104
+ ADD_DIR: "addDir",
74105
+ UNLINK: "unlink",
74106
+ UNLINK_DIR: "unlinkDir",
74107
+ RAW: "raw",
74108
+ ERROR: "error"
74109
+ };
74110
+ var EV = EVENTS;
74111
+ var THROTTLE_MODE_WATCH = "watch";
74112
+ var statMethods = { lstat: lstat2, stat: stat2 };
74113
+ var KEY_LISTENERS = "listeners";
74114
+ var KEY_ERR = "errHandlers";
74115
+ var KEY_RAW = "rawEmitters";
74116
+ var HANDLER_KEYS = [KEY_LISTENERS, KEY_ERR, KEY_RAW];
74117
+ var binaryExtensions = /* @__PURE__ */ new Set([
74118
+ "3dm",
74119
+ "3ds",
74120
+ "3g2",
74121
+ "3gp",
74122
+ "7z",
74123
+ "a",
74124
+ "aac",
74125
+ "adp",
74126
+ "afdesign",
74127
+ "afphoto",
74128
+ "afpub",
74129
+ "ai",
74130
+ "aif",
74131
+ "aiff",
74132
+ "alz",
74133
+ "ape",
74134
+ "apk",
74135
+ "appimage",
74136
+ "ar",
74137
+ "arj",
74138
+ "asf",
74139
+ "au",
74140
+ "avi",
74141
+ "bak",
74142
+ "baml",
74143
+ "bh",
74144
+ "bin",
74145
+ "bk",
74146
+ "bmp",
74147
+ "btif",
74148
+ "bz2",
74149
+ "bzip2",
74150
+ "cab",
74151
+ "caf",
74152
+ "cgm",
74153
+ "class",
74154
+ "cmx",
74155
+ "cpio",
74156
+ "cr2",
74157
+ "cur",
74158
+ "dat",
74159
+ "dcm",
74160
+ "deb",
74161
+ "dex",
74162
+ "djvu",
74163
+ "dll",
74164
+ "dmg",
74165
+ "dng",
74166
+ "doc",
74167
+ "docm",
74168
+ "docx",
74169
+ "dot",
74170
+ "dotm",
74171
+ "dra",
74172
+ "DS_Store",
74173
+ "dsk",
74174
+ "dts",
74175
+ "dtshd",
74176
+ "dvb",
74177
+ "dwg",
74178
+ "dxf",
74179
+ "ecelp4800",
74180
+ "ecelp7470",
74181
+ "ecelp9600",
74182
+ "egg",
74183
+ "eol",
74184
+ "eot",
74185
+ "epub",
74186
+ "exe",
74187
+ "f4v",
74188
+ "fbs",
74189
+ "fh",
74190
+ "fla",
74191
+ "flac",
74192
+ "flatpak",
74193
+ "fli",
74194
+ "flv",
74195
+ "fpx",
74196
+ "fst",
74197
+ "fvt",
74198
+ "g3",
74199
+ "gh",
74200
+ "gif",
74201
+ "graffle",
74202
+ "gz",
74203
+ "gzip",
74204
+ "h261",
74205
+ "h263",
74206
+ "h264",
74207
+ "icns",
74208
+ "ico",
74209
+ "ief",
74210
+ "img",
74211
+ "ipa",
74212
+ "iso",
74213
+ "jar",
74214
+ "jpeg",
74215
+ "jpg",
74216
+ "jpgv",
74217
+ "jpm",
74218
+ "jxr",
74219
+ "key",
74220
+ "ktx",
74221
+ "lha",
74222
+ "lib",
74223
+ "lvp",
74224
+ "lz",
74225
+ "lzh",
74226
+ "lzma",
74227
+ "lzo",
74228
+ "m3u",
74229
+ "m4a",
74230
+ "m4v",
74231
+ "mar",
74232
+ "mdi",
74233
+ "mht",
74234
+ "mid",
74235
+ "midi",
74236
+ "mj2",
74237
+ "mka",
74238
+ "mkv",
74239
+ "mmr",
74240
+ "mng",
74241
+ "mobi",
74242
+ "mov",
74243
+ "movie",
74244
+ "mp3",
74245
+ "mp4",
74246
+ "mp4a",
74247
+ "mpeg",
74248
+ "mpg",
74249
+ "mpga",
74250
+ "mxu",
74251
+ "nef",
74252
+ "npx",
74253
+ "numbers",
74254
+ "nupkg",
74255
+ "o",
74256
+ "odp",
74257
+ "ods",
74258
+ "odt",
74259
+ "oga",
74260
+ "ogg",
74261
+ "ogv",
74262
+ "otf",
74263
+ "ott",
74264
+ "pages",
74265
+ "pbm",
74266
+ "pcx",
74267
+ "pdb",
74268
+ "pdf",
74269
+ "pea",
74270
+ "pgm",
74271
+ "pic",
74272
+ "png",
74273
+ "pnm",
74274
+ "pot",
74275
+ "potm",
74276
+ "potx",
74277
+ "ppa",
74278
+ "ppam",
74279
+ "ppm",
74280
+ "pps",
74281
+ "ppsm",
74282
+ "ppsx",
74283
+ "ppt",
74284
+ "pptm",
74285
+ "pptx",
74286
+ "psd",
74287
+ "pya",
74288
+ "pyc",
74289
+ "pyo",
74290
+ "pyv",
74291
+ "qt",
74292
+ "rar",
74293
+ "ras",
74294
+ "raw",
74295
+ "resources",
74296
+ "rgb",
74297
+ "rip",
74298
+ "rlc",
74299
+ "rmf",
74300
+ "rmvb",
74301
+ "rpm",
74302
+ "rtf",
74303
+ "rz",
74304
+ "s3m",
74305
+ "s7z",
74306
+ "scpt",
74307
+ "sgi",
74308
+ "shar",
74309
+ "snap",
74310
+ "sil",
74311
+ "sketch",
74312
+ "slk",
74313
+ "smv",
74314
+ "snk",
74315
+ "so",
74316
+ "stl",
74317
+ "suo",
74318
+ "sub",
74319
+ "swf",
74320
+ "tar",
74321
+ "tbz",
74322
+ "tbz2",
74323
+ "tga",
74324
+ "tgz",
74325
+ "thmx",
74326
+ "tif",
74327
+ "tiff",
74328
+ "tlz",
74329
+ "ttc",
74330
+ "ttf",
74331
+ "txz",
74332
+ "udf",
74333
+ "uvh",
74334
+ "uvi",
74335
+ "uvm",
74336
+ "uvp",
74337
+ "uvs",
74338
+ "uvu",
74339
+ "viv",
74340
+ "vob",
74341
+ "war",
74342
+ "wav",
74343
+ "wax",
74344
+ "wbmp",
74345
+ "wdp",
74346
+ "weba",
74347
+ "webm",
74348
+ "webp",
74349
+ "whl",
74350
+ "wim",
74351
+ "wm",
74352
+ "wma",
74353
+ "wmv",
74354
+ "wmx",
74355
+ "woff",
74356
+ "woff2",
74357
+ "wrm",
74358
+ "wvx",
74359
+ "xbm",
74360
+ "xif",
74361
+ "xla",
74362
+ "xlam",
74363
+ "xls",
74364
+ "xlsb",
74365
+ "xlsm",
74366
+ "xlsx",
74367
+ "xlt",
74368
+ "xltm",
74369
+ "xltx",
74370
+ "xm",
74371
+ "xmind",
74372
+ "xpi",
74373
+ "xpm",
74374
+ "xwd",
74375
+ "xz",
74376
+ "z",
74377
+ "zip",
74378
+ "zipx"
74379
+ ]);
74380
+ var isBinaryPath = (filePath) => binaryExtensions.has(sp.extname(filePath).slice(1).toLowerCase());
74381
+ var foreach = (val, fn) => {
74382
+ if (val instanceof Set) {
74383
+ val.forEach(fn);
74384
+ } else {
74385
+ fn(val);
74386
+ }
74387
+ };
74388
+ var addAndConvert = (main2, prop, item) => {
74389
+ let container = main2[prop];
74390
+ if (!(container instanceof Set)) {
74391
+ main2[prop] = container = /* @__PURE__ */ new Set([container]);
74392
+ }
74393
+ container.add(item);
74394
+ };
74395
+ var clearItem = (cont) => (key) => {
74396
+ const set = cont[key];
74397
+ if (set instanceof Set) {
74398
+ set.clear();
74399
+ } else {
74400
+ delete cont[key];
74401
+ }
74402
+ };
74403
+ var delFromSet = (main2, prop, item) => {
74404
+ const container = main2[prop];
74405
+ if (container instanceof Set) {
74406
+ container.delete(item);
74407
+ } else if (container === item) {
74408
+ delete main2[prop];
74409
+ }
74410
+ };
74411
+ var isEmptySet = (val) => val instanceof Set ? val.size === 0 : !val;
74412
+ var FsWatchInstances = /* @__PURE__ */ new Map();
74413
+ function createFsWatchInstance(path3, options, listener, errHandler, emitRaw) {
74414
+ const handleEvent = (rawEvent, evPath) => {
74415
+ listener(path3);
74416
+ emitRaw(rawEvent, evPath, { watchedPath: path3 });
74417
+ if (evPath && path3 !== evPath) {
74418
+ fsWatchBroadcast(sp.resolve(path3, evPath), KEY_LISTENERS, sp.join(path3, evPath));
74419
+ }
74420
+ };
74421
+ try {
74422
+ return fs_watch(path3, {
74423
+ persistent: options.persistent
74424
+ }, handleEvent);
74425
+ } catch (error) {
74426
+ errHandler(error);
74427
+ return void 0;
74428
+ }
74429
+ }
74430
+ var fsWatchBroadcast = (fullPath, listenerType, val1, val2, val3) => {
74431
+ const cont = FsWatchInstances.get(fullPath);
74432
+ if (!cont)
74433
+ return;
74434
+ foreach(cont[listenerType], (listener) => {
74435
+ listener(val1, val2, val3);
74436
+ });
74437
+ };
74438
+ var setFsWatchListener = (path3, fullPath, options, handlers) => {
74439
+ const { listener, errHandler, rawEmitter } = handlers;
74440
+ let cont = FsWatchInstances.get(fullPath);
74441
+ let watcher;
74442
+ if (!options.persistent) {
74443
+ watcher = createFsWatchInstance(path3, options, listener, errHandler, rawEmitter);
74444
+ if (!watcher)
74445
+ return;
74446
+ return watcher.close.bind(watcher);
74447
+ }
74448
+ if (cont) {
74449
+ addAndConvert(cont, KEY_LISTENERS, listener);
74450
+ addAndConvert(cont, KEY_ERR, errHandler);
74451
+ addAndConvert(cont, KEY_RAW, rawEmitter);
74452
+ } else {
74453
+ watcher = createFsWatchInstance(
74454
+ path3,
74455
+ options,
74456
+ fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS),
74457
+ errHandler,
74458
+ // no need to use broadcast here
74459
+ fsWatchBroadcast.bind(null, fullPath, KEY_RAW)
74460
+ );
74461
+ if (!watcher)
74462
+ return;
74463
+ watcher.on(EV.ERROR, async (error) => {
74464
+ const broadcastErr = fsWatchBroadcast.bind(null, fullPath, KEY_ERR);
74465
+ if (cont)
74466
+ cont.watcherUnusable = true;
74467
+ if (isWindows && error.code === "EPERM") {
74468
+ try {
74469
+ const fd = await open(path3, "r");
74470
+ await fd.close();
74471
+ broadcastErr(error);
74472
+ } catch (err) {
74473
+ }
74474
+ } else {
74475
+ broadcastErr(error);
74476
+ }
74477
+ });
74478
+ cont = {
74479
+ listeners: listener,
74480
+ errHandlers: errHandler,
74481
+ rawEmitters: rawEmitter,
74482
+ watcher
74483
+ };
74484
+ FsWatchInstances.set(fullPath, cont);
74485
+ }
74486
+ return () => {
74487
+ delFromSet(cont, KEY_LISTENERS, listener);
74488
+ delFromSet(cont, KEY_ERR, errHandler);
74489
+ delFromSet(cont, KEY_RAW, rawEmitter);
74490
+ if (isEmptySet(cont.listeners)) {
74491
+ cont.watcher.close();
74492
+ FsWatchInstances.delete(fullPath);
74493
+ HANDLER_KEYS.forEach(clearItem(cont));
74494
+ cont.watcher = void 0;
74495
+ Object.freeze(cont);
74496
+ }
74497
+ };
74498
+ };
74499
+ var FsWatchFileInstances = /* @__PURE__ */ new Map();
74500
+ var setFsWatchFileListener = (path3, fullPath, options, handlers) => {
74501
+ const { listener, rawEmitter } = handlers;
74502
+ let cont = FsWatchFileInstances.get(fullPath);
74503
+ const copts = cont && cont.options;
74504
+ if (copts && (copts.persistent < options.persistent || copts.interval > options.interval)) {
74505
+ unwatchFile(fullPath);
74506
+ cont = void 0;
74507
+ }
74508
+ if (cont) {
74509
+ addAndConvert(cont, KEY_LISTENERS, listener);
74510
+ addAndConvert(cont, KEY_RAW, rawEmitter);
74511
+ } else {
74512
+ cont = {
74513
+ listeners: listener,
74514
+ rawEmitters: rawEmitter,
74515
+ options,
74516
+ watcher: watchFile(fullPath, options, (curr, prev) => {
74517
+ foreach(cont.rawEmitters, (rawEmitter2) => {
74518
+ rawEmitter2(EV.CHANGE, fullPath, { curr, prev });
74519
+ });
74520
+ const currmtime = curr.mtimeMs;
74521
+ if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) {
74522
+ foreach(cont.listeners, (listener2) => listener2(path3, curr));
74523
+ }
74524
+ })
74525
+ };
74526
+ FsWatchFileInstances.set(fullPath, cont);
74527
+ }
74528
+ return () => {
74529
+ delFromSet(cont, KEY_LISTENERS, listener);
74530
+ delFromSet(cont, KEY_RAW, rawEmitter);
74531
+ if (isEmptySet(cont.listeners)) {
74532
+ FsWatchFileInstances.delete(fullPath);
74533
+ unwatchFile(fullPath);
74534
+ cont.options = cont.watcher = void 0;
74535
+ Object.freeze(cont);
74536
+ }
74537
+ };
74538
+ };
74539
+ var NodeFsHandler = class {
74540
+ fsw;
74541
+ _boundHandleError;
74542
+ constructor(fsW) {
74543
+ this.fsw = fsW;
74544
+ this._boundHandleError = (error) => fsW._handleError(error);
74545
+ }
74546
+ /**
74547
+ * Watch file for changes with fs_watchFile or fs_watch.
74548
+ * @param path to file or dir
74549
+ * @param listener on fs change
74550
+ * @returns closer for the watcher instance
74551
+ */
74552
+ _watchWithNodeFs(path3, listener) {
74553
+ const opts = this.fsw.options;
74554
+ const directory = sp.dirname(path3);
74555
+ const basename4 = sp.basename(path3);
74556
+ const parent = this.fsw._getWatchedDir(directory);
74557
+ parent.add(basename4);
74558
+ const absolutePath = sp.resolve(path3);
74559
+ const options = {
74560
+ persistent: opts.persistent
74561
+ };
74562
+ if (!listener)
74563
+ listener = EMPTY_FN;
74564
+ let closer;
74565
+ if (opts.usePolling) {
74566
+ const enableBin = opts.interval !== opts.binaryInterval;
74567
+ options.interval = enableBin && isBinaryPath(basename4) ? opts.binaryInterval : opts.interval;
74568
+ closer = setFsWatchFileListener(path3, absolutePath, options, {
74569
+ listener,
74570
+ rawEmitter: this.fsw._emitRaw
74571
+ });
74572
+ } else {
74573
+ closer = setFsWatchListener(path3, absolutePath, options, {
74574
+ listener,
74575
+ errHandler: this._boundHandleError,
74576
+ rawEmitter: this.fsw._emitRaw
74577
+ });
74578
+ }
74579
+ return closer;
74580
+ }
74581
+ /**
74582
+ * Watch a file and emit add event if warranted.
74583
+ * @returns closer for the watcher instance
74584
+ */
74585
+ _handleFile(file, stats, initialAdd) {
74586
+ if (this.fsw.closed) {
74587
+ return;
74588
+ }
74589
+ const dirname7 = sp.dirname(file);
74590
+ const basename4 = sp.basename(file);
74591
+ const parent = this.fsw._getWatchedDir(dirname7);
74592
+ let prevStats = stats;
74593
+ if (parent.has(basename4))
74594
+ return;
74595
+ const listener = async (path3, newStats) => {
74596
+ if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file, 5))
74597
+ return;
74598
+ if (!newStats || newStats.mtimeMs === 0) {
74599
+ try {
74600
+ const newStats2 = await stat2(file);
74601
+ if (this.fsw.closed)
74602
+ return;
74603
+ const at = newStats2.atimeMs;
74604
+ const mt = newStats2.mtimeMs;
74605
+ if (!at || at <= mt || mt !== prevStats.mtimeMs) {
74606
+ this.fsw._emit(EV.CHANGE, file, newStats2);
74607
+ }
74608
+ if ((isMacos || isLinux || isFreeBSD) && prevStats.ino !== newStats2.ino) {
74609
+ this.fsw._closeFile(path3);
74610
+ prevStats = newStats2;
74611
+ const closer2 = this._watchWithNodeFs(file, listener);
74612
+ if (closer2)
74613
+ this.fsw._addPathCloser(path3, closer2);
74614
+ } else {
74615
+ prevStats = newStats2;
74616
+ }
74617
+ } catch (error) {
74618
+ this.fsw._remove(dirname7, basename4);
74619
+ }
74620
+ } else if (parent.has(basename4)) {
74621
+ const at = newStats.atimeMs;
74622
+ const mt = newStats.mtimeMs;
74623
+ if (!at || at <= mt || mt !== prevStats.mtimeMs) {
74624
+ this.fsw._emit(EV.CHANGE, file, newStats);
74625
+ }
74626
+ prevStats = newStats;
74627
+ }
74628
+ };
74629
+ const closer = this._watchWithNodeFs(file, listener);
74630
+ if (!(initialAdd && this.fsw.options.ignoreInitial) && this.fsw._isntIgnored(file)) {
74631
+ if (!this.fsw._throttle(EV.ADD, file, 0))
74632
+ return;
74633
+ this.fsw._emit(EV.ADD, file, stats);
74634
+ }
74635
+ return closer;
74636
+ }
74637
+ /**
74638
+ * Handle symlinks encountered while reading a dir.
74639
+ * @param entry returned by readdirp
74640
+ * @param directory path of dir being read
74641
+ * @param path of this item
74642
+ * @param item basename of this item
74643
+ * @returns true if no more processing is needed for this entry.
74644
+ */
74645
+ async _handleSymlink(entry, directory, path3, item) {
74646
+ if (this.fsw.closed) {
74647
+ return;
74648
+ }
74649
+ const full = entry.fullPath;
74650
+ const dir = this.fsw._getWatchedDir(directory);
74651
+ if (!this.fsw.options.followSymlinks) {
74652
+ this.fsw._incrReadyCount();
74653
+ let linkPath;
74654
+ try {
74655
+ linkPath = await fsrealpath(path3);
74656
+ } catch (e) {
74657
+ this.fsw._emitReady();
74658
+ return true;
74659
+ }
74660
+ if (this.fsw.closed)
74661
+ return;
74662
+ if (dir.has(item)) {
74663
+ if (this.fsw._symlinkPaths.get(full) !== linkPath) {
74664
+ this.fsw._symlinkPaths.set(full, linkPath);
74665
+ this.fsw._emit(EV.CHANGE, path3, entry.stats);
74666
+ }
74667
+ } else {
74668
+ dir.add(item);
74669
+ this.fsw._symlinkPaths.set(full, linkPath);
74670
+ this.fsw._emit(EV.ADD, path3, entry.stats);
74671
+ }
74672
+ this.fsw._emitReady();
74673
+ return true;
74674
+ }
74675
+ if (this.fsw._symlinkPaths.has(full)) {
74676
+ return true;
74677
+ }
74678
+ this.fsw._symlinkPaths.set(full, true);
74679
+ }
74680
+ _handleRead(directory, initialAdd, wh, target, dir, depth, throttler) {
74681
+ directory = sp.join(directory, "");
74682
+ const throttleKey = target ? `${directory}:${target}` : directory;
74683
+ throttler = this.fsw._throttle("readdir", throttleKey, 1e3);
74684
+ if (!throttler)
74685
+ return;
74686
+ const previous = this.fsw._getWatchedDir(wh.path);
74687
+ const current = /* @__PURE__ */ new Set();
74688
+ let stream = this.fsw._readdirp(directory, {
74689
+ fileFilter: (entry) => wh.filterPath(entry),
74690
+ directoryFilter: (entry) => wh.filterDir(entry)
74691
+ });
74692
+ if (!stream)
74693
+ return;
74694
+ stream.on(STR_DATA, async (entry) => {
74695
+ if (this.fsw.closed) {
74696
+ stream = void 0;
74697
+ return;
74698
+ }
74699
+ const item = entry.path;
74700
+ let path3 = sp.join(directory, item);
74701
+ current.add(item);
74702
+ if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path3, item)) {
74703
+ return;
74704
+ }
74705
+ if (this.fsw.closed) {
74706
+ stream = void 0;
74707
+ return;
74708
+ }
74709
+ if (item === target || !target && !previous.has(item)) {
74710
+ this.fsw._incrReadyCount();
74711
+ path3 = sp.join(dir, sp.relative(dir, path3));
74712
+ this._addToNodeFs(path3, initialAdd, wh, depth + 1);
74713
+ }
74714
+ }).on(EV.ERROR, this._boundHandleError);
74715
+ return new Promise((resolve8, reject) => {
74716
+ if (!stream)
74717
+ return reject();
74718
+ stream.once(STR_END, () => {
74719
+ if (this.fsw.closed) {
74720
+ stream = void 0;
74721
+ return;
74722
+ }
74723
+ const wasThrottled = throttler ? throttler.clear() : false;
74724
+ resolve8(void 0);
74725
+ previous.getChildren().filter((item) => {
74726
+ return item !== directory && !current.has(item);
74727
+ }).forEach((item) => {
74728
+ this.fsw._remove(directory, item);
74729
+ });
74730
+ stream = void 0;
74731
+ if (wasThrottled)
74732
+ this._handleRead(directory, false, wh, target, dir, depth, throttler);
74733
+ });
74734
+ });
74735
+ }
74736
+ /**
74737
+ * Read directory to add / remove files from `@watched` list and re-read it on change.
74738
+ * @param dir fs path
74739
+ * @param stats
74740
+ * @param initialAdd
74741
+ * @param depth relative to user-supplied path
74742
+ * @param target child path targeted for watch
74743
+ * @param wh Common watch helpers for this path
74744
+ * @param realpath
74745
+ * @returns closer for the watcher instance.
74746
+ */
74747
+ async _handleDir(dir, stats, initialAdd, depth, target, wh, realpath2) {
74748
+ const parentDir = this.fsw._getWatchedDir(sp.dirname(dir));
74749
+ const tracked = parentDir.has(sp.basename(dir));
74750
+ if (!(initialAdd && this.fsw.options.ignoreInitial) && !target && !tracked) {
74751
+ this.fsw._emit(EV.ADD_DIR, dir, stats);
74752
+ }
74753
+ parentDir.add(sp.basename(dir));
74754
+ this.fsw._getWatchedDir(dir);
74755
+ let throttler;
74756
+ let closer;
74757
+ const oDepth = this.fsw.options.depth;
74758
+ if ((oDepth == null || depth <= oDepth) && !this.fsw._symlinkPaths.has(realpath2)) {
74759
+ if (!target) {
74760
+ await this._handleRead(dir, initialAdd, wh, target, dir, depth, throttler);
74761
+ if (this.fsw.closed)
74762
+ return;
74763
+ }
74764
+ closer = this._watchWithNodeFs(dir, (dirPath, stats2) => {
74765
+ if (stats2 && stats2.mtimeMs === 0)
74766
+ return;
74767
+ this._handleRead(dirPath, false, wh, target, dir, depth, throttler);
74768
+ });
74769
+ }
74770
+ return closer;
74771
+ }
74772
+ /**
74773
+ * Handle added file, directory, or glob pattern.
74774
+ * Delegates call to _handleFile / _handleDir after checks.
74775
+ * @param path to file or ir
74776
+ * @param initialAdd was the file added at watch instantiation?
74777
+ * @param priorWh depth relative to user-supplied path
74778
+ * @param depth Child path actually targeted for watch
74779
+ * @param target Child path actually targeted for watch
74780
+ */
74781
+ async _addToNodeFs(path3, initialAdd, priorWh, depth, target) {
74782
+ const ready = this.fsw._emitReady;
74783
+ if (this.fsw._isIgnored(path3) || this.fsw.closed) {
74784
+ ready();
74785
+ return false;
74786
+ }
74787
+ const wh = this.fsw._getWatchHelpers(path3);
74788
+ if (priorWh) {
74789
+ wh.filterPath = (entry) => priorWh.filterPath(entry);
74790
+ wh.filterDir = (entry) => priorWh.filterDir(entry);
74791
+ }
74792
+ try {
74793
+ const stats = await statMethods[wh.statMethod](wh.watchPath);
74794
+ if (this.fsw.closed)
74795
+ return;
74796
+ if (this.fsw._isIgnored(wh.watchPath, stats)) {
74797
+ ready();
74798
+ return false;
74799
+ }
74800
+ const follow = this.fsw.options.followSymlinks;
74801
+ let closer;
74802
+ if (stats.isDirectory()) {
74803
+ const absPath = sp.resolve(path3);
74804
+ const targetPath = follow ? await fsrealpath(path3) : path3;
74805
+ if (this.fsw.closed)
74806
+ return;
74807
+ closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
74808
+ if (this.fsw.closed)
74809
+ return;
74810
+ if (absPath !== targetPath && targetPath !== void 0) {
74811
+ this.fsw._symlinkPaths.set(absPath, targetPath);
74812
+ }
74813
+ } else if (stats.isSymbolicLink()) {
74814
+ const targetPath = follow ? await fsrealpath(path3) : path3;
74815
+ if (this.fsw.closed)
74816
+ return;
74817
+ const parent = sp.dirname(wh.watchPath);
74818
+ this.fsw._getWatchedDir(parent).add(wh.watchPath);
74819
+ this.fsw._emit(EV.ADD, wh.watchPath, stats);
74820
+ closer = await this._handleDir(parent, stats, initialAdd, depth, path3, wh, targetPath);
74821
+ if (this.fsw.closed)
74822
+ return;
74823
+ if (targetPath !== void 0) {
74824
+ this.fsw._symlinkPaths.set(sp.resolve(path3), targetPath);
74825
+ }
74826
+ } else {
74827
+ closer = this._handleFile(wh.watchPath, stats, initialAdd);
74828
+ }
74829
+ ready();
74830
+ if (closer)
74831
+ this.fsw._addPathCloser(path3, closer);
74832
+ return false;
74833
+ } catch (error) {
74834
+ if (this.fsw._handleError(error)) {
74835
+ ready();
74836
+ return path3;
74837
+ }
74838
+ }
74839
+ }
74840
+ };
74841
+
74842
+ // node_modules/.pnpm/chokidar@5.0.0/node_modules/chokidar/index.js
74843
+ var SLASH = "/";
74844
+ var SLASH_SLASH = "//";
74845
+ var ONE_DOT = ".";
74846
+ var TWO_DOTS = "..";
74847
+ var STRING_TYPE = "string";
74848
+ var BACK_SLASH_RE = /\\/g;
74849
+ var DOUBLE_SLASH_RE = /\/\//g;
74850
+ var DOT_RE = /\..*\.(sw[px])$|~$|\.subl.*\.tmp/;
74851
+ var REPLACER_RE = /^\.[/\\]/;
74852
+ function arrify(item) {
74853
+ return Array.isArray(item) ? item : [item];
74854
+ }
74855
+ var isMatcherObject = (matcher) => typeof matcher === "object" && matcher !== null && !(matcher instanceof RegExp);
74856
+ function createPattern(matcher) {
74857
+ if (typeof matcher === "function")
74858
+ return matcher;
74859
+ if (typeof matcher === "string")
74860
+ return (string) => matcher === string;
74861
+ if (matcher instanceof RegExp)
74862
+ return (string) => matcher.test(string);
74863
+ if (typeof matcher === "object" && matcher !== null) {
74864
+ return (string) => {
74865
+ if (matcher.path === string)
74866
+ return true;
74867
+ if (matcher.recursive) {
74868
+ const relative3 = sp2.relative(matcher.path, string);
74869
+ if (!relative3) {
74870
+ return false;
74871
+ }
74872
+ return !relative3.startsWith("..") && !sp2.isAbsolute(relative3);
74873
+ }
74874
+ return false;
74875
+ };
74876
+ }
74877
+ return () => false;
74878
+ }
74879
+ function normalizePath(path3) {
74880
+ if (typeof path3 !== "string")
74881
+ throw new Error("string expected");
74882
+ path3 = sp2.normalize(path3);
74883
+ path3 = path3.replace(/\\/g, "/");
74884
+ let prepend = false;
74885
+ if (path3.startsWith("//"))
74886
+ prepend = true;
74887
+ path3 = path3.replace(DOUBLE_SLASH_RE, "/");
74888
+ if (prepend)
74889
+ path3 = "/" + path3;
74890
+ return path3;
74891
+ }
74892
+ function matchPatterns(patterns, testString, stats) {
74893
+ const path3 = normalizePath(testString);
74894
+ for (let index = 0; index < patterns.length; index++) {
74895
+ const pattern = patterns[index];
74896
+ if (pattern(path3, stats)) {
74897
+ return true;
74898
+ }
74899
+ }
74900
+ return false;
74901
+ }
74902
+ function anymatch(matchers, testString) {
74903
+ if (matchers == null) {
74904
+ throw new TypeError("anymatch: specify first argument");
74905
+ }
74906
+ const matchersArray = arrify(matchers);
74907
+ const patterns = matchersArray.map((matcher) => createPattern(matcher));
74908
+ if (testString == null) {
74909
+ return (testString2, stats) => {
74910
+ return matchPatterns(patterns, testString2, stats);
74911
+ };
74912
+ }
74913
+ return matchPatterns(patterns, testString);
74914
+ }
74915
+ var unifyPaths = (paths_) => {
74916
+ const paths = arrify(paths_).flat();
74917
+ if (!paths.every((p) => typeof p === STRING_TYPE)) {
74918
+ throw new TypeError(`Non-string provided as watch path: ${paths}`);
74919
+ }
74920
+ return paths.map(normalizePathToUnix);
74921
+ };
74922
+ var toUnix = (string) => {
74923
+ let str = string.replace(BACK_SLASH_RE, SLASH);
74924
+ let prepend = false;
74925
+ if (str.startsWith(SLASH_SLASH)) {
74926
+ prepend = true;
74927
+ }
74928
+ str = str.replace(DOUBLE_SLASH_RE, SLASH);
74929
+ if (prepend) {
74930
+ str = SLASH + str;
74931
+ }
74932
+ return str;
74933
+ };
74934
+ var normalizePathToUnix = (path3) => toUnix(sp2.normalize(toUnix(path3)));
74935
+ var normalizeIgnored = (cwd = "") => (path3) => {
74936
+ if (typeof path3 === "string") {
74937
+ return normalizePathToUnix(sp2.isAbsolute(path3) ? path3 : sp2.join(cwd, path3));
74938
+ } else {
74939
+ return path3;
74940
+ }
74941
+ };
74942
+ var getAbsolutePath = (path3, cwd) => {
74943
+ if (sp2.isAbsolute(path3)) {
74944
+ return path3;
74945
+ }
74946
+ return sp2.join(cwd, path3);
74947
+ };
74948
+ var EMPTY_SET = Object.freeze(/* @__PURE__ */ new Set());
74949
+ var DirEntry = class {
74950
+ path;
74951
+ _removeWatcher;
74952
+ items;
74953
+ constructor(dir, removeWatcher) {
74954
+ this.path = dir;
74955
+ this._removeWatcher = removeWatcher;
74956
+ this.items = /* @__PURE__ */ new Set();
74957
+ }
74958
+ add(item) {
74959
+ const { items } = this;
74960
+ if (!items)
74961
+ return;
74962
+ if (item !== ONE_DOT && item !== TWO_DOTS)
74963
+ items.add(item);
74964
+ }
74965
+ async remove(item) {
74966
+ const { items } = this;
74967
+ if (!items)
74968
+ return;
74969
+ items.delete(item);
74970
+ if (items.size > 0)
74971
+ return;
74972
+ const dir = this.path;
74973
+ try {
74974
+ await readdir2(dir);
74975
+ } catch (err) {
74976
+ if (this._removeWatcher) {
74977
+ this._removeWatcher(sp2.dirname(dir), sp2.basename(dir));
74978
+ }
74979
+ }
74980
+ }
74981
+ has(item) {
74982
+ const { items } = this;
74983
+ if (!items)
74984
+ return;
74985
+ return items.has(item);
74986
+ }
74987
+ getChildren() {
74988
+ const { items } = this;
74989
+ if (!items)
74990
+ return [];
74991
+ return [...items.values()];
74992
+ }
74993
+ dispose() {
74994
+ this.items.clear();
74995
+ this.path = "";
74996
+ this._removeWatcher = EMPTY_FN;
74997
+ this.items = EMPTY_SET;
74998
+ Object.freeze(this);
74999
+ }
75000
+ };
75001
+ var STAT_METHOD_F = "stat";
75002
+ var STAT_METHOD_L = "lstat";
75003
+ var WatchHelper = class {
75004
+ fsw;
75005
+ path;
75006
+ watchPath;
75007
+ fullWatchPath;
75008
+ dirParts;
75009
+ followSymlinks;
75010
+ statMethod;
75011
+ constructor(path3, follow, fsw) {
75012
+ this.fsw = fsw;
75013
+ const watchPath = path3;
75014
+ this.path = path3 = path3.replace(REPLACER_RE, "");
75015
+ this.watchPath = watchPath;
75016
+ this.fullWatchPath = sp2.resolve(watchPath);
75017
+ this.dirParts = [];
75018
+ this.dirParts.forEach((parts) => {
75019
+ if (parts.length > 1)
75020
+ parts.pop();
75021
+ });
75022
+ this.followSymlinks = follow;
75023
+ this.statMethod = follow ? STAT_METHOD_F : STAT_METHOD_L;
75024
+ }
75025
+ entryPath(entry) {
75026
+ return sp2.join(this.watchPath, sp2.relative(this.watchPath, entry.fullPath));
75027
+ }
75028
+ filterPath(entry) {
75029
+ const { stats } = entry;
75030
+ if (stats && stats.isSymbolicLink())
75031
+ return this.filterDir(entry);
75032
+ const resolvedPath = this.entryPath(entry);
75033
+ return this.fsw._isntIgnored(resolvedPath, stats) && this.fsw._hasReadPermissions(stats);
75034
+ }
75035
+ filterDir(entry) {
75036
+ return this.fsw._isntIgnored(this.entryPath(entry), entry.stats);
75037
+ }
75038
+ };
75039
+ var FSWatcher = class extends EventEmitter {
75040
+ closed;
75041
+ options;
75042
+ _closers;
75043
+ _ignoredPaths;
75044
+ _throttled;
75045
+ _streams;
75046
+ _symlinkPaths;
75047
+ _watched;
75048
+ _pendingWrites;
75049
+ _pendingUnlinks;
75050
+ _readyCount;
75051
+ _emitReady;
75052
+ _closePromise;
75053
+ _userIgnored;
75054
+ _readyEmitted;
75055
+ _emitRaw;
75056
+ _boundRemove;
75057
+ _nodeFsHandler;
75058
+ // Not indenting methods for history sake; for now.
75059
+ constructor(_opts = {}) {
75060
+ super();
75061
+ this.closed = false;
75062
+ this._closers = /* @__PURE__ */ new Map();
75063
+ this._ignoredPaths = /* @__PURE__ */ new Set();
75064
+ this._throttled = /* @__PURE__ */ new Map();
75065
+ this._streams = /* @__PURE__ */ new Set();
75066
+ this._symlinkPaths = /* @__PURE__ */ new Map();
75067
+ this._watched = /* @__PURE__ */ new Map();
75068
+ this._pendingWrites = /* @__PURE__ */ new Map();
75069
+ this._pendingUnlinks = /* @__PURE__ */ new Map();
75070
+ this._readyCount = 0;
75071
+ this._readyEmitted = false;
75072
+ const awf = _opts.awaitWriteFinish;
75073
+ const DEF_AWF = { stabilityThreshold: 2e3, pollInterval: 100 };
75074
+ const opts = {
75075
+ // Defaults
75076
+ persistent: true,
75077
+ ignoreInitial: false,
75078
+ ignorePermissionErrors: false,
75079
+ interval: 100,
75080
+ binaryInterval: 300,
75081
+ followSymlinks: true,
75082
+ usePolling: false,
75083
+ // useAsync: false,
75084
+ atomic: true,
75085
+ // NOTE: overwritten later (depends on usePolling)
75086
+ ..._opts,
75087
+ // Change format
75088
+ ignored: _opts.ignored ? arrify(_opts.ignored) : arrify([]),
75089
+ awaitWriteFinish: awf === true ? DEF_AWF : typeof awf === "object" ? { ...DEF_AWF, ...awf } : false
75090
+ };
75091
+ if (isIBMi)
75092
+ opts.usePolling = true;
75093
+ if (opts.atomic === void 0)
75094
+ opts.atomic = !opts.usePolling;
75095
+ const envPoll = process.env.CHOKIDAR_USEPOLLING;
75096
+ if (envPoll !== void 0) {
75097
+ const envLower = envPoll.toLowerCase();
75098
+ if (envLower === "false" || envLower === "0")
75099
+ opts.usePolling = false;
75100
+ else if (envLower === "true" || envLower === "1")
75101
+ opts.usePolling = true;
75102
+ else
75103
+ opts.usePolling = !!envLower;
75104
+ }
75105
+ const envInterval = process.env.CHOKIDAR_INTERVAL;
75106
+ if (envInterval)
75107
+ opts.interval = Number.parseInt(envInterval, 10);
75108
+ let readyCalls = 0;
75109
+ this._emitReady = () => {
75110
+ readyCalls++;
75111
+ if (readyCalls >= this._readyCount) {
75112
+ this._emitReady = EMPTY_FN;
75113
+ this._readyEmitted = true;
75114
+ process.nextTick(() => this.emit(EVENTS.READY));
75115
+ }
75116
+ };
75117
+ this._emitRaw = (...args) => this.emit(EVENTS.RAW, ...args);
75118
+ this._boundRemove = this._remove.bind(this);
75119
+ this.options = opts;
75120
+ this._nodeFsHandler = new NodeFsHandler(this);
75121
+ Object.freeze(opts);
75122
+ }
75123
+ _addIgnoredPath(matcher) {
75124
+ if (isMatcherObject(matcher)) {
75125
+ for (const ignored of this._ignoredPaths) {
75126
+ if (isMatcherObject(ignored) && ignored.path === matcher.path && ignored.recursive === matcher.recursive) {
75127
+ return;
75128
+ }
75129
+ }
75130
+ }
75131
+ this._ignoredPaths.add(matcher);
75132
+ }
75133
+ _removeIgnoredPath(matcher) {
75134
+ this._ignoredPaths.delete(matcher);
75135
+ if (typeof matcher === "string") {
75136
+ for (const ignored of this._ignoredPaths) {
75137
+ if (isMatcherObject(ignored) && ignored.path === matcher) {
75138
+ this._ignoredPaths.delete(ignored);
75139
+ }
75140
+ }
75141
+ }
75142
+ }
75143
+ // Public methods
75144
+ /**
75145
+ * Adds paths to be watched on an existing FSWatcher instance.
75146
+ * @param paths_ file or file list. Other arguments are unused
75147
+ */
75148
+ add(paths_, _origAdd, _internal) {
75149
+ const { cwd } = this.options;
75150
+ this.closed = false;
75151
+ this._closePromise = void 0;
75152
+ let paths = unifyPaths(paths_);
75153
+ if (cwd) {
75154
+ paths = paths.map((path3) => {
75155
+ const absPath = getAbsolutePath(path3, cwd);
75156
+ return absPath;
75157
+ });
75158
+ }
75159
+ paths.forEach((path3) => {
75160
+ this._removeIgnoredPath(path3);
75161
+ });
75162
+ this._userIgnored = void 0;
75163
+ if (!this._readyCount)
75164
+ this._readyCount = 0;
75165
+ this._readyCount += paths.length;
75166
+ Promise.all(paths.map(async (path3) => {
75167
+ const res = await this._nodeFsHandler._addToNodeFs(path3, !_internal, void 0, 0, _origAdd);
75168
+ if (res)
75169
+ this._emitReady();
75170
+ return res;
75171
+ })).then((results) => {
75172
+ if (this.closed)
75173
+ return;
75174
+ results.forEach((item) => {
75175
+ if (item)
75176
+ this.add(sp2.dirname(item), sp2.basename(_origAdd || item));
75177
+ });
75178
+ });
75179
+ return this;
75180
+ }
75181
+ /**
75182
+ * Close watchers or start ignoring events from specified paths.
75183
+ */
75184
+ unwatch(paths_) {
75185
+ if (this.closed)
75186
+ return this;
75187
+ const paths = unifyPaths(paths_);
75188
+ const { cwd } = this.options;
75189
+ paths.forEach((path3) => {
75190
+ if (!sp2.isAbsolute(path3) && !this._closers.has(path3)) {
75191
+ if (cwd)
75192
+ path3 = sp2.join(cwd, path3);
75193
+ path3 = sp2.resolve(path3);
75194
+ }
75195
+ this._closePath(path3);
75196
+ this._addIgnoredPath(path3);
75197
+ if (this._watched.has(path3)) {
75198
+ this._addIgnoredPath({
75199
+ path: path3,
75200
+ recursive: true
75201
+ });
75202
+ }
75203
+ this._userIgnored = void 0;
75204
+ });
75205
+ return this;
75206
+ }
75207
+ /**
75208
+ * Close watchers and remove all listeners from watched paths.
75209
+ */
75210
+ close() {
75211
+ if (this._closePromise) {
75212
+ return this._closePromise;
75213
+ }
75214
+ this.closed = true;
75215
+ this.removeAllListeners();
75216
+ const closers = [];
75217
+ this._closers.forEach((closerList) => closerList.forEach((closer) => {
75218
+ const promise = closer();
75219
+ if (promise instanceof Promise)
75220
+ closers.push(promise);
75221
+ }));
75222
+ this._streams.forEach((stream) => stream.destroy());
75223
+ this._userIgnored = void 0;
75224
+ this._readyCount = 0;
75225
+ this._readyEmitted = false;
75226
+ this._watched.forEach((dirent) => dirent.dispose());
75227
+ this._closers.clear();
75228
+ this._watched.clear();
75229
+ this._streams.clear();
75230
+ this._symlinkPaths.clear();
75231
+ this._throttled.clear();
75232
+ this._closePromise = closers.length ? Promise.all(closers).then(() => void 0) : Promise.resolve();
75233
+ return this._closePromise;
75234
+ }
75235
+ /**
75236
+ * Expose list of watched paths
75237
+ * @returns for chaining
75238
+ */
75239
+ getWatched() {
75240
+ const watchList = {};
75241
+ this._watched.forEach((entry, dir) => {
75242
+ const key = this.options.cwd ? sp2.relative(this.options.cwd, dir) : dir;
75243
+ const index = key || ONE_DOT;
75244
+ watchList[index] = entry.getChildren().sort();
75245
+ });
75246
+ return watchList;
75247
+ }
75248
+ emitWithAll(event, args) {
75249
+ this.emit(event, ...args);
75250
+ if (event !== EVENTS.ERROR)
75251
+ this.emit(EVENTS.ALL, event, ...args);
75252
+ }
75253
+ // Common helpers
75254
+ // --------------
75255
+ /**
75256
+ * Normalize and emit events.
75257
+ * Calling _emit DOES NOT MEAN emit() would be called!
75258
+ * @param event Type of event
75259
+ * @param path File or directory path
75260
+ * @param stats arguments to be passed with event
75261
+ * @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag
75262
+ */
75263
+ async _emit(event, path3, stats) {
75264
+ if (this.closed)
75265
+ return;
75266
+ const opts = this.options;
75267
+ if (isWindows)
75268
+ path3 = sp2.normalize(path3);
75269
+ if (opts.cwd)
75270
+ path3 = sp2.relative(opts.cwd, path3);
75271
+ const args = [path3];
75272
+ if (stats != null)
75273
+ args.push(stats);
75274
+ const awf = opts.awaitWriteFinish;
75275
+ let pw;
75276
+ if (awf && (pw = this._pendingWrites.get(path3))) {
75277
+ pw.lastChange = /* @__PURE__ */ new Date();
75278
+ return this;
75279
+ }
75280
+ if (opts.atomic) {
75281
+ if (event === EVENTS.UNLINK) {
75282
+ this._pendingUnlinks.set(path3, [event, ...args]);
75283
+ setTimeout(() => {
75284
+ this._pendingUnlinks.forEach((entry, path4) => {
75285
+ this.emit(...entry);
75286
+ this.emit(EVENTS.ALL, ...entry);
75287
+ this._pendingUnlinks.delete(path4);
75288
+ });
75289
+ }, typeof opts.atomic === "number" ? opts.atomic : 100);
75290
+ return this;
75291
+ }
75292
+ if (event === EVENTS.ADD && this._pendingUnlinks.has(path3)) {
75293
+ event = EVENTS.CHANGE;
75294
+ this._pendingUnlinks.delete(path3);
75295
+ }
75296
+ }
75297
+ if (awf && (event === EVENTS.ADD || event === EVENTS.CHANGE) && this._readyEmitted) {
75298
+ const awfEmit = (err, stats2) => {
75299
+ if (err) {
75300
+ event = EVENTS.ERROR;
75301
+ args[0] = err;
75302
+ this.emitWithAll(event, args);
75303
+ } else if (stats2) {
75304
+ if (args.length > 1) {
75305
+ args[1] = stats2;
75306
+ } else {
75307
+ args.push(stats2);
75308
+ }
75309
+ this.emitWithAll(event, args);
75310
+ }
75311
+ };
75312
+ this._awaitWriteFinish(path3, awf.stabilityThreshold, event, awfEmit);
75313
+ return this;
75314
+ }
75315
+ if (event === EVENTS.CHANGE) {
75316
+ const isThrottled = !this._throttle(EVENTS.CHANGE, path3, 50);
75317
+ if (isThrottled)
75318
+ return this;
75319
+ }
75320
+ if (opts.alwaysStat && stats === void 0 && (event === EVENTS.ADD || event === EVENTS.ADD_DIR || event === EVENTS.CHANGE)) {
75321
+ const fullPath = opts.cwd ? sp2.join(opts.cwd, path3) : path3;
75322
+ let stats2;
75323
+ try {
75324
+ stats2 = await stat3(fullPath);
75325
+ } catch (err) {
75326
+ }
75327
+ if (!stats2 || this.closed)
75328
+ return;
75329
+ args.push(stats2);
75330
+ }
75331
+ this.emitWithAll(event, args);
75332
+ return this;
75333
+ }
75334
+ /**
75335
+ * Common handler for errors
75336
+ * @returns The error if defined, otherwise the value of the FSWatcher instance's `closed` flag
75337
+ */
75338
+ _handleError(error) {
75339
+ const code = error && error.code;
75340
+ if (error && code !== "ENOENT" && code !== "ENOTDIR" && (!this.options.ignorePermissionErrors || code !== "EPERM" && code !== "EACCES")) {
75341
+ this.emit(EVENTS.ERROR, error);
75342
+ }
75343
+ return error || this.closed;
75344
+ }
75345
+ /**
75346
+ * Helper utility for throttling
75347
+ * @param actionType type being throttled
75348
+ * @param path being acted upon
75349
+ * @param timeout duration of time to suppress duplicate actions
75350
+ * @returns tracking object or false if action should be suppressed
75351
+ */
75352
+ _throttle(actionType, path3, timeout) {
75353
+ if (!this._throttled.has(actionType)) {
75354
+ this._throttled.set(actionType, /* @__PURE__ */ new Map());
75355
+ }
75356
+ const action = this._throttled.get(actionType);
75357
+ if (!action)
75358
+ throw new Error("invalid throttle");
75359
+ const actionPath = action.get(path3);
75360
+ if (actionPath) {
75361
+ actionPath.count++;
75362
+ return false;
75363
+ }
75364
+ let timeoutObject;
75365
+ const clear = () => {
75366
+ const item = action.get(path3);
75367
+ const count = item ? item.count : 0;
75368
+ action.delete(path3);
75369
+ clearTimeout(timeoutObject);
75370
+ if (item)
75371
+ clearTimeout(item.timeoutObject);
75372
+ return count;
75373
+ };
75374
+ timeoutObject = setTimeout(clear, timeout);
75375
+ const thr = { timeoutObject, clear, count: 0 };
75376
+ action.set(path3, thr);
75377
+ return thr;
75378
+ }
75379
+ _incrReadyCount() {
75380
+ return this._readyCount++;
75381
+ }
75382
+ /**
75383
+ * Awaits write operation to finish.
75384
+ * Polls a newly created file for size variations. When files size does not change for 'threshold' milliseconds calls callback.
75385
+ * @param path being acted upon
75386
+ * @param threshold Time in milliseconds a file size must be fixed before acknowledging write OP is finished
75387
+ * @param event
75388
+ * @param awfEmit Callback to be called when ready for event to be emitted.
75389
+ */
75390
+ _awaitWriteFinish(path3, threshold, event, awfEmit) {
75391
+ const awf = this.options.awaitWriteFinish;
75392
+ if (typeof awf !== "object")
75393
+ return;
75394
+ const pollInterval = awf.pollInterval;
75395
+ let timeoutHandler;
75396
+ let fullPath = path3;
75397
+ if (this.options.cwd && !sp2.isAbsolute(path3)) {
75398
+ fullPath = sp2.join(this.options.cwd, path3);
75399
+ }
75400
+ const now = /* @__PURE__ */ new Date();
75401
+ const writes = this._pendingWrites;
75402
+ function awaitWriteFinishFn(prevStat) {
75403
+ statcb(fullPath, (err, curStat) => {
75404
+ if (err || !writes.has(path3)) {
75405
+ if (err && err.code !== "ENOENT")
75406
+ awfEmit(err);
75407
+ return;
75408
+ }
75409
+ const now2 = Number(/* @__PURE__ */ new Date());
75410
+ if (prevStat && curStat.size !== prevStat.size) {
75411
+ writes.get(path3).lastChange = now2;
75412
+ }
75413
+ const pw = writes.get(path3);
75414
+ const df = now2 - pw.lastChange;
75415
+ if (df >= threshold) {
75416
+ writes.delete(path3);
75417
+ awfEmit(void 0, curStat);
75418
+ } else {
75419
+ timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval, curStat);
75420
+ }
75421
+ });
75422
+ }
75423
+ if (!writes.has(path3)) {
75424
+ writes.set(path3, {
75425
+ lastChange: now,
75426
+ cancelWait: () => {
75427
+ writes.delete(path3);
75428
+ clearTimeout(timeoutHandler);
75429
+ return event;
75430
+ }
75431
+ });
75432
+ timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval);
75433
+ }
75434
+ }
75435
+ /**
75436
+ * Determines whether user has asked to ignore this path.
75437
+ */
75438
+ _isIgnored(path3, stats) {
75439
+ if (this.options.atomic && DOT_RE.test(path3))
75440
+ return true;
75441
+ if (!this._userIgnored) {
75442
+ const { cwd } = this.options;
75443
+ const ign = this.options.ignored;
75444
+ const ignored = (ign || []).map(normalizeIgnored(cwd));
75445
+ const ignoredPaths = [...this._ignoredPaths];
75446
+ const list = [...ignoredPaths.map(normalizeIgnored(cwd)), ...ignored];
75447
+ this._userIgnored = anymatch(list, void 0);
75448
+ }
75449
+ return this._userIgnored(path3, stats);
75450
+ }
75451
+ _isntIgnored(path3, stat4) {
75452
+ return !this._isIgnored(path3, stat4);
75453
+ }
75454
+ /**
75455
+ * Provides a set of common helpers and properties relating to symlink handling.
75456
+ * @param path file or directory pattern being watched
75457
+ */
75458
+ _getWatchHelpers(path3) {
75459
+ return new WatchHelper(path3, this.options.followSymlinks, this);
75460
+ }
75461
+ // Directory helpers
75462
+ // -----------------
75463
+ /**
75464
+ * Provides directory tracking objects
75465
+ * @param directory path of the directory
75466
+ */
75467
+ _getWatchedDir(directory) {
75468
+ const dir = sp2.resolve(directory);
75469
+ if (!this._watched.has(dir))
75470
+ this._watched.set(dir, new DirEntry(dir, this._boundRemove));
75471
+ return this._watched.get(dir);
75472
+ }
75473
+ // File helpers
75474
+ // ------------
75475
+ /**
75476
+ * Check for read permissions: https://stackoverflow.com/a/11781404/1358405
75477
+ */
75478
+ _hasReadPermissions(stats) {
75479
+ if (this.options.ignorePermissionErrors)
75480
+ return true;
75481
+ return Boolean(Number(stats.mode) & 256);
75482
+ }
75483
+ /**
75484
+ * Handles emitting unlink events for
75485
+ * files and directories, and via recursion, for
75486
+ * files and directories within directories that are unlinked
75487
+ * @param directory within which the following item is located
75488
+ * @param item base path of item/directory
75489
+ */
75490
+ _remove(directory, item, isDirectory) {
75491
+ const path3 = sp2.join(directory, item);
75492
+ const fullPath = sp2.resolve(path3);
75493
+ isDirectory = isDirectory != null ? isDirectory : this._watched.has(path3) || this._watched.has(fullPath);
75494
+ if (!this._throttle("remove", path3, 100))
75495
+ return;
75496
+ if (!isDirectory && this._watched.size === 1) {
75497
+ this.add(directory, item, true);
75498
+ }
75499
+ const wp = this._getWatchedDir(path3);
75500
+ const nestedDirectoryChildren = wp.getChildren();
75501
+ nestedDirectoryChildren.forEach((nested) => this._remove(path3, nested));
75502
+ const parent = this._getWatchedDir(directory);
75503
+ const wasTracked = parent.has(item);
75504
+ parent.remove(item);
75505
+ if (this._symlinkPaths.has(fullPath)) {
75506
+ this._symlinkPaths.delete(fullPath);
75507
+ }
75508
+ let relPath = path3;
75509
+ if (this.options.cwd)
75510
+ relPath = sp2.relative(this.options.cwd, path3);
75511
+ if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
75512
+ const event = this._pendingWrites.get(relPath).cancelWait();
75513
+ if (event === EVENTS.ADD)
75514
+ return;
75515
+ }
75516
+ this._watched.delete(path3);
75517
+ this._watched.delete(fullPath);
75518
+ const eventName = isDirectory ? EVENTS.UNLINK_DIR : EVENTS.UNLINK;
75519
+ if (wasTracked && !this._isIgnored(path3))
75520
+ this._emit(eventName, path3);
75521
+ this._closePath(path3);
75522
+ }
75523
+ /**
75524
+ * Closes all watchers for a path
75525
+ */
75526
+ _closePath(path3) {
75527
+ this._closeFile(path3);
75528
+ const dir = sp2.dirname(path3);
75529
+ this._getWatchedDir(dir).remove(sp2.basename(path3));
75530
+ }
75531
+ /**
75532
+ * Closes only file-specific watchers
75533
+ */
75534
+ _closeFile(path3) {
75535
+ const closers = this._closers.get(path3);
75536
+ if (!closers)
75537
+ return;
75538
+ closers.forEach((closer) => closer());
75539
+ this._closers.delete(path3);
75540
+ }
75541
+ _addPathCloser(path3, closer) {
75542
+ if (!closer)
75543
+ return;
75544
+ let list = this._closers.get(path3);
75545
+ if (!list) {
75546
+ list = [];
75547
+ this._closers.set(path3, list);
75548
+ }
75549
+ list.push(closer);
75550
+ }
75551
+ _readdirp(root, opts) {
75552
+ if (this.closed)
75553
+ return;
75554
+ const options = { type: EVENTS.ALL, alwaysStat: true, lstat: true, ...opts, depth: 0 };
75555
+ let stream = readdirp(root, options);
75556
+ this._streams.add(stream);
75557
+ stream.once(STR_CLOSE, () => {
75558
+ stream = void 0;
75559
+ });
75560
+ stream.once(STR_END, () => {
75561
+ if (stream) {
75562
+ this._streams.delete(stream);
75563
+ stream = void 0;
75564
+ }
75565
+ });
75566
+ return stream;
75567
+ }
75568
+ };
75569
+ function watch(paths, options = {}) {
75570
+ const watcher = new FSWatcher(options);
75571
+ watcher.add(paths);
75572
+ return watcher;
75573
+ }
75574
+
75575
+ // src/local/file-watcher.ts
75576
+ var DEFAULT_DEBOUNCE_MS = 500;
75577
+ function createFileWatcher(options) {
75578
+ const logger = getLogger().child("start-api-watch");
75579
+ const debounceMs = options.debounceMs ?? DEFAULT_DEBOUNCE_MS;
75580
+ const ignoreInitial = options.ignoreInitial !== false;
75581
+ const watcher = watch([...options.paths], {
75582
+ ignoreInitial,
75583
+ // Don't follow symlinks — asset directories under `cdk.out/asset.<hash>/`
75584
+ // are real directories; following symlinks would risk cycling into
75585
+ // `node_modules` or similar.
75586
+ followSymlinks: false,
75587
+ // Don't crash on permission errors.
75588
+ ignorePermissionErrors: true
75589
+ });
75590
+ let timer = null;
75591
+ let closed = false;
75592
+ const fire = () => {
75593
+ if (closed)
75594
+ return;
75595
+ if (timer)
75596
+ clearTimeout(timer);
75597
+ timer = setTimeout(() => {
75598
+ timer = null;
75599
+ if (closed)
75600
+ return;
75601
+ try {
75602
+ options.onChange();
75603
+ } catch (err) {
75604
+ logger.warn(`onChange callback threw: ${err instanceof Error ? err.message : String(err)}`);
75605
+ }
75606
+ }, debounceMs);
75607
+ timer.unref?.();
75608
+ };
75609
+ watcher.on("add", fire);
75610
+ watcher.on("change", fire);
75611
+ watcher.on("unlink", fire);
75612
+ watcher.on("error", (err) => {
75613
+ logger.debug(
75614
+ `chokidar error: ${err instanceof Error ? err.message : String(err)}. Continuing.`
75615
+ );
75616
+ });
75617
+ let currentPaths = new Set(options.paths);
75618
+ return {
75619
+ update: (paths) => {
75620
+ if (closed)
75621
+ return;
75622
+ const next = new Set(paths);
75623
+ const toAdd = [];
75624
+ const toRemove = [];
75625
+ for (const p of next)
75626
+ if (!currentPaths.has(p))
75627
+ toAdd.push(p);
75628
+ for (const p of currentPaths)
75629
+ if (!next.has(p))
75630
+ toRemove.push(p);
75631
+ if (toAdd.length > 0)
75632
+ watcher.add(toAdd);
75633
+ if (toRemove.length > 0)
75634
+ watcher.unwatch(toRemove);
75635
+ currentPaths = next;
75636
+ },
75637
+ close: async () => {
75638
+ closed = true;
75639
+ if (timer) {
75640
+ clearTimeout(timer);
75641
+ timer = null;
75642
+ }
75643
+ await watcher.close();
75644
+ }
75645
+ };
75646
+ }
75647
+
75648
+ // src/local/reload-orchestrator.ts
75649
+ function createReloadOrchestrator(deps) {
75650
+ const logger = getLogger().child("start-api-reload");
75651
+ let chain = Promise.resolve();
75652
+ return {
75653
+ reload() {
75654
+ const next = chain.then(() => runOneReload(deps, logger));
75655
+ chain = next.catch(() => void 0);
75656
+ return next;
75657
+ }
75658
+ };
75659
+ }
75660
+ async function runOneReload(deps, logger) {
75661
+ const previousState = deps.getServerState();
75662
+ const start = Date.now();
75663
+ let material;
75664
+ try {
75665
+ material = await deps.synthesizeAndBuild();
75666
+ } catch (err) {
75667
+ const reason = err instanceof Error ? err.message : String(err);
75668
+ logger.warn(`cdk synth failed during reload; keeping previous version. (${reason})`);
75669
+ return { ok: false, reason, added: [], removed: [], rebuiltLambdas: [] };
75670
+ }
75671
+ const oldRoutes = previousState.routes;
75672
+ const newRoutes = material.routes;
75673
+ const oldKeys = new Set(oldRoutes.map((r) => routeKey(r.route)));
75674
+ const newKeys = new Set(newRoutes.map((r) => routeKey(r.route)));
75675
+ const added = newRoutes.filter((r) => !oldKeys.has(routeKey(r.route)));
75676
+ const removed = oldRoutes.filter((r) => !newKeys.has(routeKey(r.route)));
75677
+ const previousSpecs = pickSpecsFromState(previousState);
75678
+ const rebuiltLambdas = [];
75679
+ for (const [logicalId, newSpec] of material.specs) {
75680
+ const oldSpec = previousSpecs.get(logicalId);
75681
+ if (!oldSpec)
75682
+ continue;
75683
+ if (specSignature(oldSpec) !== specSignature(newSpec)) {
75684
+ rebuiltLambdas.push(logicalId);
75685
+ }
75686
+ }
75687
+ const newPool = deps.buildPool(material.specs);
75688
+ Object.defineProperty(newPool, "__cdkdSpecs", {
75689
+ value: material.specs,
75690
+ enumerable: false,
75691
+ configurable: true
75692
+ });
75693
+ const newState = {
75694
+ routes: material.routes,
75695
+ pool: newPool,
75696
+ corsConfigByApiId: material.corsConfigByApiId
75697
+ };
75698
+ deps.setServerState(newState);
75699
+ void previousState.pool.dispose().catch(
75700
+ (err) => logger.debug(
75701
+ `Previous pool dispose() failed: ${err instanceof Error ? err.message : String(err)}`
75702
+ )
75703
+ );
75704
+ const elapsed = Date.now() - start;
75705
+ logger.info(
75706
+ `Reloaded in ${elapsed}ms: +${added.length} route(s), -${removed.length} route(s), ${rebuiltLambdas.length} Lambda(s) rebuilt.`
75707
+ );
75708
+ return {
75709
+ ok: true,
75710
+ added,
75711
+ removed,
75712
+ rebuiltLambdas,
75713
+ newState
75714
+ };
75715
+ }
75716
+ function routeKey(route) {
75717
+ return [route.method, route.pathPattern, route.lambdaLogicalId, route.source, route.apiVersion].map((s) => String(s)).join("|");
75718
+ }
75719
+ function specSignature(spec) {
75720
+ return JSON.stringify({
75721
+ codeDir: spec.codeDir,
75722
+ env: spec.env,
75723
+ handler: spec.lambda.handler,
75724
+ runtime: spec.lambda.runtime,
75725
+ containerHost: spec.containerHost,
75726
+ debugPort: spec.debugPort ?? null
75727
+ });
75728
+ }
75729
+ function pickSpecsFromState(state) {
75730
+ const tagged = state.pool.__cdkdSpecs;
75731
+ return tagged ?? /* @__PURE__ */ new Map();
75732
+ }
75733
+
73465
75734
  // src/local/authorizer-cache.ts
73466
75735
  function createAuthorizerCache(opts = {}) {
73467
75736
  const now = opts.now ?? (() => Date.now());
@@ -73515,67 +75784,123 @@ async function localStartApiCommand(options) {
73515
75784
  if (!appCmd) {
73516
75785
  throw new Error('No CDK app specified. Pass --app, set CDKD_APP, or add "app" to cdk.json.');
73517
75786
  }
73518
- logger.info("Synthesizing CDK app...");
73519
- const synthesizer = new Synthesizer();
73520
- const context = parseContextOptions(options.context);
73521
- const synthOpts = {
73522
- app: appCmd,
73523
- output: options.output,
73524
- ...options.region && { region: options.region },
73525
- ...options.profile && { profile: options.profile },
73526
- ...Object.keys(context).length > 0 && { context }
73527
- };
73528
- const { stacks } = await synthesizer.synthesize(synthOpts);
73529
- const targetStacks = pickTargetStacks(stacks, options.stack);
73530
- if (targetStacks.length === 0) {
73531
- throw new Error("No stacks matched. Pass --stack <name> or run from a single-stack app.");
73532
- }
73533
- const routes = discoverRoutes(targetStacks);
73534
- if (routes.length === 0) {
73535
- throw new Error(
73536
- "No supported API routes were discovered. cdkd local start-api supports AWS::ApiGateway::* (REST v1), AWS::ApiGatewayV2::* (HTTP), and AWS::Lambda::Url (Function URL) with AWS_PROXY integrations only."
73537
- );
73538
- }
73539
- const routesWithAuth = attachAuthorizers(targetStacks, routes);
73540
- const lambdaIds = uniqueLambdaIds(routes, routesWithAuth);
73541
75787
  const overrides = readEnvOverridesFile(options.envVars);
73542
75788
  const debugPortBase = options.debugPortBase ? parseDebugPort(options.debugPortBase) : void 0;
73543
- const specs = /* @__PURE__ */ new Map();
75789
+ const perLambdaConcurrency = parsePerLambdaConcurrency(options.perLambdaConcurrency);
73544
75790
  const inlineTmpDirs = /* @__PURE__ */ new Set();
73545
75791
  const layerTmpDirs = /* @__PURE__ */ new Set();
73546
- for (let i = 0; i < lambdaIds.length; i++) {
73547
- const logicalId = lambdaIds[i];
73548
- const spec = await buildContainerSpec({
73549
- logicalId,
73550
- stacks: targetStacks,
73551
- overrides,
73552
- assumeRole: options.assumeRole,
73553
- containerHost: options.containerHost,
73554
- ...debugPortBase !== void 0 && { debugPort: debugPortBase + i },
73555
- stsRegion: options.region ?? process.env["AWS_REGION"] ?? process.env["AWS_DEFAULT_REGION"],
73556
- inlineTmpDirs,
73557
- layerTmpDirs
75792
+ const lastAssetPaths = { value: [] };
75793
+ const authorizerCache = createAuthorizerCache();
75794
+ const jwksCache = createJwksCache();
75795
+ const jwksWarnedUrls = /* @__PURE__ */ new Set();
75796
+ const synthesizeAndBuild = async () => {
75797
+ logger.info("Synthesizing CDK app...");
75798
+ const synthesizer = new Synthesizer();
75799
+ const context = parseContextOptions(options.context);
75800
+ const synthOpts = {
75801
+ app: appCmd,
75802
+ output: options.output,
75803
+ ...options.region && { region: options.region },
75804
+ ...options.profile && { profile: options.profile },
75805
+ ...Object.keys(context).length > 0 && { context }
75806
+ };
75807
+ const { stacks } = await synthesizer.synthesize(synthOpts);
75808
+ const targetStacks = pickTargetStacks(stacks, options.stack);
75809
+ if (targetStacks.length === 0) {
75810
+ throw new Error("No stacks matched. Pass --stack <name> or run from a single-stack app.");
75811
+ }
75812
+ const routes = discoverRoutes(targetStacks);
75813
+ if (routes.length === 0) {
75814
+ throw new Error(
75815
+ "No supported API routes were discovered. cdkd local start-api supports AWS::ApiGateway::* (REST v1), AWS::ApiGatewayV2::* (HTTP), and AWS::Lambda::Url (Function URL) with AWS_PROXY integrations only."
75816
+ );
75817
+ }
75818
+ const stageMap = /* @__PURE__ */ new Map();
75819
+ for (const stack of targetStacks) {
75820
+ const m = buildStageMap(stack.template, options.stage);
75821
+ for (const [k, v] of m)
75822
+ stageMap.set(k, v);
75823
+ }
75824
+ if (options.stage) {
75825
+ const missingApis = /* @__PURE__ */ new Set();
75826
+ for (const r of routes) {
75827
+ if (!r.apiLogicalId)
75828
+ continue;
75829
+ if (!stageMap.has(r.apiLogicalId))
75830
+ missingApis.add(r.apiLogicalId);
75831
+ }
75832
+ for (const apiId of missingApis) {
75833
+ logger.warn(
75834
+ `--stage '${options.stage}' did not match any Stage on API '${apiId}'; routes on that API will get stageVariables: null.`
75835
+ );
75836
+ }
75837
+ }
75838
+ attachStageContext(routes, stageMap);
75839
+ const routesWithAuth = attachAuthorizers(targetStacks, routes);
75840
+ const corsConfigByApiId = /* @__PURE__ */ new Map();
75841
+ for (const stack of targetStacks) {
75842
+ const m = buildCorsConfigByApiId(stack.template);
75843
+ for (const [k, v] of m)
75844
+ corsConfigByApiId.set(k, v);
75845
+ }
75846
+ const lambdaIds = uniqueLambdaIds(routes, routesWithAuth);
75847
+ const specs = /* @__PURE__ */ new Map();
75848
+ for (let i = 0; i < lambdaIds.length; i++) {
75849
+ const logicalId = lambdaIds[i];
75850
+ const spec = await buildContainerSpec({
75851
+ logicalId,
75852
+ stacks: targetStacks,
75853
+ overrides,
75854
+ assumeRole: options.assumeRole,
75855
+ containerHost: options.containerHost,
75856
+ ...debugPortBase !== void 0 && { debugPort: debugPortBase + i },
75857
+ stsRegion: options.region ?? process.env["AWS_REGION"] ?? process.env["AWS_DEFAULT_REGION"],
75858
+ inlineTmpDirs,
75859
+ layerTmpDirs
75860
+ });
75861
+ specs.set(logicalId, spec);
75862
+ }
75863
+ const distinctImages = /* @__PURE__ */ new Set();
75864
+ for (const spec of specs.values()) {
75865
+ distinctImages.add(resolveRuntimeImage(spec.lambda.runtime));
75866
+ }
75867
+ for (const image of distinctImages) {
75868
+ await pullImage(image, options.pull === false);
75869
+ }
75870
+ return { routes: routesWithAuth, specs, corsConfigByApiId, stacks: targetStacks };
75871
+ };
75872
+ const buildPool = (specs) => {
75873
+ const pool = createContainerPool(specs, {
75874
+ perLambdaConcurrency,
75875
+ skipPull: options.pull === false
73558
75876
  });
73559
- specs.set(logicalId, spec);
73560
- }
73561
- const distinctImages = /* @__PURE__ */ new Set();
73562
- for (const spec of specs.values()) {
73563
- distinctImages.add(resolveRuntimeImage(spec.lambda.runtime));
73564
- }
73565
- for (const image of distinctImages) {
73566
- await pullImage(image, options.pull === false);
73567
- }
73568
- const perLambdaConcurrency = parsePerLambdaConcurrency(options.perLambdaConcurrency);
73569
- const pool = createContainerPool(specs, {
73570
- perLambdaConcurrency,
73571
- skipPull: options.pull === false
73572
- });
75877
+ Object.defineProperty(pool, "__cdkdSpecs", {
75878
+ value: specs,
75879
+ enumerable: false,
75880
+ configurable: true
75881
+ });
75882
+ return pool;
75883
+ };
75884
+ const computeAssetPaths = (specs) => {
75885
+ const assetPaths = /* @__PURE__ */ new Set();
75886
+ for (const spec of specs.values()) {
75887
+ assetPaths.add(spec.codeDir);
75888
+ }
75889
+ return [...assetPaths];
75890
+ };
75891
+ const initialMaterial = await synthesizeAndBuild();
75892
+ const initialPool = buildPool(initialMaterial.specs);
75893
+ lastAssetPaths.value = computeAssetPaths(initialMaterial.specs);
75894
+ await prewarmJwks(initialMaterial.routes, jwksCache);
75895
+ warnVpcConfigLambdas(initialMaterial.routes, initialMaterial.stacks ?? []);
73573
75896
  if (options.warm) {
73574
- logger.info(`Pre-warming ${specs.size} container(s)...`);
73575
- const handles = await Promise.allSettled([...specs.keys()].map((id) => pool.acquire(id)));
75897
+ logger.info(`Pre-warming ${initialMaterial.specs.size} container(s)...`);
75898
+ const handles = await Promise.allSettled(
75899
+ [...initialMaterial.specs.keys()].map((id) => initialPool.acquire(id))
75900
+ );
73576
75901
  for (const result of handles) {
73577
75902
  if (result.status === "fulfilled") {
73578
- pool.release(result.value);
75903
+ initialPool.release(result.value);
73579
75904
  } else {
73580
75905
  logger.warn(
73581
75906
  `Pre-warm failed for one Lambda (cold start cost will apply on first request): ${result.reason instanceof Error ? result.reason.message : String(result.reason)}`
@@ -73584,7 +75909,7 @@ async function localStartApiCommand(options) {
73584
75909
  }
73585
75910
  }
73586
75911
  let maxTimeoutSec = 0;
73587
- for (const spec of specs.values()) {
75912
+ for (const spec of initialMaterial.specs.values()) {
73588
75913
  if (spec.lambda.timeoutSec > maxTimeoutSec)
73589
75914
  maxTimeoutSec = spec.lambda.timeoutSec;
73590
75915
  }
@@ -73593,14 +75918,13 @@ async function localStartApiCommand(options) {
73593
75918
  if (!Number.isFinite(port) || port < 0 || port > 65535) {
73594
75919
  throw new Error(`--port must be 0..65535 (got ${options.port}).`);
73595
75920
  }
73596
- const authorizerCache = createAuthorizerCache();
73597
- const jwksCache = createJwksCache();
73598
- const jwksWarnedUrls = /* @__PURE__ */ new Set();
73599
- await prewarmJwks(routesWithAuth, jwksCache);
73600
- warnVpcConfigLambdas(routesWithAuth, targetStacks);
75921
+ const initialState = {
75922
+ routes: initialMaterial.routes,
75923
+ pool: initialPool,
75924
+ corsConfigByApiId: initialMaterial.corsConfigByApiId
75925
+ };
73601
75926
  const server = await startApiServer({
73602
- routes: routesWithAuth,
73603
- pool,
75927
+ state: initialState,
73604
75928
  rieTimeoutMs,
73605
75929
  host: options.host,
73606
75930
  port,
@@ -73608,13 +75932,49 @@ async function localStartApiCommand(options) {
73608
75932
  jwksCache,
73609
75933
  jwksWarnedUrls
73610
75934
  });
73611
- printRouteTable(routes);
75935
+ printRouteTable(initialMaterial.routes);
73612
75936
  logger.info(
73613
75937
  `Per-Lambda concurrency: ${perLambdaConcurrency} (override with --per-lambda-concurrency)`
73614
75938
  );
73615
75939
  process.stdout.write(`Server listening on http://${server.host}:${server.port}
73616
75940
  `);
73617
75941
  process.stdout.write("^C to stop and clean up containers.\n");
75942
+ let watcher;
75943
+ let orchestrator;
75944
+ if (options.watch) {
75945
+ orchestrator = createReloadOrchestrator({
75946
+ synthesizeAndBuild,
75947
+ buildPool,
75948
+ setServerState: server.setServerState,
75949
+ getServerState: server.getServerState
75950
+ });
75951
+ const initialWatchPaths = [options.output, ...lastAssetPaths.value];
75952
+ watcher = createFileWatcher({
75953
+ paths: initialWatchPaths,
75954
+ onChange: () => {
75955
+ if (!orchestrator)
75956
+ return;
75957
+ logger.info("Detected file change; reloading...");
75958
+ void orchestrator.reload().then((result) => {
75959
+ if (result.ok && watcher && result.newState) {
75960
+ const taggedSpecs = result.newState.pool.__cdkdSpecs;
75961
+ if (taggedSpecs) {
75962
+ lastAssetPaths.value = computeAssetPaths(taggedSpecs);
75963
+ }
75964
+ watcher.update([options.output, ...lastAssetPaths.value]);
75965
+ if (result.added.length > 0 || result.removed.length > 0) {
75966
+ printRouteTable(result.newState.routes);
75967
+ }
75968
+ }
75969
+ }).catch((err) => {
75970
+ logger.warn(
75971
+ `Reload failed: ${err instanceof Error ? err.message : String(err)}. Keeping previous version.`
75972
+ );
75973
+ });
75974
+ }
75975
+ });
75976
+ logger.info(`Watching ${options.output} (and ${lastAssetPaths.value.length} asset dir(s))`);
75977
+ }
73618
75978
  let shuttingDown = false;
73619
75979
  let forceExitArmed = false;
73620
75980
  const shutdown = async (signal, exitCode) => {
@@ -73630,13 +75990,20 @@ async function localStartApiCommand(options) {
73630
75990
  }
73631
75991
  shuttingDown = true;
73632
75992
  logger.info(`Received ${signal}, shutting down...`);
75993
+ if (watcher) {
75994
+ try {
75995
+ await watcher.close();
75996
+ } catch (err) {
75997
+ logger.warn(`watcher.close() failed: ${err instanceof Error ? err.message : String(err)}`);
75998
+ }
75999
+ }
73633
76000
  try {
73634
76001
  await server.close();
73635
76002
  } catch (err) {
73636
76003
  logger.warn(`server.close() failed: ${err instanceof Error ? err.message : String(err)}`);
73637
76004
  }
73638
76005
  try {
73639
- await pool.dispose();
76006
+ await server.getServerState().pool.dispose();
73640
76007
  } catch (err) {
73641
76008
  logger.warn(`pool.dispose() failed: ${err instanceof Error ? err.message : String(err)}`);
73642
76009
  }
@@ -73895,7 +76262,8 @@ function resolveAssetCodePath2(stack, logicalId, resource) {
73895
76262
  return path.isAbsolute(assetPath) ? assetPath : path.resolve(cdkOutDir, assetPath);
73896
76263
  }
73897
76264
  function printRouteTable(routes) {
73898
- const sorted = [...routes].sort((a, b) => {
76265
+ const flat = routes.map((r) => r.route);
76266
+ const sorted = [...flat].sort((a, b) => {
73899
76267
  if (a.pathPattern !== b.pathPattern)
73900
76268
  return a.pathPattern.localeCompare(b.pathPattern);
73901
76269
  return a.method.localeCompare(b.method);
@@ -74049,6 +76417,16 @@ function createLocalStartApiCommand() {
74049
76417
  "--assume-role <arn-or-pair>",
74050
76418
  "Assume the Lambda's execution role and forward STS-issued temp creds. Bare <arn> = global default; <LogicalId>=<arn> = per-Lambda override (repeatable). Per-Lambda > global > unset (developer creds passed through)."
74051
76419
  ).argParser((raw, prev) => parseAssumeRoleToken(raw, prev))
76420
+ ).addOption(
76421
+ new Option7(
76422
+ "--watch",
76423
+ "Hot-reload: re-synth + re-discover routes when cdk.out/ or asset directories change. Off by default; the server keeps the previous version serving when synth fails mid-reload."
76424
+ ).default(false)
76425
+ ).addOption(
76426
+ new Option7(
76427
+ "--stage <name>",
76428
+ "Select an API Gateway Stage by its 'StageName'. Default: the first Stage attached to each API. Drives event.stageVariables for both REST v1 and HTTP API v2. NOTE: For HTTP API v2 routes, requestContext.stage is always '$default' regardless of this flag (AWS-side limitation \u2014 HTTP API only exposes one stage to the integration event); only event.stageVariables is affected for v2 routes. For REST v1 routes the selected StageName is also threaded into requestContext.stage."
76429
+ )
74052
76430
  ).action(withErrorHandling(localStartApiCommand));
74053
76431
  [...commonOptions, ...appOptions, ...contextOptions].forEach((opt) => startApi.addOption(opt));
74054
76432
  startApi.addOption(deprecatedRegionOption);
@@ -74329,7 +76707,7 @@ async function resolveLocalBuildPlan(lambda) {
74329
76707
  const manifestPath = lambda.stack.assetManifestPath;
74330
76708
  if (!manifestPath)
74331
76709
  return void 0;
74332
- const cdkOutDir = dirname3(manifestPath);
76710
+ const cdkOutDir = dirname5(manifestPath);
74333
76711
  const loader = new AssetManifestLoader();
74334
76712
  const manifest = await loader.loadManifest(cdkOutDir, lambda.stack.stackName);
74335
76713
  if (!manifest)
@@ -74633,7 +77011,7 @@ function reorderArgs(argv) {
74633
77011
  }
74634
77012
  async function main() {
74635
77013
  const program = new Command16();
74636
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.74.0");
77014
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.75.1");
74637
77015
  program.addCommand(createBootstrapCommand());
74638
77016
  program.addCommand(createSynthCommand());
74639
77017
  program.addCommand(createListCommand());
@@ -74654,4 +77032,9 @@ main().catch((error) => {
74654
77032
  console.error("Fatal error:", error);
74655
77033
  process.exit(1);
74656
77034
  });
77035
+ /*! Bundled license information:
77036
+
77037
+ chokidar/index.js:
77038
+ (*! chokidar - MIT License (c) 2012 Paul Miller (paulmillr.com) *)
77039
+ */
74657
77040
  //# sourceMappingURL=cli.js.map