/nedo

a commonJS hook to load modules from url at runtime.

Primary LanguageJavaScriptMIT LicenseMIT

NEDO

Node CommonJS require enhancer, could load module from url or ts at runtime ...

Build Status code style: prettier

[English doc] [中文文档]

USAGE

  • load module from url
const r = require("nedo");

const res = r(
  "https://raw.githubusercontent.com/loatheb/nedo/master/__test/case/code.js"
);
console.log(res); // hello code.js
  • load module from ts file
const r = require("nedo");

const res = r("./code.ts");
console.log(res); // hello code.ts
  • top level await
// index.js
const r = require("nedo");

r("./code.js");


// code.js: you don't need wrap await into async a function...
await doSomeAsyncThings();

TESTCASE

you can touch the testcase __test/index.js for much more detail.

https://github.com/loatheb/nedo/blob/master/screenshot/testcase.jpg

LICENSE

MIT