@awsless/cli 0.0.39 → 0.0.41

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,6 +1205,7 @@ 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
1209
  external: z15.string().array().optional().describe(`A list of external packages that won't be included in the bundle.`),
1209
1210
  importAsString: z15.string().array().optional().describe(`A list of glob patterns, which specifies the files that should be imported as string.`)
1210
1211
  });
@@ -3734,6 +3735,7 @@ var bundleTypeScriptWithRolldown = async ({
3734
3735
  file,
3735
3736
  nativeDir,
3736
3737
  external,
3738
+ moduleSideEffects,
3737
3739
  externalAwsSdk = true,
3738
3740
  codeSplitting = true,
3739
3741
  importAsString: importAsStringList
@@ -3748,7 +3750,7 @@ var bundleTypeScriptWithRolldown = async ({
3748
3750
  debugError(error.message);
3749
3751
  },
3750
3752
  treeshake: {
3751
- moduleSideEffects: (id) => file === id
3753
+ moduleSideEffects: moduleSideEffects ? true : (id) => file === id
3752
3754
  },
3753
3755
  plugins: [
3754
3756
  // nodeResolve({ preferBuiltins: true }),
@@ -3836,6 +3838,7 @@ var createLambdaFunction = (parentGroup, ctx, ns, id, local) => {
3836
3838
  ...fileCode.external ?? [],
3837
3839
  ...(props.layers ?? []).flatMap((id2) => ctx.shared.entry("layer", `packages`, id2))
3838
3840
  ],
3841
+ moduleSideEffects: fileCode.moduleSideEffects,
3839
3842
  minify: fileCode.minify,
3840
3843
  nativeDir: temp.path,
3841
3844
  importAsString: fileCode.importAsString
@@ -4492,7 +4495,7 @@ type Response<F extends Func> = PartialDeep<Awaited<InvokeResponse<F>>, { recurs
4492
4495
  type MockHandle<F extends Func> = (payload: Parameters<F>[0]) => Promise<Response<F>> | Response<F> | void | Promise<void> | Promise<Promise<void>>
4493
4496
  type MockHandleOrResponse<F extends Func> = MockHandle<F> | Response<F>
4494
4497
  type MockBuilder<F extends Func> = (handleOrResponse?: MockHandleOrResponse<F>) => void
4495
- type MockObject<F extends Func> = Mock<Parameters<F>, ReturnType<F>>
4498
+ type MockObject<F extends Func> = Mock<F>
4496
4499
  `;
4497
4500
  var functionFeature = defineFeature({
4498
4501
  name: "function",
@@ -5529,7 +5532,7 @@ type PubSubInstance = {
5529
5532
 
5530
5533
  type MockHandle = (payload: { topic: string; event: string; payload?: unknown }) => void
5531
5534
  type MockBuilder = (handle?: MockHandle) => void
5532
- type MockObject = Mock<[unknown], unknown>
5535
+ type MockObject = Mock<(payload: unknown) => unknown>
5533
5536
  `;
5534
5537
  var pubsubFeature = defineFeature({
5535
5538
  name: "pubsub",
@@ -5872,7 +5875,7 @@ type Send<Name extends string, F extends Func> = {
5872
5875
 
5873
5876
  type MockHandle<F extends Func> = (payload: Parameters<F>[0]) => void
5874
5877
  type MockBuilder<F extends Func> = (handle?: MockHandle<F>) => void
5875
- type MockObject<F extends Func> = Mock<Parameters<F>, ReturnType<F>>
5878
+ type MockObject<F extends Func> = Mock<F>
5876
5879
  `;
5877
5880
  var queueFeature = defineFeature({
5878
5881
  name: "queue",
@@ -6319,11 +6322,11 @@ import { aws as aws16 } from "@terraforge/aws";
6319
6322
  import { constantCase as constantCase9 } from "change-case";
6320
6323
  import { toGibibytes as toGibibytes2 } from "@awsless/size";
6321
6324
  var typeGenCode6 = `
6322
- import { AnyStruct, Table } from '@awsless/open-search'
6325
+ import { AnySchema, Table } from '@awsless/open-search'
6323
6326
 
6324
6327
  type Search = {
6325
6328
  readonly domain: string
6326
- readonly defineTable: <N extends string, S extends AnyStruct>(tableName: N, schema: S) => Table<N, S>
6329
+ readonly defineTable: <N extends string, S extends AnySchema>(tableName: N, schema: S) => Table<N, S>
6327
6330
  }
6328
6331
  `;
6329
6332
  var searchFeature = defineFeature({
@@ -7091,7 +7094,7 @@ type InvokeWithoutPayload<Name extends string, F extends Func> = {
7091
7094
 
7092
7095
  type MockHandle<F extends Func> = (payload: Parameters<F>[0]) => void | Promise<void> | Promise<Promise<void>>
7093
7096
  type MockBuilder<F extends Func> = (handle?: MockHandle<F>) => void
7094
- type MockObject<F extends Func> = Mock<Parameters<F>, ReturnType<F>>
7097
+ type MockObject<F extends Func> = Mock<F>
7095
7098
  `;
7096
7099
  var taskFeature = defineFeature({
7097
7100
  name: "task",
@@ -7218,6 +7221,7 @@ var testFeature = defineFeature({
7218
7221
  import { Group as Group20 } from "@terraforge/core";
7219
7222
  import { aws as aws21 } from "@terraforge/aws";
7220
7223
  var typeGenCode9 = `
7224
+ import type { Mock } from 'vitest'
7221
7225
  import type { PublishOptions } from '@awsless/sns'
7222
7226
 
7223
7227
  type Publish<Name extends string> = {
@@ -7409,6 +7413,7 @@ var vpcFeature = defineFeature({
7409
7413
  import { Group as Group22 } from "@terraforge/core";
7410
7414
  import { aws as aws23 } from "@terraforge/aws";
7411
7415
  var typeGenCode10 = `
7416
+ import type { Mock } from 'vitest'
7412
7417
  import type { PublishOptions } from '@awsless/sns'
7413
7418
 
7414
7419
  type Alert<Name extends string> = {
@@ -8826,7 +8831,7 @@ type Send<Name extends string> = {
8826
8831
 
8827
8832
  type MockHandle = (payload: unknown) => void
8828
8833
  type MockBuilder = (handle?: MockHandle) => void
8829
- type MockObject = Mock<[unknown], unknown>
8834
+ type MockObject = Mock<(payload: unknown) => unknown>
8830
8835
  `;
8831
8836
  var instanceFeature = defineFeature({
8832
8837
  name: "instance",
@@ -259,6 +259,7 @@ 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
263
  external: z11.string().array().optional().describe(`A list of external packages that won't be included in the bundle.`),
263
264
  importAsString: z11.string().array().optional().describe(`A list of glob patterns, which specifies the files that should be imported as string.`)
264
265
  });
Binary file
Binary file
Binary file
Binary file
package/dist/prebuild.js CHANGED
@@ -51,6 +51,7 @@ var bundleTypeScriptWithRolldown = async ({
51
51
  file,
52
52
  nativeDir,
53
53
  external,
54
+ moduleSideEffects,
54
55
  externalAwsSdk = true,
55
56
  codeSplitting = true,
56
57
  importAsString: importAsStringList
@@ -65,7 +66,7 @@ var bundleTypeScriptWithRolldown = async ({
65
66
  debugError(error.message);
66
67
  },
67
68
  treeshake: {
68
- moduleSideEffects: (id) => file === id
69
+ moduleSideEffects: moduleSideEffects ? true : (id) => file === id
69
70
  },
70
71
  plugins: [
71
72
  // nodeResolve({ preferBuiltins: true }),