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
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AwsConfiguration } from
|
|
2
|
-
import { LambdaResource } from
|
|
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?:
|
|
53
|
+
remove?: 'keep-layer' | 'all';
|
|
54
54
|
vscode?: boolean;
|
|
55
55
|
gitignore?: boolean;
|
|
56
56
|
config?: string;
|
|
57
57
|
wizard?: boolean;
|
|
58
|
-
} & Omit<LldConfigBase,
|
|
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
|
|
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,
|
|
18
|
+
export type EsBuildOptions = Omit<BuildOptions, 'outfile' | 'outdir' | 'outbase' | 'write' | 'allowOverwrite' | 'sourcemap' | 'keepnames' | 'entryPoints' | 'stdin'>;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import fs from
|
|
2
|
-
import path from
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
|
2
|
-
import * as fs from
|
|
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,
|
|
10
|
+
const packageJsonRoot = await findAboveFolderWithAFile(handlerParsedPath.dir, 'package.json');
|
|
11
11
|
const packageJsonPath = packageJsonRoot
|
|
12
|
-
? path.resolve(path.join(packageJsonRoot,
|
|
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,
|
|
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
|
package/dist/version.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as fs from
|
|
2
|
-
import * as path from
|
|
3
|
-
import { getModuleDirname } from
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import { getModuleDirname } from './getDirname.mjs';
|
|
4
4
|
let versionStored = undefined;
|
|
5
5
|
/**
|
|
6
6
|
* Get the version of the package
|
|
@@ -10,9 +10,9 @@ export async function getVersion() {
|
|
|
10
10
|
if (versionStored) {
|
|
11
11
|
return versionStored;
|
|
12
12
|
}
|
|
13
|
-
const pachageJsonPath = path.join(getModuleDirname(),
|
|
13
|
+
const pachageJsonPath = path.join(getModuleDirname(), '../', 'package.json');
|
|
14
14
|
try {
|
|
15
|
-
const packageJson = await fs.promises.readFile(pachageJsonPath,
|
|
15
|
+
const packageJson = await fs.promises.readFile(pachageJsonPath, 'utf-8');
|
|
16
16
|
const { version } = JSON.parse(packageJson);
|
|
17
17
|
versionStored = version;
|
|
18
18
|
return version;
|
package/dist/vsCode.mjs
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import fs from
|
|
2
|
-
import path from
|
|
3
|
-
import { parse, printParseErrorCode, applyEdits, modify, } from
|
|
4
|
-
import { getModuleDirname, getProjectDirname } from
|
|
5
|
-
import { Logger } from
|
|
1
|
+
import fs from 'fs/promises';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { parse, printParseErrorCode, applyEdits, modify, } from 'jsonc-parser';
|
|
4
|
+
import { getModuleDirname, getProjectDirname } from './getDirname.mjs';
|
|
5
|
+
import { Logger } from './logger.mjs';
|
|
6
6
|
async function getVsCodeLaunchConfig() {
|
|
7
|
-
const localRuntimeExecutable =
|
|
7
|
+
const localRuntimeExecutable = '${workspaceFolder}/node_modules/.bin/lld';
|
|
8
8
|
const config = {
|
|
9
|
-
version:
|
|
9
|
+
version: '0.2.0',
|
|
10
10
|
configurations: [
|
|
11
11
|
{
|
|
12
|
-
name:
|
|
13
|
-
type:
|
|
14
|
-
request:
|
|
12
|
+
name: 'Lambda Live Debugger',
|
|
13
|
+
type: 'node',
|
|
14
|
+
request: 'launch',
|
|
15
15
|
runtimeExecutable: localRuntimeExecutable,
|
|
16
16
|
runtimeArgs: [],
|
|
17
|
-
console:
|
|
18
|
-
skipFiles: [
|
|
17
|
+
console: 'integratedTerminal',
|
|
18
|
+
skipFiles: ['<node_internals>/**'],
|
|
19
19
|
env: {},
|
|
20
20
|
},
|
|
21
21
|
],
|
|
@@ -24,14 +24,14 @@ async function getVsCodeLaunchConfig() {
|
|
|
24
24
|
//Logger.log("Module folder", moduleDirname);
|
|
25
25
|
const projectDirname = getProjectDirname();
|
|
26
26
|
//Logger.log("Current folder", currentFolder);
|
|
27
|
-
const localFolder = path.resolve(path.join(projectDirname,
|
|
27
|
+
const localFolder = path.resolve(path.join(projectDirname, 'node_modules/.bin/lld'));
|
|
28
28
|
let runtimeExecutableSet = false;
|
|
29
29
|
//if installed locally
|
|
30
|
-
if (moduleDirname.startsWith(
|
|
31
|
-
Logger.verbose(
|
|
30
|
+
if (moduleDirname.startsWith('/home/')) {
|
|
31
|
+
Logger.verbose('Lambda Live Debugger is installed locally');
|
|
32
32
|
// check if file exists
|
|
33
33
|
try {
|
|
34
|
-
Logger.log(
|
|
34
|
+
Logger.log('Checking local folder for runtimeExecutable setting for VsCode configuration', localFolder);
|
|
35
35
|
await fs.access(localFolder, fs.constants.F_OK);
|
|
36
36
|
config.configurations[0].runtimeExecutable = localRuntimeExecutable;
|
|
37
37
|
runtimeExecutableSet = true;
|
|
@@ -42,16 +42,16 @@ async function getVsCodeLaunchConfig() {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
else {
|
|
45
|
-
Logger.verbose(
|
|
45
|
+
Logger.verbose('Lambda Live Debugger is installed globally');
|
|
46
46
|
}
|
|
47
47
|
if (!runtimeExecutableSet) {
|
|
48
48
|
Logger.verbose(`Setting absolute path for runtimeExecutable setting for VsCode configuration`);
|
|
49
|
-
const localFolderSubfolder = path.resolve(
|
|
50
|
-
const globalModule1 = path.join(moduleDirname,
|
|
51
|
-
const globalModule2 = path.join(moduleDirname,
|
|
52
|
-
const globalModule3 = path.join(moduleDirname,
|
|
49
|
+
const localFolderSubfolder = path.resolve('node_modules/.bin/lld');
|
|
50
|
+
const globalModule1 = path.join(moduleDirname, '..', '..', '.bin/lld');
|
|
51
|
+
const globalModule2 = path.join(moduleDirname, '..', '..', 'bin/lld');
|
|
52
|
+
const globalModule3 = path.join(moduleDirname, '..', '..', '..', '..', 'bin/lld');
|
|
53
53
|
const possibleFolders = {
|
|
54
|
-
[localFolder]:
|
|
54
|
+
[localFolder]: '${workspaceFolder}/node_modules/.bin/lld',
|
|
55
55
|
[localFolderSubfolder]: localFolderSubfolder,
|
|
56
56
|
[globalModule1]: globalModule1,
|
|
57
57
|
[globalModule2]: globalModule2,
|
|
@@ -80,7 +80,7 @@ async function getVsCodeLaunchConfig() {
|
|
|
80
80
|
}
|
|
81
81
|
async function readLaunchJson(filePath) {
|
|
82
82
|
try {
|
|
83
|
-
const jsonString = await fs.readFile(filePath,
|
|
83
|
+
const jsonString = await fs.readFile(filePath, 'utf-8');
|
|
84
84
|
const errors = [];
|
|
85
85
|
const json = parse(jsonString, errors, {
|
|
86
86
|
allowTrailingComma: true,
|
|
@@ -107,13 +107,13 @@ async function writeConfiguration(filePath, jsonString, changes, position) {
|
|
|
107
107
|
tabSize: 2,
|
|
108
108
|
};
|
|
109
109
|
// Apply changes to the original JSON string
|
|
110
|
-
const edits = modify(jsonString, [
|
|
110
|
+
const edits = modify(jsonString, ['configurations', position], changes, {
|
|
111
111
|
formattingOptions,
|
|
112
112
|
});
|
|
113
113
|
const modifiedJsonString = applyEdits(jsonString, edits);
|
|
114
114
|
// Write the modified JSON string back to the file
|
|
115
115
|
Logger.verbose(`Adding to VsCode configuration file: ${filePath}`);
|
|
116
|
-
await fs.writeFile(filePath, modifiedJsonString,
|
|
116
|
+
await fs.writeFile(filePath, modifiedJsonString, 'utf-8');
|
|
117
117
|
}
|
|
118
118
|
catch (err) {
|
|
119
119
|
Logger.error(`Error writing the file: ${err}`);
|
|
@@ -121,7 +121,7 @@ async function writeConfiguration(filePath, jsonString, changes, position) {
|
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
async function getCurrentState() {
|
|
124
|
-
const filePath = path.join(getProjectDirname(),
|
|
124
|
+
const filePath = path.join(getProjectDirname(), '.vscode/launch.json');
|
|
125
125
|
let createNewFile = false;
|
|
126
126
|
// does file exist
|
|
127
127
|
try {
|
|
@@ -141,7 +141,7 @@ async function getCurrentState() {
|
|
|
141
141
|
if (!exists) {
|
|
142
142
|
Logger.verbose(`${filePath} exists but configuration does not exist!`);
|
|
143
143
|
return {
|
|
144
|
-
state:
|
|
144
|
+
state: 'FILE_EXISTS_CONFIGURATION_DOES_NOT_EXIST',
|
|
145
145
|
jsonString,
|
|
146
146
|
configurationsLength: existingConfig.configurations?.length || 0,
|
|
147
147
|
filePath,
|
|
@@ -150,38 +150,38 @@ async function getCurrentState() {
|
|
|
150
150
|
else {
|
|
151
151
|
Logger.verbose(`Configuration already exists in ${filePath}`);
|
|
152
152
|
return {
|
|
153
|
-
state:
|
|
153
|
+
state: 'FILE_EXISTS_CONFIGURATION_EXISTS',
|
|
154
154
|
};
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
else {
|
|
158
158
|
Logger.verbose(`${filePath} does not exist!`);
|
|
159
159
|
return {
|
|
160
|
-
state:
|
|
160
|
+
state: 'FILE_DOES_NOT_EXIST',
|
|
161
161
|
filePath,
|
|
162
162
|
};
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
165
|
async function isConfigured() {
|
|
166
166
|
const state = await getCurrentState();
|
|
167
|
-
if (state.state ===
|
|
167
|
+
if (state.state === 'FILE_EXISTS_CONFIGURATION_EXISTS') {
|
|
168
168
|
return true;
|
|
169
169
|
}
|
|
170
170
|
return false;
|
|
171
171
|
}
|
|
172
172
|
async function addConfiguration() {
|
|
173
|
-
Logger.log(
|
|
173
|
+
Logger.log('Adding configuration to .vscode/launch.json');
|
|
174
174
|
const state = await getCurrentState();
|
|
175
175
|
const config = await getVsCodeLaunchConfig();
|
|
176
|
-
if (state.state ===
|
|
176
|
+
if (state.state === 'FILE_EXISTS_CONFIGURATION_DOES_NOT_EXIST') {
|
|
177
177
|
const { jsonString, filePath, configurationsLength } = state;
|
|
178
178
|
await writeConfiguration(filePath, jsonString, config.configurations[0], configurationsLength);
|
|
179
179
|
}
|
|
180
|
-
else if (state.state ===
|
|
180
|
+
else if (state.state === 'FILE_DOES_NOT_EXIST') {
|
|
181
181
|
// crete folder of filePath recursive if not exists
|
|
182
182
|
await fs.mkdir(path.dirname(state.filePath), { recursive: true });
|
|
183
183
|
Logger.verbose(`Creating VsCode configuration file: ${state.filePath}`);
|
|
184
|
-
await fs.writeFile(state.filePath, JSON.stringify(config, null, 2),
|
|
184
|
+
await fs.writeFile(state.filePath, JSON.stringify(config, null, 2), 'utf-8');
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
export const VsCode = {
|
package/eslint.config.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import globals from
|
|
2
|
-
import pluginJs from
|
|
3
|
-
import tseslint from
|
|
4
|
-
import pluginPrettier from
|
|
5
|
-
import prettierConfig from
|
|
1
|
+
import globals from 'globals';
|
|
2
|
+
import pluginJs from '@eslint/js';
|
|
3
|
+
import tseslint from 'typescript-eslint';
|
|
4
|
+
import pluginPrettier from 'eslint-plugin-prettier';
|
|
5
|
+
import prettierConfig from 'eslint-config-prettier';
|
|
6
6
|
|
|
7
7
|
export default [
|
|
8
|
-
{ files: [
|
|
8
|
+
{ files: ['**/*.{js,mjs,cjs,ts}'] },
|
|
9
9
|
{
|
|
10
10
|
ignores: [
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
'**/dist/**',
|
|
12
|
+
'**/cdk.out/**',
|
|
13
|
+
'**/.lldebugger/**',
|
|
14
|
+
'**/.serverless/**',
|
|
15
|
+
'**/.aws-sam/**',
|
|
16
|
+
'src/extension/aws/*.js',
|
|
17
17
|
],
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
20
|
languageOptions: {
|
|
21
21
|
globals: globals.node,
|
|
22
|
-
parser:
|
|
22
|
+
parser: '@typescript-eslint/parser',
|
|
23
23
|
parserOptions: {
|
|
24
|
-
project:
|
|
24
|
+
project: './tsconfig.json',
|
|
25
25
|
},
|
|
26
26
|
},
|
|
27
27
|
},
|
|
@@ -33,10 +33,10 @@ export default [
|
|
|
33
33
|
},
|
|
34
34
|
rules: {
|
|
35
35
|
...pluginPrettier.configs.recommended.rules,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
'@typescript-eslint/no-floating-promises': 'error',
|
|
37
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
38
|
+
'@typescript-eslint/no-require-imports': 'off',
|
|
39
|
+
'@typescript-eslint/ban-ts-comment': 'off',
|
|
40
40
|
},
|
|
41
41
|
},
|
|
42
42
|
prettierConfig,
|
package/fix-imports.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { readdir, readFile, writeFile, rename } from
|
|
2
|
-
import { join, dirname, parse } from
|
|
3
|
-
import { fileURLToPath } from
|
|
1
|
+
import { readdir, readFile, writeFile, rename } from 'fs/promises';
|
|
2
|
+
import { join, dirname, parse } from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
4
|
|
|
5
5
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
6
6
|
|
|
@@ -15,32 +15,32 @@ async function processFiles(directory) {
|
|
|
15
15
|
const fullPath = join(directory, entry.name);
|
|
16
16
|
if (entry.isDirectory()) {
|
|
17
17
|
await processFiles(fullPath);
|
|
18
|
-
} else if (entry.isFile() && entry.name.endsWith(
|
|
19
|
-
const data = await readFile(fullPath,
|
|
18
|
+
} else if (entry.isFile() && entry.name.endsWith('.js')) {
|
|
19
|
+
const data = await readFile(fullPath, 'utf8');
|
|
20
20
|
const updatedData = data
|
|
21
|
-
.split(
|
|
21
|
+
.split('\n')
|
|
22
22
|
.map((line) => {
|
|
23
|
-
if (line.trim().startsWith(
|
|
24
|
-
return line.replace(/\.js"/g, '.mjs"');
|
|
23
|
+
if (line.trim().startsWith('import')) {
|
|
24
|
+
return line.replace(/\.js"/g, '.mjs"').replace(/\.js'/g, ".mjs'");
|
|
25
25
|
}
|
|
26
26
|
return line;
|
|
27
27
|
})
|
|
28
|
-
.join(
|
|
28
|
+
.join('\n');
|
|
29
29
|
const { dir, name } = parse(fullPath);
|
|
30
30
|
const newFullPath = join(dir, `${name}.mjs`);
|
|
31
31
|
|
|
32
|
-
await writeFile(fullPath, updatedData,
|
|
32
|
+
await writeFile(fullPath, updatedData, 'utf8');
|
|
33
33
|
await rename(fullPath, newFullPath);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
const directoryPath = join(__dirname,
|
|
38
|
+
const directoryPath = join(__dirname, 'dist');
|
|
39
39
|
|
|
40
40
|
processFiles(directoryPath)
|
|
41
41
|
.then(() =>
|
|
42
42
|
console.log(
|
|
43
|
-
|
|
43
|
+
'JS files have been converted to MJS and import paths updated.',
|
|
44
44
|
),
|
|
45
45
|
)
|
|
46
|
-
.catch((err) => console.error(
|
|
46
|
+
.catch((err) => console.error('Error processing files:', err));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lambda-live-debugger",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.115",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Debug Lambda functions locally like it is running in the cloud",
|
|
6
6
|
"repository": {
|
|
@@ -91,6 +91,7 @@
|
|
|
91
91
|
"@aws-sdk/client-s3": "^3.577.0",
|
|
92
92
|
"@aws-sdk/credential-providers": "^3.577.0",
|
|
93
93
|
"aws-iot-device-sdk": "^2.2.13",
|
|
94
|
+
"chalk": "^5.3.0",
|
|
94
95
|
"chokidar": "^3.6.0",
|
|
95
96
|
"commander": "^12.0.0",
|
|
96
97
|
"esbuild": "^0.20.1",
|
|
@@ -117,7 +118,8 @@
|
|
|
117
118
|
"yaml",
|
|
118
119
|
"typescript",
|
|
119
120
|
"inquirer",
|
|
120
|
-
"jsonc-parser"
|
|
121
|
+
"jsonc-parser",
|
|
122
|
+
"chalk"
|
|
121
123
|
],
|
|
122
124
|
"workspaces": [
|
|
123
125
|
"src/extension/*",
|