imports_resolver
TypeScript icon, indicating that this package has built-in type declarations

0.0.8 • Public • Published

Imports resolver

JS library to parse sources and gather used imports and load it from certain source

It uses esprima-next to build list of used imports

npm install --save imports_resolver

then usage ImportResolver:

import {ImportResolver} from 'imports_resolver'

const resolver = new ImportResolver({
    baseUrl : 'some_your_endpoint',
    handler : (module, content) => {
        ...
        some code to process downloaded content
        ...
    }
});
resolver.resolveDependencies(`
    import {lib} from 'lib';
    
    const result = lib.do();
`);

then usage FileProcessor:

import {FileProcessor} from "imports_resolver";

const processor = new FileProcessor();

const imports = processor.process(`
    import {lib} from 'lib';
    
    const result = lib.do();
`);

imports.forEach(importStmt => {
    console.log(importStmt);
})

Package Sidebar

Install

npm i imports_resolver

Weekly Downloads

0

Version

0.0.8

License

MIT

Unpacked Size

608 kB

Total Files

10

Last publish

Collaborators

  • bostandyksoft