lambda-live-debugger 0.0.113 → 0.0.115

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 (60) 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 +91 -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 +764 -255
  18. package/dist/extension/nodejs/node_modules/interceptor.js.map +4 -4
  19. package/dist/fileWatcher.mjs +11 -11
  20. package/dist/frameworks/cdkFramework.d.ts +5 -5
  21. package/dist/frameworks/cdkFramework.mjs +41 -41
  22. package/dist/frameworks/cdkFrameworkWorker.mjs +13 -13
  23. package/dist/frameworks/iFrameworks.d.ts +2 -2
  24. package/dist/frameworks/samFramework.d.ts +3 -3
  25. package/dist/frameworks/samFramework.mjs +19 -19
  26. package/dist/frameworks/slsFramework.d.ts +4 -4
  27. package/dist/frameworks/slsFramework.mjs +22 -22
  28. package/dist/frameworks/terraformFramework.d.ts +4 -4
  29. package/dist/frameworks/terraformFramework.mjs +34 -34
  30. package/dist/getDirname.mjs +3 -3
  31. package/dist/gitignore.mjs +11 -11
  32. package/dist/index.d.ts +8 -8
  33. package/dist/index.mjs +4 -4
  34. package/dist/infraDeploy.mjs +39 -39
  35. package/dist/ioTService.d.ts +6 -6
  36. package/dist/ioTService.mjs +19 -19
  37. package/dist/lambdaConnection.mjs +15 -15
  38. package/dist/lldebugger.mjs +23 -24
  39. package/dist/logger.d.ts +28 -7
  40. package/dist/logger.mjs +46 -8
  41. package/dist/nodeEsBuild.mjs +30 -30
  42. package/dist/nodeHandler.d.ts +1 -1
  43. package/dist/nodeHandler.mjs +4 -4
  44. package/dist/nodeWorker.d.ts +1 -1
  45. package/dist/nodeWorker.mjs +14 -14
  46. package/dist/nodeWorkerRunner.mjs +9 -9
  47. package/dist/resourceDiscovery.d.ts +1 -1
  48. package/dist/resourceDiscovery.mjs +8 -8
  49. package/dist/types/lambdaProps.d.ts +1 -1
  50. package/dist/types/lldConfig.d.ts +4 -4
  51. package/dist/types/resourcesDiscovery.d.ts +2 -2
  52. package/dist/utils/findNpmPath.mjs +6 -6
  53. package/dist/utils/findPackageJson.mjs +6 -6
  54. package/dist/utils/getRootFolder.mjs +4 -4
  55. package/dist/utils/removeUndefinedProperties.mjs +1 -1
  56. package/dist/version.mjs +5 -5
  57. package/dist/vsCode.mjs +34 -34
  58. package/eslint.config.js +18 -18
  59. package/fix-imports.js +13 -13
  60. package/package.json +4 -2
@@ -1,9 +1,9 @@
1
- import * as chokidar from "chokidar";
2
- import { NodeEsBuild } from "./nodeEsBuild.mjs";
3
- import { NodeWorker } from "./nodeWorker.mjs";
4
- import { Configuration } from "./configuration.mjs";
5
- import { setTimeout } from "node:timers/promises";
6
- import { Logger } from "./logger.mjs";
1
+ import * as chokidar from 'chokidar';
2
+ import { NodeEsBuild } from './nodeEsBuild.mjs';
3
+ import { NodeWorker } from './nodeWorker.mjs';
4
+ import { Configuration } from './configuration.mjs';
5
+ import { setTimeout } from 'node:timers/promises';
6
+ import { Logger } from './logger.mjs';
7
7
  let processingChange = false;
8
8
  /**
9
9
  * Watch for file changes in a folder and trigger a rebuild of the Lambdas
@@ -17,17 +17,17 @@ function watchForFileChanges(folder) {
17
17
  followSymlinks: false,
18
18
  disableGlobbing: false,
19
19
  ignored: [
20
- "**/node_modules/**",
21
- "**/.lldebugger/**",
22
- "**/.git/**",
23
- "**/debug.log",
20
+ '**/node_modules/**',
21
+ '**/.lldebugger/**',
22
+ '**/.git/**',
23
+ '**/debug.log',
24
24
  ],
25
25
  awaitWriteFinish: {
26
26
  pollInterval: 100,
27
27
  stabilityThreshold: 20,
28
28
  },
29
29
  });
30
- watcher.on("change", async () => {
30
+ watcher.on('change', async () => {
31
31
  if (processingChange) {
32
32
  return;
33
33
  }
@@ -1,8 +1,8 @@
1
- import { LambdaResource } from "../types/resourcesDiscovery.js";
2
- import { IFramework } from "./iFrameworks.js";
3
- import { AwsConfiguration } from "../types/awsConfiguration.js";
4
- import { LldConfigBase } from "../types/lldConfig.js";
5
- import { type BundlingOptions } from "aws-cdk-lib/aws-lambda-nodejs";
1
+ import { LambdaResource } from '../types/resourcesDiscovery.js';
2
+ import { IFramework } from './iFrameworks.js';
3
+ import { AwsConfiguration } from '../types/awsConfiguration.js';
4
+ import { LldConfigBase } from '../types/lldConfig.js';
5
+ import { type BundlingOptions } from 'aws-cdk-lib/aws-lambda-nodejs';
6
6
  /**
7
7
  * Support for AWS CDK framework
8
8
  */
@@ -1,14 +1,14 @@
1
- import * as esbuild from "esbuild";
2
- import * as fs from "fs/promises";
3
- import * as path from "path";
4
- import { BundlingType } from "../types/resourcesDiscovery.mjs";
5
- import { outputFolder } from "../constants.mjs";
6
- import { findPackageJson } from "../utils/findPackageJson.mjs";
7
- import { CloudFormation } from "../cloudFormation.mjs";
8
- import { Logger } from "../logger.mjs";
9
- import { Worker } from "node:worker_threads";
10
- import { getModuleDirname, getProjectDirname } from "../getDirname.mjs";
11
- import { findNpmPath } from "../utils/findNpmPath.mjs";
1
+ import * as esbuild from 'esbuild';
2
+ import * as fs from 'fs/promises';
3
+ import * as path from 'path';
4
+ import { BundlingType } from '../types/resourcesDiscovery.mjs';
5
+ import { outputFolder } from '../constants.mjs';
6
+ import { findPackageJson } from '../utils/findPackageJson.mjs';
7
+ import { CloudFormation } from '../cloudFormation.mjs';
8
+ import { Logger } from '../logger.mjs';
9
+ import { Worker } from 'node:worker_threads';
10
+ import { getModuleDirname, getProjectDirname } from '../getDirname.mjs';
11
+ import { findNpmPath } from '../utils/findNpmPath.mjs';
12
12
  /**
13
13
  * Support for AWS CDK framework
14
14
  */
@@ -17,7 +17,7 @@ export class CdkFramework {
17
17
  * Framework name
18
18
  */
19
19
  get name() {
20
- return "cdk";
20
+ return 'cdk';
21
21
  }
22
22
  /**
23
23
  * Can this class handle the current project
@@ -25,7 +25,7 @@ export class CdkFramework {
25
25
  */
26
26
  async canHandle() {
27
27
  // check if there is cdk.json
28
- const cdkJsonPath = path.resolve("cdk.json");
28
+ const cdkJsonPath = path.resolve('cdk.json');
29
29
  try {
30
30
  await fs.access(cdkJsonPath, fs.constants.F_OK);
31
31
  return true;
@@ -46,7 +46,7 @@ export class CdkFramework {
46
46
  profile: config.profile,
47
47
  role: config.role,
48
48
  };
49
- const cdkConfigPath = "cdk.json";
49
+ const cdkConfigPath = 'cdk.json';
50
50
  // read cdk.json and extract the entry file
51
51
  const lambdasInCdk = await this.getLambdasDataFromCdkByCompilingAndRunning(cdkConfigPath, config);
52
52
  Logger.verbose(`[CDK] Found Lambda functions:`, JSON.stringify(lambdasInCdk, null, 2));
@@ -57,7 +57,7 @@ export class CdkFramework {
57
57
  return lambda.stackName;
58
58
  })),
59
59
  ];
60
- Logger.verbose(`[CDK] Found the following stacks in CDK: ${stackNames.join(", ")}`);
60
+ Logger.verbose(`[CDK] Found the following stacks in CDK: ${stackNames.join(', ')}`);
61
61
  const lambdasDeployed = (await Promise.all(stackNames.map(async (stackName) => {
62
62
  const lambdasInStackPromise = CloudFormation.getLambdasInStack(stackName, awsConfiguration);
63
63
  const lambdasMetadataPromise = this.getLambdaCdkPathFromTemplateMetadata(stackName, awsConfiguration);
@@ -122,11 +122,11 @@ export class CdkFramework {
122
122
  const cfTemplate = await CloudFormation.getCloudFormationStackTemplate(stackName, awsConfiguration);
123
123
  // get all Lambda functions in the template
124
124
  const lambdas = Object.entries(cfTemplate.Resources)
125
- .filter(([, resource]) => resource.Type === "AWS::Lambda::Function")
125
+ .filter(([, resource]) => resource.Type === 'AWS::Lambda::Function')
126
126
  .map(([key, resource]) => {
127
127
  return {
128
128
  logicalId: key,
129
- cdkPath: resource.Metadata["aws:cdk:path"],
129
+ cdkPath: resource.Metadata['aws:cdk:path'],
130
130
  };
131
131
  });
132
132
  return lambdas;
@@ -141,13 +141,13 @@ export class CdkFramework {
141
141
  const entryFile = await this.getCdkEntryFile(cdkConfigPath);
142
142
  // Define a plugin to prepend custom code to .ts or .tsx files
143
143
  const injectCodePlugin = {
144
- name: "injectCode",
144
+ name: 'injectCode',
145
145
  setup(build) {
146
146
  build.onLoad({ filter: /.*/ }, async (args) => {
147
147
  const absolutePath = path.resolve(args.path);
148
- let source = await fs.readFile(absolutePath, "utf8");
149
- if (args.path.includes("aws-cdk-lib/aws-lambda/lib/function.")) {
150
- const codeToFind = "try{jsiiDeprecationWarnings().aws_cdk_lib_aws_lambda_FunctionProps(props)}";
148
+ let source = await fs.readFile(absolutePath, 'utf8');
149
+ if (args.path.includes('aws-cdk-lib/aws-lambda/lib/function.')) {
150
+ const codeToFind = 'try{jsiiDeprecationWarnings().aws_cdk_lib_aws_lambda_FunctionProps(props)}';
151
151
  if (!source.includes(codeToFind)) {
152
152
  throw new Error(`Can not find code to inject in ${args.path}`);
153
153
  }
@@ -175,8 +175,8 @@ export class CdkFramework {
175
175
  // });
176
176
  global.lambdas.push(lambdaInfo);` + codeToFind);
177
177
  }
178
- if (args.path.includes("aws-cdk-lib/aws-s3-deployment/lib/bucket-deployment.")) {
179
- const codeToFind = "super(scope,id),this.requestDestinationArn=!1;";
178
+ if (args.path.includes('aws-cdk-lib/aws-s3-deployment/lib/bucket-deployment.')) {
179
+ const codeToFind = 'super(scope,id),this.requestDestinationArn=!1;';
180
180
  if (!source.includes(codeToFind)) {
181
181
  throw new Error(`Can not find code to inject in ${args.path}`);
182
182
  }
@@ -185,7 +185,7 @@ export class CdkFramework {
185
185
  }
186
186
  return {
187
187
  contents: source,
188
- loader: "default",
188
+ loader: 'default',
189
189
  };
190
190
  });
191
191
  },
@@ -196,8 +196,8 @@ export class CdkFramework {
196
196
  await esbuild.build({
197
197
  entryPoints: [entryFile],
198
198
  bundle: true,
199
- platform: "node",
200
- target: "node18",
199
+ platform: 'node',
200
+ target: 'node18',
201
201
  outfile: compileOutput,
202
202
  sourcemap: false,
203
203
  plugins: [injectCodePlugin],
@@ -212,11 +212,11 @@ export class CdkFramework {
212
212
  const CDK_CONTEXT_JSON = {
213
213
  ...context,
214
214
  // prevent compiling assets
215
- "aws:cdk:bundling-stacks": [],
215
+ 'aws:cdk:bundling-stacks': [],
216
216
  };
217
217
  process.env.CDK_CONTEXT_JSON = JSON.stringify(CDK_CONTEXT_JSON);
218
218
  Logger.verbose(`[CDK] Context:`, JSON.stringify(CDK_CONTEXT_JSON, null, 2));
219
- const awsCdkLibPath = await findNpmPath(path.join(getProjectDirname(), config.subfolder ?? "/"), "aws-cdk-lib");
219
+ const awsCdkLibPath = await findNpmPath(path.join(getProjectDirname(), config.subfolder ?? '/'), 'aws-cdk-lib');
220
220
  Logger.verbose(`[CDK] aws-cdk-lib path: ${awsCdkLibPath}`);
221
221
  const lambdas = await this.runCdkCodeAndReturnLambdas({
222
222
  config,
@@ -225,7 +225,7 @@ export class CdkFramework {
225
225
  });
226
226
  const list = await Promise.all(lambdas.map(async (lambda) => {
227
227
  // handler slit into file and file name
228
- const handlerSplit = lambda.handler.split(".");
228
+ const handlerSplit = lambda.handler.split('.');
229
229
  const handler = handlerSplit.pop();
230
230
  const filename = handlerSplit[0];
231
231
  let codePath = lambda.codePath;
@@ -270,7 +270,7 @@ export class CdkFramework {
270
270
  */
271
271
  async runCdkCodeAndReturnLambdas({ config, awsCdkLibPath, compileCodeFile, }) {
272
272
  const lambdas = await new Promise((resolve, reject) => {
273
- const worker = new Worker(path.resolve(path.join(getModuleDirname(), "frameworks/cdkFrameworkWorker.mjs")), {
273
+ const worker = new Worker(path.resolve(path.join(getModuleDirname(), 'frameworks/cdkFrameworkWorker.mjs')), {
274
274
  workerData: {
275
275
  verbose: config.verbose,
276
276
  awsCdkLibPath,
@@ -279,16 +279,16 @@ export class CdkFramework {
279
279
  subfolder: config.subfolder,
280
280
  },
281
281
  });
282
- worker.on("message", async (message) => {
282
+ worker.on('message', async (message) => {
283
283
  resolve(message);
284
284
  await worker.terminate();
285
285
  });
286
- worker.on("error", (error) => {
286
+ worker.on('error', (error) => {
287
287
  reject(new Error(`Error running CDK code in worker: ${error.message}`, {
288
288
  cause: error,
289
289
  }));
290
290
  });
291
- worker.on("exit", (code) => {
291
+ worker.on('exit', (code) => {
292
292
  if (code !== 0) {
293
293
  reject(new Error(`CDK worker stopped with exit code ${code}`));
294
294
  }
@@ -310,7 +310,7 @@ export class CdkFramework {
310
310
  // get CDK context from the command line
311
311
  // get all "-c" and "--context" arguments from the command line
312
312
  const contextFromLldConfig = config.context?.reduce((acc, arg) => {
313
- const [key, value] = arg.split("=");
313
+ const [key, value] = arg.split('=');
314
314
  if (key && value) {
315
315
  acc[key] = value;
316
316
  }
@@ -319,21 +319,21 @@ export class CdkFramework {
319
319
  // get all context from 'cdk.context.json' if it exists
320
320
  let contextFromJson = {};
321
321
  try {
322
- const cdkContextJson = await fs.readFile("cdk.context.json", "utf8");
322
+ const cdkContextJson = await fs.readFile('cdk.context.json', 'utf8');
323
323
  contextFromJson = JSON.parse(cdkContextJson);
324
324
  }
325
325
  catch (err) {
326
- if (err.code !== "ENOENT") {
326
+ if (err.code !== 'ENOENT') {
327
327
  throw new Error(`Error reading cdk.context.json: ${err.message}`);
328
328
  }
329
329
  }
330
330
  // get context from cdk.json
331
331
  let cdkJson = {};
332
332
  try {
333
- cdkJson = JSON.parse(await fs.readFile(cdkConfigPath, "utf8"));
333
+ cdkJson = JSON.parse(await fs.readFile(cdkConfigPath, 'utf8'));
334
334
  }
335
335
  catch (err) {
336
- if (err.code !== "ENOENT") {
336
+ if (err.code !== 'ENOENT') {
337
337
  throw new Error(`Error reading cdk.json: ${err.message}`);
338
338
  }
339
339
  }
@@ -345,13 +345,13 @@ export class CdkFramework {
345
345
  * @returns
346
346
  */
347
347
  async getCdkEntryFile(cdkConfigPath) {
348
- const cdkJson = await fs.readFile(cdkConfigPath, "utf8");
348
+ const cdkJson = await fs.readFile(cdkConfigPath, 'utf8');
349
349
  const cdkConfig = JSON.parse(cdkJson);
350
350
  const entry = cdkConfig.app;
351
351
  // just file that ends with .ts
352
352
  let entryFile = entry
353
- ?.split(" ")
354
- .find((file) => file.endsWith(".ts"))
353
+ ?.split(' ')
354
+ .find((file) => file.endsWith('.ts'))
355
355
  ?.trim();
356
356
  if (!entryFile) {
357
357
  throw new Error(`Entry file not found in ${cdkConfigPath}`);
@@ -1,38 +1,38 @@
1
1
  // @ts-nocheck
2
- import { createRequire as topLevelCreateRequire } from "module";
2
+ import { createRequire as topLevelCreateRequire } from 'module';
3
3
  const require = topLevelCreateRequire(import.meta.url);
4
- import path from "path";
4
+ import path from 'path';
5
5
 
6
- import { workerData, parentPort } from "node:worker_threads";
7
- import fs from "fs/promises";
6
+ import { workerData, parentPort } from 'node:worker_threads';
7
+ import fs from 'fs/promises';
8
8
 
9
- import { Logger } from "../logger.mjs";
9
+ import { Logger } from '../logger.mjs';
10
10
 
11
11
  Logger.setVerbose(workerData.verbose);
12
12
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
13
13
  const __dirname = path.resolve(
14
14
  path.join(
15
- ...[workerData.projectDirname, workerData.subfolder, "x"].filter((p) => p),
15
+ ...[workerData.projectDirname, workerData.subfolder, 'x'].filter((p) => p),
16
16
  ),
17
17
  );
18
18
 
19
19
  Logger.verbose(`[CDK] [Worker] Started`);
20
20
 
21
- parentPort.on("message", async (data) => {
21
+ parentPort.on('message', async (data) => {
22
22
  // this is global variable to store the data from the CDK code once it is executed
23
23
  global.lambdas = [];
24
24
 
25
25
  Logger.verbose(`[Worker ${workerData.workerId}] Received message`, data);
26
26
 
27
27
  // execute code to get the data into global.lambdas
28
- const codeFile = await fs.readFile(data.compileOutput, "utf8");
28
+ const codeFile = await fs.readFile(data.compileOutput, 'utf8');
29
29
 
30
30
  await fixCdkPaths(workerData.awsCdkLibPath);
31
31
 
32
32
  eval(codeFile);
33
33
 
34
34
  if (!global.lambdas || global.lambdas?.length === 0) {
35
- throw new Error("No Lambda functions found in the CDK code");
35
+ throw new Error('No Lambda functions found in the CDK code');
36
36
  }
37
37
 
38
38
  const lambdas = global.lambdas.map((lambda) => ({
@@ -67,15 +67,15 @@ async function fixCdkPaths(awsCdkLibPath) {
67
67
  Logger.verbose(`[CDK] [Worker] aws-cdk-lib PATH ${awsCdkLibPath}`);
68
68
 
69
69
  const pathsFix = {
70
- "custom-resource-handlers/": `${awsCdkLibPath}/custom-resource-handlers/`,
70
+ 'custom-resource-handlers/': `${awsCdkLibPath}/custom-resource-handlers/`,
71
71
  };
72
72
 
73
73
  // Create a proxy to intercept calls to the path module so we can fix paths
74
74
  const pathProxy = new Proxy(path, {
75
75
  get(target, prop) {
76
- if (typeof target[prop] === "function") {
76
+ if (typeof target[prop] === 'function') {
77
77
  return function (...args) {
78
- if (prop === "resolve") {
78
+ if (prop === 'resolve') {
79
79
  let resolvedPath = target[prop].apply(target, args);
80
80
 
81
81
  for (const [key, value] of Object.entries(pathsFix)) {
@@ -100,7 +100,7 @@ async function fixCdkPaths(awsCdkLibPath) {
100
100
  });
101
101
 
102
102
  // Override the path module in the require cache
103
- require.cache[require.resolve("path")] = {
103
+ require.cache[require.resolve('path')] = {
104
104
  exports: pathProxy,
105
105
  };
106
106
  }
@@ -1,5 +1,5 @@
1
- import { LldConfigBase } from "../types/lldConfig.js";
2
- import { LambdaResource } from "../types/resourcesDiscovery.js";
1
+ import { LldConfigBase } from '../types/lldConfig.js';
2
+ import { LambdaResource } from '../types/resourcesDiscovery.js';
3
3
  /**
4
4
  * Framework support interface
5
5
  */
@@ -1,6 +1,6 @@
1
- import { LambdaResource } from "../types/resourcesDiscovery.js";
2
- import { IFramework } from "./iFrameworks.js";
3
- import { LldConfigBase } from "../types/lldConfig.js";
1
+ import { LambdaResource } from '../types/resourcesDiscovery.js';
2
+ import { IFramework } from './iFrameworks.js';
3
+ import { LldConfigBase } from '../types/lldConfig.js';
4
4
  /**
5
5
  * Support for AWS SAM framework
6
6
  */
@@ -1,22 +1,22 @@
1
- import * as fs from "fs/promises";
2
- import * as path from "path";
3
- import { constants } from "fs";
4
- import toml from "toml";
5
- import * as yaml from "yaml";
6
- import { findPackageJson } from "../utils/findPackageJson.mjs";
7
- import { CloudFormation } from "../cloudFormation.mjs";
8
- import { Logger } from "../logger.mjs";
1
+ import * as fs from 'fs/promises';
2
+ import * as path from 'path';
3
+ import { constants } from 'fs';
4
+ import toml from 'toml';
5
+ import * as yaml from 'yaml';
6
+ import { findPackageJson } from '../utils/findPackageJson.mjs';
7
+ import { CloudFormation } from '../cloudFormation.mjs';
8
+ import { Logger } from '../logger.mjs';
9
9
  /**
10
10
  * Support for AWS SAM framework
11
11
  */
12
12
  export class SamFramework {
13
- samConfigFile = "samconfig.toml";
14
- samTemplateFile = "template.yaml";
13
+ samConfigFile = 'samconfig.toml';
14
+ samTemplateFile = 'template.yaml';
15
15
  /**
16
16
  * Framework name
17
17
  */
18
18
  get name() {
19
- return "sam";
19
+ return 'sam';
20
20
  }
21
21
  /**
22
22
  * Can this class handle the current project
@@ -50,20 +50,20 @@ export class SamFramework {
50
50
  profile: config.profile,
51
51
  role: config.role,
52
52
  };
53
- const environment = config.configEnv ?? "default";
54
- const samConfigContent = await fs.readFile(path.resolve(this.samConfigFile), "utf-8");
53
+ const environment = config.configEnv ?? 'default';
54
+ const samConfigContent = await fs.readFile(path.resolve(this.samConfigFile), 'utf-8');
55
55
  const samConfig = toml.parse(samConfigContent);
56
56
  const stackName = samConfig[environment]?.global?.parameters?.stack_name;
57
57
  if (!stackName) {
58
58
  throw new Error(`Stack name not found in ${path.resolve(this.samConfigFile)}`);
59
59
  }
60
- const samTemplateContent = await fs.readFile(path.resolve(this.samTemplateFile), "utf-8");
60
+ const samTemplateContent = await fs.readFile(path.resolve(this.samTemplateFile), 'utf-8');
61
61
  const template = yaml.parse(samTemplateContent);
62
62
  const lambdas = [];
63
63
  // get all resources of type AWS::Serverless::Function
64
64
  for (const resourceName in template.Resources) {
65
65
  const resource = template.Resources[resourceName];
66
- if (resource.Type === "AWS::Serverless::Function") {
66
+ if (resource.Type === 'AWS::Serverless::Function') {
67
67
  lambdas.push({
68
68
  Name: resourceName,
69
69
  ...resource,
@@ -76,8 +76,8 @@ export class SamFramework {
76
76
  Logger.verbose(`[SAM] Found Lambdas in stack ${stackName}:`, JSON.stringify(lambdasInStack, null, 2));
77
77
  // get tags for each Lambda
78
78
  for (const func of lambdas) {
79
- const handlerFull = path.join(func.Properties.CodeUri ?? "", func.Properties.Handler);
80
- const handlerParts = handlerFull.split(".");
79
+ const handlerFull = path.join(func.Properties.CodeUri ?? '', func.Properties.Handler);
80
+ const handlerParts = handlerFull.split('.');
81
81
  const handler = handlerParts[1];
82
82
  const functionName = lambdasInStack.find((lambda) => lambda.logicalId === func.Name)?.lambdaName;
83
83
  if (!functionName) {
@@ -85,9 +85,9 @@ export class SamFramework {
85
85
  }
86
86
  let esBuildOptions = undefined;
87
87
  let codePath;
88
- if (func.Metadata?.BuildMethod?.toLowerCase() === "esbuild") {
88
+ if (func.Metadata?.BuildMethod?.toLowerCase() === 'esbuild') {
89
89
  if (func.Metadata?.BuildProperties?.EntryPoints?.length > 0) {
90
- codePath = path.join(func.Properties.CodeUri ?? "", func.Metadata?.BuildProperties?.EntryPoints[0]);
90
+ codePath = path.join(func.Properties.CodeUri ?? '', func.Metadata?.BuildProperties?.EntryPoints[0]);
91
91
  }
92
92
  esBuildOptions = {
93
93
  external: func.Metadata?.BuildProperties?.External,
@@ -1,7 +1,7 @@
1
- import { EsBuildOptions, LambdaResource } from "../types/resourcesDiscovery.js";
2
- import type Serverless from "serverless";
3
- import { IFramework } from "./iFrameworks.js";
4
- import { LldConfigBase } from "../types/lldConfig.js";
1
+ import { EsBuildOptions, LambdaResource } from '../types/resourcesDiscovery.js';
2
+ import type Serverless from 'serverless';
3
+ import { IFramework } from './iFrameworks.js';
4
+ import { LldConfigBase } from '../types/lldConfig.js';
5
5
  /**
6
6
  * Support for Serverless Framework
7
7
  */
@@ -1,8 +1,8 @@
1
- import * as fs from "fs/promises";
2
- import * as path from "path";
3
- import { constants } from "fs";
4
- import { findPackageJson } from "../utils/findPackageJson.mjs";
5
- import { Logger } from "../logger.mjs";
1
+ import * as fs from 'fs/promises';
2
+ import * as path from 'path';
3
+ import { constants } from 'fs';
4
+ import { findPackageJson } from '../utils/findPackageJson.mjs';
5
+ import { Logger } from '../logger.mjs';
6
6
  /**
7
7
  * Support for Serverless Framework
8
8
  */
@@ -11,7 +11,7 @@ export class SlsFramework {
11
11
  * Framework name
12
12
  */
13
13
  get name() {
14
- return "sls";
14
+ return 'sls';
15
15
  }
16
16
  /**
17
17
  * Can this class handle the current project
@@ -19,11 +19,11 @@ export class SlsFramework {
19
19
  */
20
20
  async canHandle() {
21
21
  const serverlessFiles = [
22
- path.resolve("serverless.yml"),
23
- path.resolve("serverless.yaml"),
24
- path.resolve("serverless.js"),
25
- path.resolve("serverless.ts"),
26
- path.resolve("serverless.json"),
22
+ path.resolve('serverless.yml'),
23
+ path.resolve('serverless.yaml'),
24
+ path.resolve('serverless.js'),
25
+ path.resolve('serverless.ts'),
26
+ path.resolve('serverless.json'),
27
27
  ];
28
28
  for (const file of serverlessFiles) {
29
29
  try {
@@ -34,7 +34,7 @@ export class SlsFramework {
34
34
  continue;
35
35
  }
36
36
  }
37
- Logger.verbose(`[SLS] This is not a Serverless framework project. None of the files found: ${serverlessFiles.join(", ")}`);
37
+ Logger.verbose(`[SLS] This is not a Serverless framework project. None of the files found: ${serverlessFiles.join(', ')}`);
38
38
  return false;
39
39
  }
40
40
  /**
@@ -52,15 +52,15 @@ export class SlsFramework {
52
52
  // lazy load modules
53
53
  resolveConfigurationPath = (await import(
54
54
  //@ts-ignore
55
- "serverless/lib/cli/resolve-configuration-path.js")).default;
55
+ 'serverless/lib/cli/resolve-configuration-path.js')).default;
56
56
  readConfiguration = (await import(
57
57
  //@ts-ignore
58
- "serverless/lib/configuration/read.js")).default;
59
- Serverless = (await import("serverless")).default;
58
+ 'serverless/lib/configuration/read.js')).default;
59
+ Serverless = (await import('serverless')).default;
60
60
  }
61
61
  catch (error) {
62
- Logger.error("Error loading serverless modules", error);
63
- Logger.log("If you are running Lambda Live Debugger from a global installation, install Serverless Framework globally as well.");
62
+ Logger.error('Error loading serverless modules', error);
63
+ Logger.log('If you are running Lambda Live Debugger from a global installation, install Serverless Framework globally as well.');
64
64
  throw new Error(`Error loading serverless modules. ${error.message}`, {
65
65
  cause: error,
66
66
  });
@@ -123,7 +123,7 @@ export class SlsFramework {
123
123
  for (const func in lambdas) {
124
124
  const lambda = lambdas[func];
125
125
  const handlerFull = lambda.handler;
126
- const handlerParts = handlerFull.split(".");
126
+ const handlerParts = handlerFull.split('.');
127
127
  const handler = handlerParts[1];
128
128
  const possibleCodePaths = [
129
129
  `${handlerParts[0]}.ts`,
@@ -166,9 +166,9 @@ export class SlsFramework {
166
166
  // 1) Get from from LLD specific options in custom.lldEsBuild
167
167
  let esBuildOptions = serverless.service.custom?.lldEsBuild;
168
168
  // 2) Get from serverless-esbuild plugin
169
- const esBuildPlugin = serverless.service.plugins?.find((p) => p === "serverless-esbuild");
169
+ const esBuildPlugin = serverless.service.plugins?.find((p) => p === 'serverless-esbuild');
170
170
  if (esBuildPlugin) {
171
- Logger.verbose("[SLS] serverless-esbuild plugin detected");
171
+ Logger.verbose('[SLS] serverless-esbuild plugin detected');
172
172
  const settings = serverless.service.custom?.esbuild;
173
173
  if (settings) {
174
174
  esBuildOptions = {
@@ -180,9 +180,9 @@ export class SlsFramework {
180
180
  }
181
181
  else {
182
182
  // 3) Get from serverless-plugin-typescript plugin
183
- const typeScriptPlugin = serverless.service.plugins?.find((p) => p === "serverless-plugin-typescript");
183
+ const typeScriptPlugin = serverless.service.plugins?.find((p) => p === 'serverless-plugin-typescript');
184
184
  if (typeScriptPlugin) {
185
- Logger.verbose("[SLS] serverless-plugin-typescript plugin detected");
185
+ Logger.verbose('[SLS] serverless-plugin-typescript plugin detected');
186
186
  const settings = serverless.service.custom?.serverlessPluginTypescript;
187
187
  if (settings) {
188
188
  esBuildOptions = {
@@ -1,8 +1,8 @@
1
1
  /// <reference types="node" resolution-mode="require"/>
2
- import { LambdaResource } from "../types/resourcesDiscovery.js";
3
- import { exec } from "child_process";
4
- import { IFramework } from "./iFrameworks.js";
5
- import { LldConfigBase } from "../types/lldConfig.js";
2
+ import { LambdaResource } from '../types/resourcesDiscovery.js';
3
+ import { exec } from 'child_process';
4
+ import { IFramework } from './iFrameworks.js';
5
+ import { LldConfigBase } from '../types/lldConfig.js';
6
6
  export declare const execAsync: typeof exec.__promisify__;
7
7
  interface TerraformState {
8
8
  resources: Array<{