js-code-detector 0.0.11 → 0.0.13

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/dist/cjs/index.js CHANGED
@@ -62,6 +62,7 @@ async function umiPluginCallback(api) {
62
62
  const usingFileNoPrefix = usingFiles.map((item) => item.filePath.replace(absPathPrefix, ""));
63
63
  const groupGitDiffLines = gitDiffDetail.filter((item) => usingFileNoPrefix.includes(item.filePath));
64
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" });
65
66
  const mdContent = (0, import_createMdByJson.createMdByJson)(reports);
66
67
  (0, import_fs2.writeFileSync)((0, import_path.join)(api.cwd, jsonName), mdContent, { encoding: "utf-8", flag: "w" });
67
68
  }
@@ -150,9 +151,6 @@ async function gitDiffDetect() {
150
151
  const mdFileName = `${(0, import_dayjs.default)().format("YYYYMDD_HHmm")}_${jsonName}`;
151
152
  (0, import_fs2.writeFileSync)((0, import_path.join)(process.cwd(), mdFileName), content, { encoding: "utf-8", flag: "w" });
152
153
  import_utils.logger.info("报告完成: " + mdFileName);
153
- (0, import_utils.rimraf)((0, import_path.join)(process.cwd(), today), () => {
154
- import_utils.logger.info("临时目录已删除");
155
- });
156
154
  }
157
155
  // Annotate the CommonJS export names for ESM import in node:
158
156
  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,12 @@ var createBlockReport = (kind) => ({
48
49
  removedStillUsing: [],
49
50
  removedEffects: []
50
51
  });
51
- var findOrCreateBlockReport = (blockReports, kind, fromHead) => {
52
- var _a, _b;
53
- if (fromHead) {
54
- for (let i = blockReports.length - 1; i >= 0; i--) {
55
- if (blockReports[i].kind === kind) {
56
- return blockReports[i];
57
- }
58
- }
59
- }
60
- if (((_a = blockReports.at(-1)) == null ? void 0 : _a.kind) === kind || kind === "Other" && ((_b = blockReports.at(-1)) == null ? void 0 : _b.kind.startsWith("Other:"))) {
61
- return blockReports.at(-1);
62
- }
63
- return createBlockReport(kind);
52
+ var findOrCreateBlockReport = (blockReports, kind, index) => {
53
+ const res = blockReports.find((item) => item.index === index && item.kind === kind);
54
+ return res || createBlockReport(kind, index);
64
55
  };
65
56
  function codeBlockDetect(arg) {
66
- const { gitDiffItem, absPathPrefix, blockReports } = arg;
57
+ const { gitDiffItem, absPathPrefix, blockReports, index } = arg;
67
58
  const { filePath, startLineOfNew, items, startLineOfOld } = gitDiffItem;
68
59
  const { mapFileLineToNodeSet, mapUuidToNode } = (0, import_getAstKitByFilePath.default)(filePath, absPathPrefix);
69
60
  const filePathOfOld = (0, import_path.join)(process.cwd(), "..", "source", filePath);
@@ -76,8 +67,8 @@ function codeBlockDetect(arg) {
76
67
  const lineNumberEndOld = lineNumberStartOld + items.filter((item) => item.startsWith("-")).length - 1;
77
68
  const addNodes = import_AstUtil.default.getTopScopeNodesByLineNumberRange(mapFileLineToNodeSet, lineNumberStartNew, lineNumberEndNew);
78
69
  const removeNodes = import_AstUtil.default.getTopScopeNodesByLineNumberRange(mapFileLineToNodeSetOld, lineNumberStartOld, lineNumberEndOld);
79
- iterateNodes(addNodes, "add", { blockReports, programNode });
80
- iterateNodes(removeNodes, "remove", { blockReports, programNode });
70
+ iterateNodes(addNodes, "add", { blockReports, programNode }, index);
71
+ iterateNodes(removeNodes, "remove", { blockReports, programNode }, index);
81
72
  const lastReport = blockReports.at(-1);
82
73
  if (lastReport) {
83
74
  lastReport.diff_txt = items;
@@ -85,7 +76,7 @@ function codeBlockDetect(arg) {
85
76
  lastReport.topRemoved = removeNodes;
86
77
  }
87
78
  }
88
- blockReports.push(createBlockReport("Never"));
79
+ blockReports.push(createBlockReport("Never", NaN));
89
80
  }
90
81
  function getPathsOfNode(topScopeNodes) {
91
82
  const paths = [];
@@ -108,19 +99,19 @@ function filterBySamePathAndLen(list, sameEffectsPaths) {
108
99
  function extractEffectItem(list) {
109
100
  return list.map((e) => ({ ...e, effects: e.effects.map((item) => item.ele) }));
110
101
  }
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
- }
102
+ function pushBlockReport(blockReports, blockReport, programNode, index) {
118
103
  if (blockReport.kind.startsWith("Other:")) {
119
104
  ["added", "removed"].forEach((key) => {
120
105
  const tailElements = blockReport[key].map((ele) => ele.split(":").at(-1)).filter(Boolean);
121
106
  blockReport[key] = [...new Set(tailElements)];
122
107
  });
123
108
  }
109
+ const sameNames = blockReport.added.filter((path) => blockReport.removed.includes(path));
110
+ if (sameNames.length) {
111
+ ["added", "removed"].forEach((key) => {
112
+ blockReport[key] = blockReport[key].filter((path) => !sameNames.includes(path));
113
+ });
114
+ }
124
115
  const addedEffectsList = mapNodePath(blockReport.addedEffects);
125
116
  const removedEffectsList = mapNodePath(blockReport.removedEffects);
126
117
  const addedEffectsPaths = addedEffectsList.map((item) => item.effects.map(({ path }) => path)).flat();
@@ -132,44 +123,44 @@ function pushBlockReport(blockReports, blockReport, programNode) {
132
123
  blockReport.addedEffects = extractEffectItem(addedEffects);
133
124
  blockReport.removedEffects = extractEffectItem(removedEffects);
134
125
  }
135
- if (!blockReports.includes(blockReport) && Object.entries(blockReport).filter((e) => e[0] !== "kind").some((e) => e[1].length)) {
126
+ if (!blockReports.includes(blockReport)) {
136
127
  blockReports.push(blockReport);
137
128
  }
138
129
  }
139
- function iterateNodes(topScopeNodes, operation, extra) {
130
+ function iterateNodes(topScopeNodes, operation, extra, index) {
140
131
  for (const topScopeNode of topScopeNodes) {
141
132
  if (["ImportDeclaration", "ImportSpecifier", "ImportDefaultSpecifier"].includes(topScopeNode.type)) {
142
- detectImport({ topScopeNode, operation, extra });
133
+ detectImport({ topScopeNode, operation, extra }, index);
143
134
  } else if (["VariableDeclaration", "VariableDeclarator"].includes(topScopeNode.type) || import_AstUtil.default.isSubNodeOfVariableDeclarator(topScopeNode)) {
144
- detectVariableDeclaration({ topScopeNode, operation, extra });
135
+ detectVariableDeclaration({ topScopeNode, operation, extra }, index);
145
136
  } else if (["FunctionDeclaration", "ClassDeclaration"].includes(topScopeNode.type)) {
146
- detectFnClsDeclaration({ topScopeNode, operation, extra });
137
+ detectFnClsDeclaration({ topScopeNode, operation, extra }, index);
147
138
  } else if (["UnaryExpression", "UpdateExpression"].includes(topScopeNode.type)) {
148
- detectUpdateEffectExp({ topScopeNode, operation, extra });
139
+ detectUpdateEffectExp({ topScopeNode, operation, extra }, index);
149
140
  } else if (["CallExpression"].includes(topScopeNode.type)) {
150
- detectFnCallExp({ topScopeNode, operation, extra });
141
+ detectFnCallExp({ topScopeNode, operation, extra }, index);
151
142
  } else if (["AssignmentExpression"].includes(topScopeNode.type)) {
152
- detectAssignmentEffectExp({ topScopeNode, operation, extra });
143
+ detectAssignmentEffectExp({ topScopeNode, operation, extra }, index);
153
144
  } else if (["ExpressionStatement"].includes(topScopeNode.type)) {
154
145
  const { expression } = topScopeNode;
155
- iterateNodes([expression], operation, extra);
146
+ iterateNodes([expression], operation, extra, index);
156
147
  } else {
157
- detectOther({ topScopeNode, operation, extra });
148
+ detectOther({ topScopeNode, operation, extra }, index);
158
149
  }
159
150
  }
160
151
  }
161
- function detectOther(arg) {
152
+ function detectOther(arg, index) {
162
153
  const { topScopeNode, operation, extra: { blockReports, programNode } } = arg;
163
- const blockReport = findOrCreateBlockReport(blockReports, "Other");
154
+ const blockReport = findOrCreateBlockReport(blockReports, "Other", index);
164
155
  const { added, removed } = blockReport;
165
156
  const nodePaths = getPathsOfNode(topScopeNode._util.nodeCollection);
166
157
  (operation === "add" ? added : removed).push(...nodePaths);
167
158
  blockReport.kind = "Other:" + topScopeNode.type;
168
- pushBlockReport(blockReports, blockReport, programNode);
159
+ pushBlockReport(blockReports, blockReport, programNode, index);
169
160
  }
170
- function detectImport(arg) {
161
+ function detectImport(arg, index) {
171
162
  const { topScopeNode, operation, extra: { blockReports, programNode } } = arg;
172
- const blockReport = findOrCreateBlockReport(blockReports, "Import");
163
+ const blockReport = findOrCreateBlockReport(blockReports, "Import", index);
173
164
  const { added, removed, addedEffects, removedEffects } = blockReport;
174
165
  const specifiers = topScopeNode.type === "ImportDeclaration" ? topScopeNode.specifiers : [topScopeNode];
175
166
  if (Array.isArray(specifiers)) {
@@ -179,23 +170,23 @@ function detectImport(arg) {
179
170
  (operation === "add" ? addedEffects : removedEffects).push({ causeBy: local, effects: [...local._util.effectIds] });
180
171
  });
181
172
  }
182
- pushBlockReport(blockReports, blockReport, programNode);
173
+ pushBlockReport(blockReports, blockReport, programNode, index);
183
174
  }
184
- function detectFnClsDeclaration(arg) {
175
+ function detectFnClsDeclaration(arg, index) {
185
176
  const { topScopeNode, operation, extra: { blockReports, programNode } } = arg;
186
- const blockReport = findOrCreateBlockReport(blockReports, "Declaration");
177
+ const blockReport = findOrCreateBlockReport(blockReports, "Declaration", index);
187
178
  const { added, removed, addedEffects, removedEffects } = blockReport;
188
179
  const { id } = topScopeNode;
189
180
  (operation === "add" ? added : removed).push(id.name);
190
181
  (operation === "add" ? addedEffects : removedEffects).push({ causeBy: id, effects: [...id._util.effectIds] });
191
- pushBlockReport(blockReports, blockReport, programNode);
182
+ pushBlockReport(blockReports, blockReport, programNode, index);
192
183
  }
193
184
  function insertPrefix(n, prefix, sep = ":") {
194
185
  return [prefix, n].join(sep);
195
186
  }
196
- function detectVariableDeclaration(arg) {
187
+ function detectVariableDeclaration(arg, index) {
197
188
  const { topScopeNode, operation, extra: { blockReports, programNode } } = arg;
198
- const blockReport = findOrCreateBlockReport(blockReports, "Declaration");
189
+ const blockReport = findOrCreateBlockReport(blockReports, "Declaration", index);
199
190
  const { added, removed, addedEffects, removedEffects } = blockReport;
200
191
  if (["VariableDeclaration", "VariableDeclarator"].includes(topScopeNode.type)) {
201
192
  let declarations = [];
@@ -232,11 +223,11 @@ function detectVariableDeclaration(arg) {
232
223
  }
233
224
  });
234
225
  }
235
- pushBlockReport(blockReports, blockReport, programNode);
226
+ pushBlockReport(blockReports, blockReport, programNode, index);
236
227
  }
237
- function detectUpdateEffectExp(arg) {
228
+ function detectUpdateEffectExp(arg, index) {
238
229
  const { topScopeNode, operation, extra: { blockReports, programNode } } = arg;
239
- const blockReport = findOrCreateBlockReport(blockReports, "SelfUpdate");
230
+ const blockReport = findOrCreateBlockReport(blockReports, "SelfUpdate", index);
240
231
  const { added, removed, addedEffects, removedEffects } = blockReport;
241
232
  const { argument: args } = topScopeNode;
242
233
  const createdExpIdSet = /* @__PURE__ */ new Set();
@@ -245,11 +236,11 @@ function detectUpdateEffectExp(arg) {
245
236
  (operation === "add" ? added : removed).push(createdExpId.name);
246
237
  (operation === "add" ? addedEffects : removedEffects).push({ causeBy: createdExpId, effects: [...createdExpId._util.effectIds] });
247
238
  }
248
- pushBlockReport(blockReports, blockReport, programNode);
239
+ pushBlockReport(blockReports, blockReport, programNode, index);
249
240
  }
250
- function detectFnCallExp(arg) {
241
+ function detectFnCallExp(arg, index) {
251
242
  const { topScopeNode, operation, extra: { blockReports, programNode } } = arg;
252
- const blockReport = findOrCreateBlockReport(blockReports, "Invoke");
243
+ const blockReport = findOrCreateBlockReport(blockReports, "Invoke", index);
253
244
  const { added, removed, addedEffects, removedEffects } = blockReport;
254
245
  const { callee, arguments: args } = topScopeNode;
255
246
  const argsIds = args.map((arg2) => arg2._util.nodeCollection.filter((n) => n.type === "Identifier")).flat();
@@ -263,11 +254,11 @@ function detectFnCallExp(arg) {
263
254
  (operation === "add" ? added : removed).push(createdExpId.name);
264
255
  (operation === "add" ? addedEffects : removedEffects).push({ causeBy: createdExpId, effects: [...createdExpId._util.effectIds] });
265
256
  }
266
- pushBlockReport(blockReports, blockReport, programNode);
257
+ pushBlockReport(blockReports, blockReport, programNode, index);
267
258
  }
268
- function detectAssignmentEffectExp(arg) {
259
+ function detectAssignmentEffectExp(arg, index) {
269
260
  const { topScopeNode, operation, extra: { blockReports, programNode } } = arg;
270
- const blockReport = findOrCreateBlockReport(blockReports, "Assignment");
261
+ const blockReport = findOrCreateBlockReport(blockReports, "Assignment", index);
271
262
  const { added, removed, addedEffects, removedEffects } = blockReport;
272
263
  const { left, right } = topScopeNode;
273
264
  const idSetLeft = /* @__PURE__ */ new Set();
@@ -281,5 +272,5 @@ function detectAssignmentEffectExp(arg) {
281
272
  for (const createdExp of idSetRight) {
282
273
  (operation === "add" ? added : removed).push(insertPrefix(createdExp.name, "right"));
283
274
  }
284
- pushBlockReport(blockReports, blockReport, programNode);
275
+ pushBlockReport(blockReports, blockReport, programNode, index);
285
276
  }
@@ -28,22 +28,26 @@ var mapReportType = {
28
28
  delete: "删除"
29
29
  };
30
30
  function createMdByJson(report) {
31
- return report.map(reportItemToMd).join("\n\n\n");
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 ? `### 依赖${filePath}的文件` : "",
39
- ...filesDependsOnMe.map((file) => `- ${file}`),
40
- dangerIdentifiers.length > 0 ? `### 重点检查使用的变量` : "",
41
- dangerIdentifiers.length > 0 ? `> ${dangerIdentifiers.join(", ")}` : "",
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
- `#### 修改分类: ${kind}`,
57
- `- 原始diff内容`,
58
- `\`\`\`txt
60
+ `### 对比${index + 1}分析`,
61
+ `- 原始diff内容
62
+ \`\`\`txt
59
63
  ${diff_txt.join("\n")}
60
64
  \`\`\``,
61
- added.length > 0 ? `- 新增标识符` : "",
62
- added.length > 0 ? `> ${added.join(", ")}` : "",
63
- addedEffects.length > 0 ? `- 新增标识符影响` : "",
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
- removed.length > 0 ? `> ${removed.join(", ")}` : "",
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
- const entries = Object.entries(tree);
43
- groupGitDiffLines.forEach((item) => {
43
+ groupGitDiffLines.forEach((item, index) => {
44
44
  const { filePath, type } = item;
45
- const filesDependsOnMe = entries.filter((entry) => entry[1].includes(filePath)).map((e) => e[0]);
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.11",
3
+ "version": "0.0.13",
4
4
  "description": "",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/cjs/index.d.ts",