Repository navigation
Conversation
main.js was 8.6 MB, over the 5 MB file limit of Obsidian Sync Standard that the plugin review warns about. The two largest items were text the plugin rarely reads in full: the Plotly build widgets inline (1.75 MB) and ten non-English locale catalogs, which the minifier inflates further by escaping every non-ASCII character. Both now ship raw-deflated as base64 and are inflated synchronously with pako (already bundled via pdf-lib) on first use: the active locale at startup, Plotly when a widget first asks for it. main.js: 8.58 MB -> 6.96 MB. Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
[Medium impact] The PR appears safe to merge; the previous dotfile build failure is fixed. SummaryThis PR ships Plotly and non-English translations compressed, then restores their text on first use.
Reviews (2) · Last reviewed commit: "fix(build): skip non-directory entries w..." · Reviewed by Greptile |
A .DS_Store in the locales folder reached readdirSync as a directory in the watch-file loop and failed the build with ENOTDIR. Both loops now share one directory filter. Co-Authored-By: Claude <noreply@anthropic.com>
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.
What
Obsidian's plugin scan warned that
main.jsin 2.6.0 is over 5 MB, the per-file limit of Obsidian Sync Standard. This change ships the two largest blocks of rarely-read text deflated and inflates them on first use:?deflateimport. Vendored-lib patches are applied before compression, and the source is inflated the first time a widget requestslibs: plotly.virtual:s2b-locale-packs). Only the active locale is inflated, at firstt(). English stays plain JSON because it is the fallback and the source of the key types. The raw catalogs were costlier than their file size: the minifier escapes every non-ASCII character as\uXXXX.Inflation is synchronous, so
t()keeps its contract, viapako, which pdf-lib already bundles. The new direct dependency pins the same major, so only one copy ships. The plugin is registered in bothvite.config.tsandvitest.config.ts, so tests decode exactly what ships.main.js: 8.58 MB → 6.96 MB (Plotly 731 KB, all locales ≈ 380 KB). This is still above 5 MB; getting under it needs more work (Plotly on demand, zod dedupe, pdf-lib).
How I tested it
bun run check,format,lint, andtestpass. Newtest/bundling/compressedAssets.test.tsround-trips non-ASCII text, checks that every locale pack inflates to its catalogs, and translates from a compressed locale.widgetLibs.test.tsasserts the inflated Plotly is byte-identical to the patched source.vite build --mode production.AI assistance: Claude Code wrote the change from the maintainer's brief to cut bundle size by compressing locales and Plotly; the maintainer still needs to review it and test it live.
Checklist
bun run check,bun run format,bun run lint, andbun run testpass locallymanifest.json: I noted that the docs site needs updating (see "Documentation" in CONTRIBUTING.md) — n/a