@bifravst/aws-cdk-lambda-helpers 3.5.139 → 4.0.2
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/src/PackedLambdaFn.js +1 -1
- package/dist/src/findDependencies.d.ts +5 -5
- package/dist/src/findDependencies.js +4 -12
- package/dist/src/packLambda.d.ts +3 -3
- package/dist/src/packLambdaFromPath.d.ts +6 -6
- package/dist/src/packLayer.d.ts +4 -4
- package/dist/src/packLayer.js +8 -7
- package/dist/src/updateLambdaCode.d.ts +1 -1
- package/package.json +14 -14
|
@@ -27,7 +27,7 @@ import { LambdaSource } from './LambdaSource.js';
|
|
|
27
27
|
this.logGroup = props.logGroup ?? new LambdaLogGroup(this, 'fnLogs').logGroup;
|
|
28
28
|
this.fn = new Lambda.Function(this, 'fn', {
|
|
29
29
|
architecture: architecture ?? Lambda.Architecture.ARM_64,
|
|
30
|
-
runtime: props.runtime ?? Lambda.Runtime.
|
|
30
|
+
runtime: props.runtime ?? Lambda.Runtime.NODEJS_24_X,
|
|
31
31
|
timeout: Duration.seconds(5),
|
|
32
32
|
memorySize: 1792,
|
|
33
33
|
environment: {
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export declare const findDependencies: (args: {
|
|
5
5
|
sourceFilePath: string;
|
|
6
|
-
imports?: string[];
|
|
7
|
-
visited?: string[];
|
|
8
|
-
packages?: Set<string
|
|
9
|
-
tsConfigFilePath?: string;
|
|
10
|
-
importsSubpathPatterns?: Record<string, string
|
|
6
|
+
imports?: string[] | undefined;
|
|
7
|
+
visited?: string[] | undefined;
|
|
8
|
+
packages?: Set<string> | undefined;
|
|
9
|
+
tsConfigFilePath?: string | undefined;
|
|
10
|
+
importsSubpathPatterns?: Record<string, string> | undefined;
|
|
11
11
|
}) => {
|
|
12
12
|
dependencies: string[];
|
|
13
13
|
/**
|
|
@@ -74,12 +74,8 @@ const resolve = ({ moduleSpecifier, sourceFilePath, tsConfigFilePath, tsConfig,
|
|
|
74
74
|
if (resolvedPath === undefined) continue;
|
|
75
75
|
// Exact match
|
|
76
76
|
if (moduleSpecifier === key) {
|
|
77
|
-
const fullResolvedPath = path.join(path.parse(tsConfigFilePath).dir,
|
|
78
|
-
importsSubpathPatterns[key] =
|
|
79
|
-
tsConfig.compilerOptions.baseUrl,
|
|
80
|
-
path.sep,
|
|
81
|
-
resolvedPath
|
|
82
|
-
].join('');
|
|
77
|
+
const fullResolvedPath = path.join(path.parse(tsConfigFilePath).dir, resolvedPath);
|
|
78
|
+
importsSubpathPatterns[key] = resolvedPath;
|
|
83
79
|
return {
|
|
84
80
|
resolvedPath: fullResolvedPath
|
|
85
81
|
};
|
|
@@ -89,13 +85,9 @@ const resolve = ({ moduleSpecifier, sourceFilePath, tsConfigFilePath, tsConfig,
|
|
|
89
85
|
const rx = new RegExp(`^${key.replace('*', '(?<wildcard>.*)')}`);
|
|
90
86
|
const maybeMatch = rx.exec(moduleSpecifier);
|
|
91
87
|
if (maybeMatch?.groups?.wildcard === undefined) continue;
|
|
92
|
-
importsSubpathPatterns[key] =
|
|
93
|
-
tsConfig.compilerOptions.baseUrl,
|
|
94
|
-
path.sep,
|
|
95
|
-
resolvedPath
|
|
96
|
-
].join('');
|
|
88
|
+
importsSubpathPatterns[key] = resolvedPath;
|
|
97
89
|
return {
|
|
98
|
-
resolvedPath: path.resolve(path.parse(tsConfigFilePath).dir,
|
|
90
|
+
resolvedPath: path.resolve(path.parse(tsConfigFilePath).dir, resolvedPath.replace('*', maybeMatch.groups.wildcard))
|
|
99
91
|
};
|
|
100
92
|
}
|
|
101
93
|
}
|
package/dist/src/packLambda.d.ts
CHANGED
|
@@ -13,9 +13,9 @@ export declare const packLambda: ({ sourceFilePath, zipFilePath, tsConfigFilePat
|
|
|
13
13
|
/**
|
|
14
14
|
* Pass the path to the tsconfig.json file if you want to use paths from the tsconfig.json file.
|
|
15
15
|
*/
|
|
16
|
-
tsConfigFilePath?: string;
|
|
17
|
-
debug?: (label: string, info: string) => void;
|
|
18
|
-
progress?: (label: string, info: string) => void;
|
|
16
|
+
tsConfigFilePath?: string | undefined;
|
|
17
|
+
debug?: ((label: string, info: string) => void) | undefined;
|
|
18
|
+
progress?: ((label: string, info: string) => void) | undefined;
|
|
19
19
|
}) => Promise<{
|
|
20
20
|
handler: string;
|
|
21
21
|
hash: string;
|
|
@@ -2,19 +2,19 @@ import { type PackedLambda } from './packLambda.ts';
|
|
|
2
2
|
export declare const packLambdaFromPath: ({ id, sourceFilePath, handlerFunction: handlerFunctionArg, baseDir: baseDirArg, distDir: distDirArg, tsConfigFilePath, debug, progress, }: {
|
|
3
3
|
id: string;
|
|
4
4
|
sourceFilePath: string;
|
|
5
|
-
handlerFunction?: string;
|
|
5
|
+
handlerFunction?: string | undefined;
|
|
6
6
|
/**
|
|
7
7
|
* @default process.cwd()
|
|
8
8
|
*/
|
|
9
|
-
baseDir?: string;
|
|
9
|
+
baseDir?: string | undefined;
|
|
10
10
|
/**
|
|
11
11
|
* @default ${baseDir}/dist/lambdas
|
|
12
12
|
*/
|
|
13
|
-
distDir?: string;
|
|
13
|
+
distDir?: string | undefined;
|
|
14
14
|
/**
|
|
15
15
|
* Pass the path to the tsconfig.json file if you want to use paths from the tsconfig.json file.
|
|
16
16
|
*/
|
|
17
|
-
tsConfigFilePath?: string;
|
|
18
|
-
debug?: (label: string, info: string) => void;
|
|
19
|
-
progress?: (label: string, info: string) => void;
|
|
17
|
+
tsConfigFilePath?: string | undefined;
|
|
18
|
+
debug?: ((label: string, info: string) => void) | undefined;
|
|
19
|
+
progress?: ((label: string, info: string) => void) | undefined;
|
|
20
20
|
}) => Promise<PackedLambda>;
|
package/dist/src/packLayer.d.ts
CHANGED
|
@@ -8,16 +8,16 @@ export declare const packLayer: ({ id, dependencies, baseDir, distDir, installCo
|
|
|
8
8
|
/**
|
|
9
9
|
* @default process.cwd()
|
|
10
10
|
*/
|
|
11
|
-
baseDir?: string;
|
|
11
|
+
baseDir?: string | undefined;
|
|
12
12
|
/**
|
|
13
13
|
* @default ${baseDir}/dist/layers
|
|
14
14
|
*/
|
|
15
|
-
distDir?: string;
|
|
15
|
+
distDir?: string | undefined;
|
|
16
16
|
/**
|
|
17
17
|
* Returns the command to run, the first element is the command (e.g. `npm`) and the rest are its arguments.
|
|
18
18
|
*/
|
|
19
|
-
installCommand?: (args: {
|
|
19
|
+
installCommand?: ((args: {
|
|
20
20
|
packageFilePath: string;
|
|
21
21
|
packageLockFilePath: string;
|
|
22
|
-
}) => [string, ...
|
|
22
|
+
}) => [string, ...string[]]) | undefined;
|
|
23
23
|
}) => Promise<PackedLayer>;
|
package/dist/src/packLayer.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { spawn } from 'child_process';
|
|
2
2
|
import { createWriteStream } from 'fs';
|
|
3
3
|
import { copyFile, mkdir, readFile, rm, stat, writeFile } from 'fs/promises';
|
|
4
|
-
import { glob } from '
|
|
4
|
+
import { glob } from 'node:fs/promises';
|
|
5
5
|
import { fileURLToPath } from 'node:url';
|
|
6
6
|
import path from 'path';
|
|
7
7
|
import { ZipFile } from 'yazl';
|
|
@@ -84,14 +84,15 @@ export const packLayer = async ({ id, dependencies, baseDir, distDir, installCom
|
|
|
84
84
|
return resolve();
|
|
85
85
|
});
|
|
86
86
|
});
|
|
87
|
-
const filesToAdd = await glob(`**`, {
|
|
88
|
-
cwd: layerDir,
|
|
89
|
-
nodir: true
|
|
90
|
-
});
|
|
91
87
|
const zipfile = new ZipFile();
|
|
92
|
-
|
|
88
|
+
for await (const f of glob(`**`, {
|
|
89
|
+
cwd: layerDir
|
|
90
|
+
})){
|
|
91
|
+
if ((await stat(path.join(layerDir, f))).isDirectory()) {
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
93
94
|
zipfile.addFile(path.join(layerDir, f), f);
|
|
94
|
-
}
|
|
95
|
+
}
|
|
95
96
|
if (hasNpmRcFile) {
|
|
96
97
|
zipfile.addFile(path.join(nodejsDir, '.npmrc'), 'nodejs/.npmrc');
|
|
97
98
|
}
|
|
@@ -4,4 +4,4 @@ import type { PackedLambda } from './packLambda.ts';
|
|
|
4
4
|
export declare const updateLambdaCode: ({ cf, lambda }: {
|
|
5
5
|
cf: CloudFormationClient;
|
|
6
6
|
lambda: LambdaClient;
|
|
7
|
-
}) => (stackName: string, packedLambdas: Record<string, PackedLambda>, debug?: (...args:
|
|
7
|
+
}) => (stackName: string, packedLambdas: Record<string, PackedLambda>, debug?: ((...args: any[]) => void) | undefined) => Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bifravst/aws-cdk-lambda-helpers",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"description": "Helper functions which simplify working with TypeScript lambdas for AWS CDK.",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"test:e2e": "node --experimental-strip-types --test e2e.spec.ts",
|
|
35
35
|
"test:e2e:updated": "node --experimental-strip-types --test e2e-updated.spec.ts",
|
|
36
36
|
"prepare": "husky",
|
|
37
|
-
"prepublishOnly": "node --experimental-strip-types npm-compile.ts && npx
|
|
37
|
+
"prepublishOnly": "node --experimental-strip-types npm-compile.ts && npx tsgo -P tsconfig.npm.json --outDir ./dist/src"
|
|
38
38
|
},
|
|
39
39
|
"repository": {
|
|
40
40
|
"type": "git",
|
|
@@ -53,20 +53,21 @@
|
|
|
53
53
|
"author": "Nordic Semiconductor ASA | nordicsemi.no",
|
|
54
54
|
"license": "BSD-3-Clause",
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@aws-sdk/client-cloudformation": "3.
|
|
57
|
-
"@aws-sdk/client-dynamodb": "3.
|
|
56
|
+
"@aws-sdk/client-cloudformation": "3.964.0",
|
|
57
|
+
"@aws-sdk/client-dynamodb": "3.964.0",
|
|
58
58
|
"@bifravst/cloudformation-helpers": "9.1.1",
|
|
59
59
|
"@bifravst/eslint-config-typescript": "6.4.4",
|
|
60
60
|
"@bifravst/from-env": "3.0.2",
|
|
61
61
|
"@bifravst/prettier-config": "1.1.17",
|
|
62
|
-
"@commitlint/config-conventional": "
|
|
62
|
+
"@commitlint/config-conventional": "20.3.0",
|
|
63
63
|
"@swc/cli": "0.7.9",
|
|
64
64
|
"@types/aws-lambda": "8.10.159",
|
|
65
|
-
"@types/node": "
|
|
65
|
+
"@types/node": "25.0.3",
|
|
66
66
|
"@types/unzip-stream": "0.3.4",
|
|
67
67
|
"@types/yazl": "3.3.0",
|
|
68
|
-
"
|
|
69
|
-
"
|
|
68
|
+
"@typescript/native-preview": "7.0.0-dev.20260106.1",
|
|
69
|
+
"cdk": "2.1100.3",
|
|
70
|
+
"commitlint": "20.3.0",
|
|
70
71
|
"husky": "9.1.7",
|
|
71
72
|
"id128": "1.6.6",
|
|
72
73
|
"lint-staged": "16.2.7",
|
|
@@ -113,17 +114,16 @@
|
|
|
113
114
|
],
|
|
114
115
|
"prettier": "@bifravst/prettier-config",
|
|
115
116
|
"dependencies": {
|
|
116
|
-
"@swc/core": "1.15.
|
|
117
|
+
"@swc/core": "1.15.8",
|
|
117
118
|
"fp-ts": "2.16.11",
|
|
118
|
-
"
|
|
119
|
-
"p-retry": "7.1.0",
|
|
119
|
+
"p-retry": "7.1.1",
|
|
120
120
|
"typescript": "5.9.3",
|
|
121
121
|
"yazl": "3.3.1"
|
|
122
122
|
},
|
|
123
123
|
"peerDependencies": {
|
|
124
|
-
"@aws-sdk/client-lambda": "^3.
|
|
124
|
+
"@aws-sdk/client-lambda": "^3.964.0",
|
|
125
125
|
"@bifravst/aws-ssm-settings-helpers": "^1.2.257",
|
|
126
|
-
"aws-cdk-lib": "^2.
|
|
127
|
-
"constructs": "^10.4.
|
|
126
|
+
"aws-cdk-lib": "^2.233.0",
|
|
127
|
+
"constructs": "^10.4.4"
|
|
128
128
|
}
|
|
129
129
|
}
|