@awsless/awsless 0.0.563 → 0.0.565

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
@@ -869,7 +869,8 @@ var LayersSchema = z14.string().array().describe(
869
869
  var FileCodeSchema = z14.object({
870
870
  file: LocalFileSchema.describe("The file path of the function code."),
871
871
  minify: MinifySchema.optional().default(true),
872
- external: z14.string().array().optional().describe(`A list of external packages that won't be included in the bundle.`)
872
+ external: z14.string().array().optional().describe(`A list of external packages that won't be included in the bundle.`),
873
+ importAsString: z14.string().array().optional().describe(`A list of glob patterns, which specifies the files that should be imported as string.`)
873
874
  });
874
875
  var BundleCodeSchema = z14.object({
875
876
  bundle: LocalDirectorySchema.describe("The directory that needs to be bundled.")
@@ -2957,13 +2958,15 @@ import { createHash } from "crypto";
2957
2958
  import { dirname as dirname5 } from "path";
2958
2959
  import { rollup } from "rollup";
2959
2960
  import natives from "rollup-plugin-natives";
2961
+ import { importAsString } from "rollup-plugin-string-import";
2960
2962
  import { swc, minify as swcMinify } from "rollup-plugin-swc3";
2961
2963
  var bundleTypeScript = async ({
2962
2964
  format: format2 = "esm",
2963
2965
  minify = true,
2964
2966
  file,
2965
2967
  nativeDir,
2966
- external
2968
+ external,
2969
+ importAsString: importAsStringList
2967
2970
  }) => {
2968
2971
  const bundle = await rollup({
2969
2972
  input: file,
@@ -3000,7 +3003,10 @@ var bundleTypeScript = async ({
3000
3003
  sourceMap: true,
3001
3004
  compress: true
3002
3005
  }) : void 0,
3003
- json()
3006
+ json(),
3007
+ importAsStringList ? importAsString({
3008
+ include: importAsStringList
3009
+ }) : void 0
3004
3010
  ]
3005
3011
  });
3006
3012
  const ext = format2 === "esm" ? "mjs" : "js";
@@ -3197,7 +3203,8 @@ var createLambdaFunction = (parentGroup, ctx, ns, id, local) => {
3197
3203
  ...(props.layers ?? []).flatMap((id2) => ctx.shared.entry("layer", `packages`, id2))
3198
3204
  ],
3199
3205
  minify: fileCode.minify,
3200
- nativeDir: temp.path
3206
+ nativeDir: temp.path,
3207
+ importAsString: fileCode.importAsString
3201
3208
  });
3202
3209
  const nativeFiles = await temp.files();
3203
3210
  const archive = await zipFiles([
@@ -6940,7 +6947,7 @@ var buildExecutable = async (input, outputPath) => {
6940
6947
  }
6941
6948
  const file = await readFile4(filePath);
6942
6949
  return {
6943
- hash: createHash4("sha1").update(file).digest("hex"),
6950
+ hash: createHash4("sha1").update(file).update("x86_64").digest("hex"),
6944
6951
  file
6945
6952
  };
6946
6953
  };
@@ -7330,7 +7337,7 @@ var instanceFeature = defineFeature({
7330
7337
 
7331
7338
  // src/feature/metric/index.ts
7332
7339
  import { $ as $27, Group as Group27 } from "@awsless/formation";
7333
- import { kebabCase as kebabCase8, constantCase as constantCase15 } from "change-case";
7340
+ import { kebabCase as kebabCase8, constantCase as constantCase14 } from "change-case";
7334
7341
  import { toSeconds as toSeconds11 } from "@awsless/duration";
7335
7342
  var typeGenCode9 = `
7336
7343
  import { type PutDataProps, putData, batchPutData } from '@awsless/cloudwatch'
@@ -7398,7 +7405,7 @@ var metricFeature = defineFeature({
7398
7405
  });
7399
7406
  for (const [id, props] of Object.entries(ctx.stackConfig.metrics ?? {})) {
7400
7407
  const group = new Group27(ctx.stack, "metric", id);
7401
- ctx.addEnv(`METRIC_${constantCase15(id)}`, props.type);
7408
+ ctx.addEnv(`METRIC_${constantCase14(id)}`, props.type);
7402
7409
  for (const alarmId in props.alarms ?? []) {
7403
7410
  const alarmGroup = new Group27(group, "alarm", alarmId);
7404
7411
  const alarmName = kebabCase8(`${id}-${alarmId}`);
@@ -8915,7 +8922,7 @@ var auth = (program2) => {
8915
8922
 
8916
8923
  // src/cli/command/bind.ts
8917
8924
  import { log as log18 } from "@awsless/clui";
8918
- import { constantCase as constantCase16 } from "change-case";
8925
+ import { constantCase as constantCase15 } from "change-case";
8919
8926
  import { spawn } from "child_process";
8920
8927
  var bind = (program2) => {
8921
8928
  program2.command("bind").argument("[command...]", "The command to execute").option("--config <string...>", "List of config values that will be accessable", (v) => v.split(",")).description(`Bind your site environment variables to a command`).action(async (commands9 = [], opts) => {
@@ -8944,10 +8951,10 @@ var bind = (program2) => {
8944
8951
  const configList = opts.config ?? [];
8945
8952
  const configs = {};
8946
8953
  for (const name of configList) {
8947
- configs[`CONFIG_${constantCase16(name)}`] = name;
8954
+ configs[`CONFIG_${constantCase15(name)}`] = name;
8948
8955
  }
8949
8956
  if (configList.length ?? 0 > 0) {
8950
- log18.note("Bind Config", configList.map((v) => color.label(constantCase16(v))).join("\n"));
8957
+ log18.note("Bind Config", configList.map((v) => color.label(constantCase15(v))).join("\n"));
8951
8958
  }
8952
8959
  if (commands9.length === 0) {
8953
8960
  return "No command to execute.";
@@ -261,7 +261,8 @@ var LayersSchema = z11.string().array().describe(
261
261
  var FileCodeSchema = z11.object({
262
262
  file: LocalFileSchema.describe("The file path of the function code."),
263
263
  minify: MinifySchema.optional().default(true),
264
- external: z11.string().array().optional().describe(`A list of external packages that won't be included in the bundle.`)
264
+ external: z11.string().array().optional().describe(`A list of external packages that won't be included in the bundle.`),
265
+ importAsString: z11.string().array().optional().describe(`A list of glob patterns, which specifies the files that should be imported as string.`)
265
266
  });
266
267
  var BundleCodeSchema = z11.object({
267
268
  bundle: LocalDirectorySchema.describe("The directory that needs to be bundled.")
Binary file
Binary file
Binary file
package/dist/prebuild.js CHANGED
@@ -19,6 +19,7 @@ import { createHash } from "crypto";
19
19
  import { dirname } from "path";
20
20
  import { rollup } from "rollup";
21
21
  import natives from "rollup-plugin-natives";
22
+ import { importAsString } from "rollup-plugin-string-import";
22
23
  import { swc, minify as swcMinify } from "rollup-plugin-swc3";
23
24
 
24
25
  // src/cli/ui/style.ts
@@ -56,7 +57,8 @@ var bundleTypeScript = async ({
56
57
  minify = true,
57
58
  file,
58
59
  nativeDir,
59
- external
60
+ external,
61
+ importAsString: importAsStringList
60
62
  }) => {
61
63
  const bundle = await rollup({
62
64
  input: file,
@@ -93,7 +95,10 @@ var bundleTypeScript = async ({
93
95
  sourceMap: true,
94
96
  compress: true
95
97
  }) : void 0,
96
- json()
98
+ json(),
99
+ importAsStringList ? importAsString({
100
+ include: importAsStringList
101
+ }) : void 0
97
102
  ]
98
103
  });
99
104
  const ext = format === "esm" ? "mjs" : "js";