refactor(js): extract import/export module from app.js monofile (§3.1)
Third slice of the app.js split. Moves the encrypted export container, CSV/JSON import parsing (parseCSV, findColumn, parseEntriesFromCSV, parseEntriesFromJSON), and the doImport/doExport/doExportCSV flows to js/app.import.js. encryptImportEntry moves here too (also called by app.sync.js — resolved via shared global scope at call time). - Byte-for-byte identical to the extracted block; no duplicate const; no top-level import ref left in app.js. - Load order: BEFORE app.js (pure declarations, no top-level side effects), alongside app.crypto.js. Full order: argon2 → crypto → import → app → sync. - index.html + BuildAssets whitelist + harness APP_PARTS updated. - Safety net: the 14 CSV tests exercise parseCSV/parseEntriesFromCSV from the extracted file and stay green (42/42). app.js: 11936 → 10253 lines (crypto + sync + import now separate, ~1700 lines moved into 3 modules). NOTE: assets.res not regenerated here (needs brcc32/Delphi) — run BuildAssets before the next Delphi build to embed js/app.import.js. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -33,11 +33,16 @@ visibles des suivants exactement comme dans le monofichier. Ordre actuel :
|
||||
```
|
||||
js/argon2.js (IIFE, globalThis.NobleArgon2)
|
||||
js/app.crypto.js (KDF, verifier, encrypt/decrypt — extrait §3.1)
|
||||
js/app.import.js (export container + import CSV/JSON — extrait §3.1)
|
||||
js/app.js (le reste : state, Bridge, api, UI…)
|
||||
js/app.sync.js (WebDAV + merge — extrait §3.1, APRÈS app.js car
|
||||
effet de bord top-level `Bridge.onWebdavResult = …`)
|
||||
```
|
||||
|
||||
`app.import.js` contient `encryptImportEntry`, appelé aussi par
|
||||
`app.sync.js` (`applyRemoteSnapshot`) — OK, référence cross-fichier résolue
|
||||
au call-time via le scope global partagé.
|
||||
|
||||
Note ordre : un module **sans** exécution top-level (que des déclarations,
|
||||
comme `app.crypto.js`) peut se charger AVANT `app.js`. Un module **avec** un
|
||||
effet de bord top-level qui touche un global d'`app.js` (`Bridge`, `state`…)
|
||||
@@ -94,6 +99,7 @@ parsing CSV d'import, et l'arbitrage merge/tombstone de sync
|
||||
| Handlers REST | `delphi-backend/Handlers/PM.Handler.*.pas` |
|
||||
| Frontend principal (en cours de découpage §3.1) | `js/app.js` |
|
||||
| Crypto frontend (KDF, verifier, AES-GCM) — extrait §3.1 | `js/app.crypto.js` |
|
||||
| Import/export frontend (CSV/JSON parse, export container) — extrait §3.1 | `js/app.import.js` |
|
||||
| Sync frontend (WebDAV, snapshot, merge) — extrait §3.1 | `js/app.sync.js` |
|
||||
| Argon2id vendé (bundle `@noble/hashes`, IIFE) | `js/argon2.js` |
|
||||
| HTML racine | `index.html` |
|
||||
|
||||
Reference in New Issue
Block a user