JSPM

module-map-nodejs

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q9646F
  • License MIT

A module map that returns all modules in your folder

Package Exports

  • module-map-nodejs

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (module-map-nodejs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

module map nodejs

Module map lets you discover size, last edited and content of a module. It also shows the dependencies of a module.

Installation

npm install --save module-map-nodejs

Usage

const modules = moduleMap({
  source: "./your-path",
});

Example

const vm = require("vm");
const moduleMap = require("./index");

const modules = moduleMap({
  source: "./test2",
});

for (let [key, value] of Object.entries(modules)) {
  const context = {
    require: () => {},
    module: {
      exports: {},
    },
    ...value.exports,
  };

  vm.createContext(context);
  vm.runInContext(value.content, context);
  console.log(context, "YAY");
}