barrelize 1.4.1 → 1.4.2
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/lib/index.js +13 -8
- package/lib/src/log/log.d.ts +1 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -591,7 +591,7 @@ class CAC extends EventEmitter {
|
|
|
591
591
|
}
|
|
592
592
|
const cac = (name2 = "") => new CAC(name2);
|
|
593
593
|
const name = "barrelize";
|
|
594
|
-
const version = "1.4.
|
|
594
|
+
const version = "1.4.1";
|
|
595
595
|
function cliInit() {
|
|
596
596
|
const cli = cac(name);
|
|
597
597
|
cli.command("[config path]", `Generate barrel files`).action(async (config) => {
|
|
@@ -943,6 +943,11 @@ function logWarning(message) {
|
|
|
943
943
|
function logInfo(message) {
|
|
944
944
|
console.log(colorize(message, TerminalColor.BLUE));
|
|
945
945
|
}
|
|
946
|
+
function logDebug(message) {
|
|
947
|
+
if (process.argv.includes("--verbose")) {
|
|
948
|
+
console.log(colorize(message, TerminalColor.MAGENTA));
|
|
949
|
+
}
|
|
950
|
+
}
|
|
946
951
|
const INITIAL_CONFIG = {
|
|
947
952
|
$schema: "node_modules/barrelize/schema.json",
|
|
948
953
|
barrels: [
|
|
@@ -16810,7 +16815,7 @@ function requireLib() {
|
|
|
16810
16815
|
var libExports = requireLib();
|
|
16811
16816
|
async function extractExports(sourcePath) {
|
|
16812
16817
|
if (!existsSync(sourcePath)) {
|
|
16813
|
-
|
|
16818
|
+
logDebug(`Source path '${sourcePath}' does not exist`);
|
|
16814
16819
|
return [];
|
|
16815
16820
|
}
|
|
16816
16821
|
const options = {
|
|
@@ -16825,7 +16830,9 @@ async function extractExportsFromFile(sourcePath, options) {
|
|
|
16825
16830
|
const ast = parseFileContent(content);
|
|
16826
16831
|
return extractExportsFromAst(ast, options);
|
|
16827
16832
|
} catch (error) {
|
|
16828
|
-
|
|
16833
|
+
if (error instanceof Error) {
|
|
16834
|
+
logDebug(`Failed to process file '${sourcePath}': ${error.message}`);
|
|
16835
|
+
}
|
|
16829
16836
|
return [];
|
|
16830
16837
|
}
|
|
16831
16838
|
}
|
|
@@ -16857,7 +16864,7 @@ async function extractExportsFromAst(ast, options) {
|
|
|
16857
16864
|
if (options.recursive) {
|
|
16858
16865
|
const normalizedPath = normalizeSourcePath(node.source.value, options);
|
|
16859
16866
|
if (!normalizedPath) {
|
|
16860
|
-
|
|
16867
|
+
logDebug(`Exported module path '${normalizedPath}' does not exist`);
|
|
16861
16868
|
} else {
|
|
16862
16869
|
const innerExports = await extractExportsFromFile(normalizedPath, options);
|
|
16863
16870
|
exports.push(...innerExports);
|
|
@@ -23584,10 +23591,7 @@ async function fillExports(rootDir, exportPaths, config) {
|
|
|
23584
23591
|
const skipMapMembersIfNotExists = config.skipMapMembersIfNotExists ?? true;
|
|
23585
23592
|
for (const pathInfo of exportPaths) {
|
|
23586
23593
|
const resolvedPath = resolve(rootDir, pathInfo.originalPath);
|
|
23587
|
-
|
|
23588
|
-
if (!allExportMembers.length) {
|
|
23589
|
-
continue;
|
|
23590
|
-
}
|
|
23594
|
+
const allExportMembers = await getExportedMembers(resolvedPath);
|
|
23591
23595
|
const exportMemberList = await filterExportMembers(allExportMembers, includeRegexes, excludeRegexes);
|
|
23592
23596
|
const exportMemberMap = getExportMemberMap(allExportMembers, mapRegexes, skipMapMembersIfNotExists);
|
|
23593
23597
|
const asteriskMapItem = exportMemberMap.get("*");
|
|
@@ -23756,6 +23760,7 @@ export {
|
|
|
23756
23760
|
handlePathReplace,
|
|
23757
23761
|
handlePaths,
|
|
23758
23762
|
indexFileExportedPaths,
|
|
23763
|
+
logDebug,
|
|
23759
23764
|
logError,
|
|
23760
23765
|
logInfo,
|
|
23761
23766
|
logValidationError,
|
package/lib/src/log/log.d.ts
CHANGED