@awsless/awsless 0.0.472 → 0.0.475

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.
@@ -203,7 +203,7 @@ var RetryAttemptsSchema = z11.number().int().min(0).max(2).describe(
203
203
  );
204
204
  var NodeRuntimeSchema = z11.enum(["nodejs18.x", "nodejs20.x", "nodejs22.x"]);
205
205
  var ContainerRuntimeSchema = z11.literal("container");
206
- var RuntimeSchema = NodeRuntimeSchema.or(ContainerRuntimeSchema).describe("The identifier of the function's runtime.");
206
+ var RuntimeSchema = NodeRuntimeSchema.or(ContainerRuntimeSchema).or(z11.string()).describe("The identifier of the function's runtime.");
207
207
  var ActionSchema = z11.string();
208
208
  var ActionsSchema = z11.union([ActionSchema.transform((v) => [v]), ActionSchema.array()]);
209
209
  var ArnSchema = z11.string().startsWith("arn:");
@@ -489,7 +489,7 @@ import { z as z18 } from "zod";
489
489
  // src/config/schema/route.ts
490
490
  import { z as z17 } from "zod";
491
491
  var RouteSchema = z17.union([
492
- z17.string().regex(/^(POST|GET|PUT|DELETE|HEAD|OPTIONS)(\s\/[a-z0-9\+\_\-\/\{\}]*)$/gi, "Invalid route"),
492
+ z17.string().regex(/^(POST|GET|PUT|DELETE|HEAD|OPTIONS|ANY)(\s\/[a-z0-9\+\_\-\/\{\}]*)$/gi, "Invalid route"),
493
493
  z17.literal("$default")
494
494
  ]);
495
495
 
@@ -501,7 +501,19 @@ var RestDefaultSchema = z18.record(
501
501
  subDomain: z18.string().optional()
502
502
  })
503
503
  ).optional().describe("Define your global REST API's.");
504
- var RestSchema = z18.record(ResourceIdSchema, z18.record(RouteSchema, FunctionSchema)).optional().describe("Define routes in your stack for your global REST API.");
504
+ var RestSchema = z18.record(
505
+ ResourceIdSchema,
506
+ z18.record(
507
+ RouteSchema.describe(
508
+ [
509
+ "The REST API route that is comprised by the http method and http path.",
510
+ "The possible http methods are POST, GET,PUT, DELETE, HEAD, OPTIONS, ANY.",
511
+ "Example: GET /posts/{id}"
512
+ ].join("\n")
513
+ ),
514
+ FunctionSchema
515
+ )
516
+ ).optional().describe("Define routes in your stack for your global REST API.");
505
517
 
506
518
  // src/feature/rpc/schema.ts
507
519
  import { z as z19 } from "zod";
@@ -601,7 +613,7 @@ var AppSchema = z21.object({
601
613
  });
602
614
 
603
615
  // src/config/stack.ts
604
- import { z as z34 } from "zod";
616
+ import { z as z35 } from "zod";
605
617
 
606
618
  // src/feature/cache/schema.ts
607
619
  import { gibibytes as gibibytes2 } from "@awsless/size";
@@ -811,29 +823,48 @@ var SearchsSchema = z27.record(
811
823
  ).optional().describe("Define the search instances in your stack. Backed by OpenSearch.");
812
824
 
813
825
  // src/feature/site/schema.ts
826
+ import { z as z29 } from "zod";
827
+
828
+ // src/config/schema/local-entry.ts
829
+ import { stat as stat3 } from "fs/promises";
814
830
  import { z as z28 } from "zod";
815
- var ErrorResponsePathSchema = z28.string().describe(
831
+ var LocalEntrySchema = z28.union([
832
+ RelativePathSchema.refine(async (path) => {
833
+ try {
834
+ const s = await stat3(path);
835
+ return s.isFile() || s.isDirectory();
836
+ } catch (error) {
837
+ return false;
838
+ }
839
+ }, `File or directory doesn't exist`),
840
+ z28.object({
841
+ nocheck: z28.string().describe("Specifies a local file or directory without checking if the file or directory exists.")
842
+ }).transform((v) => v.nocheck)
843
+ ]);
844
+
845
+ // src/feature/site/schema.ts
846
+ var ErrorResponsePathSchema = z29.string().describe(
816
847
  "The path to the custom error page that you want to return to the viewer when your origin returns the HTTP status code specified.\n - We recommend that you store custom error pages in an Amazon S3 bucket. If you store custom error pages on an HTTP server and the server starts to return 5xx errors, CloudFront can't get the files that you want to return to viewers because the origin server is unavailable."
817
848
  );
818
- var StatusCodeSchema = z28.number().int().positive().optional().describe(
849
+ var StatusCodeSchema = z29.number().int().positive().optional().describe(
819
850
  "The HTTP status code that you want CloudFront to return to the viewer along with the custom error page. There are a variety of reasons that you might want CloudFront to return a status code different from the status code that your origin returned to CloudFront, for example:\n- Some Internet devices (some firewalls and corporate proxies, for example) intercept HTTP 4xx and 5xx and prevent the response from being returned to the viewer. If you substitute 200, the response typically won't be intercepted.\n- If you don't care about distinguishing among different client errors or server errors, you can specify 400 or 500 as the ResponseCode for all 4xx or 5xx errors.\n- You might want to return a 200 status code (OK) and static website so your customers don't know that your website is down."
820
851
  );
821
852
  var MinTTLSchema = DurationSchema.describe(
822
853
  "The minimum amount of time, that you want to cache the error response. When this time period has elapsed, CloudFront queries your origin to see whether the problem that caused the error has been resolved and the requested object is now available."
823
854
  );
824
- var ErrorResponseSchema = z28.union([
855
+ var ErrorResponseSchema = z29.union([
825
856
  ErrorResponsePathSchema,
826
- z28.object({
857
+ z29.object({
827
858
  path: ErrorResponsePathSchema,
828
859
  statusCode: StatusCodeSchema.optional(),
829
860
  minTTL: MinTTLSchema.optional()
830
861
  })
831
862
  ]).optional();
832
- var SitesSchema = z28.record(
863
+ var SitesSchema = z29.record(
833
864
  ResourceIdSchema,
834
- z28.object({
865
+ z29.object({
835
866
  domain: ResourceIdSchema.describe("The domain id to link your site with.").optional(),
836
- subDomain: z28.string().optional(),
867
+ subDomain: z29.string().optional(),
837
868
  // bind: z
838
869
  // .object({
839
870
  // auth: z.array(ResourceIdSchema),
@@ -842,24 +873,20 @@ var SitesSchema = z28.record(
842
873
  // // rest: z.array(ResourceIdSchema),
843
874
  // })
844
875
  // .optional(),
845
- build: z28.object({
846
- command: z28.string().describe(
876
+ build: z29.object({
877
+ command: z29.string().describe(
847
878
  `Specifies the files and directories to generate the cache key for your custom build command.`
848
879
  ),
849
- cacheKey: z28.union([
850
- LocalFileSchema.transform((v) => [v]),
851
- LocalFileSchema.array(),
852
- LocalDirectorySchema.transform((v) => [v]),
853
- LocalDirectorySchema.array()
854
- ]).describe(
880
+ cacheKey: z29.union([LocalEntrySchema.transform((v) => [v]), LocalEntrySchema.array()]).describe(
855
881
  `Specifies the files and directories to generate the cache key for your custom build command.`
856
882
  )
857
883
  }).optional().describe(`Specifies the build process for sites that need a build step.`),
858
- static: z28.union([LocalDirectorySchema, z28.boolean()]).optional().describe(
884
+ static: z29.union([LocalDirectorySchema, z29.boolean()]).optional().describe(
859
885
  "Specifies the path to the static files directory. Additionally you can also pass `true` when you don't have local static files, but still want to make an S3 bucket."
860
886
  ),
861
- ssr: FunctionSchema.optional().describe("Specifies the ssr file."),
862
- origin: z28.enum(["ssr-first", "static-first"]).default("static-first").describe("Specifies the origin fallback ordering."),
887
+ ssr: FunctionSchema.optional().describe("Specifies the file that will render the site on the server."),
888
+ // envPrefix: z.string().optional().describe('Specifies a prefix for all '),
889
+ origin: z29.enum(["ssr-first", "static-first"]).default("static-first").describe("Specifies the origin fallback ordering."),
863
890
  // bind: z.object({
864
891
  // auth:
865
892
  // h
@@ -872,11 +899,11 @@ var SitesSchema = z28.record(
872
899
  // build: z.string().optional(),
873
900
  // }),
874
901
  // ]),
875
- geoRestrictions: z28.array(z28.string().length(2).toUpperCase()).default([]).describe("Specifies a blacklist of countries that should be blocked."),
876
- forwardHost: z28.boolean().default(false).describe(
902
+ geoRestrictions: z29.array(z29.string().length(2).toUpperCase()).default([]).describe("Specifies a blacklist of countries that should be blocked."),
903
+ forwardHost: z29.boolean().default(false).describe(
877
904
  "Specify if the host header should be forwarded to the SSR function. Keep in mind that this requires an extra CloudFront Function."
878
905
  ),
879
- errors: z28.object({
906
+ errors: z29.object({
880
907
  400: ErrorResponseSchema.describe("Customize a `400 Bad Request` response."),
881
908
  403: ErrorResponseSchema.describe("Customize a `403 Forbidden` response."),
882
909
  404: ErrorResponseSchema.describe("Customize a `404 Not Found` response."),
@@ -889,16 +916,16 @@ var SitesSchema = z28.record(
889
916
  503: ErrorResponseSchema.describe("Customize a `503 Service Unavailable` response."),
890
917
  504: ErrorResponseSchema.describe("Customize a `504 Gateway Timeout` response.")
891
918
  }).optional().describe("Customize the error responses for specific HTTP status codes."),
892
- cors: z28.object({
893
- override: z28.boolean().default(false),
919
+ cors: z29.object({
920
+ override: z29.boolean().default(false),
894
921
  maxAge: DurationSchema.default("365 days"),
895
- exposeHeaders: z28.string().array().optional(),
896
- credentials: z28.boolean().default(false),
897
- headers: z28.string().array().default(["*"]),
898
- origins: z28.string().array().default(["*"]),
899
- methods: z28.enum(["GET", "DELETE", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "ALL"]).array().default(["ALL"])
922
+ exposeHeaders: z29.string().array().optional(),
923
+ credentials: z29.boolean().default(false),
924
+ headers: z29.string().array().default(["*"]),
925
+ origins: z29.string().array().default(["*"]),
926
+ methods: z29.enum(["GET", "DELETE", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "ALL"]).array().default(["ALL"])
900
927
  }).optional().describe("Define the cors headers."),
901
- security: z28.object({
928
+ security: z29.object({
902
929
  // contentSecurityPolicy: z.object({
903
930
  // override: z.boolean().default(false),
904
931
  // policy: z.string(),
@@ -940,10 +967,10 @@ var SitesSchema = z28.record(
940
967
  // reportUri?: string
941
968
  // }
942
969
  }).optional().describe("Define the security policy."),
943
- cache: z28.object({
944
- cookies: z28.string().array().optional().describe("Specifies the cookies that CloudFront includes in the cache key."),
945
- headers: z28.string().array().optional().describe("Specifies the headers that CloudFront includes in the cache key."),
946
- queries: z28.string().array().optional().describe("Specifies the query values that CloudFront includes in the cache key.")
970
+ cache: z29.object({
971
+ cookies: z29.string().array().optional().describe("Specifies the cookies that CloudFront includes in the cache key."),
972
+ headers: z29.string().array().optional().describe("Specifies the headers that CloudFront includes in the cache key."),
973
+ queries: z29.string().array().optional().describe("Specifies the query values that CloudFront includes in the cache key.")
947
974
  }).optional().describe(
948
975
  "Specifies the cookies, headers, and query values that CloudFront includes in the cache key."
949
976
  )
@@ -951,22 +978,22 @@ var SitesSchema = z28.record(
951
978
  ).optional().describe("Define the sites in your stack.");
952
979
 
953
980
  // src/feature/store/schema.ts
954
- import { z as z29 } from "zod";
955
- var StoresSchema = z29.union([
956
- z29.array(ResourceIdSchema).transform((list) => {
981
+ import { z as z30 } from "zod";
982
+ var StoresSchema = z30.union([
983
+ z30.array(ResourceIdSchema).transform((list) => {
957
984
  const stores = {};
958
985
  for (const key of list) {
959
986
  stores[key] = {};
960
987
  }
961
988
  return stores;
962
989
  }),
963
- z29.record(
990
+ z30.record(
964
991
  ResourceIdSchema,
965
- z29.object({
992
+ z30.object({
966
993
  // cors: CorsSchema,
967
994
  // deletionProtection: DeletionProtectionSchema.optional(),
968
- versioning: z29.boolean().default(false).describe("Enable versioning of your store."),
969
- events: z29.object({
995
+ versioning: z30.boolean().default(false).describe("Enable versioning of your store."),
996
+ events: z30.object({
970
997
  // create
971
998
  "created:*": FunctionSchema.optional().describe(
972
999
  "Subscribe to notifications regardless of the API that was used to create an object."
@@ -999,44 +1026,99 @@ var StoresSchema = z29.union([
999
1026
  ]).optional().describe("Define the stores in your stack.");
1000
1027
 
1001
1028
  // src/feature/table/schema.ts
1002
- import { z as z30 } from "zod";
1003
- var KeySchema = z30.string().min(1).max(255);
1004
- var TablesSchema = z30.record(
1029
+ import { minutes as minutes4, seconds as seconds4 } from "@awsless/duration";
1030
+ import { z as z31 } from "zod";
1031
+ var KeySchema = z31.string().min(1).max(255);
1032
+ var TablesSchema = z31.record(
1005
1033
  ResourceIdSchema,
1006
- z30.object({
1034
+ z31.object({
1007
1035
  hash: KeySchema.describe(
1008
1036
  "Specifies the name of the partition / hash key that makes up the primary key for the table."
1009
1037
  ),
1010
1038
  sort: KeySchema.optional().describe(
1011
1039
  "Specifies the name of the range / sort key that makes up the primary key for the table."
1012
1040
  ),
1013
- fields: z30.record(z30.string(), z30.enum(["string", "number", "binary"])).optional().describe(
1041
+ fields: z31.record(z31.string(), z31.enum(["string", "number", "binary"])).optional().describe(
1014
1042
  'A list of attributes that describe the key schema for the table and indexes. If no attribute field is defined we default to "string".'
1015
1043
  ),
1016
- class: z30.enum(["standard", "standard-infrequent-access"]).default("standard").describe("The table class of the table."),
1017
- pointInTimeRecovery: z30.boolean().default(false).describe("Indicates whether point in time recovery is enabled on the table."),
1018
- timeToLiveAttribute: KeySchema.optional().describe(
1019
- "The name of the TTL attribute used to store the expiration time for items in the table. To update this property, you must first disable TTL and then enable TTL with the new attribute name."
1044
+ class: z31.enum(["standard", "standard-infrequent-access"]).default("standard").describe("The table class of the table."),
1045
+ pointInTimeRecovery: z31.boolean().default(false).describe("Indicates whether point in time recovery is enabled on the table."),
1046
+ ttl: KeySchema.optional().describe(
1047
+ [
1048
+ "The name of the TTL attribute used to store the expiration time for items in the table.",
1049
+ "To update this property, you must first disable TTL and then enable TTL with the new attribute name."
1050
+ ].join("\n")
1020
1051
  ),
1021
1052
  // deletionProtection: DeletionProtectionSchema.optional(),
1022
- stream: z30.object({
1023
- type: z30.enum(["keys-only", "new-image", "old-image", "new-and-old-images"]).describe(
1024
- "When an item in the table is modified, stream.type determines what information is written to the stream for this table. Valid values are:\n- keys-only - Only the key attributes of the modified item are written to the stream.\n- new-image - The entire item, as it appears after it was modified, is written to the stream.\n- old-image - The entire item, as it appeared before it was modified, is written to the stream.\n- new-and-old-images - Both the new and the old item images of the item are written to the stream."
1053
+ stream: z31.object({
1054
+ type: z31.enum(["keys-only", "new-image", "old-image", "new-and-old-images"]).describe(
1055
+ [
1056
+ "When an item in the table is modified, you can determines what information is written to the stream for this table.",
1057
+ "Valid values are:",
1058
+ "- keys-only - Only the key attributes of the modified item are written to the stream.",
1059
+ "- new-image - The entire item, as it appears after it was modified, is written to the stream.",
1060
+ "- old-image - The entire item, as it appeared before it was modified, is written to the stream.",
1061
+ "- new-and-old-images - Both the new and the old item images of the item are written to the stream."
1062
+ ].join("\n")
1063
+ ),
1064
+ batchSize: z31.number().min(1).max(1e4).default(1).describe(
1065
+ [
1066
+ "The maximum number of records in each batch that Lambda pulls from your stream and sends to your function.",
1067
+ "Lambda passes all of the records in the batch to the function in a single call, up to the payload limit for synchronous invocation (6 MB).",
1068
+ "You can specify a number from 1 to 10000."
1069
+ ].join("\n")
1070
+ ),
1071
+ batchWindow: DurationSchema.refine(
1072
+ durationMin(seconds4(1)),
1073
+ "Minimum batch window duration is 1 second"
1074
+ ).refine(durationMax(minutes4(5)), "Maximum batch window duration is 5 minutes").optional().describe(
1075
+ [
1076
+ "The maximum amount of time that is spend gathering records before invoking the function.",
1077
+ "You can specify a duration from 1 seconds to 5 minutes."
1078
+ ].join("\n")
1079
+ ),
1080
+ // maxRecordAge: DurationSchema.refine(
1081
+ // durationMin(seconds(1)),
1082
+ // 'Minimum record age duration is 1 second'
1083
+ // )
1084
+ // .refine(durationMax(minutes(5)), 'Maximum batch window duration is 5 minutes')
1085
+ // .optional()
1086
+ // .describe(
1087
+ // [
1088
+ // 'Discard records after the specified number of retries.',
1089
+ // 'The default value is -1, which sets the maximum number of retries to infinite.',
1090
+ // 'When maxRetryAttempts is infinite, Lambda retries failed records until the record expires in the event source.',
1091
+ // 'You can specify a number from -1 to 10000.',
1092
+ // ].join('\n')
1093
+ // ),
1094
+ retryAttempts: z31.number().min(-1).max(1e4).default(-1).describe(
1095
+ [
1096
+ "Discard records after the specified number of retries.",
1097
+ "The default value is -1, which sets the maximum number of retries to infinite.",
1098
+ "When maxRetryAttempts is infinite, Lambda retries failed records until the record expires in the event source.",
1099
+ "You can specify a number from -1 to 10000."
1100
+ ].join("\n")
1101
+ ),
1102
+ concurrencyPerShard: z31.number().min(1).max(10).default(1).describe(
1103
+ [
1104
+ "The number of batches to process concurrently from each shard.",
1105
+ "You can specify a number from 1 to 10."
1106
+ ].join("\n")
1025
1107
  ),
1026
1108
  consumer: FunctionSchema.describe("The consuming lambda function for the stream")
1027
1109
  }).optional().describe(
1028
1110
  "The settings for the DynamoDB table stream, which capture changes to items stored in the table."
1029
1111
  ),
1030
- indexes: z30.record(
1031
- z30.string(),
1032
- z30.object({
1112
+ indexes: z31.record(
1113
+ z31.string(),
1114
+ z31.object({
1033
1115
  hash: KeySchema.describe(
1034
1116
  "Specifies the name of the partition / hash key that makes up the primary key for the global secondary index."
1035
1117
  ),
1036
1118
  sort: KeySchema.optional().describe(
1037
1119
  "Specifies the name of the range / sort key that makes up the primary key for the global secondary index."
1038
1120
  ),
1039
- projection: z30.enum(["all", "keys-only"]).default("all").describe(
1121
+ projection: z31.enum(["all", "keys-only"]).default("all").describe(
1040
1122
  [
1041
1123
  "The set of attributes that are projected into the index:",
1042
1124
  "- all - All of the table attributes are projected into the index.",
@@ -1050,11 +1132,11 @@ var TablesSchema = z30.record(
1050
1132
  ).optional().describe("Define the tables in your stack.");
1051
1133
 
1052
1134
  // src/feature/task/schema.ts
1053
- import { z as z31 } from "zod";
1054
- var RetryAttemptsSchema2 = z31.number().int().min(0).max(2).describe(
1135
+ import { z as z32 } from "zod";
1136
+ var RetryAttemptsSchema2 = z32.number().int().min(0).max(2).describe(
1055
1137
  "The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
1056
1138
  );
1057
- var TaskSchema = z31.union([
1139
+ var TaskSchema = z32.union([
1058
1140
  LocalFileSchema.transform((file) => ({
1059
1141
  consumer: {
1060
1142
  code: {
@@ -1065,33 +1147,33 @@ var TaskSchema = z31.union([
1065
1147
  },
1066
1148
  retryAttempts: void 0
1067
1149
  })),
1068
- z31.object({
1150
+ z32.object({
1069
1151
  consumer: FunctionSchema,
1070
1152
  retryAttempts: RetryAttemptsSchema2.optional()
1071
1153
  })
1072
1154
  ]);
1073
- var TasksSchema = z31.record(ResourceIdSchema, TaskSchema).optional().describe("Define the tasks in your stack.");
1155
+ var TasksSchema = z32.record(ResourceIdSchema, TaskSchema).optional().describe("Define the tasks in your stack.");
1074
1156
 
1075
1157
  // src/feature/test/schema.ts
1076
- import { z as z32 } from "zod";
1077
- var TestsSchema = z32.union([LocalDirectorySchema.transform((v) => [v]), LocalDirectorySchema.array()]).describe("Define the location of your tests for your stack.").optional();
1158
+ import { z as z33 } from "zod";
1159
+ var TestsSchema = z33.union([LocalDirectorySchema.transform((v) => [v]), LocalDirectorySchema.array()]).describe("Define the location of your tests for your stack.").optional();
1078
1160
 
1079
1161
  // src/feature/topic/schema.ts
1080
1162
  import { kebabCase as kebabCase3 } from "change-case";
1081
- import { z as z33 } from "zod";
1082
- var TopicNameSchema = z33.string().min(3).max(256).regex(/^[a-z0-9\-]+$/i, "Invalid topic name").transform((value) => kebabCase3(value)).describe("Define event topic name.");
1083
- var TopicsSchema = z33.array(TopicNameSchema).refine((topics) => {
1163
+ import { z as z34 } from "zod";
1164
+ var TopicNameSchema = z34.string().min(3).max(256).regex(/^[a-z0-9\-]+$/i, "Invalid topic name").transform((value) => kebabCase3(value)).describe("Define event topic name.");
1165
+ var TopicsSchema = z34.array(TopicNameSchema).refine((topics) => {
1084
1166
  return topics.length === new Set(topics).size;
1085
1167
  }, "Must be a list of unique topic names").optional().describe("Define the event topics to publish too in your stack.");
1086
- var SubscribersSchema = z33.record(TopicNameSchema, FunctionSchema).optional().describe("Define the event topics to subscribe too in your stack.");
1168
+ var SubscribersSchema = z34.record(TopicNameSchema, FunctionSchema).optional().describe("Define the event topics to subscribe too in your stack.");
1087
1169
 
1088
1170
  // src/config/stack.ts
1089
1171
  var DependsSchema = ResourceIdSchema.array().optional().describe("Define the stacks that this stack is depended on.");
1090
1172
  var NameSchema = ResourceIdSchema.refine((name) => !["base", "hostedzones"].includes(name), {
1091
1173
  message: `Stack name can't be a reserved name.`
1092
1174
  }).describe("Stack name.");
1093
- var StackSchema = z34.object({
1094
- $schema: z34.string().optional(),
1175
+ var StackSchema = z35.object({
1176
+ $schema: z35.string().optional(),
1095
1177
  name: NameSchema,
1096
1178
  depends: DependsSchema,
1097
1179
  commands: CommandsSchema,
package/dist/client.js CHANGED
@@ -90,10 +90,12 @@ var createPubSubClient = (app, props) => {
90
90
  };
91
91
  });
92
92
  const getPubSubTopic = (name) => {
93
- return `${app}/pubsub/${name}`;
93
+ const appName = typeof app === "string" ? app : app();
94
+ return `${appName}/pubsub/${name}`;
94
95
  };
95
96
  const fromPubSubTopic = (name) => {
96
- return name.replace(`${app}/pubsub/`, "");
97
+ const appName = typeof app === "string" ? app : app();
98
+ return name.replace(`${appName}/pubsub/`, "");
97
99
  };
98
100
  return {
99
101
  ...mqtt,
@@ -1 +1 @@
1
- 19645fcec77189d7f564499303ce68d059f8305e
1
+ c8bc865ae78809bcecaa432f89aa387b3584c479
Binary file
package/dist/prebuild.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // src/prebuild.ts
2
2
  import { mkdir } from "fs/promises";
3
- import { dirname, join as join2 } from "path";
3
+ import { dirname as dirname2, join as join2 } from "path";
4
4
  import { fileURLToPath } from "url";
5
5
 
6
6
  // src/feature/function/prebuild.ts
@@ -11,13 +11,15 @@ import { pascalCase } from "change-case";
11
11
  import { writeFile } from "fs/promises";
12
12
  import { join } from "path";
13
13
 
14
- // src/feature/function/build/typescript/rolldown.ts
14
+ // src/feature/function/build/typescript/bundle.ts
15
+ import commonjs from "@rollup/plugin-commonjs";
15
16
  import json from "@rollup/plugin-json";
16
17
  import nodeResolve from "@rollup/plugin-node-resolve";
17
18
  import { createHash } from "crypto";
18
- import { rolldown } from "rolldown";
19
+ import { dirname } from "path";
20
+ import { rollup } from "rollup";
19
21
  import natives from "rollup-plugin-natives";
20
- import { minify as swcMinify } from "rollup-plugin-swc3";
22
+ import { swc, minify as swcMinify } from "rollup-plugin-swc3";
21
23
 
22
24
  // src/cli/ui/style.ts
23
25
  import chalk from "chalk";
@@ -48,15 +50,15 @@ var debugError = (error) => {
48
50
  });
49
51
  };
50
52
 
51
- // src/feature/function/build/typescript/rolldown.ts
52
- var bundleTypeScriptWithRolldown = async ({
53
+ // src/feature/function/build/typescript/bundle.ts
54
+ var bundleTypeScript = async ({
53
55
  format = "esm",
54
56
  minify = true,
55
57
  file,
56
58
  nativeDir,
57
59
  external
58
60
  }) => {
59
- const bundle = await rolldown({
61
+ const bundle = await rollup({
60
62
  input: file,
61
63
  external: (importee) => {
62
64
  return importee.startsWith("@aws-sdk") || importee.startsWith("aws-sdk") || external?.includes(importee);
@@ -65,26 +67,27 @@ var bundleTypeScriptWithRolldown = async ({
65
67
  debugError(error.message);
66
68
  },
67
69
  treeshake: {
68
- // preset: 'smallest',
70
+ preset: "smallest",
69
71
  moduleSideEffects: (id) => file === id
70
72
  },
71
73
  plugins: [
72
- // commonjs({ sourceMap: true }),
74
+ commonjs({ sourceMap: true }),
73
75
  nodeResolve({ preferBuiltins: true }),
76
+ // @ts-ignore
74
77
  nativeDir ? natives({
75
78
  copyTo: nativeDir,
76
79
  targetEsm: format === "esm",
77
80
  sourcemap: true
78
81
  }) : void 0,
79
- // swc({
80
- // // minify,
81
- // // module: true,
82
- // jsc: {
83
- // baseUrl: dirname(file),
84
- // minify: { sourceMap: true },
85
- // },
86
- // sourceMaps: true,
87
- // }),
82
+ swc({
83
+ // minify,
84
+ // module: true,
85
+ jsc: {
86
+ baseUrl: dirname(file),
87
+ minify: { sourceMap: true }
88
+ },
89
+ sourceMaps: true
90
+ }),
88
91
  minify ? swcMinify({
89
92
  module: format === "esm",
90
93
  sourceMap: true,
@@ -98,7 +101,7 @@ var bundleTypeScriptWithRolldown = async ({
98
101
  format,
99
102
  sourcemap: "hidden",
100
103
  exports: "auto",
101
- // manualChunks: {},
104
+ manualChunks: {},
102
105
  entryFileNames: `index.${ext}`,
103
106
  chunkFileNames: `[name].${ext}`
104
107
  });
@@ -146,7 +149,7 @@ var zipFiles = (files) => {
146
149
 
147
150
  // src/feature/function/prebuild.ts
148
151
  var prebuild = async (file, output) => {
149
- const bundle = await bundleTypeScriptWithRolldown({
152
+ const bundle = await bundleTypeScript({
150
153
  file,
151
154
  minify: true,
152
155
  external: []
@@ -157,7 +160,7 @@ var prebuild = async (file, output) => {
157
160
  };
158
161
 
159
162
  // src/prebuild.ts
160
- var __dirname = dirname(fileURLToPath(import.meta.url));
163
+ var __dirname = dirname2(fileURLToPath(import.meta.url));
161
164
  var builds = {
162
165
  rpc: "../src/feature/rpc/server/handle.ts"
163
166
  };