@awsless/cli 0.0.41 → 0.0.42

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
@@ -1205,7 +1205,9 @@ var LayersSchema = z15.string().array().describe(
1205
1205
  var FileCodeSchema = z15.object({
1206
1206
  file: LocalFileSchema.describe("The file path of the function code."),
1207
1207
  minify: MinifySchema.optional().default(true),
1208
- moduleSideEffects: z15.boolean().default(false).describe(`Will flag all modules as having potential side effects.`),
1208
+ moduleSideEffects: RelativePathSchema.array().default([]).describe(
1209
+ `A list of glob patterns for modules that should be flagged as having potential side effects. For example "./.svelte-kit/**" will flag every file inside the .svelte-kit folder.`
1210
+ ),
1209
1211
  external: z15.string().array().optional().describe(`A list of external packages that won't be included in the bundle.`),
1210
1212
  importAsString: z15.string().array().optional().describe(`A list of glob patterns, which specifies the files that should be imported as string.`)
1211
1213
  });
@@ -3727,8 +3729,18 @@ var zipBundle = async ({ directory }) => {
3727
3729
 
3728
3730
  // src/feature/function/build/typescript/rolldown.ts
3729
3731
  import { createHash as createHash2 } from "crypto";
3732
+ import { Minimatch } from "minimatch";
3730
3733
  import { rolldown } from "rolldown";
3731
3734
  import { importAsString } from "rollup-plugin-string-import";
3735
+ var createModuleMatcher = (patterns = []) => {
3736
+ const globs = patterns.map((pattern) => {
3737
+ return new Minimatch(pattern.replaceAll("\\", "/"), { dot: true });
3738
+ });
3739
+ return (id) => {
3740
+ const path = id.replaceAll("\\", "/");
3741
+ return globs.some((glob6) => glob6.match(path));
3742
+ };
3743
+ };
3732
3744
  var bundleTypeScriptWithRolldown = async ({
3733
3745
  format: format3 = "esm",
3734
3746
  minify = true,
@@ -3740,6 +3752,7 @@ var bundleTypeScriptWithRolldown = async ({
3740
3752
  codeSplitting = true,
3741
3753
  importAsString: importAsStringList
3742
3754
  }) => {
3755
+ const hasModuleSideEffects = createModuleMatcher(moduleSideEffects);
3743
3756
  const bundle = await rolldown({
3744
3757
  input: file,
3745
3758
  platform: "node",
@@ -3750,7 +3763,7 @@ var bundleTypeScriptWithRolldown = async ({
3750
3763
  debugError(error.message);
3751
3764
  },
3752
3765
  treeshake: {
3753
- moduleSideEffects: moduleSideEffects ? true : (id) => file === id
3766
+ moduleSideEffects: (id) => file === id || hasModuleSideEffects(id)
3754
3767
  },
3755
3768
  plugins: [
3756
3769
  // nodeResolve({ preferBuiltins: true }),
@@ -259,7 +259,9 @@ var LayersSchema = z11.string().array().describe(
259
259
  var FileCodeSchema = z11.object({
260
260
  file: LocalFileSchema.describe("The file path of the function code."),
261
261
  minify: MinifySchema.optional().default(true),
262
- moduleSideEffects: z11.boolean().default(false).describe(`Will flag all modules as having potential side effects.`),
262
+ moduleSideEffects: RelativePathSchema.array().default([]).describe(
263
+ `A list of glob patterns for modules that should be flagged as having potential side effects. For example "./.svelte-kit/**" will flag every file inside the .svelte-kit folder.`
264
+ ),
263
265
  external: z11.string().array().optional().describe(`A list of external packages that won't be included in the bundle.`),
264
266
  importAsString: z11.string().array().optional().describe(`A list of glob patterns, which specifies the files that should be imported as string.`)
265
267
  });
@@ -1994,6 +1996,7 @@ var generateJsonSchema = (props) => {
1994
1996
  var appendDefaults = (object) => {
1995
1997
  if (Array.isArray(object)) {
1996
1998
  object.forEach(appendDefaults);
1999
+ return;
1997
2000
  }
1998
2001
  if (typeof object === "object" && object !== null) {
1999
2002
  if ("default" in object && "type" in object) {
Binary file
Binary file
Binary file
Binary file
package/dist/prebuild.js CHANGED
@@ -12,6 +12,7 @@ import { join } from "path";
12
12
 
13
13
  // src/feature/function/build/typescript/rolldown.ts
14
14
  import { createHash } from "crypto";
15
+ import { Minimatch } from "minimatch";
15
16
  import { rolldown } from "rolldown";
16
17
  import { importAsString } from "rollup-plugin-string-import";
17
18
 
@@ -45,6 +46,15 @@ var debugError = (error) => {
45
46
  };
46
47
 
47
48
  // src/feature/function/build/typescript/rolldown.ts
49
+ var createModuleMatcher = (patterns = []) => {
50
+ const globs = patterns.map((pattern) => {
51
+ return new Minimatch(pattern.replaceAll("\\", "/"), { dot: true });
52
+ });
53
+ return (id) => {
54
+ const path = id.replaceAll("\\", "/");
55
+ return globs.some((glob) => glob.match(path));
56
+ };
57
+ };
48
58
  var bundleTypeScriptWithRolldown = async ({
49
59
  format = "esm",
50
60
  minify = true,
@@ -56,6 +66,7 @@ var bundleTypeScriptWithRolldown = async ({
56
66
  codeSplitting = true,
57
67
  importAsString: importAsStringList
58
68
  }) => {
69
+ const hasModuleSideEffects = createModuleMatcher(moduleSideEffects);
59
70
  const bundle = await rolldown({
60
71
  input: file,
61
72
  platform: "node",
@@ -66,7 +77,7 @@ var bundleTypeScriptWithRolldown = async ({
66
77
  debugError(error.message);
67
78
  },
68
79
  treeshake: {
69
- moduleSideEffects: moduleSideEffects ? true : (id) => file === id
80
+ moduleSideEffects: (id) => file === id || hasModuleSideEffects(id)
70
81
  },
71
82
  plugins: [
72
83
  // nodeResolve({ preferBuiltins: true }),