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.
- package/.prettierrc +3 -1
- package/README.md +31 -33
- package/dist/awsCredentials.d.ts +2 -2
- package/dist/awsCredentials.mjs +1 -1
- package/dist/cloudFormation.d.ts +1 -1
- package/dist/cloudFormation.mjs +7 -7
- package/dist/configuration/getConfigFromCliArgs.d.ts +1 -1
- package/dist/configuration/getConfigFromCliArgs.mjs +22 -22
- package/dist/configuration/getConfigFromTsConfigFile.d.ts +1 -1
- package/dist/configuration/getConfigFromTsConfigFile.mjs +9 -9
- package/dist/configuration/getConfigFromWizard.d.ts +1 -1
- package/dist/configuration/getConfigFromWizard.mjs +91 -78
- package/dist/configuration.d.ts +2 -2
- package/dist/configuration.mjs +15 -15
- package/dist/constants.mjs +2 -2
- package/dist/extension/extension.zip +0 -0
- package/dist/extension/nodejs/node_modules/interceptor.js +764 -255
- package/dist/extension/nodejs/node_modules/interceptor.js.map +4 -4
- package/dist/fileWatcher.mjs +11 -11
- package/dist/frameworks/cdkFramework.d.ts +5 -5
- package/dist/frameworks/cdkFramework.mjs +41 -41
- package/dist/frameworks/cdkFrameworkWorker.mjs +13 -13
- package/dist/frameworks/iFrameworks.d.ts +2 -2
- package/dist/frameworks/samFramework.d.ts +3 -3
- package/dist/frameworks/samFramework.mjs +19 -19
- package/dist/frameworks/slsFramework.d.ts +4 -4
- package/dist/frameworks/slsFramework.mjs +22 -22
- package/dist/frameworks/terraformFramework.d.ts +4 -4
- package/dist/frameworks/terraformFramework.mjs +34 -34
- package/dist/getDirname.mjs +3 -3
- package/dist/gitignore.mjs +11 -11
- package/dist/index.d.ts +8 -8
- package/dist/index.mjs +4 -4
- package/dist/infraDeploy.mjs +39 -39
- package/dist/ioTService.d.ts +6 -6
- package/dist/ioTService.mjs +19 -19
- package/dist/lambdaConnection.mjs +15 -15
- package/dist/lldebugger.mjs +23 -24
- package/dist/logger.d.ts +28 -7
- package/dist/logger.mjs +46 -8
- package/dist/nodeEsBuild.mjs +30 -30
- package/dist/nodeHandler.d.ts +1 -1
- package/dist/nodeHandler.mjs +4 -4
- package/dist/nodeWorker.d.ts +1 -1
- package/dist/nodeWorker.mjs +14 -14
- package/dist/nodeWorkerRunner.mjs +9 -9
- package/dist/resourceDiscovery.d.ts +1 -1
- package/dist/resourceDiscovery.mjs +8 -8
- package/dist/types/lambdaProps.d.ts +1 -1
- package/dist/types/lldConfig.d.ts +4 -4
- package/dist/types/resourcesDiscovery.d.ts +2 -2
- package/dist/utils/findNpmPath.mjs +6 -6
- package/dist/utils/findPackageJson.mjs +6 -6
- package/dist/utils/getRootFolder.mjs +4 -4
- package/dist/utils/removeUndefinedProperties.mjs +1 -1
- package/dist/version.mjs +5 -5
- package/dist/vsCode.mjs +34 -34
- package/eslint.config.js +18 -18
- package/fix-imports.js +13 -13
- package/package.json +4 -2
package/.prettierrc
CHANGED
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
|
|
132
|
+
import { type LldConfigTs } from 'lambda-live-debugger';
|
|
133
133
|
|
|
134
134
|
export default {
|
|
135
|
-
framework:
|
|
136
|
-
context: [
|
|
137
|
-
region:
|
|
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
|
-
|
|
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
|
-
**
|
|
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
|
-
|
|
258
|
+
getLambdas: async (foundLambdas, config) => {
|
|
259
259
|
if (foundLambdas) {
|
|
260
260
|
for (const lambda of foundLambdas) {
|
|
261
|
-
|
|
262
|
-
|
|
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
|
-
|
|
275
|
+
getLambdas: async (foundLambdas, config) => {
|
|
277
276
|
return [
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
331
|
+
- ⭐ Your name here for notable code or documentation contributions, or sample projects submitted with bug reports.
|
|
334
332
|
|
|
335
333
|
## Declarment
|
|
336
334
|
|
package/dist/awsCredentials.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AwsCredentialIdentityProvider } from
|
|
2
|
-
import { AwsConfiguration } from
|
|
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
|
package/dist/awsCredentials.mjs
CHANGED
package/dist/cloudFormation.d.ts
CHANGED
package/dist/cloudFormation.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AwsCredentials } from
|
|
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(
|
|
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 ===
|
|
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(
|
|
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(
|
|
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 ===
|
|
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 ===
|
|
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,7 +1,7 @@
|
|
|
1
|
-
import { Command, InvalidOptionArgumentError } from
|
|
2
|
-
import { getVersion } from
|
|
3
|
-
import { defaultObservableInterval, outputFolder } from
|
|
4
|
-
const validRemoveOptions = [
|
|
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(
|
|
14
|
-
program.option(
|
|
15
|
-
program.option(
|
|
16
|
-
program.option(
|
|
17
|
-
program.option(
|
|
18
|
-
program.option(
|
|
19
|
-
program.option(
|
|
20
|
-
program.option(
|
|
21
|
-
program.option(
|
|
22
|
-
program.option(
|
|
23
|
-
program.option(
|
|
24
|
-
program.option(
|
|
25
|
-
program.option(
|
|
26
|
-
program.option(
|
|
27
|
-
program.option(
|
|
28
|
-
program.option(
|
|
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 =
|
|
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,8 +1,8 @@
|
|
|
1
|
-
import { outputFolder } from
|
|
2
|
-
import * as esbuild from
|
|
3
|
-
import * as url from
|
|
4
|
-
import * as path from
|
|
5
|
-
import fs from
|
|
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:
|
|
26
|
+
platform: 'node',
|
|
27
27
|
metafile: true,
|
|
28
|
-
target:
|
|
29
|
-
format:
|
|
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
|
}
|