1.0.18 • Published 2 years ago
useless-code-killer v1.0.18
useless-code-killer
npm install useless-code-killer
Start
const path = require('path');
const { UselessCodeKiller } = require('useless-code-killer');
const killer = new UselessCodeKiller({
// your project path
dir: path.resolve(__dirname, './'),
// Ignore node_modules or others
excludes: ['node_modules'],
// includes file type
includes: ['.ts', '.tsx', '.js', '.jsx'],
alias: {
'alias': path.resolve(__dirname, './example/alias-test')
},
// some special file loader
loader: [],
// Output a json
outputDir: path.resolve(__dirname, './result.json'),
// static
retry: false
});
Loader
Loader must be a function like this:
const yourLoader = ({ memo, parse, fileCode }) => {
/**
* @memo
* @memo._import { from:string }:[]
* @memo._export { type:string }:[]
* @memo._url: string
*/
/**
* @parse
* goto: https://www.npmjs.com/package/@babel/parser
*/
/**
* @fileCode { string }
*/
const newMemo = {
_import: [],
_export: [],
};
return {
...memo,
...newMemo
};
};
module.exports = yourLoader;
1.0.18
2 years ago
1.0.17
2 years ago
1.0.16
2 years ago
1.0.15
2 years ago
1.0.14
2 years ago
1.0.13
2 years ago
1.0.12
2 years ago
1.0.11
2 years ago
1.0.10
2 years ago
1.0.9
2 years ago
1.0.8
2 years ago
1.0.7
2 years ago
1.0.6
2 years ago
1.0.5
2 years ago
1.0.4
2 years ago
1.0.3
2 years ago
1.0.2
2 years ago
1.0.1
2 years ago
1.0.0-alpha-4
2 years ago
1.0.0-alpha-3
2 years ago
1.0.0-alpha-2
2 years ago
1.0.0-alpha-1
2 years ago
1.0.0-alpha
2 years ago
1.0.0
2 years ago