Socket
Socket
Sign inDemoInstall

@webtask/optional-compiler-middleware

Package Overview
Dependencies
4
Maintainers
8
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @webtask/optional-compiler-middleware

Webtask middleware that decorates the nodejsCompiler with optional compilation


Version published
Weekly downloads
1
Maintainers
8
Install size
7.56 kB
Created
Weekly downloads
 

Readme

Source

Optional compiler middleware

The optional compiler middleware enables advanced middleware usage such as implementing compilers as middleware or even composable compilers. @webtask/middleware-compiler plays a fundamental role in enabling middleware functions and one of its core assumptions is that the underlying webtask script (located at req.webtaskContext.compiler.script) is a string. It would be convenient to be able to reassign the webtask script to a compiled Function object when implementing a compiler. Unfortunately, this breaks the assumption made by @webtask/middleware-compiler (or even other userspace middleware functions) that it is safe to call nodejsCompiler on req.webtaskContext.compiler.script. This middleware decorates the nodejsCompiler with optional compilation based on the type of the webtask script.

Usage

  1. Set the wt-node-dependencies metadata property to the stringified JSON of an object having @webtask/middleware-compiler and @webtask/optional-compiler-middleware properties whose values are the latest version of the @webtask/middleware-compiler module and this module, respectively.

    {
      "@webtask/middleware-compiler": "1.5.0",
      "@webtask/optional-compiler-middleware": "1.0.0"
    }
    
  2. Set the wt-compiler metadata property on your webtask to @webtask/middleware-compiler.

  3. Set (or add to) the wt-middleware metadata property of your webtask to contain a comma-separated list containing @webtask/optional-compiler-middleware.

  4. Issue requests to your webtask

FAQs

Last updated on 02 Oct 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc