@hexagen-monaco/sync 0.12.0 → 0.12.1
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/cli.js +5 -40
- package/dist/cli.js.map +1 -1
- package/dist/fs-utils.d.ts.map +1 -1
- package/dist/generators/barrels/recursive.d.ts.map +1 -1
- package/dist/index.js +5 -40
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -404,7 +404,7 @@ function isGeneratedFile(content) {
|
|
|
404
404
|
return content.includes(GENERATED_MARKER);
|
|
405
405
|
}
|
|
406
406
|
function isProtectedRoot(filePath, config) {
|
|
407
|
-
const relative = path34__default.relative(config.workspaceRoot, filePath);
|
|
407
|
+
const relative = path34__default.relative(config.workspaceRoot, filePath).replace(/\\/g, "/");
|
|
408
408
|
const isRootLevel = !relative.startsWith("packages/") && !relative.startsWith("tools/") && !relative.startsWith("apps/");
|
|
409
409
|
return isRootLevel && Array.from(protectedFiles).some(
|
|
410
410
|
(f) => relative.endsWith(f) || relative.includes(f)
|
|
@@ -860,53 +860,18 @@ async function walkDirectory(dirPath, pendingWrites, preserved, exportGraph, con
|
|
|
860
860
|
if (exportEntries.length === 0) {
|
|
861
861
|
const barrelPath2 = path34__default.join(dirPath, "index.ts");
|
|
862
862
|
const existingBarrel = await readFileIfExists(barrelPath2);
|
|
863
|
-
const dirName = path34__default.basename(dirPath);
|
|
864
|
-
const isLayerDir = ["domain", "application", "infrastructure"].includes(
|
|
865
|
-
dirName
|
|
866
|
-
);
|
|
867
863
|
if (existingBarrel) {
|
|
868
864
|
const isGenerated = isGeneratedFile2(existingBarrel);
|
|
869
|
-
const
|
|
870
|
-
|
|
865
|
+
const statements = existingBarrel.split("\n").map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("//"));
|
|
866
|
+
const isEmptyStub = statements.length === 1 && /^export\s*\{\s*\}\s*;?$/.test(statements[0]);
|
|
867
|
+
if (isGenerated || isEmptyStub) {
|
|
871
868
|
pendingWrites.push({
|
|
872
869
|
filePath: barrelPath2,
|
|
873
870
|
content: "",
|
|
874
871
|
// Empty content signals deletion
|
|
875
872
|
isNew: false
|
|
876
873
|
});
|
|
877
|
-
} else if (isEmptyStub && isLayerDir) {
|
|
878
|
-
const newContent = `${GENERATED_MARKER2}
|
|
879
|
-
|
|
880
|
-
export {};
|
|
881
|
-
`;
|
|
882
|
-
if (contentHash2(existingBarrel) !== contentHash2(newContent)) {
|
|
883
|
-
pendingWrites.push({
|
|
884
|
-
filePath: barrelPath2,
|
|
885
|
-
content: newContent,
|
|
886
|
-
isNew: false
|
|
887
|
-
});
|
|
888
|
-
}
|
|
889
|
-
} else if (!existingBarrel.includes("export {}") && isLayerDir) {
|
|
890
|
-
const newContent = `${GENERATED_MARKER2}
|
|
891
|
-
|
|
892
|
-
export {};
|
|
893
|
-
`;
|
|
894
|
-
pendingWrites.push({
|
|
895
|
-
filePath: barrelPath2,
|
|
896
|
-
content: newContent,
|
|
897
|
-
isNew: false
|
|
898
|
-
});
|
|
899
874
|
}
|
|
900
|
-
} else if (isLayerDir) {
|
|
901
|
-
const newContent = `${GENERATED_MARKER2}
|
|
902
|
-
|
|
903
|
-
export {};
|
|
904
|
-
`;
|
|
905
|
-
pendingWrites.push({
|
|
906
|
-
filePath: barrelPath2,
|
|
907
|
-
content: newContent,
|
|
908
|
-
isNew: true
|
|
909
|
-
});
|
|
910
875
|
}
|
|
911
876
|
return [];
|
|
912
877
|
}
|
|
@@ -1534,7 +1499,7 @@ function assertValidToolchainVersion(version, source) {
|
|
|
1534
1499
|
function resolveToolchainVersion() {
|
|
1535
1500
|
{
|
|
1536
1501
|
return assertValidToolchainVersion(
|
|
1537
|
-
"0.12.
|
|
1502
|
+
"0.12.1",
|
|
1538
1503
|
"build-injected __HEXAGEN_TOOLCHAIN_VERSION__"
|
|
1539
1504
|
);
|
|
1540
1505
|
}
|