vibemancer 1.0.38 → 1.0.39
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 +10 -6
- package/dist/cli.js.map +1 -1
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -1495,10 +1495,15 @@ function recordedHashFor(projectDir, filePath) {
|
|
|
1495
1495
|
const state = readState(projectDir);
|
|
1496
1496
|
const key = stateKey(projectDir, filePath);
|
|
1497
1497
|
if (key in state) return state[key];
|
|
1498
|
-
return legacyRecordFor(key, state, (candidateKey) =>
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1498
|
+
return legacyRecordFor(key, state, (candidateKey) => isDistinctFileRecord(projectDir, candidateKey));
|
|
1499
|
+
}
|
|
1500
|
+
function isDistinctFileRecord(projectDir, candidateKey) {
|
|
1501
|
+
const asFile = path7.join(projectDir, candidateKey);
|
|
1502
|
+
return fs6.existsSync(asFile) && stateKey(projectDir, asFile) === candidateKey;
|
|
1503
|
+
}
|
|
1504
|
+
function staleVariantsOf(key, state, isDistinctFile) {
|
|
1505
|
+
const folded = key.toLowerCase();
|
|
1506
|
+
return Object.keys(state).filter((k) => k !== key && k.toLowerCase() === folded && !isDistinctFile(k));
|
|
1502
1507
|
}
|
|
1503
1508
|
function legacyRecordFor(key, state, isDistinctFile) {
|
|
1504
1509
|
const folded = key.toLowerCase();
|
|
@@ -1515,8 +1520,7 @@ function recordWritten(projectDir, filePath, content) {
|
|
|
1515
1520
|
const state = readRaw(projectDir);
|
|
1516
1521
|
state._readme = README_NOTE;
|
|
1517
1522
|
const key = stateKey(projectDir, filePath);
|
|
1518
|
-
const
|
|
1519
|
-
for (const k of Object.keys(state)) if (k !== key && k.toLowerCase() === folded) delete state[k];
|
|
1523
|
+
for (const k of staleVariantsOf(key, state, (candidate) => isDistinctFileRecord(projectDir, candidate))) delete state[k];
|
|
1520
1524
|
state[key] = hashContent(content);
|
|
1521
1525
|
fs6.writeFileSync(tmp, JSON.stringify(state, null, 2) + String.fromCharCode(10));
|
|
1522
1526
|
fs6.renameSync(tmp, statePath(projectDir));
|