@bifravst/aws-cdk-lambda-helpers 2.0.0 → 2.0.1

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.
@@ -1,2 +1,18 @@
1
1
  import { type PackedLambda } from './packLambda.js';
2
- export declare const packLambdaFromPath: (id: string, sourceFilePath: string, handlerFunction?: string, baseDir?: string, distDir?: string) => Promise<PackedLambda>;
2
+ export declare const packLambdaFromPath: ({ id, sourceFilePath, handlerFunction: handlerFunctionArg, baseDir: baseDirArg, distDir: distDirArg, tsConfigFilePath, }: {
3
+ id: string;
4
+ sourceFilePath: string;
5
+ handlerFunction?: string;
6
+ /**
7
+ * @default process.cwd()
8
+ */
9
+ baseDir?: string;
10
+ /**
11
+ * @default ${baseDir}/dist/lambdas
12
+ */
13
+ distDir?: string;
14
+ /**
15
+ * Pass the path to the tsconfig.json file if you want to use paths from the tsconfig.json file.
16
+ */
17
+ tsConfigFilePath?: string;
18
+ }) => Promise<PackedLambda>;
@@ -1,15 +1,10 @@
1
1
  import { mkdir } from 'node:fs/promises';
2
2
  import path from 'node:path';
3
3
  import { packLambda } from './packLambda.js';
4
- export const packLambdaFromPath = async (id, sourceFilePath, handlerFunction = 'handler',
5
- /**
6
- * @default process.cwd()
7
- */
8
- baseDir = process.cwd(),
9
- /**
10
- * @default ${baseDir}/dist/lambdas
11
- */
12
- distDir = path.join(process.cwd(), 'dist', 'lambdas')) => {
4
+ export const packLambdaFromPath = async ({ id, sourceFilePath, handlerFunction: handlerFunctionArg, baseDir: baseDirArg, distDir: distDirArg, tsConfigFilePath, }) => {
5
+ const distDir = distDirArg ?? path.join(process.cwd(), 'dist', 'lambdas');
6
+ const baseDir = baseDirArg ?? process.cwd();
7
+ const handlerFunction = handlerFunctionArg ?? 'handler';
13
8
  try {
14
9
  await mkdir(distDir, {
15
10
  recursive: true,
@@ -22,6 +17,7 @@ distDir = path.join(process.cwd(), 'dist', 'lambdas')) => {
22
17
  const { handler, hash } = await packLambda({
23
18
  sourceFilePath: path.join(baseDir, sourceFilePath),
24
19
  zipFilePath: zipFile,
20
+ tsConfigFilePath,
25
21
  });
26
22
  return {
27
23
  id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bifravst/aws-cdk-lambda-helpers",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Helper functions which simplify working with TypeScript lambdas for AWS CDK.",
5
5
  "exports": {
6
6
  ".": {