@awsless/awsless 0.0.594 → 0.0.596

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
@@ -750,6 +750,13 @@ import { basename as basename2, dirname as dirname3, join as join5 } from "path"
750
750
 
751
751
  // src/cli/debug.ts
752
752
  var queue = [];
753
+ var debugError = (error) => {
754
+ queue.push({
755
+ date: /* @__PURE__ */ new Date(),
756
+ type: color.error.dim("error"),
757
+ message: typeof error === "string" ? error : error instanceof Error ? color.error(error.message || "") : JSON.stringify(error)
758
+ });
759
+ };
753
760
  var debug = (...parts) => {
754
761
  queue.push({
755
762
  date: /* @__PURE__ */ new Date(),
@@ -3268,10 +3275,13 @@ var zipBundle = async ({ directory }) => {
3268
3275
  });
3269
3276
  };
3270
3277
 
3271
- // src/feature/function/build/typescript/bun.ts
3272
- import { minify as swcMinify } from "@swc/core";
3278
+ // src/feature/function/build/typescript/rolldown.ts
3279
+ import nodeResolve from "@rollup/plugin-node-resolve";
3273
3280
  import { createHash as createHash3 } from "crypto";
3274
- var bundleTypeScriptWithBun = async ({
3281
+ import { rolldown } from "rolldown";
3282
+ import natives from "rollup-plugin-natives";
3283
+ import { importAsString } from "rollup-plugin-string-import";
3284
+ var bundleTypeScriptWithRolldown = async ({
3275
3285
  format: format2 = "esm",
3276
3286
  minify = true,
3277
3287
  file,
@@ -3279,57 +3289,51 @@ var bundleTypeScriptWithBun = async ({
3279
3289
  external,
3280
3290
  importAsString: importAsStringList
3281
3291
  }) => {
3282
- const build3 = await Bun.build({
3283
- entrypoints: [file],
3284
- target: "node",
3285
- format: format2,
3286
- sourcemap: "none",
3287
- // sourcemap: 'external',
3288
- minify: true,
3289
- external: ["@aws-sdk/*", "aws-sdk", ...external ?? []],
3290
- naming: {
3291
- entry: `index.js`,
3292
- chunk: `[name].js`
3292
+ const bundle = await rolldown({
3293
+ input: file,
3294
+ external: (importee) => {
3295
+ return importee.startsWith("@aws-sdk") || importee.startsWith("aws-sdk") || external?.includes(importee);
3296
+ },
3297
+ onwarn: (error) => {
3298
+ debugError(error.message);
3299
+ },
3300
+ treeshake: {
3301
+ moduleSideEffects: (id) => file === id
3293
3302
  },
3294
3303
  plugins: [
3295
- {
3296
- name: "string-loader",
3297
- setup(build4) {
3298
- if (importAsStringList) {
3299
- build4.onLoad({ filter: new RegExp(importAsStringList.join("|")) }, async (args) => {
3300
- return {
3301
- contents: `export default ${JSON.stringify(await Bun.file(args.path).text())};`,
3302
- loader: "js"
3303
- };
3304
- });
3305
- }
3306
- }
3307
- }
3308
- // nativesPlugin(nativeDir),
3304
+ nodeResolve({ preferBuiltins: true }),
3305
+ nativeDir ? natives({
3306
+ copyTo: nativeDir,
3307
+ targetEsm: format2 === "esm",
3308
+ sourcemap: true
3309
+ }) : void 0,
3310
+ importAsStringList ? importAsString({
3311
+ include: importAsStringList
3312
+ }) : void 0
3309
3313
  ]
3310
3314
  });
3311
- if (!build3.success) {
3312
- throw new Error("Bun build error");
3313
- }
3315
+ const ext = format2 === "esm" ? "mjs" : "js";
3316
+ const result = await bundle.generate({
3317
+ format: format2,
3318
+ sourcemap: "hidden",
3319
+ exports: "auto",
3320
+ entryFileNames: `index.${ext}`,
3321
+ chunkFileNames: `[name].${ext}`,
3322
+ minify
3323
+ });
3314
3324
  const hash = createHash3("sha1");
3315
3325
  const files = [];
3316
- for await (const artifact of build3.outputs) {
3317
- if (artifact.kind === "asset" || artifact.kind === "sourcemap") {
3326
+ for (const item of result.output) {
3327
+ if (item.type !== "chunk") {
3318
3328
  continue;
3319
3329
  }
3320
- const originalCode = await artifact.text();
3321
- const { code } = await swcMinify(originalCode, {
3322
- toplevel: true,
3323
- module: true,
3324
- compress: true,
3325
- mangle: true,
3326
- sourceMap: false
3327
- });
3330
+ const code = Buffer.from(item.code, "utf8");
3331
+ const map = item.map ? Buffer.from(item.map.toString(), "utf8") : void 0;
3328
3332
  hash.update(code);
3329
3333
  files.push({
3330
- name: artifact.path.split("/").pop(),
3331
- code: Buffer.from(code)
3332
- // map: map ? Buffer.from(map) : undefined,
3334
+ name: item.fileName,
3335
+ code,
3336
+ map
3333
3337
  });
3334
3338
  }
3335
3339
  return {
@@ -3373,7 +3377,7 @@ var createLambdaFunction = (parentGroup, ctx, ns, id, local) => {
3373
3377
  const fingerprint = await generateFileHash(workspace, fileCode.file);
3374
3378
  return build3(fingerprint, async (write) => {
3375
3379
  const temp = await createTempFolder(`function--${name}`);
3376
- const bundle = await bundleTypeScriptWithBun({
3380
+ const bundle = await bundleTypeScriptWithRolldown({
3377
3381
  file: fileCode.file,
3378
3382
  external: [
3379
3383
  ...fileCode.external ?? [],
@@ -6076,6 +6080,9 @@ var layerFeature = defineFeature({
6076
6080
  resourceName: "assets",
6077
6081
  postfix: ctx.appId
6078
6082
  }),
6083
+ versioning: {
6084
+ enabled: true
6085
+ },
6079
6086
  forceDestroy: true
6080
6087
  });
6081
6088
  ctx.shared.set("layer", "bucket-name", bucket.bucket);
@@ -6126,10 +6133,12 @@ var layerFeature = defineFeature({
6126
6133
  }
6127
6134
  return name;
6128
6135
  }),
6129
- sourceCodeHash: $hash(props.file)
6136
+ sourceCodeHash: $hash(props.file),
6137
+ skipDestroy: true
6130
6138
  },
6131
6139
  {
6132
- dependsOn: [zip]
6140
+ dependsOn: [zip],
6141
+ replaceOnChanges: ["sourceCodeHash"]
6133
6142
  }
6134
6143
  );
6135
6144
  ctx.shared.add("layer", "arn", id, layer.arn);
@@ -6503,8 +6512,7 @@ var buildExecutable = async (input, outputPath, architecture) => {
6503
6512
  target,
6504
6513
  outfile: filePath
6505
6514
  },
6506
- target: "bun",
6507
- bytecode: true
6515
+ target: "bun"
6508
6516
  });
6509
6517
  } catch (error) {
6510
6518
  throw new ExpectedError(
@@ -8692,7 +8700,7 @@ import { parse as parse4, stringify } from "@awsless/json";
8692
8700
  // src/test/start.ts
8693
8701
  import commonjs from "@rollup/plugin-commonjs";
8694
8702
  import json from "@rollup/plugin-json";
8695
- import nodeResolve from "@rollup/plugin-node-resolve";
8703
+ import nodeResolve2 from "@rollup/plugin-node-resolve";
8696
8704
  import { dirname as dirname10, join as join18 } from "path";
8697
8705
  import { swc } from "rollup-plugin-swc3";
8698
8706
  import { fileURLToPath as fileURLToPath4 } from "url";
@@ -8750,7 +8758,7 @@ var startTest = async (props) => {
8750
8758
  // @ts-ignore
8751
8759
  commonjs({ sourceMap: true }),
8752
8760
  // @ts-ignore
8753
- nodeResolve({ preferBuiltins: true }),
8761
+ nodeResolve2({ preferBuiltins: true }),
8754
8762
  swc({
8755
8763
  jsc: {
8756
8764
  // baseUrl: dirname(input),
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awsless/awsless",
3
- "version": "0.0.594",
3
+ "version": "0.0.596",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -38,17 +38,17 @@
38
38
  "@awsless/clui": "^0.0.8",
39
39
  "@awsless/duration": "^0.0.4",
40
40
  "@awsless/dynamodb": "^0.3.8",
41
- "@awsless/json": "^0.0.10",
42
41
  "@awsless/iot": "^0.0.3",
43
- "@awsless/mqtt": "^0.0.2",
44
- "@awsless/open-search": "^0.0.21",
45
- "@awsless/redis": "^0.0.14",
46
42
  "@awsless/lambda": "^0.0.35",
47
- "@awsless/sns": "^0.0.10",
48
- "@awsless/sqs": "^0.0.16",
43
+ "@awsless/open-search": "^0.0.21",
49
44
  "@awsless/s3": "^0.0.21",
50
- "@awsless/validate": "^0.1.3",
45
+ "@awsless/sqs": "^0.0.16",
51
46
  "@awsless/ssm": "^0.0.7",
47
+ "@awsless/sns": "^0.0.10",
48
+ "@awsless/json": "^0.0.10",
49
+ "@awsless/validate": "^0.1.3",
50
+ "@awsless/mqtt": "^0.0.2",
51
+ "@awsless/redis": "^0.0.14",
52
52
  "@awsless/weak-cache": "^0.0.1"
53
53
  },
54
54
  "dependencies": {
@@ -121,7 +121,7 @@
121
121
  "pretty-hrtime": "^1.0.3",
122
122
  "promise-dag": "^1.0.0",
123
123
  "promisify-child-process": "^4.1.2",
124
- "rolldown": "1.0.0-beta.59",
124
+ "rolldown": "1.0.0-rc.3",
125
125
  "rollup": "^4.18.0",
126
126
  "rollup-plugin-natives": "^0.7.8",
127
127
  "rollup-plugin-replace": "^2.2.0",
@@ -140,18 +140,20 @@
140
140
  "zod": "^3.24.2",
141
141
  "zod-to-json-schema": "^3.24.3",
142
142
  "@awsless/big-float": "^0.1.5",
143
- "@awsless/clui": "^0.0.8",
144
143
  "@awsless/cloudwatch": "^0.0.1",
145
- "@awsless/duration": "^0.0.4",
146
144
  "@awsless/graphql": "^0.0.9",
145
+ "@awsless/duration": "^0.0.4",
147
146
  "@awsless/json": "^0.0.10",
148
- "@awsless/size": "^0.0.2",
149
- "@awsless/ts-file-cache": "^0.0.12",
150
147
  "@awsless/scheduler": "^0.0.4",
151
- "@awsless/validate": "^0.1.3"
148
+ "@awsless/size": "^0.0.2",
149
+ "@awsless/validate": "^0.1.3",
150
+ "@awsless/clui": "^0.0.8",
151
+ "@awsless/ts-file-cache": "^0.0.12"
152
152
  },
153
153
  "devDependencies": {
154
+ "@hono/node-server": "1.19.9",
154
155
  "@node-rs/bcrypt": "^1.10.5",
156
+ "hono": "4.11.7",
155
157
  "sharp": "^0.34.2"
156
158
  },
157
159
  "scripts": {