import-inspector

Wrap dynamic imports with metadata about the import

MIT 4 个版本
安装
npm install import-inspector
yarn add import-inspector
pnpm add import-inspector
bun add import-inspector
README

import-inspector

Wrap dynamic imports with metadata about the import

import {inspect, report} from 'import-inspector';

const stopInspecting = inspect(metadata => {
  console.log(metadata);
});

report(import('./other-module'), { whatever: 42 });
// log: { whatever: 42 }

stopInspecting();

API

inspect(callback)

Add a callback to be called whenever the report() function is called. Receives metadata from report().

Returns a function stopInspecting() that will stop the callback from being called again.

report(promise, metadata)

Wrap an import promise with some metadata to report.

版本列表
2.0.0 2017-06-14
1.1.0 2017-06-14
1.0.1 2017-06-14
1.0.0 2017-06-14