scancscode 1.0.34 → 1.0.35

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.
@@ -47,7 +47,7 @@ class LiteralCollector {
47
47
  }
48
48
  let files = glob_1.glob.sync("**/*.cs", { cwd: folder });
49
49
  let testFullPath = "@";
50
- // let testFullPath = "E:/DATA/Projects/ZhiYou/ProjectFClient/GameClient/Assets/Bundles/GameConfigs/Main/UnitAttributeTable-UnitAttributeTable.cs";
50
+ // let testFullPath = "E:/DATA/Projects/ZhiYou/ProjectFClient/GameClient/Assets/Bundles/FGUI/Basics/Comp/InfoToastComp.cs";
51
51
  // 限制并行处理的文件数量,避免内存占用过高
52
52
  const batchSize = 10;
53
53
  for (let i = 0; i < files.length; i += batchSize) {
@@ -63,7 +63,6 @@ class LiteralCollector {
63
63
  try {
64
64
  const content = await fs.promises.readFile(fullPath, "utf-8");
65
65
  const snippets = CSCodeScanner_1.CSCodeScanner.scanFile(fullPath, content, trmethod);
66
- CSCodeScanner_1.CSCodeScanner.filterSnippets(snippets);
67
66
  if (snippets.length > 0) {
68
67
  if (!scanonly) {
69
68
  let convertedContent = CSCodeScanner_1.CSCodeScanner.replaceInFile(content, snippets);
@@ -71,9 +70,11 @@ class LiteralCollector {
71
70
  await fs.promises.writeFile(fullPath, convertedContent, "utf-8");
72
71
  }
73
72
  }
73
+ let filteredSnippets = [...snippets];
74
+ CSCodeScanner_1.CSCodeScanner.filterSnippets(filteredSnippets);
74
75
  const fileLiterals = [];
75
76
  const fileUnexpects = [];
76
- for (const snippet of snippets) {
77
+ for (const snippet of filteredSnippets) {
77
78
  fileLiterals.push(...snippet.literals);
78
79
  fileUnexpects.push(...snippet.unexpects);
79
80
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scancscode",
3
- "version": "1.0.34",
3
+ "version": "1.0.35",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "bin": {
@@ -15,8 +15,8 @@ export class LiteralCollector {
15
15
 
16
16
  let files = glob.sync("**/*.cs", { cwd: folder });
17
17
  let testFullPath = "@";
18
- // let testFullPath = "E:/DATA/Projects/ZhiYou/ProjectFClient/GameClient/Assets/Bundles/GameConfigs/Main/UnitAttributeTable-UnitAttributeTable.cs";
19
-
18
+ // let testFullPath = "E:/DATA/Projects/ZhiYou/ProjectFClient/GameClient/Assets/Bundles/FGUI/Basics/Comp/InfoToastComp.cs";
19
+
20
20
  // 限制并行处理的文件数量,避免内存占用过高
21
21
  const batchSize = 10;
22
22
  for (let i = 0; i < files.length; i += batchSize) {
@@ -32,8 +32,7 @@ export class LiteralCollector {
32
32
  try {
33
33
  const content = await fs.promises.readFile(fullPath, "utf-8");
34
34
  const snippets = CSCodeScanner.scanFile(fullPath, content, trmethod);
35
- CSCodeScanner.filterSnippets(snippets);
36
-
35
+
37
36
  if (snippets.length > 0) {
38
37
  if (!scanonly) {
39
38
  let convertedContent = CSCodeScanner.replaceInFile(content, snippets);
@@ -42,9 +41,11 @@ export class LiteralCollector {
42
41
  }
43
42
  }
44
43
 
44
+ let filteredSnippets = [...snippets];
45
+ CSCodeScanner.filterSnippets(filteredSnippets);
45
46
  const fileLiterals: string[] = [];
46
47
  const fileUnexpects: string[] = [];
47
- for (const snippet of snippets) {
48
+ for (const snippet of filteredSnippets) {
48
49
  fileLiterals.push(...snippet.literals);
49
50
  fileUnexpects.push(...snippet.unexpects);
50
51
  }
@@ -106,7 +107,7 @@ export class LiteralCollector {
106
107
 
107
108
  let literals: string[] = [];
108
109
  let unexpects: string[] = [];
109
-
110
+
110
111
  // 并行处理代码文件夹
111
112
  const codeFolderPromises = cscodeFolders.map(async (cscodeFolder) => {
112
113
  const folderLiterals: string[] = [];
@@ -114,19 +115,19 @@ export class LiteralCollector {
114
115
  await this.scanCodeInFolder(cscodeFolder, folderLiterals, folderUnexpects, trmethod, scanonly, verbose);
115
116
  return { literals: folderLiterals, unexpects: folderUnexpects };
116
117
  });
117
-
118
+
118
119
  const codeFolderResults = await Promise.all(codeFolderPromises);
119
120
  for (const result of codeFolderResults) {
120
121
  literals.push(...result.literals);
121
122
  unexpects.push(...result.unexpects);
122
123
  }
123
-
124
+
124
125
  // 并行处理表格文件夹
125
126
  const tableFolderPromises = gameConfigFolders.map(async (gameConfigFolder) => {
126
127
  await this.scanTablesInFolder(gameConfigFolder, literals, verbose);
127
128
  });
128
129
  await Promise.all(tableFolderPromises);
129
-
130
+
130
131
  // 去重和过滤
131
132
  this.filterLiterals(literals);
132
133