lambda-live-debugger 0.0.93 → 0.0.94

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.
Binary file
@@ -21,7 +21,7 @@ export class SlsFramework {
21
21
  const serverlessFiles = [
22
22
  path.resolve("serverless.yml"),
23
23
  path.resolve("serverless.yaml"),
24
- path.resolve("serverless.mjs"),
24
+ path.resolve("serverless.js"),
25
25
  path.resolve("serverless.ts"),
26
26
  path.resolve("serverless.json"),
27
27
  ];
@@ -52,12 +52,10 @@ 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" // hack for avoiding renaming to .mjs by build script
56
- )).default;
55
+ "serverless/lib/cli/resolve-configuration-path.js")).default;
57
56
  readConfiguration = (await import(
58
57
  //@ts-ignore
59
- "serverless/lib/configuration/read." + "js" // hack for avoiding renaming to .mjs by build script
60
- )).default;
58
+ "serverless/lib/configuration/read.js")).default;
61
59
  Serverless = (await import("serverless")).default;
62
60
  }
63
61
  catch (error) {
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { CdkFramework } from "./frameworks/cdkFramework.mjs";
2
- export { SlsFramework } from "./frameworks/slsFramework.mjs";
3
- export { SamFramework } from "./frameworks/samFramework.mjs";
4
- export { TerraformFramework } from "./frameworks/terraformFramework.mjs";
1
+ export { CdkFramework } from "./frameworks/cdkFramework.js";
2
+ export { SlsFramework } from "./frameworks/slsFramework.js";
3
+ export { SamFramework } from "./frameworks/samFramework.js";
4
+ export { TerraformFramework } from "./frameworks/terraformFramework.js";
@@ -20,7 +20,7 @@ async function getBuild(functionId) {
20
20
  let newBuild = false;
21
21
  const func = await Configuration.getLambda(functionId);
22
22
  // if handler is a JavaScript file and not force bundle, just return the file
23
- if ((func.codePath.endsWith(".mjs") ||
23
+ if ((func.codePath.endsWith(".js") ||
24
24
  func.codePath.endsWith(".mjs") ||
25
25
  func.codePath.endsWith(".cjs")) &&
26
26
  !func.forceBundle) {
@@ -53,8 +53,7 @@ async function getBuild(functionId) {
53
53
  if (newBuild) {
54
54
  Logger.verbose(`[Function ${functionId}] Build complete`);
55
55
  }
56
- const artifactFile = Object.keys(result.metafile?.outputs).find((key) => key.endsWith("." + "js") // hack for avoiding renaming to .mjs by build script
57
- );
56
+ const artifactFile = Object.keys(result.metafile?.outputs).find((key) => key.endsWith(".js"));
58
57
  if (!artifactFile) {
59
58
  throw new Error(`Artifact file not found for function ${functionId}`);
60
59
  }
package/fix-imports.js CHANGED
@@ -17,7 +17,15 @@ async function processFiles(directory) {
17
17
  await processFiles(fullPath);
18
18
  } else if (entry.isFile() && entry.name.endsWith(".js")) {
19
19
  const data = await readFile(fullPath, "utf8");
20
- const updatedData = data.replace(/\.js"/g, '.mjs"');
20
+ const updatedData = data
21
+ .split("\n")
22
+ .map((line) => {
23
+ if (line.trim().startsWith("import")) {
24
+ return line.replace(/\.js"/g, '.mjs"');
25
+ }
26
+ return line;
27
+ })
28
+ .join("\n");
21
29
  const { dir, name } = parse(fullPath);
22
30
  const newFullPath = join(dir, `${name}.mjs`);
23
31
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lambda-live-debugger",
3
- "version": "0.0.93",
3
+ "version": "0.0.94",
4
4
  "type": "module",
5
5
  "description": "Debug Lambda functions locally like it is running in the cloud",
6
6
  "repository": {