@awsless/awsless 0.0.473 → 0.0.476

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,25 +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
887
  ssr: FunctionSchema.optional().describe("Specifies the file that will render the site on the server."),
862
888
  // envPrefix: z.string().optional().describe('Specifies a prefix for all '),
863
- origin: z28.enum(["ssr-first", "static-first"]).default("static-first").describe("Specifies the origin fallback ordering."),
889
+ origin: z29.enum(["ssr-first", "static-first"]).default("static-first").describe("Specifies the origin fallback ordering."),
864
890
  // bind: z.object({
865
891
  // auth:
866
892
  // h
@@ -873,11 +899,11 @@ var SitesSchema = z28.record(
873
899
  // build: z.string().optional(),
874
900
  // }),
875
901
  // ]),
876
- geoRestrictions: z28.array(z28.string().length(2).toUpperCase()).default([]).describe("Specifies a blacklist of countries that should be blocked."),
877
- 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(
878
904
  "Specify if the host header should be forwarded to the SSR function. Keep in mind that this requires an extra CloudFront Function."
879
905
  ),
880
- errors: z28.object({
906
+ errors: z29.object({
881
907
  400: ErrorResponseSchema.describe("Customize a `400 Bad Request` response."),
882
908
  403: ErrorResponseSchema.describe("Customize a `403 Forbidden` response."),
883
909
  404: ErrorResponseSchema.describe("Customize a `404 Not Found` response."),
@@ -890,16 +916,16 @@ var SitesSchema = z28.record(
890
916
  503: ErrorResponseSchema.describe("Customize a `503 Service Unavailable` response."),
891
917
  504: ErrorResponseSchema.describe("Customize a `504 Gateway Timeout` response.")
892
918
  }).optional().describe("Customize the error responses for specific HTTP status codes."),
893
- cors: z28.object({
894
- override: z28.boolean().default(false),
919
+ cors: z29.object({
920
+ override: z29.boolean().default(false),
895
921
  maxAge: DurationSchema.default("365 days"),
896
- exposeHeaders: z28.string().array().optional(),
897
- credentials: z28.boolean().default(false),
898
- headers: z28.string().array().default(["*"]),
899
- origins: z28.string().array().default(["*"]),
900
- 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"])
901
927
  }).optional().describe("Define the cors headers."),
902
- security: z28.object({
928
+ security: z29.object({
903
929
  // contentSecurityPolicy: z.object({
904
930
  // override: z.boolean().default(false),
905
931
  // policy: z.string(),
@@ -941,10 +967,10 @@ var SitesSchema = z28.record(
941
967
  // reportUri?: string
942
968
  // }
943
969
  }).optional().describe("Define the security policy."),
944
- cache: z28.object({
945
- cookies: z28.string().array().optional().describe("Specifies the cookies that CloudFront includes in the cache key."),
946
- headers: z28.string().array().optional().describe("Specifies the headers that CloudFront includes in the cache key."),
947
- 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.")
948
974
  }).optional().describe(
949
975
  "Specifies the cookies, headers, and query values that CloudFront includes in the cache key."
950
976
  )
@@ -952,22 +978,22 @@ var SitesSchema = z28.record(
952
978
  ).optional().describe("Define the sites in your stack.");
953
979
 
954
980
  // src/feature/store/schema.ts
955
- import { z as z29 } from "zod";
956
- var StoresSchema = z29.union([
957
- z29.array(ResourceIdSchema).transform((list) => {
981
+ import { z as z30 } from "zod";
982
+ var StoresSchema = z30.union([
983
+ z30.array(ResourceIdSchema).transform((list) => {
958
984
  const stores = {};
959
985
  for (const key of list) {
960
986
  stores[key] = {};
961
987
  }
962
988
  return stores;
963
989
  }),
964
- z29.record(
990
+ z30.record(
965
991
  ResourceIdSchema,
966
- z29.object({
992
+ z30.object({
967
993
  // cors: CorsSchema,
968
994
  // deletionProtection: DeletionProtectionSchema.optional(),
969
- versioning: z29.boolean().default(false).describe("Enable versioning of your store."),
970
- events: z29.object({
995
+ versioning: z30.boolean().default(false).describe("Enable versioning of your store."),
996
+ events: z30.object({
971
997
  // create
972
998
  "created:*": FunctionSchema.optional().describe(
973
999
  "Subscribe to notifications regardless of the API that was used to create an object."
@@ -1001,22 +1027,22 @@ var StoresSchema = z29.union([
1001
1027
 
1002
1028
  // src/feature/table/schema.ts
1003
1029
  import { minutes as minutes4, seconds as seconds4 } from "@awsless/duration";
1004
- import { z as z30 } from "zod";
1005
- var KeySchema = z30.string().min(1).max(255);
1006
- var TablesSchema = z30.record(
1030
+ import { z as z31 } from "zod";
1031
+ var KeySchema = z31.string().min(1).max(255);
1032
+ var TablesSchema = z31.record(
1007
1033
  ResourceIdSchema,
1008
- z30.object({
1034
+ z31.object({
1009
1035
  hash: KeySchema.describe(
1010
1036
  "Specifies the name of the partition / hash key that makes up the primary key for the table."
1011
1037
  ),
1012
1038
  sort: KeySchema.optional().describe(
1013
1039
  "Specifies the name of the range / sort key that makes up the primary key for the table."
1014
1040
  ),
1015
- 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(
1016
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".'
1017
1043
  ),
1018
- class: z30.enum(["standard", "standard-infrequent-access"]).default("standard").describe("The table class of the table."),
1019
- pointInTimeRecovery: z30.boolean().default(false).describe("Indicates whether point in time recovery is enabled on the table."),
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."),
1020
1046
  ttl: KeySchema.optional().describe(
1021
1047
  [
1022
1048
  "The name of the TTL attribute used to store the expiration time for items in the table.",
@@ -1024,8 +1050,8 @@ var TablesSchema = z30.record(
1024
1050
  ].join("\n")
1025
1051
  ),
1026
1052
  // deletionProtection: DeletionProtectionSchema.optional(),
1027
- stream: z30.object({
1028
- type: z30.enum(["keys-only", "new-image", "old-image", "new-and-old-images"]).describe(
1053
+ stream: z31.object({
1054
+ type: z31.enum(["keys-only", "new-image", "old-image", "new-and-old-images"]).describe(
1029
1055
  [
1030
1056
  "When an item in the table is modified, you can determines what information is written to the stream for this table.",
1031
1057
  "Valid values are:",
@@ -1035,7 +1061,7 @@ var TablesSchema = z30.record(
1035
1061
  "- new-and-old-images - Both the new and the old item images of the item are written to the stream."
1036
1062
  ].join("\n")
1037
1063
  ),
1038
- batchSize: z30.number().min(1).max(1e4).default(1).describe(
1064
+ batchSize: z31.number().min(1).max(1e4).default(1).describe(
1039
1065
  [
1040
1066
  "The maximum number of records in each batch that Lambda pulls from your stream and sends to your function.",
1041
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).",
@@ -1065,7 +1091,7 @@ var TablesSchema = z30.record(
1065
1091
  // 'You can specify a number from -1 to 10000.',
1066
1092
  // ].join('\n')
1067
1093
  // ),
1068
- retryAttempts: z30.number().min(-1).max(1e4).default(-1).describe(
1094
+ retryAttempts: z31.number().min(-1).max(1e4).default(-1).describe(
1069
1095
  [
1070
1096
  "Discard records after the specified number of retries.",
1071
1097
  "The default value is -1, which sets the maximum number of retries to infinite.",
@@ -1073,10 +1099,9 @@ var TablesSchema = z30.record(
1073
1099
  "You can specify a number from -1 to 10000."
1074
1100
  ].join("\n")
1075
1101
  ),
1076
- concurrencyPerShard: z30.number().min(1).max(10).default(1).describe(
1102
+ concurrencyPerShard: z31.number().min(1).max(10).default(1).describe(
1077
1103
  [
1078
1104
  "The number of batches to process concurrently from each shard.",
1079
- "The default value is 1.",
1080
1105
  "You can specify a number from 1 to 10."
1081
1106
  ].join("\n")
1082
1107
  ),
@@ -1084,16 +1109,16 @@ var TablesSchema = z30.record(
1084
1109
  }).optional().describe(
1085
1110
  "The settings for the DynamoDB table stream, which capture changes to items stored in the table."
1086
1111
  ),
1087
- indexes: z30.record(
1088
- z30.string(),
1089
- z30.object({
1112
+ indexes: z31.record(
1113
+ z31.string(),
1114
+ z31.object({
1090
1115
  hash: KeySchema.describe(
1091
1116
  "Specifies the name of the partition / hash key that makes up the primary key for the global secondary index."
1092
1117
  ),
1093
1118
  sort: KeySchema.optional().describe(
1094
1119
  "Specifies the name of the range / sort key that makes up the primary key for the global secondary index."
1095
1120
  ),
1096
- projection: z30.enum(["all", "keys-only"]).default("all").describe(
1121
+ projection: z31.enum(["all", "keys-only"]).default("all").describe(
1097
1122
  [
1098
1123
  "The set of attributes that are projected into the index:",
1099
1124
  "- all - All of the table attributes are projected into the index.",
@@ -1107,11 +1132,11 @@ var TablesSchema = z30.record(
1107
1132
  ).optional().describe("Define the tables in your stack.");
1108
1133
 
1109
1134
  // src/feature/task/schema.ts
1110
- import { z as z31 } from "zod";
1111
- 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(
1112
1137
  "The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
1113
1138
  );
1114
- var TaskSchema = z31.union([
1139
+ var TaskSchema = z32.union([
1115
1140
  LocalFileSchema.transform((file) => ({
1116
1141
  consumer: {
1117
1142
  code: {
@@ -1122,33 +1147,33 @@ var TaskSchema = z31.union([
1122
1147
  },
1123
1148
  retryAttempts: void 0
1124
1149
  })),
1125
- z31.object({
1150
+ z32.object({
1126
1151
  consumer: FunctionSchema,
1127
1152
  retryAttempts: RetryAttemptsSchema2.optional()
1128
1153
  })
1129
1154
  ]);
1130
- 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.");
1131
1156
 
1132
1157
  // src/feature/test/schema.ts
1133
- import { z as z32 } from "zod";
1134
- 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();
1135
1160
 
1136
1161
  // src/feature/topic/schema.ts
1137
1162
  import { kebabCase as kebabCase3 } from "change-case";
1138
- import { z as z33 } from "zod";
1139
- 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.");
1140
- 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) => {
1141
1166
  return topics.length === new Set(topics).size;
1142
1167
  }, "Must be a list of unique topic names").optional().describe("Define the event topics to publish too in your stack.");
1143
- 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.");
1144
1169
 
1145
1170
  // src/config/stack.ts
1146
1171
  var DependsSchema = ResourceIdSchema.array().optional().describe("Define the stacks that this stack is depended on.");
1147
1172
  var NameSchema = ResourceIdSchema.refine((name) => !["base", "hostedzones"].includes(name), {
1148
1173
  message: `Stack name can't be a reserved name.`
1149
1174
  }).describe("Stack name.");
1150
- var StackSchema = z34.object({
1151
- $schema: z34.string().optional(),
1175
+ var StackSchema = z35.object({
1176
+ $schema: z35.string().optional(),
1152
1177
  name: NameSchema,
1153
1178
  depends: DependsSchema,
1154
1179
  commands: CommandsSchema,
package/dist/client.d.ts CHANGED
@@ -61,7 +61,7 @@ type ClientProps = {
61
61
  token?: string;
62
62
  };
63
63
  type ClientPropsProvider = () => Promise<ClientProps> | ClientProps;
64
- declare const createPubSubClient: (app: string, props: ClientProps | ClientPropsProvider) => {
64
+ declare const createPubSubClient: (app: string | (() => string), props: ClientProps | ClientPropsProvider) => {
65
65
  connected: boolean;
66
66
  topics: string[];
67
67
  publish(topic: string, event: string, payload: unknown, qos: QoS): Promise<void>;
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
- 3ef5fb4ef69d1fdaa28fdb474186990eba65bd52
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
  };