Move the last React-free modules out of apps/web - #27
Open
playforge-coding wants to merge 1 commit into
Open
Conversation
Phase 1C. Six modules that never needed React but were sitting in the app: richText (the DOMPurify render pass), wikimedia (the browser Commons client), presence, summarizer, git/fs and git/sync. All land in the browser tier — DOMPurify, DOMParser, the Summarizer API and LightningFS-over-IndexedDB are browser things, framework-agnostic but not runtime-neutral. Two are renamed rather than moved as-is, to avoid a second module with the same basename in a different tier: richText.js -> browser/sanitizeRichText (../richText.js holds the policy) wikimedia.js -> browser/commonsImages (../wikimedia.js holds the plumbing) sanitizeRichText also drops the re-export block it carried so components could get their rich-text helpers from one import. With the module in core that indirection buys nothing, so the five consumers that only wanted the neutral helpers now take them from core/richText directly, and only RichText.jsx — which actually sanitizes — imports the browser module. The lazy git chunk was re-checked after the move, since git/fs and git/sync crossing into a workspace package could plausibly have broken it: isomorphic-git internals still appear only in the ~181 KB async chunk and in none of the main ones. What stays in apps/web/src/lib and why: i18n.js, languages.js bound to react-i18next git/engine.js, load.js the dynamic-import boundary and the Buffer polyfill utils.js cn(), the shadcn/Tailwind helper everything else React hooks and contexts Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #25. Phase 1C — the six modules that never needed React but were sitting in the app.
richText(the DOMPurify render pass),wikimedia(the browser Commons client),presence,summarizer,git/fsandgit/sync. All land in the browser tier: DOMPurify, DOMParser, the Summarizer API and LightningFS-over-IndexedDB are browser things — framework-agnostic, but not runtime-neutral.Two renames, deliberately
Both would otherwise have been a second module with the same basename in a different tier — the thing I avoided with
image/imageFilein the browser-tier PR:richText.jsbrowser/sanitizeRichText../richText.jsholds the policywikimedia.jsbrowser/commonsImages../wikimedia.jsholds the plumbingDropping an indirection
sanitizeRichTextcarried a re-export block so components could get all their rich-text helpers from one import. With the module in core that buys nothing — so the five consumers that only wanted the neutral helpers (richTextLength,richTextToLine,isRichTextEmpty,isRichTextHtml) now take them fromcore/richTextdirectly, and onlyRichText.jsx— which actually sanitizes — imports the browser module.The bundle split, re-checked
git/fsandgit/synccrossing into a workspace package could plausibly have broken the lazy git chunk, so I verified rather than assumed: isomorphic-git internals still appear only in the ~181 KB async chunk and in none of the four main ones.Phase 1 is now done
apps/web/src/libis 1,892 lines;packages/coreis 7,504 (+635 tests).What's left in the app, and why it should stay:
i18n.js,languages.jsreact-i18nextgit/engine.js,git/load.jsBufferpolyfill — bundler concernsutils.jscn(), the shadcn/Tailwind helperThat is the state the SvelteKit plan assumed: the rewrite surface is the view layer, not the product.
Verification
pnpm lint,pnpm test(core 41, api 27, mcp 14),pnpm build,pnpm build:docsall pass.