rev-dep 1.5.4 → 2.0.0-alpha-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Readme.md +5 -0
- package/bin.js +66 -1
- package/package.json +6 -49
- package/README.md +0 -558
- package/babel.js +0 -1
- package/dist/babel/babelParsingOptions.d.ts +0 -5
- package/dist/babel/babelParsingOptions.js +0 -15
- package/dist/babel/groupBy.d.ts +0 -1
- package/dist/babel/groupBy.js +0 -14
- package/dist/babel/index.d.ts +0 -1
- package/dist/babel/index.js +0 -449
- package/dist/babel/processCodeTextModificationsArray.d.ts +0 -30
- package/dist/babel/processCodeTextModificationsArray.js +0 -55
- package/dist/babel/template.d.ts +0 -1
- package/dist/babel/template.js +0 -13
- package/dist/babel/transform.d.ts +0 -6
- package/dist/babel/transform.js +0 -66
- package/dist/babel/transformCli.d.ts +0 -1
- package/dist/babel/transformCli.js +0 -18
- package/dist/cli/commonOptions.d.ts +0 -27
- package/dist/cli/commonOptions.js +0 -29
- package/dist/cli/createCommands.d.ts +0 -2
- package/dist/cli/createCommands.js +0 -19
- package/dist/cli/docs/generate.d.ts +0 -20
- package/dist/cli/docs/generate.js +0 -90
- package/dist/cli/docs/index.d.ts +0 -3
- package/dist/cli/docs/index.js +0 -18
- package/dist/cli/docs/template.d.ts +0 -3
- package/dist/cli/docs/template.js +0 -51
- package/dist/cli/entryPoints/index.d.ts +0 -2
- package/dist/cli/entryPoints/index.js +0 -52
- package/dist/cli/entryPoints/types.d.ts +0 -4
- package/dist/cli/entryPoints/types.js +0 -2
- package/dist/cli/files/index.d.ts +0 -2
- package/dist/cli/files/index.js +0 -36
- package/dist/cli/files/types.d.ts +0 -3
- package/dist/cli/files/types.js +0 -2
- package/dist/cli/index.d.ts +0 -1
- package/dist/cli/index.js +0 -10
- package/dist/cli/nodeModules/index.d.ts +0 -2
- package/dist/cli/nodeModules/index.js +0 -36
- package/dist/cli/nodeModules/types.d.ts +0 -3
- package/dist/cli/nodeModules/types.js +0 -2
- package/dist/cli/resolve/formatResults.d.ts +0 -9
- package/dist/cli/resolve/formatResults.js +0 -67
- package/dist/cli/resolve/index.d.ts +0 -2
- package/dist/cli/resolve/index.js +0 -47
- package/dist/cli/resolve/types.d.ts +0 -11
- package/dist/cli/resolve/types.js +0 -2
- package/dist/lib/buildDepsGraph.d.ts +0 -2
- package/dist/lib/buildDepsGraph.js +0 -49
- package/dist/lib/cleanupDpdmDeps.d.ts +0 -3
- package/dist/lib/cleanupDpdmDeps.js +0 -39
- package/dist/lib/getDepsSetWebpack.d.ts +0 -6
- package/dist/lib/getDepsSetWebpack.js +0 -44
- package/dist/lib/getDepsTree.d.ts +0 -1
- package/dist/lib/getDepsTree.js +0 -24
- package/dist/lib/getEntryPoints.d.ts +0 -18
- package/dist/lib/getEntryPoints.js +0 -83
- package/dist/lib/getFilesForEntryPoint.d.ts +0 -8
- package/dist/lib/getFilesForEntryPoint.js +0 -12
- package/dist/lib/getMaxDepthInGraph.d.ts +0 -4
- package/dist/lib/getMaxDepthInGraph.js +0 -21
- package/dist/lib/getNodeModulesForEntryPoint.d.ts +0 -8
- package/dist/lib/getNodeModulesForEntryPoint.js +0 -18
- package/dist/lib/resolve.d.ts +0 -15
- package/dist/lib/resolve.js +0 -60
- package/dist/lib/types.d.ts +0 -12
- package/dist/lib/types.js +0 -2
- package/dist/lib/utils.d.ts +0 -6
- package/dist/lib/utils.js +0 -44
- package/dist/module.d.ts +0 -5
- package/dist/module.js +0 -28
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const rootPath = process.argv[2];
|
|
4
|
-
const inputFilePath = process.argv[3];
|
|
5
|
-
const transform_1 = require("./transform");
|
|
6
|
-
if (!rootPath) {
|
|
7
|
-
console.error('Please provide correct transformation root');
|
|
8
|
-
process.exit(1);
|
|
9
|
-
}
|
|
10
|
-
const run = async () => {
|
|
11
|
-
const startTime = new Date().getTime();
|
|
12
|
-
await (0, transform_1.transform)({
|
|
13
|
-
rootPath,
|
|
14
|
-
inputFilePath
|
|
15
|
-
});
|
|
16
|
-
console.log('Operation time: ', (new Date().getTime() - startTime) / 1000);
|
|
17
|
-
};
|
|
18
|
-
run();
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
declare type OptionMeta2 = [string, string];
|
|
2
|
-
declare type OptionMeta3 = [string, string, string | boolean];
|
|
3
|
-
export declare const webpackConfigOption: OptionMeta2;
|
|
4
|
-
export declare type WebpackConfigOptionType = {
|
|
5
|
-
webpackConfig?: string;
|
|
6
|
-
};
|
|
7
|
-
export declare const cwdOption: OptionMeta3;
|
|
8
|
-
export declare type CwdOptionType = {
|
|
9
|
-
cwd: string;
|
|
10
|
-
};
|
|
11
|
-
export declare const reexportRewireOption: OptionMeta2;
|
|
12
|
-
export declare type ReexportRewireOptionType = {
|
|
13
|
-
reexportRewire?: boolean;
|
|
14
|
-
};
|
|
15
|
-
export declare const includeOption: OptionMeta2;
|
|
16
|
-
export declare type IncludeOptionType = {
|
|
17
|
-
include?: string[];
|
|
18
|
-
};
|
|
19
|
-
export declare const excludeOption: OptionMeta2;
|
|
20
|
-
export declare type ExcludeOptionType = {
|
|
21
|
-
exclude?: string[];
|
|
22
|
-
};
|
|
23
|
-
export declare const ignoreTypesImports: OptionMeta3;
|
|
24
|
-
export declare type IgnoreTypesImportsOptionType = {
|
|
25
|
-
ignoreTypesImports: boolean;
|
|
26
|
-
};
|
|
27
|
-
export {};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ignoreTypesImports = exports.excludeOption = exports.includeOption = exports.reexportRewireOption = exports.cwdOption = exports.webpackConfigOption = void 0;
|
|
4
|
-
exports.webpackConfigOption = [
|
|
5
|
-
'-wc, --webpackConfig <path>',
|
|
6
|
-
'path to webpack config to enable webpack aliases support'
|
|
7
|
-
];
|
|
8
|
-
exports.cwdOption = [
|
|
9
|
-
'--cwd <path>',
|
|
10
|
-
'path to a directory that should be used as a resolution root',
|
|
11
|
-
process.cwd()
|
|
12
|
-
];
|
|
13
|
-
exports.reexportRewireOption = [
|
|
14
|
-
'-rr --reexportRewire <value>',
|
|
15
|
-
'resolve actual dependencies for "export * from" statements'
|
|
16
|
-
];
|
|
17
|
-
exports.includeOption = [
|
|
18
|
-
'-i --include <globs...>',
|
|
19
|
-
'A list of globs to determine files included in entry points search'
|
|
20
|
-
];
|
|
21
|
-
exports.excludeOption = [
|
|
22
|
-
'-e --exclude <globs...>',
|
|
23
|
-
'A list of globs to determine files excluded in entry points search'
|
|
24
|
-
];
|
|
25
|
-
exports.ignoreTypesImports = [
|
|
26
|
-
'-iti --ignoreTypesImports',
|
|
27
|
-
'Use this flag to not follow type imports when resolving modules',
|
|
28
|
-
false
|
|
29
|
-
];
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.createCommands = void 0;
|
|
7
|
-
const resolve_1 = __importDefault(require("./resolve"));
|
|
8
|
-
const docs_1 = __importDefault(require("./docs"));
|
|
9
|
-
const entryPoints_1 = __importDefault(require("./entryPoints"));
|
|
10
|
-
const files_1 = __importDefault(require("./files"));
|
|
11
|
-
const nodeModules_1 = __importDefault(require("./nodeModules"));
|
|
12
|
-
function createCommands(program) {
|
|
13
|
-
(0, resolve_1.default)(program);
|
|
14
|
-
(0, entryPoints_1.default)(program);
|
|
15
|
-
(0, files_1.default)(program);
|
|
16
|
-
(0, nodeModules_1.default)(program);
|
|
17
|
-
(0, docs_1.default)(program);
|
|
18
|
-
}
|
|
19
|
-
exports.createCommands = createCommands;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export declare type Command = {
|
|
2
|
-
name: string;
|
|
3
|
-
arguments: {
|
|
4
|
-
nameRaw: string;
|
|
5
|
-
name: string;
|
|
6
|
-
required: boolean;
|
|
7
|
-
description?: string;
|
|
8
|
-
}[];
|
|
9
|
-
description?: string;
|
|
10
|
-
options: {
|
|
11
|
-
shortName: string;
|
|
12
|
-
longName?: string;
|
|
13
|
-
argument?: string;
|
|
14
|
-
description?: string;
|
|
15
|
-
defaultValue?: string;
|
|
16
|
-
required: boolean;
|
|
17
|
-
}[];
|
|
18
|
-
};
|
|
19
|
-
declare function generate(output: string, initialHeaderLevel: number): void;
|
|
20
|
-
export default generate;
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const fs_1 = __importDefault(require("fs"));
|
|
7
|
-
const createCommands_1 = require("../createCommands");
|
|
8
|
-
const template_1 = __importDefault(require("./template"));
|
|
9
|
-
function createCommandsInspector() {
|
|
10
|
-
let currentCommand = null;
|
|
11
|
-
const commands = [];
|
|
12
|
-
const parseOption = (data, description, defaultValue, required) => {
|
|
13
|
-
const argRegex = /(<|\[).+?(>|\])/g;
|
|
14
|
-
const argument = data.match(argRegex);
|
|
15
|
-
const [shortName, longName] = data
|
|
16
|
-
.replace(argRegex, '')
|
|
17
|
-
.trim()
|
|
18
|
-
.split(/,\s+/);
|
|
19
|
-
return {
|
|
20
|
-
shortName,
|
|
21
|
-
longName,
|
|
22
|
-
argument: argument !== null && argument.length > 0 ? argument[0] : undefined,
|
|
23
|
-
description,
|
|
24
|
-
defaultValue,
|
|
25
|
-
required
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
return {
|
|
29
|
-
command(cmd) {
|
|
30
|
-
if (currentCommand !== null) {
|
|
31
|
-
commands.push(currentCommand);
|
|
32
|
-
}
|
|
33
|
-
const [name, ...args] = cmd.split(/\s+/);
|
|
34
|
-
currentCommand = {
|
|
35
|
-
name,
|
|
36
|
-
arguments: args.map((arg) => ({
|
|
37
|
-
nameRaw: arg,
|
|
38
|
-
name: arg.substring(1, arg.length - 1),
|
|
39
|
-
required: arg.charAt(0) === '<'
|
|
40
|
-
})),
|
|
41
|
-
options: []
|
|
42
|
-
};
|
|
43
|
-
return this;
|
|
44
|
-
},
|
|
45
|
-
description(description, argDescription) {
|
|
46
|
-
if (currentCommand !== null) {
|
|
47
|
-
currentCommand.description = description;
|
|
48
|
-
if (argDescription !== undefined) {
|
|
49
|
-
currentCommand.arguments.forEach((arg) => {
|
|
50
|
-
//eslint-disable-next-line
|
|
51
|
-
if (argDescription.hasOwnProperty(arg.name)) {
|
|
52
|
-
arg.description = argDescription[arg.name];
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return this;
|
|
58
|
-
},
|
|
59
|
-
option(data, description, defaultValue) {
|
|
60
|
-
if (currentCommand !== null) {
|
|
61
|
-
currentCommand.options.push(parseOption(data, description, defaultValue, false));
|
|
62
|
-
}
|
|
63
|
-
return this;
|
|
64
|
-
},
|
|
65
|
-
requiredOption(data, description, defaultValue) {
|
|
66
|
-
if (currentCommand !== null) {
|
|
67
|
-
currentCommand.options.push(parseOption(data, description, defaultValue, true));
|
|
68
|
-
}
|
|
69
|
-
return this;
|
|
70
|
-
},
|
|
71
|
-
action() {
|
|
72
|
-
return this;
|
|
73
|
-
},
|
|
74
|
-
getCommands() {
|
|
75
|
-
if (currentCommand !== null) {
|
|
76
|
-
commands.push(currentCommand);
|
|
77
|
-
}
|
|
78
|
-
return commands;
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
function generate(output, initialHeaderLevel) {
|
|
83
|
-
const commandInspector = createCommandsInspector();
|
|
84
|
-
//@ts-ignore
|
|
85
|
-
(0, createCommands_1.createCommands)(commandInspector);
|
|
86
|
-
const commands = commandInspector.getCommands();
|
|
87
|
-
const document = (0, template_1.default)(commands, initialHeaderLevel);
|
|
88
|
-
fs_1.default.writeFileSync(output, document);
|
|
89
|
-
}
|
|
90
|
-
exports.default = generate;
|
package/dist/cli/docs/index.d.ts
DELETED
package/dist/cli/docs/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const generate_1 = __importDefault(require("./generate"));
|
|
7
|
-
function create(program) {
|
|
8
|
-
program
|
|
9
|
-
.command('docs <outputPath>')
|
|
10
|
-
.description('Generate documentation of available commands into md file.', {
|
|
11
|
-
outputPath: 'path to output *.md file'
|
|
12
|
-
})
|
|
13
|
-
.option('-hl, --headerLevel <value>', 'Initial header level', '3')
|
|
14
|
-
.action((outputPath, options) => {
|
|
15
|
-
(0, generate_1.default)(outputPath, parseInt(options.headerLevel));
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
exports.default = create;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const dedent_1 = __importDefault(require("dedent"));
|
|
7
|
-
const programName = 'rev-dep';
|
|
8
|
-
const header = (level, ...text) => '#'.repeat(level) + ' ' + text.join(' ');
|
|
9
|
-
const code = (...text) => '`' + text.join(' ') + '`';
|
|
10
|
-
const codeBlock = (...text) => '```sh\n' + text.join(' ') + '\n```';
|
|
11
|
-
const requiredStr = '**required**';
|
|
12
|
-
const optionalStr = '_optional_';
|
|
13
|
-
const filterFalsy = (array) => array.filter((val) => val);
|
|
14
|
-
function template(commands, headerLevel) {
|
|
15
|
-
return (0, dedent_1.default)(commands
|
|
16
|
-
.map((cmd) => {
|
|
17
|
-
return `
|
|
18
|
-
${header(headerLevel, 'Command', code(cmd.name))}
|
|
19
|
-
|
|
20
|
-
${cmd.description || 'Description not available'}
|
|
21
|
-
|
|
22
|
-
${header(headerLevel + 1, 'Usage')}
|
|
23
|
-
|
|
24
|
-
${codeBlock(...filterFalsy([
|
|
25
|
-
programName,
|
|
26
|
-
cmd.name,
|
|
27
|
-
...cmd.arguments.map((arg) => arg.nameRaw),
|
|
28
|
-
cmd.options.length > 0 ? '[options]' : undefined
|
|
29
|
-
]))}
|
|
30
|
-
${cmd.arguments.length > 0 ? header(headerLevel + 1, 'Arguments') : ''}
|
|
31
|
-
|
|
32
|
-
${cmd.arguments
|
|
33
|
-
.map(({ name, required, description }) => (0, dedent_1.default) `
|
|
34
|
-
* ${code(name)} - ${description} (${required ? requiredStr : optionalStr})
|
|
35
|
-
`)
|
|
36
|
-
.join('\n')}
|
|
37
|
-
|
|
38
|
-
${cmd.options.length > 0 ? header(headerLevel + 1, 'Options') : ''}
|
|
39
|
-
|
|
40
|
-
${cmd.options
|
|
41
|
-
.map(({ shortName, longName, argument, required, description }) => (0, dedent_1.default) `
|
|
42
|
-
* ${code(filterFalsy([shortName, longName]).join(', ') +
|
|
43
|
-
(argument ? ` ${argument}` : ''))} - ${description} (${required ? requiredStr : optionalStr})
|
|
44
|
-
`)
|
|
45
|
-
.join('\n')}
|
|
46
|
-
|
|
47
|
-
`;
|
|
48
|
-
})
|
|
49
|
-
.join('\n'));
|
|
50
|
-
}
|
|
51
|
-
exports.default = template;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const commonOptions_1 = require("../commonOptions");
|
|
4
|
-
const getEntryPoints_1 = require("../../lib/getEntryPoints");
|
|
5
|
-
const buildDepsGraph_1 = require("../../lib/buildDepsGraph");
|
|
6
|
-
const utils_1 = require("../../lib/utils");
|
|
7
|
-
function createEntryPoints(program) {
|
|
8
|
-
program
|
|
9
|
-
.command('entry-points')
|
|
10
|
-
.description('Print list of entry points in current directory')
|
|
11
|
-
.option(...commonOptions_1.webpackConfigOption)
|
|
12
|
-
.option(...commonOptions_1.cwdOption)
|
|
13
|
-
// .option(...reexportRewireOption)
|
|
14
|
-
.option(...commonOptions_1.includeOption)
|
|
15
|
-
.option(...commonOptions_1.excludeOption)
|
|
16
|
-
.option('-pdc, --printDependenciesCount', 'print count of entry point dependencies', false)
|
|
17
|
-
.option('-c, --count', 'print just count of found entry points', false)
|
|
18
|
-
.option(...commonOptions_1.ignoreTypesImports)
|
|
19
|
-
.action(async (data) => {
|
|
20
|
-
const { webpackConfig: webpackConfigPath, cwd, printDependenciesCount, include, exclude, count, ignoreTypesImports } = data;
|
|
21
|
-
const [entryPoints, depsTree] = await (0, getEntryPoints_1.getEntryPoints)({
|
|
22
|
-
cwd: (0, utils_1.resolvePath)(cwd),
|
|
23
|
-
webpackConfigPath,
|
|
24
|
-
exclude,
|
|
25
|
-
include,
|
|
26
|
-
ignoreTypesImports
|
|
27
|
-
});
|
|
28
|
-
let depsCount = null;
|
|
29
|
-
if (printDependenciesCount) {
|
|
30
|
-
depsCount = entryPoints
|
|
31
|
-
.map((0, buildDepsGraph_1.buildDepsGraph)(depsTree))
|
|
32
|
-
.map(([_, __, vertices]) => vertices.size);
|
|
33
|
-
}
|
|
34
|
-
if (count) {
|
|
35
|
-
console.log('Found', entryPoints.length, 'entry points.');
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
if (entryPoints.length === 0) {
|
|
39
|
-
console.log('No results found');
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
entryPoints.forEach((pathName, idx) => {
|
|
43
|
-
if (depsCount !== null) {
|
|
44
|
-
console.log(pathName, depsCount[idx]);
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
console.log(pathName);
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
exports.default = createEntryPoints;
|
package/dist/cli/files/index.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const commonOptions_1 = require("../commonOptions");
|
|
4
|
-
const getFilesForEntryPoint_1 = require("../../lib/getFilesForEntryPoint");
|
|
5
|
-
function createFiles(program) {
|
|
6
|
-
program
|
|
7
|
-
.command('files <entryPoint>')
|
|
8
|
-
.description('Get list of files required by entry point', {
|
|
9
|
-
entryPoint: 'Path to entry point'
|
|
10
|
-
})
|
|
11
|
-
.option(...commonOptions_1.webpackConfigOption)
|
|
12
|
-
.option(...commonOptions_1.cwdOption)
|
|
13
|
-
// .option(...reexportRewireOption)
|
|
14
|
-
.option('-c, --count', 'print only count of entry point dependencies', false)
|
|
15
|
-
.option(...commonOptions_1.ignoreTypesImports)
|
|
16
|
-
.action(async (entryPoint, data) => {
|
|
17
|
-
const { webpackConfig: webpackConfigPath, cwd, count, ignoreTypesImports } = data;
|
|
18
|
-
const filePaths = await (0, getFilesForEntryPoint_1.getFilesForEntryPoint)({
|
|
19
|
-
cwd,
|
|
20
|
-
entryPoint,
|
|
21
|
-
webpackConfigPath,
|
|
22
|
-
ignoreTypesImports
|
|
23
|
-
});
|
|
24
|
-
if (filePaths.length === 0) {
|
|
25
|
-
console.log('No results found');
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
if (count) {
|
|
29
|
-
console.log(filePaths.length);
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
filePaths.forEach((filePath) => console.log(filePath));
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
exports.default = createFiles;
|
package/dist/cli/files/types.js
DELETED
package/dist/cli/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/cli/index.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const commander_1 = require("commander");
|
|
4
|
-
//eslint-disable-next-line
|
|
5
|
-
const pkg = require('../../package.json');
|
|
6
|
-
const createCommands_1 = require("./createCommands");
|
|
7
|
-
const program = new commander_1.Command('rev-dep');
|
|
8
|
-
program.version(pkg.version, '-v, --version');
|
|
9
|
-
(0, createCommands_1.createCommands)(program);
|
|
10
|
-
program.parse(process.argv);
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const commonOptions_1 = require("../commonOptions");
|
|
4
|
-
const getNodeModulesForEntryPoint_1 = require("../../lib/getNodeModulesForEntryPoint");
|
|
5
|
-
function createNodeModules(program) {
|
|
6
|
-
program
|
|
7
|
-
.command('node-modules <entryPoint>')
|
|
8
|
-
.description('Get list of node modules required by entry point', {
|
|
9
|
-
entryPoint: 'Path to entry point'
|
|
10
|
-
})
|
|
11
|
-
.option(...commonOptions_1.webpackConfigOption)
|
|
12
|
-
.option(...commonOptions_1.cwdOption)
|
|
13
|
-
// .option(...reexportRewireOption)
|
|
14
|
-
.option('-c, --count', 'print only count of entry point dependencies', false)
|
|
15
|
-
.option(...commonOptions_1.ignoreTypesImports)
|
|
16
|
-
.action(async (entryPoint, data) => {
|
|
17
|
-
const { webpackConfig: webpackConfigPath, cwd, count, ignoreTypesImports } = data;
|
|
18
|
-
const uniqueNodeModuleImports = await (0, getNodeModulesForEntryPoint_1.getNodeModulesForEntryPoint)({
|
|
19
|
-
cwd,
|
|
20
|
-
entryPoint,
|
|
21
|
-
webpackConfigPath,
|
|
22
|
-
ignoreTypesImports
|
|
23
|
-
});
|
|
24
|
-
if (uniqueNodeModuleImports.length === 0) {
|
|
25
|
-
console.log('No results found');
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
if (count) {
|
|
29
|
-
console.log(uniqueNodeModuleImports.length);
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
uniqueNodeModuleImports.forEach((nodeModuleName) => console.log(nodeModuleName));
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
exports.default = createNodeModules;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { InputParams } from './types';
|
|
2
|
-
declare type Results = Array<Array<Array<string>>>;
|
|
3
|
-
export declare function formatResults({ results, filePathOrNodeModuleName, entryPoints, compactSummary }: {
|
|
4
|
-
results: Results;
|
|
5
|
-
compactSummary: InputParams['compactSummary'];
|
|
6
|
-
entryPoints: string[];
|
|
7
|
-
filePathOrNodeModuleName: string;
|
|
8
|
-
}): string;
|
|
9
|
-
export {};
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.formatResults = void 0;
|
|
27
|
-
const colors = __importStar(require("colorette"));
|
|
28
|
-
const pathToString = (str, filePath, indentation) => {
|
|
29
|
-
return `${str ? `${str}\n` : ''}${' '.repeat(indentation)} ➞ ${filePath}`;
|
|
30
|
-
};
|
|
31
|
-
const join = (...args) => args.join(' ') + '\n';
|
|
32
|
-
function formatResults({ results, filePathOrNodeModuleName, entryPoints, compactSummary }) {
|
|
33
|
-
let formatted = '';
|
|
34
|
-
const hasAnyResults = results.some((paths) => paths.length > 0);
|
|
35
|
-
if (!hasAnyResults) {
|
|
36
|
-
formatted = join('No results found for', filePathOrNodeModuleName, 'in the following entry points list:\n' + entryPoints.join('\n'));
|
|
37
|
-
return formatted;
|
|
38
|
-
}
|
|
39
|
-
if (compactSummary) {
|
|
40
|
-
formatted += join('Results:\n');
|
|
41
|
-
const maxEntryLength = entryPoints.reduce((maxLength, entryPoint) => {
|
|
42
|
-
return entryPoint.length > maxLength ? entryPoint.length : maxLength;
|
|
43
|
-
}, 0);
|
|
44
|
-
let total = 0;
|
|
45
|
-
entryPoints.forEach((entry, index) => {
|
|
46
|
-
formatted += join(`${entry.padEnd(maxEntryLength)} :`, results[index].length);
|
|
47
|
-
total += results[index].length;
|
|
48
|
-
});
|
|
49
|
-
formatted += join('\nTotal:', total);
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
results.forEach((entryPointResults, index) => {
|
|
53
|
-
if (entryPointResults.length > 0) {
|
|
54
|
-
formatted += join(colors.bold(entryPoints[index]), ':', '\n');
|
|
55
|
-
entryPointResults.forEach((path, resultsIndex) => {
|
|
56
|
-
const isLast = resultsIndex === entryPointResults.length - 1;
|
|
57
|
-
formatted += join(path.reduce(pathToString, ''), isLast ? '' : '\n');
|
|
58
|
-
});
|
|
59
|
-
if (index < results.length - 1 && entryPointResults.length > 0) {
|
|
60
|
-
formatted += join('_'.repeat(process.stdout.columns)) + '\n';
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
return formatted;
|
|
66
|
-
}
|
|
67
|
-
exports.formatResults = formatResults;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const resolve_1 = require("../../lib/resolve");
|
|
4
|
-
const formatResults_1 = require("./formatResults");
|
|
5
|
-
const utils_1 = require("../../lib/utils");
|
|
6
|
-
const commonOptions_1 = require("../commonOptions");
|
|
7
|
-
function createResolve(program) {
|
|
8
|
-
program
|
|
9
|
-
.command('resolve <filePathOrNodeModuleName> [entryPoints...]')
|
|
10
|
-
.description('Checks if a filePath is required from entryPoint(s) and prints the resolution path', {
|
|
11
|
-
filePath: 'Path to a file that should be resolved in entry points',
|
|
12
|
-
'entryPoints...': 'List of entry points to look for file'
|
|
13
|
-
})
|
|
14
|
-
.option(...commonOptions_1.webpackConfigOption)
|
|
15
|
-
.option(...commonOptions_1.cwdOption)
|
|
16
|
-
// .option(...reexportRewireOption)
|
|
17
|
-
.option(...commonOptions_1.includeOption)
|
|
18
|
-
.option(...commonOptions_1.excludeOption)
|
|
19
|
-
.option('-cs, --compactSummary', 'print a compact summary of reverse resolution with a count of found paths')
|
|
20
|
-
.option('-a, --all', 'finds all paths combination of a given dependency. Might work very slow or crash for some projects due to heavy usage of RAM', false)
|
|
21
|
-
.option('-ntp --notTraversePaths <paths...>', 'Specify file paths relative to resolution root, that should not be traversed when finding dependency path')
|
|
22
|
-
.option('-inm --includeNodeModules', 'Whether to include node modules in dependency graph. Has to be provided to resolve node module.', true)
|
|
23
|
-
.option(...commonOptions_1.ignoreTypesImports)
|
|
24
|
-
.action(async (filePathOrNodeModuleName, entryPoints, data) => {
|
|
25
|
-
const { compactSummary, webpackConfig, all, cwd, exclude, include, notTraversePaths, ignoreTypesImports, includeNodeModules } = data;
|
|
26
|
-
const [results, resolveEntryPoints] = await (0, resolve_1.resolve)({
|
|
27
|
-
entryPoints,
|
|
28
|
-
filePathOrNodeModuleName,
|
|
29
|
-
webpackConfig,
|
|
30
|
-
all,
|
|
31
|
-
cwd: (0, utils_1.resolvePath)(cwd),
|
|
32
|
-
exclude,
|
|
33
|
-
include,
|
|
34
|
-
notTraversePaths,
|
|
35
|
-
ignoreTypesImports,
|
|
36
|
-
includeNodeModules
|
|
37
|
-
});
|
|
38
|
-
const formatted = (0, formatResults_1.formatResults)({
|
|
39
|
-
results,
|
|
40
|
-
entryPoints: resolveEntryPoints,
|
|
41
|
-
compactSummary,
|
|
42
|
-
filePathOrNodeModuleName
|
|
43
|
-
});
|
|
44
|
-
console.log(formatted);
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
exports.default = createResolve;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export declare type InputParams = {
|
|
2
|
-
compactSummary?: boolean;
|
|
3
|
-
verbose?: boolean;
|
|
4
|
-
webpackConfig?: string;
|
|
5
|
-
typescriptConfig?: string;
|
|
6
|
-
printMaxDepth?: boolean;
|
|
7
|
-
printDependentCount?: boolean;
|
|
8
|
-
all: boolean;
|
|
9
|
-
notTraversePaths?: string[];
|
|
10
|
-
includeNodeModules?: boolean;
|
|
11
|
-
};
|