@bleedingdev/modern-js-app-tools 3.5.0-ultramodern.99 → 3.8.1-ultramodern.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/modern-bundle-docs.js +7 -0
- package/dist/cjs/builder/generator/getBuilderEnvironments.js +73 -11
- package/dist/cjs/bundleDocs.js +114 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/index.js +1 -1
- package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.js +94 -18
- package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.mjs +1 -0
- package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-worker-mf-ssr-runtime-plugin.mjs +14 -0
- package/dist/cjs/ultramodern-release-envelope/framework-output.js +109 -57
- package/dist/esm/builder/generator/getBuilderEnvironments.mjs +63 -10
- package/dist/esm/bundleDocs.mjs +62 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/index.mjs +1 -1
- package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.mjs +93 -18
- package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.mjs +1 -0
- package/dist/esm/plugins/deploy/platforms/templates/cloudflare-worker-mf-ssr-runtime-plugin.mjs +14 -0
- package/dist/esm/ultramodern-release-envelope/framework-output.mjs +107 -58
- package/dist/esm-node/builder/generator/getBuilderEnvironments.mjs +63 -10
- package/dist/esm-node/bundleDocs.mjs +63 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/index.mjs +1 -1
- package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.mjs +93 -18
- package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.mjs +1 -0
- package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-worker-mf-ssr-runtime-plugin.mjs +14 -0
- package/dist/esm-node/ultramodern-release-envelope/framework-output.mjs +107 -58
- package/dist/types/builder/generator/getBuilderEnvironments.d.ts +29 -0
- package/dist/types/bundleDocs.d.ts +20 -0
- package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.d.ts +1 -1
- package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.d.mts +1 -1
- package/dist/types/plugins/deploy/platforms/templates/cloudflare-worker-mf-ssr-runtime-plugin.d.mts +13 -0
- package/dist/types/ultramodern-release-envelope/framework-output.d.ts +1 -0
- package/docs/apis/app/{commands.mdx → commands.md} +35 -9
- package/docs/apis/app/hooks/api/{lambda.mdx → lambda.md} +2 -6
- package/docs/apis/app/hooks/config/{favicon.mdx → favicon.md} +1 -6
- package/docs/apis/app/hooks/config/{html.mdx → html.md} +1 -5
- package/docs/apis/app/hooks/config/{icon.mdx → icon.md} +1 -6
- package/docs/apis/app/hooks/config/{mock.mdx → mock.md} +1 -5
- package/docs/apis/app/hooks/config/{public.mdx → public.md} +0 -4
- package/docs/apis/app/hooks/config/{upload.mdx → upload.md} +3 -7
- package/docs/apis/app/hooks/{modern-config.mdx → modern-config.md} +1 -5
- package/docs/apis/app/hooks/server/{server.mdx → server.md} +1 -6
- package/docs/apis/app/hooks/{shared.mdx → shared.md} +0 -4
- package/docs/apis/app/hooks/src/{app.mdx → app.md} +2 -2
- package/docs/apis/app/hooks/src/{entry.mdx → entry.md} +1 -6
- package/docs/apis/app/hooks/src/{entry.server.mdx → entry.server.md} +0 -5
- package/docs/apis/app/hooks/src/{modern.runtime.mdx → modern.runtime.md} +1 -5
- package/docs/apis/app/hooks/src/{routes.mdx → routes.md} +3 -7
- package/docs/apis/app/hooks/src/{server.mdx → server.md} +1 -5
- package/docs/apis/app/runtime/bff/{use-backend-context.mdx → use-backend-context.md} +0 -3
- package/docs/apis/app/runtime/core/{create-root.mdx → create-root.md} +0 -3
- package/docs/apis/app/runtime/core/{render.mdx → render.md} +1 -4
- package/docs/apis/app/runtime/core/{runtime-context.mdx → runtime-context.md} +0 -4
- package/docs/apis/app/runtime/router/{router.mdx → router.md} +1 -6
- package/docs/apis/app/runtime/ssr/{no-ssr.mdx → no-ssr.md} +0 -3
- package/docs/apis/app/runtime/ssr/{renderStreaming.mdx → renderStreaming.md} +0 -4
- package/docs/apis/app/runtime/ssr/{renderString.mdx → renderString.md} +0 -4
- package/docs/apis/app/runtime/ssr/{requestHandler.mdx → requestHandler.md} +0 -4
- package/docs/apis/app/runtime/utility/{css-in-js.mdx → css-in-js.md} +0 -4
- package/docs/apis/app/runtime/utility/{head.mdx → head.md} +0 -3
- package/docs/apis/app/runtime/utility/{loadable.mdx → loadable.md} +0 -3
- package/docs/community/blog/2022-0708-updates.md +91 -0
- package/docs/community/blog/2022-0910-updates.md +76 -0
- package/docs/community/blog/overview.md +63 -0
- package/docs/community/blog/v2-release-note.md +238 -0
- package/docs/community/blog/v3-release-note.md +622 -0
- package/docs/community/contributing-guide.md +252 -0
- package/docs/community/releases.md +23 -0
- package/docs/community/showcase.md +24 -0
- package/docs/community/team.md +14 -0
- package/docs/configure/app/bff/{cross-project.mdx → cross-project.md} +4 -8
- package/docs/configure/app/bff/{effect.mdx → effect.md} +16 -22
- package/docs/configure/app/bff/{prefix.mdx → prefix.md} +3 -7
- package/docs/configure/app/bff/{runtime-framework.mdx → runtime-framework.md} +3 -7
- package/docs/configure/app/{builder-plugins.mdx → builder-plugins.md} +4 -8
- package/docs/configure/app/dev/{asset-prefix.mdx → asset-prefix.md} +4 -9
- package/docs/configure/app/dev/{before-start-url.mdx → before-start-url.md} +0 -4
- package/docs/configure/app/dev/{client.mdx → client.md} +3 -7
- package/docs/configure/app/dev/hmr.md +10 -0
- package/docs/configure/app/dev/{host.mdx → host.md} +0 -4
- package/docs/configure/app/dev/{https.mdx → https.md} +0 -4
- package/docs/configure/app/dev/{lazy-compilation.mdx → lazy-compilation.md} +2 -8
- package/docs/configure/app/dev/live-reload.md +10 -0
- package/docs/configure/app/dev/{mock-dir.mdx → mock-dir.md} +0 -4
- package/docs/configure/app/dev/progress-bar.md +19 -0
- package/docs/configure/app/dev/{server.mdx → server.md} +0 -4
- package/docs/configure/app/dev/{setup-middlewares.mdx → setup-middlewares.md} +3 -7
- package/docs/configure/app/dev/{start-url.mdx → start-url.md} +0 -5
- package/docs/configure/app/dev/{watch-files.mdx → watch-files.md} +3 -7
- package/docs/configure/app/dev/{write-to-disk.mdx → write-to-disk.md} +3 -7
- package/docs/configure/app/experiments/{source-build.mdx → source-build.md} +1 -3
- package/docs/configure/app/html/{app-icon.mdx → app-icon.md} +3 -7
- package/docs/configure/app/html/{crossorigin.mdx → crossorigin.md} +3 -7
- package/docs/configure/app/html/{favicon.mdx → favicon.md} +3 -7
- package/docs/configure/app/html/inject.md +10 -0
- package/docs/configure/app/html/{meta.mdx → meta.md} +3 -7
- package/docs/configure/app/html/{mount-id.mdx → mount-id.md} +3 -7
- package/docs/configure/app/html/output-structure.md +10 -0
- package/docs/configure/app/html/script-loading.md +10 -0
- package/docs/configure/app/html/{tags.mdx → tags.md} +3 -7
- package/docs/configure/app/html/{template-parameters.mdx → template-parameters.md} +3 -7
- package/docs/configure/app/html/template.md +10 -0
- package/docs/configure/app/html/title.md +18 -0
- package/docs/configure/app/output/asset-prefix.md +11 -0
- package/docs/configure/app/output/{assets-retry.mdx → assets-retry.md} +1 -5
- package/docs/configure/app/output/{charset.mdx → charset.md} +3 -7
- package/docs/configure/app/output/{clean-dist-path.mdx → clean-dist-path.md} +0 -4
- package/docs/configure/app/output/{convert-to-rem.mdx → convert-to-rem.md} +12 -16
- package/docs/configure/app/output/{copy.mdx → copy.md} +3 -7
- package/docs/configure/app/output/{css-modules.mdx → css-modules.md} +3 -7
- package/docs/configure/app/output/{data-uri-limit.mdx → data-uri-limit.md} +3 -7
- package/docs/configure/app/output/{disable-css-module-extension.mdx → disable-css-module-extension.md} +3 -7
- package/docs/configure/app/output/{disable-inline-runtime-chunk.mdx → disable-inline-runtime-chunk.md} +0 -4
- package/docs/configure/app/output/{disable-svgr.mdx → disable-svgr.md} +0 -4
- package/docs/configure/app/output/{disable-ts-checker.mdx → disable-ts-checker.md} +0 -4
- package/docs/configure/app/output/{dist-path.mdx → dist-path.md} +3 -11
- package/docs/configure/app/output/{enable-asset-manifest.mdx → enable-asset-manifest.md} +0 -4
- package/docs/configure/app/output/{enable-css-module-tsdeclaration.mdx → enable-css-module-tsdeclaration.md} +0 -4
- package/docs/configure/app/output/{enable-inline-route-manifests.mdx → enable-inline-route-manifests.md} +0 -4
- package/docs/configure/app/output/{externals.mdx → externals.md} +3 -7
- package/docs/configure/app/output/filename-hash.md +10 -0
- package/docs/configure/app/output/{filename.mdx → filename.md} +3 -7
- package/docs/configure/app/output/inject-styles.md +10 -0
- package/docs/configure/app/output/{inline-scripts.mdx → inline-scripts.md} +4 -8
- package/docs/configure/app/output/{inline-styles.mdx → inline-styles.md} +4 -8
- package/docs/configure/app/output/{legal-comments.mdx → legal-comments.md} +3 -7
- package/docs/configure/app/output/{minify.mdx → minify.md} +3 -7
- package/docs/configure/app/output/{override-browserslist.mdx → override-browserslist.md} +4 -8
- package/docs/configure/app/output/polyfill.md +12 -0
- package/docs/configure/app/output/{source-map.mdx → source-map.md} +3 -7
- package/docs/configure/app/output/{split-route-chunks.mdx → split-route-chunks.md} +0 -4
- package/docs/configure/app/output/{ssg.mdx → ssg.md} +3 -7
- package/docs/configure/app/output/{ssgByEntries.mdx → ssgByEntries.md} +1 -4
- package/docs/configure/app/output/{svg-default-export.mdx → svg-default-export.md} +0 -4
- package/docs/configure/app/output/{temp-dir.mdx → temp-dir.md} +0 -4
- package/docs/configure/app/performance/{build-cache.mdx → build-cache.md} +3 -7
- package/docs/configure/app/performance/{chunk-split.mdx → chunk-split.md} +3 -7
- package/docs/configure/app/performance/{dns-prefetch.mdx → dns-prefetch.md} +3 -7
- package/docs/configure/app/performance/preconnect.md +16 -0
- package/docs/configure/app/performance/{prefetch.mdx → prefetch.md} +3 -7
- package/docs/configure/app/performance/{preload.mdx → preload.md} +3 -7
- package/docs/configure/app/performance/{print-file-size.mdx → print-file-size.md} +3 -7
- package/docs/configure/app/performance/profile.md +10 -0
- package/docs/configure/app/performance/remove-console.md +10 -0
- package/docs/configure/app/performance/remove-moment-locale.md +10 -0
- package/docs/configure/app/performance/{rsdoctor.mdx → rsdoctor.md} +0 -4
- package/docs/configure/app/{plugins.mdx → plugins.md} +4 -4
- package/docs/configure/app/resolve/{alias-strategy.mdx → alias-strategy.md} +3 -7
- package/docs/configure/app/resolve/alias.md +9 -0
- package/docs/configure/app/resolve/{condition-names.mdx → condition-names.md} +3 -8
- package/docs/configure/app/resolve/{dedupe.mdx → dedupe.md} +3 -7
- package/docs/configure/app/resolve/{extensions.mdx → extensions.md} +3 -8
- package/docs/configure/app/runtime/{0-intro.mdx → 0-intro.md} +1 -4
- package/docs/configure/app/runtime/{plugins.mdx → plugins.md} +1 -1
- package/docs/configure/app/runtime/{router.mdx → router.md} +3 -7
- package/docs/configure/app/security/{check-syntax.mdx → check-syntax.md} +0 -4
- package/docs/configure/app/security/{nonce.mdx → nonce.md} +3 -7
- package/docs/configure/app/security/{sri.mdx → sri.md} +0 -4
- package/docs/configure/app/server/{base-url.mdx → base-url.md} +0 -4
- package/docs/configure/app/server/{port.mdx → port.md} +3 -7
- package/docs/configure/app/server/{public-routes.mdx → public-routes.md} +0 -4
- package/docs/configure/app/server/{routes.mdx → routes.md} +1 -5
- package/docs/configure/app/server/rsc.md +22 -0
- package/docs/configure/app/server/{ssr-by-entries.mdx → ssr-by-entries.md} +1 -5
- package/docs/configure/app/server/ssr.md +80 -0
- package/docs/configure/app/server/{tsconfig-path.mdx → tsconfig-path.md} +0 -4
- package/docs/configure/app/source/{alias-strategy.mdx → alias-strategy.md} +4 -8
- package/docs/configure/app/source/{alias.mdx → alias.md} +4 -8
- package/docs/configure/app/source/{config-dir.mdx → config-dir.md} +1 -5
- package/docs/configure/app/source/{decorators.mdx → decorators.md} +0 -4
- package/docs/configure/app/source/{define.mdx → define.md} +3 -7
- package/docs/configure/app/source/{disable-default-entries.mdx → disable-default-entries.md} +2 -6
- package/docs/{components/module-federation.mdx → configure/app/source/enable-async-entry.md} +47 -0
- package/docs/configure/app/source/{enable-async-pre-entry.mdx → enable-async-pre-entry.md} +0 -4
- package/docs/configure/app/source/{entries-dir.mdx → entries-dir.md} +0 -4
- package/docs/configure/app/source/{entries.mdx → entries.md} +1 -5
- package/docs/configure/app/source/{exclude.mdx → exclude.md} +4 -8
- package/docs/configure/app/source/{global-vars.mdx → global-vars.md} +0 -4
- package/docs/configure/app/source/{include.mdx → include.md} +4 -8
- package/docs/configure/app/source/{main-entry-name.mdx → main-entry-name.md} +0 -4
- package/docs/configure/app/source/{pre-entry.mdx → pre-entry.md} +3 -7
- package/docs/configure/app/source/{react-compiler.mdx → react-compiler.md} +0 -4
- package/docs/configure/app/source/{transform-import.mdx → transform-import.md} +3 -7
- package/docs/configure/app/{split-chunks.mdx → split-chunks.md} +3 -3
- package/docs/configure/app/tools/{autoprefixer.mdx → autoprefixer.md} +0 -4
- package/docs/configure/app/tools/{bundler-chain.mdx → bundler-chain.md} +0 -4
- package/docs/configure/app/tools/{css-extract.mdx → css-extract.md} +3 -7
- package/docs/configure/app/tools/{css-loader.mdx → css-loader.md} +3 -7
- package/docs/configure/app/tools/{dev-server.mdx → dev-server.md} +0 -4
- package/docs/configure/app/tools/{html-plugin.mdx → html-plugin.md} +3 -7
- package/docs/configure/app/tools/{less.mdx → less.md} +0 -4
- package/docs/configure/app/tools/{lightningcss-loader.mdx → lightningcss-loader.md} +3 -7
- package/docs/configure/app/tools/{minify-css.mdx → minify-css.md} +0 -4
- package/docs/configure/app/tools/{postcss.mdx → postcss.md} +3 -7
- package/docs/configure/app/tools/rspack.md +10 -0
- package/docs/configure/app/tools/{sass.mdx → sass.md} +0 -4
- package/docs/configure/app/tools/style-loader.md +10 -0
- package/docs/configure/app/tools/{swc.mdx → swc.md} +4 -8
- package/docs/configure/app/tools/{ts-checker.mdx → ts-checker.md} +20 -7
- package/docs/configure/app/{usage.mdx → usage.md} +1 -1
- package/docs/guides/advanced-features/bff/{cross-project.mdx → cross-project.md} +1 -2
- package/docs/guides/advanced-features/bff/{data-platform.mdx → data-platform.md} +0 -4
- package/docs/guides/advanced-features/bff/{extend-server.mdx → extend-server.md} +1 -1
- package/docs/guides/advanced-features/bff/frameworks.md +243 -0
- package/docs/guides/advanced-features/bff/{function.mdx → function.md} +60 -7
- package/docs/guides/advanced-features/bff/{operators.mdx → operators.md} +2 -77
- package/docs/{components/bff-upload.mdx → guides/advanced-features/bff/upload.md} +4 -0
- package/docs/guides/advanced-features/{bff.mdx → bff.md} +0 -4
- package/docs/guides/advanced-features/{build-performance.mdx → build-performance.md} +3 -7
- package/docs/guides/advanced-features/{compatibility.mdx → compatibility.md} +54 -15
- package/docs/guides/advanced-features/international/{advanced.mdx → advanced.md} +0 -4
- package/docs/guides/advanced-features/international/{api.mdx → api.md} +16 -20
- package/docs/guides/advanced-features/international/{best-practices.mdx → best-practices.md} +0 -4
- package/docs/guides/advanced-features/international/configuration.md +228 -0
- package/docs/guides/advanced-features/international/{locale-detection.mdx → locale-detection.md} +25 -29
- package/docs/guides/advanced-features/international/{quick-start.mdx → quick-start.md} +29 -13
- package/docs/guides/advanced-features/international/{resource-loading.mdx → resource-loading.md} +11 -15
- package/docs/guides/advanced-features/international/{routing.mdx → routing.md} +12 -16
- package/docs/guides/advanced-features/international.md +27 -0
- package/docs/guides/advanced-features/{low-level.mdx → low-level.md} +17 -21
- package/docs/guides/advanced-features/page-performance/{code-split.mdx → code-split.md} +2 -6
- package/docs/guides/advanced-features/page-performance/{inline-assets.mdx → inline-assets.md} +3 -7
- package/docs/guides/advanced-features/page-performance/{optimize-bundle.mdx → optimize-bundle.md} +4 -8
- package/docs/{components/internal-logger.mdx → guides/advanced-features/server-monitor/logger.md} +16 -0
- package/docs/guides/advanced-features/server-monitor/metrics.md +58 -0
- package/docs/guides/advanced-features/server-monitor/{monitors.mdx → monitors.md} +3 -3
- package/docs/guides/advanced-features/{source-build.mdx → source-build.md} +1 -5
- package/docs/guides/advanced-features/{web-server.mdx → web-server.md} +1 -9
- package/docs/guides/basic-features/{alias.mdx → alias.md} +3 -7
- package/docs/guides/basic-features/css/{css-in-js.mdx → css-in-js.md} +12 -9
- package/docs/guides/basic-features/css/{css-modules.mdx → css-modules.md} +3 -3
- package/docs/guides/basic-features/css/{css.mdx → css.md} +2 -6
- package/docs/guides/basic-features/data/{data-cache.mdx → data-cache.md} +1 -6
- package/docs/guides/basic-features/data/{data-fetch.mdx → data-fetch.md} +4 -8
- package/docs/guides/basic-features/data/{data-write.mdx → data-write.md} +6 -9
- package/docs/guides/basic-features/debug/{mock.mdx → mock.md} +1 -5
- package/docs/guides/basic-features/debug/{proxy.mdx → proxy.md} +1 -5
- package/docs/guides/basic-features/debug/{using-storybook.mdx → using-storybook.md} +20 -8
- package/docs/guides/basic-features/{deploy.mdx → deploy.md} +23 -13
- package/docs/guides/basic-features/{env-vars.mdx → env-vars.md} +8 -12
- package/docs/guides/basic-features/{html.mdx → html.md} +3 -7
- package/docs/guides/basic-features/{output-files.mdx → output-files.md} +6 -10
- package/docs/guides/basic-features/render/{before-render.mdx → before-render.md} +1 -1
- package/docs/guides/basic-features/render/overview.md +47 -0
- package/docs/guides/basic-features/render/{rsc.mdx → rsc.md} +16 -33
- package/docs/guides/basic-features/render/{ssg.mdx → ssg.md} +71 -10
- package/docs/guides/basic-features/render/{ssr-cache.mdx → ssr-cache.md} +5 -5
- package/docs/guides/basic-features/render/{ssr.mdx → ssr.md} +10 -12
- package/docs/guides/basic-features/render/{streaming-ssr.mdx → streaming-ssr.md} +5 -8
- package/docs/guides/basic-features/routes/{config-routes.mdx → config-routes.md} +10 -11
- package/docs/guides/basic-features/routes/{routes.mdx → routes.md} +8 -16
- package/docs/guides/basic-features/static-assets/{json-files.mdx → json-files.md} +0 -4
- package/docs/guides/basic-features/static-assets/{svg-assets.mdx → svg-assets.md} +3 -7
- package/docs/guides/basic-features/static-assets/{wasm-assets.mdx → wasm-assets.md} +1 -5
- package/docs/guides/basic-features/{static-assets.mdx → static-assets.md} +10 -14
- package/docs/guides/basic-features/testing/{playwright.mdx → playwright.md} +12 -3
- package/docs/guides/basic-features/testing/{rstest.mdx → rstest.md} +70 -11
- package/docs/guides/concept/{builder.mdx → builder.md} +3 -26
- package/docs/guides/concept/{entries.mdx → entries.md} +11 -17
- package/docs/guides/concept/{server.mdx → server.md} +3 -3
- package/docs/guides/get-started/{ai-coding-agents.mdx → ai-coding-agents.md} +4 -9
- package/docs/guides/get-started/glossary.md +63 -0
- package/docs/guides/get-started/{introduction.mdx → introduction.md} +1 -6
- package/docs/guides/get-started/quick-start.md +269 -0
- package/docs/guides/get-started/{tech-stack.mdx → tech-stack.md} +9 -15
- package/docs/guides/get-started/{ultramodern.mdx → ultramodern.md} +38 -31
- package/docs/guides/get-started/{upgrade.mdx → upgrade.md} +26 -22
- package/docs/guides/topic-detail/module-federation/{application.mdx → application.md} +3 -3
- package/docs/guides/topic-detail/module-federation/{deploy.mdx → deploy.md} +2 -2
- package/docs/guides/topic-detail/module-federation/{i18n.mdx → i18n.md} +14 -14
- package/docs/guides/topic-detail/module-federation/{introduce.mdx → introduce.md} +2 -3
- package/docs/guides/topic-detail/module-federation/{ssr.mdx → ssr.md} +12 -7
- package/docs/guides/topic-detail/module-federation/{usage.mdx → usage.md} +20 -3
- package/docs/guides/troubleshooting/{builder.mdx → builder.md} +10 -14
- package/docs/guides/troubleshooting/{cli.mdx → cli.md} +0 -4
- package/docs/guides/troubleshooting/{dependencies.mdx → dependencies.md} +7 -11
- package/docs/guides/troubleshooting/{hmr.mdx → hmr.md} +5 -9
- package/docs/guides/upgrade/{config.mdx → config.md} +8 -5
- package/docs/guides/upgrade/{entry.mdx → entry.md} +6 -6
- package/docs/guides/upgrade/{other.mdx → other.md} +8 -8
- package/docs/guides/upgrade/{overview.mdx → overview.md} +4 -4
- package/docs/guides/upgrade/{tailwindcss.mdx → tailwindcss.md} +0 -1
- package/docs/guides/upgrade/web-server.md +11 -11
- package/docs/index.md +33 -4
- package/docs/llms.txt +290 -0
- package/docs/plugin/cli-plugins/api.md +573 -0
- package/docs/plugin/cli-plugins/life-cycle.md +2 -0
- package/docs/plugin/introduction.md +152 -0
- package/docs/plugin/official/cli-plugins/plugin-bff.md +5 -0
- package/docs/plugin/official/cli-plugins/plugin-ssg.md +5 -0
- package/docs/plugin/official/cli-plugins/plugin-styled-components.md +5 -0
- package/docs/plugin/official/cli-plugins.md +4 -0
- package/docs/plugin/plugin-system.md +238 -0
- package/docs/plugin/runtime-plugins/api.md +194 -0
- package/docs/plugin/runtime-plugins/life-cycle.md +2 -0
- package/docs/plugin/server-plugins/api.md +209 -0
- package/docs/plugin/server-plugins/life-cycle.md +13 -0
- package/docs/tutorials/examples/csr-auth.md +9 -0
- package/docs/tutorials/foundations/introduction.md +16 -0
- package/package.json +33 -15
- package/docs/_nav.json +0 -36
- package/docs/apis/_meta.json +0 -13
- package/docs/apis/app/hooks/_meta.json +0 -28
- package/docs/apis/app/hooks/config/_meta.json +0 -1
- package/docs/apis/app/runtime/_meta.json +0 -32
- package/docs/components/auto-upgrade.mdx +0 -0
- package/docs/components/build-output.mdx +0 -45
- package/docs/components/bundler.mdx +0 -3
- package/docs/components/convention-routing-motivation.mdx +0 -0
- package/docs/components/debug-app.mdx +0 -15
- package/docs/components/default-browserslist.mdx +0 -7
- package/docs/components/deploy-command.mdx +0 -14
- package/docs/components/deploy.mdx +0 -1
- package/docs/components/enable-bff-caution.mdx +0 -3
- package/docs/components/enable-bff.mdx +0 -56
- package/docs/components/enable-ssg.mdx +0 -49
- package/docs/components/entry-mode.mdx +0 -0
- package/docs/components/entry-scan-logic.mdx +0 -7
- package/docs/components/extend-bff-function.mdx +0 -3
- package/docs/components/hono.mdx +0 -120
- package/docs/components/init-app.mdx +0 -93
- package/docs/components/init-rspack-app.mdx +0 -5
- package/docs/components/internal-metrics.mdx +0 -20
- package/docs/components/international/custom-instance-code.mdx +0 -16
- package/docs/components/international/init-options-desc.mdx +0 -1
- package/docs/components/international/install-command.mdx +0 -10
- package/docs/components/international/instance-code.mdx +0 -16
- package/docs/components/international/introduce.mdx +0 -5
- package/docs/components/international/platform-support.mdx +0 -0
- package/docs/components/language-config.mdx +0 -9
- package/docs/components/micro-frontend.mdx +0 -6
- package/docs/components/micro-master-manifest-config.mdx +0 -15
- package/docs/components/micro-runtime-config.mdx +0 -17
- package/docs/components/new-entry-tooltip.mdx +0 -0
- package/docs/components/nodeVersion.mdx +0 -28
- package/docs/components/other-plugins.mdx +0 -0
- package/docs/components/output-asset-prefix-extend.mdx +0 -0
- package/docs/components/output-distpath-warning.mdx +0 -0
- package/docs/components/output-polyfill-extend.mdx +0 -1
- package/docs/components/prerequisites.mdx +0 -18
- package/docs/components/release-note.mdx +0 -1
- package/docs/components/routes-practice.mdx +0 -0
- package/docs/components/rsbuild-config-tooltip.mdx +0 -5
- package/docs/components/rsbuild.mdx +0 -3
- package/docs/components/rsc-deploy-tip.mdx +0 -1
- package/docs/components/rspack.mdx +0 -3
- package/docs/components/rspackTip.mdx +0 -7
- package/docs/components/runtime-cli-config.mdx +0 -0
- package/docs/components/serve-command.mdx +0 -22
- package/docs/components/ssr-monitor.mdx +0 -3
- package/docs/components/stream-ssr-performance.mdx +0 -0
- package/docs/components/swc.mdx +0 -3
- package/docs/components/tech-stack-node-framework.mdx +0 -1
- package/docs/components/turtorials-example-list.mdx +0 -2
- package/docs/components/ua-polyfill.mdx +0 -44
- package/docs/components/upgrade-browserslist.mdx +0 -0
- package/docs/components/upgrade-config-deploy.mdx +0 -0
- package/docs/components/upgrade-faq.mdx +0 -0
- package/docs/configure/_meta.json +0 -78
- package/docs/configure/app/dev/hmr.mdx +0 -14
- package/docs/configure/app/dev/live-reload.mdx +0 -14
- package/docs/configure/app/dev/progress-bar.mdx +0 -23
- package/docs/configure/app/html/inject.mdx +0 -14
- package/docs/configure/app/html/output-structure.mdx +0 -14
- package/docs/configure/app/html/script-loading.mdx +0 -14
- package/docs/configure/app/html/template.mdx +0 -14
- package/docs/configure/app/html/title.mdx +0 -22
- package/docs/configure/app/output/asset-prefix.mdx +0 -18
- package/docs/configure/app/output/filename-hash.mdx +0 -14
- package/docs/configure/app/output/inject-styles.mdx +0 -14
- package/docs/configure/app/output/polyfill.mdx +0 -18
- package/docs/configure/app/performance/preconnect.mdx +0 -20
- package/docs/configure/app/performance/profile.mdx +0 -14
- package/docs/configure/app/performance/remove-console.mdx +0 -14
- package/docs/configure/app/performance/remove-moment-locale.mdx +0 -14
- package/docs/configure/app/resolve/alias.mdx +0 -13
- package/docs/configure/app/server/rsc.mdx +0 -30
- package/docs/configure/app/server/ssr.mdx +0 -85
- package/docs/configure/app/source/enable-async-entry.mdx +0 -54
- package/docs/configure/app/tools/rspack.mdx +0 -14
- package/docs/configure/app/tools/style-loader.mdx +0 -14
- package/docs/guides/_meta.json +0 -37
- package/docs/guides/advanced-features/_meta.json +0 -32
- package/docs/guides/advanced-features/bff/_meta.json +0 -10
- package/docs/guides/advanced-features/bff/frameworks.mdx +0 -131
- package/docs/guides/advanced-features/bff/upload.mdx +0 -7
- package/docs/guides/advanced-features/international/_meta.json +0 -10
- package/docs/guides/advanced-features/international/configuration.mdx +0 -222
- package/docs/guides/advanced-features/international.mdx +0 -29
- package/docs/guides/advanced-features/page-performance/_meta.json +0 -1
- package/docs/guides/advanced-features/server-monitor/_meta.json +0 -1
- package/docs/guides/advanced-features/server-monitor/logger.mdx +0 -19
- package/docs/guides/advanced-features/server-monitor/metrics.mdx +0 -41
- package/docs/guides/basic-features/_meta.json +0 -49
- package/docs/guides/basic-features/css/_meta.json +0 -1
- package/docs/guides/basic-features/data/_meta.json +0 -1
- package/docs/guides/basic-features/debug/_meta.json +0 -1
- package/docs/guides/basic-features/render/_meta.json +0 -1
- package/docs/guides/basic-features/render/overview.mdx +0 -51
- package/docs/guides/basic-features/routes/_meta.json +0 -1
- package/docs/guides/basic-features/static-assets/_meta.json +0 -1
- package/docs/guides/basic-features/testing/_meta.json +0 -1
- package/docs/guides/concept/_meta.json +0 -1
- package/docs/guides/get-started/_meta.json +0 -9
- package/docs/guides/get-started/glossary.mdx +0 -63
- package/docs/guides/get-started/quick-start.mdx +0 -92
- package/docs/guides/topic-detail/_meta.json +0 -8
- package/docs/guides/topic-detail/module-federation/_meta.json +0 -1
- package/docs/guides/troubleshooting/_meta.json +0 -1
- package/docs/guides/upgrade/_meta.json +0 -1
- package/scripts/copy-main-doc.mjs +0 -50
- /package/docs/guides/advanced-features/bff/{sdk.mdx → sdk.md} +0 -0
- /package/docs/guides/advanced-features/page-performance/{react-compiler.mdx → react-compiler.md} +0 -0
- /package/docs/guides/basic-features/css/{tailwindcss.mdx → tailwindcss.md} +0 -0
- /package/docs/guides/basic-features/debug/{rsdoctor.mdx → rsdoctor.md} +0 -0
package/docs/guides/advanced-features/page-performance/{optimize-bundle.mdx → optimize-bundle.md}
RENAMED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
sidebar_position: 13
|
|
3
|
-
---
|
|
4
|
-
|
|
5
1
|
# Bundle Size Optimization
|
|
6
2
|
|
|
7
3
|
Bundle size optimization is an important part of optimizing your production environment because it directly affects the user experience. In this document, we will introduce some common bundle size optimization methods in Modern.js.
|
|
@@ -46,7 +42,7 @@ This will generate a bundle analysis report to help you identify large dependenc
|
|
|
46
42
|
|
|
47
43
|
Modern.js will compile the code according to the project's Browserslist config, and inject some Polyfills. If the project does not need to be compatible with legacy browsers, you can adjust the Browserslist and drop some legacy browsers, thereby reducing the compilation overhead on syntax and polyfill.
|
|
48
44
|
|
|
49
|
-
Modern.js's default [`output.overrideBrowserslist`](/configure/app/output/override-browserslist.
|
|
45
|
+
Modern.js's default [`output.overrideBrowserslist`](/configure/app/output/override-browserslist.md) config is:
|
|
50
46
|
|
|
51
47
|
```js
|
|
52
48
|
['chrome >= 87', 'edge >= 88', 'firefox >= 78', 'safari >= 14'];
|
|
@@ -59,12 +55,12 @@ For example, if you only need to be compatible with browsers above Chrome 100, y
|
|
|
59
55
|
```
|
|
60
56
|
|
|
61
57
|
:::tip
|
|
62
|
-
Please read the [Browserslist configuration](/guides/advanced-features/compatibility.
|
|
58
|
+
Please read the [Browserslist configuration](/guides/advanced-features/compatibility.md) chapter to know more about the usage of Browserslist.
|
|
63
59
|
:::
|
|
64
60
|
|
|
65
61
|
## Usage polyfill
|
|
66
62
|
|
|
67
|
-
When it is clear that third-party dependencies do not require additional polyfills, you can set [output.polyfill](/configure/app/output/polyfill.
|
|
63
|
+
When it is clear that third-party dependencies do not require additional polyfills, you can set [output.polyfill](/configure/app/output/polyfill.md) to `usage`.
|
|
68
64
|
|
|
69
65
|
In `usage` mode, Modern.js analyzes the syntax used in the source code and injects the required polyfill code on demand to reduce the size of polyfill.
|
|
70
66
|
|
|
@@ -77,7 +73,7 @@ export default {
|
|
|
77
73
|
```
|
|
78
74
|
|
|
79
75
|
:::tip
|
|
80
|
-
Please read the [Browser Compatibility](/guides/advanced-features/compatibility) chapter to know more about the usage of Browserslist.
|
|
76
|
+
Please read the [Browser Compatibility](/guides/advanced-features/compatibility.md) chapter to know more about the usage of Browserslist.
|
|
81
77
|
:::
|
|
82
78
|
|
|
83
79
|
## Image Compression
|
package/docs/{components/internal-logger.mdx → guides/advanced-features/server-monitor/logger.md}
RENAMED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
# Logs Events
|
|
2
|
+
|
|
3
|
+
Log events are distributed by Modern.js as events of type `log`.
|
|
4
|
+
|
|
5
|
+
## Built-in Events
|
|
6
|
+
|
|
7
|
+
Based on server-side runtime logic, Modern.js provides the following log events:
|
|
8
|
+
|
|
9
|
+
| Stage | Message | Level |
|
|
10
|
+
| -------------- | --------------------------------------------- | ----- |
|
|
11
|
+
| RENDER\_HTML | App Render To HTML | error |
|
|
12
|
+
| RENDER\_STREAM | An error occurs during streaming SSR | error |
|
|
13
|
+
| RENDER\_SHELL | An error occurs during streaming render shell | error |
|
|
14
|
+
|
|
15
|
+
## Built-in Monitor
|
|
16
|
+
|
|
1
17
|
In Modern.js, log events are handled by `LoggerMonitor`, which outputs logs to the console.
|
|
2
18
|
|
|
3
19
|
:::info
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Metrics Events
|
|
2
|
+
|
|
3
|
+
Metric events are distributed by Monitors as events of type `timing` or `counter`.
|
|
4
|
+
|
|
5
|
+
## Built-in Events
|
|
6
|
+
|
|
7
|
+
When SSR is enabled, we need to monitor server-side phase durations and have the capability to diagnose server-side issues.
|
|
8
|
+
|
|
9
|
+
Based on server-side runtime logic, Modern.js provides the following metric events:
|
|
10
|
+
|
|
11
|
+
| Key | Description |
|
|
12
|
+
| ------------------------ | ---------------------------------------------------------------------------------------------------------------------- |
|
|
13
|
+
| server-handle-request | Modern.js Server request handling duration |
|
|
14
|
+
| ssr-render-shell | \[SSR] When using Streaming SSR, React renders a shell for early streaming. This marks shell rendering completion time |
|
|
15
|
+
| ssr-render-html | \[SSR] Time taken by React to render component tree to HTML (typically under 50ms) |
|
|
16
|
+
| server-middleware | Total execution time of Modern.js custom server middlewares |
|
|
17
|
+
| server-loader | Server-side Data Loader total duration |
|
|
18
|
+
| server-loader-#id | Individual Data Loader durations on server-side |
|
|
19
|
+
| server-loader-navigation | Server-side Data Loader duration during client navigation |
|
|
20
|
+
|
|
21
|
+
Modern.js server workflow diagram:
|
|
22
|
+
|
|
23
|
+

|
|
24
|
+
|
|
25
|
+
## Built-in Monitor
|
|
26
|
+
|
|
27
|
+
In Modern.js, metric events are also handled by `LoggerMonitor`, which outputs metrics to the console in a specific format.
|
|
28
|
+
|
|
29
|
+
:::info
|
|
30
|
+
The built-in `LoggerMonitor` depends on the [rslog](https://www.npmjs.com/package/rslog) library.
|
|
31
|
+
:::
|
|
32
|
+
|
|
33
|
+
The `rslog` instance initialized in Modern.js outputs logs at `debug` level and above in development environment by default, and outputs all logs in production environment. In the built-in `LoggerMonitor`, all metric events are output as Debug logs. Therefore, if you want to view metric event information in the development environment, you need to add additional environment variables.
|
|
34
|
+
|
|
35
|
+
Developers can add the environment variable `DEBUG=true` when running the `dev` command. If running normally, after accessing, you can see the following output in the console:
|
|
36
|
+
|
|
37
|
+
```shell
|
|
38
|
+
> Local: http://localhost:8080/
|
|
39
|
+
> press h + enter to show shortcuts
|
|
40
|
+
|
|
41
|
+
debug SSR Debug - server-loader, cost: 2.000094, req.url = /
|
|
42
|
+
debug SSR Debug - ssr-prerender, cost: 6.99997, req.url = /
|
|
43
|
+
debug SSR Debug - ssr-render-html, cost: 0.999927, req.url = /
|
|
44
|
+
debug Debug - server-handle-request, cost: 19.999981, req.url = /
|
|
45
|
+
debug --> GET / 200 90ms
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Server-Timing
|
|
49
|
+
|
|
50
|
+
Modern.js injects phase metrics as Server-Timing headers into HTML responses.
|
|
51
|
+
|
|
52
|
+
Developers can retrieve these metrics using the [Performance API](https://developer.mozilla.org/en-US/docs/Web/API/Performance) in browsers:
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
const navigation = performance.getEntriesByType('navigation')[0];
|
|
56
|
+
const serverTiming = navigation.serverTiming;
|
|
57
|
+
console.log(serverTiming);
|
|
58
|
+
```
|
|
@@ -68,12 +68,12 @@ export interface Monitors {
|
|
|
68
68
|
|
|
69
69
|
Modern.js comes with a built-in default Monitor, where different events trigger different behaviors in the built-in Monitor. For more details, see:
|
|
70
70
|
|
|
71
|
-
- [Log Event](/guides/advanced-features/server-monitor/logger)
|
|
72
|
-
- [Metrics Event](/guides/advanced-features/server-monitor/metrics)
|
|
71
|
+
- [Log Event](/guides/advanced-features/server-monitor/logger.md)
|
|
72
|
+
- [Metrics Event](/guides/advanced-features/server-monitor/metrics.md)
|
|
73
73
|
|
|
74
74
|
## Register Monitors
|
|
75
75
|
|
|
76
|
-
Developers can register their own Monitors using the `push` API, but this can only be done in [server middleware](/guides/advanced-features/web-server#unstable-middleware) or [server plugins](/plugin/server-plugins/api). Registration is not available in Data Loaders, components, or init functions.
|
|
76
|
+
Developers can register their own Monitors using the `push` API, but this can only be done in [server middleware](/guides/advanced-features/web-server.md#unstable-middleware) or [server plugins](/plugin/server-plugins/api.md). Registration is not available in Data Loaders, components, or init functions.
|
|
77
77
|
|
|
78
78
|
```ts title="server/modern.server.ts"
|
|
79
79
|
import {
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
sidebar_position: 11
|
|
3
|
-
---
|
|
4
|
-
|
|
5
1
|
# Source Code Build Mode
|
|
6
2
|
|
|
7
3
|
The source code build mode is used in the monorepo development scenario, allowing developers to directly reference the source code of other sub-projects within the monorepo for development.
|
|
@@ -68,7 +64,7 @@ The disadvantages are:
|
|
|
68
64
|
|
|
69
65
|
### Enabling Configuration
|
|
70
66
|
|
|
71
|
-
You can enable source code build mode by setting [experiments.sourceBuild](/configure/app/experiments/source-build.
|
|
67
|
+
You can enable source code build mode by setting [experiments.sourceBuild](/configure/app/experiments/source-build.md) to `true`.
|
|
72
68
|
|
|
73
69
|
```ts
|
|
74
70
|
export default {
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
sidebar_position: 16
|
|
3
|
-
---
|
|
4
|
-
|
|
5
1
|
# Custom Web Server
|
|
6
2
|
|
|
7
3
|
Modern.js encapsulates most server-side capabilities required by projects, typically eliminating the need for server-side development. However, in certain scenarios such as user authentication, request preprocessing, or adding page skeletons, custom server-side logic may still be necessary.
|
|
@@ -72,11 +68,7 @@ In the `server/modern.server.ts` file, you can add the following configurations
|
|
|
72
68
|
|
|
73
69
|
In the **Plugin**, you can define **Middleware** and **RenderMiddleware**. The middleware loading process is illustrated in the following diagram:
|
|
74
70
|
|
|
75
|
-
|
|
76
|
-
src="https://lf3-static.bytednsdoc.com/obj/eden-cn/10eh7nuhpenuhog/server-md-wf.png"
|
|
77
|
-
style={{ width: '100%', maxWidth: '540px' }}
|
|
78
|
-
/>
|
|
79
|
-
|
|
71
|
+

|
|
80
72
|
### Basic Configuration
|
|
81
73
|
|
|
82
74
|
```ts title="server/modern.server.ts"
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
sidebar_position: 4
|
|
3
|
-
---
|
|
4
|
-
|
|
5
1
|
# Path Alias
|
|
6
2
|
|
|
7
3
|
Path aliases allow developers to define aliases for modules, making it easier to reference them in code. This can be useful when you want to use a short, easy-to-remember name for a module instead of a long, complex path.
|
|
@@ -11,7 +7,7 @@ For example, if you frequently reference the `src/common/request.ts` module in y
|
|
|
11
7
|
In Modern.js, there are two ways to set up path aliases:
|
|
12
8
|
|
|
13
9
|
- Through the `paths` configuration in `tsconfig.json`.
|
|
14
|
-
- Through the [source.alias](/configure/app/source/alias) configuration.
|
|
10
|
+
- Through the [source.alias](/configure/app/source/alias.md) configuration.
|
|
15
11
|
|
|
16
12
|
## Using `tsconfig.json`'s `paths` Configuration
|
|
17
13
|
|
|
@@ -37,7 +33,7 @@ You can refer to the [TypeScript - paths](https://www.typescriptlang.org/tsconfi
|
|
|
37
33
|
|
|
38
34
|
## Use `source.alias` Configuration
|
|
39
35
|
|
|
40
|
-
Modern.js provides the [source.alias](/configure/app/source/alias) configuration option. You can configure this option using an object or a function.
|
|
36
|
+
Modern.js provides the [source.alias](/configure/app/source/alias.md) configuration option. You can configure this option using an object or a function.
|
|
41
37
|
|
|
42
38
|
### Use Cases
|
|
43
39
|
|
|
@@ -84,7 +80,7 @@ export default {
|
|
|
84
80
|
|
|
85
81
|
The `paths` configuration in `tsconfig.json` takes precedence over the `source.alias` configuration. When a path matches the rules defined in both `paths` and `source.alias`, the value defined in `paths` will be used.
|
|
86
82
|
|
|
87
|
-
You can adjust the priority of these two options using [source.aliasStrategy](/configure/app/source/alias-strategy).
|
|
83
|
+
You can adjust the priority of these two options using [source.aliasStrategy](/configure/app/source/alias-strategy.md).
|
|
88
84
|
|
|
89
85
|
## Default Aliases
|
|
90
86
|
|
|
@@ -10,15 +10,18 @@ The Modern.js plugin `@modern-js/plugin-styled-components` provides support for
|
|
|
10
10
|
|
|
11
11
|
First, you need to install the `styled-components` plugin dependency and the `styled-components` library:
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
|
|
14
|
+
```sh [npm]
|
|
15
|
+
npm install @modern-js/plugin-styled-components styled-components -D
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
```sh [yarn]
|
|
19
|
+
yarn add @modern-js/plugin-styled-components styled-components -D
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
```sh [pnpm]
|
|
23
|
+
pnpm install @modern-js/plugin-styled-components styled-components -D
|
|
24
|
+
```
|
|
22
25
|
|
|
23
26
|
Then configure the `styled-components` plugin in `modern.config.ts`:
|
|
24
27
|
|
|
@@ -38,7 +38,7 @@ export default () => {
|
|
|
38
38
|
|
|
39
39
|
By default, only files ending in `*.module.css` are treated CSS Modules.
|
|
40
40
|
|
|
41
|
-
If you want to treat all CSS files in the source directory as CSS Modules, you can enable the [output.disableCssModuleExtension](/configure/app/output/disable-css-module-extension) config, for example:
|
|
41
|
+
If you want to treat all CSS files in the source directory as CSS Modules, you can enable the [output.disableCssModuleExtension](/configure/app/output/disable-css-module-extension.md) config, for example:
|
|
42
42
|
|
|
43
43
|
```ts
|
|
44
44
|
export default {
|
|
@@ -63,7 +63,7 @@ We do not recommend enabling this config, because after enabling disableCssModul
|
|
|
63
63
|
|
|
64
64
|
By default, only files ending in `*.module.css` are treated CSS Modules.
|
|
65
65
|
|
|
66
|
-
If you want to enable CSS Modules only for specified style files, you can configure [output.cssModules](/configure/app/output/css-modules), for example:
|
|
66
|
+
If you want to enable CSS Modules only for specified style files, you can configure [output.cssModules](/configure/app/output/css-modules.md), for example:
|
|
67
67
|
|
|
68
68
|
```ts
|
|
69
69
|
export default {
|
|
@@ -149,7 +149,7 @@ After adding the type declaration, if the type error still exists, you can try t
|
|
|
149
149
|
|
|
150
150
|
Although the above method can provide the type of CSS Modules, it cannot accurately prompt which classNames are exported by a certain CSS file.
|
|
151
151
|
|
|
152
|
-
Modern.js supports generating accurate type declarations for CSS Modules, you only need to enable the [output.enableCssModuleTSDeclaration](/configure/app/output/enable-css-module-tsdeclaration) config, and then execute the build, Modern.js will generate type declaration files for all CSS Modules.
|
|
152
|
+
Modern.js supports generating accurate type declarations for CSS Modules, you only need to enable the [output.enableCssModuleTSDeclaration](/configure/app/output/enable-css-module-tsdeclaration.md) config, and then execute the build, Modern.js will generate type declaration files for all CSS Modules.
|
|
153
153
|
|
|
154
154
|
```ts
|
|
155
155
|
export default {
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
sidebar_position: 1
|
|
3
|
-
---
|
|
4
|
-
|
|
5
1
|
# Styling
|
|
6
2
|
|
|
7
3
|
Modern.js has built-in a variety of commonly used CSS solutions, including Less / Sass / Stylus preprocessors, PostCSS, CSS Modules, CSS-in-JS, and Tailwind CSS.
|
|
@@ -10,7 +6,7 @@ Modern.js has built-in a variety of commonly used CSS solutions, including Less
|
|
|
10
6
|
|
|
11
7
|
Modern.js has built-in popular community CSS preprocessors, including Less and Sass.
|
|
12
8
|
|
|
13
|
-
By default, you don't need to configure Less and Sass. If you have custom loader configuration requirements, you can set them up by configuring [tools.less](/configure/app/tools/less) and [tools.sass](/configure/app/tools/sass).
|
|
9
|
+
By default, you don't need to configure Less and Sass. If you have custom loader configuration requirements, you can set them up by configuring [tools.less](/configure/app/tools/less.md) and [tools.sass](/configure/app/tools/sass.md).
|
|
14
10
|
|
|
15
11
|
You can also use Stylus in Modern.js by installing the Stylus plugin provided by Rsbuild. For usage, please refer to [Stylus Plugin](https://v2.rsbuild.rs/plugins/list/plugin-stylus).
|
|
16
12
|
|
|
@@ -22,7 +18,7 @@ Please refer to [Rsbuild - Using PostCSS](https://v2.rsbuild.rs/guide/styling/cs
|
|
|
22
18
|
|
|
23
19
|
## Using Lightning CSS
|
|
24
20
|
|
|
25
|
-
Modern.js supports using [Lightning CSS](https://lightningcss.dev/) to convert CSS code. This feature can be turned on by configuring [tools.lightningcssLoader](/configure/app/tools/lightningcss-loader).
|
|
21
|
+
Modern.js supports using [Lightning CSS](https://lightningcss.dev/) to convert CSS code. This feature can be turned on by configuring [tools.lightningcssLoader](/configure/app/tools/lightningcss-loader.md).
|
|
26
22
|
|
|
27
23
|
Please refer to [Rsbuild - Using Lightning CSS](https://v2.rsbuild.rs/guide/styling/css-usage#lightning-css) for detailed usage.
|
|
28
24
|
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Data Caching
|
|
3
|
-
sidebar_position: 4
|
|
4
|
-
---
|
|
5
|
-
|
|
6
1
|
# Data Caching
|
|
7
2
|
|
|
8
|
-
The `cache` function allows you to cache the results of data fetching or computation, Compared to full-page [rendering cache](/guides/basic-features/render/ssr-cache), it provides more fine-grained control over data granularity and is applicable to various scenarios such as Client-Side Rendering (CSR), Server-Side Rendering (SSR), and API services (BFF).
|
|
3
|
+
The `cache` function allows you to cache the results of data fetching or computation, Compared to full-page [rendering cache](/guides/basic-features/render/ssr-cache.md), it provides more fine-grained control over data granularity and is applicable to various scenarios such as Client-Side Rendering (CSR), Server-Side Rendering (SSR), and API services (BFF).
|
|
9
4
|
|
|
10
5
|
## Basic Usage
|
|
11
6
|
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
---
|
|
2
|
-
sidebar_position: 3
|
|
3
|
-
---
|
|
4
|
-
|
|
5
1
|
# Data Fetching
|
|
6
2
|
|
|
7
3
|
Modern.js provides out-of-the-box data fetching capabilities. Developers can use these APIs to fetch data in their projects. It's important to note that these APIs do not help the application make requests but assist developers in managing data better and improving project performance.
|
|
8
4
|
|
|
9
5
|
## What is Data Loader
|
|
10
6
|
|
|
11
|
-
Modern.js recommends managing routes using [conventional routing](/guides/basic-features/routes/routes). Each route component (`layout.ts`, `page.ts`, or `$.tsx`) can have a same-named `.data` file. These files can export a `loader` function, known as Data Loader, which executes before the corresponding route component renders to provide data for the component. Here is an example:
|
|
7
|
+
Modern.js recommends managing routes using [conventional routing](/guides/basic-features/routes/routes.md). Each route component (`layout.ts`, `page.ts`, or `$.tsx`) can have a same-named `.data` file. These files can export a `loader` function, known as Data Loader, which executes before the corresponding route component renders to provide data for the component. Here is an example:
|
|
12
8
|
|
|
13
9
|
```bash
|
|
14
10
|
.
|
|
@@ -54,7 +50,7 @@ In a CSR environment, the `loader` function executes on the browser side and can
|
|
|
54
50
|
|
|
55
51
|
In an SSR environment, the `loader` function only executes on the server side for initial page loads and when navigating. Here it can call any Node.js APIs, and any dependencies or code used won't be included in the client-side bundle.
|
|
56
52
|
|
|
57
|
-
When navigating on the client side, based on [conventional routing](/guides/basic-features/routes/routes), Modern.js supports parallel execution (requests) of all `loader` functions. For example, when visiting `/user/profile`, the `loader` functions under `/user` and `/user/profile` will execute in parallel, solving the request-render waterfall issue and significantly improving page performance.
|
|
53
|
+
When navigating on the client side, based on [conventional routing](/guides/basic-features/routes/routes.md), Modern.js supports parallel execution (requests) of all `loader` functions. For example, when visiting `/user/profile`, the `loader` functions under `/user` and `/user/profile` will execute in parallel, solving the request-render waterfall issue and significantly improving page performance.
|
|
58
54
|
|
|
59
55
|
:::tip
|
|
60
56
|
The `loader` is responsible for data fetching, with route parameters and request information provided as input. Generally, there's no need to access browser APIs. It's recommended to keep it environment-agnostic for future SSR compatibility.
|
|
@@ -66,7 +62,7 @@ The `loader` function has two parameters used for getting route parameters and r
|
|
|
66
62
|
|
|
67
63
|
### params
|
|
68
64
|
|
|
69
|
-
`params` is the dynamic route segments when the route is a [dynamic route](/guides/basic-features/routes/routes#dynamic-routes), which passed as parameters to the `loader` function:
|
|
65
|
+
`params` is the dynamic route segments when the route is a [dynamic route](/guides/basic-features/routes/routes.md#dynamic-routes), which passed as parameters to the `loader` function:
|
|
70
66
|
|
|
71
67
|
```tsx title="routes/user/[id]/page.data.ts"
|
|
72
68
|
import { LoaderFunctionArgs } from '@modern-js/runtime/router';
|
|
@@ -153,7 +149,7 @@ export async function loader() {
|
|
|
153
149
|
|
|
154
150
|
### Basic Usage
|
|
155
151
|
|
|
156
|
-
In a `loader` function, you can handle errors by using `throw error` or `throw response`. When an error is thrown in the `loader` function, Modern.js will stop executing the remaining code in the current `loader` and switch the front-end UI to the defined [`ErrorBoundary`](/guides/basic-features/routes/routes#error-handling) component:
|
|
152
|
+
In a `loader` function, you can handle errors by using `throw error` or `throw response`. When an error is thrown in the `loader` function, Modern.js will stop executing the remaining code in the current `loader` and switch the front-end UI to the defined [`ErrorBoundary`](/guides/basic-features/routes/routes.md#error-handling) component:
|
|
157
153
|
|
|
158
154
|
```tsx
|
|
159
155
|
// routes/user/profile/page.data.ts
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
---
|
|
2
|
-
sidebar_position: 4
|
|
3
|
-
---
|
|
4
|
-
|
|
5
1
|
# Data Writing
|
|
6
2
|
|
|
7
|
-
In the [Data Fetching](/guides/basic-features/data/data-fetch) section, we introduced how Modern.js fetches data. This might bring up two questions:
|
|
3
|
+
In the [Data Fetching](/guides/basic-features/data/data-fetch.md) section, we introduced how Modern.js fetches data. This might bring up two questions:
|
|
8
4
|
|
|
9
5
|
1. How do I update the data returned by the Data Loader?
|
|
10
6
|
2. How do I send new data to the server?
|
|
@@ -13,7 +9,7 @@ In Modern.js, you can use Data Action to address these scenarios.
|
|
|
13
9
|
|
|
14
10
|
## What is Data Action
|
|
15
11
|
|
|
16
|
-
Modern.js recommends managing routes using [conventional routing](/guides/basic-features/routes/routes). Each route component (`layout.ts`, `page.ts`, or `$.tsx`) can have a same-named `.data` file. These files can export an `action` function, known as Data Action, which developers can call at an appropriate time:
|
|
12
|
+
Modern.js recommends managing routes using [conventional routing](/guides/basic-features/routes/routes.md). Each route component (`layout.ts`, `page.ts`, or `$.tsx`) can have a same-named `.data` file. These files can export an `action` function, known as Data Action, which developers can call at an appropriate time:
|
|
17
13
|
|
|
18
14
|
```bash
|
|
19
15
|
.
|
|
@@ -69,7 +65,7 @@ export default () => {
|
|
|
69
65
|
}
|
|
70
66
|
```
|
|
71
67
|
|
|
72
|
-
After executing `submit`, the defined `action` function will be triggered. You can get the submitted data from the [parameters](/guides/basic-features/data/data-write.
|
|
68
|
+
After executing `submit`, the defined `action` function will be triggered. You can get the submitted data from the [parameters](/guides/basic-features/data/data-write.md#parameters) in the `action` function and ultimately send the data to the server.
|
|
73
69
|
|
|
74
70
|
Once the `action` function executes, Modern.js will automatically run the `loader` function code to update the data and view accordingly.
|
|
75
71
|
|
|
@@ -81,7 +77,7 @@ Similar to the `loader` function, the `action` function takes two parameters: `p
|
|
|
81
77
|
|
|
82
78
|
### params
|
|
83
79
|
|
|
84
|
-
`params` is the dynamic route segments when the route is a [dynamic route](/guides/basic-features/routes/routes#dynamic-routes), which are passed as parameters to the `action` function:
|
|
80
|
+
`params` is the dynamic route segments when the route is a [dynamic route](/guides/basic-features/routes/routes.md#dynamic-routes), which are passed as parameters to the `action` function:
|
|
85
81
|
|
|
86
82
|
```tsx title="routes/user/[id]/page.data.ts"
|
|
87
83
|
import { ActionFunctionArgs } from '@modern-js/runtime/router;
|
|
@@ -134,6 +130,7 @@ submit(null, { method: "post", action: "/logout" });
|
|
|
134
130
|
```
|
|
135
131
|
|
|
136
132
|
The `submit` function takes two parameters. The first parameter is the `formData` passed to the server. The second parameter is an optional object where:
|
|
133
|
+
|
|
137
134
|
- `method` corresponds to the form submission method. In most data writing scenarios, you can set the `method` to `post`.
|
|
138
135
|
- `action` specifies the route component to trigger the Data Action. If not provided, it defaults to the current route component's action. For example, executing submit in `user/page.tsx` or its sub-components will trigger the action defined in `user/page.data.ts`.
|
|
139
136
|
|
|
@@ -223,7 +220,7 @@ In Modern.js, we aim to help developers automatically synchronize client and ser
|
|
|
223
220
|
|
|
224
221
|

|
|
225
222
|
|
|
226
|
-
If the shared data in your project mainly comes from the server, you don't need to introduce a client-side state management library. Use Data Loader to request data and share it in sub-components via [`useRouteLoaderData`](/guides/basic-features/data/data-fetch). Use Data Action to modify and synchronize the server's state.
|
|
223
|
+
If the shared data in your project mainly comes from the server, you don't need to introduce a client-side state management library. Use Data Loader to request data and share it in sub-components via [`useRouteLoaderData`](/guides/basic-features/data/data-fetch.md). Use Data Action to modify and synchronize the server's state.
|
|
227
224
|
|
|
228
225
|
## CSR and SSR
|
|
229
226
|
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
sidebar_position: 5
|
|
3
|
-
---
|
|
4
|
-
|
|
5
1
|
# Data Mocking
|
|
6
2
|
|
|
7
3
|
Modern.js allows you to easily generate mock data so that the front-end can develop independently without depending on the back-end API.
|
|
@@ -20,7 +16,7 @@ By convention, when there is an `index.ts` in the `config/mock/` directory, mock
|
|
|
20
16
|
└── modern.config.ts
|
|
21
17
|
```
|
|
22
18
|
|
|
23
|
-
You can use [`dev.mockDir`](/configure/app/dev/mock-dir) to place the
|
|
19
|
+
You can use [`dev.mockDir`](/configure/app/dev/mock-dir.md) to place the
|
|
24
20
|
Mock entry in another directory:
|
|
25
21
|
|
|
26
22
|
```js title="modern.config.ts"
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
---
|
|
2
|
-
sidebar_position: 6
|
|
3
|
-
---
|
|
4
|
-
|
|
5
1
|
# Local Proxy
|
|
6
2
|
|
|
7
|
-
Modern.js provides a way to configure the development proxy in [`dev.server.proxy`](/configure/app/dev/server).
|
|
3
|
+
Modern.js provides a way to configure the development proxy in [`dev.server.proxy`](/configure/app/dev/server.md).
|
|
8
4
|
|
|
9
5
|
For example, to proxy the local interface to another address:
|
|
10
6
|
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
sidebar_position: 15
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
import { PackageManagerTabs } from '@theme'
|
|
6
|
-
|
|
7
1
|
# Using Storybook
|
|
8
2
|
|
|
9
3
|
[Storybook](https://storybook.js.org/) is a tool specifically designed for component debugging. It provides:
|
|
@@ -26,7 +20,26 @@ This document only provides the simplest usage. For more information, please ref
|
|
|
26
20
|
|
|
27
21
|
## Installation
|
|
28
22
|
|
|
29
|
-
|
|
23
|
+
|
|
24
|
+
```sh [npm]
|
|
25
|
+
npm install @rsbuild/core storybook-builder-rsbuild storybook-addon-modernjs -D
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
```sh [yarn]
|
|
29
|
+
yarn add @rsbuild/core storybook-builder-rsbuild storybook-addon-modernjs -D
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
```sh [pnpm]
|
|
33
|
+
pnpm add @rsbuild/core storybook-builder-rsbuild storybook-addon-modernjs -D
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
```sh [bun]
|
|
37
|
+
bun add @rsbuild/core storybook-builder-rsbuild storybook-addon-modernjs -D
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
```sh [deno]
|
|
41
|
+
deno add npm:@rsbuild/core npm:storybook-builder-rsbuild npm:storybook-addon-modernjs -D
|
|
42
|
+
```
|
|
30
43
|
|
|
31
44
|
You need to install `@rsbuild/core` in your project, otherwise the plugin may not work properly.
|
|
32
45
|
|
|
@@ -43,7 +56,6 @@ const config: StorybookConfig = {
|
|
|
43
56
|
export default config
|
|
44
57
|
```
|
|
45
58
|
|
|
46
|
-
|
|
47
59
|
## BFF Integrated Calls in Storybook
|
|
48
60
|
|
|
49
61
|
When you want to call BFF APIs directly in Storybook components (for example `/api/**`), start the BFF service and configure a proxy in Storybook's dev server to avoid CORS issues.
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
sidebar_position: 15
|
|
3
|
-
---
|
|
4
|
-
|
|
5
1
|
# Deploy Application
|
|
6
2
|
|
|
7
3
|
Currently, Modern.js offers two deployment way:
|
|
@@ -165,8 +161,7 @@ Assuming the directory structure of the Monorepo repository is as follows:
|
|
|
165
161
|
|
|
166
162
|
You need to configure Base directory on the netlify platform as `packages/app`:
|
|
167
163
|
|
|
168
|
-
|
|
169
|
-
|
|
164
|
+

|
|
170
165
|
Add the following script in `packages/app/package.json`, before executing the deployment command of the `app` repository, first execute the build of other repositories in the workspace:
|
|
171
166
|
|
|
172
167
|
```json
|
|
@@ -220,8 +215,7 @@ Add the following content to `vercel.json`:
|
|
|
220
215
|
|
|
221
216
|
Commit your project to git, select Framework Preset as `Other` on the Vercel platform and deploy.
|
|
222
217
|
|
|
223
|
-
|
|
224
|
-
|
|
218
|
+

|
|
225
219
|
:::info
|
|
226
220
|
You can refer to the [deployment project examples](https://github.com/web-infra-dev/modern.js/tree/main/examples/modern-js-deploy-csr).
|
|
227
221
|
|
|
@@ -265,8 +259,7 @@ Assuming the directory structure of the Monorepo repository is as follows:
|
|
|
265
259
|
|
|
266
260
|
First, you need to configure the **Root Directory** as `packages/app` on the Vercel platform:
|
|
267
261
|
|
|
268
|
-
|
|
269
|
-
|
|
262
|
+

|
|
270
263
|
Specify Node.js runtime as `20.x`:
|
|
271
264
|
|
|
272
265
|
```json title="package.json"
|
|
@@ -370,9 +363,26 @@ app.listen(3000);
|
|
|
370
363
|
|
|
371
364
|
Now, you can add some code to include the logic for accessing static resources and HTML files in `server.js`. We need to use the `mime-types` package to get the MIME types of static resources, so let's install the dependency first:
|
|
372
365
|
|
|
373
|
-
import { PackageManagerTabs } from '@theme';
|
|
374
366
|
|
|
375
|
-
|
|
367
|
+
```sh [npm]
|
|
368
|
+
npm add mime-types
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
```sh [yarn]
|
|
372
|
+
yarn add mime-types
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
```sh [pnpm]
|
|
376
|
+
pnpm add mime-types
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
```sh [bun]
|
|
380
|
+
bun add mime-types
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
```sh [deno]
|
|
384
|
+
deno add npm:mime-types
|
|
385
|
+
```
|
|
376
386
|
|
|
377
387
|
```ts title="server.js"
|
|
378
388
|
const Koa = require('koa');
|
|
@@ -402,7 +412,7 @@ The above code is a basic example. Your application might have multiple entry po
|
|
|
402
412
|
|
|
403
413
|
Please note that if your project uses Modern.js conventional routing or if you have set up client-side routing with React Router, you must access HTML files through the correct `baseURL`.
|
|
404
414
|
|
|
405
|
-
In Modern.js, the default `baseURL` is `'/'`. You can configure it by modifying [`server.baseUrl`](/configure/app/server/base-url) in `modern.config.ts`.
|
|
415
|
+
In Modern.js, the default `baseURL` is `'/'`. You can configure it by modifying [`server.baseUrl`](/configure/app/server/base-url.md) in `modern.config.ts`.
|
|
406
416
|
|
|
407
417
|
:::danger
|
|
408
418
|
For projects with client-side routing, you can never access HTML files through the `/index.html` path.
|
|
@@ -1,34 +1,30 @@
|
|
|
1
|
-
---
|
|
2
|
-
sidebar_position: 7
|
|
3
|
-
---
|
|
4
|
-
|
|
5
1
|
# Environment Variables
|
|
6
2
|
|
|
7
3
|
Modern.js provides support for environment variables, including built-in environment variables and custom environment variables.
|
|
8
4
|
|
|
9
5
|
## Built-in Environment Variables
|
|
10
6
|
|
|
11
|
-
###
|
|
7
|
+
### ASSET\_PREFIX
|
|
12
8
|
|
|
13
9
|
The current path prefix of the asset, which is a read-only environment variable.
|
|
14
10
|
|
|
15
|
-
###
|
|
11
|
+
### NODE\_ENV
|
|
16
12
|
|
|
17
13
|
The current execution environment and is a **read-only** environment variable whose have different values under different execution commands:
|
|
18
14
|
|
|
19
15
|
- `production`: Default value when running `modern build` or `modern serve`.
|
|
20
16
|
- `development`: Default value when running `modern dev`, also the default value in other cases.
|
|
21
17
|
|
|
22
|
-
###
|
|
18
|
+
### MODERN\_ENV
|
|
23
19
|
|
|
24
|
-
Set the current execution environment manually. In addition to the values in the
|
|
20
|
+
Set the current execution environment manually. In addition to the values in the NODE\_ENV, custom environment names are supported here, such as `staging`, `boe`, etc.
|
|
25
21
|
|
|
26
22
|
:::tip
|
|
27
|
-
|
|
23
|
+
MODERN\_ENV priority is higher than NODE\_ENV.
|
|
28
24
|
|
|
29
25
|
:::
|
|
30
26
|
|
|
31
|
-
###
|
|
27
|
+
### MODERN\_TARGET
|
|
32
28
|
|
|
33
29
|
When using `@modern-js/runtime`, Modern.js will automatically inject `MODERN_TARGET` to distinguish between SSR and CSR environments.
|
|
34
30
|
|
|
@@ -136,7 +132,7 @@ In custom HTML templates, you can also use such environment variables directly.
|
|
|
136
132
|
|
|
137
133
|
### Any Other Names
|
|
138
134
|
|
|
139
|
-
If you need to use environment variables with any other names in your code, you can configure them in [`source.globalVars`](/configure/app/source/global-vars). For example:
|
|
135
|
+
If you need to use environment variables with any other names in your code, you can configure them in [`source.globalVars`](/configure/app/source/global-vars.md). For example:
|
|
140
136
|
|
|
141
137
|
```ts title="modern.config.ts"
|
|
142
138
|
export default defineConfig({
|
|
@@ -178,4 +174,4 @@ const foo = TWO;
|
|
|
178
174
|
const foo = 1 + 1;
|
|
179
175
|
```
|
|
180
176
|
|
|
181
|
-
In most cases, `source.globalVars` is already sufficient to replace variables. But the values passed in by `source.globalVars` will be serialized by JSON by default. So it cannot be replaced like `1 + 1` in the example above, at this time, we need to use [`source.define`](/configure/app/source/define).
|
|
177
|
+
In most cases, `source.globalVars` is already sufficient to replace variables. But the values passed in by `source.globalVars` will be serialized by JSON by default. So it cannot be replaced like `1 + 1` in the example above, at this time, we need to use [`source.define`](/configure/app/source/define.md).
|