1.0.6 • Published 10 months ago

@nodescript/module-loader v1.0.6

Weekly downloads
-
License
ISC
Repository
github
Last release
10 months ago

Module Loader

This module loader allows loading ESM modules from HTTP and data: URLs.

A brief chart of what is allowed to import what:

flowchart LR
    http(Http URL)
    data(Data URL)
    file(File URL)
    relative(Relative URL)
    node_modules(node_modules)
    builtins(Node.js builtins)

    http --> http
    http --> data
    http --> relative

    data --> http
    data --> data

    file --> file
    file --> http
    file --> data
    file --> node_modules
    file --> builtins
    file --> relative
  • file: modules can import:

    • other file: modules
    • http: modules
    • data: modules
    • node_modules modules
    • Node.js builtins
    • relative URLs (e.g. ./foo.js)
  • http: modules can import:

    • other http: modules
    • data: modules
    • relative URLs (e.g. ./foo.js)
  • data: modules can import:

    • other data: modules
    • http: modules

Usage

Via Node.js CLI:

node --import @nodescript/module-loader/register ./entrypoint.js

Or in mocharc.json:

{
    "require": [
        "@nodescript/module-loader/register"
    ]
}
1.0.6

10 months ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago