lambda-live-debugger 0.0.113 → 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 +41 -41
  21. package/dist/frameworks/cdkFrameworkWorker.mjs +13 -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
package/.prettierrc CHANGED
@@ -1 +1,3 @@
1
- {}
1
+ {
2
+ "singleQuote": true
3
+ }
package/README.md CHANGED
@@ -129,12 +129,12 @@ The configuration is saved to `lldebugger.config.ts`.
129
129
  Example `lldebugger.config.ts`:
130
130
 
131
131
  ```typescript
132
- import { type LldConfigTs } from "lambda-live-debugger";
132
+ import { type LldConfigTs } from 'lambda-live-debugger';
133
133
 
134
134
  export default {
135
- framework: "cdk",
136
- context: ["environment=development"],
137
- region: "eu-central-1",
135
+ framework: 'cdk',
136
+ context: ['environment=development'],
137
+ region: 'eu-central-1',
138
138
  observable: false,
139
139
  verbose: false,
140
140
  //getLambdas: async (foundLambdas) => {
@@ -240,30 +240,29 @@ For example, when the framework has only a list of JavaScript files, but you tra
240
240
  getLambdas: async (foundLambdas, config) => {
241
241
  if (foundLambdas) {
242
242
  for (const lambda of foundLambdas) {
243
- lambda.codePath = lambda.codePath
243
+ lambda.codePath = lambda.codePath
244
244
  .replace("/dist/", "/src/")
245
245
  .replace(".js", ".ts");
246
- }
247
- }
246
+ }
247
+ }
248
248
  },
249
249
  ```
250
250
 
251
- **Modfiy esBuild configuration:**
251
+ **Modify esBuild configuration:**
252
252
 
253
253
  ```typescript
254
254
  import { type EsBuildOptions, type LldConfigTs } from "lambda-live-debugger";
255
255
 
256
256
  export default {
257
257
  ...
258
- getLambdas: async (foundLambdas, config) => {
258
+ getLambdas: async (foundLambdas, config) => {
259
259
  if (foundLambdas) {
260
260
  for (const lambda of foundLambdas) {
261
- lambda.esBuildOptions = {
262
- target: "node14",
263
- };
264
- }
265
- }
266
- },
261
+ lambda.esBuildOptions = {
262
+ target: "node14",
263
+ };
264
+ }
265
+ }
267
266
  } satisfies LldConfigTs;
268
267
  ```
269
268
 
@@ -273,15 +272,15 @@ export default {
273
272
  export default {
274
273
  //framework: <-- you do not need this line
275
274
  ...
276
- getLambdas: async (foundLambdas, config) => {
275
+ getLambdas: async (foundLambdas, config) => {
277
276
  return [
278
- {
279
- // function name as deployed on AWS
280
- functionName: "mystack-myfunction",
281
- codePath: "/src/myLambda.ts",
282
- },
283
- ];
284
- },
277
+ {
278
+ // function name as deployed on AWS
279
+ functionName: "mystack-myfunction",
280
+ codePath: "/src/myLambda.ts",
281
+ },
282
+ ];
283
+ },
285
284
  } satisfies LldConfigTs;
286
285
  ```
287
286
 
@@ -291,19 +290,16 @@ export default {
291
290
  import { CdkFramework, type LldConfigBase, type LldConfigTs } from "lambda-live-debugger";
292
291
 
293
292
  class MyCdkFramework extends CdkFramework {
294
- override getCdkContext(
295
- cdkConfigPath: string,
296
- config: LldConfigBase,
297
- ) {
293
+ override getCdkContext(cdkConfigPath: string, config: LldConfigBase) {
298
294
  // your implementation
299
- }
295
+ }
300
296
  }
301
297
 
302
298
  export default {
303
299
  ...
304
- getLambdas: async (foundLambdas, config) => {
300
+ getLambdas: async (foundLambdas, config) => {
305
301
  return new MyCdkFramework().getLambdas(config);
306
- }
302
+ }
307
303
  } satisfies LldConfigTs;s
308
304
  ```
309
305
 
@@ -313,7 +309,9 @@ Check the [GitHub issues](https://github.com/ServerlessLife/lambda-live-debugger
313
309
 
314
310
  ## Missing Features
315
311
 
316
- Check the [GitHub issues](https://github.com/ServerlessLife/lambda-live-debugger/issues). The biggest missing feature right now is MFA authentication and more Terraform configurations.
312
+ For the current list of missing features, please refer to the [GitHub issues](https://github.com/ServerlessLife/lambda-live-debugger/issues) page. The most significant missing features at the moment are MFA authentication and additional Terraform configurations.
313
+
314
+ If you have a new feature idea, please create and issue.
317
315
 
318
316
  ## Reporting an Issue
319
317
 
@@ -328,9 +326,9 @@ Check the [GitHub issues](https://github.com/ServerlessLife/lambda-live-debugger
328
326
  - [Marko (ServerlessLife)](https://www.serverlesslife.com/)
329
327
  - ⭐ Your name here for big code contributions
330
328
 
331
- ## Contributors (alphabetical)
329
+ ## Contributors (alphabetical):
332
330
 
333
- - ⭐ Your name here for documentation contributions, minor code additions, or sample projects submitted with bug reports.
331
+ - ⭐ Your name here for notable code or documentation contributions, or sample projects submitted with bug reports.
334
332
 
335
333
  ## Declarment
336
334
 
@@ -1,5 +1,5 @@
1
- import type { AwsCredentialIdentityProvider } from "@smithy/types";
2
- import { AwsConfiguration } from "./types/awsConfiguration.js";
1
+ import type { AwsCredentialIdentityProvider } from '@smithy/types';
2
+ import { AwsConfiguration } from './types/awsConfiguration.js';
3
3
  /**
4
4
  * Get AWS credentials provider
5
5
  * @param awsConfiguration
@@ -1,4 +1,4 @@
1
- import { fromNodeProviderChain } from "@aws-sdk/credential-providers";
1
+ import { fromNodeProviderChain } from '@aws-sdk/credential-providers';
2
2
  /**
3
3
  * Get AWS credentials provider
4
4
  * @param awsConfiguration
@@ -1,4 +1,4 @@
1
- import { AwsConfiguration } from "./types/awsConfiguration.js";
1
+ import { AwsConfiguration } from './types/awsConfiguration.js';
2
2
  /**
3
3
  * Get CloudFormation stack template
4
4
  * @param stackName
@@ -1,4 +1,4 @@
1
- import { AwsCredentials } from "./awsCredentials.mjs";
1
+ import { AwsCredentials } from './awsCredentials.mjs';
2
2
  let cloudFormationClient;
3
3
  /**
4
4
  * Get CloudFormation stack template
@@ -7,7 +7,7 @@ let cloudFormationClient;
7
7
  * @returns
8
8
  */
9
9
  async function getCloudFormationStackTemplate(stackName, awsConfiguration) {
10
- const { GetTemplateCommand } = await import("@aws-sdk/client-cloudformation");
10
+ const { GetTemplateCommand } = await import('@aws-sdk/client-cloudformation');
11
11
  const command = new GetTemplateCommand({ StackName: stackName });
12
12
  const cloudFormationClient = await getCloudFormationClient(awsConfiguration);
13
13
  try {
@@ -19,7 +19,7 @@ async function getCloudFormationStackTemplate(stackName, awsConfiguration) {
19
19
  return cfTemplate;
20
20
  }
21
21
  catch (error) {
22
- if (error.name === "ValidationError") {
22
+ if (error.name === 'ValidationError') {
23
23
  throw new Error(`Stack ${stackName} not found. Try specifying a region. Error: ${error.message}`, { cause: error });
24
24
  }
25
25
  else {
@@ -34,7 +34,7 @@ async function getCloudFormationStackTemplate(stackName, awsConfiguration) {
34
34
  */
35
35
  async function getCloudFormationClient(awsConfiguration) {
36
36
  if (!cloudFormationClient) {
37
- const { CloudFormationClient } = await import("@aws-sdk/client-cloudformation");
37
+ const { CloudFormationClient } = await import('@aws-sdk/client-cloudformation');
38
38
  cloudFormationClient = new CloudFormationClient({
39
39
  region: awsConfiguration.region,
40
40
  credentials: AwsCredentials.getCredentialsProvider(awsConfiguration),
@@ -49,7 +49,7 @@ async function getCloudFormationClient(awsConfiguration) {
49
49
  * @returns
50
50
  */
51
51
  async function getCloudFormationResources(stackName, awsConfiguration) {
52
- const { ListStackResourcesCommand } = await import("@aws-sdk/client-cloudformation");
52
+ const { ListStackResourcesCommand } = await import('@aws-sdk/client-cloudformation');
53
53
  const command = new ListStackResourcesCommand({
54
54
  StackName: stackName,
55
55
  });
@@ -59,7 +59,7 @@ async function getCloudFormationResources(stackName, awsConfiguration) {
59
59
  return response;
60
60
  }
61
61
  catch (error) {
62
- if (error.name === "ValidationError") {
62
+ if (error.name === 'ValidationError') {
63
63
  throw new Error(`Stack ${stackName} not found. Try specifying a region. Error: ${error.message}`, { cause: error });
64
64
  }
65
65
  else {
@@ -75,7 +75,7 @@ async function getCloudFormationResources(stackName, awsConfiguration) {
75
75
  */
76
76
  async function getLambdasInStack(stackName, awsConfiguration) {
77
77
  const response = await getCloudFormationResources(stackName, awsConfiguration);
78
- const lambdaResources = response.StackResourceSummaries?.filter((resource) => resource.ResourceType === "AWS::Lambda::Function");
78
+ const lambdaResources = response.StackResourceSummaries?.filter((resource) => resource.ResourceType === 'AWS::Lambda::Function');
79
79
  return (lambdaResources?.map((resource) => {
80
80
  return {
81
81
  lambdaName: resource.PhysicalResourceId,
@@ -1,4 +1,4 @@
1
- import { LldConfigCliArgs } from "../types/lldConfig.js";
1
+ import { LldConfigCliArgs } from '../types/lldConfig.js';
2
2
  /**
3
3
  * Get configuration from CLI arguments
4
4
  * @param supportedFrameworks Supported frameworks
@@ -1,7 +1,7 @@
1
- import { Command, InvalidOptionArgumentError } from "commander";
2
- import { getVersion } from "../version.mjs";
3
- import { defaultObservableInterval, outputFolder } from "../constants.mjs";
4
- const validRemoveOptions = ["keep-layer", "all"];
1
+ import { Command, InvalidOptionArgumentError } from 'commander';
2
+ import { getVersion } from '../version.mjs';
3
+ import { defaultObservableInterval, outputFolder } from '../constants.mjs';
4
+ const validRemoveOptions = ['keep-layer', 'all'];
5
5
  /**
6
6
  * Get configuration from CLI arguments
7
7
  * @param supportedFrameworks Supported frameworks
@@ -10,31 +10,31 @@ const validRemoveOptions = ["keep-layer", "all"];
10
10
  export async function getConfigFromCliArgs(supportedFrameworks = []) {
11
11
  const version = await getVersion();
12
12
  const program = new Command();
13
- program.name("lld").description("Lambda Live Debugger").version(version);
14
- program.option("-r, --remove [option]", "Remove Lambda Live Debugger infrastructure. Options: 'keep-layer' (default), 'remove-all'. The latest also removes the Lambda Layer");
15
- program.option("-w, --wizard", "Program interactively asks for each parameter and saves it to lldebugger.config.ts");
16
- program.option("-v, --verbose", "Verbose logs");
17
- program.option("-c, --context <context>", "AWS CDK context", (value, previous) => previous.concat(value), []);
18
- program.option("-s, --stage <stage>", "Serverless Framework stage");
19
- program.option("-f, --function <function name>", "Filter by function name. You can use * as a wildcard");
20
- program.option("-m, --subfolder <subfolder>", "Monorepo subfolder");
21
- program.option("-o, --observable", "Observable mode");
22
- program.option("-i --interval <interval>", "Observable mode interval", defaultObservableInterval.toString());
23
- program.option("--config-env <evironment>", "SAM environment");
24
- program.option("--profile <profile>", "AWS profile to use");
25
- program.option("--region <region>", "AWS region to use");
26
- program.option("--role <role>", "AWS role to use");
27
- program.option("--framework <framework>", `Framework to use (${supportedFrameworks.join(", ")})`);
28
- program.option("--gitignore", `Add ${outputFolder} to .gitignore`);
13
+ program.name('lld').description('Lambda Live Debugger').version(version);
14
+ program.option('-r, --remove [option]', "Remove Lambda Live Debugger infrastructure. Options: 'keep-layer' (default), 'remove-all'. The latest also removes the Lambda Layer");
15
+ program.option('-w, --wizard', 'Program interactively asks for each parameter and saves it to lldebugger.config.ts');
16
+ program.option('-v, --verbose', 'Verbose logs');
17
+ program.option('-c, --context <context>', 'AWS CDK context', (value, previous) => previous.concat(value), []);
18
+ program.option('-s, --stage <stage>', 'Serverless Framework stage');
19
+ program.option('-f, --function <function name>', 'Filter by function name. You can use * as a wildcard');
20
+ program.option('-m, --subfolder <subfolder>', 'Monorepo subfolder');
21
+ program.option('-o, --observable', 'Observable mode');
22
+ program.option('-i --interval <interval>', 'Observable mode interval', defaultObservableInterval.toString());
23
+ program.option('--config-env <evironment>', 'SAM environment');
24
+ program.option('--profile <profile>', 'AWS profile to use');
25
+ program.option('--region <region>', 'AWS region to use');
26
+ program.option('--role <role>', 'AWS role to use');
27
+ program.option('--framework <framework>', `Framework to use (${supportedFrameworks.join(', ')})`);
28
+ program.option('--gitignore', `Add ${outputFolder} to .gitignore`);
29
29
  program.parse(process.argv);
30
30
  const args = program.opts();
31
31
  args.interval = parseInt(args.interval);
32
32
  if (args.remove === true) {
33
- args.remove = "keep-layer";
33
+ args.remove = 'keep-layer';
34
34
  }
35
35
  else if (args.remove) {
36
36
  if (!validRemoveOptions.includes(args.remove)) {
37
- throw new InvalidOptionArgumentError(`Invalid option: '${args.remove}'. Valid options are: ${validRemoveOptions.join(", ")}`);
37
+ throw new InvalidOptionArgumentError(`Invalid option: '${args.remove}'. Valid options are: ${validRemoveOptions.join(', ')}`);
38
38
  }
39
39
  }
40
40
  return args;
@@ -1,4 +1,4 @@
1
- import { LldConfigBase } from "../types/lldConfig.js";
1
+ import { LldConfigBase } from '../types/lldConfig.js';
2
2
  /**
3
3
  * Get configuration from ts config file
4
4
  * @param configFile Config file
@@ -1,8 +1,8 @@
1
- import { outputFolder } from "../constants.mjs";
2
- import * as esbuild from "esbuild";
3
- import * as url from "url";
4
- import * as path from "path";
5
- import fs from "fs/promises";
1
+ import { outputFolder } from '../constants.mjs';
2
+ import * as esbuild from 'esbuild';
3
+ import * as url from 'url';
4
+ import * as path from 'path';
5
+ import fs from 'fs/promises';
6
6
  /**
7
7
  * Get configuration from ts config file
8
8
  * @param configFile Config file
@@ -23,17 +23,17 @@ export async function getConfigTsFromConfigFile(configFile) {
23
23
  entryPoints: [configFile],
24
24
  bundle: false,
25
25
  keepNames: true,
26
- platform: "node",
26
+ platform: 'node',
27
27
  metafile: true,
28
- target: "esnext",
29
- format: "esm",
28
+ target: 'esnext',
29
+ format: 'esm',
30
30
  outfile: compileOutput,
31
31
  sourcemap: true,
32
32
  banner: {
33
33
  js: [
34
34
  `import { createRequire as topLevelCreateRequire } from 'module';`,
35
35
  `const require = topLevelCreateRequire(import.meta.url);`,
36
- ].join(""),
36
+ ].join(''),
37
37
  },
38
38
  });
39
39
  }
@@ -1,4 +1,4 @@
1
- import { LldConfigBase, LldConfigCliArgs, LldConfigTs } from "../types/lldConfig.js";
1
+ import { LldConfigBase, LldConfigCliArgs, LldConfigTs } from '../types/lldConfig.js';
2
2
  /**
3
3
  * Get configuration from wizard
4
4
  * @param parameters