@jim-brighter/lambda-local-runner 0.0.1 → 0.1.0

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 (2) hide show
  1. package/index.js +5 -1
  2. package/package.json +7 -2
package/index.js CHANGED
@@ -1,12 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { createServer } from 'node:http';
4
+ import { createJiti } from 'jiti';
5
+
6
+ const jiti = createJiti(import.meta.url);
4
7
 
5
8
  const port = process.env.PORT ?? 3000;
6
9
 
7
10
  const handlerFile = process.argv[2];
8
11
  const handlerFunc = process.argv[3] || 'handler';
9
- const handlerModule = await import(`${process.cwd()}/${handlerFile}`);
12
+
13
+ const handlerModule = await jiti.import(`${process.cwd()}/${handlerFile}`);
10
14
  const handler = handlerModule[handlerFunc];
11
15
 
12
16
  const server = createServer(async (req, res) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jim-brighter/lambda-local-runner",
3
- "version": "0.0.1",
3
+ "version": "0.1.0",
4
4
  "description": "Simple CLI tool to run a lambda handler locally",
5
5
  "homepage": "https://github.com/jim-brighter/lambda-local-runner#readme",
6
6
  "bugs": {
@@ -19,9 +19,14 @@
19
19
  },
20
20
  "files": [
21
21
  "index.js",
22
+ "package.json",
22
23
  "README.md"
23
24
  ],
24
25
  "scripts": {
25
- "test": "echo \"Error: no test specified\" && exit 1"
26
+ "test": "echo \"Error: no test specified\" && exit 1",
27
+ "pub": "npm publish --access public"
28
+ },
29
+ "dependencies": {
30
+ "jiti": "^2.7.0"
26
31
  }
27
32
  }