Socket
Book a DemoInstallSign in
Socket

flow-node-esm

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

flow-node-esm

flow-node with ESM support

0.3.0
unpublished
latest
npmnpm
Version published
Maintainers
1
Created
Source

flow-node-esm

Like flow-node, but supports .mjs/ES modules.

flow-node-esm ./script-with-flow-types.mjs

Requirements:

  • Node v16 LTS
  • bash

Notes

It's built using the experimental ESM loaders API and has only been tested to work in Node v16 LTS.

Due to a limitation of the loaders API, CommonJS modules cannot be transformed: you can import CJS files, but Flow types won't be stripped from them. However, you can still use Flow's comment syntax to add type annotations in these files.

flow-node-esm can only be used for executing a file; a REPL is not implemented. Only one option is currently supported: -s will strip Flow types using Sucrase instead of flow-remove-types. Sucrase is faster, but you may prefer sticking with the official parser if you're not worried about performance. (How much faster Sucrase is in your case is up to you to measure.)

The loader code here is based on the CoffeeScript loader example by Geoffrey Booth and contributors, with some modifications. Thanks for the helpful example!

Keywords

flow

FAQs

Package last updated on 07 Jul 2022

Did you know?

Socket

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.