@c4a/extract 0.6.17 → 0.6.19
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/bin/c4a-extract-code.js +9 -7
- package/index.js +9 -7
- package/package.json +1 -1
package/bin/c4a-extract-code.js
CHANGED
|
@@ -13748,8 +13748,8 @@ import { promisify } from "node:util";
|
|
|
13748
13748
|
var execFileAsync = promisify(execFile);
|
|
13749
13749
|
var isScanExcludedDir = (name) => SCAN_EXCLUDED_DIRS.has(name) || name.startsWith(".") && name !== "." || name.endsWith(".egg-info");
|
|
13750
13750
|
var DEFAULT_EXCLUDED_FILE_PATTERNS = [
|
|
13751
|
-
/\.test\.
|
|
13752
|
-
/\.spec\.
|
|
13751
|
+
/\.test\.tsx?$/i,
|
|
13752
|
+
/\.spec\.tsx?$/i,
|
|
13753
13753
|
/\.d\.ts$/i
|
|
13754
13754
|
];
|
|
13755
13755
|
var SUPPORTED_EXTENSIONS = new Set([".ts", ".tsx"]);
|
|
@@ -13904,11 +13904,7 @@ var countFileLines = async (filePath) => {
|
|
|
13904
13904
|
const contents = await readFile(filePath, "utf-8");
|
|
13905
13905
|
if (contents === "")
|
|
13906
13906
|
return 0;
|
|
13907
|
-
|
|
13908
|
-
if (lines[lines.length - 1] === "") {
|
|
13909
|
-
lines.pop();
|
|
13910
|
-
}
|
|
13911
|
-
return lines.length;
|
|
13907
|
+
return contents.split(/\r\n|\r|\n/).filter((line) => line.trim().length > 0).length;
|
|
13912
13908
|
};
|
|
13913
13909
|
var MANIFEST_FILES = [
|
|
13914
13910
|
"package.json",
|
|
@@ -14054,13 +14050,19 @@ var findSubModuleDirs = async (rootDir, excludeDirs, gitFiles, pathFilter2) => {
|
|
|
14054
14050
|
var buildModule = async (repoRoot, moduleDir, moduleName, childModuleDirs, ref, pathFilter2, gitFiles) => {
|
|
14055
14051
|
const excludes = childModuleDirs.size > 0 ? childModuleDirs : undefined;
|
|
14056
14052
|
const moduleFiles = gitFiles !== undefined && gitFiles !== null && gitFiles.size > 0 ? filterGitSourceFiles(resolve(moduleDir), gitFiles, excludes, pathFilter2) : await scanSourceFiles(moduleDir, excludes, ref, pathFilter2);
|
|
14053
|
+
const broadPathFilter = pathFilter2 === undefined ? undefined : { ...pathFilter2, code: { ...pathFilter2.code, exclude: [] } };
|
|
14054
|
+
const allMatchedFiles = broadPathFilter === undefined ? moduleFiles : gitFiles !== undefined && gitFiles !== null && gitFiles.size > 0 ? filterGitSourceFiles(resolve(moduleDir), gitFiles, excludes, broadPathFilter) : await scanSourceFiles(moduleDir, excludes, ref, broadPathFilter);
|
|
14055
|
+
const included = new Set(moduleFiles);
|
|
14056
|
+
const excludedModuleFiles = allMatchedFiles.filter((file) => !included.has(file));
|
|
14057
14057
|
const modulePath = toPosixPath(relative(repoRoot, moduleDir)) || ".";
|
|
14058
14058
|
const totalLines = await Promise.all(moduleFiles.map((file) => countFileLines(join(moduleDir, file))));
|
|
14059
14059
|
const files = modulePath === "." ? moduleFiles : moduleFiles.map((file) => toPosixPath(join(modulePath, file)));
|
|
14060
|
+
const excludedFiles = modulePath === "." ? excludedModuleFiles : excludedModuleFiles.map((file) => toPosixPath(join(modulePath, file)));
|
|
14060
14061
|
return {
|
|
14061
14062
|
name: moduleName,
|
|
14062
14063
|
path: modulePath,
|
|
14063
14064
|
files,
|
|
14065
|
+
...excludedFiles.length === 0 ? {} : { excludedFiles },
|
|
14064
14066
|
fileCount: files.length,
|
|
14065
14067
|
totalLines: totalLines.reduce((sum, value) => sum + value, 0)
|
|
14066
14068
|
};
|
package/index.js
CHANGED
|
@@ -14355,8 +14355,8 @@ import { promisify } from "node:util";
|
|
|
14355
14355
|
var execFileAsync = promisify(execFile);
|
|
14356
14356
|
var isScanExcludedDir = (name) => SCAN_EXCLUDED_DIRS.has(name) || name.startsWith(".") && name !== "." || name.endsWith(".egg-info");
|
|
14357
14357
|
var DEFAULT_EXCLUDED_FILE_PATTERNS = [
|
|
14358
|
-
/\.test\.
|
|
14359
|
-
/\.spec\.
|
|
14358
|
+
/\.test\.tsx?$/i,
|
|
14359
|
+
/\.spec\.tsx?$/i,
|
|
14360
14360
|
/\.d\.ts$/i
|
|
14361
14361
|
];
|
|
14362
14362
|
var SUPPORTED_EXTENSIONS = new Set([".ts", ".tsx"]);
|
|
@@ -14511,11 +14511,7 @@ var countFileLines = async (filePath) => {
|
|
|
14511
14511
|
const contents = await readFile(filePath, "utf-8");
|
|
14512
14512
|
if (contents === "")
|
|
14513
14513
|
return 0;
|
|
14514
|
-
|
|
14515
|
-
if (lines[lines.length - 1] === "") {
|
|
14516
|
-
lines.pop();
|
|
14517
|
-
}
|
|
14518
|
-
return lines.length;
|
|
14514
|
+
return contents.split(/\r\n|\r|\n/).filter((line) => line.trim().length > 0).length;
|
|
14519
14515
|
};
|
|
14520
14516
|
var MANIFEST_FILES = [
|
|
14521
14517
|
"package.json",
|
|
@@ -14661,13 +14657,19 @@ var findSubModuleDirs = async (rootDir, excludeDirs, gitFiles, pathFilter2) => {
|
|
|
14661
14657
|
var buildModule = async (repoRoot, moduleDir, moduleName, childModuleDirs, ref, pathFilter2, gitFiles) => {
|
|
14662
14658
|
const excludes = childModuleDirs.size > 0 ? childModuleDirs : undefined;
|
|
14663
14659
|
const moduleFiles = gitFiles !== undefined && gitFiles !== null && gitFiles.size > 0 ? filterGitSourceFiles(resolve(moduleDir), gitFiles, excludes, pathFilter2) : await scanSourceFiles(moduleDir, excludes, ref, pathFilter2);
|
|
14660
|
+
const broadPathFilter = pathFilter2 === undefined ? undefined : { ...pathFilter2, code: { ...pathFilter2.code, exclude: [] } };
|
|
14661
|
+
const allMatchedFiles = broadPathFilter === undefined ? moduleFiles : gitFiles !== undefined && gitFiles !== null && gitFiles.size > 0 ? filterGitSourceFiles(resolve(moduleDir), gitFiles, excludes, broadPathFilter) : await scanSourceFiles(moduleDir, excludes, ref, broadPathFilter);
|
|
14662
|
+
const included = new Set(moduleFiles);
|
|
14663
|
+
const excludedModuleFiles = allMatchedFiles.filter((file) => !included.has(file));
|
|
14664
14664
|
const modulePath = toPosixPath(relative(repoRoot, moduleDir)) || ".";
|
|
14665
14665
|
const totalLines = await Promise.all(moduleFiles.map((file) => countFileLines(join(moduleDir, file))));
|
|
14666
14666
|
const files = modulePath === "." ? moduleFiles : moduleFiles.map((file) => toPosixPath(join(modulePath, file)));
|
|
14667
|
+
const excludedFiles = modulePath === "." ? excludedModuleFiles : excludedModuleFiles.map((file) => toPosixPath(join(modulePath, file)));
|
|
14667
14668
|
return {
|
|
14668
14669
|
name: moduleName,
|
|
14669
14670
|
path: modulePath,
|
|
14670
14671
|
files,
|
|
14672
|
+
...excludedFiles.length === 0 ? {} : { excludedFiles },
|
|
14671
14673
|
fileCount: files.length,
|
|
14672
14674
|
totalLines: totalLines.reduce((sum, value) => sum + value, 0)
|
|
14673
14675
|
};
|