@kezh/my-custom-js-converter 1.1.11 → 1.5.0

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.
@@ -0,0 +1,65 @@
1
+ # 日志优化方案
2
+
3
+ ## 现状问题
4
+
5
+ 1. **格式不统一** — 有的用 `=>` 分隔,有的直接打印数组,风格混乱
6
+ 2. **缺少层级结构** — 所有日志平铺输出,无法区分步骤/阶段
7
+ 3. **信息不完整** — `scanf dirs => ` 和数组分两行打印,`the map is not found!` 没有上下文
8
+ 4. **缺少状态标识** — 没有成功/失败/警告等视觉区分
9
+ 5. **中英混杂** — `路径不存在[...]忽略` vs `scanf dirs` vs `the map is not found!`
10
+ 6. **缺少汇总** — 处理完成后没有统计摘要
11
+
12
+ ## 优化方案
13
+
14
+ ### 1. 新建 `src/util/logger.ts` — 统一日志工具
15
+
16
+ ```typescript
17
+ export function createLogger(scope: string) {
18
+ return {
19
+ info(msg: string) { console.log(`[${scope}] ✔ ${msg}`); },
20
+ warn(msg: string) { console.log(`[${scope}] ⚠ ${msg}`); },
21
+ error(msg: string) { console.log(`[${scope}] ✖ ${msg}`); },
22
+ step(title: string) {
23
+ console.log(`\n[${scope}] ── ${title} ${'─'.repeat(Math.max(0, 50 - title.length))}`);
24
+ },
25
+ };
26
+ }
27
+ ```
28
+
29
+ 简洁、无外部依赖、终端友好。
30
+
31
+ ### 2. 日志对照表
32
+
33
+ | 原始 | 优化后 |
34
+ |---|---|
35
+ | `console.log("scanf dirs => ")` + `console.log(targetDirs)` | `logger.info('scanf dirs: ' + targetDirs.join(', '))` |
36
+ | `console.log(\`scanf file => ${inPath}\`)` | `logger.info(\`scanf file: ${inPath}\`)` |
37
+ | `console.log(\`output file => ${outPath}\`)` | `logger.info(\`output: ${outPath}\`)` |
38
+ | `console.log(\`output => ${outPath}\`)` | `logger.info(\`output: ${outPath}\`)` |
39
+ | `console.log(\`input map => ${inPath}\`)` | `logger.info(\`read map: ${inPath}\`)` |
40
+ | `console.log("the map is not found!")` | `logger.warn('map file not found')` |
41
+ | `console.log(\`output map => ${outPath}\`)` | `logger.info(\`write map: ${outPath}\`)` |
42
+ | `console.log(\`not found entry => ${entry}\`)` | `logger.warn(\`entry not found: ${entry}\`)` |
43
+ | `console.log(\`路径不存在[${dirPath}]忽略\`)` | `logger.warn(\`dir not found, skipping: ${dirPath}\`)` |
44
+ | `console.log(\`ignore module => ${item.id.name}\`)` | `logger.info(\`ignore module: ${item.id.name}\`)` |
45
+
46
+ ### 3. 增加步骤分隔和汇总
47
+
48
+ **encode** 流程增加:
49
+ - 步骤标题:扫描目录 → 查找文件 → 编码处理
50
+ - 汇总:处理文件数、方法总数、版本号
51
+
52
+ **decode** 流程增加:
53
+ - 步骤标题:扫描目录 → 查找文件 → 解码处理
54
+ - 汇总:处理文件数
55
+
56
+ ### 4. 修改文件清单
57
+
58
+ | 文件 | 变更 |
59
+ |---|---|
60
+ | `src/util/logger.ts` | **新建** — 日志工具模块 |
61
+ | `src/encode/index.ts` | 替换 4 处 console.log,增加步骤和汇总 |
62
+ | `src/decode/index.ts` | 替换 4 处 console.log,增加步骤和汇总 |
63
+ | `src/context/map_context.ts` | 替换 3 处 console.log |
64
+ | `src/scanf/index.ts` | 替换 1 处 console.log |
65
+ | `src/util/ast.ts` | 替换 1 处 console.log |
package/CLAUDE.md ADDED
@@ -0,0 +1,50 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Project Overview
6
+
7
+ `@kezh/my-custom-js-converter` is a Babel-based JavaScript code transformer that **encodes** (flattens) and **decodes** (restores) CommonJS module structures. It takes JavaScript files that use `require()` + object-oriented patterns and flattens them into a single object with renamed methods, then can reverse the process.
8
+
9
+ ## Build & Run
10
+
11
+ ```bash
12
+ pnpm install # install dependencies
13
+ pnpm build # compile TypeScript (npx tsc --build)
14
+ ```
15
+
16
+ The compiled output goes to `core/` (gitignored). Source is in `src/`.
17
+
18
+ Two CLI entry points (declared in `package.json` bin):
19
+ - `encode` → `core/encode/index.js` — flattens modules into a single file
20
+ - `decode` → `core/decode/index.js` — restores the original module structure
21
+
22
+ No test framework is configured.
23
+
24
+ ## Architecture
25
+
26
+ ### Data Flow
27
+
28
+ **Encode**: Scan target dirs → find entry JS files → build dependency map (`MapContext`) → extract & rename methods from all modules → output single flattened file + `mod.map`
29
+
30
+ **Decode**: Read `mod.map` → read encoded file → re-insert `require` statements → remove inlined dependency methods → restore original method names → output restored file
31
+
32
+ ### Key Modules
33
+
34
+ - **`src/config/`** — Configuration loading. `MainConfig` defines encode/decode settings (entry object name, file names, ignore list). Reads `config.json` from the parent project root when installed as a dependency.
35
+ - **`src/context/map_context.ts`** — Core orchestration. `MapContext` builds a dependency graph by recursively walking `require()` calls, then performs **filtering** (removing invalid method references) and **tree-shaking** (removing unused methods). Serializes to `mod.map` JSON file.
36
+ - **`src/util/ast.ts`** — All Babel AST manipulation: parsing, traversing, extracting object methods, renaming methods (appending `__modName` suffix), generating import statements, and reversing the renaming during decode.
37
+ - **`src/scanf/`** — File system scanning: finding target files by name, resolving `require()` paths (handles both `dir/index.js` and `file.js` patterns).
38
+ - **`src/util/parent_path.ts`** — Detects whether the tool is running inside `node_modules/` and resolves the parent project root.
39
+
40
+ ### Encoding Convention
41
+
42
+ Methods from dependency modules are renamed with a `__modName` suffix (e.g., `helperMethod` becomes `helperMethod__util`). `this.method()` calls in the root module stay as-is; in dependency modules, `this.method()` becomes `this.method__modName()`. The decode step reverses this convention.
43
+
44
+ ### Configuration
45
+
46
+ When used as a dependency, the tool reads `config.json` from the parent project's root. Default config:
47
+ - `encode.file`: `"index.js"`, `encode.output`: `"coded.js"`, `encode.entry`: `"customEvent"`
48
+ - `decode.file`: `"coded.js"`, `decode.output`: `"decoded.js"`, `decode.mount`: `"customEvent"`
49
+ - `settingDir`: `".setting"` (where `mod.map` is stored)
50
+ - `target`: directories to scan relative to `baseDir`
package/README.en.md ADDED
@@ -0,0 +1,116 @@
1
+ [中文](README.md)
2
+
3
+ # my-custom-js-converter
4
+
5
+ A Babel-based JavaScript code transformer that flattens and restores CommonJS module structures.
6
+
7
+ ## Features
8
+
9
+ - **Encode** — Recursively scans `require()` dependencies, extracts used methods from each module, and flattens them into a single file with renamed methods (e.g., `helperMethod__util`).
10
+ - **Decode** — Reads the generated dependency map and restores the original module structure by re-inserting `require()` statements and reversing method renaming.
11
+ - **Tree-shaking** — Only methods that are actually used are included in the encoded output; unused methods are stripped.
12
+ - **Configurable** — Entry object name, file names, ignore list, and scan directories are all configurable via `config.json`.
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ npm install @kezh/my-custom-js-converter
18
+ # or
19
+ pnpm add @kezh/my-custom-js-converter
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ ### 1. Create a config file
25
+
26
+ Create `config.json` in your project root:
27
+
28
+ ```json
29
+ {
30
+ "encode": {
31
+ "file": "index.js",
32
+ "output": "coded.js",
33
+ "entry": "customEvent",
34
+ "ignoreMod": ["commonUtil"]
35
+ },
36
+ "decode": {
37
+ "file": "coded.js",
38
+ "output": "decoded.js",
39
+ "mount": "customEvent"
40
+ },
41
+ "target": ["src"],
42
+ "settingDir": ".setting"
43
+ }
44
+ ```
45
+
46
+ #### Config Options
47
+
48
+ | Field | Description |
49
+ |---|---|
50
+ | `encode.file` | Source file name to encode |
51
+ | `encode.output` | Encoded output file name |
52
+ | `encode.entry` | Entry object name in source |
53
+ | `encode.ignoreMod` | Module names to skip during encoding |
54
+ | `decode.file` | Encoded file to decode |
55
+ | `decode.output` | Decoded output file name |
56
+ | `decode.mount` | Object name to mount decoded code |
57
+ | `target` | Directories to scan (relative to project root) |
58
+ | `settingDir` | Directory for the dependency map file |
59
+
60
+ ### 2. Encode
61
+
62
+ ```bash
63
+ npx encode
64
+ ```
65
+
66
+ Scans the `target` directories for files matching `encode.file`, builds a dependency map, and outputs:
67
+ - `encode.output` — the flattened code file
68
+ - `settingDir/mod.map` — the dependency map (needed for decoding)
69
+
70
+ ### 3. Decode
71
+
72
+ ```bash
73
+ npx decode
74
+ ```
75
+
76
+ Reads the dependency map from `settingDir/mod.map`, restores `require()` imports, reverses method renaming, and outputs `decode.output`.
77
+
78
+ ## How It Works
79
+
80
+ ### Encode Flow
81
+
82
+ ```
83
+ index.js (entry: customEvent)
84
+ ├── require('./util') → util.methodA(), util.methodB()
85
+ └── require('./helper') → helper.process()
86
+
87
+ ↓ encode
88
+
89
+ coded.js
90
+ customEvent = {
91
+ ownMethod() { ... },
92
+ methodA__util() { ... }, // from util
93
+ methodB__util() { ... }, // from util
94
+ process__helper() { ... } // from helper
95
+ }
96
+ ```
97
+
98
+ ### Decode Flow
99
+
100
+ ```
101
+ coded.js + mod.map
102
+
103
+ ↓ decode
104
+
105
+ decoded.js
106
+ const util = require('./util');
107
+ const helper = require('./helper');
108
+ customEvent = {
109
+ ownMethod() { ... },
110
+ // methodA__util, methodB__util, process__helper removed
111
+ }
112
+ ```
113
+
114
+ ## License
115
+
116
+ MIT
package/README.md ADDED
@@ -0,0 +1,116 @@
1
+ [English](README.en.md)
2
+
3
+ # my-custom-js-converter
4
+
5
+ 基于 Babel 的 JavaScript 代码转换器,用于扁平化和还原 CommonJS 模块结构。
6
+
7
+ ## 功能
8
+
9
+ - **编码(Encode)** — 递归扫描 `require()` 依赖,从每个模块中提取被使用的方法,扁平化到单个文件中并重命名方法(如 `helperMethod__util`)。
10
+ - **解码(Decode)** — 读取生成的依赖映射文件,还原原始模块结构,重新插入 `require()` 语句并恢复方法命名。
11
+ - **摇树优化(Tree-shaking)** — 编码输出仅包含实际使用的方法,未使用的方法会被移除。
12
+ - **可配置** — 入口对象名、文件名、忽略列表和扫描目录均可通过 `config.json` 配置。
13
+
14
+ ## 安装
15
+
16
+ ```bash
17
+ npm install @kezh/my-custom-js-converter
18
+ # 或
19
+ pnpm add @kezh/my-custom-js-converter
20
+ ```
21
+
22
+ ## 使用方式
23
+
24
+ ### 1. 创建配置文件
25
+
26
+ 在项目根目录创建 `config.json`:
27
+
28
+ ```json
29
+ {
30
+ "encode": {
31
+ "file": "index.js",
32
+ "output": "coded.js",
33
+ "entry": "customEvent",
34
+ "ignoreMod": ["commonUtil"]
35
+ },
36
+ "decode": {
37
+ "file": "coded.js",
38
+ "output": "decoded.js",
39
+ "mount": "customEvent"
40
+ },
41
+ "target": ["src"],
42
+ "settingDir": ".setting"
43
+ }
44
+ ```
45
+
46
+ #### 配置项
47
+
48
+ | 字段 | 说明 |
49
+ |---|---|
50
+ | `encode.file` | 编码的源文件名 |
51
+ | `encode.output` | 编码输出文件名 |
52
+ | `encode.entry` | 源码中的入口对象名 |
53
+ | `encode.ignoreMod` | 编码时忽略的模块名 |
54
+ | `decode.file` | 待解码的文件名 |
55
+ | `decode.output` | 解码输出文件名 |
56
+ | `decode.mount` | 解码代码的挂载对象名 |
57
+ | `target` | 扫描目录(相对于项目根目录) |
58
+ | `settingDir` | 依赖映射文件存放目录 |
59
+
60
+ ### 2. 编码
61
+
62
+ ```bash
63
+ npx encode
64
+ ```
65
+
66
+ 扫描 `target` 目录中匹配 `encode.file` 的文件,构建依赖映射,输出:
67
+ - `encode.output` — 扁平化后的代码文件
68
+ - `settingDir/mod.map` — 依赖映射文件(解码时需要)
69
+
70
+ ### 3. 解码
71
+
72
+ ```bash
73
+ npx decode
74
+ ```
75
+
76
+ 读取 `settingDir/mod.map` 中的依赖映射,还原 `require()` 导入,恢复方法命名,输出 `decode.output`。
77
+
78
+ ## 工作原理
79
+
80
+ ### 编码流程
81
+
82
+ ```
83
+ index.js (entry: customEvent)
84
+ ├── require('./util') → util.methodA(), util.methodB()
85
+ └── require('./helper') → helper.process()
86
+
87
+ ↓ encode
88
+
89
+ coded.js
90
+ customEvent = {
91
+ ownMethod() { ... },
92
+ methodA__util() { ... }, // 来自 util
93
+ methodB__util() { ... }, // 来自 util
94
+ process__helper() { ... } // 来自 helper
95
+ }
96
+ ```
97
+
98
+ ### 解码流程
99
+
100
+ ```
101
+ coded.js + mod.map
102
+
103
+ ↓ decode
104
+
105
+ decoded.js
106
+ const util = require('./util');
107
+ const helper = require('./helper');
108
+ customEvent = {
109
+ ownMethod() { ... },
110
+ // methodA__util 等已移除
111
+ }
112
+ ```
113
+
114
+ ## 许可证
115
+
116
+ MIT
package/TASKS.md ADDED
@@ -0,0 +1,2 @@
1
+ # 任务
2
+ 项目encode和decode输出日志可读性差,请帮我优化日志。
@@ -1,2 +1,2 @@
1
- import { MainConfig } from "./main_config";
2
- export declare const config: MainConfig;
1
+ import { MainConfig } from "./main_config";
2
+ export declare const config: MainConfig;
@@ -1,44 +1,69 @@
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.config = void 0;
7
- const fs_1 = __importDefault(require("fs"));
8
- const path_1 = __importDefault(require("path"));
9
- exports.config = initConfig();
10
- function initConfig() {
11
- const defConfig = {
12
- encode: {
13
- file: "index.js",
14
- output: "coded.js",
15
- entry: "customEvent",
16
- ignoreMod: ["commonUtil"],
17
- },
18
- decode: {
19
- file: "coded.js",
20
- output: "decoded.js",
21
- mount: "customEvent",
22
- },
23
- baseDir: "",
24
- target: [""],
25
- settingDir: ".setting",
26
- customConfig: "config.json",
27
- };
28
- const curDir = __dirname;
29
- const baseDir = curDir.replace(/node_modules.*/g, "");
30
- try {
31
- const configPath = path_1.default.join(baseDir, defConfig.customConfig);
32
- fs_1.default.accessSync(configPath);
33
- const json = fs_1.default.readFileSync(configPath, { encoding: "utf-8" });
34
- const customConfig = JSON.parse(json);
35
- defConfig.baseDir = baseDir;
36
- Object.keys(customConfig).map(key => key).forEach((key) => {
37
- if (customConfig[key]) {
38
- defConfig[key] = customConfig[key];
39
- }
40
- });
41
- }
42
- catch (err) { }
43
- return defConfig;
44
- }
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.config = void 0;
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const path_1 = __importDefault(require("path"));
9
+ exports.config = initConfig();
10
+ function initConfig() {
11
+ const defConfig = {
12
+ encode: {
13
+ file: "index.js",
14
+ output: "coded.js",
15
+ entry: "customEvent",
16
+ ignoreMod: ["commonUtil"],
17
+ useAlias: false,
18
+ },
19
+ decode: {
20
+ file: "coded.js",
21
+ output: "decoded.js",
22
+ mount: "customEvent",
23
+ },
24
+ baseDir: "",
25
+ target: [""],
26
+ settingDir: ".setting",
27
+ customConfig: "config.js",
28
+ };
29
+ const curDir = __dirname;
30
+ let baseDir = curDir.replace(/node_modules.*/g, "");
31
+ // 当 __dirname 不包含 node_modules 时(如 junction symlink 场景),
32
+ // 尝试从 process.cwd() 查找配置文件
33
+ if (!curDir.includes("node_modules")) {
34
+ baseDir = process.cwd();
35
+ }
36
+ // 尝试查找配置文件:先 customConfig 指定的文件名,再 config.json
37
+ const configCandidates = [defConfig.customConfig, "config.json"];
38
+ for (const configName of configCandidates) {
39
+ try {
40
+ const configPath = path_1.default.join(baseDir, configName);
41
+ fs_1.default.accessSync(configPath);
42
+ let customConfig;
43
+ if (configPath.endsWith(".js")) {
44
+ // 支持 .js 配置文件,可使用注释
45
+ customConfig = require(configPath);
46
+ }
47
+ else {
48
+ // 兼容 .json 配置文件
49
+ const json = fs_1.default.readFileSync(configPath, { encoding: "utf-8" });
50
+ customConfig = JSON.parse(json);
51
+ }
52
+ defConfig.baseDir = baseDir;
53
+ Object.keys(customConfig).map(key => key).forEach((key) => {
54
+ if (customConfig[key]) {
55
+ defConfig[key] = customConfig[key];
56
+ }
57
+ });
58
+ // baseDir 允许从配置文件中显式覆盖
59
+ if (customConfig.baseDir) {
60
+ defConfig.baseDir = customConfig.baseDir;
61
+ }
62
+ break;
63
+ }
64
+ catch (err) {
65
+ continue;
66
+ }
67
+ }
68
+ return defConfig;
69
+ }
@@ -1,19 +1,20 @@
1
- export interface MainConfig {
2
- encode: EncodeConfig;
3
- decode: DecodeConfig;
4
- baseDir: string;
5
- target: string[];
6
- settingDir: string;
7
- customConfig: string;
8
- }
9
- export interface EncodeConfig {
10
- file: string;
11
- output: string;
12
- entry: string;
13
- ignoreMod: string[];
14
- }
15
- export interface DecodeConfig {
16
- file: string;
17
- output: string;
18
- mount: string;
19
- }
1
+ export interface MainConfig {
2
+ encode: EncodeConfig;
3
+ decode: DecodeConfig;
4
+ baseDir: string;
5
+ target: string[];
6
+ settingDir: string;
7
+ customConfig: string;
8
+ }
9
+ export interface EncodeConfig {
10
+ file: string;
11
+ output: string;
12
+ entry: string;
13
+ ignoreMod: string[];
14
+ useAlias: boolean;
15
+ }
16
+ export interface DecodeConfig {
17
+ file: string;
18
+ output: string;
19
+ mount: string;
20
+ }
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,15 +1,15 @@
1
- export declare class MapConfig {
2
- [mod: string]: Mod;
3
- }
4
- export declare class Mod {
5
- src: string;
6
- dependencies: Dependencies;
7
- constructor(src: string, dependencies?: Dependencies);
8
- }
9
- export declare class Dependencies {
10
- [name: string]: Dependency;
11
- }
12
- export declare class Dependency {
13
- methods: string[];
14
- constructor(methods?: string[]);
15
- }
1
+ export declare class MapConfig {
2
+ [mod: string]: Mod;
3
+ }
4
+ export declare class Mod {
5
+ src: string;
6
+ dependencies: Dependencies;
7
+ constructor(src: string, dependencies?: Dependencies);
8
+ }
9
+ export declare class Dependencies {
10
+ [name: string]: Dependency;
11
+ }
12
+ export declare class Dependency {
13
+ methods: string[];
14
+ constructor(methods?: string[]);
15
+ }
@@ -1,22 +1,22 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Dependency = exports.Dependencies = exports.Mod = exports.MapConfig = void 0;
4
- class MapConfig {
5
- }
6
- exports.MapConfig = MapConfig;
7
- class Mod {
8
- constructor(src, dependencies = new Dependencies()) {
9
- this.src = src;
10
- this.dependencies = dependencies;
11
- }
12
- }
13
- exports.Mod = Mod;
14
- class Dependencies {
15
- }
16
- exports.Dependencies = Dependencies;
17
- class Dependency {
18
- constructor(methods = []) {
19
- this.methods = methods;
20
- }
21
- }
22
- exports.Dependency = Dependency;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Dependency = exports.Dependencies = exports.Mod = exports.MapConfig = void 0;
4
+ class MapConfig {
5
+ }
6
+ exports.MapConfig = MapConfig;
7
+ class Mod {
8
+ constructor(src, dependencies = new Dependencies()) {
9
+ this.src = src;
10
+ this.dependencies = dependencies;
11
+ }
12
+ }
13
+ exports.Mod = Mod;
14
+ class Dependencies {
15
+ }
16
+ exports.Dependencies = Dependencies;
17
+ class Dependency {
18
+ constructor(methods = []) {
19
+ this.methods = methods;
20
+ }
21
+ }
22
+ exports.Dependency = Dependency;
@@ -1,28 +1,28 @@
1
- import { Mod } from "../config/map_config";
2
- export declare class MapContext {
3
- static SAVE_FILE: string;
4
- private srcPath;
5
- private entry;
6
- private outDir;
7
- private map;
8
- constructor(srcPath?: string, entry?: string, outDir?: string, initMap?: boolean);
9
- appendModMap(mod: Mod, self: boolean, name?: string): void;
10
- getModNames(): string[];
11
- getMod(name: string): Mod | null | undefined;
12
- getMethodNamesByMod(name: string): string[];
13
- getDependencyNameByMod(name: string): string[];
14
- getSrcPathByMod(name: string): string | undefined;
15
- getAbsoluteSrcPathByMod(name: string): string | undefined;
16
- static readFromLocal(inDir: string): MapContext;
17
- private init;
18
- private writeToLocal;
19
- private buildMapContext;
20
- /**
21
- * 过滤self的dependencies中无效方法
22
- */
23
- private filtering;
24
- /**
25
- * 去除dependencies中未使用方法
26
- */
27
- private shaking;
28
- }
1
+ import { Mod } from "../config/map_config";
2
+ export declare class MapContext {
3
+ static SAVE_FILE: string;
4
+ private srcPath;
5
+ private entry;
6
+ private outDir;
7
+ private map;
8
+ constructor(srcPath?: string, entry?: string, outDir?: string, initMap?: boolean);
9
+ appendModMap(mod: Mod, self: boolean, name?: string): void;
10
+ getModNames(): string[];
11
+ getMod(name: string): Mod | null | undefined;
12
+ getMethodNamesByMod(name: string): string[];
13
+ getDependencyNameByMod(name: string): string[];
14
+ getSrcPathByMod(name: string): string | undefined;
15
+ getAbsoluteSrcPathByMod(name: string): string | undefined;
16
+ static readFromLocal(inDir: string): MapContext;
17
+ private init;
18
+ private writeToLocal;
19
+ private buildMapContext;
20
+ /**
21
+ * 过滤self的dependencies中无效方法
22
+ */
23
+ private filtering;
24
+ /**
25
+ * 去除dependencies中未使用方法
26
+ */
27
+ private shaking;
28
+ }