@modern-js/main-doc 2.0.2 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/.turbo/turbo-build.log +1 -1
- package/en/docusaurus-plugin-content-docs/current/apis/app/commands/index.md +0 -5
- package/en/docusaurus-plugin-content-docs/current/apis/app/commands/lint.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/apis/app/commands/serve.md +2 -4
- package/en/docusaurus-plugin-content-docs/current/apis/app/hooks/api/framework/lambda.md +12 -12
- package/en/docusaurus-plugin-content-docs/current/apis/app/hooks/api/functions/api.md +13 -13
- package/en/docusaurus-plugin-content-docs/current/apis/app/hooks/api/functions/app.md +0 -2
- package/en/docusaurus-plugin-content-docs/current/apis/app/hooks/api/functions/common.md +1 -3
- package/en/docusaurus-plugin-content-docs/current/apis/app/hooks/src/app.md +16 -9
- package/en/docusaurus-plugin-content-docs/current/apis/app/hooks/src/index_.md +0 -1
- package/en/docusaurus-plugin-content-docs/current/apis/app/hooks/src/routes.md +5 -3
- package/en/docusaurus-plugin-content-docs/current/apis/app/hooks/src/server.md +6 -4
- package/en/docusaurus-plugin-content-docs/current/apis/app/hooks/src/stories.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/apis/app/hooks/src/test.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/app/define-config.md +0 -1
- package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/bff/hook.md +3 -3
- package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/core/bootstrap.md +3 -6
- package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/core/create-app.md +1 -3
- package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/core/use-loader.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/core/use-module-apps.md +58 -51
- package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/core/use-runtime-context.md +3 -4
- package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/index.md +0 -5
- package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/model/Provider.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/model/connect.md +8 -5
- package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/model/create-store.md +1 -3
- package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/model/handle-effect.md +3 -3
- package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/model/model_.md +0 -1
- package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/model/use-model.md +0 -3
- package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/model/use-store.md +0 -2
- package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/router/router.md +23 -54
- package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/ssr/no-ssr.md +1 -8
- package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/ssr/pre-render.md +10 -6
- package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/testing/render.md +0 -2
- package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/utility/css-in-js.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/utility/head.md +3 -5
- package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/utility/loadable.md +14 -15
- package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/web-server/hook.md +4 -5
- package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/web-server/middleware.md +7 -6
- package/en/docusaurus-plugin-content-docs/current/components/command-tip.md +3 -2
- package/en/docusaurus-plugin-content-docs/current/components/debug-app.md +17 -0
- package/en/docusaurus-plugin-content-docs/current/components/enable-bff.md +10 -14
- package/en/docusaurus-plugin-content-docs/current/components/enable-micro-frontend.md +4 -4
- package/en/docusaurus-plugin-content-docs/current/components/global-proxy-config.md +6 -9
- package/en/docusaurus-plugin-content-docs/current/components/global-proxy.md +0 -1
- package/en/docusaurus-plugin-content-docs/current/components/micro-master-manifest-config.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/components/micro-runtime-config.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/components/prerequisites.md +19 -0
- package/en/docusaurus-plugin-content-docs/current/components/reduck-migration.md +0 -1
- package/en/docusaurus-plugin-content-docs/current/components/reduck-tip.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/components/router-legacy-tip.md +0 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/auto-load-plugin.md +8 -9
- package/en/docusaurus-plugin-content-docs/current/configure/app/bff/prefix.md +6 -6
- package/en/docusaurus-plugin-content-docs/current/configure/app/bff/proxy.md +8 -9
- package/en/docusaurus-plugin-content-docs/current/configure/app/builder-plugins.md +6 -6
- package/en/docusaurus-plugin-content-docs/current/configure/app/deploy/microFrontend.md +11 -13
- package/en/docusaurus-plugin-content-docs/current/configure/app/dev/asset-prefix.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/dev/hmr.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/dev/https.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/dev/port.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/dev/progress-bar.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/dev/proxy.md +0 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/dev/start-url.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/experiments/lazy-compilation.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/html/app-icon.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/html/crossorigin.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/html/disable-html-folder.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/html/favicon-by-entries.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/html/favicon.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/html/inject-by-entries.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/html/inject.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/html/meta-by-entries.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/html/meta.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/html/mount-id.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/html/tags-by-entries.md +12 -0
- package/en/docusaurus-plugin-content-docs/current/configure/app/html/tags.md +12 -0
- package/en/docusaurus-plugin-content-docs/current/configure/app/html/template-by-entries.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/html/template-parameters-by-entries.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/html/template-parameters.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/html/template.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/html/title-by-entries.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/html/title.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/asset-prefix.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/assets-retry.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/charset.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/clean-dist-path.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/convert-to-rem.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/copy.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/css-module-local-ident-name.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/data-uri-limit.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/disable-css-extract.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/disable-css-module-extension.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/disable-filename-hash.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/disable-inline-runtime-chunk.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/disable-minimize.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/disable-node-polyfill.md +8 -6
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/disable-source-map.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/disable-ts-checker.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/dist-path.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/enable-asset-fallback.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/enable-asset-manifest.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/enable-css-module-tsdeclaration.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/enable-inline-scripts.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/enable-inline-styles.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/enable-latest-decorators.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/externals.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/filename.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/legal-comments.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/override-browserslist.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/polyfill.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/ssg.md +3 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/svg-default-export.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/performance/build-cache.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/performance/bundle-analyze.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/performance/chunk-split.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/performance/print-file-size.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/performance/profile.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/performance/remove-console.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/performance/remove-moment-locale.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/plugins.md +6 -6
- package/en/docusaurus-plugin-content-docs/current/configure/app/runtime/intro.md +11 -10
- package/en/docusaurus-plugin-content-docs/current/configure/app/runtime/master-app.md +1 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/runtime/router.md +7 -7
- package/en/docusaurus-plugin-content-docs/current/configure/app/runtime/state.md +15 -15
- package/en/docusaurus-plugin-content-docs/current/configure/app/security/sri.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/server/base-url.md +3 -4
- package/en/docusaurus-plugin-content-docs/current/configure/app/server/enable-framework-ext.md +5 -4
- package/en/docusaurus-plugin-content-docs/current/configure/app/server/port.md +24 -4
- package/en/docusaurus-plugin-content-docs/current/configure/app/server/public-routes.md +6 -6
- package/en/docusaurus-plugin-content-docs/current/configure/app/server/routes.md +7 -7
- package/en/docusaurus-plugin-content-docs/current/configure/app/server/ssr-by-entries.md +5 -5
- package/en/docusaurus-plugin-content-docs/current/configure/app/server/ssr.md +4 -4
- package/en/docusaurus-plugin-content-docs/current/configure/app/source/alias.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/source/compile-js-data-uri.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/source/config-dir.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/source/define.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/source/design-system.md +656 -634
- package/en/docusaurus-plugin-content-docs/current/configure/app/source/disable-default-entries.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/source/disable-entry-dirs.md +8 -8
- package/en/docusaurus-plugin-content-docs/current/configure/app/source/enable-async-entry.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/source/entries-dir.md +7 -7
- package/en/docusaurus-plugin-content-docs/current/configure/app/source/entries.md +4 -6
- package/en/docusaurus-plugin-content-docs/current/configure/app/source/exclude.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/source/global-vars.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/source/include.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/source/module-scopes.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/source/pre-entry.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/source/resolve-extension-prefix.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/source/resolve-main-fields.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/tools/autoprefixer.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/tools/babel.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/tools/css-extract.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/tools/css-loader.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/tools/dev-server.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/tools/html-plugin.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/tools/inspector.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/tools/jest.md +9 -9
- package/en/docusaurus-plugin-content-docs/current/configure/app/tools/less.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/tools/minify-css.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/tools/postcss.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/tools/pug.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/tools/sass.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/tools/style-loader.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/tools/styled-components.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/tools/swc.md +12 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/tools/terser.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/tools/ts-checker.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/tools/ts-loader.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/tools/webpack-chain.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/configure/app/tools/webpack.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/guides/advanced-features/bff/frameworks.md +6 -6
- package/en/docusaurus-plugin-content-docs/current/guides/advanced-features/bff/function.md +44 -38
- package/en/docusaurus-plugin-content-docs/current/guides/advanced-features/bff/index.md +9 -9
- package/en/docusaurus-plugin-content-docs/current/guides/advanced-features/bff/type.md +0 -1
- package/en/docusaurus-plugin-content-docs/current/guides/advanced-features/code-split.md +3 -4
- package/en/docusaurus-plugin-content-docs/current/guides/advanced-features/compatibility.md +6 -7
- package/en/docusaurus-plugin-content-docs/current/guides/advanced-features/eslint.md +0 -1
- package/en/docusaurus-plugin-content-docs/current/guides/advanced-features/index.md +0 -5
- package/en/docusaurus-plugin-content-docs/current/guides/advanced-features/low-level.md +17 -19
- package/en/docusaurus-plugin-content-docs/current/guides/advanced-features/ssg.md +8 -10
- package/en/docusaurus-plugin-content-docs/current/guides/advanced-features/ssr.md +5 -11
- package/en/docusaurus-plugin-content-docs/current/guides/advanced-features/testing.md +3 -3
- package/en/docusaurus-plugin-content-docs/current/guides/advanced-features/web-server.md +3 -4
- package/en/docusaurus-plugin-content-docs/current/guides/basic-features/alias.md +7 -11
- package/en/docusaurus-plugin-content-docs/current/guides/basic-features/css/css-in-js.md +6 -6
- package/en/docusaurus-plugin-content-docs/current/guides/basic-features/css/css-modules.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/guides/basic-features/css/less-sass.md +1 -2
- package/en/docusaurus-plugin-content-docs/current/guides/basic-features/css/postcss.md +43 -47
- package/en/docusaurus-plugin-content-docs/current/guides/basic-features/css/tailwindcss.md +3 -3
- package/en/docusaurus-plugin-content-docs/current/guides/basic-features/data-fetch.md +106 -192
- package/en/docusaurus-plugin-content-docs/current/guides/basic-features/env-vars.md +8 -8
- package/en/docusaurus-plugin-content-docs/current/guides/basic-features/html.md +55 -47
- package/en/docusaurus-plugin-content-docs/current/guides/basic-features/mock.md +4 -4
- package/en/docusaurus-plugin-content-docs/current/guides/basic-features/proxy.md +4 -5
- package/en/docusaurus-plugin-content-docs/current/guides/basic-features/routes.md +90 -9
- package/en/docusaurus-plugin-content-docs/current/guides/concept/entries.md +1 -2
- package/en/docusaurus-plugin-content-docs/current/guides/get-started/quick-start.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/guides/get-started/upgrade.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/framework-plugin/extend.md +13 -13
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/framework-plugin/hook-list.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/framework-plugin/hook.md +57 -54
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/framework-plugin/implement.md +11 -11
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/framework-plugin/lifecycle.md +0 -1
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/framework-plugin/plugin-api.md +4 -4
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/codesmith/api/app.md +33 -33
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/codesmith/api/ejs.md +3 -3
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/codesmith/api/fs.md +3 -3
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/codesmith/api/git.md +3 -2
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/codesmith/api/handlebars.md +3 -4
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/codesmith/api/json.md +9 -12
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/codesmith/api/npm.md +2 -3
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/codesmith/introduce.md +4 -3
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/codesmith/run-in-js.md +4 -5
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/codesmith/structure.md +13 -11
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/config/common.md +18 -27
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/abstract.md +1 -4
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/file/introduce.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/file/updateJSONFile.md +4 -5
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/hook/onForged.md +0 -1
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/input/addInputAfter.md +1 -4
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/input/addInputBefore.md +1 -3
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/input/setInput.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/input/type.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/introduce.md +8 -9
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/develop.md +11 -12
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/use.md +8 -8
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/project.md +1 -2
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/micro-frontend/c01-introduction.md +7 -8
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/micro-frontend/c02-development.md +18 -21
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/micro-frontend/c03-main-app.md +41 -44
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/micro-frontend/c04-communicate.md +7 -5
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/micro-frontend/c05-mixed-stack.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/model/auto-actions.md +0 -1
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/model/computed-state.md +0 -2
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/model/define-model.md +3 -6
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/model/faq.md +2 -5
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/model/manage-effects.md +2 -5
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/model/model-communicate.md +1 -4
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/model/performance.md +1 -5
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/model/quick-start.md +0 -6
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/model/redux-integration.md +3 -2
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/model/test-model.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/model/typescript-best-practice.md +13 -14
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/model/use-model.md +14 -12
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/model/use-out-of-modernjs.md +4 -6
- package/en/docusaurus-plugin-content-docs/current/tutorials/first-app/c01-start.md +19 -19
- package/en/docusaurus-plugin-content-docs/current/tutorials/first-app/c02-component.md +11 -11
- package/en/docusaurus-plugin-content-docs/current/tutorials/first-app/c03-css.md +52 -55
- package/en/docusaurus-plugin-content-docs/current/tutorials/first-app/c04-routes.md +23 -23
- package/en/docusaurus-plugin-content-docs/current/tutorials/first-app/c05-loader.md +12 -11
- package/en/docusaurus-plugin-content-docs/current/tutorials/first-app/c06-model.md +28 -28
- package/en/docusaurus-plugin-content-docs/current/tutorials/first-app/c07-container.md +25 -26
- package/en/docusaurus-plugin-content-docs/current/tutorials/first-app/c08-entries.md +36 -38
- package/en/docusaurus-plugin-content-docs/current.json +3 -47
- package/package.json +3 -3
- package/scripts/config.ts +4 -2
- package/scripts/summary.en.json +1 -1
- package/scripts/summary.zh.json +1 -1
- package/scripts/sync.ts +1 -1
- package/zh/apis/app/commands/index.md +0 -5
- package/zh/apis/app/commands/lint.md +1 -1
- package/zh/apis/app/commands/serve.md +2 -4
- package/zh/apis/app/hooks/api/framework/lambda.md +12 -12
- package/zh/apis/app/hooks/api/functions/api.md +13 -13
- package/zh/apis/app/hooks/api/functions/app.md +0 -2
- package/zh/apis/app/hooks/api/functions/common.md +1 -1
- package/zh/apis/app/hooks/index.md +0 -5
- package/zh/apis/app/hooks/shared.md +0 -1
- package/zh/apis/app/hooks/src/app.md +16 -9
- package/zh/apis/app/hooks/src/index_.md +0 -2
- package/zh/apis/app/hooks/src/routes.md +6 -7
- package/zh/apis/app/hooks/src/server.md +6 -4
- package/zh/apis/app/hooks/src/stories.md +1 -1
- package/zh/apis/app/hooks/src/test.md +1 -1
- package/zh/apis/app/runtime/app/define-config.md +1 -2
- package/zh/apis/app/runtime/bff/hook.md +3 -3
- package/zh/apis/app/runtime/core/bootstrap.md +2 -3
- package/zh/apis/app/runtime/core/use-loader.md +2 -2
- package/zh/apis/app/runtime/core/use-module-apps.md +53 -50
- package/zh/apis/app/runtime/core/use-runtime-context.md +3 -4
- package/zh/apis/app/runtime/index.md +0 -5
- package/zh/apis/app/runtime/model/Provider.md +1 -0
- package/zh/apis/app/runtime/model/auto-actions.md +1 -1
- package/zh/apis/app/runtime/model/connect.md +9 -5
- package/zh/apis/app/runtime/model/create-app.md +3 -3
- package/zh/apis/app/runtime/model/create-store.md +2 -4
- package/zh/apis/app/runtime/model/handle-effect.md +3 -4
- package/zh/apis/app/runtime/model/model_.md +0 -3
- package/zh/apis/app/runtime/model/use-local-model.md +0 -1
- package/zh/apis/app/runtime/model/use-store.md +0 -2
- package/zh/apis/app/runtime/router/router.md +23 -53
- package/zh/apis/app/runtime/ssr/no-ssr.md +1 -5
- package/zh/apis/app/runtime/ssr/pre-render.md +10 -6
- package/zh/apis/app/runtime/testing/cleanup.md +2 -2
- package/zh/apis/app/runtime/testing/render.md +0 -2
- package/zh/apis/app/runtime/utility/css-in-js.md +2 -2
- package/zh/apis/app/runtime/utility/head.md +3 -5
- package/zh/apis/app/runtime/utility/loadable.md +14 -15
- package/zh/apis/app/runtime/web-server/hook.md +5 -4
- package/zh/apis/app/runtime/web-server/middleware.md +8 -6
- package/zh/apis/monorepo/commands/bump.md +1 -1
- package/zh/apis/monorepo/commands/change.md +3 -2
- package/zh/apis/monorepo/commands/gen-release-note.md +1 -2
- package/zh/apis/monorepo/commands/index.md +1 -6
- package/zh/apis/monorepo/commands/lint.md +1 -1
- package/zh/apis/monorepo/commands/release.md +0 -1
- package/zh/apis/monorepo/hooks/index.md +1 -6
- package/zh/components/command-tip.md +3 -2
- package/zh/components/enable-bff.md +10 -14
- package/zh/components/enable-micro-frontend.md +4 -4
- package/zh/components/global-proxy-config.md +6 -9
- package/zh/components/global-proxy.md +0 -1
- package/zh/components/init-app.md +0 -1
- package/zh/components/micro-master-manifest-config.md +2 -2
- package/zh/components/micro-runtime-config.md +1 -1
- package/zh/components/reduck-migration.md +0 -1
- package/zh/components/router-legacy-tip.md +0 -1
- package/zh/configure/app/auto-load-plugin.md +9 -10
- package/zh/configure/app/bff/prefix.md +6 -10
- package/zh/configure/app/bff/proxy.md +9 -8
- package/zh/configure/app/builder-plugins.md +6 -6
- package/zh/configure/app/deploy/microFrontend.md +11 -11
- package/zh/configure/app/dev/asset-prefix.md +2 -2
- package/zh/configure/app/dev/hmr.md +2 -2
- package/zh/configure/app/dev/https.md +2 -2
- package/zh/configure/app/dev/port.md +2 -2
- package/zh/configure/app/dev/progress-bar.md +2 -2
- package/zh/configure/app/dev/proxy.md +0 -1
- package/zh/configure/app/dev/start-url.md +2 -2
- package/zh/configure/app/experiments/lazy-compilation.md +2 -2
- package/zh/configure/app/html/app-icon.md +2 -2
- package/zh/configure/app/html/crossorigin.md +2 -2
- package/zh/configure/app/html/disable-html-folder.md +2 -2
- package/zh/configure/app/html/favicon-by-entries.md +2 -2
- package/zh/configure/app/html/favicon.md +2 -2
- package/zh/configure/app/html/inject-by-entries.md +2 -2
- package/zh/configure/app/html/inject.md +2 -2
- package/zh/configure/app/html/meta-by-entries.md +2 -2
- package/zh/configure/app/html/meta.md +2 -2
- package/zh/configure/app/html/mount-id.md +2 -2
- package/zh/configure/app/html/tags-by-entries.md +12 -0
- package/zh/configure/app/html/tags.md +12 -0
- package/zh/configure/app/html/template-by-entries.md +2 -2
- package/zh/configure/app/html/template-parameters-by-entries.md +2 -2
- package/zh/configure/app/html/template-parameters.md +2 -2
- package/zh/configure/app/html/template.md +2 -2
- package/zh/configure/app/html/title-by-entries.md +2 -2
- package/zh/configure/app/html/title.md +2 -2
- package/zh/configure/app/output/asset-prefix.md +2 -2
- package/zh/configure/app/output/assets-retry.md +2 -2
- package/zh/configure/app/output/charset.md +2 -2
- package/zh/configure/app/output/clean-dist-path.md +2 -2
- package/zh/configure/app/output/convert-to-rem.md +2 -2
- package/zh/configure/app/output/copy.md +2 -2
- package/zh/configure/app/output/css-module-local-ident-name.md +2 -2
- package/zh/configure/app/output/data-uri-limit.md +2 -2
- package/zh/configure/app/output/disable-css-extract.md +2 -2
- package/zh/configure/app/output/disable-css-module-extension.md +2 -2
- package/zh/configure/app/output/disable-filename-hash.md +2 -2
- package/zh/configure/app/output/disable-inline-runtime-chunk.md +2 -2
- package/zh/configure/app/output/disable-minimize.md +2 -2
- package/zh/configure/app/output/disable-node-polyfill.md +8 -8
- package/zh/configure/app/output/disable-source-map.md +2 -2
- package/zh/configure/app/output/disable-ts-checker.md +2 -2
- package/zh/configure/app/output/dist-path.md +2 -2
- package/zh/configure/app/output/enable-asset-fallback.md +2 -2
- package/zh/configure/app/output/enable-asset-manifest.md +2 -2
- package/zh/configure/app/output/enable-css-module-tsdeclaration.md +2 -2
- package/zh/configure/app/output/enable-inline-scripts.md +2 -2
- package/zh/configure/app/output/enable-inline-styles.md +2 -2
- package/zh/configure/app/output/enable-latest-decorators.md +2 -2
- package/zh/configure/app/output/externals.md +2 -2
- package/zh/configure/app/output/filename.md +2 -2
- package/zh/configure/app/output/legal-comments.md +2 -2
- package/zh/configure/app/output/override-browserslist.md +2 -2
- package/zh/configure/app/output/polyfill.md +2 -2
- package/zh/configure/app/output/ssg.md +3 -2
- package/zh/configure/app/output/svg-default-export.md +2 -2
- package/zh/configure/app/performance/build-cache.md +2 -2
- package/zh/configure/app/performance/bundle-analyze.md +2 -2
- package/zh/configure/app/performance/chunk-split.md +2 -2
- package/zh/configure/app/performance/print-file-size.md +2 -2
- package/zh/configure/app/performance/profile.md +2 -2
- package/zh/configure/app/performance/remove-console.md +2 -2
- package/zh/configure/app/performance/remove-moment-locale.md +2 -2
- package/zh/configure/app/plugins.md +6 -6
- package/zh/configure/app/runtime/intro.md +39 -11
- package/zh/configure/app/runtime/master-app.md +1 -2
- package/zh/configure/app/runtime/router.md +6 -7
- package/zh/configure/app/runtime/state.md +15 -16
- package/zh/configure/app/security/sri.md +2 -2
- package/zh/configure/app/server/base-url.md +3 -6
- package/zh/configure/app/server/enable-framework-ext.md +5 -4
- package/zh/configure/app/server/port.md +24 -6
- package/zh/configure/app/server/public-routes.md +6 -8
- package/zh/configure/app/server/routes.md +6 -6
- package/zh/configure/app/server/ssr-by-entries.md +5 -8
- package/zh/configure/app/server/ssr.md +4 -5
- package/zh/configure/app/source/alias.md +2 -2
- package/zh/configure/app/source/compile-js-data-uri.md +2 -2
- package/zh/configure/app/source/config-dir.md +2 -2
- package/zh/configure/app/source/define.md +2 -2
- package/zh/configure/app/source/design-system.md +656 -630
- package/zh/configure/app/source/disable-default-entries.md +3 -3
- package/zh/configure/app/source/disable-entry-dirs.md +8 -7
- package/zh/configure/app/source/enable-async-entry.md +3 -3
- package/zh/configure/app/source/entries-dir.md +7 -7
- package/zh/configure/app/source/entries.md +5 -6
- package/zh/configure/app/source/exclude.md +2 -2
- package/zh/configure/app/source/global-vars.md +2 -2
- package/zh/configure/app/source/include.md +2 -2
- package/zh/configure/app/source/module-scopes.md +2 -2
- package/zh/configure/app/source/pre-entry.md +2 -2
- package/zh/configure/app/source/resolve-extension-prefix.md +2 -2
- package/zh/configure/app/source/resolve-main-fields.md +2 -2
- package/zh/configure/app/testing/transformer.md +2 -3
- package/zh/configure/app/tools/autoprefixer.md +2 -2
- package/zh/configure/app/tools/babel.md +2 -2
- package/zh/configure/app/tools/css-extract.md +2 -2
- package/zh/configure/app/tools/css-loader.md +2 -2
- package/zh/configure/app/tools/dev-server.md +2 -2
- package/zh/configure/app/tools/html-plugin.md +2 -2
- package/zh/configure/app/tools/inspector.md +2 -2
- package/zh/configure/app/tools/jest.md +9 -9
- package/zh/configure/app/tools/less.md +2 -2
- package/zh/configure/app/tools/minify-css.md +2 -2
- package/zh/configure/app/tools/postcss.md +2 -2
- package/zh/configure/app/tools/pug.md +2 -2
- package/zh/configure/app/tools/sass.md +2 -2
- package/zh/configure/app/tools/style-loader.md +2 -2
- package/zh/configure/app/tools/styled-components.md +2 -2
- package/zh/configure/app/tools/swc.md +12 -1
- package/zh/configure/app/tools/terser.md +2 -2
- package/zh/configure/app/tools/ts-checker.md +2 -2
- package/zh/configure/app/tools/ts-loader.md +2 -2
- package/zh/configure/app/tools/webpack-chain.md +2 -2
- package/zh/configure/app/tools/webpack.md +2 -2
- package/zh/guides/advanced-features/bff/frameworks.md +6 -6
- package/zh/guides/advanced-features/bff/function.md +49 -44
- package/zh/guides/advanced-features/bff/index.md +9 -9
- package/zh/guides/advanced-features/bff/type.md +0 -1
- package/zh/guides/advanced-features/code-split.md +3 -3
- package/zh/guides/advanced-features/compatibility.md +6 -7
- package/zh/guides/advanced-features/eslint.md +0 -1
- package/zh/guides/advanced-features/index.md +0 -5
- package/zh/guides/advanced-features/low-level.md +17 -19
- package/zh/guides/advanced-features/ssg.md +8 -9
- package/zh/guides/advanced-features/ssr.md +5 -11
- package/zh/guides/advanced-features/testing.md +3 -2
- package/zh/guides/advanced-features/web-server.md +3 -4
- package/zh/guides/basic-features/alias.md +7 -11
- package/zh/guides/basic-features/css/css-in-js.md +5 -5
- package/zh/guides/basic-features/css/css-modules.md +2 -2
- package/zh/guides/basic-features/css/postcss.md +42 -46
- package/zh/guides/basic-features/css/tailwindcss.md +5 -5
- package/zh/guides/basic-features/data-fetch.md +109 -192
- package/zh/guides/basic-features/env-vars.md +7 -6
- package/zh/guides/basic-features/html.md +54 -46
- package/zh/guides/basic-features/index.md +0 -5
- package/zh/guides/basic-features/mock.md +4 -4
- package/zh/guides/basic-features/proxy.md +4 -5
- package/zh/guides/basic-features/routes.md +105 -18
- package/zh/guides/concept/entries.md +5 -7
- package/zh/guides/get-started/quick-start.md +3 -4
- package/zh/guides/topic-detail/changesets/add.md +1 -3
- package/zh/guides/topic-detail/changesets/changelog.md +30 -31
- package/zh/guides/topic-detail/changesets/commit.md +44 -45
- package/zh/guides/topic-detail/changesets/config.md +2 -1
- package/zh/guides/topic-detail/changesets/github.md +6 -10
- package/zh/guides/topic-detail/changesets/introduce.md +0 -1
- package/zh/guides/topic-detail/changesets/release-note.md +9 -12
- package/zh/guides/topic-detail/changesets/release-pre.md +1 -1
- package/zh/guides/topic-detail/framework-plugin/extend.md +13 -13
- package/zh/guides/topic-detail/framework-plugin/hook-list.md +2 -2
- package/zh/guides/topic-detail/framework-plugin/hook.md +57 -54
- package/zh/guides/topic-detail/framework-plugin/implement.md +11 -11
- package/zh/guides/topic-detail/framework-plugin/plugin-api.md +4 -4
- package/zh/guides/topic-detail/generator/codesmith/api/app.md +36 -36
- package/zh/guides/topic-detail/generator/codesmith/api/ejs.md +2 -2
- package/zh/guides/topic-detail/generator/codesmith/api/fs.md +2 -2
- package/zh/guides/topic-detail/generator/codesmith/api/git.md +3 -2
- package/zh/guides/topic-detail/generator/codesmith/api/handlebars.md +2 -2
- package/zh/guides/topic-detail/generator/codesmith/api/json.md +9 -11
- package/zh/guides/topic-detail/generator/codesmith/api/npm.md +4 -2
- package/zh/guides/topic-detail/generator/codesmith/introduce.md +20 -7
- package/zh/guides/topic-detail/generator/codesmith/run-in-js.md +4 -5
- package/zh/guides/topic-detail/generator/codesmith/structure.md +13 -10
- package/zh/guides/topic-detail/generator/config/common.md +18 -27
- package/zh/guides/topic-detail/generator/plugin/abstract.md +1 -1
- package/zh/guides/topic-detail/generator/plugin/api/file/introduce.md +1 -0
- package/zh/guides/topic-detail/generator/plugin/api/file/updateJSONFile.md +4 -4
- package/zh/guides/topic-detail/generator/plugin/api/info/locale.md +1 -1
- package/zh/guides/topic-detail/generator/plugin/api/input/addInputAfter.md +2 -2
- package/zh/guides/topic-detail/generator/plugin/api/input/addInputBefore.md +3 -4
- package/zh/guides/topic-detail/generator/plugin/api/input/setInput.md +1 -1
- package/zh/guides/topic-detail/generator/plugin/api/input/type.md +1 -1
- package/zh/guides/topic-detail/generator/plugin/api/introduce.md +8 -9
- package/zh/guides/topic-detail/generator/plugin/develop.md +13 -13
- package/zh/guides/topic-detail/generator/plugin/use.md +8 -8
- package/zh/guides/topic-detail/generator/project.md +1 -1
- package/zh/guides/topic-detail/micro-frontend/c01-introduction.md +7 -8
- package/zh/guides/topic-detail/micro-frontend/c02-development.md +20 -23
- package/zh/guides/topic-detail/micro-frontend/c03-main-app.md +41 -44
- package/zh/guides/topic-detail/micro-frontend/c04-communicate.md +7 -5
- package/zh/guides/topic-detail/micro-frontend/c05-mixed-stack.md +1 -1
- package/zh/guides/topic-detail/model/auto-actions.md +0 -1
- package/zh/guides/topic-detail/model/computed-state.md +0 -2
- package/zh/guides/topic-detail/model/define-model.md +3 -6
- package/zh/guides/topic-detail/model/faq.md +2 -5
- package/zh/guides/topic-detail/model/manage-effects.md +2 -5
- package/zh/guides/topic-detail/model/model-communicate.md +1 -4
- package/zh/guides/topic-detail/model/performance.md +1 -5
- package/zh/guides/topic-detail/model/quick-start.md +0 -6
- package/zh/guides/topic-detail/model/redux-integration.md +3 -2
- package/zh/guides/topic-detail/model/test-model.md +1 -1
- package/zh/guides/topic-detail/model/typescript-best-practice.md +13 -14
- package/zh/guides/topic-detail/model/use-model.md +14 -12
- package/zh/guides/topic-detail/model/use-out-of-modernjs.md +4 -6
- package/zh/guides/topic-detail/monorepo/intro.md +0 -1
- package/zh/guides/topic-detail/monorepo/sub-project-interface.md +14 -7
- package/zh/tutorials/first-app/c01-start.md +2 -2
- package/zh/tutorials/first-app/c03-css.md +6 -9
- package/zh/tutorials/first-app/c04-routes.md +1 -1
- package/zh/tutorials/first-app/c05-loader.md +2 -1
- package/zh/tutorials/first-app/c07-container.md +6 -7
- package/zh/tutorials/first-app/c08-entries.md +5 -7
@@ -50,7 +50,7 @@ interface State {
|
|
50
50
|
pending: boolean;
|
51
51
|
result: any;
|
52
52
|
error: string;
|
53
|
-
}
|
53
|
+
};
|
54
54
|
}
|
55
55
|
```
|
56
56
|
|
@@ -75,9 +75,10 @@ interface State {
|
|
75
75
|
|
76
76
|
- `pending`: the default value is `"pending"`. Change the name of the `pending` field in the returned State. Usage is the same as `result`.
|
77
77
|
|
78
|
-
- `error`:
|
78
|
+
- `error`: the default value is `"error"`. Change the name of the `error` field in the returned State. Usage is the same as `result`.
|
79
79
|
|
80
80
|
- `combineMode`: the default value is `"merge"`。get fulfilled state results. There are two ways to deal with it (The data types that can be automatically processed here are also limited to simple object or array types):
|
81
|
+
|
81
82
|
- `"merge"`: the previous data is merged with the current data. the data is an array type, operation is similar to `[].concat(lastData, currentData)`. the data is an object,operation is similar to `{...lastData, ...curData}`.
|
82
83
|
- `"replace"`: the current data directly replaces the previous data.
|
83
84
|
|
@@ -95,7 +96,6 @@ interface State {
|
|
95
96
|
}
|
96
97
|
```
|
97
98
|
|
98
|
-
|
99
99
|
### Return Type
|
100
100
|
|
101
101
|
Objects are processed by actions in pending, fulfilled, and rejected states.
|
@@ -11,7 +11,6 @@ import ReduckTip from '@site-docs-en/components/reduck-tip.md'
|
|
11
11
|
The original type of Reduck is complex. The following type definition shows the simplified type information. For the original type, see [**model**](https://github.com/modern-js-dev/reduck/blob/main/packages/store/src/model/model.ts)。
|
12
12
|
:::
|
13
13
|
|
14
|
-
|
15
14
|
## Function Signature
|
16
15
|
|
17
16
|
```ts
|
@@ -27,14 +26,12 @@ function useModel(
|
|
27
26
|
): [state, actions, subscribe];
|
28
27
|
```
|
29
28
|
|
30
|
-
|
31
29
|
### Input
|
32
30
|
|
33
31
|
- models: Array of Model objects, which can be passed in as an array type parameter, or all Models can be passed in as parameters one by one.
|
34
32
|
- stateSelector: Optional parameters, used to filter State calculations. The first n parameters are the States corresponding to n Models, and the returned data is used as the first element of the `useModel` return value array.
|
35
33
|
- actionSelector: Optional parameters, used to filter Action calculations. The first n parameters are the States corresponding to n Models, and the returned data is used as the second element of the `useModel` return value array.
|
36
34
|
|
37
|
-
|
38
35
|
### Return Value
|
39
36
|
|
40
37
|
Returns an array with each value:
|
@@ -9,7 +9,6 @@ import ReduckTip from '@site-docs-en/components/reduck-tip.md'
|
|
9
9
|
|
10
10
|
`useStore` Used to get the store shared by the current component tree.
|
11
11
|
|
12
|
-
|
13
12
|
## Function Signature
|
14
13
|
|
15
14
|
```ts
|
@@ -20,7 +19,6 @@ function useStore(): ReduckStore;
|
|
20
19
|
|
21
20
|
- ReduckStore: Reduck Store,type refer to the return type of [createStore](./create-store.md).
|
22
21
|
|
23
|
-
|
24
22
|
:::info More
|
25
23
|
[Use Model](/docs/guides/topic-detail/model/use-model).
|
26
24
|
:::
|
@@ -21,7 +21,7 @@ interface NavigateFunction {
|
|
21
21
|
replace?: boolean;
|
22
22
|
state?: any;
|
23
23
|
relative?: RelativeRoutingType;
|
24
|
-
}
|
24
|
+
},
|
25
25
|
): void;
|
26
26
|
(delta: number): void;
|
27
27
|
}
|
@@ -30,13 +30,13 @@ interface NavigateFunction {
|
|
30
30
|
The `useNavigate` hook returns a function that lets you navigate programmatically。
|
31
31
|
|
32
32
|
```tsx
|
33
|
-
import { useNavigate } from
|
33
|
+
import { useNavigate } from '@modern-js/runtime/router';
|
34
34
|
|
35
35
|
export function HomeButton() {
|
36
36
|
let navigate = useNavigate();
|
37
37
|
|
38
38
|
function handleClick() {
|
39
|
-
navigate(
|
39
|
+
navigate('/home');
|
40
40
|
}
|
41
41
|
|
42
42
|
return (
|
@@ -81,19 +81,13 @@ function App() {
|
|
81
81
|
### useParams
|
82
82
|
|
83
83
|
```ts
|
84
|
-
declare function useParams<
|
85
|
-
K extends string = string
|
86
|
-
>(): Readonly<Params<K>>;
|
84
|
+
declare function useParams<K extends string = string>(): Readonly<Params<K>>;
|
87
85
|
```
|
88
86
|
|
89
87
|
The `useParams` hook returns an object of key/value pairs of the dynamic params from the current URL that were matched by the `<Route path>`.
|
90
88
|
|
91
89
|
```tsx
|
92
|
-
import {
|
93
|
-
Routes,
|
94
|
-
Route,
|
95
|
-
useParams
|
96
|
-
} from "@modern-js/runtime/router";
|
90
|
+
import { Routes, Route, useParams } from '@modern-js/runtime/router';
|
97
91
|
|
98
92
|
function BlogPost() {
|
99
93
|
const { slug } = useParams();
|
@@ -103,10 +97,10 @@ function BlogPost() {
|
|
103
97
|
function App() {
|
104
98
|
return (
|
105
99
|
<Routes>
|
106
|
-
<Route path="/" element={
|
107
|
-
<Route path="/blog/:slug" element={
|
100
|
+
<Route path="/" element={<div>home</div>} />
|
101
|
+
<Route path="/blog/:slug" element={<BlogPost />} />
|
108
102
|
</Routes>
|
109
|
-
)
|
103
|
+
);
|
110
104
|
}
|
111
105
|
```
|
112
106
|
|
@@ -118,10 +112,7 @@ function App() {
|
|
118
112
|
declare function Link(props: LinkProps): React.ReactElement;
|
119
113
|
|
120
114
|
interface LinkProps
|
121
|
-
extends Omit<
|
122
|
-
React.AnchorHTMLAttributes<HTMLAnchorElement>,
|
123
|
-
"href"
|
124
|
-
> {
|
115
|
+
extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href'> {
|
125
116
|
replace?: boolean;
|
126
117
|
state?: any;
|
127
118
|
to: To;
|
@@ -140,45 +131,31 @@ A `<Link>` is an element that lets the user navigate to another page by clicking
|
|
140
131
|
### NavLink
|
141
132
|
|
142
133
|
```ts
|
143
|
-
declare function NavLink(
|
144
|
-
props: NavLinkProps
|
145
|
-
): React.ReactElement;
|
134
|
+
declare function NavLink(props: NavLinkProps): React.ReactElement;
|
146
135
|
|
147
136
|
interface NavLinkProps
|
148
|
-
extends Omit<
|
149
|
-
LinkProps,
|
150
|
-
"className" | "style" | "children"
|
151
|
-
> {
|
137
|
+
extends Omit<LinkProps, 'className' | 'style' | 'children'> {
|
152
138
|
caseSensitive?: boolean;
|
153
139
|
children?:
|
154
140
|
| React.ReactNode
|
155
141
|
| ((props: { isActive: boolean }) => React.ReactNode);
|
156
|
-
className?:
|
157
|
-
| string
|
158
|
-
| ((props: {
|
159
|
-
isActive: boolean;
|
160
|
-
}) => string | undefined);
|
142
|
+
className?: string | ((props: { isActive: boolean }) => string | undefined);
|
161
143
|
end?: boolean;
|
162
144
|
style?:
|
163
145
|
| React.CSSProperties
|
164
|
-
| ((props: {
|
165
|
-
isActive: boolean;
|
166
|
-
}) => React.CSSProperties);
|
146
|
+
| ((props: { isActive: boolean }) => React.CSSProperties);
|
167
147
|
}
|
168
148
|
```
|
169
149
|
|
170
150
|
A `<NavLink>` is a special kind of `<Link>` that knows whether or not it is "active".
|
171
151
|
|
172
|
-
|
173
152
|
### Outlet
|
174
153
|
|
175
154
|
```ts
|
176
155
|
interface OutletProps {
|
177
156
|
context?: unknown;
|
178
157
|
}
|
179
|
-
declare function Outlet(
|
180
|
-
props: OutletProps
|
181
|
-
): React.ReactElement | null;
|
158
|
+
declare function Outlet(props: OutletProps): React.ReactElement | null;
|
182
159
|
```
|
183
160
|
|
184
161
|
An `<Outlet>` should be used in parent route elements to render their child route elements. This allows nested UI to show up when child routes are rendered.
|
@@ -201,10 +178,7 @@ function App() {
|
|
201
178
|
return (
|
202
179
|
<Routes>
|
203
180
|
<Route path="/" element={<Dashboard />}>
|
204
|
-
<Route
|
205
|
-
path="messages"
|
206
|
-
element={<DashboardMessages />}
|
207
|
-
/>
|
181
|
+
<Route path="messages" element={<DashboardMessages />} />
|
208
182
|
<Route path="tasks" element={<DashboardTasks />} />
|
209
183
|
</Route>
|
210
184
|
</Routes>
|
@@ -225,7 +199,7 @@ interface RouteObject {
|
|
225
199
|
action?: ActionFunction;
|
226
200
|
element?: React.ReactNode | null;
|
227
201
|
errorElement?: React.ReactNode | null;
|
228
|
-
handle?: RouteObject[
|
202
|
+
handle?: RouteObject['handle'];
|
229
203
|
shouldRevalidate?: ShouldRevalidateFunction;
|
230
204
|
}
|
231
205
|
```
|
@@ -241,14 +215,13 @@ const router = createBrowserRouter([
|
|
241
215
|
element: <Team />,
|
242
216
|
|
243
217
|
// when the URL matches this segment
|
244
|
-
path:
|
218
|
+
path: 'teams/:teamId',
|
245
219
|
|
246
220
|
// with this data loaded before rendering
|
247
221
|
loader: async ({ request, params }) => {
|
248
|
-
return fetch(
|
249
|
-
|
250
|
-
|
251
|
-
);
|
222
|
+
return fetch(`/fake/api/teams/${params.teamId}.json`, {
|
223
|
+
signal: request.signal,
|
224
|
+
});
|
252
225
|
},
|
253
226
|
|
254
227
|
// performing this mutation when data is submitted to it
|
@@ -271,21 +244,17 @@ const router = createBrowserRouter(
|
|
271
244
|
element={<Team />}
|
272
245
|
path="teams/:teamId"
|
273
246
|
loader={async ({ params }) => {
|
274
|
-
return fetch(
|
275
|
-
`/fake/api/teams/${params.teamId}.json`
|
276
|
-
);
|
247
|
+
return fetch(`/fake/api/teams/${params.teamId}.json`);
|
277
248
|
}}
|
278
249
|
action={async ({ request }) => {
|
279
250
|
return updateFakeTeam(await request.formData());
|
280
251
|
}}
|
281
252
|
errorElement={<ErrorBoundary />}
|
282
|
-
|
283
|
-
)
|
253
|
+
/>,
|
254
|
+
),
|
284
255
|
);
|
285
256
|
```
|
286
257
|
|
287
258
|
## More
|
288
259
|
|
289
260
|
You can access to [React Router](https://reactrouter.com/) to get the full API information.
|
290
|
-
|
291
|
-
|
@@ -9,11 +9,7 @@ The content wrapped by NoSSR will not be rendered at the server, nor will it be
|
|
9
9
|
```tsx
|
10
10
|
import { NoSSR } from '@modern-js/runtime';
|
11
11
|
|
12
|
-
export default () =>
|
13
|
-
<NoSSR>
|
14
|
-
...
|
15
|
-
</NoSSR>
|
16
|
-
)
|
12
|
+
export default () => <NoSSR>...</NoSSR>;
|
17
13
|
```
|
18
14
|
|
19
15
|
## Example
|
@@ -39,6 +35,3 @@ In CSR, it is often necessary to render different content according to the brows
|
|
39
35
|
Modern.js provides complete browser side information in the SSR context, which can be used to determine the rendering result of the component on the server side.
|
40
36
|
|
41
37
|
Even so, if there is too much logic in the application, or the developer wants to use the context later, or does not want some content to be rendered at the server side. developer can use the NoSSR component to exclude this part from server-side rendering.
|
42
|
-
|
43
|
-
|
44
|
-
|
@@ -13,7 +13,7 @@ export default () => (
|
|
13
13
|
<>
|
14
14
|
<PreRender interval={5} />
|
15
15
|
</>
|
16
|
-
)
|
16
|
+
);
|
17
17
|
```
|
18
18
|
|
19
19
|
## Function Signature
|
@@ -59,7 +59,7 @@ export default function App() {
|
|
59
59
|
<PreRender interval={10} />
|
60
60
|
<div>Hello Modern</div>
|
61
61
|
</>
|
62
|
-
)
|
62
|
+
);
|
63
63
|
}
|
64
64
|
```
|
65
65
|
|
@@ -67,10 +67,14 @@ The following example shows how to add the parameters in the query and header in
|
|
67
67
|
|
68
68
|
```tsx
|
69
69
|
/* calculate cache identifier using channel in query and language in header */
|
70
|
-
<PreRender
|
71
|
-
|
72
|
-
|
73
|
-
|
70
|
+
<PreRender
|
71
|
+
interval={10}
|
72
|
+
level={2}
|
73
|
+
includes={{
|
74
|
+
query: ['channel'],
|
75
|
+
header: ['language'],
|
76
|
+
}}
|
77
|
+
/>
|
74
78
|
```
|
75
79
|
|
76
80
|
The following example shows how not to let the test channel affect the online cache:
|
@@ -44,7 +44,6 @@ function render(ui: React.ReactElement<any>, options: Options): RenderResult;
|
|
44
44
|
- `wrapper`: a react component that can be used to customize rendering logic.
|
45
45
|
- `queries`: customize some own `queries`.
|
46
46
|
|
47
|
-
|
48
47
|
### Return Value
|
49
48
|
|
50
49
|
- `{...queries}`: all available [queries](https://testing-library.com/docs/queries/about/)。
|
@@ -55,7 +54,6 @@ function render(ui: React.ReactElement<any>, options: Options): RenderResult;
|
|
55
54
|
- `unmount`: unmount rendered components. This API is helpful if you want to test what happens after the component is unmounted.
|
56
55
|
- `asFragment`: return the [DocumentFragment](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment) of rendered component. used to test the response of the DOM structure after the react event is triggered.
|
57
56
|
|
58
|
-
|
59
57
|
## Example
|
60
58
|
|
61
59
|
```ts
|
@@ -30,7 +30,7 @@ const TomatoButton = styled(Button)`
|
|
30
30
|
background: tomato;
|
31
31
|
`;
|
32
32
|
|
33
|
-
function ButtonExample(){
|
33
|
+
function ButtonExample() {
|
34
34
|
return (
|
35
35
|
<>
|
36
36
|
<Button>I'm purple.</Button>
|
@@ -38,5 +38,5 @@ function ButtonExample(){
|
|
38
38
|
<TomatoButton>I'm red.</TomatoButton>
|
39
39
|
</>
|
40
40
|
);
|
41
|
-
}
|
41
|
+
}
|
42
42
|
```
|
@@ -9,9 +9,7 @@ Used to add html elements (such as title, meta, script, etc.) to the `<head>` el
|
|
9
9
|
```tsx
|
10
10
|
import { Helmet } from '@modern-js/runtime/head';
|
11
11
|
|
12
|
-
export default () =>
|
13
|
-
<Helmet>...</Helmet>
|
14
|
-
)
|
12
|
+
export default () => <Helmet>...</Helmet>;
|
15
13
|
```
|
16
14
|
|
17
15
|
## Example
|
@@ -28,10 +26,10 @@ function IndexPage() {
|
|
28
26
|
</Helmet>
|
29
27
|
<p>Hello Modern.js!</p>
|
30
28
|
</div>
|
31
|
-
)
|
29
|
+
);
|
32
30
|
}
|
33
31
|
|
34
|
-
export default IndexPage
|
32
|
+
export default IndexPage;
|
35
33
|
```
|
36
34
|
|
37
35
|
## More
|
@@ -34,7 +34,7 @@ Used to load component.
|
|
34
34
|
```ts
|
35
35
|
import loadable from '@modern-js/runtime/loadable';
|
36
36
|
|
37
|
-
const OtherComponent = loadable(() => import('./OtherComponent'))
|
37
|
+
const OtherComponent = loadable(() => import('./OtherComponent'));
|
38
38
|
```
|
39
39
|
|
40
40
|
#### options.resolveComponent
|
@@ -46,20 +46,20 @@ Type: `(module: Module, props: Props) => React.ComponentType<Props>`
|
|
46
46
|
By default, we think that the default export of file is a react component, so we can render the component directly. But when the component is named export, or we need to dynamically determine which component needs to be rendered according to the `props`, we can use `resolveComponent`. Here is an example:
|
47
47
|
|
48
48
|
```ts title='component.js'
|
49
|
-
export const Apple = () => 'Apple!'
|
50
|
-
export const Orange = () => 'Orange!'
|
49
|
+
export const Apple = () => 'Apple!';
|
50
|
+
export const Orange = () => 'Orange!';
|
51
51
|
```
|
52
52
|
|
53
53
|
```ts title='loadable.js'
|
54
54
|
const LoadableApple = loadable(() => import('./components'), {
|
55
|
-
resolveComponent:
|
56
|
-
})
|
55
|
+
resolveComponent: components => components.Apple,
|
56
|
+
});
|
57
57
|
const LoadableOrange = loadable(() => import('./components'), {
|
58
|
-
resolveComponent:
|
59
|
-
})
|
58
|
+
resolveComponent: components => components.Orange,
|
59
|
+
});
|
60
60
|
const LoadableFruit = loadable(() => import('./components'), {
|
61
61
|
resolveComponent: (components, props) => components[props.fruit],
|
62
|
-
})
|
62
|
+
});
|
63
63
|
```
|
64
64
|
|
65
65
|
#### options.fallback
|
@@ -75,11 +75,10 @@ Whether to support SSR, the default value is `true`。
|
|
75
75
|
#### LoadableComponent
|
76
76
|
|
77
77
|
```ts
|
78
|
-
type LoadableComponent<Props> =
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
}
|
78
|
+
type LoadableComponent<Props> = React.ComponentType<
|
79
|
+
Props & { fallback?: JSX.Element }
|
80
|
+
> & {
|
81
|
+
preload(props?: Props): void;
|
82
|
+
load(props?: Props): Promise<React.ComponentType<Props>>;
|
83
|
+
};
|
85
84
|
```
|
@@ -13,8 +13,8 @@ For more detail, see [Extend Web Server](/docs/guides/advanced-features/web-serv
|
|
13
13
|
```ts
|
14
14
|
import { AfterMatchHook, AfterRenderHook } from '@modern-js/runtime/server';
|
15
15
|
|
16
|
-
export const afterMatch: AfterMatchHook = (context, next) => {}
|
17
|
-
export const afterRender: AfterRenderHook = (context, next) => {}
|
16
|
+
export const afterMatch: AfterMatchHook = (context, next) => {};
|
17
|
+
export const afterRender: AfterRenderHook = (context, next) => {};
|
18
18
|
```
|
19
19
|
|
20
20
|
:::info
|
@@ -68,7 +68,7 @@ type AfterMatchContext = HookContext & {
|
|
68
68
|
redirect: (url: string, status: number) => void;
|
69
69
|
rewrite: (entry: string) => void;
|
70
70
|
};
|
71
|
-
}
|
71
|
+
};
|
72
72
|
|
73
73
|
type AfterRenderContext = {
|
74
74
|
template: {
|
@@ -82,7 +82,6 @@ type AfterRenderContext = {
|
|
82
82
|
};
|
83
83
|
```
|
84
84
|
|
85
|
-
|
86
85
|
### Input
|
87
86
|
|
88
87
|
- `context`: Hook context.
|
@@ -127,5 +126,5 @@ import type { AfterRender } from '@modern-js/runtime/server';
|
|
127
126
|
|
128
127
|
export const afterRender: AfterRenderHook = (context, next) => {
|
129
128
|
ctx.template.prependBody('<div>Footer</div>');
|
130
|
-
}
|
129
|
+
};
|
131
130
|
```
|
@@ -15,11 +15,11 @@ For more detail, see [Extend Web Server](/docs/guides/advanced-features/web-serv
|
|
15
15
|
```ts
|
16
16
|
import { Middleware } from '@modern-js/runtime/server';
|
17
17
|
|
18
|
-
export const middleware: Middleware = async (context, next) => {}
|
18
|
+
export const middleware: Middleware = async (context, next) => {};
|
19
19
|
export const middleware: Middleware[] = [
|
20
20
|
async (context, next) => {},
|
21
21
|
async (context, next) => {},
|
22
|
-
]
|
22
|
+
];
|
23
23
|
```
|
24
24
|
|
25
25
|
:::info
|
@@ -68,10 +68,12 @@ type MiddlewareContext = {
|
|
68
68
|
};
|
69
69
|
};
|
70
70
|
|
71
|
-
type RequestHandler = (
|
71
|
+
type RequestHandler = (
|
72
|
+
context: Context,
|
73
|
+
next: NextFunction,
|
74
|
+
) => Promise<void> | void;
|
72
75
|
```
|
73
76
|
|
74
|
-
|
75
77
|
### Input
|
76
78
|
|
77
79
|
- `context`: Middleware context.
|
@@ -90,7 +92,7 @@ export const Middleware = () => async (ctx, next) => {
|
|
90
92
|
ctx.res.once('finish', () => {
|
91
93
|
console.log(Date.now() - start);
|
92
94
|
});
|
93
|
-
}
|
95
|
+
};
|
94
96
|
```
|
95
97
|
|
96
98
|
### Inject Tools & Data
|
@@ -103,4 +105,3 @@ export const Middleware = () => async (ctx, next) => {
|
|
103
105
|
ctx.res.locals.rpc = createRpcInstance();
|
104
106
|
});
|
105
107
|
```
|
106
|
-
|
@@ -15,7 +15,7 @@ If you need to pass parameters to a command, you need to put the parameters afte
|
|
15
15
|
|
16
16
|
For example, in the following `package.json` configuration:
|
17
17
|
|
18
|
-
```
|
18
|
+
```json
|
19
19
|
{
|
20
20
|
"scripts": {
|
21
21
|
"command": "modern command"
|
@@ -24,6 +24,7 @@ For example, in the following `package.json` configuration:
|
|
24
24
|
```
|
25
25
|
|
26
26
|
The way to carry parameters when executing the command command is:
|
27
|
+
|
27
28
|
```bash
|
28
29
|
pnpm run command --options
|
29
30
|
```
|
@@ -32,7 +33,7 @@ pnpm v6:
|
|
32
33
|
|
33
34
|
In the following `package.json` configuration:
|
34
35
|
|
35
|
-
```
|
36
|
+
```json
|
36
37
|
{
|
37
38
|
"scripts": {
|
38
39
|
"command": "modern command"
|
@@ -0,0 +1,17 @@
|
|
1
|
+
Execute `pnpm run dev` in the project to start the project:
|
2
|
+
|
3
|
+
```bash
|
4
|
+
$ pnpm run dev
|
5
|
+
|
6
|
+
> modern dev
|
7
|
+
|
8
|
+
info Starting dev server...
|
9
|
+
info App running at:
|
10
|
+
|
11
|
+
> Local: http://localhost:8080/
|
12
|
+
> Network: http://192.168.0.1:8080/
|
13
|
+
|
14
|
+
Client ✔ done in 76.10ms
|
15
|
+
```
|
16
|
+
|
17
|
+
Open `http://localhost:8000/` in your browser to see the page content.
|
@@ -8,29 +8,25 @@ import TabItem from '@theme/TabItem';
|
|
8
8
|
<TabItem value="express" label="Express.js" default>
|
9
9
|
|
10
10
|
```ts title="edenx.config.ts"
|
11
|
-
import
|
12
|
-
import
|
11
|
+
import expressPlugin from '@edenx/plugin-express';
|
12
|
+
import bffPlugin from '@edenx/plugin-bff';
|
13
13
|
|
14
14
|
export default defineConfig({
|
15
|
-
plugins: [
|
16
|
-
|
17
|
-
BffPlugin()
|
18
|
-
]
|
19
|
-
})
|
15
|
+
plugins: [expressPlugin(), bffPlugin()],
|
16
|
+
});
|
20
17
|
```
|
18
|
+
|
21
19
|
</TabItem>
|
22
20
|
<TabItem value="koa" label="Koa.js">
|
23
21
|
|
24
22
|
```ts title="edenx.config.ts"
|
25
|
-
import
|
26
|
-
import
|
23
|
+
import koaPlugin from '@edenx/plugin-koa';
|
24
|
+
import bffPlugin from '@edenx/plugin-bff';
|
27
25
|
|
28
26
|
export default defineConfig({
|
29
|
-
plugins: [
|
30
|
-
|
31
|
-
BffPlugin()
|
32
|
-
]
|
33
|
-
})
|
27
|
+
plugins: [koaPlugin(), bffPlugin()],
|
28
|
+
});
|
34
29
|
```
|
30
|
+
|
35
31
|
</TabItem>
|
36
32
|
</Tabs>
|
@@ -1,6 +1,6 @@
|
|
1
|
-
```
|
2
|
-
import
|
3
|
-
import
|
1
|
+
```js title="modern.config.ts"
|
2
|
+
import appTools, { defineConfig } from '@modern-js/app-tools';
|
3
|
+
import garfishPlugin from '@modern-js/plugin-garfish';
|
4
4
|
|
5
5
|
export default defineConfig({
|
6
6
|
runtime: {
|
@@ -8,6 +8,6 @@ export default defineConfig({
|
|
8
8
|
state: true,
|
9
9
|
masterApp: true,
|
10
10
|
},
|
11
|
-
plugins: [
|
11
|
+
plugins: [appTools(), garfishPlugin()],
|
12
12
|
});
|
13
13
|
```
|
@@ -1,9 +1,8 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
- Type: `string | Object`
|
2
|
+
- Default: `null`
|
3
3
|
|
4
4
|
When this option is configured, the development environment will start a global proxy, similar to [Fiddler](https://www.telerik.com/fiddler), [Charles](https://www.charlesproxy.com/) and other web proxy debugging tools, which can be used to view, modify HTTP/HTTPS requests, responses, and can also be used as a proxy server.
|
5
5
|
|
6
|
-
|
7
6
|
:::tip 提示
|
8
7
|
Using this option requires advance installation `@modern-js/plugin-proxy`。
|
9
8
|
:::
|
@@ -14,15 +13,15 @@ Using this option requires that the value of `Object` be installed in advance, t
|
|
14
13
|
|
15
14
|
Example:
|
16
15
|
|
17
|
-
```
|
16
|
+
```ts title="modern.config.ts"
|
18
17
|
export default defineConfig({
|
19
18
|
dev: {
|
20
19
|
proxy: {
|
21
20
|
'https://www.baidu.com': 'https://google.com.hk',
|
22
21
|
//可以通过 file 协议直接返回静态文件。
|
23
22
|
'https://example.com/api': 'file://./data.json',
|
24
|
-
}
|
25
|
-
}
|
23
|
+
},
|
24
|
+
},
|
26
25
|
});
|
27
26
|
```
|
28
27
|
|
@@ -30,8 +29,7 @@ export default defineConfig({
|
|
30
29
|
|
31
30
|
When the value is `string`, it can be used to specify a separate proxy file, for example:
|
32
31
|
|
33
|
-
|
34
|
-
```typescript title="modern.config.ts"
|
32
|
+
```ts title="modern.config.ts"
|
35
33
|
export default defineConfig({
|
36
34
|
dev: {
|
37
35
|
proxy: './proxy.js',
|
@@ -71,4 +69,3 @@ Access the `localhost:8899` to view the Network and configure proxy rules on the
|
|
71
69
|
:::caution Caution
|
72
70
|
The https agent automatically installs the certificate to obtain root privileges. Please enter the password as prompted. ** The password is only used when the certificate is trusted and will not be leaked or used for other links **.
|
73
71
|
:::
|
74
|
-
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
Modern.js provides out-of-the-box global proxy plugin `@modern-js/plugin-proxy`, which is based on [whistle](https://github.com/avwo/whistle) and can be used to view and modify HTTP/HTTPS requests and responses, and can also be used as an HTTP proxy server.
|
3
2
|
|
4
3
|
### Set Proxy Rules
|