slue-module

2.0.11 • Public • Published

slue-module

A tool of analyse modules relationship.

API

const slueModule = require('slue-module');
let realyData = slueModule(options);

options:

{
    // the file to analyse
    filePath: './test/app.js',

    root: '/',

    prevHandler() {}

    // external global variables
    externals: {
        'react': 'React'
    },

    // when exclude return true, the required module will be ignore
    exclude: function(opts) {
        return opts.moduleId == 'xxx';
    },

    // the ext names of the files which to analyse
    ext: ['.js', '.jsx', '.css', '.less', '.html'],

    // alias make module require shorter
    alias: {
        components: path.join(__dirname, './components')
    }
};

output:

{
    // file path and it's require id
    moduleList: [
        {
            id: 'xxx', // require id
            dir: 'xxx' // file path
        }
    ],

    // all handled files, used file path to be key
    handledFile: {}
};

Package Sidebar

Install

npm i slue-module

Weekly Downloads

5

Version

2.0.11

License

ISC

Unpacked Size

11.6 kB

Total Files

21

Last publish

Collaborators

  • songgenlei