refactor(js): extract sync module from app.js monofile (§3.1)
Second slice of the app.js split (after crypto). Moves the WebDAV sync section to js/app.sync.js: transport (_webdavCall), buildSyncSnapshot, applyRemoteSnapshot (merge + tombstone arbitration), runSyncNow, and the sync settings UI. - Byte-for-byte identical to the extracted block (verified before removal); no duplicate const; no top-level sync reference left in app.js. - Load order: AFTER app.js (unlike crypto, which loads before) because this module has a top-level side effect — `Bridge.onWebdavResult = …` — that needs Bridge/state/api already declared. Rule documented in CLAUDE.md. - index.html + BuildAssets whitelist + harness APP_PARTS updated; assets rebuilt to embed the new file. - Safety net: the existing merge tests exercise applyRemoteSnapshot / buildSyncSnapshot from the extracted file and stay green (42/42). app.js: 11936 → 11256 lines (crypto + sync now separate). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -30,7 +30,7 @@ const { webcrypto } = require('node:crypto');
|
||||
// top-level const/let across separate runInContext calls, so we CONCATENATE
|
||||
// the app.* parts (in <script> load order) into one script. argon2.js is a
|
||||
// self-contained IIFE and loads separately (see below).
|
||||
const APP_PARTS = ['app.crypto.js', 'app.js'].map(f => path.join(__dirname, '..', f));
|
||||
const APP_PARTS = ['app.crypto.js', 'app.js', 'app.sync.js'].map(f => path.join(__dirname, '..', f));
|
||||
|
||||
// In-memory Storage stub (Web Storage API surface used by app.js).
|
||||
function makeStorage() {
|
||||
|
||||
Reference in New Issue
Block a user