lambda-live-debugger 0.0.112 → 0.0.114

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.
Files changed (57) hide show
  1. package/.prettierrc +3 -1
  2. package/README.md +31 -33
  3. package/dist/awsCredentials.d.ts +2 -2
  4. package/dist/awsCredentials.mjs +1 -1
  5. package/dist/cloudFormation.d.ts +1 -1
  6. package/dist/cloudFormation.mjs +7 -7
  7. package/dist/configuration/getConfigFromCliArgs.d.ts +1 -1
  8. package/dist/configuration/getConfigFromCliArgs.mjs +22 -22
  9. package/dist/configuration/getConfigFromTsConfigFile.d.ts +1 -1
  10. package/dist/configuration/getConfigFromTsConfigFile.mjs +9 -9
  11. package/dist/configuration/getConfigFromWizard.d.ts +1 -1
  12. package/dist/configuration/getConfigFromWizard.mjs +78 -78
  13. package/dist/configuration.d.ts +2 -2
  14. package/dist/configuration.mjs +15 -15
  15. package/dist/constants.mjs +2 -2
  16. package/dist/extension/extension.zip +0 -0
  17. package/dist/extension/nodejs/node_modules/interceptor.js.map +1 -1
  18. package/dist/fileWatcher.mjs +11 -11
  19. package/dist/frameworks/cdkFramework.d.ts +5 -5
  20. package/dist/frameworks/cdkFramework.mjs +42 -41
  21. package/dist/frameworks/cdkFrameworkWorker.mjs +17 -13
  22. package/dist/frameworks/iFrameworks.d.ts +2 -2
  23. package/dist/frameworks/samFramework.d.ts +3 -3
  24. package/dist/frameworks/samFramework.mjs +19 -19
  25. package/dist/frameworks/slsFramework.d.ts +4 -4
  26. package/dist/frameworks/slsFramework.mjs +22 -22
  27. package/dist/frameworks/terraformFramework.d.ts +4 -4
  28. package/dist/frameworks/terraformFramework.mjs +34 -34
  29. package/dist/getDirname.mjs +3 -3
  30. package/dist/gitignore.mjs +11 -11
  31. package/dist/index.d.ts +8 -8
  32. package/dist/index.mjs +4 -4
  33. package/dist/infraDeploy.mjs +39 -39
  34. package/dist/ioTService.d.ts +6 -6
  35. package/dist/ioTService.mjs +19 -19
  36. package/dist/lambdaConnection.mjs +13 -13
  37. package/dist/lldebugger.mjs +22 -22
  38. package/dist/nodeEsBuild.mjs +30 -30
  39. package/dist/nodeHandler.d.ts +1 -1
  40. package/dist/nodeHandler.mjs +4 -4
  41. package/dist/nodeWorker.d.ts +1 -1
  42. package/dist/nodeWorker.mjs +14 -14
  43. package/dist/nodeWorkerRunner.mjs +9 -9
  44. package/dist/resourceDiscovery.d.ts +1 -1
  45. package/dist/resourceDiscovery.mjs +8 -8
  46. package/dist/types/lambdaProps.d.ts +1 -1
  47. package/dist/types/lldConfig.d.ts +4 -4
  48. package/dist/types/resourcesDiscovery.d.ts +2 -2
  49. package/dist/utils/findNpmPath.mjs +6 -6
  50. package/dist/utils/findPackageJson.mjs +6 -6
  51. package/dist/utils/getRootFolder.mjs +4 -4
  52. package/dist/utils/removeUndefinedProperties.mjs +1 -1
  53. package/dist/version.mjs +5 -5
  54. package/dist/vsCode.mjs +34 -34
  55. package/eslint.config.js +18 -18
  56. package/fix-imports.js +13 -13
  57. package/package.json +1 -1
@@ -1,8 +1,8 @@
1
- import { AwsCredentials } from "./awsCredentials.mjs";
2
- import { Configuration } from "./configuration.mjs";
3
- import { IoTService } from "./ioTService.mjs";
4
- import { Logger } from "./logger.mjs";
5
- import { NodeHandler } from "./nodeHandler.mjs";
1
+ import { AwsCredentials } from './awsCredentials.mjs';
2
+ import { Configuration } from './configuration.mjs';
3
+ import { IoTService } from './ioTService.mjs';
4
+ import { Logger } from './logger.mjs';
5
+ import { NodeHandler } from './nodeHandler.mjs';
6
6
  let ioTServiceConnection;
7
7
  let topic;
8
8
  const lambdasProcessingObservableMode = new Set();
@@ -30,7 +30,7 @@ async function onMessageFromLambda(message) {
30
30
  if (!Configuration.config.observable) {
31
31
  //immediately respond to the ping message to confirm the local debugging is alive
32
32
  await ioTServiceConnection.publish({
33
- type: "PING",
33
+ type: 'PING',
34
34
  data: {
35
35
  workerId: message.data.workerId,
36
36
  requestId: message.data.requestId,
@@ -38,7 +38,7 @@ async function onMessageFromLambda(message) {
38
38
  },
39
39
  }, `${topic}/${message.data.workerId}`);
40
40
  }
41
- if (message.type !== "INVOKE") {
41
+ if (message.type !== 'INVOKE') {
42
42
  throw new Error(`Unexpected message type: ${message.type}`);
43
43
  }
44
44
  try {
@@ -64,8 +64,8 @@ async function onMessageFromLambda(message) {
64
64
  // first 50 characters of the response
65
65
  const requestPretty = message.data
66
66
  ? JSON.stringify(message.data).substring(0, 100)
67
- : "";
68
- Logger.log(`[Function ${message.data.functionId}] Request: ${requestPretty}${requestPretty.length < 50 ? "" : "..."}`);
67
+ : '';
68
+ Logger.log(`[Function ${message.data.functionId}] Request: ${requestPretty}${requestPretty.length < 50 ? '' : '...'}`);
69
69
  }
70
70
  const response = await NodeHandler.invokeLambda(message.data);
71
71
  if (Configuration.config.verbose) {
@@ -75,15 +75,15 @@ async function onMessageFromLambda(message) {
75
75
  // first 50 characters of the response
76
76
  const responsePretty = response
77
77
  ? JSON.stringify(response).substring(0, 100)
78
- : "";
79
- Logger.log(`[Function ${message.data.functionId}] Response: ${responsePretty}${responsePretty.length < 50 ? "" : "..."}`);
78
+ : '';
79
+ Logger.log(`[Function ${message.data.functionId}] Response: ${responsePretty}${responsePretty.length < 50 ? '' : '...'}`);
80
80
  }
81
81
  if (Configuration.config.observable) {
82
82
  // if we are in observable mode, mark the worker as processed
83
83
  lambdasProcessingObservableMode.delete(message.data.functionId);
84
84
  }
85
85
  const payload = {
86
- type: "SUCCESS",
86
+ type: 'SUCCESS',
87
87
  data: {
88
88
  functionId: message.data.functionId,
89
89
  requestId: message.data.requestId,
@@ -98,7 +98,7 @@ async function onMessageFromLambda(message) {
98
98
  catch (e) {
99
99
  Logger.error(`[Function ${message.data.functionId}] Error: `, e);
100
100
  const payload = {
101
- type: "ERROR",
101
+ type: 'ERROR',
102
102
  data: {
103
103
  functionId: message.data.functionId,
104
104
  requestId: message.data.requestId,
@@ -1,33 +1,33 @@
1
1
  #!/usr/bin/env node
2
2
  // ****** support require in for CJS modules ******
3
- import { createRequire } from "module";
3
+ import { createRequire } from 'module';
4
4
  // @ts-ignore
5
5
  const require = createRequire(import.meta.url);
6
6
  global.require = require;
7
- import { InfraDeploy } from "./infraDeploy.mjs";
8
- import { getVersion } from "./version.mjs";
9
- import { Configuration } from "./configuration.mjs";
10
- import { FileWatcher } from "./fileWatcher.mjs";
11
- import { GitIgnore } from "./gitignore.mjs";
12
- import { VsCode } from "./vsCode.mjs";
13
- import path from "path";
14
- import { getRootFolder } from "./utils/getRootFolder.mjs";
15
- import fs from "fs/promises";
16
- import { Logger } from "./logger.mjs";
17
- import { getModuleDirname, getProjectDirname } from "./getDirname.mjs";
18
- import { LambdaConnection } from "./lambdaConnection.mjs";
7
+ import { InfraDeploy } from './infraDeploy.mjs';
8
+ import { getVersion } from './version.mjs';
9
+ import { Configuration } from './configuration.mjs';
10
+ import { FileWatcher } from './fileWatcher.mjs';
11
+ import { GitIgnore } from './gitignore.mjs';
12
+ import { VsCode } from './vsCode.mjs';
13
+ import path from 'path';
14
+ import { getRootFolder } from './utils/getRootFolder.mjs';
15
+ import fs from 'fs/promises';
16
+ import { Logger } from './logger.mjs';
17
+ import { getModuleDirname, getProjectDirname } from './getDirname.mjs';
18
+ import { LambdaConnection } from './lambdaConnection.mjs';
19
19
  /**
20
20
  * Start the Lambda Live Debugger
21
21
  */
22
22
  async function run() {
23
23
  const version = await getVersion();
24
24
  Logger.log(`Welcome to Lambda Live Debugger 🐞 version ${version}.`);
25
- Logger.log("To keep the project moving forward, please fill out the feedback form at https://forms.gle/v6ekZtuB45Rv3EyW9. Your input is greatly appreciated!");
25
+ Logger.log('To keep the project moving forward, please fill out the feedback form at https://forms.gle/v6ekZtuB45Rv3EyW9. Your input is greatly appreciated!');
26
26
  await Configuration.readConfig();
27
27
  Logger.setVerbose(Configuration.config.verbose === true);
28
28
  Logger.verbose(`Parameters: \n${Object.entries(Configuration.config)
29
29
  .map(([key, value]) => ` - ${key}=${value}`)
30
- .join("\n")}`);
30
+ .join('\n')}`);
31
31
  Logger.verbose(`NPM module folder: ${getModuleDirname()}`);
32
32
  Logger.verbose(`Project folder: ${getProjectDirname()}`);
33
33
  if (Configuration.config.gitignore) {
@@ -40,7 +40,7 @@ async function run() {
40
40
  return;
41
41
  }
42
42
  Logger.log(`Starting the debugger ${Configuration.config.observable
43
- ? "in observable mode"
43
+ ? 'in observable mode'
44
44
  : `(ID ${Configuration.config.debuggerId})`}
45
45
  ...`);
46
46
  if (Configuration.config.subfolder) {
@@ -51,28 +51,28 @@ async function run() {
51
51
  }
52
52
  await Configuration.discoverLambdas();
53
53
  if (Configuration.config.remove) {
54
- Logger.log(`Removing Lambda Live Debugger${Configuration.config.remove === "all" ? " including layer" : ""}...`);
54
+ Logger.log(`Removing Lambda Live Debugger${Configuration.config.remove === 'all' ? ' including layer' : ''}...`);
55
55
  await InfraDeploy.removeInfrastructure();
56
56
  // await GitIgnore.removeFromGitIgnore();
57
57
  // delete folder .lldebugger
58
- const folder = path.join(getProjectDirname(), ".lldebugger");
58
+ const folder = path.join(getProjectDirname(), '.lldebugger');
59
59
  Logger.verbose(`Removing ${folder} folder...`);
60
60
  await fs.rm(folder, { recursive: true });
61
- if (Configuration.config.remove === "all") {
61
+ if (Configuration.config.remove === 'all') {
62
62
  await InfraDeploy.deleteLayer();
63
63
  }
64
- Logger.log("Lambda Live Debugger removed!");
64
+ Logger.log('Lambda Live Debugger removed!');
65
65
  return;
66
66
  }
67
67
  await InfraDeploy.deployInfrastructure();
68
68
  const folders = [
69
- path.resolve("."),
69
+ path.resolve('.'),
70
70
  ...Configuration.getLambdas().map((l) => l.codePath),
71
71
  ];
72
72
  // get the uppermost folder of all lambdas or the project root to watch for changes
73
73
  const rootFolderForWarchingChanges = getRootFolder(folders);
74
74
  FileWatcher.watchForFileChanges(rootFolderForWarchingChanges);
75
75
  await LambdaConnection.connect();
76
- Logger.log("Debugger started!");
76
+ Logger.log('Debugger started!');
77
77
  }
78
78
  run().catch(Logger.error);
@@ -1,14 +1,14 @@
1
- import * as path from "path";
2
- import * as fs from "fs/promises";
3
- import * as esbuild from "esbuild";
4
- import { Configuration } from "./configuration.mjs";
5
- import { Logger } from "./logger.mjs";
6
- import { getProjectDirname } from "./getDirname.mjs";
7
- import { outputFolder } from "./constants.mjs";
8
- import { combineArray } from "./utils/combineArray.mjs";
9
- import { combineObject } from "./utils/combineObject.mjs";
10
- import { combineObjectStrings } from "./utils/combineObjectStrings.mjs";
11
- import { removeUndefinedProperties } from "./utils/removeUndefinedProperties.mjs";
1
+ import * as path from 'path';
2
+ import * as fs from 'fs/promises';
3
+ import * as esbuild from 'esbuild';
4
+ import { Configuration } from './configuration.mjs';
5
+ import { Logger } from './logger.mjs';
6
+ import { getProjectDirname } from './getDirname.mjs';
7
+ import { outputFolder } from './constants.mjs';
8
+ import { combineArray } from './utils/combineArray.mjs';
9
+ import { combineObject } from './utils/combineObject.mjs';
10
+ import { combineObjectStrings } from './utils/combineObjectStrings.mjs';
11
+ import { removeUndefinedProperties } from './utils/removeUndefinedProperties.mjs';
12
12
  const buildCache = {};
13
13
  /**
14
14
  * Get the build for the function
@@ -20,9 +20,9 @@ async function getBuild(functionId) {
20
20
  let newBuild = false;
21
21
  const func = await Configuration.getLambda(functionId);
22
22
  // if handler is a JavaScript file and not force bundle, just return the file
23
- if ((func.codePath.endsWith(".js") ||
24
- func.codePath.endsWith(".mjs") ||
25
- func.codePath.endsWith(".cjs")) &&
23
+ if ((func.codePath.endsWith('.js') ||
24
+ func.codePath.endsWith('.mjs') ||
25
+ func.codePath.endsWith('.cjs')) &&
26
26
  !func.forceBundle) {
27
27
  return func.codePath;
28
28
  }
@@ -54,7 +54,7 @@ async function getBuild(functionId) {
54
54
  if (newBuild) {
55
55
  Logger.verbose(`[Function ${functionId}] Build complete`);
56
56
  }
57
- const artifactFile = Object.keys(result.metafile.outputs).find((key) => key.endsWith(".js"));
57
+ const artifactFile = Object.keys(result.metafile.outputs).find((key) => key.endsWith('.js'));
58
58
  if (!artifactFile) {
59
59
  throw new Error(`Artifact file not found for function ${functionId}`);
60
60
  }
@@ -81,15 +81,15 @@ async function build(input) {
81
81
  const packageJsonPath = input.function.packageJsonPath;
82
82
  let isESMFromPackageJson = false;
83
83
  if (packageJsonPath) {
84
- const packageJson = JSON.parse(await fs.readFile(packageJsonPath, { encoding: "utf-8" }));
85
- isESMFromPackageJson = packageJson.type === "module";
84
+ const packageJson = JSON.parse(await fs.readFile(packageJsonPath, { encoding: 'utf-8' }));
85
+ isESMFromPackageJson = packageJson.type === 'module';
86
86
  }
87
- const isESMFromBundling = esbuildOptions?.format === "esm" ? true : undefined;
87
+ const isESMFromBundling = esbuildOptions?.format === 'esm' ? true : undefined;
88
88
  let isESM;
89
89
  if (isESMFromPackageJson !== undefined &&
90
90
  isESMFromBundling !== undefined &&
91
91
  isESMFromPackageJson !== isESMFromBundling) {
92
- Logger.warn(`WARNING! Mismatch module type between package.json and bundling options for ${handlerCodePath}. Package.json: ${isESMFromPackageJson ? "ESM" : "CJS"}, bundling options: ${isESMFromBundling ? "ESM" : "CJS"}. Using ${isESMFromBundling ? "ESM" : "CJS"} from bunding otions.`);
92
+ Logger.warn(`WARNING! Mismatch module type between package.json and bundling options for ${handlerCodePath}. Package.json: ${isESMFromPackageJson ? 'ESM' : 'CJS'}, bundling options: ${isESMFromBundling ? 'ESM' : 'CJS'}. Using ${isESMFromBundling ? 'ESM' : 'CJS'} from bunding otions.`);
93
93
  isESM = isESMFromBundling;
94
94
  }
95
95
  else if (isESMFromPackageJson !== undefined) {
@@ -102,35 +102,35 @@ async function build(input) {
102
102
  isESM = false;
103
103
  }
104
104
  let ctx = input.oldCtx;
105
- Logger.verbose(`[Function ${input.functionId}] Module type: ${isESM ? "ESM" : "CJS"})`);
105
+ Logger.verbose(`[Function ${input.functionId}] Module type: ${isESM ? 'ESM' : 'CJS'})`);
106
106
  if (!ctx) {
107
107
  const optionsDefault = {
108
108
  entryPoints: [handlerCodePath],
109
- platform: "node",
109
+ platform: 'node',
110
110
  keepNames: true,
111
111
  bundle: true,
112
- logLevel: "silent",
112
+ logLevel: 'silent',
113
113
  metafile: true,
114
114
  ...(isESM
115
115
  ? {
116
- format: "esm",
117
- target: "esnext",
118
- mainFields: ["module", "main"],
116
+ format: 'esm',
117
+ target: 'esnext',
118
+ mainFields: ['module', 'main'],
119
119
  banner: {
120
120
  js: [
121
121
  `import { createRequire as topLevelCreateRequire } from 'module';`,
122
122
  `global.require = global.require ?? topLevelCreateRequire(import.meta.url);`,
123
123
  `import { fileURLToPath as topLevelFileUrlToPath, URL as topLevelURL } from "url"`,
124
124
  `global.__dirname = global.__dirname ?? topLevelFileUrlToPath(new topLevelURL(".", import.meta.url))`,
125
- ].join("\n"),
125
+ ].join('\n'),
126
126
  },
127
127
  }
128
128
  : {
129
- format: "cjs",
130
- target: "node14",
129
+ format: 'cjs',
130
+ target: 'node14',
131
131
  }),
132
132
  outdir: targetFolder,
133
- sourcemap: "linked",
133
+ sourcemap: 'linked',
134
134
  };
135
135
  const options = {
136
136
  ...optionsDefault,
@@ -161,7 +161,7 @@ async function build(input) {
161
161
  if (input.function.packageJsonPath) {
162
162
  const from = path.resolve(input.function.packageJsonPath);
163
163
  Logger.verbose(`[Function ${input.functionId}] package.json: ${from}`);
164
- const to = path.resolve(path.join(targetFolder, "package.json"));
164
+ const to = path.resolve(path.join(targetFolder, 'package.json'));
165
165
  await fs.copyFile(from, to);
166
166
  }
167
167
  else {
@@ -1,4 +1,4 @@
1
- import { FuctionRequest } from "./ioTService.js";
1
+ import { FuctionRequest } from './ioTService.js';
2
2
  /**
3
3
  * Invoke a Lambda function locally
4
4
  * @param fuctionRequest
@@ -1,7 +1,7 @@
1
- import * as path from "path";
2
- import * as fs from "fs/promises";
3
- import { NodeEsBuild } from "./nodeEsBuild.mjs";
4
- import { NodeWorker } from "./nodeWorker.mjs";
1
+ import * as path from 'path';
2
+ import * as fs from 'fs/promises';
3
+ import { NodeEsBuild } from './nodeEsBuild.mjs';
4
+ import { NodeWorker } from './nodeWorker.mjs';
5
5
  /**
6
6
  * Build the Lambda function
7
7
  * @param functionId
@@ -1,4 +1,4 @@
1
- import { FuctionRequest } from "./ioTService.js";
1
+ import { FuctionRequest } from './ioTService.js';
2
2
  /**
3
3
  * Run the function in a Node.js Worker Thread
4
4
  * @param input
@@ -1,8 +1,8 @@
1
- import { Worker } from "node:worker_threads";
2
- import * as path from "path";
3
- import { Configuration } from "./configuration.mjs";
4
- import { getModuleDirname, getProjectDirname } from "./getDirname.mjs";
5
- import { Logger } from "./logger.mjs";
1
+ import { Worker } from 'node:worker_threads';
2
+ import * as path from 'path';
3
+ import { Configuration } from './configuration.mjs';
4
+ import { getModuleDirname, getProjectDirname } from './getDirname.mjs';
5
+ import { Logger } from './logger.mjs';
6
6
  const workers = new Map();
7
7
  /**
8
8
  * Run the function in a Node.js Worker Thread
@@ -15,7 +15,7 @@ async function runInWorker(input) {
15
15
  let worker = workers.get(input.fuctionRequest.workerId);
16
16
  if (!worker) {
17
17
  worker = startWorker({
18
- handler: func.handler ?? "handler",
18
+ handler: func.handler ?? 'handler',
19
19
  artifactFile: input.artifactFile,
20
20
  workerId: input.fuctionRequest.workerId,
21
21
  functionId: input.fuctionRequest.functionId,
@@ -26,7 +26,7 @@ async function runInWorker(input) {
26
26
  else {
27
27
  Logger.verbose(`[Function ${input.fuctionRequest.functionId}] [Worker ${input.fuctionRequest.workerId}] Reusing worker`);
28
28
  }
29
- worker.on("message", (msg) => {
29
+ worker.on('message', (msg) => {
30
30
  Logger.verbose(`[Function ${input.fuctionRequest.functionId}] [Worker ${input.fuctionRequest.workerId}] Worker message`, JSON.stringify(msg));
31
31
  if (msg?.errorType) {
32
32
  reject(msg);
@@ -35,7 +35,7 @@ async function runInWorker(input) {
35
35
  resolve(msg);
36
36
  }
37
37
  });
38
- worker.on("error", (err) => {
38
+ worker.on('error', (err) => {
39
39
  Logger.error(`[Function ${input.fuctionRequest.functionId}] [Worker ${input.fuctionRequest.workerId}] Error`, err);
40
40
  reject(err);
41
41
  });
@@ -57,23 +57,23 @@ function startWorker(input) {
57
57
  const worker = new Worker(path.resolve(path.join(getModuleDirname(), `./nodeWorkerRunner.mjs`)), {
58
58
  env: {
59
59
  ...input.environment,
60
- IS_LOCAL: "true",
60
+ IS_LOCAL: 'true',
61
61
  LOCAL_PROJECT_DIR: localProjectDir,
62
62
  },
63
- execArgv: ["--enable-source-maps"],
63
+ execArgv: ['--enable-source-maps'],
64
64
  workerData: input,
65
65
  stderr: true,
66
66
  stdin: true,
67
67
  stdout: true,
68
68
  //type: "module",
69
69
  });
70
- worker.stdout.on("data", (data) => {
70
+ worker.stdout.on('data', (data) => {
71
71
  Logger.verbose(`[Function ${input.functionId}] [Worker ${input.workerId}] `, data.toString());
72
72
  });
73
- worker.stderr.on("data", (data) => {
73
+ worker.stderr.on('data', (data) => {
74
74
  Logger.verbose(`[Function ${input.functionId}] [Worker ${input.workerId}] `, data.toString());
75
75
  });
76
- worker.on("exit", () => {
76
+ worker.on('exit', () => {
77
77
  Logger.verbose(`[Function ${input.functionId}] [Worker ${input.workerId}] Worker exited`);
78
78
  workers.delete(input.workerId);
79
79
  });
@@ -84,7 +84,7 @@ function startWorker(input) {
84
84
  * Stop all Node.js Worker Threads
85
85
  */
86
86
  async function stopAllWorkers() {
87
- Logger.verbose("Stopping all workers");
87
+ Logger.verbose('Stopping all workers');
88
88
  const promises = [];
89
89
  for (const worker of workers.values()) {
90
90
  promises.push(worker.terminate());
@@ -1,16 +1,16 @@
1
- import { createRequire as topLevelCreateRequire } from "module";
1
+ import { createRequire as topLevelCreateRequire } from 'module';
2
2
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
3
3
  const require = topLevelCreateRequire(import.meta.url);
4
4
 
5
- import { workerData, parentPort } from "node:worker_threads";
6
- import { Logger } from "./logger.mjs";
5
+ import { workerData, parentPort } from 'node:worker_threads';
6
+ import { Logger } from './logger.mjs';
7
7
 
8
8
  Logger.setVerbose(workerData.verbose);
9
9
  Logger.verbose(
10
10
  `[Function ${workerData.functionId}] [Worker ${workerData.workerId}] Worker started.`,
11
11
  );
12
12
 
13
- parentPort.on("message", async (data) => {
13
+ parentPort.on('message', async (data) => {
14
14
  Logger.verbose(`[Worker ${workerData.workerId}] Received message`, data);
15
15
  const mod = await import(workerData.artifactFile);
16
16
  const fn = mod[workerData.handler];
@@ -21,17 +21,17 @@ parentPort.on("message", async (data) => {
21
21
  getRemainingTimeInMillis: () => 2147483647, // Max 32-bit signed integer
22
22
  done() {
23
23
  throw new Error(
24
- "`done` function on lambda Context is not implemented in Lambda Live Debugger.",
24
+ '`done` function on lambda Context is not implemented in Lambda Live Debugger.',
25
25
  );
26
26
  },
27
27
  fail() {
28
28
  throw new Error(
29
- "`fail` function on lambda Context is not implemented in Lambda Live Debugger.",
29
+ '`fail` function on lambda Context is not implemented in Lambda Live Debugger.',
30
30
  );
31
31
  },
32
32
  succeed() {
33
33
  throw new Error(
34
- "`succeed` function on lambda Context is not implemented in Lambda Live Debugger.",
34
+ '`succeed` function on lambda Context is not implemented in Lambda Live Debugger.',
35
35
  );
36
36
  },
37
37
  };
@@ -47,7 +47,7 @@ parentPort.on("message", async (data) => {
47
47
  }
48
48
  });
49
49
 
50
- process.on("unhandledRejection", (error) => {
50
+ process.on('unhandledRejection', (error) => {
51
51
  Logger.error(
52
52
  `[Function ${workerData.functionId}] [Worker ${workerData.workerId}] Unhandled Rejection`,
53
53
  error,
@@ -57,7 +57,7 @@ process.on("unhandledRejection", (error) => {
57
57
 
58
58
  function handleError(error) {
59
59
  parentPort.postMessage({
60
- errorType: error.name ?? "Error",
60
+ errorType: error.name ?? 'Error',
61
61
  errorMessage: error.message,
62
62
  trace: error.stack,
63
63
  });
@@ -1,4 +1,4 @@
1
- import { LldConfig } from "./types/lldConfig.js";
1
+ import { LldConfig } from './types/lldConfig.js';
2
2
  /**
3
3
  * Get the names of the supported frameworks
4
4
  */
@@ -1,9 +1,9 @@
1
- import { cdkFramework } from "./frameworks/cdkFramework.mjs";
2
- import { slsFramework } from "./frameworks/slsFramework.mjs";
3
- import { samFramework } from "./frameworks/samFramework.mjs";
4
- import { terraformFramework } from "./frameworks/terraformFramework.mjs";
5
- import { Logger } from "./logger.mjs";
6
- import path from "node:path";
1
+ import { cdkFramework } from './frameworks/cdkFramework.mjs';
2
+ import { slsFramework } from './frameworks/slsFramework.mjs';
3
+ import { samFramework } from './frameworks/samFramework.mjs';
4
+ import { terraformFramework } from './frameworks/terraformFramework.mjs';
5
+ import { Logger } from './logger.mjs';
6
+ import path from 'node:path';
7
7
  /**
8
8
  * List of supported frameworks
9
9
  */
@@ -30,7 +30,7 @@ async function getLambdas(config) {
30
30
  let resources = undefined;
31
31
  let frameworks = [...frameworksSupported];
32
32
  if (config.framework) {
33
- if (config.framework === "none") {
33
+ if (config.framework === 'none') {
34
34
  frameworks = [];
35
35
  }
36
36
  else {
@@ -46,7 +46,7 @@ async function getLambdas(config) {
46
46
  resources = resources.filter(
47
47
  // filter by function name, can use * as wildcard
48
48
  (l) => l.functionName === functionNameFilter ||
49
- new RegExp("^" + functionNameFilter.split("*").join(".*") + "$").test(l.functionName));
49
+ new RegExp('^' + functionNameFilter.split('*').join('.*') + '$').test(l.functionName));
50
50
  }
51
51
  }
52
52
  else {
@@ -1,4 +1,4 @@
1
- import { LambdaResource } from "./resourcesDiscovery.js";
1
+ import { LambdaResource } from './resourcesDiscovery.js';
2
2
  export type LambdaProps = {
3
3
  functionId: string;
4
4
  } & LambdaResource;
@@ -1,5 +1,5 @@
1
- import { AwsConfiguration } from "./awsConfiguration.js";
2
- import { LambdaResource } from "./resourcesDiscovery.js";
1
+ import { AwsConfiguration } from './awsConfiguration.js';
2
+ import { LambdaResource } from './resourcesDiscovery.js';
3
3
  export type LldConfigBase = {
4
4
  /**
5
5
  * Verbose logs
@@ -50,12 +50,12 @@ export type LldConfigBase = {
50
50
  subfolder?: string;
51
51
  } & AwsConfiguration;
52
52
  export type LldConfigCliArgs = {
53
- remove?: "keep-layer" | "all";
53
+ remove?: 'keep-layer' | 'all';
54
54
  vscode?: boolean;
55
55
  gitignore?: boolean;
56
56
  config?: string;
57
57
  wizard?: boolean;
58
- } & Omit<LldConfigBase, "getResources">;
58
+ } & Omit<LldConfigBase, 'getResources'>;
59
59
  export type LldConfigTs = Partial<LldConfigBase>;
60
60
  export type LldConfig = LldConfigCliArgs & LldConfigTs & {
61
61
  debuggerId: string;
@@ -1,4 +1,4 @@
1
- import { BuildOptions } from "esbuild";
1
+ import { BuildOptions } from 'esbuild';
2
2
  export type LambdaResource = {
3
3
  functionName: string;
4
4
  codePath: string;
@@ -15,4 +15,4 @@ export declare enum BundlingType {
15
15
  ESBUILD = "ESBUILD",
16
16
  NONE = "NONE"
17
17
  }
18
- export type EsBuildOptions = Omit<BuildOptions, "outfile" | "outdir" | "outbase" | "write" | "allowOverwrite" | "sourcemap" | "keepnames" | "entryPoints" | "stdin">;
18
+ export type EsBuildOptions = Omit<BuildOptions, 'outfile' | 'outdir' | 'outbase' | 'write' | 'allowOverwrite' | 'sourcemap' | 'keepnames' | 'entryPoints' | 'stdin'>;
@@ -1,15 +1,15 @@
1
- import fs from "fs/promises";
2
- import path from "path";
1
+ import fs from 'fs/promises';
2
+ import path from 'path';
3
3
  /**
4
4
  * Function to find the path of a module in the directory and parent directories
5
5
  * @param {*} dir
6
6
  * @param {*} moduleName
7
7
  */
8
8
  export async function findNpmPath(dir, moduleName) {
9
- if (dir === "/")
9
+ if (dir === '/')
10
10
  return undefined;
11
11
  try {
12
- await fs.access(path.join(dir, "package.json"));
12
+ await fs.access(path.join(dir, 'package.json'));
13
13
  const modulePath = await checkModuleInPackageJson(dir, moduleName);
14
14
  if (modulePath) {
15
15
  return modulePath;
@@ -18,7 +18,7 @@ export async function findNpmPath(dir, moduleName) {
18
18
  catch {
19
19
  // ignore, no package.json in this directory
20
20
  }
21
- return await findNpmPath(path.resolve(path.join(dir, "..")), moduleName);
21
+ return await findNpmPath(path.resolve(path.join(dir, '..')), moduleName);
22
22
  }
23
23
  /**
24
24
  * Function to check if a module exists in package.json and return the path
@@ -27,7 +27,7 @@ export async function findNpmPath(dir, moduleName) {
27
27
  * @returns
28
28
  */
29
29
  async function checkModuleInPackageJson(dir, moduleName) {
30
- const modulePath = path.join(dir, "node_modules", moduleName);
30
+ const modulePath = path.join(dir, 'node_modules', moduleName);
31
31
  try {
32
32
  await fs.access(modulePath);
33
33
  }
@@ -1,5 +1,5 @@
1
- import * as path from "path";
2
- import * as fs from "fs/promises";
1
+ import * as path from 'path';
2
+ import * as fs from 'fs/promises';
3
3
  /**
4
4
  * Find the package.json file for a given code path
5
5
  * @param codePath
@@ -7,9 +7,9 @@ import * as fs from "fs/promises";
7
7
  */
8
8
  export async function findPackageJson(codePath) {
9
9
  const handlerParsedPath = path.parse(codePath);
10
- const packageJsonRoot = await findAboveFolderWithAFile(handlerParsedPath.dir, "package.json");
10
+ const packageJsonRoot = await findAboveFolderWithAFile(handlerParsedPath.dir, 'package.json');
11
11
  const packageJsonPath = packageJsonRoot
12
- ? path.resolve(path.join(packageJsonRoot, "package.json"))
12
+ ? path.resolve(path.join(packageJsonRoot, 'package.json'))
13
13
  : undefined;
14
14
  return packageJsonPath;
15
15
  }
@@ -20,7 +20,7 @@ export async function findPackageJson(codePath) {
20
20
  * @returns
21
21
  */
22
22
  async function findAboveFolderWithAFile(dir, file) {
23
- if (dir === "/")
23
+ if (dir === '/')
24
24
  return undefined;
25
25
  try {
26
26
  // Check if the file exists in the current directory
@@ -28,6 +28,6 @@ async function findAboveFolderWithAFile(dir, file) {
28
28
  return dir;
29
29
  }
30
30
  catch {
31
- return findAboveFolderWithAFile(path.resolve(path.join(dir, "..")), file);
31
+ return findAboveFolderWithAFile(path.resolve(path.join(dir, '..')), file);
32
32
  }
33
33
  }
@@ -5,16 +5,16 @@
5
5
  */
6
6
  export function getRootFolder(folders) {
7
7
  if (folders.length === 0)
8
- return "";
8
+ return '';
9
9
  // Sort folders to ensure the shortest and most nested folder is first
10
10
  folders.sort((a, b) => a.length - b.length);
11
11
  // Split the first folder to get its parts
12
- const rootParts = folders[0].split("/");
12
+ const rootParts = folders[0].split('/');
13
13
  // Iterate through the parts and check if all folders start with the same root
14
14
  for (let i = 1; i < rootParts.length; i++) {
15
- const currentRoot = rootParts.slice(0, i + 1).join("/");
15
+ const currentRoot = rootParts.slice(0, i + 1).join('/');
16
16
  if (!folders.every((folder) => folder.startsWith(currentRoot))) {
17
- return rootParts.slice(0, i).join("/");
17
+ return rootParts.slice(0, i).join('/');
18
18
  }
19
19
  }
20
20
  return folders[0]; // If all folders have the same root
@@ -8,7 +8,7 @@ export function removeUndefinedProperties(obj) {
8
8
  return obj;
9
9
  }
10
10
  for (const key in obj) {
11
- if (typeof obj[key] === "undefined") {
11
+ if (typeof obj[key] === 'undefined') {
12
12
  delete obj[key];
13
13
  }
14
14
  }