faas-js-runtime
Advanced tools
Comparing version 0.9.5 to 0.9.6
@@ -5,2 +5,3 @@ #!/usr/bin/env node | ||
const { start, defaults } = require('../'); | ||
const { loadFunction } = require('../lib/function-loader.js'); | ||
const pkg = require('../package.json'); | ||
@@ -24,3 +25,3 @@ | ||
const programOpts = program.opts(); | ||
try { | ||
@@ -34,3 +35,4 @@ let server; | ||
const filePath = extractFullPath(file); | ||
const code = require(filePath); | ||
const code = await loadFunction(filePath); | ||
if (typeof code === 'function') { | ||
@@ -37,0 +39,0 @@ server = await start(code, options); |
{ | ||
"name": "faas-js-runtime", | ||
"version": "0.9.5", | ||
"version": "0.9.6", | ||
"repository": { | ||
@@ -5,0 +5,0 @@ "type": "git", |
@@ -101,2 +101,24 @@ # Node.js Function Framework | ||
### Functions as ES Modules | ||
Functions can be written and imported as ES modules with either the `.mjs` file extenstion or by adding the `type` property to the functions package.json and setting it to `module`. | ||
```js | ||
// index.mjs | ||
const handle = async function(context) => { ... }; | ||
// Export the function | ||
export { handle }; | ||
``` | ||
If using the `type` property, the package.json might look something like this: | ||
```js | ||
{ | ||
"name": "moduleName", | ||
"type": "module" | ||
} | ||
``` | ||
## Usage as a Module | ||
@@ -103,0 +125,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41991
15
664
191
18
1