lambda-live-debugger 1.4.1 → 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 -1
- package/dist/extension/extension.zip +0 -0
- package/dist/frameworks/cdkFramework.mjs +4 -2
- 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 +3 -3
package/README.md
CHANGED
|
@@ -332,7 +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
|
-
- [
|
|
335
|
+
- [Quentin Laurent](https://github.com/Spotchi)
|
|
336
336
|
- ⭐ Your name here for notable code or documentation contributions or sample projects submitted with a bug report that resulted in tool improvement.
|
|
337
337
|
|
|
338
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';
|
|
@@ -201,7 +202,7 @@ export class CdkFramework {
|
|
|
201
202
|
? 'js'
|
|
202
203
|
: fileExtension;
|
|
203
204
|
// Inject code to get the file path of the Lambda function and CDK hierarchy
|
|
204
|
-
if (args.path.includes('aws-cdk-lib
|
|
205
|
+
if (args.path.includes(path.join('aws-cdk-lib', 'aws-lambda', 'lib', 'function.'))) {
|
|
205
206
|
const codeToFind = 'try{jsiiDeprecationWarnings().aws_cdk_lib_aws_lambda_FunctionProps(props)}';
|
|
206
207
|
if (!contents.includes(codeToFind)) {
|
|
207
208
|
throw new Error(`Can not find code to inject in ${args.path}`);
|
|
@@ -351,7 +352,8 @@ export class CdkFramework {
|
|
|
351
352
|
*/
|
|
352
353
|
async runCdkCodeAndReturnLambdas({ config, awsCdkLibPath, compileCodeFile, }) {
|
|
353
354
|
const lambdas = await new Promise((resolve, reject) => {
|
|
354
|
-
const
|
|
355
|
+
const workerPath = pathToFileURL(path.resolve(path.join(getModuleDirname(), 'frameworks/cdkFrameworkWorker.mjs'))).href;
|
|
356
|
+
const worker = new Worker(new URL(workerPath), {
|
|
355
357
|
workerData: {
|
|
356
358
|
verbose: config.verbose,
|
|
357
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",
|