You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
refactor: emit the content data store as a JSON string - #17430
Precedent: Vite's own JSON plugin defaults to json.stringify: 'auto', which emits JSON.parse("...") for any JSON module over 10kB for the same reasons, and the chunked store mode (feat: chunk data store #17296) already ships serialized strings in both dev and production.
dataToEsm() adds nothing here: the store's top level is a devalue-flattened array, so the generated module has a single default export and there are no named exports to tree-shake. Its output is essentially the on-disk JSON with unquoted keys.
Cost: the data store module in the (unminified) server bundle grows about 9% raw from string escaping, about 1% after gzip. Client bundles are unaffected; nothing client-reachable imports this module.
Testing
Green CI
Docs
No docs needed: this changes the internal representation of a virtual module with no user-facing behavior change. No changeset file is added.
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Comparing ocavue/data-store-json-parse (8fdcc52) with main (5a5337e)
ocavue
changed the title
Emit the content data store as a JSON string instead of an object literal
refactor: emit the content data store as a JSON string
Jul 19, 2026
ocavue
changed the title
refactor: emit the content data store as a JSON string
refactor(astro): emit the content data store as a JSON string
Jul 19, 2026
ocavue
changed the title
refactor(astro): emit the content data store as a JSON string
refactor: emit the content data store as a JSON string
Jul 19, 2026
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
dependenciesPull requests that update a dependency filepkg: astroRelated to the core `astro` package (scope)
3 participants
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.
AI discourse: most works are done by Claude Fable 5
Changes
astro:data-layer-contentnow always emitsexport default JSON.parse("...")instead of adataToEsm()object literal. The dev-only 5MB threshold from Fix getCollection() returning empty in dev mode for large content collections #17223 is removed, so dev and production emit the same code again.@rollup/pluginutilsdependency fromastro.Why:
JSON.parseis roughly 1.7x faster than parsing the equivalent object literal (https://v8.dev/blog/cost-of-javascript-2019#json), so server cold starts get slightly faster as stores grow.json.stringify: 'auto', which emitsJSON.parse("...")for any JSON module over 10kB for the same reasons, and the chunked store mode (feat: chunk data store #17296) already ships serialized strings in both dev and production.dataToEsm()adds nothing here: the store's top level is a devalue-flattened array, so the generated module has a single default export and there are no named exports to tree-shake. Its output is essentially the on-disk JSON with unquoted keys.Testing
Green CI
Docs
No docs needed: this changes the internal representation of a virtual module with no user-facing behavior change. No changeset file is added.