@awsless/awsless 0.0.435 → 0.0.436

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin.js CHANGED
@@ -7588,7 +7588,7 @@ var AlertsDefaultSchema = z2.record(
7588
7588
  ).optional().describe("Define the alerts in your app. Alerts are a way to send messages to one or more email addresses.");
7589
7589
 
7590
7590
  // src/feature/auth/schema.ts
7591
- import { z as z8 } from "zod";
7591
+ import { z as z9 } from "zod";
7592
7592
 
7593
7593
  // src/config/schema/resource-id.ts
7594
7594
  import { paramCase as paramCase2 } from "change-case";
@@ -7598,7 +7598,7 @@ var ResourceIdSchema = z3.string().min(3).max(24).regex(/^[a-z0-9\-]+$/i, "Inval
7598
7598
  // src/feature/function/schema.ts
7599
7599
  import { days, minutes as minutes2, seconds, toDays } from "@awsless/duration";
7600
7600
  import { gibibytes, mebibytes } from "@awsless/size";
7601
- import { z as z7 } from "zod";
7601
+ import { z as z8 } from "zod";
7602
7602
 
7603
7603
  // src/config/schema/duration.ts
7604
7604
  import { z as z4 } from "zod";
@@ -7615,6 +7615,10 @@ var durationMax = (max) => {
7615
7615
  };
7616
7616
  };
7617
7617
 
7618
+ // src/config/schema/local-directory.ts
7619
+ import { stat as stat2 } from "fs/promises";
7620
+ import { z as z6 } from "zod";
7621
+
7618
7622
  // src/config/schema/local-file.ts
7619
7623
  import { stat } from "fs/promises";
7620
7624
  import { join as join3 } from "path";
@@ -7638,10 +7642,20 @@ var LocalFileSchema = z5.string().transform((path) => resolvePath(path)).refine(
7638
7642
  }
7639
7643
  }, `File doesn't exist`);
7640
7644
 
7645
+ // src/config/schema/local-directory.ts
7646
+ var LocalDirectorySchema = z6.string().transform((path) => resolvePath(path)).refine(async (path) => {
7647
+ try {
7648
+ const s = await stat2(path);
7649
+ return s.isDirectory();
7650
+ } catch (error) {
7651
+ return false;
7652
+ }
7653
+ }, `Directory doesn't exist`);
7654
+
7641
7655
  // src/config/schema/size.ts
7642
- import { z as z6 } from "zod";
7656
+ import { z as z7 } from "zod";
7643
7657
  import { parse as parse2 } from "@awsless/size";
7644
- var SizeSchema = z6.string().regex(/^[0-9]+ (B|KB|MB|GB|TB|PB)$/, "Invalid size").transform((v) => parse2(v));
7658
+ var SizeSchema = z7.string().regex(/^[0-9]+ (B|KB|MB|GB|TB|PB)$/, "Invalid size").transform((v) => parse2(v));
7645
7659
  var sizeMin = (min) => {
7646
7660
  return (size) => {
7647
7661
  return size.value >= min.value;
@@ -7664,33 +7678,32 @@ var EphemeralStorageSizeSchema = SizeSchema.refine(
7664
7678
  sizeMin(mebibytes(512)),
7665
7679
  "Minimum ephemeral storage size is 512 MB"
7666
7680
  ).refine(sizeMax(gibibytes(10)), "Minimum ephemeral storage size is 10 GB").describe("The size of the function's /tmp directory. You can specify a size value from 512 MB to 10 GB.");
7667
- var ReservedConcurrentExecutionsSchema = z7.number().int().min(0).describe("The number of simultaneous executions to reserve for the function. You can specify a number from 0.");
7668
- var EnvironmentSchema = z7.record(z7.string(), z7.string()).optional().describe("Environment variable key-value pairs.");
7669
- var ArchitectureSchema = z7.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the function supports.");
7670
- var RetryAttemptsSchema = z7.number().int().min(0).max(2).describe(
7681
+ var ReservedConcurrentExecutionsSchema = z8.number().int().min(0).describe("The number of simultaneous executions to reserve for the function. You can specify a number from 0.");
7682
+ var EnvironmentSchema = z8.record(z8.string(), z8.string()).optional().describe("Environment variable key-value pairs.");
7683
+ var ArchitectureSchema = z8.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the function supports.");
7684
+ var RetryAttemptsSchema = z8.number().int().min(0).max(2).describe(
7671
7685
  "The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
7672
7686
  );
7673
- var NodeRuntimeSchema = z7.enum(["nodejs18.x", "nodejs20.x", "nodejs22.x"]).describe("The identifier of the function's runtime.");
7674
- var ContainerRuntimeSchema = z7.literal("container").describe("The identifier of the function's runtime.");
7675
- var RuntimeSchema = NodeRuntimeSchema.or(ContainerRuntimeSchema);
7676
- var ActionSchema = z7.string();
7677
- var ActionsSchema = z7.union([ActionSchema.transform((v) => [v]), ActionSchema.array()]);
7678
- var ArnSchema = z7.string().startsWith("arn:").transform((v) => v);
7679
- var WildcardSchema = z7.literal("*");
7680
- var ResourceSchema = z7.union([ArnSchema, WildcardSchema]);
7681
- var ResourcesSchema = z7.union([ResourceSchema.transform((v) => [v]), ResourceSchema.array()]);
7682
- var PermissionSchema = z7.object({
7683
- effect: z7.enum(["allow", "deny"]).default("allow"),
7687
+ var NodeRuntimeSchema = z8.enum(["nodejs18.x", "nodejs20.x", "nodejs22.x"]);
7688
+ var ContainerRuntimeSchema = z8.literal("container");
7689
+ var RuntimeSchema = NodeRuntimeSchema.or(ContainerRuntimeSchema).describe("The identifier of the function's runtime.");
7690
+ var ActionSchema = z8.string();
7691
+ var ActionsSchema = z8.union([ActionSchema.transform((v) => [v]), ActionSchema.array()]);
7692
+ var ArnSchema = z8.string().startsWith("arn:").transform((v) => v);
7693
+ var WildcardSchema = z8.literal("*");
7694
+ var ResourceSchema = z8.union([ArnSchema, WildcardSchema]);
7695
+ var ResourcesSchema = z8.union([ResourceSchema.transform((v) => [v]), ResourceSchema.array()]);
7696
+ var PermissionSchema = z8.object({
7697
+ effect: z8.enum(["allow", "deny"]).default("allow"),
7684
7698
  actions: ActionsSchema,
7685
7699
  resources: ResourcesSchema
7686
7700
  });
7687
- var PermissionsSchema = z7.union([PermissionSchema.transform((v) => [v]), PermissionSchema.array()]).describe("Add IAM permissions to your function.");
7688
- var WarmSchema = z7.number().int().min(0).max(10).describe("Specify how many functions you want to warm up each 5 minutes. You can specify a number from 0 to 10.");
7689
- var VPCSchema = z7.boolean().describe("Put the function inside your global VPC.");
7690
- var MinifySchema = z7.boolean().describe("Minify the function code.");
7691
- var HandlerSchema = z7.string().describe("The name of the exported method within your code that Lambda calls to run your function.");
7692
- var FileSchema = LocalFileSchema.describe("The file path of the function code.");
7693
- var DescriptionSchema = z7.string().describe("A description of the function.");
7701
+ var PermissionsSchema = z8.union([PermissionSchema.transform((v) => [v]), PermissionSchema.array()]).describe("Add IAM permissions to your function.");
7702
+ var WarmSchema = z8.number().int().min(0).max(10).describe("Specify how many functions you want to warm up each 5 minutes. You can specify a number from 0 to 10.");
7703
+ var VPCSchema = z8.boolean().describe("Put the function inside your global VPC.");
7704
+ var MinifySchema = z8.boolean().describe("Minify the function code.");
7705
+ var HandlerSchema = z8.string().describe("The name of the exported method within your code that Lambda calls to run your function.");
7706
+ var DescriptionSchema = z8.string().describe("A description of the function.");
7694
7707
  var validLogRetentionDays = [
7695
7708
  ...[1n, 3n, 5n, 7n, 14n, 30n, 60n, 90n, 120n, 150n],
7696
7709
  ...[180n, 365n, 400n, 545n, 731n, 1096n, 1827n, 2192n],
@@ -7705,47 +7718,59 @@ var LogRetentionSchema = DurationSchema.refine(
7705
7718
  },
7706
7719
  `Invalid log retention. Valid days are: ${validLogRetentionDays.map((days7) => `${days7}`).join(", ")}`
7707
7720
  ).describe("The log retention duration.");
7708
- var LogSubscriptionSchema = z7.union([
7721
+ var LogSubscriptionSchema = z8.union([
7709
7722
  LocalFileSchema.transform((file) => ({
7710
7723
  file
7711
7724
  })),
7712
- z7.object({
7725
+ z8.object({
7713
7726
  subscriber: LocalFileSchema,
7714
- filter: z7.string().optional()
7727
+ filter: z8.string().optional()
7715
7728
  })
7716
7729
  ]).describe(
7717
7730
  "Log Subscription allow you to subscribe to a real-time stream of log events and have them delivered to a specific destination"
7718
7731
  );
7719
- var LogSchema = z7.union([
7720
- z7.boolean().transform((enabled) => ({ retention: enabled ? days(7) : days(0) })),
7732
+ var LogSchema = z8.union([
7733
+ z8.boolean().transform((enabled) => ({ retention: enabled ? days(7) : days(0) })),
7721
7734
  LogRetentionSchema.transform((retention) => ({ retention })),
7722
- z7.object({
7735
+ z8.object({
7723
7736
  subscription: LogSubscriptionSchema.optional(),
7724
7737
  retention: LogRetentionSchema.optional(),
7725
- format: z7.enum(["text", "json"]).describe(
7738
+ format: z8.enum(["text", "json"]).describe(
7726
7739
  `The format in which Lambda sends your function's application and system logs to CloudWatch. Select between plain text and structured JSON.`
7727
7740
  ).optional(),
7728
- system: z7.enum(["debug", "info", "warn"]).describe(
7741
+ system: z8.enum(["debug", "info", "warn"]).describe(
7729
7742
  "Set this property to filter the system logs for your function that Lambda sends to CloudWatch. Lambda only sends system logs at the selected level of detail and lower, where DEBUG is the highest level and WARN is the lowest."
7730
7743
  ).optional(),
7731
- level: z7.enum(["trace", "debug", "info", "warn", "error", "fatal"]).describe(
7744
+ level: z8.enum(["trace", "debug", "info", "warn", "error", "fatal"]).describe(
7732
7745
  "Set this property to filter the application logs for your function that Lambda sends to CloudWatch. Lambda only sends application logs at the selected level of detail and lower, where TRACE is the highest level and FATAL is the lowest."
7733
7746
  ).optional()
7734
7747
  })
7735
7748
  ]).describe("Enable logging to a CloudWatch log group. Providing a duration value will set the log retention time.");
7736
- var LayersSchema = z7.string().array().describe(
7749
+ var LayersSchema = z8.string().array().describe(
7737
7750
  // `A list of function layers to add to the function's execution environment..`
7738
7751
  `A list of function layers to add to the function's execution environment. Specify each layer by its ARN, including the version.`
7739
7752
  );
7740
- var BuildSchema = z7.object({
7741
- minify: MinifySchema.default(true),
7742
- external: z7.string().array().optional().describe(`A list of external packages that won't be included in the bundle.`)
7743
- }).describe(`Options for the function bundler`);
7744
- var FnSchema = z7.object({
7745
- file: FileSchema,
7753
+ var FileCodeSchema = z8.object({
7754
+ file: LocalFileSchema.describe("The file path of the function code."),
7755
+ minify: MinifySchema.optional().default(true),
7756
+ external: z8.string().array().optional().describe(`A list of external packages that won't be included in the bundle.`)
7757
+ });
7758
+ var BundleCodeSchema = z8.object({
7759
+ bundle: LocalDirectorySchema.describe("The directory that needs to be bundled.")
7760
+ });
7761
+ var CodeSchema = z8.union([
7762
+ LocalFileSchema.transform((file) => ({
7763
+ file
7764
+ })),
7765
+ FileCodeSchema,
7766
+ BundleCodeSchema
7767
+ ]).describe("Specify the code of your function.");
7768
+ var FnSchema = z8.object({
7769
+ code: CodeSchema,
7746
7770
  // node
7747
7771
  handler: HandlerSchema.optional(),
7748
- build: BuildSchema.optional(),
7772
+ // build: BuildSchema.optional(),
7773
+ // bundle: BundleSchema.optional(),
7749
7774
  // container
7750
7775
  // ...
7751
7776
  runtime: RuntimeSchema.optional(),
@@ -7763,20 +7788,23 @@ var FnSchema = z7.object({
7763
7788
  environment: EnvironmentSchema.optional(),
7764
7789
  permissions: PermissionsSchema.optional()
7765
7790
  });
7766
- var FunctionSchema = z7.union([
7791
+ var FunctionSchema = z8.union([
7767
7792
  LocalFileSchema.transform((file) => ({
7768
- file
7793
+ code: {
7794
+ file
7795
+ }
7769
7796
  })),
7770
7797
  FnSchema
7771
7798
  ]);
7772
- var FunctionsSchema = z7.record(ResourceIdSchema, FunctionSchema).optional().describe("Define the functions in your stack.");
7773
- var FunctionDefaultSchema = z7.object({
7799
+ var FunctionsSchema = z8.record(ResourceIdSchema, FunctionSchema).optional().describe("Define the functions in your stack.");
7800
+ var FunctionDefaultSchema = z8.object({
7774
7801
  runtime: RuntimeSchema.default("nodejs20.x"),
7775
7802
  // node
7776
7803
  handler: HandlerSchema.default("index.default"),
7777
- build: BuildSchema.default({
7778
- minify: true
7779
- }),
7804
+ // build: BuildSchema.default({
7805
+ // type: 'simple',
7806
+ // minify: true,
7807
+ // }),
7780
7808
  // container
7781
7809
  warm: WarmSchema.default(0),
7782
7810
  vpc: VPCSchema.default(false),
@@ -7798,7 +7826,7 @@ var FunctionDefaultSchema = z7.object({
7798
7826
  }).default({});
7799
7827
 
7800
7828
  // src/feature/auth/schema.ts
7801
- var TriggersSchema = z8.object({
7829
+ var TriggersSchema = z9.object({
7802
7830
  beforeToken: FunctionSchema.optional().describe("A pre jwt token generation AWS Lambda trigger."),
7803
7831
  beforeLogin: FunctionSchema.optional().describe("A pre user login AWS Lambda trigger."),
7804
7832
  afterLogin: FunctionSchema.optional().describe("A post user login AWS Lambda trigger."),
@@ -7811,42 +7839,42 @@ var TriggersSchema = z8.object({
7811
7839
  createChallenge: FunctionSchema.optional().describe("Creates an authentication challenge."),
7812
7840
  verifyChallenge: FunctionSchema.optional().describe("Verifies the authentication challenge response.")
7813
7841
  }).describe("Specifies the configuration for AWS Lambda triggers.");
7814
- var AuthSchema = z8.record(
7842
+ var AuthSchema = z9.record(
7815
7843
  ResourceIdSchema,
7816
- z8.object({
7817
- access: z8.boolean().default(false).describe("Give access to every function in this stack to your cognito instance."),
7844
+ z9.object({
7845
+ access: z9.boolean().default(false).describe("Give access to every function in this stack to your cognito instance."),
7818
7846
  triggers: TriggersSchema.optional()
7819
7847
  })
7820
7848
  ).optional().describe("Define the auth triggers in your stack.");
7821
- var AuthDefaultSchema = z8.record(
7849
+ var AuthDefaultSchema = z9.record(
7822
7850
  ResourceIdSchema,
7823
- z8.object({
7824
- allowUserRegistration: z8.boolean().default(true).describe("Specifies whether users can create an user account or if only the administrator can."),
7825
- messaging: z8.object({
7851
+ z9.object({
7852
+ allowUserRegistration: z9.boolean().default(true).describe("Specifies whether users can create an user account or if only the administrator can."),
7853
+ messaging: z9.object({
7826
7854
  fromEmail: EmailSchema.describe("Specifies the sender's email address."),
7827
- fromName: z8.string().optional().describe("Specifies the sender's name."),
7855
+ fromName: z9.string().optional().describe("Specifies the sender's name."),
7828
7856
  replyTo: EmailSchema.optional().describe(
7829
7857
  "The destination to which the receiver of the email should reply."
7830
7858
  )
7831
7859
  }).optional().describe("The email configuration for sending messages."),
7832
7860
  // secret: z.boolean().default(false).describe('Specifies whether you want to generate a client secret.'),
7833
- username: z8.object({
7834
- emailAlias: z8.boolean().default(true).describe("Allow the user email to be used as username."),
7835
- caseSensitive: z8.boolean().default(false).describe(
7861
+ username: z9.object({
7862
+ emailAlias: z9.boolean().default(true).describe("Allow the user email to be used as username."),
7863
+ caseSensitive: z9.boolean().default(false).describe(
7836
7864
  "Specifies whether username case sensitivity will be enabled. When usernames and email addresses are case insensitive, users can sign in as the same user when they enter a different capitalization of their user name."
7837
7865
  )
7838
7866
  }).default({}).describe("The username policy."),
7839
- password: z8.object({
7840
- minLength: z8.number().int().min(6).max(99).default(12).describe("Required users to have at least the minimum password length."),
7841
- uppercase: z8.boolean().default(true).describe("Required users to use at least one uppercase letter in their password."),
7842
- lowercase: z8.boolean().default(true).describe("Required users to use at least one lowercase letter in their password."),
7843
- numbers: z8.boolean().default(true).describe("Required users to use at least one number in their password."),
7844
- symbols: z8.boolean().default(true).describe("Required users to use at least one symbol in their password."),
7867
+ password: z9.object({
7868
+ minLength: z9.number().int().min(6).max(99).default(12).describe("Required users to have at least the minimum password length."),
7869
+ uppercase: z9.boolean().default(true).describe("Required users to use at least one uppercase letter in their password."),
7870
+ lowercase: z9.boolean().default(true).describe("Required users to use at least one lowercase letter in their password."),
7871
+ numbers: z9.boolean().default(true).describe("Required users to use at least one number in their password."),
7872
+ symbols: z9.boolean().default(true).describe("Required users to use at least one symbol in their password."),
7845
7873
  temporaryPasswordValidity: DurationSchema.default("7 days").describe(
7846
7874
  "The duration a temporary password is valid. If the user doesn't sign in during this time, an administrator must reset their password."
7847
7875
  )
7848
7876
  }).default({}).describe("The password policy."),
7849
- validity: z8.object({
7877
+ validity: z9.object({
7850
7878
  idToken: DurationSchema.default("1 hour").describe(
7851
7879
  "The ID token time limit. After this limit expires, your user can't use their ID token."
7852
7880
  ),
@@ -7862,18 +7890,18 @@ var AuthDefaultSchema = z8.record(
7862
7890
  ).default({}).describe("Define the authenticatable users in your app.");
7863
7891
 
7864
7892
  // src/feature/domain/schema.ts
7865
- import { z as z9 } from "zod";
7866
- var DomainNameSchema = z9.string().regex(/[a-z\-\_\.]/g, "Invalid domain name").describe(
7893
+ import { z as z10 } from "zod";
7894
+ var DomainNameSchema = z10.string().regex(/[a-z\-\_\.]/g, "Invalid domain name").describe(
7867
7895
  "Enter a fully qualified domain name, for example, www.example.com. You can optionally include a trailing dot. If you omit the trailing dot, Amazon Route 53 assumes that the domain name that you specify is fully qualified. This means that Route 53 treats www.example.com (without a trailing dot) and www.example.com. (with a trailing dot) as identical."
7868
7896
  );
7869
- var DNSTypeSchema = z9.enum(["A", "AAAA", "CAA", "CNAME", "DS", "MX", "NAPTR", "NS", "PTR", "SOA", "SPF", "SRV", "TXT"]).describe("The DNS record type.");
7897
+ var DNSTypeSchema = z10.enum(["A", "AAAA", "CAA", "CNAME", "DS", "MX", "NAPTR", "NS", "PTR", "SOA", "SPF", "SRV", "TXT"]).describe("The DNS record type.");
7870
7898
  var TTLSchema = DurationSchema.describe("The resource record cache time to live (TTL).");
7871
- var RecordsSchema = z9.string().array().describe("One or more values that correspond with the value that you specified for the Type property.");
7872
- var DomainsDefaultSchema = z9.record(
7899
+ var RecordsSchema = z10.string().array().describe("One or more values that correspond with the value that you specified for the Type property.");
7900
+ var DomainsDefaultSchema = z10.record(
7873
7901
  ResourceIdSchema,
7874
- z9.object({
7902
+ z10.object({
7875
7903
  domain: DomainNameSchema.describe("Define the domain name"),
7876
- dns: z9.object({
7904
+ dns: z10.object({
7877
7905
  name: DomainNameSchema.optional(),
7878
7906
  type: DNSTypeSchema,
7879
7907
  ttl: TTLSchema,
@@ -7883,18 +7911,18 @@ var DomainsDefaultSchema = z9.record(
7883
7911
  ).optional().describe("Define the domains for your application.");
7884
7912
 
7885
7913
  // src/feature/graphql/schema.ts
7886
- import { z as z10 } from "zod";
7914
+ import { z as z11 } from "zod";
7887
7915
  var AuthorizerTtl = DurationSchema.describe(
7888
7916
  `The number of seconds a response should be cached for. The maximum value is one hour (3600 seconds). The Lambda function can override this by returning a ttlOverride key in its response.`
7889
7917
  );
7890
- var GraphQLDefaultSchema = z10.record(
7918
+ var GraphQLDefaultSchema = z11.record(
7891
7919
  ResourceIdSchema,
7892
- z10.object({
7920
+ z11.object({
7893
7921
  domain: ResourceIdSchema.describe("The domain id to link your API with.").optional(),
7894
- subDomain: z10.string().optional(),
7895
- auth: z10.union([
7922
+ subDomain: z11.string().optional(),
7923
+ auth: z11.union([
7896
7924
  ResourceIdSchema,
7897
- z10.object({
7925
+ z11.object({
7898
7926
  authorizer: FunctionSchema,
7899
7927
  ttl: AuthorizerTtl.default("1 hour")
7900
7928
  })
@@ -7906,22 +7934,22 @@ var GraphQLDefaultSchema = z10.record(
7906
7934
  resolver: LocalFileSchema.optional()
7907
7935
  })
7908
7936
  ).describe(`Define the global GraphQL API's.`).optional();
7909
- var GraphQLSchema = z10.record(
7937
+ var GraphQLSchema = z11.record(
7910
7938
  ResourceIdSchema,
7911
- z10.object({
7939
+ z11.object({
7912
7940
  // schema: z.union([LocalFileSchema.transform(v => [v]), z.array(LocalFileSchema).min(1)]).optional(),
7913
7941
  schema: LocalFileSchema.describe("The graphql schema file."),
7914
- resolvers: z10.record(
7942
+ resolvers: z11.record(
7915
7943
  // TypeName
7916
- z10.string(),
7917
- z10.record(
7944
+ z11.string(),
7945
+ z11.record(
7918
7946
  // FieldName
7919
- z10.string(),
7920
- z10.union([
7947
+ z11.string(),
7948
+ z11.union([
7921
7949
  FunctionSchema.transform((consumer) => ({
7922
7950
  consumer
7923
7951
  })),
7924
- z10.object({
7952
+ z11.object({
7925
7953
  consumer: FunctionSchema,
7926
7954
  resolver: LocalFileSchema.optional()
7927
7955
  })
@@ -7932,34 +7960,20 @@ var GraphQLSchema = z10.record(
7932
7960
  ).describe("Define the schema & resolvers in your stack for your global GraphQL API.").optional();
7933
7961
 
7934
7962
  // src/feature/http/schema.ts
7935
- import { z as z11 } from "zod";
7936
- var RouteSchema = z11.string().regex(/^(POST|GET|PUT|DELETE|HEAD|OPTIONS)(\s\/[a-z0-9\+\_\-\/\{\}]*)$/gi, "Invalid route").transform((v) => v);
7937
- var HttpDefaultSchema = z11.record(
7963
+ import { z as z12 } from "zod";
7964
+ var RouteSchema = z12.string().regex(/^(POST|GET|PUT|DELETE|HEAD|OPTIONS)(\s\/[a-z0-9\+\_\-\/\{\}]*)$/gi, "Invalid route").transform((v) => v);
7965
+ var HttpDefaultSchema = z12.record(
7938
7966
  ResourceIdSchema,
7939
- z11.object({
7967
+ z12.object({
7940
7968
  domain: ResourceIdSchema.describe("The domain id to link your API with."),
7941
- subDomain: z11.string().optional()
7969
+ subDomain: z12.string().optional()
7942
7970
  // auth: ResourceIdSchema.optional(),
7943
7971
  })
7944
7972
  ).optional().describe("Define your global HTTP API's.");
7945
- var HttpSchema = z11.record(ResourceIdSchema, z11.record(RouteSchema, FunctionSchema)).optional().describe("Define routes in your stack for your global HTTP API.");
7973
+ var HttpSchema = z12.record(ResourceIdSchema, z12.record(RouteSchema, FunctionSchema)).optional().describe("Define routes in your stack for your global HTTP API.");
7946
7974
 
7947
7975
  // src/feature/instance/schema.ts
7948
7976
  import { z as z13 } from "zod";
7949
-
7950
- // src/config/schema/local-directory.ts
7951
- import { stat as stat2 } from "fs/promises";
7952
- import { z as z12 } from "zod";
7953
- var LocalDirectorySchema = z12.string().transform((path) => resolvePath(path)).refine(async (path) => {
7954
- try {
7955
- const s = await stat2(path);
7956
- return s.isDirectory();
7957
- } catch (error) {
7958
- return false;
7959
- }
7960
- }, `Directory doesn't exist`);
7961
-
7962
- // src/feature/instance/schema.ts
7963
7977
  var ImageSchema = z13.string().regex(/^ami\-[0-9a-f]+/).describe("The ID of the AMI.");
7964
7978
  var TypeSchema = z13.enum([
7965
7979
  "t3.nano",
@@ -7980,7 +7994,7 @@ var TypeSchema = z13.enum([
7980
7994
  "g4dn.xlarge"
7981
7995
  ]).describe(`The instance type.`);
7982
7996
  var CommandSchema = z13.string().describe(`The script you want to execute when the instance starts up.`);
7983
- var CodeSchema = LocalDirectorySchema.describe(`The code directory that will be deployed to your instance.`);
7997
+ var CodeSchema2 = LocalDirectorySchema.describe(`The code directory that will be deployed to your instance.`);
7984
7998
  var ConnectSchema = z13.boolean().describe("Allows you to connect to all instances with an Instance Connect Endpoint.");
7985
7999
  var EnvironmentSchema2 = z13.record(z13.string(), z13.string()).optional().describe("Environment variable key-value pairs.");
7986
8000
  var ActionSchema2 = z13.string();
@@ -8003,7 +8017,7 @@ var InstancesSchema = z13.record(
8003
8017
  z13.object({
8004
8018
  image: ImageSchema,
8005
8019
  type: TypeSchema,
8006
- code: CodeSchema,
8020
+ code: CodeSchema2,
8007
8021
  user: z13.string().default("ec2-user"),
8008
8022
  command: CommandSchema.optional(),
8009
8023
  environment: EnvironmentSchema2.optional(),
@@ -10627,6 +10641,71 @@ var formatFilterPattern = (filters) => {
10627
10641
  return `{${filters.map((filter) => `$.level = "${filter.toUpperCase()}"`).join(" || ")}}`;
10628
10642
  };
10629
10643
 
10644
+ // src/feature/function/build/bundle/bundle.ts
10645
+ import JSZip2 from "jszip";
10646
+ import { createReadStream as createReadStream2 } from "node:fs";
10647
+ import { readdir as readdir2 } from "node:fs/promises";
10648
+ import { join as join9, relative as relative2 } from "node:path";
10649
+ var zipBundle = async ({ directory }) => {
10650
+ const zip2 = new JSZip2();
10651
+ const list4 = await readdir2(directory, {
10652
+ recursive: true,
10653
+ withFileTypes: true
10654
+ });
10655
+ for (const file of list4) {
10656
+ if (file.isFile()) {
10657
+ const path = join9(file.path, file.name);
10658
+ const rel = relative2(directory, path);
10659
+ zip2.file(rel, createReadStream2(path));
10660
+ }
10661
+ }
10662
+ return zip2.generateAsync({
10663
+ type: "nodebuffer",
10664
+ compression: "DEFLATE",
10665
+ compressionOptions: {
10666
+ level: 9
10667
+ }
10668
+ });
10669
+ };
10670
+
10671
+ // src/feature/function/build/bundle/cache.ts
10672
+ import { createHash as createHash3 } from "node:crypto";
10673
+ import { createReadStream as createReadStream3 } from "node:fs";
10674
+ import { lstat as lstat2, readdir as readdir3 } from "node:fs/promises";
10675
+ import { join as join10 } from "node:path";
10676
+ var bundleCacheKey = async (props) => {
10677
+ const files = await listAllFiles([props.directory]);
10678
+ const hashes = {};
10679
+ for (const file of files) {
10680
+ hashes[file] = await createHashFromFile(file);
10681
+ }
10682
+ return createHash3("md5").update(JSON.stringify(hashes)).digest("hex");
10683
+ };
10684
+ var createHashFromFile = (file) => {
10685
+ return new Promise((resolve2) => {
10686
+ const hash = createHash3("md5");
10687
+ const stream = createReadStream3(file);
10688
+ stream.on("data", (data) => hash.update(data));
10689
+ stream.on("end", () => resolve2(hash.digest("hex")));
10690
+ });
10691
+ };
10692
+ var listAllFiles = async (list4) => {
10693
+ const files = [];
10694
+ for (const entry of list4) {
10695
+ const stat5 = await lstat2(entry);
10696
+ if (stat5.isDirectory()) {
10697
+ const dirents = await readdir3(entry, {
10698
+ recursive: true,
10699
+ withFileTypes: true
10700
+ });
10701
+ files.push(...dirents.filter((d) => d.isFile()).map((file) => join10(file.path, file.name)));
10702
+ } else if (stat5.isFile()) {
10703
+ files.push(entry);
10704
+ }
10705
+ }
10706
+ return files;
10707
+ };
10708
+
10630
10709
  // src/feature/function/build/container/build.ts
10631
10710
  import { exec } from "promisify-child-process";
10632
10711
  var buildDockerImage = async (opts) => {
@@ -10671,7 +10750,10 @@ var createLambdaFunction = (group, ctx, ns, id, local2) => {
10671
10750
  let code;
10672
10751
  if (props.runtime === "container") {
10673
10752
  ctx.registerBuild("function", name, async (build3) => {
10674
- const cwd = dirname7(local2.file);
10753
+ if (!("file" in local2.code)) {
10754
+ throw new Error('code.file needs to be set for functions with the "container" runtime');
10755
+ }
10756
+ const cwd = dirname7(local2.code.file);
10675
10757
  const version = await hashElement(cwd, {
10676
10758
  files: {
10677
10759
  exclude: ["stack.json"]
@@ -10698,18 +10780,19 @@ var createLambdaFunction = (group, ctx, ns, id, local2) => {
10698
10780
  code = {
10699
10781
  imageUri: image.uri
10700
10782
  };
10701
- } else {
10783
+ } else if ("file" in local2.code) {
10784
+ const fileCode = local2.code;
10702
10785
  ctx.registerBuild("function", name, async (build3, { workspace }) => {
10703
- const version = await generateFileHash(workspace, local2.file);
10786
+ const version = await generateFileHash(workspace, fileCode.file);
10704
10787
  return build3(version, async (write) => {
10705
10788
  const temp = await createTempFolder(`function--${name}`);
10706
10789
  const bundle = await bundleTypeScript({
10707
- file: local2.file,
10790
+ file: fileCode.file,
10708
10791
  external: [
10709
- ...props.build.external ?? [],
10792
+ ...fileCode.external ?? [],
10710
10793
  ...(props.layers ?? []).flatMap((id2) => ctx.shared.get(`layer-${id2}-packages`))
10711
10794
  ],
10712
- minify: props.build.minify,
10795
+ minify: fileCode.minify,
10713
10796
  nativeDir: temp.path
10714
10797
  });
10715
10798
  const nativeFiles = await temp.files();
@@ -10737,6 +10820,28 @@ var createLambdaFunction = (group, ctx, ns, id, local2) => {
10737
10820
  key: `/lambda/${name}.zip`,
10738
10821
  body: Asset.fromFile(getBuildPath("function", name, "bundle.zip"))
10739
10822
  });
10823
+ } else {
10824
+ const bundleCode = local2.code;
10825
+ ctx.registerBuild("function", name, async (build3) => {
10826
+ const version = await bundleCacheKey({
10827
+ directory: bundleCode.bundle
10828
+ });
10829
+ return build3(version, async (write) => {
10830
+ const bundle = await zipBundle({
10831
+ directory: bundleCode.bundle
10832
+ });
10833
+ await write("HASH", version);
10834
+ await write("bundle.zip", bundle);
10835
+ return {
10836
+ size: formatByteSize(bundle.byteLength)
10837
+ };
10838
+ });
10839
+ });
10840
+ code = new aws2.s3.BucketObject(group, "code", {
10841
+ bucket: ctx.shared.get("function-bucket-name"),
10842
+ key: `/lambda/${name}.zip`,
10843
+ body: Asset.fromFile(getBuildPath("function", name, "bundle.zip"))
10844
+ });
10740
10845
  }
10741
10846
  const role = new aws2.iam.Role(group, "role", {
10742
10847
  name,
@@ -11408,7 +11513,7 @@ var domainFeature = defineFeature({
11408
11513
  // src/feature/function/index.ts
11409
11514
  import { aws as aws7, Node as Node6 } from "@awsless/formation";
11410
11515
  import { camelCase as camelCase3 } from "change-case";
11411
- import { relative as relative2 } from "path";
11516
+ import { relative as relative3 } from "path";
11412
11517
  import deepmerge2 from "deepmerge";
11413
11518
  import { days as days3 } from "@awsless/duration";
11414
11519
  var typeGenCode2 = `
@@ -11458,16 +11563,18 @@ var functionFeature = defineFeature({
11458
11563
  resourceType: "function",
11459
11564
  resourceName: name
11460
11565
  });
11461
- const relFile = relative2(directories.types, props.file);
11462
- if (props.runtime === "container") {
11463
- resource2.addType(name, `Invoke<'${funcName}', Func>`);
11464
- mock.addType(name, `MockBuilder<Func>`);
11465
- mockResponse.addType(name, `MockObject<Func>`);
11466
- } else {
11467
- types2.addImport(varName, relFile);
11468
- resource2.addType(name, `Invoke<'${funcName}', typeof ${varName}>`);
11469
- mock.addType(name, `MockBuilder<typeof ${varName}>`);
11470
- mockResponse.addType(name, `MockObject<typeof ${varName}>`);
11566
+ if ("file" in local2.code) {
11567
+ const relFile = relative3(directories.types, local2.code.file);
11568
+ if (props.runtime === "container") {
11569
+ resource2.addType(name, `Invoke<'${funcName}', Func>`);
11570
+ mock.addType(name, `MockBuilder<Func>`);
11571
+ mockResponse.addType(name, `MockObject<Func>`);
11572
+ } else {
11573
+ types2.addImport(varName, relFile);
11574
+ resource2.addType(name, `Invoke<'${funcName}', typeof ${varName}>`);
11575
+ mock.addType(name, `MockBuilder<typeof ${varName}>`);
11576
+ mockResponse.addType(name, `MockObject<typeof ${varName}>`);
11577
+ }
11471
11578
  }
11472
11579
  }
11473
11580
  mocks.addType(stack.name, mock);
@@ -11536,12 +11643,12 @@ import { mergeTypeDefs } from "@graphql-tools/merge";
11536
11643
  import { readFile as readFile5 } from "fs/promises";
11537
11644
  import { buildSchema, print } from "graphql";
11538
11645
  import { Asset as Asset2, aws as aws8, Node as Node7 } from "@awsless/formation";
11539
- import { createHash as createHash4 } from "crypto";
11646
+ import { createHash as createHash5 } from "crypto";
11540
11647
 
11541
11648
  // src/util/id.ts
11542
- import { createHash as createHash3 } from "crypto";
11649
+ import { createHash as createHash4 } from "crypto";
11543
11650
  var shortId = (ns) => {
11544
- return createHash3("md5").update(ns).digest("hex").substring(0, 10);
11651
+ return createHash4("md5").update(ns).digest("hex").substring(0, 10);
11545
11652
  };
11546
11653
 
11547
11654
  // src/feature/domain/util.ts
@@ -11749,12 +11856,12 @@ var graphqlFeature = defineFeature({
11749
11856
  const file = stack.graphql?.[id]?.schema;
11750
11857
  if (file) {
11751
11858
  const source = await readFile5(file, "utf8");
11752
- const finger2 = createHash4("sha1").update(source).digest("hex");
11859
+ const finger2 = createHash5("sha1").update(source).digest("hex");
11753
11860
  sources.push(source);
11754
11861
  fingers.push(finger2);
11755
11862
  }
11756
11863
  }
11757
- const finger = createHash4("sha1").update(sources.sort().join(" ")).digest("hex");
11864
+ const finger = createHash5("sha1").update(sources.sort().join(" ")).digest("hex");
11758
11865
  return build3(finger, async (write) => {
11759
11866
  const defs = mergeTypeDefs([scalarSchema, baseSchema, ...sources]);
11760
11867
  const output = print(defs);
@@ -11890,7 +11997,7 @@ var graphqlFeature = defineFeature({
11890
11997
  // src/feature/http/index.ts
11891
11998
  import { aws as aws9, Node as Node8 } from "@awsless/formation";
11892
11999
  import { camelCase as camelCase4, constantCase as constantCase6 } from "change-case";
11893
- import { relative as relative3 } from "path";
12000
+ import { relative as relative4 } from "path";
11894
12001
  var parseRoute = (route) => {
11895
12002
  const [method, ...paths] = route.split(" ");
11896
12003
  const path = paths.join(" ");
@@ -11934,7 +12041,7 @@ var httpFeature = defineFeature({
11934
12041
  paramType.addType(param[0], "string | number");
11935
12042
  }
11936
12043
  const varName = camelCase4(`${id}-${path}-${method}`);
11937
- const relFile = relative3(directories.types, file);
12044
+ const relFile = relative4(directories.types, file);
11938
12045
  types2.addImport(varName, relFile);
11939
12046
  methodType.add(`'${path}'`, `Route<typeof ${varName}, ${paramType.toString() || "never"}>`);
11940
12047
  }
@@ -12416,7 +12523,7 @@ var pubsubFeature = defineFeature({
12416
12523
  import { aws as aws14, Node as Node13 } from "@awsless/formation";
12417
12524
  import { camelCase as camelCase5, constantCase as constantCase8 } from "change-case";
12418
12525
  import deepmerge3 from "deepmerge";
12419
- import { relative as relative4 } from "path";
12526
+ import { relative as relative5 } from "path";
12420
12527
  var typeGenCode3 = `
12421
12528
  import { SendMessageOptions, SendMessageBatchOptions, BatchItem } from '@awsless/sqs'
12422
12529
  import type { Mock } from 'vitest'
@@ -12454,7 +12561,7 @@ var queueFeature = defineFeature({
12454
12561
  resourceName: name
12455
12562
  });
12456
12563
  const file = typeof fileOrProps === "string" ? fileOrProps : typeof fileOrProps.consumer === "string" ? fileOrProps.consumer : fileOrProps.consumer.file;
12457
- const relFile = relative4(directories.types, file);
12564
+ const relFile = relative5(directories.types, file);
12458
12565
  gen.addImport(varName, relFile);
12459
12566
  mock.addType(name, `MockBuilder<typeof ${varName}>`);
12460
12567
  resource2.addType(name, `Send<'${queueName}', typeof ${varName}>`);
@@ -12602,7 +12709,7 @@ var restFeature = defineFeature({
12602
12709
  import { camelCase as camelCase6, constantCase as constantCase10, paramCase as paramCase7 } from "change-case";
12603
12710
  import { Asset as Asset5, aws as aws17, Node as Node16 } from "@awsless/formation";
12604
12711
  import { mebibytes as mebibytes2 } from "@awsless/size";
12605
- import { dirname as dirname10, join as join9, relative as relative5 } from "path";
12712
+ import { dirname as dirname10, join as join11, relative as relative6 } from "path";
12606
12713
  import { fileURLToPath } from "node:url";
12607
12714
 
12608
12715
  // src/feature/function/prebuild.ts
@@ -12648,6 +12755,7 @@ var createPrebuildLambdaFunction = (group, ctx, ns, id, local2) => {
12648
12755
  role: role.arn,
12649
12756
  code,
12650
12757
  runtime: props.runtime === "container" ? void 0 : props.runtime,
12758
+ layers: (props.layers ?? []).map((id2) => ctx.shared.get(`layer-${id2}-arn`)),
12651
12759
  // Remove conflicting props.
12652
12760
  vpc: void 0,
12653
12761
  log: props.log
@@ -12760,7 +12868,7 @@ var rpcFeature = defineFeature({
12760
12868
  const schema = new TypeObject(2);
12761
12869
  for (const stack of ctx.stackConfigs) {
12762
12870
  for (const [name, props] of Object.entries(stack.rpc?.[id] ?? {})) {
12763
- const relFile = relative5(directories.types, props.file);
12871
+ const relFile = relative6(directories.types, props.file);
12764
12872
  const varName = camelCase6(`${stack.name}-${name}`);
12765
12873
  types2.addImport(varName, relFile);
12766
12874
  schema.addType(name, `Handle<typeof ${varName}>`);
@@ -12798,8 +12906,8 @@ var rpcFeature = defineFeature({
12798
12906
  resourceName: id
12799
12907
  });
12800
12908
  const { lambda, policy, code } = createPrebuildLambdaFunction(group, ctx, "rpc", id, {
12801
- bundleFile: join9(__dirname, "/prebuild/rpc/bundle.zip"),
12802
- bundleHash: join9(__dirname, "/prebuild/rpc/HASH"),
12909
+ bundleFile: join11(__dirname, "/prebuild/rpc/bundle.zip"),
12910
+ bundleHash: join11(__dirname, "/prebuild/rpc/HASH"),
12803
12911
  memorySize: mebibytes2(256),
12804
12912
  warm: 3,
12805
12913
  log: props.log
@@ -12987,7 +13095,7 @@ var searchFeature = defineFeature({
12987
13095
  import { days as days6, seconds as seconds4 } from "@awsless/duration";
12988
13096
  import { Asset as Asset6, aws as aws19, Node as Node18 } from "@awsless/formation";
12989
13097
  import { glob as glob2 } from "glob";
12990
- import { join as join10 } from "path";
13098
+ import { join as join12 } from "path";
12991
13099
 
12992
13100
  // src/feature/site/util.ts
12993
13101
  import { lookup, contentType } from "mime-types";
@@ -13097,7 +13205,7 @@ var siteFeature = defineFeature({
13097
13205
  const object = new aws19.s3.BucketObject(group, file, {
13098
13206
  bucket: bucket.name,
13099
13207
  key: file,
13100
- body: Asset6.fromFile(join10(props.static, file)),
13208
+ body: Asset6.fromFile(join12(props.static, file)),
13101
13209
  cacheControl: getCacheControl(file),
13102
13210
  contentType: getContentType(file)
13103
13211
  });
@@ -13478,7 +13586,7 @@ var tableFeature = defineFeature({
13478
13586
  // src/feature/task/index.ts
13479
13587
  import { Node as Node22 } from "@awsless/formation";
13480
13588
  import { camelCase as camelCase7 } from "change-case";
13481
- import { relative as relative6 } from "path";
13589
+ import { relative as relative7 } from "path";
13482
13590
  var typeGenCode6 = `
13483
13591
  import { InvokeOptions } from '@awsless/lambda'
13484
13592
  import type { Mock } from 'vitest'
@@ -13520,7 +13628,7 @@ var taskFeature = defineFeature({
13520
13628
  resourceType: "task",
13521
13629
  resourceName: name
13522
13630
  });
13523
- const relFile = relative6(directories.types, props.consumer.file);
13631
+ const relFile = relative7(directories.types, props.consumer.file);
13524
13632
  types2.addImport(varName, relFile);
13525
13633
  resource2.addType(name, `Invoke<'${funcName}', typeof ${varName}>`);
13526
13634
  mock.addType(name, `MockBuilder<typeof ${varName}>`);
@@ -14669,13 +14777,13 @@ import wildstring4 from "wildstring";
14669
14777
  import { log as log8 } from "@clack/prompts";
14670
14778
  import chalk6 from "chalk";
14671
14779
  import { mkdir as mkdir5, readFile as readFile7, writeFile as writeFile3 } from "fs/promises";
14672
- import { join as join13 } from "path";
14780
+ import { join as join15 } from "path";
14673
14781
  import wildstring3 from "wildstring";
14674
14782
 
14675
14783
  // src/build/__fingerprint.ts
14676
- import { createHash as createHash5 } from "crypto";
14677
- import { readdir as readdir2, readFile as readFile6, stat as stat4 } from "fs/promises";
14678
- import { basename as basename5, dirname as dirname11, extname as extname3, join as join11 } from "path";
14784
+ import { createHash as createHash6 } from "crypto";
14785
+ import { readdir as readdir4, readFile as readFile6, stat as stat4 } from "fs/promises";
14786
+ import { basename as basename5, dirname as dirname11, extname as extname3, join as join13 } from "path";
14679
14787
  import parseStaticImports from "parse-static-imports";
14680
14788
  var extensions = ["js", "mjs", "jsx", "ts", "mts", "tsx"];
14681
14789
  var generateFileHashes = async (file, hashes) => {
@@ -14684,7 +14792,7 @@ var generateFileHashes = async (file, hashes) => {
14684
14792
  }
14685
14793
  const code = await readModuleFile(file);
14686
14794
  const deps = await findDependencies(file, code);
14687
- const hash = createHash5("sha1").update(code).digest();
14795
+ const hash = createHash6("sha1").update(code).digest();
14688
14796
  hashes.set(file, hash);
14689
14797
  for (const dep of deps) {
14690
14798
  if (dep.startsWith("/")) {
@@ -14694,14 +14802,14 @@ var generateFileHashes = async (file, hashes) => {
14694
14802
  };
14695
14803
  var fingerprintFromDirectory = async (dir) => {
14696
14804
  const hashes = /* @__PURE__ */ new Map();
14697
- const files = await readdir2(dir, { recursive: true });
14805
+ const files = await readdir4(dir, { recursive: true });
14698
14806
  for (const file of files) {
14699
14807
  if (extensions.includes(extname3(file).substring(1)) && file.at(0) !== "_") {
14700
- await generateFileHashes(join11(dir, file), hashes);
14808
+ await generateFileHashes(join13(dir, file), hashes);
14701
14809
  }
14702
14810
  }
14703
14811
  const merge2 = Buffer.concat(Array.from(hashes.values()).sort());
14704
- return createHash5("sha1").update(merge2).digest("hex");
14812
+ return createHash6("sha1").update(merge2).digest("hex");
14705
14813
  };
14706
14814
  var readModuleFile = (file) => {
14707
14815
  if (file.endsWith(".js")) {
@@ -14711,7 +14819,7 @@ var readModuleFile = (file) => {
14711
14819
  return readFiles([
14712
14820
  file,
14713
14821
  ...extensions.map((exp) => `${file}.${exp}`),
14714
- ...extensions.map((exp) => join11(file, `/index.${exp}`))
14822
+ ...extensions.map((exp) => join13(file, `/index.${exp}`))
14715
14823
  ]);
14716
14824
  }
14717
14825
  return readFile6(file, "utf8");
@@ -14731,7 +14839,7 @@ var readFiles = async (files) => {
14731
14839
  };
14732
14840
  var findDependencies = async (file, code) => {
14733
14841
  const imports = await parseStaticImports(code);
14734
- return imports.map((entry) => entry.moduleName).filter(Boolean).map((value) => value?.startsWith(".") ? join11(dirname11(file), value) : value);
14842
+ return imports.map((entry) => entry.moduleName).filter(Boolean).map((value) => value?.startsWith(".") ? join13(dirname11(file), value) : value);
14735
14843
  };
14736
14844
 
14737
14845
  // src/test/reporter.ts
@@ -14814,7 +14922,7 @@ import { startVitest } from "vitest/node";
14814
14922
  import commonjs3 from "@rollup/plugin-commonjs";
14815
14923
  import nodeResolve3 from "@rollup/plugin-node-resolve";
14816
14924
  import json3 from "@rollup/plugin-json";
14817
- import { dirname as dirname12, join as join12 } from "path";
14925
+ import { dirname as dirname12, join as join14 } from "path";
14818
14926
  import { fileURLToPath as fileURLToPath2 } from "url";
14819
14927
  var startTest = async (props) => {
14820
14928
  const __dirname2 = dirname12(fileURLToPath2(import.meta.url));
@@ -14831,7 +14939,7 @@ var startTest = async (props) => {
14831
14939
  exclude: ["**/_*", "**/_*/**", ...configDefaults.exclude],
14832
14940
  globals: true,
14833
14941
  reporters: props.reporter,
14834
- globalSetup: join12(__dirname2, "test-global-setup.js")
14942
+ globalSetup: join14(__dirname2, "test-global-setup.js")
14835
14943
  // env: {
14836
14944
  // TZ: 'UTC',
14837
14945
  // },
@@ -14925,7 +15033,7 @@ var logTestErrors = (event) => {
14925
15033
  var runTest = async (stack, dir, filters) => {
14926
15034
  await mkdir5(directories.test, { recursive: true });
14927
15035
  const fingerprint = await fingerprintFromDirectory(dir);
14928
- const file = join13(directories.test, `${stack}.json`);
15036
+ const file = join15(directories.test, `${stack}.json`);
14929
15037
  const exists = await fileExist(file);
14930
15038
  if (exists && !process.env.NO_CACHE) {
14931
15039
  const raw = await readFile7(file, { encoding: "utf8" });
@@ -15179,12 +15287,13 @@ var bind = (program2) => {
15179
15287
  } else {
15180
15288
  log9.warning("No bindings available.");
15181
15289
  }
15290
+ const configList = opts.config ?? [];
15182
15291
  const configs = {};
15183
- for (const name of opts.config) {
15292
+ for (const name of configList) {
15184
15293
  configs[`CONFIG_${constantCase14(name)}`] = name;
15185
15294
  }
15186
- if (opts.config.length > 0) {
15187
- note3(wrap(opts.config.map((v) => color.label(constantCase14(v)))), "Bind Config");
15295
+ if (configList.length ?? 0 > 0) {
15296
+ note3(wrap(configList.map((v) => color.label(constantCase14(v)))), "Bind Config");
15188
15297
  }
15189
15298
  if (commands7.length === 0) {
15190
15299
  return "No command to execute.";
@@ -15247,7 +15356,7 @@ import { log as log10 } from "@clack/prompts";
15247
15356
 
15248
15357
  // src/type-gen/generate.ts
15249
15358
  import { mkdir as mkdir6, writeFile as writeFile4 } from "fs/promises";
15250
- import { dirname as dirname13, join as join14, relative as relative7 } from "path";
15359
+ import { dirname as dirname13, join as join16, relative as relative8 } from "path";
15251
15360
  var generateTypes = async (props) => {
15252
15361
  const files = [];
15253
15362
  await Promise.all(
@@ -15256,10 +15365,10 @@ var generateTypes = async (props) => {
15256
15365
  ...props,
15257
15366
  async write(file, data, include = false) {
15258
15367
  const code = data?.toString("utf8");
15259
- const path = join14(directories.types, file);
15368
+ const path = join16(directories.types, file);
15260
15369
  if (code) {
15261
15370
  if (include) {
15262
- files.push(relative7(directories.root, path));
15371
+ files.push(relative8(directories.root, path));
15263
15372
  }
15264
15373
  await mkdir6(dirname13(path), { recursive: true });
15265
15374
  await writeFile4(path, code);
@@ -15270,7 +15379,7 @@ var generateTypes = async (props) => {
15270
15379
  );
15271
15380
  if (files.length) {
15272
15381
  const code = files.map((file) => `/// <reference path='${file}' />`).join("\n");
15273
- await writeFile4(join14(directories.root, `awsless.d.ts`), code);
15382
+ await writeFile4(join16(directories.root, `awsless.d.ts`), code);
15274
15383
  }
15275
15384
  };
15276
15385