Socket
Socket
Sign inDemoInstall

faas-js-runtime

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

faas-js-runtime - npm Package Compare versions

Comparing version 0.9.5 to 0.9.6

lib/function-loader.js

6

bin/cli.js

@@ -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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc