Gathering detailed insights and metrics for esm-loader
Gathering detailed insights and metrics for esm-loader
Gathering detailed insights and metrics for esm-loader
Gathering detailed insights and metrics for esm-loader
Offers Cross Environment Context ESM Loading even from Strings is a Loader Construction Framework for Userland http import in nodejs supports remote url including node-resolve via rollup
npm install esm-loader
Typescript
Module System
Node Version
NPM Version
68.4
Supply Chain
98
Quality
75.1
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
30,651
Last Day
1
Last Week
339
Last Month
1,241
Last Year
16,524
Apache-2.0 License
6 Stars
23 Commits
2 Forks
3 Watchers
1 Branches
4 Contributors
Updated on May 20, 2023
Minified
Minified + Gzipped
Latest Version
0.1.0
Package Id
esm-loader@0.1.0
Unpacked Size
19.11 kB
Size
7.10 kB
File Count
7
NPM Version
6.13.1
Node Version
13.2.0
Cumulative downloads
Total Downloads
Last Day
-97.9%
1
Compared to previous day
Last Week
14.9%
339
Compared to previous week
Last Month
2.6%
1,241
Compared to previous month
Last Year
88.3%
16,524
Compared to previous year
No dependencies detected.
Allows to load esm from any file formart can be seen as loader construction kit while offering precoded methods to do generic loader stuff in cross environment applications. It also can be seen as Pollyfill for importScript and dynamic import from url for NodeJS.
breaking change is deprecating strToESM its successor is ESMLoader and moduleString
Host a local or remote server with scripts or use https://unpkg directly inside nodeJS via "esm-loader" The Steps to form a Module Instance with livebindings!
String to ESModule Examples Cross Environment
1import { ESMLoader } from 'esm-loader/loader.mjs' 2 3const module = ESMLoader('export const myModule = { yellow: \'snowflakes\'}') 4 .then(({ myModule })=>console.log(myModule.yellow)) // Logs: snowflakes
1import { moduleString } from 'esm-loader/loader.mjs' 2 3const module = import(moduleString('export const myModule = { yellow: \'snowflakes\'}')) 4 .then(({ myModule })=>console.log(myModule.yellow)) // Logs: snowflakes
ESMLoader used inside NodeJS supports NodeJS Module Resolve but not relative resolve you can support it via a transformation step after loading your code you can simply replace any ./ ../ urls with correct resolved values relative to your current loaded module or the module loading path of the scipt you plan to instantiate and evaluate to ESM via ESMLoader.
ESMLoader ships with a example method to get code from a remote file via a isomorpic fetch This allows to use import with dynamic content.
1// The exported fetch is cross environment Nodejs and Browser 2import { ESMLoader, fetch ,fetchImport, dynamicImport } from 'esm-loader/loader.mjs' 3 4// Creates a dynamic import from a string 5// Returns a ESM Module with exports from string has resovle for Bare and Absolut Specifiers 6// can easy be rewritten for your own extensions 7fetchImport('url') //is a shortHand helper for fetch('https://url.to/your/js.mjs').then(ESMLoader) 8 .then(mod=>console.log(mod)) 9 10dynamicImport('url') // uses import in the browser and fetchImport in nodejs
CJS
1const fs = require('fs') 2//ESM-LOADER is ES so you need to use dynamic import 3import('esm-loader/esm-loader.mjs') // NodeJS Resolve used here 4 .then(({ ESMLoader })=>fs.promises.readFile('path/to/file.txt,ts,any').then(ESMLoader)) // NodeJS Resolve used here 5 //no relativ urls can use transformations befor then(ESMLoader) 6 .then(myModule=>console.log(myModule)) //=> returns a real ESModule
1import { ESMLoader, dynamicImport } from 'esm-loader/loader.mjs' 2 3// Creates a dynamic import from a string 4 5// can easy be rewritten for your own extensions 6fetch('https://url.to/your/js.mjs') 7 .then(ESMLoader) 8 /** 9 * Returns a ESM Module with exports from string 10 * has resolve for Bare and Absolut Specifiers 11 * Your Can Easy rewrite the String that you get from 12 * fetch befor you use it as input to ESMLoader. 13 */ 14 .then(mod=>console.log(mod)) 15 16dynamicImport('url') // uses import in the browser and fetchImport in nodejs
https://github.com/rollup/plugins/pull/150
Lets Import a mjs file from a source and rewrite it to resolve to the right locations if relativ specifiers are used
1// TODO:
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 0/21 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More