lambda-live-debugger 1.4.0 → 1.5.0
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/README.md +1 -0
- package/dist/extension/extension.zip +0 -0
- package/dist/frameworks/cdkFramework.mjs +7 -3
- package/dist/frameworks/cdkFrameworkWorker.mjs +2 -1
- package/dist/lldebugger.mjs +1 -1
- package/dist/nodeWorker.mjs +3 -1
- package/dist/nodeWorkerRunner.mjs +3 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -332,6 +332,7 @@ If you have a new feature idea, please create and issue.
|
|
|
332
332
|
- [Roger Chi](https://rogerchi.com/)
|
|
333
333
|
- [Sebastian / avocadomaster](https://github.com/avocadomaster)
|
|
334
334
|
- [Sebastian Bille](https://blog.sebastianbille.com)
|
|
335
|
+
- [Quentin Laurent](https://github.com/Spotchi)
|
|
335
336
|
- ⭐ Your name here for notable code or documentation contributions or sample projects submitted with a bug report that resulted in tool improvement.
|
|
336
337
|
|
|
337
338
|
## Disclaimer
|
|
Binary file
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as esbuild from 'esbuild';
|
|
2
2
|
import * as fs from 'fs/promises';
|
|
3
3
|
import * as path from 'path';
|
|
4
|
+
import { pathToFileURL } from 'url';
|
|
4
5
|
import { BundlingType } from '../types/resourcesDiscovery.mjs';
|
|
5
6
|
import { outputFolder } from '../constants.mjs';
|
|
6
7
|
import { findPackageJson } from '../utils/findPackageJson.mjs';
|
|
@@ -197,9 +198,11 @@ export class CdkFramework {
|
|
|
197
198
|
}
|
|
198
199
|
// for .mjs files, use js loader
|
|
199
200
|
const fileExtension = args.path.split('.').pop();
|
|
200
|
-
const loader = fileExtension === 'mjs'
|
|
201
|
+
const loader = fileExtension === 'mjs' || fileExtension === 'cjs'
|
|
202
|
+
? 'js'
|
|
203
|
+
: fileExtension;
|
|
201
204
|
// Inject code to get the file path of the Lambda function and CDK hierarchy
|
|
202
|
-
if (args.path.includes('aws-cdk-lib
|
|
205
|
+
if (args.path.includes(path.join('aws-cdk-lib', 'aws-lambda', 'lib', 'function.'))) {
|
|
203
206
|
const codeToFind = 'try{jsiiDeprecationWarnings().aws_cdk_lib_aws_lambda_FunctionProps(props)}';
|
|
204
207
|
if (!contents.includes(codeToFind)) {
|
|
205
208
|
throw new Error(`Can not find code to inject in ${args.path}`);
|
|
@@ -349,7 +352,8 @@ export class CdkFramework {
|
|
|
349
352
|
*/
|
|
350
353
|
async runCdkCodeAndReturnLambdas({ config, awsCdkLibPath, compileCodeFile, }) {
|
|
351
354
|
const lambdas = await new Promise((resolve, reject) => {
|
|
352
|
-
const
|
|
355
|
+
const workerPath = pathToFileURL(path.resolve(path.join(getModuleDirname(), 'frameworks/cdkFrameworkWorker.mjs'))).href;
|
|
356
|
+
const worker = new Worker(new URL(workerPath), {
|
|
353
357
|
workerData: {
|
|
354
358
|
verbose: config.verbose,
|
|
355
359
|
awsCdkLibPath,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
import { workerData, parentPort } from 'node:worker_threads';
|
|
3
|
+
import { pathToFileURL } from 'url';
|
|
3
4
|
import { Logger } from '../logger.mjs';
|
|
4
5
|
|
|
5
6
|
Logger.setVerbose(workerData.verbose);
|
|
@@ -14,7 +15,7 @@ parentPort.on('message', async (data) => {
|
|
|
14
15
|
Logger.verbose(`[Worker] Received message`, data);
|
|
15
16
|
|
|
16
17
|
// execute code to get the data into global.lambdas
|
|
17
|
-
await import(data.compileOutput);
|
|
18
|
+
await import(pathToFileURL(data.compileOutput).href);
|
|
18
19
|
|
|
19
20
|
if (!global.lambdas || global.lambdas?.length === 0) {
|
|
20
21
|
throw new Error('No Lambda functions found in the CDK code');
|
package/dist/lldebugger.mjs
CHANGED
package/dist/nodeWorker.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Worker } from 'node:worker_threads';
|
|
2
2
|
import * as path from 'path';
|
|
3
|
+
import { pathToFileURL } from 'url';
|
|
3
4
|
import { Configuration } from './configuration.mjs';
|
|
4
5
|
import { getModuleDirname, getProjectDirname } from './getDirname.mjs';
|
|
5
6
|
import { Logger } from './logger.mjs';
|
|
@@ -75,7 +76,8 @@ function addEnableSourceMapsToEnv(environment) {
|
|
|
75
76
|
function startWorker(input) {
|
|
76
77
|
Logger.verbose(`[Function ${input.functionId}] [Worker ${input.workerId}] Starting worker. Artifact: ${input.artifactFile}`);
|
|
77
78
|
const localProjectDir = getProjectDirname();
|
|
78
|
-
const
|
|
79
|
+
const workerPath = pathToFileURL(path.resolve(path.join(getModuleDirname(), `./nodeWorkerRunner.mjs`))).href;
|
|
80
|
+
const worker = new Worker(new URL(workerPath), {
|
|
79
81
|
env: {
|
|
80
82
|
...input.environment,
|
|
81
83
|
IS_LOCAL: 'true',
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
import { createRequire as topLevelCreateRequire } from 'module';
|
|
3
|
+
import { pathToFileURL } from 'url';
|
|
3
4
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4
5
|
const require = topLevelCreateRequire(import.meta.url);
|
|
5
6
|
|
|
@@ -14,7 +15,8 @@ Logger.verbose(
|
|
|
14
15
|
parentPort.on('message', async (data) => {
|
|
15
16
|
Logger.verbose(`[Worker ${workerData.workerId}] Received message`, data);
|
|
16
17
|
try {
|
|
17
|
-
const
|
|
18
|
+
const artifactFile = pathToFileURL(workerData.artifactFile).href;
|
|
19
|
+
const mod = await import(artifactFile);
|
|
18
20
|
const fn = mod[workerData.handler];
|
|
19
21
|
|
|
20
22
|
if (!fn) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lambda-live-debugger",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Debug Lambda functions locally like it is running in the cloud",
|
|
6
6
|
"repository": {
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"lint": "eslint . --fix",
|
|
45
45
|
"prettier": "prettier . --write",
|
|
46
46
|
"prepare": "husky",
|
|
47
|
-
"add-bang": "
|
|
47
|
+
"add-bang": "echo '#!/usr/bin/env node' | cat - ./dist/lldebugger.mjs > ./dist/lldebugger.mjs.tmp && mv ./dist/lldebugger.mjs.tmp ./dist/lldebugger.mjs",
|
|
48
48
|
"build": "tsc -p tsconfig.build.json && cp src/nodeWorkerRunner.mjs dist && cp src/frameworks/cdkFrameworkWorker.mjs dist/frameworks && node fix-imports.js && npm run add-bang && npm run bundle-extension",
|
|
49
49
|
"bundle-extension": "cd src/extension && npm run build && cd ../../",
|
|
50
50
|
"deploy-github-role": "aws cloudformation deploy --stack-name lld-deploy-role --template-file cloudformation/gitHubDeployRole.yaml --capabilities CAPABILITY_IAM CAPABILITY_NAMED_IAM --profile lldebugger",
|
|
51
|
-
"deploy-tests": "npm run deploy --workspaces",
|
|
51
|
+
"deploy-tests": "npm run deploy --workspaces --if-present --parallel",
|
|
52
52
|
"test": "npm run build && RUN_TEST_FROM_CLI=true vitest run && RUN_TEST_FROM_CLI=true OBSERVABLE_MODE=true vitest run",
|
|
53
53
|
"test-cdk-basic": "npm run build && RUN_TEST_FROM_CLI=true vitest run test/cdk-basic.test.ts",
|
|
54
54
|
"test-cdk-basic-observable": "npm run build && RUN_TEST_FROM_CLI=true OBSERVABLE_MODE=true vitest run test/cdk-basic.test.ts",
|
|
@@ -85,8 +85,8 @@
|
|
|
85
85
|
"@types/inquirer": "^9.0.7",
|
|
86
86
|
"@types/node": "^20.11.16",
|
|
87
87
|
"@types/serverless": "^3.12.22",
|
|
88
|
-
"aws-cdk": "2.
|
|
89
|
-
"aws-cdk-lib": "2.
|
|
88
|
+
"aws-cdk": "2.178.0",
|
|
89
|
+
"aws-cdk-lib": "2.178.0",
|
|
90
90
|
"constructs": "^10.0.0",
|
|
91
91
|
"eslint": "^9.8.0",
|
|
92
92
|
"eslint-config-prettier": "^9.1.0",
|
|
@@ -95,8 +95,8 @@
|
|
|
95
95
|
"prettier": "^3.3.3",
|
|
96
96
|
"semantic-release": "^23.0.8",
|
|
97
97
|
"serverless": "^3.38.0",
|
|
98
|
-
"osls": "^3.
|
|
99
|
-
"serverless-esbuild": "^1.
|
|
98
|
+
"osls": "^3.46.0",
|
|
99
|
+
"serverless-esbuild": "^1.54.6",
|
|
100
100
|
"tsx": "^4.7.1",
|
|
101
101
|
"typescript-eslint": "^8.0.0",
|
|
102
102
|
"vitepress": "^1.3.3"
|