lambda-live-debugger 0.0.95 → 0.0.97

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.
@@ -20,10 +20,13 @@ export async function getConfigFromWizard({ supportedFrameworks, currentFramewor
20
20
  type: "list",
21
21
  name: "framework",
22
22
  message: `Which framework are you using (detected: ${currentFramework ?? "?"})?`,
23
- choices: supportedFrameworks,
23
+ choices: [...supportedFrameworks, "other"],
24
24
  default: currentConfig?.framework ?? currentFramework,
25
25
  },
26
26
  ]);
27
+ if (answers.framework === "other") {
28
+ answers.framework = undefined;
29
+ }
27
30
  const oldContext = currentConfig?.context ?? [];
28
31
  if (answers.framework === "cdk") {
29
32
  const cdkAnswers = await inquirer.prompt([
@@ -223,6 +226,15 @@ export async function getConfigFromWizard({ supportedFrameworks, currentFramewor
223
226
  ]);
224
227
  answers.vscode = answersVsCode.vscode;
225
228
  }
229
+ const answersVerbose = await inquirer.prompt([
230
+ {
231
+ type: "confirm",
232
+ name: "verbose",
233
+ message: "Do you want to use verbose logging? This will log all events to the console.",
234
+ default: currentConfig?.verbose === true,
235
+ },
236
+ ]);
237
+ answers.verbose = answersVerbose.verbose;
226
238
  }
227
239
  /*
228
240
  {
@@ -288,7 +300,7 @@ function getConfigFromAnswers(answers) {
288
300
  interval: answers.interval !== undefined
289
301
  ? answers.interval
290
302
  : defaultObservableInterval,
291
- verbose: false,
303
+ verbose: answers.verbose,
292
304
  interactive: answers.interactive,
293
305
  gitignore: answers.gitignore,
294
306
  vscode: answers.vscode,
Binary file
@@ -21,7 +21,7 @@ parentPort.on("message", async (data) => {
21
21
  const __dirname = path.resolve("./x"); // CDK needs this, pure magic
22
22
  eval(codeFile);
23
23
 
24
- if (global.lambdas.length === 0) {
24
+ if (!global.lambdas || global.lambdas?.length === 0) {
25
25
  throw new Error("No Lambda functions found in the CDK code");
26
26
  }
27
27
 
@@ -33,29 +33,15 @@ parentPort.on("message", async (data) => {
33
33
  path: lambda.code?.path,
34
34
  },
35
35
  cdkPath: lambda.node.defaultChild.node.path,
36
- bundling: lambda.bundling,
36
+ bundling: {
37
+ ...lambda.bundling,
38
+ commandHooks: undefined, // can not be serialized
39
+ },
37
40
  }));
38
41
 
39
- try {
40
- Logger.verbose(
41
- `[CDK] [Worker] Sending found lambdas`,
42
- JSON.stringify(lambdas, null, 2)
43
- );
44
- parentPort.postMessage(lambdas);
45
- } catch (error) {
46
- handleError(error);
47
- }
42
+ Logger.verbose(
43
+ `[CDK] [Worker] Sending found lambdas`,
44
+ JSON.stringify(lambdas, null, 2)
45
+ );
46
+ parentPort.postMessage(lambdas);
48
47
  });
49
-
50
- process.on("unhandledRejection", (error) => {
51
- Logger.error(`[CDK] [Worker] Unhandled Rejection`, error);
52
- handleError(error);
53
- });
54
-
55
- function handleError(error) {
56
- parentPort.postMessage({
57
- errorType: error.name ?? "Error",
58
- errorMessage: error.message,
59
- trace: error.stack,
60
- });
61
- }
@@ -114,13 +114,13 @@ async function deployLayer() {
114
114
  await getLambdaClient().send(deleteLayerVersionCommand);
115
115
  }
116
116
  else {
117
- Logger.verbose("Layer already deployed.");
117
+ Logger.log(`${layerDescription} already deployed.`);
118
118
  return existingLayer.LayerVersionArn;
119
119
  }
120
120
  }
121
121
  // Read the ZIP file containing your layer code
122
122
  const layerContent = await fs.readFile(layerZipPathFullPath);
123
- Logger.verbose(`Deploying ${layerDescription}`);
123
+ Logger.log(`Deploying ${layerDescription}`);
124
124
  // Create the command for publishing a new layer version
125
125
  const publishLayerVersionCommand = new PublishLayerVersionCommand({
126
126
  LayerName: layerName,
@@ -22,9 +22,10 @@ import { LambdaConnection } from "./lambdaConnection.mjs";
22
22
  */
23
23
  async function run() {
24
24
  const version = await getVersion();
25
+ Logger.log(`Welcome to Lambda Live Debugger version ${version}`);
25
26
  await Configuration.readConfig();
26
27
  Logger.setVerbose(Configuration.config.verbose === true);
27
- Logger.verbose(`Parameters: \n ${Object.entries(Configuration.config)
28
+ Logger.verbose(`Parameters: \n${Object.entries(Configuration.config)
28
29
  .map(([key, value]) => ` - ${key}=${value}`)
29
30
  .join("\n")}`);
30
31
  Logger.verbose(`NPM module folder: ${getModuleDirname()}`);
@@ -38,7 +39,7 @@ async function run() {
38
39
  if (!Configuration.config.start && !Configuration.config.remove) {
39
40
  return;
40
41
  }
41
- Logger.log(`Welcome to Lambda Live Debugger version: ${version}! Starting the debugger
42
+ Logger.log(`Starting the debugger
42
43
  ${Configuration.config.observable
43
44
  ? "in observable mode"
44
45
  : `(ID ${Configuration.config.debuggerId})`}
@@ -148,7 +148,12 @@ async function build(input) {
148
148
  };
149
149
  // remove all undefined values just to make it cleaner
150
150
  removeUndefinedProperties(options);
151
- Logger.verbose(`[Function ${input.functionId}] Building ${handlerCodePath} with options:`, JSON.stringify(options, null, 2));
151
+ if (Configuration.config.verbose) {
152
+ Logger.verbose(`[Function ${input.functionId}] Building ${handlerCodePath} with options:`, JSON.stringify(options, null, 2));
153
+ }
154
+ else {
155
+ Logger.log(`[Function ${input.functionId}] Building ${handlerCodePath}`);
156
+ }
152
157
  ctx = await esbuild.context(options);
153
158
  }
154
159
  const result = await ctx.rebuild();
package/dist/vsCode.mjs CHANGED
@@ -28,6 +28,7 @@ async function getVsCodeLaunchConfig(lldConfig) {
28
28
  let runtimeExecutableSet = false;
29
29
  //if installed locally
30
30
  if (moduleDirname.startsWith("/home/")) {
31
+ Logger.verbose("Lambda Live Debugger is installed locally");
31
32
  // check if file exists
32
33
  try {
33
34
  //Logger.log("Checking local folder", localFolder);
@@ -40,10 +41,13 @@ async function getVsCodeLaunchConfig(lldConfig) {
40
41
  //Logger.log("Not found", localFolder);
41
42
  }
42
43
  }
43
- if (runtimeExecutableSet) {
44
- const projectDirname = getProjectDirname();
45
- const globalModule1 = path.join(projectDirname, "..", "..", ".bin/lld");
46
- const globalModule2 = path.join(projectDirname, "..", "..", "bin/lld");
44
+ else {
45
+ Logger.verbose("Lambda Live Debugger is installed globally");
46
+ }
47
+ if (!runtimeExecutableSet) {
48
+ Logger.verbose(`Setting absolute path for runtimeExecutable setting for VsCode configuration`);
49
+ const globalModule1 = path.join(moduleDirname, "..", "..", ".bin/lld");
50
+ const globalModule2 = path.join(moduleDirname, "..", "..", "bin/lld");
47
51
  const globalModule3 = path.join(moduleDirname, "..", "..", "..", "..", "bin/lld");
48
52
  const possibleFolders = {
49
53
  [localFolder]: "${workspaceFolder}/node_modules/.bin/lld",
@@ -51,6 +55,7 @@ async function getVsCodeLaunchConfig(lldConfig) {
51
55
  [globalModule2]: globalModule2,
52
56
  [globalModule3]: globalModule3,
53
57
  };
58
+ Logger.verbose(`Checking the following possible folders for lld executable:`, JSON.stringify(possibleFolders, null, 2));
54
59
  // check each possible folder and set the runtimeExecutable
55
60
  for (const folder in possibleFolders) {
56
61
  try {
@@ -58,11 +63,11 @@ async function getVsCodeLaunchConfig(lldConfig) {
58
63
  await fs.access(folder, fs.constants.F_OK);
59
64
  config.configurations[0].runtimeExecutable = possibleFolders[folder];
60
65
  runtimeExecutableSet = true;
61
- //Logger.log("Found folder", folder);
66
+ Logger.verbose(`Found folder with lld executable: ${folder}`);
62
67
  break;
63
68
  }
64
69
  catch (err) {
65
- //Logger.log("Not found", folder);
70
+ // Not found
66
71
  }
67
72
  }
68
73
  if (!runtimeExecutableSet) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lambda-live-debugger",
3
- "version": "0.0.95",
3
+ "version": "0.0.97",
4
4
  "type": "module",
5
5
  "description": "Debug Lambda functions locally like it is running in the cloud",
6
6
  "repository": {