@awsless/awsless 0.0.314 → 0.0.315

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
@@ -460,9 +460,9 @@ var RetryAttemptsSchema = z5.number().int().min(0).max(2).describe(
460
460
  var RuntimeSchema = z5.enum(["nodejs18.x", "nodejs20.x"]).describe("The identifier of the function's runtime.");
461
461
  var ActionSchema = z5.string();
462
462
  var ActionsSchema = z5.union([ActionSchema.transform((v) => [v]), ActionSchema.array()]);
463
- var ArnSchema = z5.string().startsWith("arn:");
463
+ var ArnSchema = z5.string().startsWith("arn:").transform((v) => v);
464
464
  var WildcardSchema = z5.literal("*");
465
- var ResourceSchema = z5.union([ArnSchema, WildcardSchema]).transform((v) => v);
465
+ var ResourceSchema = z5.union([ArnSchema, WildcardSchema]);
466
466
  var ResourcesSchema = z5.union([ResourceSchema.transform((v) => [v]), ResourceSchema.array()]);
467
467
  var PermissionSchema = z5.object({
468
468
  effect: z5.enum(["allow", "deny"]).default("allow"),
@@ -496,6 +496,13 @@ var LogSchema = z5.union([
496
496
  ).optional()
497
497
  })
498
498
  ]).describe("Enable logging to a CloudWatch log group. Providing a duration value will set the log retention time.");
499
+ var LayersSchema = ArnSchema.array().describe(
500
+ `A list of function layers to add to the function's execution environment. Specify each layer by its ARN, including the version.`
501
+ );
502
+ var BuildSchema = z5.object({
503
+ // minify: z.boolean().optional().describe('')
504
+ external: z5.string().array().optional().describe(`A list of external packages that won't be included in the bundle.`)
505
+ }).describe(`Options for the function bundler`);
499
506
  var FunctionSchema = z5.union([
500
507
  LocalFileSchema.transform((file) => ({
501
508
  file
@@ -515,6 +522,8 @@ var FunctionSchema = z5.union([
515
522
  ephemeralStorageSize: EphemeralStorageSizeSchema.optional(),
516
523
  retryAttempts: RetryAttemptsSchema.optional(),
517
524
  reserved: ReservedConcurrentExecutionsSchema.optional(),
525
+ layers: LayersSchema.optional(),
526
+ build: BuildSchema.optional(),
518
527
  environment: EnvironmentSchema.optional(),
519
528
  permissions: PermissionsSchema.optional()
520
529
  })
@@ -538,6 +547,8 @@ var FunctionDefaultSchema = z5.object({
538
547
  ephemeralStorageSize: EphemeralStorageSizeSchema.default("512 MB"),
539
548
  retryAttempts: RetryAttemptsSchema.default(2),
540
549
  reserved: ReservedConcurrentExecutionsSchema.optional(),
550
+ layers: LayersSchema.optional(),
551
+ build: BuildSchema.optional(),
541
552
  environment: EnvironmentSchema.optional(),
542
553
  permissions: PermissionsSchema.optional()
543
554
  }).default({});
@@ -2057,11 +2068,11 @@ import { createHash } from "crypto";
2057
2068
  import { dirname as dirname5 } from "path";
2058
2069
  import { rollup } from "rollup";
2059
2070
  import { minify as swcMinify, swc } from "rollup-plugin-swc3";
2060
- var bundleTypeScript = async ({ format: format2 = "esm", minify = true, file }) => {
2071
+ var bundleTypeScript = async ({ format: format2 = "esm", minify = true, file, external }) => {
2061
2072
  const bundle = await rollup({
2062
2073
  input: file,
2063
2074
  external: (importee) => {
2064
- return importee.startsWith("@aws-sdk") || importee.startsWith("aws-sdk");
2075
+ return importee.startsWith("@aws-sdk") || importee.startsWith("aws-sdk") || external?.includes(importee);
2065
2076
  },
2066
2077
  onwarn: (error) => {
2067
2078
  debugError(error.message);
@@ -2158,7 +2169,10 @@ var createLambdaFunction = (group, ctx, ns, id, local2) => {
2158
2169
  packageVersions
2159
2170
  });
2160
2171
  return build3(version, async (write) => {
2161
- const bundle = await bundleTypeScript({ file: props.file });
2172
+ const bundle = await bundleTypeScript({
2173
+ file: props.file,
2174
+ external: props.build?.external
2175
+ });
2162
2176
  const archive = await zipFiles(bundle.files);
2163
2177
  await Promise.all([
2164
2178
  write("bundle.zip", archive),
@@ -117,9 +117,9 @@ var RetryAttemptsSchema = z5.number().int().min(0).max(2).describe(
117
117
  var RuntimeSchema = z5.enum(["nodejs18.x", "nodejs20.x"]).describe("The identifier of the function's runtime.");
118
118
  var ActionSchema = z5.string();
119
119
  var ActionsSchema = z5.union([ActionSchema.transform((v) => [v]), ActionSchema.array()]);
120
- var ArnSchema = z5.string().startsWith("arn:");
120
+ var ArnSchema = z5.string().startsWith("arn:").transform((v) => v);
121
121
  var WildcardSchema = z5.literal("*");
122
- var ResourceSchema = z5.union([ArnSchema, WildcardSchema]).transform((v) => v);
122
+ var ResourceSchema = z5.union([ArnSchema, WildcardSchema]);
123
123
  var ResourcesSchema = z5.union([ResourceSchema.transform((v) => [v]), ResourceSchema.array()]);
124
124
  var PermissionSchema = z5.object({
125
125
  effect: z5.enum(["allow", "deny"]).default("allow"),
@@ -153,6 +153,13 @@ var LogSchema = z5.union([
153
153
  ).optional()
154
154
  })
155
155
  ]).describe("Enable logging to a CloudWatch log group. Providing a duration value will set the log retention time.");
156
+ var LayersSchema = ArnSchema.array().describe(
157
+ `A list of function layers to add to the function's execution environment. Specify each layer by its ARN, including the version.`
158
+ );
159
+ var BuildSchema = z5.object({
160
+ // minify: z.boolean().optional().describe('')
161
+ external: z5.string().array().optional().describe(`A list of external packages that won't be included in the bundle.`)
162
+ }).describe(`Options for the function bundler`);
156
163
  var FunctionSchema = z5.union([
157
164
  LocalFileSchema.transform((file) => ({
158
165
  file
@@ -172,6 +179,8 @@ var FunctionSchema = z5.union([
172
179
  ephemeralStorageSize: EphemeralStorageSizeSchema.optional(),
173
180
  retryAttempts: RetryAttemptsSchema.optional(),
174
181
  reserved: ReservedConcurrentExecutionsSchema.optional(),
182
+ layers: LayersSchema.optional(),
183
+ build: BuildSchema.optional(),
175
184
  environment: EnvironmentSchema.optional(),
176
185
  permissions: PermissionsSchema.optional()
177
186
  })
@@ -195,6 +204,8 @@ var FunctionDefaultSchema = z5.object({
195
204
  ephemeralStorageSize: EphemeralStorageSizeSchema.default("512 MB"),
196
205
  retryAttempts: RetryAttemptsSchema.default(2),
197
206
  reserved: ReservedConcurrentExecutionsSchema.optional(),
207
+ layers: LayersSchema.optional(),
208
+ build: BuildSchema.optional(),
198
209
  environment: EnvironmentSchema.optional(),
199
210
  permissions: PermissionsSchema.optional()
200
211
  }).default({});