Skip to content

Wrap dynamic imports with metadata about the import

License

Notifications You must be signed in to change notification settings

jamiebuilds/import-inspector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Wrap dynamic imports with metadata about the import

Resources

License

Stars

Watchers

Forks

Packages

No packages published