New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

@jcbhmr/esmurl

Package Overview
Dependencies
Maintainers
1
Versions
1
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

@jcbhmr/esmurl

🎁 Create a self-contained ESM blob: URL using a function & local import.meta

unpublished
latest
npmnpm
Version
0.1.0
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

🚧 Under construction 👷‍♂️

Bound ESM URLs

🎁 Create a self-contained ESM blob: URL using a function & local import.meta

Installation

npm install @jcbhmr/esmurl

🛑 Currently only Node.js is supported. Check #5 for more details.

Usage

import esmurl from "@jcbhmr/esmurl";

const url = esmurl(import.meta, async () => {
  const url = await import("node:url");
  const { default: isOdd } = await import("is-odd");
  const { hello } = await import("./greetings.js");

  console.log("/ as a file: URL => %s", url.pathToFileURL("/").href);
  console.log(hello("George"));
  console.log("Is 100 odd? %s", isOdd(100));

  return 42;
});

const m = await import(url);
console.log("Return value is exposed as default export: %s", m.default);

Keywords

nodejs

FAQs

Package last updated on 26 Jun 2023

Related posts