New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(server): add ssr.inlineScript config #3448
Conversation
🦋 Changeset detectedLatest commit: 83aa5c7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 214 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
packages/document/main-doc/docs/en/configure/app/server/ssr.mdx
Outdated
Show resolved
Hide resolved
packages/document/main-doc/docs/zh/configure/app/server/ssr.mdx
Outdated
Show resolved
Hide resolved
5ea90b8
to
4217387
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #3448 +/- ##
==========================================
+ Coverage 57.59% 58.28% +0.68%
==========================================
Files 672 671 -1
Lines 17794 17775 -19
Branches 3876 3867 -9
==========================================
+ Hits 10249 10360 +111
+ Misses 6934 6810 -124
+ Partials 611 605 -6
... and 90 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
4217387
to
aede666
Compare
aede666
to
d0e619d
Compare
09cd8e5
to
31f8806
Compare
31f8806
to
83aa5c7
Compare
Summary
🤖 Generated by Copilot at 15e83c7
This pull request adds a new option
inlineScript
for SSR mode that allows using inline JSON elements instead of inline scripts for server data injection. It updates the documentation, the runtime, the server, and the utils packages to support the new option. It also adds tests and changelogs for the affected packages and creates a new integration test fixture that uses the new option.Details
🤖 Generated by Copilot at 15e83c7
inlineScript
for SSR mode to use inline JSON instead of inline scripts for data injection (link)ssr
configuration in the@modern-js/main-doc
package to explain and demonstrate the new option (link, link, link, link)parsedJSONFromElement
function to the@modern-js/utils
package to parse the JSON data from the HTML element with a given id (link)inlineScript
property to theSSR
type in the@modern-js/server-core
package to indicate whether to use inline scripts or inline JSON for SSR data injection (link)injectServerData
andinjectServerDataStream
functions in the@modern-js/prod-server
package to generate inline JSON elements with the id__MODERN_SERVER_DATA__
instead of inline scripts for the server data injection (link, link)getSSRDataScript
method in theEntry
class in the@modern-js/runtime
package to check theinlineScript
option and generate either inline scripts or inline JSON elements with the corresponding ids for the SSR and router data (link)__MODERN_SERVER_DATA__
,SSR_DATA_JSON_ID
, andROUTER_DATA_JSON_ID
to the global variables_SERVER_DATA
,_SSR_DATA
, and_ROUTER_DATA
in the browser environment in the@modern-js/runtime
and@modern-js/plugin-router-v5
packages (link, link, link)Related Issue
Checklist
pnpm run change
.