@awsless/cli 0.0.31 → 0.0.33

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.
Binary file
package/dist/prebuild.js CHANGED
@@ -52,13 +52,15 @@ var bundleTypeScriptWithRolldown = async ({
52
52
  file,
53
53
  nativeDir,
54
54
  external,
55
+ externalAwsSdk = true,
56
+ codeSplitting = true,
55
57
  importAsString: importAsStringList
56
58
  }) => {
57
59
  const bundle = await rolldown({
58
60
  input: file,
59
61
  platform: "node",
60
62
  external: (importee) => {
61
- return importee.startsWith("@aws-sdk") || importee.startsWith("aws-sdk") || external?.includes(importee);
63
+ return externalAwsSdk && (importee.startsWith("@aws-sdk") || importee.startsWith("aws-sdk")) || external?.includes(importee);
62
64
  },
63
65
  onwarn: (error) => {
64
66
  debugError(error.message);
@@ -87,6 +89,7 @@ var bundleTypeScriptWithRolldown = async ({
87
89
  exports: "auto",
88
90
  entryFileNames: `index.${ext}`,
89
91
  chunkFileNames: `[name].${ext}`,
92
+ codeSplitting,
90
93
  minify
91
94
  });
92
95
  const hash = createHash("sha1");
@@ -142,6 +145,16 @@ var prebuild = async (file, output, external = []) => {
142
145
  await writeFile(join(output, "HASH"), bundle.hash);
143
146
  await writeFile(join(output, "bundle.zip"), archive);
144
147
  };
148
+ var prebuildBundle = async (file, output) => {
149
+ const bundle = await bundleTypeScriptWithRolldown({
150
+ file,
151
+ minify: true,
152
+ externalAwsSdk: false,
153
+ codeSplitting: false
154
+ });
155
+ await Promise.all(bundle.files.map((item) => writeFile(join(output, item.name), item.code)));
156
+ await writeFile(join(output, "HASH"), bundle.hash);
157
+ };
145
158
 
146
159
  // src/prebuild.ts
147
160
  var cwd = join2(process.cwd(), "./dist");
@@ -150,10 +163,19 @@ var builds = {
150
163
  image: "../src/feature/image/server/handle.ts",
151
164
  icon: "../src/feature/icon/server/handle.ts",
152
165
  "on-failure": "../src/feature/on-failure/server/handle.ts",
153
- "on-error-log": "../src/feature/on-error-log/server/handle.ts"
166
+ "on-error-log": "../src/feature/on-error-log/server/handle.ts",
167
+ "pubsub-publisher": "../src/feature/pubsub/publisher/handle.ts"
154
168
  };
155
169
  for (const [name, file] of Object.entries(builds)) {
156
170
  const output = join2(cwd, "prebuild", name);
157
171
  await mkdir(output, { recursive: true });
158
172
  await prebuild(join2(cwd, file), output, ["sharp"]);
159
173
  }
174
+ var bundles = {
175
+ "pubsub-server": "../src/feature/pubsub/server/index.ts"
176
+ };
177
+ for (const [name, file] of Object.entries(bundles)) {
178
+ const output = join2(cwd, "prebuild", name);
179
+ await mkdir(output, { recursive: true });
180
+ await prebuildBundle(join2(cwd, file), output);
181
+ }