@awsless/awsless 0.0.50 → 0.0.52

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.
Files changed (2) hide show
  1. package/dist/bin.js +24 -15
  2. package/package.json +3 -3
package/dist/bin.js CHANGED
@@ -803,7 +803,7 @@ import json from "@rollup/plugin-json";
803
803
  import commonjs from "@rollup/plugin-commonjs";
804
804
  import nodeResolve from "@rollup/plugin-node-resolve";
805
805
  import { dirname } from "path";
806
- var rollupBundle = ({ format: format2 = "esm", minify = true, handler = "index.default" } = {}) => {
806
+ var rollupBundle = ({ format: format2 = "esm", minify = true, handler = "default" } = {}) => {
807
807
  return async (input) => {
808
808
  const bundle = await rollup({
809
809
  input,
@@ -841,20 +841,29 @@ var rollupBundle = ({ format: format2 = "esm", minify = true, handler = "index.d
841
841
  const result = await bundle.generate({
842
842
  format: format2,
843
843
  sourcemap: "hidden",
844
- exports: "auto"
844
+ exports: "auto",
845
+ manualChunks: {}
845
846
  });
846
- const output = result.output[0];
847
- const code = Buffer.from(output.code, "utf8");
848
- const map = output.map ? Buffer.from(output.map.toString(), "utf8") : void 0;
849
- const hash = createHash("sha1").update(code).digest("hex");
850
- return {
851
- handler,
852
- hash,
853
- files: [{
854
- name: format2 === "esm" ? "index.mjs" : "index.js",
847
+ const hash = createHash("sha1");
848
+ const files = [];
849
+ for (const item of result.output) {
850
+ if (item.type !== "chunk") {
851
+ continue;
852
+ }
853
+ const name = item.isEntry ? format2 === "esm" ? "index.mjs" : "index.js" : item.fileName;
854
+ const code = Buffer.from(item.code, "utf8");
855
+ const map = item.map ? Buffer.from(item.map.toString(), "utf8") : void 0;
856
+ hash.update(code);
857
+ files.push({
858
+ name,
855
859
  code,
856
860
  map
857
- }]
861
+ });
862
+ }
863
+ return {
864
+ handler: `index.${handler}`,
865
+ hash: hash.digest("hex"),
866
+ files
858
867
  };
859
868
  };
860
869
  };
@@ -896,7 +905,7 @@ var Code = class {
896
905
  const file = join(root2, `features/${id}.js`);
897
906
  return new FileCode(id, file, rollupBundle({
898
907
  minify: false,
899
- handler: "index.handler"
908
+ handler: "handler"
900
909
  }));
901
910
  }
902
911
  static fromInlineFeature(id) {
@@ -905,7 +914,7 @@ var Code = class {
905
914
  return new InlineFileCode(id, file, rollupBundle({
906
915
  format: "cjs",
907
916
  minify: false,
908
- handler: "index.handler"
917
+ handler: "handler"
909
918
  }));
910
919
  }
911
920
  };
@@ -1311,7 +1320,7 @@ var schema = z6.object({
1311
1320
  /** The name of the exported method within your code that Lambda calls to run your function.
1312
1321
  * @default 'default'
1313
1322
  */
1314
- handler: z6.string().default("index.default"),
1323
+ handler: z6.string().default("default"),
1315
1324
  /** Minify the function code.
1316
1325
  * @default true
1317
1326
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awsless/awsless",
3
- "version": "0.0.50",
3
+ "version": "0.0.52",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {
@@ -25,8 +25,8 @@
25
25
  "peerDependencies": {
26
26
  "@awsless/lambda": "^0.0.6",
27
27
  "@awsless/sns": "^0.0.6",
28
- "@awsless/sqs": "^0.0.6",
29
- "@awsless/ssm": "^0.0.7"
28
+ "@awsless/ssm": "^0.0.7",
29
+ "@awsless/sqs": "^0.0.6"
30
30
  },
31
31
  "dependencies": {
32
32
  "@aws-sdk/client-cloudformation": "^3.369.0",