js-code-detector 0.0.9 → 0.0.11
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 +19 -21
- package/bin/gitDiffDetect.js +3 -0
- package/dist/cjs/index.d.ts +2 -1
- package/dist/cjs/index.js +39 -4
- package/dist/cjs/util/ast_util/Core.d.ts +6 -29
- package/dist/cjs/util/ast_util/windowProperties.js +648 -1
- package/dist/cjs/util/report_util/code_block_detect.js +15 -13
- package/dist/cjs/util/report_util/createMdByJson.js +4 -4
- package/dist/cjs/util/report_util/file_identifier_detect.js +3 -0
- package/dist/cjs/util/report_util.d.ts +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
# js-code-detector
|
|
2
2
|
|
|
3
3
|
## 说明
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
- 重复代码检测工具, 支持 React、Vue 项目
|
|
5
|
+
- git分支对比报告, 目前适用于 umi4.x 版本的项目
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
## 重复代码检测使用
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
3.执行该命令可在当前项目目录下生成报告, ```npm run same```
|
|
9
|
+
- 项目安装 **js-code-detector**
|
|
10
|
+
- package.json 中添加 scripts 命令 ```sameCodeDetect```, 例如:```"same": "sameCodeDetect"```
|
|
11
|
+
- 执行该命令可在当前项目目录下生成报告, ```npm run same```
|
|
13
12
|
|
|
14
13
|
## git分支对比报告使用
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
3.执行该命令可在当前项目目录下生成报告, ```npm run detect```
|
|
14
|
+
- 项目安装 **js-code-detector**
|
|
15
|
+
- package.json 中添加 scripts 命令 ```gitDiffDetect```, 例如:```"detect": "gitDiffDetect"```
|
|
16
|
+
- 执行该命令可在当前项目目录下生成报告, ```npm run detect```
|
|
19
17
|
|
|
20
18
|
## 重复代码检测报告说明
|
|
21
19
|
1.所有相似的代码片段为一组,每组有2个及以上的代码片段
|
|
@@ -23,17 +21,17 @@
|
|
|
23
21
|
|
|
24
22
|
|
|
25
23
|
## git分支对比报告说明
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
24
|
+
- 文件路径
|
|
25
|
+
- 改动类型 add remove modify
|
|
26
|
+
- 依赖当前文件的文件
|
|
27
|
+
- 危险标识符(包括 1、找不到定义的, 2、函数的参数是一个函数,并进行调用的)
|
|
28
|
+
- 区块报告(每个diff块产生一个报告)
|
|
29
|
+
- 区块类型,目前把重点的类型单独提取处理,包括 "Import"|"Declaration"|"Assignment"|"SelfUpdate"|"Invoke"
|
|
30
|
+
- 区块的原始改动内容
|
|
31
|
+
- 增加的标识符
|
|
32
|
+
- 增加的标识符的影响
|
|
33
|
+
- 增加的标识符的来源
|
|
34
|
+
- 影响到的标识符的位置
|
|
37
35
|
|
|
38
36
|
|
|
39
37
|
## LICENSE
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -4,5 +4,6 @@ export declare function getGitRepositoryAndBranch(): Promise<{
|
|
|
4
4
|
gitUrl: string;
|
|
5
5
|
branchName: string;
|
|
6
6
|
}>;
|
|
7
|
-
export declare function generateReport(
|
|
7
|
+
export declare function generateReport(content: string): void;
|
|
8
8
|
export declare function sameCodeDetect(dirOfCwd?: string): Promise<void>;
|
|
9
|
+
export declare function gitDiffDetect(): Promise<void>;
|
package/dist/cjs/index.js
CHANGED
|
@@ -31,6 +31,7 @@ var src_exports = {};
|
|
|
31
31
|
__export(src_exports, {
|
|
32
32
|
generateReport: () => generateReport,
|
|
33
33
|
getGitRepositoryAndBranch: () => getGitRepositoryAndBranch,
|
|
34
|
+
gitDiffDetect: () => gitDiffDetect,
|
|
34
35
|
sameCodeDetect: () => sameCodeDetect,
|
|
35
36
|
umiPluginCallback: () => umiPluginCallback,
|
|
36
37
|
writeGitDiffTxt: () => writeGitDiffTxt
|
|
@@ -82,14 +83,14 @@ git clone $1 source
|
|
|
82
83
|
`;
|
|
83
84
|
var pluginFileContent = `import * as cb from "js-code-detector"
|
|
84
85
|
|
|
85
|
-
export default async (api) => {
|
|
86
|
+
export default async (api: any) => {
|
|
86
87
|
const buildCallback = () => cb.umiPluginCallback(api);
|
|
87
88
|
api.onBuildComplete(buildCallback);
|
|
88
89
|
}`;
|
|
89
90
|
async function writeGitDiffTxt(gitUrl, branchName) {
|
|
90
91
|
const today = (0, import_dayjs.default)().format("YYYYMDD");
|
|
91
92
|
(0, import_fs2.writeFileSync)((0, import_path.join)(process.cwd(), "detect.sh"), shellFileContent, { encoding: "utf-8", flag: "w" });
|
|
92
|
-
import_utils.execa.execa("chmod +x detect.sh", { shell: "/bin/bash" });
|
|
93
|
+
await import_utils.execa.execa("chmod +x detect.sh", { shell: "/bin/bash" });
|
|
93
94
|
const res0 = await import_utils.execa.execa("sh detect.sh", [gitUrl, branchName], { shell: "/bin/bash" });
|
|
94
95
|
import_utils.chalk.green(["临时文件夹建立,源代码clone完成"]);
|
|
95
96
|
(0, import_fs2.writeFileSync)((0, import_path.join)(process.cwd(), today, "target", "plugin.ts"), pluginFileContent, { encoding: "utf-8", flag: "w" });
|
|
@@ -108,8 +109,8 @@ async function getGitRepositoryAndBranch() {
|
|
|
108
109
|
branchName: branch.stdout
|
|
109
110
|
};
|
|
110
111
|
}
|
|
111
|
-
function generateReport(
|
|
112
|
-
(0, import_fs2.writeFileSync)((0, import_path.join)(process.cwd(), `${(0, import_dayjs.default)().format("YYYYMDD_HHmm")}_${jsonName}`),
|
|
112
|
+
function generateReport(content) {
|
|
113
|
+
(0, import_fs2.writeFileSync)((0, import_path.join)(process.cwd(), `${(0, import_dayjs.default)().format("YYYYMDD_HHmm")}_${jsonName}`), content, { encoding: "utf-8", flag: "w" });
|
|
113
114
|
}
|
|
114
115
|
async function sameCodeDetect(dirOfCwd) {
|
|
115
116
|
const filesAndContent = await (0, import_readDirFiles.readSrcFiles)(dirOfCwd);
|
|
@@ -120,10 +121,44 @@ async function sameCodeDetect(dirOfCwd) {
|
|
|
120
121
|
const md = import_Core.default.createMarkdownFile(validContentList);
|
|
121
122
|
(0, import_fs2.writeFileSync)((0, import_path.join)(process.cwd(), `${(0, import_dayjs.default)().format("YYYYMDD_HHmm")}_same_code.md`), md, { encoding: "utf-8", flag: "w" });
|
|
122
123
|
}
|
|
124
|
+
async function gitDiffDetect() {
|
|
125
|
+
const today = (0, import_dayjs.default)().format("YYYYMDD");
|
|
126
|
+
const { gitUrl, branchName } = await getGitRepositoryAndBranch();
|
|
127
|
+
import_utils.logger.ready("准备生成临时工作目录...");
|
|
128
|
+
await import_utils.execa.execa(`mkdir -p ${today}`, { shell: "/bin/bash" });
|
|
129
|
+
import_utils.logger.info("临时目录建立完成");
|
|
130
|
+
import_utils.logger.ready("准备clone源代码到临时目录下的target文件夹");
|
|
131
|
+
await import_utils.execa.execa(`git clone ${gitUrl} ${today}/target`, { shell: "/bin/bash" });
|
|
132
|
+
import_utils.logger.info("源代码clone完成");
|
|
133
|
+
import_utils.logger.ready("准备clone源代码到临时目录下的source文件夹");
|
|
134
|
+
await import_utils.execa.execa(`git clone ${gitUrl} ${today}/source`, { shell: "/bin/bash" });
|
|
135
|
+
import_utils.logger.info("源代码clone完成");
|
|
136
|
+
import_utils.logger.ready("准备切换到目标分支");
|
|
137
|
+
await import_utils.execa.execa(`cd ${today}/target && git fetch origin ${branchName}:${branchName} && git checkout ${branchName}`, { shell: "/bin/bash" });
|
|
138
|
+
import_utils.logger.info("分支切换完成");
|
|
139
|
+
import_utils.logger.ready("准备生成git_diff.txt文件");
|
|
140
|
+
await import_utils.execa.execa(`cd ${today}/target && git diff master..${branchName} --unified=0 --output=git_diff.txt`, { shell: "/bin/bash" });
|
|
141
|
+
import_utils.logger.info("git_diff.txt文件生成完成");
|
|
142
|
+
import_utils.logger.ready("准备生成插件文件");
|
|
143
|
+
(0, import_fs2.writeFileSync)((0, import_path.join)(process.cwd(), today, "target", "plugin.ts"), pluginFileContent, { encoding: "utf-8", flag: "w" });
|
|
144
|
+
import_utils.logger.info("插件文件生成完成");
|
|
145
|
+
import_utils.logger.ready("准备生成报告");
|
|
146
|
+
await import_utils.execa.execa(`cd ${today}/target && yarn install && npm run build`, { shell: "/bin/bash" });
|
|
147
|
+
import_utils.logger.info("报告生成完成!");
|
|
148
|
+
import_utils.logger.ready("准备移动报告");
|
|
149
|
+
const content = (0, import_fs.readFileSync)((0, import_path.join)(process.cwd(), today, "target", jsonName), "utf-8");
|
|
150
|
+
const mdFileName = `${(0, import_dayjs.default)().format("YYYYMDD_HHmm")}_${jsonName}`;
|
|
151
|
+
(0, import_fs2.writeFileSync)((0, import_path.join)(process.cwd(), mdFileName), content, { encoding: "utf-8", flag: "w" });
|
|
152
|
+
import_utils.logger.info("报告完成: " + mdFileName);
|
|
153
|
+
(0, import_utils.rimraf)((0, import_path.join)(process.cwd(), today), () => {
|
|
154
|
+
import_utils.logger.info("临时目录已删除");
|
|
155
|
+
});
|
|
156
|
+
}
|
|
123
157
|
// Annotate the CommonJS export names for ESM import in node:
|
|
124
158
|
0 && (module.exports = {
|
|
125
159
|
generateReport,
|
|
126
160
|
getGitRepositoryAndBranch,
|
|
161
|
+
gitDiffDetect,
|
|
127
162
|
sameCodeDetect,
|
|
128
163
|
umiPluginCallback,
|
|
129
164
|
writeGitDiffTxt
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FileSegment
|
|
2
|
-
import
|
|
1
|
+
import { FileSegment } from "./FileUtil";
|
|
2
|
+
import { AstFeatNode } from "./AstFeatUtil";
|
|
3
3
|
export default class Core {
|
|
4
4
|
static createMarkdownFile(result: {
|
|
5
5
|
list: {
|
|
@@ -40,31 +40,8 @@ export default class Core {
|
|
|
40
40
|
countList: number[];
|
|
41
41
|
depthList: number[];
|
|
42
42
|
};
|
|
43
|
-
static getFileContentByLine
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
static getListOfGroup(mapFilePathToDetail: MapFilePathToDetail, validFullNodeList: ReturnType<typeof Core.getListOfNodeGroup>['nodeGroupList']): {
|
|
48
|
-
list: {
|
|
49
|
-
astNode: AstFeatNode;
|
|
50
|
-
location: string;
|
|
51
|
-
content: string;
|
|
52
|
-
}[];
|
|
53
|
-
listOfNodeInfo: (typeof validFullNodeList)[number]["listOfNodeInfo"];
|
|
54
|
-
nodeCount: number;
|
|
55
|
-
depth: number;
|
|
56
|
-
hashKey: string;
|
|
57
|
-
}[];
|
|
58
|
-
static createMapHashKeyToAstNodeSet(fileList: FileSegment[]): readonly [MapHashKeyToAstNodeSet, Set<string>, string[]];
|
|
59
|
-
static getListOfNodeGroup(mapHashKeyToNodeSet: MapHashKeyToAstNodeSet): {
|
|
60
|
-
nodeGroupList: {
|
|
61
|
-
list: AstFeatNode[];
|
|
62
|
-
listOfNodeInfo: ReturnType<typeof AstFeatUtil.spreadSubNode>;
|
|
63
|
-
nodeCount: number;
|
|
64
|
-
depth: number;
|
|
65
|
-
hashKey: string;
|
|
66
|
-
}[];
|
|
67
|
-
countList: number[];
|
|
68
|
-
depthList: number[];
|
|
69
|
-
};
|
|
43
|
+
private static getFileContentByLine;
|
|
44
|
+
private static getListOfGroup;
|
|
45
|
+
private static createMapHashKeyToAstNodeSet;
|
|
46
|
+
private static getListOfNodeGroup;
|
|
70
47
|
}
|
|
@@ -23,6 +23,497 @@ __export(windowProperties_exports, {
|
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(windowProperties_exports);
|
|
25
25
|
var windowProperties = [
|
|
26
|
+
"undefined",
|
|
27
|
+
"SuppressedError",
|
|
28
|
+
"BigInt64Array",
|
|
29
|
+
"BigUint64Array",
|
|
30
|
+
"Float16Array",
|
|
31
|
+
"Intl",
|
|
32
|
+
"WebAssembly",
|
|
33
|
+
"DisposableStack",
|
|
34
|
+
"AsyncDisposableStack",
|
|
35
|
+
"SVGTextContentElement",
|
|
36
|
+
"AuthenticatorAttestationResponse",
|
|
37
|
+
"SVGRectElement",
|
|
38
|
+
"Crypto",
|
|
39
|
+
"MediaEncryptedEvent",
|
|
40
|
+
"AudioNode",
|
|
41
|
+
"SVGScriptElement",
|
|
42
|
+
"HTMLMeterElement",
|
|
43
|
+
"VideoEncoder",
|
|
44
|
+
"SVGAnimatedNumberList",
|
|
45
|
+
"HTMLTableRowElement",
|
|
46
|
+
"WritableStreamDefaultWriter",
|
|
47
|
+
"AudioContext",
|
|
48
|
+
"MessagePort",
|
|
49
|
+
"SVGTransform",
|
|
50
|
+
"Worker",
|
|
51
|
+
"MIDIConnectionEvent",
|
|
52
|
+
"ToggleEvent",
|
|
53
|
+
"XSLTProcessor",
|
|
54
|
+
"AudioWorklet",
|
|
55
|
+
"XMLHttpRequestUpload",
|
|
56
|
+
"WebGLShader",
|
|
57
|
+
"RTCStatsReport",
|
|
58
|
+
"BarProp",
|
|
59
|
+
"HTMLTableCaptionElement",
|
|
60
|
+
"SVGFEImageElement",
|
|
61
|
+
"Cache",
|
|
62
|
+
"SVGFEFuncBElement",
|
|
63
|
+
"AbstractRange",
|
|
64
|
+
"SVGCircleElement",
|
|
65
|
+
"WebGLVertexArrayObject",
|
|
66
|
+
"IDBOpenDBRequest",
|
|
67
|
+
"SVGPolylineElement",
|
|
68
|
+
"SVGComponentTransferFunctionElement",
|
|
69
|
+
"PromiseRejectionEvent",
|
|
70
|
+
"StereoPannerNode",
|
|
71
|
+
"AudioParamMap",
|
|
72
|
+
"HTMLOptionsCollection",
|
|
73
|
+
"DocumentFragment",
|
|
74
|
+
"WebGLRenderingContext",
|
|
75
|
+
"DOMMatrixReadOnly",
|
|
76
|
+
"RTCTrackEvent",
|
|
77
|
+
"DOMImplementation",
|
|
78
|
+
"PerformanceNavigation",
|
|
79
|
+
"ShadowRoot",
|
|
80
|
+
"SVGGElement",
|
|
81
|
+
"SVGFEConvolveMatrixElement",
|
|
82
|
+
"WebGLTexture",
|
|
83
|
+
"WebGLSync",
|
|
84
|
+
"SVGLength",
|
|
85
|
+
"ErrorEvent",
|
|
86
|
+
"WakeLock",
|
|
87
|
+
"RTCPeerConnectionIceEvent",
|
|
88
|
+
"WebGLBuffer",
|
|
89
|
+
"CSSContainerRule",
|
|
90
|
+
"ClipboardItem",
|
|
91
|
+
"SVGFEFuncRElement",
|
|
92
|
+
"PerformanceServerTiming",
|
|
93
|
+
"SVGDescElement",
|
|
94
|
+
"RadioNodeList",
|
|
95
|
+
"SVGPatternElement",
|
|
96
|
+
"CustomStateSet",
|
|
97
|
+
"SVGMPathElement",
|
|
98
|
+
"XPathExpression",
|
|
99
|
+
"CSSFontFeatureValuesRule",
|
|
100
|
+
"ResizeObserverSize",
|
|
101
|
+
"SVGFEFuncGElement",
|
|
102
|
+
"AnimationEffect",
|
|
103
|
+
"Gamepad",
|
|
104
|
+
"RTCIceTransport",
|
|
105
|
+
"SVGAnimatedTransformList",
|
|
106
|
+
"FileSystemFileHandle",
|
|
107
|
+
"SVGAnimatedAngle",
|
|
108
|
+
"SVGNumber",
|
|
109
|
+
"DOMPoint",
|
|
110
|
+
"SVGFESpotLightElement",
|
|
111
|
+
"IDBObjectStore",
|
|
112
|
+
"MediaRecorder",
|
|
113
|
+
"DeviceMotionEvent",
|
|
114
|
+
"VTTCue",
|
|
115
|
+
"SVGFECompositeElement",
|
|
116
|
+
"AuthenticatorResponse",
|
|
117
|
+
"SVGGradientElement",
|
|
118
|
+
"ReadableStreamBYOBReader",
|
|
119
|
+
"SVGAnimatedNumber",
|
|
120
|
+
"WebGLProgram",
|
|
121
|
+
"GeolocationPosition",
|
|
122
|
+
"DataTransferItem",
|
|
123
|
+
"CacheStorage",
|
|
124
|
+
"MessageChannel",
|
|
125
|
+
"CanvasGradient",
|
|
126
|
+
"HTMLFieldSetElement",
|
|
127
|
+
"MIDIPort",
|
|
128
|
+
"MediaKeyStatusMap",
|
|
129
|
+
"SVGAnimatedInteger",
|
|
130
|
+
"SecurityPolicyViolationEvent",
|
|
131
|
+
"ElementInternals",
|
|
132
|
+
"CSSPageRule",
|
|
133
|
+
"SVGFEDiffuseLightingElement",
|
|
134
|
+
"FileSystemDirectoryHandle",
|
|
135
|
+
"CDATASection",
|
|
136
|
+
"CountQueuingStrategy",
|
|
137
|
+
"HTMLTableElement",
|
|
138
|
+
"FormData",
|
|
139
|
+
"AuthenticatorAssertionResponse",
|
|
140
|
+
"UserActivation",
|
|
141
|
+
"ProgressEvent",
|
|
142
|
+
"HTMLFrameElement",
|
|
143
|
+
"SpeechSynthesisErrorEvent",
|
|
144
|
+
"CompressionStream",
|
|
145
|
+
"SVGAnimateTransformElement",
|
|
146
|
+
"HTMLAudioElement",
|
|
147
|
+
"AudioDecoder",
|
|
148
|
+
"CredentialsContainer",
|
|
149
|
+
"SpeechSynthesisVoice",
|
|
150
|
+
"ImageBitmap",
|
|
151
|
+
"CSSSupportsRule",
|
|
152
|
+
"NavigationPreloadManager",
|
|
153
|
+
"IDBFactory",
|
|
154
|
+
"Credential",
|
|
155
|
+
"PannerNode",
|
|
156
|
+
"MIDIInputMap",
|
|
157
|
+
"Headers",
|
|
158
|
+
"CSSCounterStyleRule",
|
|
159
|
+
"TextTrack",
|
|
160
|
+
"GeolocationCoordinates",
|
|
161
|
+
"PerformanceObserver",
|
|
162
|
+
"CSS",
|
|
163
|
+
"AudioProcessingEvent",
|
|
164
|
+
"Clipboard",
|
|
165
|
+
"SVGStopElement",
|
|
166
|
+
"CSSStartingStyleRule",
|
|
167
|
+
"MediaSession",
|
|
168
|
+
"TextDecoderStream",
|
|
169
|
+
"IDBIndex",
|
|
170
|
+
"SVGMatrix",
|
|
171
|
+
"VideoFrame",
|
|
172
|
+
"PerformanceResourceTiming",
|
|
173
|
+
"SpeechSynthesisUtterance",
|
|
174
|
+
"HTMLVideoElement",
|
|
175
|
+
"HTMLDetailsElement",
|
|
176
|
+
"SVGTitleElement",
|
|
177
|
+
"DragEvent",
|
|
178
|
+
"SVGAnimatedString",
|
|
179
|
+
"IIRFilterNode",
|
|
180
|
+
"TreeWalker",
|
|
181
|
+
"SVGFEGaussianBlurElement",
|
|
182
|
+
"CanvasPattern",
|
|
183
|
+
"CookieStoreManager",
|
|
184
|
+
"SVGPreserveAspectRatio",
|
|
185
|
+
"Option",
|
|
186
|
+
"WebKitCSSMatrix",
|
|
187
|
+
"FileSystemWritableFileStream",
|
|
188
|
+
"HTMLDataElement",
|
|
189
|
+
"ReadableByteStreamController",
|
|
190
|
+
"HTMLMenuElement",
|
|
191
|
+
"Geolocation",
|
|
192
|
+
"MediaStreamEvent",
|
|
193
|
+
"ReadableStreamBYOBRequest",
|
|
194
|
+
"HTMLHeadingElement",
|
|
195
|
+
"VideoDecoder",
|
|
196
|
+
"MediaKeySystemAccess",
|
|
197
|
+
"TextEncoder",
|
|
198
|
+
"SVGFEFloodElement",
|
|
199
|
+
"IDBCursor",
|
|
200
|
+
"CSSFontPaletteValuesRule",
|
|
201
|
+
"CSSKeyframesRule",
|
|
202
|
+
"ScriptProcessorNode",
|
|
203
|
+
"HTMLSlotElement",
|
|
204
|
+
"TrackEvent",
|
|
205
|
+
"HTMLLegendElement",
|
|
206
|
+
"WebTransportBidirectionalStream",
|
|
207
|
+
"CSSImportRule",
|
|
208
|
+
"TextEvent",
|
|
209
|
+
"ConvolverNode",
|
|
210
|
+
"HTMLPreElement",
|
|
211
|
+
"MediaCapabilities",
|
|
212
|
+
"HTMLLabelElement",
|
|
213
|
+
"GamepadHapticActuator",
|
|
214
|
+
"TextEncoderStream",
|
|
215
|
+
"SVGImageElement",
|
|
216
|
+
"DocumentTimeline",
|
|
217
|
+
"MIDIInput",
|
|
218
|
+
"webkitURL",
|
|
219
|
+
"TransformStream",
|
|
220
|
+
"RTCPeerConnection",
|
|
221
|
+
"HTMLHRElement",
|
|
222
|
+
"SVGPolygonElement",
|
|
223
|
+
"Highlight",
|
|
224
|
+
"AudioBuffer",
|
|
225
|
+
"WaveShaperNode",
|
|
226
|
+
"OffscreenCanvasRenderingContext2D",
|
|
227
|
+
"WebTransportError",
|
|
228
|
+
"SVGLinearGradientElement",
|
|
229
|
+
"RTCDTMFSender",
|
|
230
|
+
"RTCRtpTransceiver",
|
|
231
|
+
"SVGTextPositioningElement",
|
|
232
|
+
"SVGRect",
|
|
233
|
+
"Audio",
|
|
234
|
+
"SVGAnimatedEnumeration",
|
|
235
|
+
"HTMLMapElement",
|
|
236
|
+
"WebGL2RenderingContext",
|
|
237
|
+
"WebGLQuery",
|
|
238
|
+
"WebGLRenderbuffer",
|
|
239
|
+
"SVGFEMergeElement",
|
|
240
|
+
"MediaKeys",
|
|
241
|
+
"PerformancePaintTiming",
|
|
242
|
+
"HTMLEmbedElement",
|
|
243
|
+
"StorageManager",
|
|
244
|
+
"AnimationPlaybackEvent",
|
|
245
|
+
"MIDIMessageEvent",
|
|
246
|
+
"CaretPosition",
|
|
247
|
+
"HTMLTableSectionElement",
|
|
248
|
+
"CSSFontFaceRule",
|
|
249
|
+
"PerformanceMark",
|
|
250
|
+
"SVGFEDistantLightElement",
|
|
251
|
+
"HTMLSourceElement",
|
|
252
|
+
"PerformanceMeasure",
|
|
253
|
+
"RTCDataChannelEvent",
|
|
254
|
+
"SVGFETileElement",
|
|
255
|
+
"FileReader",
|
|
256
|
+
"MediaStreamTrack",
|
|
257
|
+
"SVGUnitTypes",
|
|
258
|
+
"MediaQueryListEvent",
|
|
259
|
+
"SVGLineElement",
|
|
260
|
+
"URL",
|
|
261
|
+
"FormDataEvent",
|
|
262
|
+
"XPathEvaluator",
|
|
263
|
+
"FontFaceSetLoadEvent",
|
|
264
|
+
"RTCEncodedVideoFrame",
|
|
265
|
+
"SVGAnimateElement",
|
|
266
|
+
"FragmentDirective",
|
|
267
|
+
"IDBRequest",
|
|
268
|
+
"ProcessingInstruction",
|
|
269
|
+
"NodeFilter",
|
|
270
|
+
"ResizeObserver",
|
|
271
|
+
"PublicKeyCredential",
|
|
272
|
+
"HTMLPictureElement",
|
|
273
|
+
"CanvasRenderingContext2D",
|
|
274
|
+
"ByteLengthQueuingStrategy",
|
|
275
|
+
"CSSKeyframeRule",
|
|
276
|
+
"CSSNestedDeclarations",
|
|
277
|
+
"WebGLSampler",
|
|
278
|
+
"WebTransportDatagramDuplexStream",
|
|
279
|
+
"HTMLBRElement",
|
|
280
|
+
"MediaStreamTrackEvent",
|
|
281
|
+
"MediaStreamAudioSourceNode",
|
|
282
|
+
"DOMQuad",
|
|
283
|
+
"IDBTransaction",
|
|
284
|
+
"HTMLDialogElement",
|
|
285
|
+
"ReadableStreamDefaultReader",
|
|
286
|
+
"HTMLDirectoryElement",
|
|
287
|
+
"PopStateEvent",
|
|
288
|
+
"ContentVisibilityAutoStateChangeEvent",
|
|
289
|
+
"ServiceWorker",
|
|
290
|
+
"SVGFETurbulenceElement",
|
|
291
|
+
"ReadableStream",
|
|
292
|
+
"SVGAnimatedPreserveAspectRatio",
|
|
293
|
+
"BlobEvent",
|
|
294
|
+
"HTMLDListElement",
|
|
295
|
+
"PermissionStatus",
|
|
296
|
+
"SVGAngle",
|
|
297
|
+
"ImageTrack",
|
|
298
|
+
"PerformanceEntry",
|
|
299
|
+
"HTMLBaseElement",
|
|
300
|
+
"SVGSymbolElement",
|
|
301
|
+
"SVGFEMergeNodeElement",
|
|
302
|
+
"RTCEncodedAudioFrame",
|
|
303
|
+
"HTMLOptionElement",
|
|
304
|
+
"MIDIOutputMap",
|
|
305
|
+
"Screen",
|
|
306
|
+
"Selection",
|
|
307
|
+
"HTMLTitleElement",
|
|
308
|
+
"OffscreenCanvas",
|
|
309
|
+
"Blob",
|
|
310
|
+
"SVGFEBlendElement",
|
|
311
|
+
"InputEvent",
|
|
312
|
+
"ValidityState",
|
|
313
|
+
"HashChangeEvent",
|
|
314
|
+
"Lock",
|
|
315
|
+
"TextTrackCue",
|
|
316
|
+
"MediaKeySession",
|
|
317
|
+
"CryptoKey",
|
|
318
|
+
"WebGLActiveInfo",
|
|
319
|
+
"WritableStreamDefaultController",
|
|
320
|
+
"File",
|
|
321
|
+
"TimeRanges",
|
|
322
|
+
"ResizeObserverEntry",
|
|
323
|
+
"IDBDatabase",
|
|
324
|
+
"ServiceWorkerContainer",
|
|
325
|
+
"RTCDtlsTransport",
|
|
326
|
+
"SVGFESpecularLightingElement",
|
|
327
|
+
"CSSNamespaceRule",
|
|
328
|
+
"SVGAnimatedLength",
|
|
329
|
+
"RTCDTMFToneChangeEvent",
|
|
330
|
+
"HTMLTimeElement",
|
|
331
|
+
"LockManager",
|
|
332
|
+
"RTCSctpTransport",
|
|
333
|
+
"GainNode",
|
|
334
|
+
"SharedWorker",
|
|
335
|
+
"HTMLTableCellElement",
|
|
336
|
+
"CustomElementRegistry",
|
|
337
|
+
"GamepadEvent",
|
|
338
|
+
"AnalyserNode",
|
|
339
|
+
"MIDIOutput",
|
|
340
|
+
"SVGRadialGradientElement",
|
|
341
|
+
"CookieStore",
|
|
342
|
+
"ChannelMergerNode",
|
|
343
|
+
"WritableStream",
|
|
344
|
+
"XPathResult",
|
|
345
|
+
"DataTransfer",
|
|
346
|
+
"AudioWorkletNode",
|
|
347
|
+
"SVGClipPathElement",
|
|
348
|
+
"SpeechSynthesisEvent",
|
|
349
|
+
"WebGLFramebuffer",
|
|
350
|
+
"OscillatorNode",
|
|
351
|
+
"Path2D",
|
|
352
|
+
"HTMLFrameSetElement",
|
|
353
|
+
"SVGMarkerElement",
|
|
354
|
+
"OfflineAudioContext",
|
|
355
|
+
"SVGFEOffsetElement",
|
|
356
|
+
"EventSource",
|
|
357
|
+
"Animation",
|
|
358
|
+
"WebGLTransformFeedback",
|
|
359
|
+
"MediaStreamAudioDestinationNode",
|
|
360
|
+
"HTMLMarqueeElement",
|
|
361
|
+
"AudioBufferSourceNode",
|
|
362
|
+
"EncodedAudioChunk",
|
|
363
|
+
"WebGLUniformLocation",
|
|
364
|
+
"SVGAnimationElement",
|
|
365
|
+
"IDBKeyRange",
|
|
366
|
+
"ReadableStreamDefaultController",
|
|
367
|
+
"HTMLDataListElement",
|
|
368
|
+
"Request",
|
|
369
|
+
"WebGLContextEvent",
|
|
370
|
+
"SVGAnimatedRect",
|
|
371
|
+
"WebTransport",
|
|
372
|
+
"Notification",
|
|
373
|
+
"SourceBuffer",
|
|
374
|
+
"CSSLayerStatementRule",
|
|
375
|
+
"WheelEvent",
|
|
376
|
+
"ScreenOrientation",
|
|
377
|
+
"BroadcastChannel",
|
|
378
|
+
"NavigatorLogin",
|
|
379
|
+
"FontFace",
|
|
380
|
+
"StorageEvent",
|
|
381
|
+
"SVGFEFuncAElement",
|
|
382
|
+
"ClipboardEvent",
|
|
383
|
+
"PeriodicWave",
|
|
384
|
+
"SVGUseElement",
|
|
385
|
+
"PerformanceEventTiming",
|
|
386
|
+
"MediaDeviceInfo",
|
|
387
|
+
"PerformanceNavigationTiming",
|
|
388
|
+
"DOMPointReadOnly",
|
|
389
|
+
"HTMLProgressElement",
|
|
390
|
+
"DeviceOrientationEvent",
|
|
391
|
+
"ImageData",
|
|
392
|
+
"MIDIAccess",
|
|
393
|
+
"SVGDefsElement",
|
|
394
|
+
"SVGFEDisplacementMapElement",
|
|
395
|
+
"PushSubscriptionOptions",
|
|
396
|
+
"Worklet",
|
|
397
|
+
"CookieChangeEvent",
|
|
398
|
+
"MessageEvent",
|
|
399
|
+
"HTMLQuoteElement",
|
|
400
|
+
"SubmitEvent",
|
|
401
|
+
"IDBCursorWithValue",
|
|
402
|
+
"HTMLParamElement",
|
|
403
|
+
"URLSearchParams",
|
|
404
|
+
"KeyframeEffect",
|
|
405
|
+
"TextDecoder",
|
|
406
|
+
"TransformStreamDefaultController",
|
|
407
|
+
"MimeType",
|
|
408
|
+
"AudioParam",
|
|
409
|
+
"VideoColorSpace",
|
|
410
|
+
"TransitionEvent",
|
|
411
|
+
"SubtleCrypto",
|
|
412
|
+
"SVGStyleElement",
|
|
413
|
+
"SVGMaskElement",
|
|
414
|
+
"ImageTrackList",
|
|
415
|
+
"MediaMetadata",
|
|
416
|
+
"MediaSource",
|
|
417
|
+
"SVGAnimateMotionElement",
|
|
418
|
+
"AudioData",
|
|
419
|
+
"SVGPoint",
|
|
420
|
+
"CompositionEvent",
|
|
421
|
+
"HTMLTrackElement",
|
|
422
|
+
"CSSTransition",
|
|
423
|
+
"MathMLElement",
|
|
424
|
+
"DocumentType",
|
|
425
|
+
"StaticRange",
|
|
426
|
+
"RTCRtpSender",
|
|
427
|
+
"SVGTextElement",
|
|
428
|
+
"GamepadButton",
|
|
429
|
+
"SVGFEColorMatrixElement",
|
|
430
|
+
"AudioEncoder",
|
|
431
|
+
"SVGMetadataElement",
|
|
432
|
+
"VisualViewport",
|
|
433
|
+
"SVGAnimatedLengthList",
|
|
434
|
+
"TextMetrics",
|
|
435
|
+
"WebGLShaderPrecisionFormat",
|
|
436
|
+
"PushManager",
|
|
437
|
+
"WakeLockSentinel",
|
|
438
|
+
"AudioScheduledSourceNode",
|
|
439
|
+
"HTMLFontElement",
|
|
440
|
+
"BaseAudioContext",
|
|
441
|
+
"RTCIceCandidate",
|
|
442
|
+
"AudioListener",
|
|
443
|
+
"SVGFEPointLightElement",
|
|
444
|
+
"MediaStream",
|
|
445
|
+
"HTMLMediaElement",
|
|
446
|
+
"HTMLOutputElement",
|
|
447
|
+
"DOMParser",
|
|
448
|
+
"RTCRtpReceiver",
|
|
449
|
+
"HTMLTableColElement",
|
|
450
|
+
"SVGEllipseElement",
|
|
451
|
+
"DOMMatrix",
|
|
452
|
+
"SVGTSpanElement",
|
|
453
|
+
"RTCSessionDescription",
|
|
454
|
+
"HighlightRegistry",
|
|
455
|
+
"PerformanceObserverEntryList",
|
|
456
|
+
"OfflineAudioCompletionEvent",
|
|
457
|
+
"HTMLOListElement",
|
|
458
|
+
"DynamicsCompressorNode",
|
|
459
|
+
"XMLSerializer",
|
|
460
|
+
"ImageBitmapRenderingContext",
|
|
461
|
+
"SVGAnimatedBoolean",
|
|
462
|
+
"Range",
|
|
463
|
+
"SVGFEMorphologyElement",
|
|
464
|
+
"PushSubscription",
|
|
465
|
+
"SVGSwitchElement",
|
|
466
|
+
"ServiceWorkerRegistration",
|
|
467
|
+
"SVGForeignObjectElement",
|
|
468
|
+
"SVGFEDropShadowElement",
|
|
469
|
+
"DecompressionStream",
|
|
470
|
+
"Permissions",
|
|
471
|
+
"LargestContentfulPaint",
|
|
472
|
+
"MediaElementAudioSourceNode",
|
|
473
|
+
"EncodedVideoChunk",
|
|
474
|
+
"SVGSetElement",
|
|
475
|
+
"GeolocationPositionError",
|
|
476
|
+
"MediaDevices",
|
|
477
|
+
"BiquadFilterNode",
|
|
478
|
+
"AudioDestinationNode",
|
|
479
|
+
"RTCDataChannel",
|
|
480
|
+
"DelayNode",
|
|
481
|
+
"HTMLOptGroupElement",
|
|
482
|
+
"ImageDecoder",
|
|
483
|
+
"AnimationTimeline",
|
|
484
|
+
"XMLDocument",
|
|
485
|
+
"RTCCertificate",
|
|
486
|
+
"SVGFilterElement",
|
|
487
|
+
"HTMLCanvasElement",
|
|
488
|
+
"IDBVersionChangeEvent",
|
|
489
|
+
"VideoPlaybackQuality",
|
|
490
|
+
"SVGFEComponentTransferElement",
|
|
491
|
+
"CSSPropertyRule",
|
|
492
|
+
"SVGTextPathElement",
|
|
493
|
+
"HTMLModElement",
|
|
494
|
+
"AnimationEvent",
|
|
495
|
+
"Attr",
|
|
496
|
+
"SVGViewElement",
|
|
497
|
+
"History",
|
|
498
|
+
"CSSAnimation",
|
|
499
|
+
"ChannelSplitterNode",
|
|
500
|
+
"MediaKeyMessageEvent",
|
|
501
|
+
"CloseEvent",
|
|
502
|
+
"CSSLayerBlockRule",
|
|
503
|
+
"MediaError",
|
|
504
|
+
"IdleDeadline",
|
|
505
|
+
"NodeIterator",
|
|
506
|
+
"ConstantSourceNode",
|
|
507
|
+
"SpeechSynthesis",
|
|
508
|
+
"DOMException",
|
|
509
|
+
"FileSystemHandle",
|
|
510
|
+
"BeforeUnloadEvent",
|
|
511
|
+
"HTMLTemplateElement",
|
|
512
|
+
"Function",
|
|
513
|
+
"Object",
|
|
514
|
+
"eval",
|
|
515
|
+
"EventTarget",
|
|
516
|
+
"Window",
|
|
26
517
|
"close",
|
|
27
518
|
"stop",
|
|
28
519
|
"focus",
|
|
@@ -101,6 +592,8 @@ var windowProperties = [
|
|
|
101
592
|
"ondeviceorientation",
|
|
102
593
|
"ondeviceorientationabsolute",
|
|
103
594
|
"visualViewport",
|
|
595
|
+
"cookieStore",
|
|
596
|
+
"originAgentCluster",
|
|
104
597
|
"crypto",
|
|
105
598
|
"onabort",
|
|
106
599
|
"onblur",
|
|
@@ -108,6 +601,7 @@ var windowProperties = [
|
|
|
108
601
|
"oncancel",
|
|
109
602
|
"onauxclick",
|
|
110
603
|
"onbeforeinput",
|
|
604
|
+
"onbeforematch",
|
|
111
605
|
"onbeforetoggle",
|
|
112
606
|
"oncanplay",
|
|
113
607
|
"oncanplaythrough",
|
|
@@ -179,6 +673,7 @@ var windowProperties = [
|
|
|
179
673
|
"onpointerover",
|
|
180
674
|
"onpointerenter",
|
|
181
675
|
"onpointerleave",
|
|
676
|
+
"onpointerrawupdate",
|
|
182
677
|
"ongotpointercapture",
|
|
183
678
|
"onlostpointercapture",
|
|
184
679
|
"onanimationend",
|
|
@@ -220,7 +715,159 @@ var windowProperties = [
|
|
|
220
715
|
"window",
|
|
221
716
|
"document",
|
|
222
717
|
"location",
|
|
223
|
-
"top"
|
|
718
|
+
"top",
|
|
719
|
+
"Node",
|
|
720
|
+
"Document",
|
|
721
|
+
"HTMLDocument",
|
|
722
|
+
"EventCounts",
|
|
723
|
+
"Map",
|
|
724
|
+
"Performance",
|
|
725
|
+
"XMLHttpRequestEventTarget",
|
|
726
|
+
"XMLHttpRequest",
|
|
727
|
+
"WebSocket",
|
|
728
|
+
"JSON",
|
|
729
|
+
"Location",
|
|
730
|
+
"MutationObserver",
|
|
731
|
+
"MutationRecord",
|
|
732
|
+
"Event",
|
|
733
|
+
"Element",
|
|
734
|
+
"HTMLElement",
|
|
735
|
+
"HTMLLinkElement",
|
|
736
|
+
"DOMTokenList",
|
|
737
|
+
"Array",
|
|
738
|
+
"HTMLBodyElement",
|
|
739
|
+
"HTMLHeadElement",
|
|
740
|
+
"RegExp",
|
|
741
|
+
"globalThis",
|
|
742
|
+
"Symbol",
|
|
743
|
+
"escape",
|
|
744
|
+
"unescape",
|
|
745
|
+
"decodeURI",
|
|
746
|
+
"encodeURI",
|
|
747
|
+
"decodeURIComponent",
|
|
748
|
+
"encodeURIComponent",
|
|
749
|
+
"String",
|
|
750
|
+
"Navigator",
|
|
751
|
+
"Reflect",
|
|
752
|
+
"Set",
|
|
753
|
+
"Promise",
|
|
754
|
+
"Date",
|
|
755
|
+
"isNaN",
|
|
756
|
+
"isFinite",
|
|
757
|
+
"parseInt",
|
|
758
|
+
"parseFloat",
|
|
759
|
+
"NaN",
|
|
760
|
+
"Infinity",
|
|
761
|
+
"Number",
|
|
762
|
+
"Boolean",
|
|
763
|
+
"HTMLDivElement",
|
|
764
|
+
"HTMLStyleElement",
|
|
765
|
+
"CharacterData",
|
|
766
|
+
"Text",
|
|
767
|
+
"HTMLScriptElement",
|
|
768
|
+
"Math",
|
|
769
|
+
"WeakMap",
|
|
770
|
+
"HTMLHtmlElement",
|
|
771
|
+
"IntersectionObserver",
|
|
772
|
+
"IntersectionObserverEntry",
|
|
773
|
+
"CustomEvent",
|
|
774
|
+
"HTMLIFrameElement",
|
|
775
|
+
"HTMLAnchorElement",
|
|
776
|
+
"Error",
|
|
777
|
+
"SyntaxError",
|
|
778
|
+
"TypeError",
|
|
779
|
+
"Uint8Array",
|
|
780
|
+
"AggregateError",
|
|
781
|
+
"ArrayBuffer",
|
|
782
|
+
"Iterator",
|
|
783
|
+
"Atomics",
|
|
784
|
+
"BigInt",
|
|
785
|
+
"DataView",
|
|
786
|
+
"EvalError",
|
|
787
|
+
"Float32Array",
|
|
788
|
+
"Float64Array",
|
|
789
|
+
"FinalizationRegistry",
|
|
790
|
+
"Int8Array",
|
|
791
|
+
"Int16Array",
|
|
792
|
+
"Int32Array",
|
|
793
|
+
"Proxy",
|
|
794
|
+
"RangeError",
|
|
795
|
+
"ReferenceError",
|
|
796
|
+
"Uint8ClampedArray",
|
|
797
|
+
"Uint16Array",
|
|
798
|
+
"Uint32Array",
|
|
799
|
+
"URIError",
|
|
800
|
+
"WeakRef",
|
|
801
|
+
"WeakSet",
|
|
802
|
+
"HTMLUnknownElement",
|
|
803
|
+
"CSSStyleDeclaration",
|
|
804
|
+
"HTMLCollection",
|
|
805
|
+
"CSSRuleList",
|
|
806
|
+
"DOMRectList",
|
|
807
|
+
"DOMStringList",
|
|
808
|
+
"DataTransferItemList",
|
|
809
|
+
"FileList",
|
|
810
|
+
"HTMLAllCollection",
|
|
811
|
+
"HTMLFormElement",
|
|
812
|
+
"HTMLSelectElement",
|
|
813
|
+
"MediaList",
|
|
814
|
+
"MimeTypeArray",
|
|
815
|
+
"NamedNodeMap",
|
|
816
|
+
"NodeList",
|
|
817
|
+
"Plugin",
|
|
818
|
+
"PluginArray",
|
|
819
|
+
"SVGLengthList",
|
|
820
|
+
"SVGNumberList",
|
|
821
|
+
"SVGPointList",
|
|
822
|
+
"SVGStringList",
|
|
823
|
+
"SVGTransformList",
|
|
824
|
+
"SourceBufferList",
|
|
825
|
+
"StyleSheetList",
|
|
826
|
+
"TextTrackCueList",
|
|
827
|
+
"TextTrackList",
|
|
828
|
+
"console",
|
|
829
|
+
"HTMLObjectElement",
|
|
830
|
+
"Storage",
|
|
831
|
+
"Comment",
|
|
832
|
+
"HTMLSpanElement",
|
|
833
|
+
"SVGElement",
|
|
834
|
+
"SVGGraphicsElement",
|
|
835
|
+
"SVGSVGElement",
|
|
836
|
+
"SVGGeometryElement",
|
|
837
|
+
"SVGPathElement",
|
|
838
|
+
"HTMLImageElement",
|
|
839
|
+
"Image",
|
|
840
|
+
"HTMLInputElement",
|
|
841
|
+
"HTMLUListElement",
|
|
842
|
+
"HTMLButtonElement",
|
|
843
|
+
"HTMLLIElement",
|
|
844
|
+
"HTMLParagraphElement",
|
|
845
|
+
"DOMStringMap",
|
|
846
|
+
"DOMRectReadOnly",
|
|
847
|
+
"DOMRect",
|
|
848
|
+
"HTMLFormControlsCollection",
|
|
849
|
+
"HTMLMetaElement",
|
|
850
|
+
"Response",
|
|
851
|
+
"PageTransitionEvent",
|
|
852
|
+
"UIEvent",
|
|
853
|
+
"FocusEvent",
|
|
854
|
+
"MouseEvent",
|
|
855
|
+
"PointerEvent",
|
|
856
|
+
"HTMLAreaElement",
|
|
857
|
+
"SVGAElement",
|
|
858
|
+
"HTMLTextAreaElement",
|
|
859
|
+
"KeyboardEvent",
|
|
860
|
+
"PerformanceTiming",
|
|
861
|
+
"StyleSheet",
|
|
862
|
+
"CSSStyleSheet",
|
|
863
|
+
"CSSRule",
|
|
864
|
+
"CSSGroupingRule",
|
|
865
|
+
"CSSStyleRule",
|
|
866
|
+
"CSSConditionRule",
|
|
867
|
+
"CSSMediaRule",
|
|
868
|
+
"MediaQueryList",
|
|
869
|
+
"AbortController",
|
|
870
|
+
"AbortSignal"
|
|
224
871
|
];
|
|
225
872
|
// Annotate the CommonJS export names for ESM import in node:
|
|
226
873
|
0 && (module.exports = {
|
|
@@ -69,19 +69,21 @@ function codeBlockDetect(arg) {
|
|
|
69
69
|
const filePathOfOld = (0, import_path.join)(process.cwd(), "..", "source", filePath);
|
|
70
70
|
const { mapFileLineToNodeSet: mapFileLineToNodeSetOld } = (0, import_getAstKitByFilePath.default)(filePathOfOld, absPathPrefix);
|
|
71
71
|
const programNode = mapUuidToNode.get("Program");
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
lastReport
|
|
83
|
-
|
|
84
|
-
|
|
72
|
+
if (programNode) {
|
|
73
|
+
const lineNumberStartNew = Number(startLineOfNew);
|
|
74
|
+
const lineNumberEndNew = lineNumberStartNew + items.filter((item) => item.startsWith("+")).length - 1;
|
|
75
|
+
const lineNumberStartOld = Number(startLineOfOld);
|
|
76
|
+
const lineNumberEndOld = lineNumberStartOld + items.filter((item) => item.startsWith("-")).length - 1;
|
|
77
|
+
const addNodes = import_AstUtil.default.getTopScopeNodesByLineNumberRange(mapFileLineToNodeSet, lineNumberStartNew, lineNumberEndNew);
|
|
78
|
+
const removeNodes = import_AstUtil.default.getTopScopeNodesByLineNumberRange(mapFileLineToNodeSetOld, lineNumberStartOld, lineNumberEndOld);
|
|
79
|
+
iterateNodes(addNodes, "add", { blockReports, programNode });
|
|
80
|
+
iterateNodes(removeNodes, "remove", { blockReports, programNode });
|
|
81
|
+
const lastReport = blockReports.at(-1);
|
|
82
|
+
if (lastReport) {
|
|
83
|
+
lastReport.diff_txt = items;
|
|
84
|
+
lastReport.topAdded = addNodes;
|
|
85
|
+
lastReport.topRemoved = removeNodes;
|
|
86
|
+
}
|
|
85
87
|
}
|
|
86
88
|
blockReports.push(createBlockReport("Never"));
|
|
87
89
|
}
|
|
@@ -34,10 +34,10 @@ function reportItemToMd(report) {
|
|
|
34
34
|
const { filePath, filesDependsOnMe, type, dangerIdentifiers, blockReports } = report;
|
|
35
35
|
return [
|
|
36
36
|
`## ${filePath}`,
|
|
37
|
-
|
|
38
|
-
filesDependsOnMe.length > 0 ?
|
|
39
|
-
...filesDependsOnMe.map((file
|
|
40
|
-
dangerIdentifiers.length > 0 ?
|
|
37
|
+
`### 类型: ${mapReportType[type]}`,
|
|
38
|
+
filesDependsOnMe.length > 0 ? `### 依赖${filePath}的文件` : "",
|
|
39
|
+
...filesDependsOnMe.map((file) => `- ${file}`),
|
|
40
|
+
dangerIdentifiers.length > 0 ? `### 重点检查使用的变量` : "",
|
|
41
41
|
dangerIdentifiers.length > 0 ? `> ${dangerIdentifiers.join(", ")}` : "",
|
|
42
42
|
blockReports.length > 0 ? `### 代码块分析` : "",
|
|
43
43
|
...blockReports.map(blockReportToMd)
|
|
@@ -37,6 +37,9 @@ var import_AstUtil = __toESM(require("../ast_util/AstUtil"));
|
|
|
37
37
|
function fileIdentifierDetect(filePath, absPathPrefix) {
|
|
38
38
|
const { mapUuidToNode } = (0, import_getAstKitByFilePath.default)(filePath, absPathPrefix);
|
|
39
39
|
const programNode = mapUuidToNode.get("Program");
|
|
40
|
+
if (!programNode) {
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
40
43
|
const { dependenceIds } = programNode._util;
|
|
41
44
|
const ids = [...dependenceIds].filter((id) => {
|
|
42
45
|
return import_AstUtil.default.isUntrackedId(id) || id._util.crossScope.size > 0;
|
|
@@ -31,7 +31,7 @@ export declare function createDetectReport(arg: Arg): {
|
|
|
31
31
|
kind: "Import" | "Declaration" | "Assignment" | "SelfUpdate" | "Invoke" | "Other" | "Never";
|
|
32
32
|
}[];
|
|
33
33
|
filePath: string;
|
|
34
|
-
type: "add" | "
|
|
34
|
+
type: "add" | "modify" | "delete";
|
|
35
35
|
filesDependsOnMe: string[];
|
|
36
36
|
dangerIdentifiers: string[];
|
|
37
37
|
}[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "js-code-detector",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"types": "dist/cjs/index.d.ts",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
],
|
|
23
23
|
"bin": {
|
|
24
24
|
"detect": "bin/detect.js",
|
|
25
|
+
"gitDiffDetect": "bin/gitDiffDetect.js",
|
|
25
26
|
"sameCodeDetect": "bin/sameCodeDetect.js"
|
|
26
27
|
},
|
|
27
28
|
"publishConfig": {
|