js-code-detector 0.0.10 → 0.0.12
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 +37 -4
- package/dist/cjs/util/ast_util/windowProperties.js +648 -1
- package/dist/cjs/util/report_util/code_block_detect.d.ts +2 -0
- package/dist/cjs/util/report_util/code_block_detect.js +52 -54
- package/dist/cjs/util/report_util/createMdByJson.js +21 -15
- package/dist/cjs/util/report_util/getFileDepends.d.ts +1 -0
- package/dist/cjs/util/report_util/getFileDepends.js +38 -0
- package/dist/cjs/util/report_util.d.ts +3 -2
- package/dist/cjs/util/report_util.js +4 -4
- 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
|
|
@@ -61,6 +62,7 @@ async function umiPluginCallback(api) {
|
|
|
61
62
|
const usingFileNoPrefix = usingFiles.map((item) => item.filePath.replace(absPathPrefix, ""));
|
|
62
63
|
const groupGitDiffLines = gitDiffDetail.filter((item) => usingFileNoPrefix.includes(item.filePath));
|
|
63
64
|
const reports = (0, import_report_util.createDetectReport)({ groupGitDiffLines, tree, absPathPrefix });
|
|
65
|
+
(0, import_fs2.writeFileSync)((0, import_path.join)(api.cwd, "reports.json"), JSON.stringify(reports, null, 2), { encoding: "utf-8", flag: "w" });
|
|
64
66
|
const mdContent = (0, import_createMdByJson.createMdByJson)(reports);
|
|
65
67
|
(0, import_fs2.writeFileSync)((0, import_path.join)(api.cwd, jsonName), mdContent, { encoding: "utf-8", flag: "w" });
|
|
66
68
|
}
|
|
@@ -82,14 +84,14 @@ git clone $1 source
|
|
|
82
84
|
`;
|
|
83
85
|
var pluginFileContent = `import * as cb from "js-code-detector"
|
|
84
86
|
|
|
85
|
-
export default async (api) => {
|
|
87
|
+
export default async (api: any) => {
|
|
86
88
|
const buildCallback = () => cb.umiPluginCallback(api);
|
|
87
89
|
api.onBuildComplete(buildCallback);
|
|
88
90
|
}`;
|
|
89
91
|
async function writeGitDiffTxt(gitUrl, branchName) {
|
|
90
92
|
const today = (0, import_dayjs.default)().format("YYYYMDD");
|
|
91
93
|
(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" });
|
|
94
|
+
await import_utils.execa.execa("chmod +x detect.sh", { shell: "/bin/bash" });
|
|
93
95
|
const res0 = await import_utils.execa.execa("sh detect.sh", [gitUrl, branchName], { shell: "/bin/bash" });
|
|
94
96
|
import_utils.chalk.green(["临时文件夹建立,源代码clone完成"]);
|
|
95
97
|
(0, import_fs2.writeFileSync)((0, import_path.join)(process.cwd(), today, "target", "plugin.ts"), pluginFileContent, { encoding: "utf-8", flag: "w" });
|
|
@@ -108,8 +110,8 @@ async function getGitRepositoryAndBranch() {
|
|
|
108
110
|
branchName: branch.stdout
|
|
109
111
|
};
|
|
110
112
|
}
|
|
111
|
-
function generateReport(
|
|
112
|
-
(0, import_fs2.writeFileSync)((0, import_path.join)(process.cwd(), `${(0, import_dayjs.default)().format("YYYYMDD_HHmm")}_${jsonName}`),
|
|
113
|
+
function generateReport(content) {
|
|
114
|
+
(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
115
|
}
|
|
114
116
|
async function sameCodeDetect(dirOfCwd) {
|
|
115
117
|
const filesAndContent = await (0, import_readDirFiles.readSrcFiles)(dirOfCwd);
|
|
@@ -120,10 +122,41 @@ async function sameCodeDetect(dirOfCwd) {
|
|
|
120
122
|
const md = import_Core.default.createMarkdownFile(validContentList);
|
|
121
123
|
(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
124
|
}
|
|
125
|
+
async function gitDiffDetect() {
|
|
126
|
+
const today = (0, import_dayjs.default)().format("YYYYMDD");
|
|
127
|
+
const { gitUrl, branchName } = await getGitRepositoryAndBranch();
|
|
128
|
+
import_utils.logger.ready("准备生成临时工作目录...");
|
|
129
|
+
await import_utils.execa.execa(`mkdir -p ${today}`, { shell: "/bin/bash" });
|
|
130
|
+
import_utils.logger.info("临时目录建立完成");
|
|
131
|
+
import_utils.logger.ready("准备clone源代码到临时目录下的target文件夹");
|
|
132
|
+
await import_utils.execa.execa(`git clone ${gitUrl} ${today}/target`, { shell: "/bin/bash" });
|
|
133
|
+
import_utils.logger.info("源代码clone完成");
|
|
134
|
+
import_utils.logger.ready("准备clone源代码到临时目录下的source文件夹");
|
|
135
|
+
await import_utils.execa.execa(`git clone ${gitUrl} ${today}/source`, { shell: "/bin/bash" });
|
|
136
|
+
import_utils.logger.info("源代码clone完成");
|
|
137
|
+
import_utils.logger.ready("准备切换到目标分支");
|
|
138
|
+
await import_utils.execa.execa(`cd ${today}/target && git fetch origin ${branchName}:${branchName} && git checkout ${branchName}`, { shell: "/bin/bash" });
|
|
139
|
+
import_utils.logger.info("分支切换完成");
|
|
140
|
+
import_utils.logger.ready("准备生成git_diff.txt文件");
|
|
141
|
+
await import_utils.execa.execa(`cd ${today}/target && git diff master..${branchName} --unified=0 --output=git_diff.txt`, { shell: "/bin/bash" });
|
|
142
|
+
import_utils.logger.info("git_diff.txt文件生成完成");
|
|
143
|
+
import_utils.logger.ready("准备生成插件文件");
|
|
144
|
+
(0, import_fs2.writeFileSync)((0, import_path.join)(process.cwd(), today, "target", "plugin.ts"), pluginFileContent, { encoding: "utf-8", flag: "w" });
|
|
145
|
+
import_utils.logger.info("插件文件生成完成");
|
|
146
|
+
import_utils.logger.ready("准备生成报告");
|
|
147
|
+
await import_utils.execa.execa(`cd ${today}/target && yarn install && npm run build`, { shell: "/bin/bash" });
|
|
148
|
+
import_utils.logger.info("报告生成完成!");
|
|
149
|
+
import_utils.logger.ready("准备移动报告");
|
|
150
|
+
const content = (0, import_fs.readFileSync)((0, import_path.join)(process.cwd(), today, "target", jsonName), "utf-8");
|
|
151
|
+
const mdFileName = `${(0, import_dayjs.default)().format("YYYYMDD_HHmm")}_${jsonName}`;
|
|
152
|
+
(0, import_fs2.writeFileSync)((0, import_path.join)(process.cwd(), mdFileName), content, { encoding: "utf-8", flag: "w" });
|
|
153
|
+
import_utils.logger.info("报告完成: " + mdFileName);
|
|
154
|
+
}
|
|
123
155
|
// Annotate the CommonJS export names for ESM import in node:
|
|
124
156
|
0 && (module.exports = {
|
|
125
157
|
generateReport,
|
|
126
158
|
getGitRepositoryAndBranch,
|
|
159
|
+
gitDiffDetect,
|
|
127
160
|
sameCodeDetect,
|
|
128
161
|
umiPluginCallback,
|
|
129
162
|
writeGitDiffTxt
|
|
@@ -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 = {
|
|
@@ -6,6 +6,7 @@ type EffectItem = {
|
|
|
6
6
|
effects: AstNode[];
|
|
7
7
|
};
|
|
8
8
|
export type BlockReport = {
|
|
9
|
+
index: number;
|
|
9
10
|
kind: BlockReportKind;
|
|
10
11
|
diff_txt: string[];
|
|
11
12
|
topAdded: AstNode[];
|
|
@@ -22,6 +23,7 @@ type Arg = {
|
|
|
22
23
|
gitDiffItem: GitDiffDetail;
|
|
23
24
|
absPathPrefix: string;
|
|
24
25
|
blockReports: BlockReport[];
|
|
26
|
+
index: number;
|
|
25
27
|
};
|
|
26
28
|
export default function codeBlockDetect(arg: Arg): void;
|
|
27
29
|
export {};
|
|
@@ -35,7 +35,8 @@ module.exports = __toCommonJS(code_block_detect_exports);
|
|
|
35
35
|
var import_path = require("path");
|
|
36
36
|
var import_getAstKitByFilePath = __toESM(require("../ast_util/getAstKitByFilePath"));
|
|
37
37
|
var import_AstUtil = __toESM(require("../ast_util/AstUtil"));
|
|
38
|
-
var createBlockReport = (kind) => ({
|
|
38
|
+
var createBlockReport = (kind, index) => ({
|
|
39
|
+
index,
|
|
39
40
|
kind,
|
|
40
41
|
diff_txt: [],
|
|
41
42
|
topAdded: [],
|
|
@@ -48,22 +49,19 @@ var createBlockReport = (kind) => ({
|
|
|
48
49
|
removedStillUsing: [],
|
|
49
50
|
removedEffects: []
|
|
50
51
|
});
|
|
51
|
-
var findOrCreateBlockReport = (blockReports, kind,
|
|
52
|
-
var _a
|
|
53
|
-
if (
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
52
|
+
var findOrCreateBlockReport = (blockReports, kind, index) => {
|
|
53
|
+
var _a;
|
|
54
|
+
if (((_a = blockReports.at(-1)) == null ? void 0 : _a.index) === index) {
|
|
55
|
+
const res = blockReports.at(-1);
|
|
56
|
+
if (res.kind !== kind) {
|
|
57
|
+
res.kind = `${res.kind} | ${kind}`;
|
|
58
58
|
}
|
|
59
|
+
return res;
|
|
59
60
|
}
|
|
60
|
-
|
|
61
|
-
return blockReports.at(-1);
|
|
62
|
-
}
|
|
63
|
-
return createBlockReport(kind);
|
|
61
|
+
return createBlockReport(kind, index);
|
|
64
62
|
};
|
|
65
63
|
function codeBlockDetect(arg) {
|
|
66
|
-
const { gitDiffItem, absPathPrefix, blockReports } = arg;
|
|
64
|
+
const { gitDiffItem, absPathPrefix, blockReports, index } = arg;
|
|
67
65
|
const { filePath, startLineOfNew, items, startLineOfOld } = gitDiffItem;
|
|
68
66
|
const { mapFileLineToNodeSet, mapUuidToNode } = (0, import_getAstKitByFilePath.default)(filePath, absPathPrefix);
|
|
69
67
|
const filePathOfOld = (0, import_path.join)(process.cwd(), "..", "source", filePath);
|
|
@@ -76,8 +74,8 @@ function codeBlockDetect(arg) {
|
|
|
76
74
|
const lineNumberEndOld = lineNumberStartOld + items.filter((item) => item.startsWith("-")).length - 1;
|
|
77
75
|
const addNodes = import_AstUtil.default.getTopScopeNodesByLineNumberRange(mapFileLineToNodeSet, lineNumberStartNew, lineNumberEndNew);
|
|
78
76
|
const removeNodes = import_AstUtil.default.getTopScopeNodesByLineNumberRange(mapFileLineToNodeSetOld, lineNumberStartOld, lineNumberEndOld);
|
|
79
|
-
iterateNodes(addNodes, "add", { blockReports, programNode });
|
|
80
|
-
iterateNodes(removeNodes, "remove", { blockReports, programNode });
|
|
77
|
+
iterateNodes(addNodes, "add", { blockReports, programNode }, index);
|
|
78
|
+
iterateNodes(removeNodes, "remove", { blockReports, programNode }, index);
|
|
81
79
|
const lastReport = blockReports.at(-1);
|
|
82
80
|
if (lastReport) {
|
|
83
81
|
lastReport.diff_txt = items;
|
|
@@ -85,7 +83,7 @@ function codeBlockDetect(arg) {
|
|
|
85
83
|
lastReport.topRemoved = removeNodes;
|
|
86
84
|
}
|
|
87
85
|
}
|
|
88
|
-
blockReports.push(createBlockReport("Never"));
|
|
86
|
+
blockReports.push(createBlockReport("Never", NaN));
|
|
89
87
|
}
|
|
90
88
|
function getPathsOfNode(topScopeNodes) {
|
|
91
89
|
const paths = [];
|
|
@@ -108,19 +106,19 @@ function filterBySamePathAndLen(list, sameEffectsPaths) {
|
|
|
108
106
|
function extractEffectItem(list) {
|
|
109
107
|
return list.map((e) => ({ ...e, effects: e.effects.map((item) => item.ele) }));
|
|
110
108
|
}
|
|
111
|
-
function pushBlockReport(blockReports, blockReport, programNode) {
|
|
112
|
-
const sameNames = blockReport.added.filter((path) => blockReport.removed.includes(path));
|
|
113
|
-
if (sameNames.length) {
|
|
114
|
-
["added", "removed"].forEach((key) => {
|
|
115
|
-
blockReport[key] = blockReport[key].filter((path) => !sameNames.includes(path));
|
|
116
|
-
});
|
|
117
|
-
}
|
|
109
|
+
function pushBlockReport(blockReports, blockReport, programNode, index) {
|
|
118
110
|
if (blockReport.kind.startsWith("Other:")) {
|
|
119
111
|
["added", "removed"].forEach((key) => {
|
|
120
112
|
const tailElements = blockReport[key].map((ele) => ele.split(":").at(-1)).filter(Boolean);
|
|
121
113
|
blockReport[key] = [...new Set(tailElements)];
|
|
122
114
|
});
|
|
123
115
|
}
|
|
116
|
+
const sameNames = blockReport.added.filter((path) => blockReport.removed.includes(path));
|
|
117
|
+
if (sameNames.length) {
|
|
118
|
+
["added", "removed"].forEach((key) => {
|
|
119
|
+
blockReport[key] = blockReport[key].filter((path) => !sameNames.includes(path));
|
|
120
|
+
});
|
|
121
|
+
}
|
|
124
122
|
const addedEffectsList = mapNodePath(blockReport.addedEffects);
|
|
125
123
|
const removedEffectsList = mapNodePath(blockReport.removedEffects);
|
|
126
124
|
const addedEffectsPaths = addedEffectsList.map((item) => item.effects.map(({ path }) => path)).flat();
|
|
@@ -132,44 +130,44 @@ function pushBlockReport(blockReports, blockReport, programNode) {
|
|
|
132
130
|
blockReport.addedEffects = extractEffectItem(addedEffects);
|
|
133
131
|
blockReport.removedEffects = extractEffectItem(removedEffects);
|
|
134
132
|
}
|
|
135
|
-
if (!blockReports.includes(blockReport)
|
|
133
|
+
if (!blockReports.includes(blockReport)) {
|
|
136
134
|
blockReports.push(blockReport);
|
|
137
135
|
}
|
|
138
136
|
}
|
|
139
|
-
function iterateNodes(topScopeNodes, operation, extra) {
|
|
137
|
+
function iterateNodes(topScopeNodes, operation, extra, index) {
|
|
140
138
|
for (const topScopeNode of topScopeNodes) {
|
|
141
139
|
if (["ImportDeclaration", "ImportSpecifier", "ImportDefaultSpecifier"].includes(topScopeNode.type)) {
|
|
142
|
-
detectImport({ topScopeNode, operation, extra });
|
|
140
|
+
detectImport({ topScopeNode, operation, extra }, index);
|
|
143
141
|
} else if (["VariableDeclaration", "VariableDeclarator"].includes(topScopeNode.type) || import_AstUtil.default.isSubNodeOfVariableDeclarator(topScopeNode)) {
|
|
144
|
-
detectVariableDeclaration({ topScopeNode, operation, extra });
|
|
142
|
+
detectVariableDeclaration({ topScopeNode, operation, extra }, index);
|
|
145
143
|
} else if (["FunctionDeclaration", "ClassDeclaration"].includes(topScopeNode.type)) {
|
|
146
|
-
detectFnClsDeclaration({ topScopeNode, operation, extra });
|
|
144
|
+
detectFnClsDeclaration({ topScopeNode, operation, extra }, index);
|
|
147
145
|
} else if (["UnaryExpression", "UpdateExpression"].includes(topScopeNode.type)) {
|
|
148
|
-
detectUpdateEffectExp({ topScopeNode, operation, extra });
|
|
146
|
+
detectUpdateEffectExp({ topScopeNode, operation, extra }, index);
|
|
149
147
|
} else if (["CallExpression"].includes(topScopeNode.type)) {
|
|
150
|
-
detectFnCallExp({ topScopeNode, operation, extra });
|
|
148
|
+
detectFnCallExp({ topScopeNode, operation, extra }, index);
|
|
151
149
|
} else if (["AssignmentExpression"].includes(topScopeNode.type)) {
|
|
152
|
-
detectAssignmentEffectExp({ topScopeNode, operation, extra });
|
|
150
|
+
detectAssignmentEffectExp({ topScopeNode, operation, extra }, index);
|
|
153
151
|
} else if (["ExpressionStatement"].includes(topScopeNode.type)) {
|
|
154
152
|
const { expression } = topScopeNode;
|
|
155
|
-
iterateNodes([expression], operation, extra);
|
|
153
|
+
iterateNodes([expression], operation, extra, index);
|
|
156
154
|
} else {
|
|
157
|
-
detectOther({ topScopeNode, operation, extra });
|
|
155
|
+
detectOther({ topScopeNode, operation, extra }, index);
|
|
158
156
|
}
|
|
159
157
|
}
|
|
160
158
|
}
|
|
161
|
-
function detectOther(arg) {
|
|
159
|
+
function detectOther(arg, index) {
|
|
162
160
|
const { topScopeNode, operation, extra: { blockReports, programNode } } = arg;
|
|
163
|
-
const blockReport = findOrCreateBlockReport(blockReports, "Other");
|
|
161
|
+
const blockReport = findOrCreateBlockReport(blockReports, "Other", index);
|
|
164
162
|
const { added, removed } = blockReport;
|
|
165
163
|
const nodePaths = getPathsOfNode(topScopeNode._util.nodeCollection);
|
|
166
164
|
(operation === "add" ? added : removed).push(...nodePaths);
|
|
167
165
|
blockReport.kind = "Other:" + topScopeNode.type;
|
|
168
|
-
pushBlockReport(blockReports, blockReport, programNode);
|
|
166
|
+
pushBlockReport(blockReports, blockReport, programNode, index);
|
|
169
167
|
}
|
|
170
|
-
function detectImport(arg) {
|
|
168
|
+
function detectImport(arg, index) {
|
|
171
169
|
const { topScopeNode, operation, extra: { blockReports, programNode } } = arg;
|
|
172
|
-
const blockReport = findOrCreateBlockReport(blockReports, "Import");
|
|
170
|
+
const blockReport = findOrCreateBlockReport(blockReports, "Import", index);
|
|
173
171
|
const { added, removed, addedEffects, removedEffects } = blockReport;
|
|
174
172
|
const specifiers = topScopeNode.type === "ImportDeclaration" ? topScopeNode.specifiers : [topScopeNode];
|
|
175
173
|
if (Array.isArray(specifiers)) {
|
|
@@ -179,23 +177,23 @@ function detectImport(arg) {
|
|
|
179
177
|
(operation === "add" ? addedEffects : removedEffects).push({ causeBy: local, effects: [...local._util.effectIds] });
|
|
180
178
|
});
|
|
181
179
|
}
|
|
182
|
-
pushBlockReport(blockReports, blockReport, programNode);
|
|
180
|
+
pushBlockReport(blockReports, blockReport, programNode, index);
|
|
183
181
|
}
|
|
184
|
-
function detectFnClsDeclaration(arg) {
|
|
182
|
+
function detectFnClsDeclaration(arg, index) {
|
|
185
183
|
const { topScopeNode, operation, extra: { blockReports, programNode } } = arg;
|
|
186
|
-
const blockReport = findOrCreateBlockReport(blockReports, "Declaration");
|
|
184
|
+
const blockReport = findOrCreateBlockReport(blockReports, "Declaration", index);
|
|
187
185
|
const { added, removed, addedEffects, removedEffects } = blockReport;
|
|
188
186
|
const { id } = topScopeNode;
|
|
189
187
|
(operation === "add" ? added : removed).push(id.name);
|
|
190
188
|
(operation === "add" ? addedEffects : removedEffects).push({ causeBy: id, effects: [...id._util.effectIds] });
|
|
191
|
-
pushBlockReport(blockReports, blockReport, programNode);
|
|
189
|
+
pushBlockReport(blockReports, blockReport, programNode, index);
|
|
192
190
|
}
|
|
193
191
|
function insertPrefix(n, prefix, sep = ":") {
|
|
194
192
|
return [prefix, n].join(sep);
|
|
195
193
|
}
|
|
196
|
-
function detectVariableDeclaration(arg) {
|
|
194
|
+
function detectVariableDeclaration(arg, index) {
|
|
197
195
|
const { topScopeNode, operation, extra: { blockReports, programNode } } = arg;
|
|
198
|
-
const blockReport = findOrCreateBlockReport(blockReports, "Declaration");
|
|
196
|
+
const blockReport = findOrCreateBlockReport(blockReports, "Declaration", index);
|
|
199
197
|
const { added, removed, addedEffects, removedEffects } = blockReport;
|
|
200
198
|
if (["VariableDeclaration", "VariableDeclarator"].includes(topScopeNode.type)) {
|
|
201
199
|
let declarations = [];
|
|
@@ -232,11 +230,11 @@ function detectVariableDeclaration(arg) {
|
|
|
232
230
|
}
|
|
233
231
|
});
|
|
234
232
|
}
|
|
235
|
-
pushBlockReport(blockReports, blockReport, programNode);
|
|
233
|
+
pushBlockReport(blockReports, blockReport, programNode, index);
|
|
236
234
|
}
|
|
237
|
-
function detectUpdateEffectExp(arg) {
|
|
235
|
+
function detectUpdateEffectExp(arg, index) {
|
|
238
236
|
const { topScopeNode, operation, extra: { blockReports, programNode } } = arg;
|
|
239
|
-
const blockReport = findOrCreateBlockReport(blockReports, "SelfUpdate");
|
|
237
|
+
const blockReport = findOrCreateBlockReport(blockReports, "SelfUpdate", index);
|
|
240
238
|
const { added, removed, addedEffects, removedEffects } = blockReport;
|
|
241
239
|
const { argument: args } = topScopeNode;
|
|
242
240
|
const createdExpIdSet = /* @__PURE__ */ new Set();
|
|
@@ -245,11 +243,11 @@ function detectUpdateEffectExp(arg) {
|
|
|
245
243
|
(operation === "add" ? added : removed).push(createdExpId.name);
|
|
246
244
|
(operation === "add" ? addedEffects : removedEffects).push({ causeBy: createdExpId, effects: [...createdExpId._util.effectIds] });
|
|
247
245
|
}
|
|
248
|
-
pushBlockReport(blockReports, blockReport, programNode);
|
|
246
|
+
pushBlockReport(blockReports, blockReport, programNode, index);
|
|
249
247
|
}
|
|
250
|
-
function detectFnCallExp(arg) {
|
|
248
|
+
function detectFnCallExp(arg, index) {
|
|
251
249
|
const { topScopeNode, operation, extra: { blockReports, programNode } } = arg;
|
|
252
|
-
const blockReport = findOrCreateBlockReport(blockReports, "Invoke");
|
|
250
|
+
const blockReport = findOrCreateBlockReport(blockReports, "Invoke", index);
|
|
253
251
|
const { added, removed, addedEffects, removedEffects } = blockReport;
|
|
254
252
|
const { callee, arguments: args } = topScopeNode;
|
|
255
253
|
const argsIds = args.map((arg2) => arg2._util.nodeCollection.filter((n) => n.type === "Identifier")).flat();
|
|
@@ -263,11 +261,11 @@ function detectFnCallExp(arg) {
|
|
|
263
261
|
(operation === "add" ? added : removed).push(createdExpId.name);
|
|
264
262
|
(operation === "add" ? addedEffects : removedEffects).push({ causeBy: createdExpId, effects: [...createdExpId._util.effectIds] });
|
|
265
263
|
}
|
|
266
|
-
pushBlockReport(blockReports, blockReport, programNode);
|
|
264
|
+
pushBlockReport(blockReports, blockReport, programNode, index);
|
|
267
265
|
}
|
|
268
|
-
function detectAssignmentEffectExp(arg) {
|
|
266
|
+
function detectAssignmentEffectExp(arg, index) {
|
|
269
267
|
const { topScopeNode, operation, extra: { blockReports, programNode } } = arg;
|
|
270
|
-
const blockReport = findOrCreateBlockReport(blockReports, "Assignment");
|
|
268
|
+
const blockReport = findOrCreateBlockReport(blockReports, "Assignment", index);
|
|
271
269
|
const { added, removed, addedEffects, removedEffects } = blockReport;
|
|
272
270
|
const { left, right } = topScopeNode;
|
|
273
271
|
const idSetLeft = /* @__PURE__ */ new Set();
|
|
@@ -281,5 +279,5 @@ function detectAssignmentEffectExp(arg) {
|
|
|
281
279
|
for (const createdExp of idSetRight) {
|
|
282
280
|
(operation === "add" ? added : removed).push(insertPrefix(createdExp.name, "right"));
|
|
283
281
|
}
|
|
284
|
-
pushBlockReport(blockReports, blockReport, programNode);
|
|
282
|
+
pushBlockReport(blockReports, blockReport, programNode, index);
|
|
285
283
|
}
|
|
@@ -28,22 +28,26 @@ var mapReportType = {
|
|
|
28
28
|
delete: "删除"
|
|
29
29
|
};
|
|
30
30
|
function createMdByJson(report) {
|
|
31
|
-
|
|
31
|
+
const allFiles = `# 文件汇总
|
|
32
|
+
${report.map((r) => `- ${r.filePath}`).join("\n")}
|
|
33
|
+
|
|
34
|
+
`;
|
|
35
|
+
return allFiles + report.map(reportItemToMd).join("\n\n\n");
|
|
32
36
|
}
|
|
33
37
|
function reportItemToMd(report) {
|
|
34
38
|
const { filePath, filesDependsOnMe, type, dangerIdentifiers, blockReports } = report;
|
|
35
39
|
return [
|
|
36
40
|
`## ${filePath}`,
|
|
37
41
|
`### 类型: ${mapReportType[type]}`,
|
|
38
|
-
filesDependsOnMe.length > 0 ? `###
|
|
39
|
-
|
|
40
|
-
dangerIdentifiers.length > 0 ? `###
|
|
41
|
-
|
|
42
|
-
blockReports.length > 0 ? `###
|
|
42
|
+
filesDependsOnMe.length > 0 ? `### 所影响的文件
|
|
43
|
+
${filesDependsOnMe.map((files) => `- ${files.join("、")}`).join("\n")}` : "",
|
|
44
|
+
dangerIdentifiers.length > 0 ? `### 重点检查使用的变量
|
|
45
|
+
> ${dangerIdentifiers.join(", ")}` : "",
|
|
46
|
+
blockReports.length > 0 ? `### 对比分析 共${blockReports.length}处` : "",
|
|
43
47
|
...blockReports.map(blockReportToMd)
|
|
44
48
|
].filter(Boolean).join("\n\n");
|
|
45
49
|
}
|
|
46
|
-
function blockReportToMd(block) {
|
|
50
|
+
function blockReportToMd(block, index) {
|
|
47
51
|
const {
|
|
48
52
|
kind,
|
|
49
53
|
diff_txt,
|
|
@@ -53,17 +57,19 @@ function blockReportToMd(block) {
|
|
|
53
57
|
removedEffects
|
|
54
58
|
} = block;
|
|
55
59
|
return [
|
|
56
|
-
|
|
57
|
-
`- 原始diff
|
|
58
|
-
|
|
60
|
+
`### 对比${index + 1}分析`,
|
|
61
|
+
`- 原始diff内容
|
|
62
|
+
\`\`\`txt
|
|
59
63
|
${diff_txt.join("\n")}
|
|
60
64
|
\`\`\``,
|
|
61
|
-
|
|
62
|
-
added.length > 0 ?
|
|
63
|
-
|
|
65
|
+
`#### 修改分类: ${kind}`,
|
|
66
|
+
added.length > 0 ? `- 新增标识符
|
|
67
|
+
> ${added.join(", ")}` : "",
|
|
68
|
+
addedEffects.length > 0 ? `- 新增标识符影响
|
|
69
|
+
` : "",
|
|
64
70
|
addedEffects.map(({ causeBy, effects }) => `> ${causeBy}相关: ${effects.join()}`).join("\n\n"),
|
|
65
|
-
removed.length > 0 ? `-
|
|
66
|
-
|
|
71
|
+
removed.length > 0 ? `- 删除标识符
|
|
72
|
+
> ${removed.join(", ")}` : "",
|
|
67
73
|
removedEffects.length > 0 ? `- 删除标识符影响` : "",
|
|
68
74
|
removedEffects.map(({ causeBy, effects }) => `> ${causeBy}相关: ${effects.join()}`).join("\n\n")
|
|
69
75
|
].filter(Boolean).join("\n\n");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function getFileDepends(filePath: string, tree: Record<string, string[]>): string[][];
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/util/report_util/getFileDepends.ts
|
|
20
|
+
var getFileDepends_exports = {};
|
|
21
|
+
__export(getFileDepends_exports, {
|
|
22
|
+
default: () => getFileDepends
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(getFileDepends_exports);
|
|
25
|
+
function getFileDepends(filePath, tree) {
|
|
26
|
+
const res = [];
|
|
27
|
+
getFileDependsRecursive(res, [filePath], Object.entries(tree), 2);
|
|
28
|
+
return res;
|
|
29
|
+
}
|
|
30
|
+
function getFileDependsRecursive(res, filePaths, treeEntries, maxTry) {
|
|
31
|
+
const depends = filePaths.map((f) => treeEntries.filter((entry) => entry[1].includes(f)).map((e) => e[0])).flat();
|
|
32
|
+
if (depends.length > 0) {
|
|
33
|
+
res.push(depends);
|
|
34
|
+
if (maxTry === 0)
|
|
35
|
+
return;
|
|
36
|
+
getFileDependsRecursive(res, depends, treeEntries, maxTry - 1);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -3,7 +3,7 @@ import { BlockReport } from "./report_util/code_block_detect";
|
|
|
3
3
|
export type DetectReport = {
|
|
4
4
|
filePath: string;
|
|
5
5
|
type: "modify" | "add" | "delete";
|
|
6
|
-
filesDependsOnMe: string[];
|
|
6
|
+
filesDependsOnMe: string[][];
|
|
7
7
|
dangerIdentifiers: string[];
|
|
8
8
|
blockReports: BlockReport[];
|
|
9
9
|
};
|
|
@@ -22,6 +22,7 @@ export declare function createDetectReport(arg: Arg): {
|
|
|
22
22
|
causeBy: string;
|
|
23
23
|
effects: (string | undefined)[];
|
|
24
24
|
}[];
|
|
25
|
+
index: number;
|
|
25
26
|
diff_txt: string[];
|
|
26
27
|
added: string[];
|
|
27
28
|
addedNotUsed: string[];
|
|
@@ -32,7 +33,7 @@ export declare function createDetectReport(arg: Arg): {
|
|
|
32
33
|
}[];
|
|
33
34
|
filePath: string;
|
|
34
35
|
type: "add" | "modify" | "delete";
|
|
35
|
-
filesDependsOnMe: string[];
|
|
36
|
+
filesDependsOnMe: string[][];
|
|
36
37
|
dangerIdentifiers: string[];
|
|
37
38
|
}[];
|
|
38
39
|
export {};
|
|
@@ -36,13 +36,13 @@ var import_code_block_detect = __toESM(require("./report_util/code_block_detect"
|
|
|
36
36
|
var import_getAstKitByFilePath = __toESM(require("./ast_util/getAstKitByFilePath"));
|
|
37
37
|
var import_AstUtil = __toESM(require("./ast_util/AstUtil"));
|
|
38
38
|
var import_file_identifier_detect = require("./report_util/file_identifier_detect");
|
|
39
|
+
var import_getFileDepends = __toESM(require("./report_util/getFileDepends"));
|
|
39
40
|
function createDetectReport(arg) {
|
|
40
41
|
const { groupGitDiffLines, tree, absPathPrefix } = arg;
|
|
41
42
|
const reports = [];
|
|
42
|
-
|
|
43
|
-
groupGitDiffLines.forEach((item) => {
|
|
43
|
+
groupGitDiffLines.forEach((item, index) => {
|
|
44
44
|
const { filePath, type } = item;
|
|
45
|
-
const filesDependsOnMe =
|
|
45
|
+
const filesDependsOnMe = (0, import_getFileDepends.default)(filePath, tree);
|
|
46
46
|
let reportItem = reports.find((e) => e.filePath === filePath);
|
|
47
47
|
if (!reportItem) {
|
|
48
48
|
reportItem = {
|
|
@@ -56,7 +56,7 @@ function createDetectReport(arg) {
|
|
|
56
56
|
}
|
|
57
57
|
reportItem.dangerIdentifiers = (0, import_file_identifier_detect.fileIdentifierDetect)(filePath, absPathPrefix);
|
|
58
58
|
if (type === "modify") {
|
|
59
|
-
(0, import_code_block_detect.default)({ gitDiffItem: item, absPathPrefix, blockReports: reportItem.blockReports });
|
|
59
|
+
(0, import_code_block_detect.default)({ gitDiffItem: item, absPathPrefix, blockReports: reportItem.blockReports, index });
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
62
|
return reports.map((report) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "js-code-detector",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
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": {
|