@modern-js/main-doc 2.3.0 → 2.5.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/LICENSE +0 -123
- package/README.md +26 -0
- package/en/apis/app/commands/_category_.json +1 -4
- package/en/apis/app/commands/new.mdx +11 -10
- package/en/apis/app/commands/test.mdx +1 -1
- package/en/apis/app/hooks/_category_.json +1 -4
- package/en/apis/app/hooks/api/framework/lambda.mdx +1 -1
- package/en/apis/app/hooks/api/functions/api.mdx +1 -1
- package/en/apis/app/hooks/server/index_.mdx +2 -1
- package/en/apis/app/hooks/src/pages.mdx +7 -7
- package/en/apis/app/hooks/src/routes.mdx +1 -1
- package/en/apis/app/runtime/_category_.json +1 -5
- package/en/apis/app/runtime/app/define-config.mdx +2 -2
- package/en/apis/app/runtime/core/bootstrap.mdx +1 -1
- package/en/apis/app/runtime/core/create-app.mdx +2 -2
- package/en/apis/app/runtime/core/use-loader.mdx +4 -4
- package/en/apis/app/runtime/core/use-module-apps.mdx +2 -2
- package/en/apis/app/runtime/model/Provider.mdx +2 -2
- package/en/apis/app/runtime/model/auto-actions.mdx +2 -2
- package/en/apis/app/runtime/model/connect.mdx +5 -5
- package/en/apis/app/runtime/model/create-app.mdx +9 -9
- package/en/apis/app/runtime/model/create-store.mdx +3 -3
- package/en/apis/app/runtime/model/handle-effect.mdx +2 -2
- package/en/apis/app/runtime/model/model_.mdx +1 -1
- package/en/apis/app/runtime/model/use-local-model.mdx +1 -1
- package/en/apis/app/runtime/model/use-model.mdx +1 -1
- package/en/apis/app/runtime/model/use-static-model.mdx +4 -4
- package/en/apis/app/runtime/model/use-store.mdx +1 -1
- package/en/apis/app/runtime/router/router.mdx +1 -1
- package/en/apis/app/runtime/ssr/pre-render.mdx +1 -1
- package/en/apis/app/runtime/testing/render.mdx +1 -1
- package/en/apis/app/runtime/testing/renderApp.mdx +1 -1
- package/en/apis/app/runtime/utility/css-in-js.mdx +1 -1
- package/en/apis/app/runtime/utility/loadable.mdx +1 -1
- package/en/apis/app/runtime/web-server/hook.mdx +5 -5
- package/en/apis/app/runtime/web-server/middleware.mdx +6 -6
- package/en/components/global-proxy-config.mdx +3 -3
- package/en/components/init-app.mdx +1 -1
- package/en/configure/app/bff/_category_.json +4 -0
- package/en/configure/app/builder-plugins.mdx +3 -3
- package/en/configure/app/deploy/_category_.json +4 -0
- package/en/configure/app/dev/_category_.json +4 -0
- package/en/configure/app/dev/asset-prefix.mdx +1 -1
- package/en/configure/app/dev/hmr.mdx +1 -1
- package/en/configure/app/dev/https.mdx +1 -1
- package/en/configure/app/dev/port.mdx +1 -1
- package/en/configure/app/dev/progress-bar.mdx +1 -1
- package/en/configure/app/dev/start-url.mdx +1 -1
- package/en/configure/app/experiments/_category_.json +4 -0
- package/en/configure/app/experiments/lazy-compilation.mdx +1 -1
- package/en/configure/app/html/_category_.json +4 -0
- package/en/configure/app/html/app-icon.mdx +1 -1
- package/en/configure/app/html/crossorigin.mdx +1 -1
- package/en/configure/app/html/disable-html-folder.mdx +1 -1
- package/en/configure/app/html/favicon-by-entries.mdx +1 -1
- package/en/configure/app/html/favicon.mdx +1 -1
- package/en/configure/app/html/inject-by-entries.mdx +1 -1
- package/en/configure/app/html/inject.mdx +1 -1
- package/en/configure/app/html/meta-by-entries.mdx +1 -1
- package/en/configure/app/html/meta.mdx +1 -1
- package/en/configure/app/html/mount-id.mdx +1 -1
- package/en/configure/app/html/tags-by-entries.mdx +1 -1
- package/en/configure/app/html/tags.mdx +1 -1
- package/en/configure/app/html/template-by-entries.mdx +1 -1
- package/en/configure/app/html/template-parameters-by-entries.mdx +1 -1
- package/en/configure/app/html/template-parameters.mdx +1 -1
- package/en/configure/app/html/template.mdx +1 -1
- package/en/configure/app/html/title-by-entries.mdx +1 -1
- package/en/configure/app/html/title.mdx +1 -1
- package/en/configure/app/output/_category_.json +4 -0
- package/en/configure/app/output/asset-prefix.mdx +1 -1
- package/en/configure/app/output/assets-retry.mdx +1 -1
- package/en/configure/app/output/charset.mdx +1 -1
- package/en/configure/app/output/clean-dist-path.mdx +1 -1
- package/en/configure/app/output/convert-to-rem.mdx +1 -1
- package/en/configure/app/output/copy.mdx +1 -1
- package/en/configure/app/output/css-module-local-ident-name.mdx +1 -1
- package/en/configure/app/output/data-uri-limit.mdx +1 -1
- package/en/configure/app/output/disable-css-extract.mdx +1 -1
- package/en/configure/app/output/disable-css-module-extension.mdx +1 -1
- package/en/configure/app/output/disable-filename-hash.mdx +1 -1
- package/en/configure/app/output/disable-inline-runtime-chunk.mdx +1 -1
- package/en/configure/app/output/disable-minimize.mdx +1 -1
- package/en/configure/app/output/disable-source-map.mdx +1 -1
- package/en/configure/app/output/disable-ts-checker.mdx +1 -1
- package/en/configure/app/output/dist-path.mdx +1 -1
- package/en/configure/app/output/enable-asset-fallback.mdx +1 -1
- package/en/configure/app/output/enable-asset-manifest.mdx +1 -1
- package/en/configure/app/output/enable-css-module-tsdeclaration.mdx +1 -1
- package/en/configure/app/output/enable-inline-scripts.mdx +1 -1
- package/en/configure/app/output/enable-inline-styles.mdx +1 -1
- package/en/configure/app/output/enable-latest-decorators.mdx +1 -1
- package/en/configure/app/output/externals.mdx +1 -1
- package/en/configure/app/output/filename.mdx +1 -1
- package/en/configure/app/output/legal-comments.mdx +1 -1
- package/en/configure/app/output/override-browserslist.mdx +1 -1
- package/en/configure/app/output/polyfill.mdx +1 -1
- package/en/configure/app/output/ssg.mdx +2 -2
- package/en/configure/app/output/svg-default-export.mdx +1 -1
- package/en/configure/app/performance/_category_.json +4 -0
- package/en/configure/app/performance/build-cache.mdx +1 -1
- package/en/configure/app/performance/bundle-analyze.mdx +1 -1
- package/en/configure/app/performance/chunk-split.mdx +1 -1
- package/en/configure/app/performance/print-file-size.mdx +1 -1
- package/en/configure/app/performance/profile.mdx +1 -1
- package/en/configure/app/performance/remove-console.mdx +1 -1
- package/en/configure/app/performance/remove-moment-locale.mdx +1 -1
- package/en/configure/app/plugins.mdx +1 -1
- package/en/configure/app/runtime/_category_.json +4 -0
- package/en/configure/app/runtime/intro.mdx +2 -2
- package/en/configure/app/security/_category_.json +4 -0
- package/en/configure/app/security/check-syntax.mdx +1 -1
- package/en/configure/app/security/sri.mdx +1 -1
- package/en/configure/app/server/_category_.json +4 -0
- package/en/configure/app/server/base-url.mdx +3 -3
- package/en/configure/app/server/enable-framework-ext.mdx +1 -1
- package/en/configure/app/server/ssr-by-entries.mdx +1 -1
- package/en/configure/app/source/_category_.json +4 -0
- package/en/configure/app/source/alias.mdx +1 -1
- package/en/configure/app/source/compile-js-data-uri.mdx +1 -1
- package/en/configure/app/source/define.mdx +1 -1
- package/en/configure/app/source/design-system.mdx +5 -5
- package/en/configure/app/source/entries.mdx +3 -3
- package/en/configure/app/source/exclude.mdx +1 -1
- package/en/configure/app/source/global-vars.mdx +1 -1
- package/en/configure/app/source/include.mdx +1 -1
- package/en/configure/app/source/module-scopes.mdx +1 -1
- package/en/configure/app/source/pre-entry.mdx +1 -1
- package/en/configure/app/source/resolve-extension-prefix.mdx +1 -1
- package/en/configure/app/source/resolve-main-fields.mdx +1 -1
- package/en/configure/app/testing/_category_.json +4 -0
- package/en/configure/app/tools/_category_.json +4 -0
- package/en/configure/app/tools/autoprefixer.mdx +1 -1
- package/en/configure/app/tools/babel.mdx +1 -1
- package/en/configure/app/tools/css-extract.mdx +1 -1
- package/en/configure/app/tools/css-loader.mdx +1 -1
- package/en/configure/app/tools/dev-server.mdx +1 -1
- package/en/configure/app/tools/html-plugin.mdx +1 -1
- package/en/configure/app/tools/inspector.mdx +1 -1
- package/en/configure/app/tools/less.mdx +1 -1
- package/en/configure/app/tools/minify-css.mdx +1 -1
- package/en/configure/app/tools/postcss.mdx +1 -1
- package/en/configure/app/tools/pug.mdx +1 -1
- package/en/configure/app/tools/rspack.mdx +13 -0
- package/en/configure/app/tools/sass.mdx +1 -1
- package/en/configure/app/tools/style-loader.mdx +1 -1
- package/en/configure/app/tools/styled-components.mdx +1 -1
- package/en/configure/app/tools/tailwindcss.mdx +1 -1
- package/en/configure/app/tools/terser.mdx +1 -1
- package/en/configure/app/tools/ts-checker.mdx +1 -1
- package/en/configure/app/tools/ts-loader.mdx +1 -1
- package/en/configure/app/tools/webpack-chain.mdx +1 -1
- package/en/configure/app/tools/webpack.mdx +1 -1
- package/en/configure/app/usage.mdx +64 -1
- package/en/guides/advanced-features/_category_.json +5 -0
- package/en/guides/advanced-features/bff/bff-proxy.mdx +1 -1
- package/en/guides/advanced-features/bff/frameworks.mdx +1 -1
- package/en/guides/advanced-features/bff/function.mdx +3 -3
- package/en/guides/advanced-features/code-split.mdx +2 -2
- package/en/guides/advanced-features/compatibility.mdx +2 -3
- package/en/guides/advanced-features/eslint.mdx +4 -4
- package/en/guides/advanced-features/low-level.mdx +1 -1
- package/en/guides/advanced-features/ssg.mdx +4 -5
- package/en/guides/advanced-features/ssr.mdx +5 -5
- package/en/guides/advanced-features/testing.mdx +4 -5
- package/en/guides/advanced-features/web-server.mdx +0 -1
- package/en/guides/basic-features/_category_.json +5 -0
- package/en/guides/basic-features/alias.mdx +1 -1
- package/en/guides/basic-features/data-fetch.mdx +21 -8
- package/en/guides/basic-features/env-vars.mdx +1 -1
- package/en/guides/basic-features/html.mdx +11 -11
- package/en/guides/basic-features/mock.mdx +21 -1
- package/en/guides/basic-features/proxy.mdx +2 -2
- package/en/guides/basic-features/routes.mdx +33 -7
- package/en/guides/concept/_category_.json +5 -0
- package/en/guides/{basic-features → concept}/builder.mdx +2 -2
- package/en/guides/concept/entries.mdx +11 -11
- package/en/guides/css/_category_.json +5 -0
- package/en/guides/{basic-features/css → css}/css-in-js.mdx +0 -0
- package/en/guides/{basic-features/css → css}/css-modules.mdx +0 -0
- package/en/guides/{basic-features/css → css}/less-sass.mdx +1 -1
- package/en/guides/{basic-features/css → css}/postcss.mdx +0 -0
- package/en/guides/{basic-features/css → css}/tailwindcss.mdx +0 -0
- package/en/guides/get-started/_category_.json +5 -0
- package/en/guides/get-started/introduction.mdx +34 -0
- package/en/guides/get-started/quick-start.mdx +2 -2
- package/en/guides/get-started/upgrade.mdx +2 -1
- package/en/guides/topic-detail/_category_.json +2 -2
- package/en/guides/topic-detail/framework-plugin/hook.mdx +1 -1
- package/en/guides/topic-detail/generator/config/{mwa.mdx → app.mdx} +1 -1
- package/en/guides/topic-detail/generator/plugin/api/hook/onForged.mdx +1 -1
- package/en/guides/topic-detail/generator/plugin/api/new/createElement.mdx +1 -1
- package/en/guides/topic-detail/generator/plugin/api/new/enableFunc.mdx +1 -1
- package/en/guides/topic-detail/generator/plugin/api/new/introduce.mdx +1 -1
- package/en/guides/topic-detail/generator/plugin/develop.mdx +3 -3
- package/en/guides/topic-detail/micro-frontend/c02-development.mdx +128 -61
- package/en/guides/topic-detail/micro-frontend/c03-main-app.mdx +72 -41
- package/en/guides/topic-detail/micro-frontend/c05-mixed-stack.mdx +1 -1
- package/en/guides/topic-detail/model/auto-actions.mdx +1 -1
- package/en/guides/topic-detail/model/define-model.mdx +1 -1
- package/en/guides/topic-detail/model/manage-effects.mdx +1 -1
- package/en/guides/topic-detail/model/model-communicate.mdx +1 -1
- package/en/guides/topic-detail/model/quick-start.mdx +2 -2
- package/en/guides/topic-detail/model/test-model.mdx +1 -1
- package/en/guides/topic-detail/model/use-model.mdx +3 -3
- package/en/guides/troubleshooting/_category_.json +2 -2
- package/en/guides/troubleshooting/cli.mdx +1 -1
- package/en/index.md +1 -1
- package/en/tutorials/first-app/_category_.json +1 -1
- package/en/tutorials/first-app/c01-start.mdx +0 -1
- package/en/tutorials/first-app/c03-css.mdx +1 -2
- package/en/tutorials/first-app/c06-model.mdx +1 -1
- package/en/tutorials/first-app/c07-container.mdx +1 -1
- package/en/tutorials/first-app/c08-entries.mdx +1 -2
- package/en/tutorials/foundations/introduction.mdx +17 -34
- package/package.json +3 -3
- package/scripts/config.ts +3 -1
- package/scripts/summary.en.json +1 -1
- package/scripts/summary.zh.json +1 -1
- package/zh/apis/app/commands/_category_.json +1 -4
- package/zh/apis/app/hooks/_category_.json +1 -4
- package/zh/apis/app/hooks/src/pages.mdx +1 -1
- package/zh/apis/app/hooks/src/routes.mdx +1 -1
- package/zh/apis/app/runtime/_category_.json +1 -5
- package/zh/apis/app/runtime/core/create-app.mdx +1 -1
- package/zh/apis/app/runtime/core/use-module-apps.mdx +81 -40
- package/zh/apis/app/runtime/model/Provider.mdx +2 -2
- package/zh/apis/app/runtime/model/create-app.mdx +7 -7
- package/zh/apis/app/runtime/model/create-store.mdx +2 -2
- package/zh/apis/app/runtime/model/use-local-model.mdx +1 -1
- package/zh/apis/app/runtime/model/use-static-model.mdx +1 -1
- package/zh/apis/app/runtime/model/use-store.mdx +1 -1
- package/zh/apis/app/runtime/testing/renderApp.mdx +1 -1
- package/zh/components/custom-router-micro-frontend.mdx +40 -0
- package/zh/components/enable-micro-frontend.mdx +12 -2
- package/zh/components/micro-runtime-config.mdx +9 -10
- package/zh/components/release-note.mdx +1 -1
- package/zh/configure/app/builder-plugins.mdx +3 -3
- package/zh/configure/app/dev/asset-prefix.mdx +1 -1
- package/zh/configure/app/dev/hmr.mdx +1 -1
- package/zh/configure/app/dev/https.mdx +1 -1
- package/zh/configure/app/dev/port.mdx +1 -1
- package/zh/configure/app/dev/progress-bar.mdx +1 -1
- package/zh/configure/app/dev/start-url.mdx +1 -1
- package/zh/configure/app/experiments/lazy-compilation.mdx +1 -1
- package/zh/configure/app/html/app-icon.mdx +1 -1
- package/zh/configure/app/html/crossorigin.mdx +1 -1
- package/zh/configure/app/html/disable-html-folder.mdx +1 -1
- package/zh/configure/app/html/favicon-by-entries.mdx +1 -1
- package/zh/configure/app/html/favicon.mdx +1 -1
- package/zh/configure/app/html/inject-by-entries.mdx +1 -1
- package/zh/configure/app/html/inject.mdx +1 -1
- package/zh/configure/app/html/meta-by-entries.mdx +1 -1
- package/zh/configure/app/html/meta.mdx +1 -1
- package/zh/configure/app/html/mount-id.mdx +1 -1
- package/zh/configure/app/html/tags-by-entries.mdx +1 -1
- package/zh/configure/app/html/tags.mdx +1 -1
- package/zh/configure/app/html/template-by-entries.mdx +1 -1
- package/zh/configure/app/html/template-parameters-by-entries.mdx +1 -1
- package/zh/configure/app/html/template-parameters.mdx +1 -1
- package/zh/configure/app/html/template.mdx +1 -1
- package/zh/configure/app/html/title-by-entries.mdx +1 -1
- package/zh/configure/app/html/title.mdx +1 -1
- package/zh/configure/app/output/asset-prefix.mdx +1 -1
- package/zh/configure/app/output/assets-retry.mdx +1 -1
- package/zh/configure/app/output/charset.mdx +1 -1
- package/zh/configure/app/output/clean-dist-path.mdx +1 -1
- package/zh/configure/app/output/convert-to-rem.mdx +1 -1
- package/zh/configure/app/output/copy.mdx +1 -1
- package/zh/configure/app/output/css-module-local-ident-name.mdx +1 -1
- package/zh/configure/app/output/data-uri-limit.mdx +1 -1
- package/zh/configure/app/output/disable-css-extract.mdx +1 -1
- package/zh/configure/app/output/disable-css-module-extension.mdx +1 -1
- package/zh/configure/app/output/disable-filename-hash.mdx +1 -1
- package/zh/configure/app/output/disable-inline-runtime-chunk.mdx +1 -1
- package/zh/configure/app/output/disable-minimize.mdx +1 -1
- package/zh/configure/app/output/disable-source-map.mdx +1 -1
- package/zh/configure/app/output/disable-ts-checker.mdx +1 -1
- package/zh/configure/app/output/dist-path.mdx +1 -1
- package/zh/configure/app/output/enable-asset-fallback.mdx +1 -1
- package/zh/configure/app/output/enable-asset-manifest.mdx +1 -1
- package/zh/configure/app/output/enable-css-module-tsdeclaration.mdx +1 -1
- package/zh/configure/app/output/enable-inline-scripts.mdx +1 -1
- package/zh/configure/app/output/enable-inline-styles.mdx +1 -1
- package/zh/configure/app/output/enable-latest-decorators.mdx +1 -1
- package/zh/configure/app/output/externals.mdx +1 -1
- package/zh/configure/app/output/filename.mdx +1 -1
- package/zh/configure/app/output/legal-comments.mdx +1 -1
- package/zh/configure/app/output/override-browserslist.mdx +1 -1
- package/zh/configure/app/output/polyfill.mdx +1 -1
- package/zh/configure/app/output/svg-default-export.mdx +1 -1
- package/zh/configure/app/performance/build-cache.mdx +1 -1
- package/zh/configure/app/performance/bundle-analyze.mdx +1 -1
- package/zh/configure/app/performance/chunk-split.mdx +1 -1
- package/zh/configure/app/performance/print-file-size.mdx +1 -1
- package/zh/configure/app/performance/profile.mdx +1 -1
- package/zh/configure/app/performance/remove-console.mdx +1 -1
- package/zh/configure/app/performance/remove-moment-locale.mdx +1 -1
- package/zh/configure/app/plugins.mdx +1 -1
- package/zh/configure/app/security/check-syntax.mdx +1 -1
- package/zh/configure/app/security/sri.mdx +1 -1
- package/zh/configure/app/server/ssr-by-entries.mdx +1 -1
- package/zh/configure/app/source/alias.mdx +1 -1
- package/zh/configure/app/source/compile-js-data-uri.mdx +1 -1
- package/zh/configure/app/source/define.mdx +1 -1
- package/zh/configure/app/source/exclude.mdx +1 -1
- package/zh/configure/app/source/global-vars.mdx +1 -1
- package/zh/configure/app/source/include.mdx +1 -1
- package/zh/configure/app/source/module-scopes.mdx +1 -1
- package/zh/configure/app/source/pre-entry.mdx +1 -1
- package/zh/configure/app/source/resolve-extension-prefix.mdx +1 -1
- package/zh/configure/app/source/resolve-main-fields.mdx +1 -1
- package/zh/configure/app/tools/autoprefixer.mdx +1 -1
- package/zh/configure/app/tools/babel.mdx +1 -1
- package/zh/configure/app/tools/css-extract.mdx +1 -1
- package/zh/configure/app/tools/css-loader.mdx +1 -1
- package/zh/configure/app/tools/dev-server.mdx +1 -1
- package/zh/configure/app/tools/html-plugin.mdx +1 -1
- package/zh/configure/app/tools/inspector.mdx +1 -1
- package/zh/configure/app/tools/less.mdx +1 -1
- package/zh/configure/app/tools/minify-css.mdx +1 -1
- package/zh/configure/app/tools/postcss.mdx +1 -1
- package/zh/configure/app/tools/pug.mdx +1 -1
- package/zh/configure/app/tools/rspack.mdx +13 -0
- package/zh/configure/app/tools/sass.mdx +1 -1
- package/zh/configure/app/tools/style-loader.mdx +1 -1
- package/zh/configure/app/tools/styled-components.mdx +1 -1
- package/zh/configure/app/tools/terser.mdx +1 -1
- package/zh/configure/app/tools/ts-checker.mdx +1 -1
- package/zh/configure/app/tools/ts-loader.mdx +1 -1
- package/zh/configure/app/tools/webpack-chain.mdx +1 -1
- package/zh/configure/app/tools/webpack.mdx +1 -1
- package/zh/configure/app/usage.mdx +64 -1
- package/zh/guides/advanced-features/_category_.json +2 -6
- package/zh/guides/advanced-features/compatibility.mdx +0 -1
- package/zh/guides/advanced-features/ssg.mdx +0 -1
- package/zh/guides/advanced-features/ssr.mdx +2 -2
- package/zh/guides/advanced-features/testing.mdx +0 -1
- package/zh/guides/advanced-features/web-server.mdx +0 -1
- package/zh/guides/basic-features/_category_.json +1 -5
- package/zh/guides/basic-features/alias.mdx +1 -1
- package/zh/guides/basic-features/data-fetch.mdx +35 -26
- package/zh/guides/basic-features/html.mdx +10 -9
- package/zh/guides/basic-features/mock.mdx +20 -0
- package/zh/guides/basic-features/routes.mdx +41 -9
- package/zh/guides/{basic-features → concept}/builder.mdx +2 -2
- package/zh/guides/concept/entries.mdx +11 -11
- package/zh/guides/css/_category_.json +5 -0
- package/zh/guides/{basic-features/css → css}/css-in-js.mdx +0 -0
- package/zh/guides/{basic-features/css → css}/css-modules.mdx +0 -0
- package/zh/guides/{basic-features/css → css}/less-sass.mdx +1 -1
- package/zh/guides/{basic-features/css → css}/postcss.mdx +5 -4
- package/zh/guides/{basic-features/css → css}/tailwindcss.mdx +0 -1
- package/zh/guides/get-started/introduction.mdx +31 -0
- package/zh/guides/get-started/quick-start.mdx +2 -3
- package/zh/guides/get-started/upgrade.mdx +2 -1
- package/zh/guides/topic-detail/_category_.json +2 -2
- package/zh/guides/topic-detail/generator/config/{mwa.mdx → app.mdx} +1 -1
- package/zh/guides/topic-detail/generator/plugin/api/input/addInputBefore.mdx +1 -1
- package/zh/guides/topic-detail/generator/plugin/api/new/createElement.mdx +1 -1
- package/zh/guides/topic-detail/generator/plugin/api/new/enableFunc.mdx +1 -1
- package/zh/guides/topic-detail/generator/plugin/api/new/introduce.mdx +2 -2
- package/zh/guides/topic-detail/generator/plugin/develop.mdx +3 -3
- package/zh/guides/topic-detail/micro-frontend/c02-development.mdx +155 -63
- package/zh/guides/topic-detail/micro-frontend/c03-main-app.mdx +71 -40
- package/zh/guides/topic-detail/model/model-communicate.mdx +1 -1
- package/zh/guides/troubleshooting/_category_.json +2 -2
- package/zh/index.md +1 -1
- package/zh/tutorials/first-app/_category_.json +1 -1
- package/zh/tutorials/first-app/c01-start.mdx +1 -2
- package/zh/tutorials/first-app/c03-css.mdx +1 -2
- package/zh/tutorials/first-app/c06-model.mdx +2 -2
- package/zh/tutorials/first-app/c07-container.mdx +1 -1
- package/zh/tutorials/first-app/c08-entries.mdx +2 -3
- package/zh/tutorials/foundations/introduction.mdx +14 -29
- package/en/apis/app/commands/index.mdx +0 -7
- package/en/apis/app/hooks/index.mdx +0 -7
- package/en/apis/app/runtime/index.mdx +0 -7
- package/en/guides/advanced-features/index.mdx +0 -7
- package/en/guides/basic-features/css/_category_.json +0 -4
- package/zh/apis/app/commands/index.mdx +0 -7
- package/zh/apis/app/hooks/index.mdx +0 -7
- package/zh/apis/app/runtime/index.mdx +0 -7
- package/zh/guides/advanced-features/index.mdx +0 -7
- package/zh/guides/basic-features/css/_category_.json +0 -4
- package/zh/guides/basic-features/index.mdx +0 -7
package/.turbo/turbo-build.log
CHANGED
package/LICENSE
CHANGED
@@ -19,126 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
21
|
SOFTWARE.
|
22
|
-
|
23
|
-
|
24
|
-
The code implementation modified from external library are:
|
25
|
-
|
26
|
-
- vite
|
27
|
-
|
28
|
-
MIT License
|
29
|
-
|
30
|
-
Copyright (c) 2019-present, Yuxi (Evan) You and Vite contributors
|
31
|
-
|
32
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
33
|
-
of this software and associated documentation files (the "Software"), to deal
|
34
|
-
in the Software without restriction, including without limitation the rights
|
35
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
36
|
-
copies of the Software, and to permit persons to whom the Software is
|
37
|
-
furnished to do so, subject to the following conditions:
|
38
|
-
|
39
|
-
The above copyright notice and this permission notice shall be included in all
|
40
|
-
copies or substantial portions of the Software.
|
41
|
-
|
42
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
43
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
44
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
45
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
46
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
47
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
48
|
-
SOFTWARE.
|
49
|
-
|
50
|
-
- wmr
|
51
|
-
|
52
|
-
MIT License
|
53
|
-
|
54
|
-
Copyright (c) 2020 The Preact Authors
|
55
|
-
|
56
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
57
|
-
of this software and associated documentation files (the "Software"), to deal
|
58
|
-
in the Software without restriction, including without limitation the rights
|
59
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
60
|
-
copies of the Software, and to permit persons to whom the Software is
|
61
|
-
furnished to do so, subject to the following conditions:
|
62
|
-
|
63
|
-
The above copyright notice and this permission notice shall be included in all
|
64
|
-
copies or substantial portions of the Software.
|
65
|
-
|
66
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
67
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
68
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
69
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
70
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
71
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
72
|
-
SOFTWARE.
|
73
|
-
|
74
|
-
- bundle-require
|
75
|
-
|
76
|
-
The MIT License (MIT)
|
77
|
-
|
78
|
-
Copyright © 2021 EGOIST (https://github.com/sponsors/egoist)
|
79
|
-
|
80
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
81
|
-
of this software and associated documentation files (the "Software"), to deal
|
82
|
-
in the Software without restriction, including without limitation the rights
|
83
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
84
|
-
copies of the Software, and to permit persons to whom the Software is
|
85
|
-
furnished to do so, subject to the following conditions:
|
86
|
-
|
87
|
-
The above copyright notice and this permission notice shall be included in all
|
88
|
-
copies or substantial portions of the Software.
|
89
|
-
|
90
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
91
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
92
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
93
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
94
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
95
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
96
|
-
SOFTWARE
|
97
|
-
|
98
|
-
- react-dev-utils
|
99
|
-
|
100
|
-
MIT License
|
101
|
-
|
102
|
-
Copyright (c) 2013-present, Facebook, Inc.
|
103
|
-
|
104
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
105
|
-
of this software and associated documentation files (the "Software"), to deal
|
106
|
-
in the Software without restriction, including without limitation the rights
|
107
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
108
|
-
copies of the Software, and to permit persons to whom the Software is
|
109
|
-
furnished to do so, subject to the following conditions:
|
110
|
-
|
111
|
-
The above copyright notice and this permission notice shall be included in all
|
112
|
-
copies or substantial portions of the Software.
|
113
|
-
|
114
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
115
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
116
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
117
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
118
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
119
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
120
|
-
SOFTWARE.
|
121
|
-
|
122
|
-
- jest-cli
|
123
|
-
|
124
|
-
MIT License
|
125
|
-
|
126
|
-
Copyright (c) Facebook, Inc. and its affiliates.
|
127
|
-
|
128
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
129
|
-
of this software and associated documentation files (the "Software"), to deal
|
130
|
-
in the Software without restriction, including without limitation the rights
|
131
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
132
|
-
copies of the Software, and to permit persons to whom the Software is
|
133
|
-
furnished to do so, subject to the following conditions:
|
134
|
-
|
135
|
-
The above copyright notice and this permission notice shall be included in all
|
136
|
-
copies or substantial portions of the Software.
|
137
|
-
|
138
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
139
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
140
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
141
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
142
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
143
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
144
|
-
SOFTWARE.
|
package/README.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
<p align="center">
|
2
|
+
<a href="https://modernjs.dev" target="blank"><img src="https://lf3-static.bytednsdoc.com/obj/eden-cn/ylaelkeh7nuhfnuhf/modernjs-cover.png" width="300" alt="Modern.js Logo" /></a>
|
3
|
+
</p>
|
4
|
+
|
5
|
+
<h1 align="center">Modern.js</h1>
|
6
|
+
|
7
|
+
<p align="center">
|
8
|
+
A Progressive React Framework for modern web development.
|
9
|
+
</p>
|
10
|
+
|
11
|
+
## Getting Started
|
12
|
+
|
13
|
+
Please follow [Quick Start](https://modernjs.dev/en/guides/get-started/quick-start) to get started with Modern.js.
|
14
|
+
|
15
|
+
## Documentation
|
16
|
+
|
17
|
+
- [English Documentation](https://modernjs.dev/en/)
|
18
|
+
- [中文文档](https://modernjs.dev)
|
19
|
+
|
20
|
+
## Contributing
|
21
|
+
|
22
|
+
Please read the [Contributing Guide](https://github.com/modern-js-dev/modern.js/blob/main/CONTRIBUTING.md).
|
23
|
+
|
24
|
+
## License
|
25
|
+
|
26
|
+
Modern.js is [MIT licensed](https://github.com/modern-js-dev/modern.js/blob/main/LICENSE).
|
@@ -26,9 +26,9 @@ In the project, execute the `new` command to add entries as follows:
|
|
26
26
|
|
27
27
|
```bash
|
28
28
|
$ npx modern new
|
29
|
-
?
|
30
|
-
?
|
31
|
-
?
|
29
|
+
? Action Create project element
|
30
|
+
? Create project element New "entry"
|
31
|
+
? Entry name entry
|
32
32
|
```
|
33
33
|
|
34
34
|
### Enable Features
|
@@ -37,13 +37,14 @@ In the project, execute the `new` command to enable features as follows:
|
|
37
37
|
|
38
38
|
```bash
|
39
39
|
$ npx modern new
|
40
|
-
?
|
41
|
-
?
|
42
|
-
❯
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
40
|
+
? Action Enable features
|
41
|
+
? Enable features (Use arrow keys)
|
42
|
+
❯ Enable Tailwind CSS
|
43
|
+
Enable BFF
|
44
|
+
Enable SSG
|
45
|
+
Enable Micro Frontend
|
46
|
+
Enable Unit Test / Integration Test
|
47
|
+
Enable Visual Testing (Storybook)
|
47
48
|
```
|
48
49
|
|
49
50
|
:::caution
|
@@ -40,7 +40,7 @@ Dynamic named routing parameters can be supported by creating folders or files w
|
|
40
40
|
- `api/lambda/user/[username]/delete.ts` -> `$BASENAME/user/:username/delete`
|
41
41
|
- `api/lambda/article/[id]/info.ts` -> `$BASENAME/article/:id/info`
|
42
42
|
|
43
|
-
the `$BASENAME` can be configured in `modern.config.js`,the default value is `/api
|
43
|
+
the `$BASENAME` can be configured in `modern.config.js`,the default value is `/api`.
|
44
44
|
|
45
45
|
### Allow List
|
46
46
|
|
@@ -40,7 +40,7 @@ Dynamic named routing parameters can be supported by creating folders or files w
|
|
40
40
|
- `api/user/[username]/delete.ts` -> `$BASENAME/user/:username/delete`
|
41
41
|
- `api/article/[id]/info.ts` -> `$BASENAME/article/:id/info`
|
42
42
|
|
43
|
-
the `$BASENAME` can be configured in `modern.config.js`,the default value is `/api
|
43
|
+
the `$BASENAME` can be configured in `modern.config.js`,the default value is `/api`.
|
44
44
|
|
45
45
|
### Allow List
|
46
46
|
|
@@ -2,6 +2,7 @@
|
|
2
2
|
title: index.[tj]s
|
3
3
|
sidebar_position: 1
|
4
4
|
---
|
5
|
+
|
5
6
|
# index.[tj]s
|
6
7
|
|
7
8
|
A file that extends the Modern.js Web Server, to add a Hook or Middleware to the Web Server that the project uses.
|
@@ -11,6 +12,6 @@ It can intercept requests and responses, authenticate and role, request preproce
|
|
11
12
|
It can also be inserted logic into the built-in processing handler (including route matching, resource addressing, header injection, page rendering, static web hosting).
|
12
13
|
|
13
14
|
:::info
|
14
|
-
For detail, see [Hook](/apis/app/runtime/web-server/hook) & [Middleware](/apis/app/runtime/web-server/middleware)
|
15
|
+
For detail, see [Hook](/apis/app/runtime/web-server/hook) & [Middleware](/apis/app/runtime/web-server/middleware).
|
15
16
|
|
16
17
|
:::
|
@@ -107,16 +107,16 @@ For example the following directory structure:
|
|
107
107
|
└── index.js
|
108
108
|
```
|
109
109
|
|
110
|
-
- access `/`, the `Component` is `pages/index.js
|
111
|
-
- access `/a`, the `Component` is `pages/a/index.js
|
112
|
-
- access `/a/b`, the `Component` is `pages/a/b/index.js
|
110
|
+
- access `/`, the `Component` is `pages/index.js`.
|
111
|
+
- access `/a`, the `Component` is `pages/a/index.js`.
|
112
|
+
- access `/a/b`, the `Component` is `pages/a/b/index.js`.
|
113
113
|
|
114
114
|
:::tip Advantages
|
115
115
|
|
116
116
|
- preserve the state of the global layout when the page changes.
|
117
117
|
- add global css.
|
118
118
|
- handle ComponentDidCatch error
|
119
|
-
- use
|
119
|
+
- use [defineConfig](/apis/app/runtime/app/define-config) dynamic configuration runtime.
|
120
120
|
|
121
121
|
:::
|
122
122
|
|
@@ -149,8 +149,8 @@ export default ALayout;
|
|
149
149
|
|
150
150
|
The Component props is the specific route, for example
|
151
151
|
|
152
|
-
- access `/a`, the `Component` is `pages/a/index.js
|
153
|
-
- 访问 `/a/b`, the `Component` is `pages/a/b/index.js
|
152
|
+
- access `/a`, the `Component` is `pages/a/index.js`.
|
153
|
+
- 访问 `/a/b`, the `Component` is `pages/a/b/index.js`.
|
154
154
|
|
155
155
|
In this way, you can use `pages/a/_layout.js` to display the routing common layout in the `a` directory.
|
156
156
|
|
@@ -179,4 +179,4 @@ the generated route is configured is as:
|
|
179
179
|
]
|
180
180
|
```
|
181
181
|
|
182
|
-
All unmatched routes will match to `pages/404.[tj]s
|
182
|
+
All unmatched routes will match to `pages/404.[tj]s`.
|
@@ -52,7 +52,7 @@ If the directory name of the route file is named with `[]`, the generated route
|
|
52
52
|
|
53
53
|
The `routes/[id]/page.tsx` file will be converted to a `/:id` route. All `/xxx` will match that route, except for the `/blog` route, which can be matched exactly.
|
54
54
|
|
55
|
-
In the component, you can get the corresponding parameters by [useParams](/apis/app/runtime/router
|
55
|
+
In the component, you can get the corresponding parameters by [useParams](/apis/app/runtime/router/router#useparams).
|
56
56
|
|
57
57
|
In the loader, params will be used as input to [loader](/guides/basic-features/data-fetch#loader-function), and the corresponding parameters can be retrieved through the property `params`.
|
58
58
|
|
@@ -3,7 +3,7 @@ title: bootstrap
|
|
3
3
|
---
|
4
4
|
# bootstrap
|
5
5
|
|
6
|
-
Used to start and mount App, usually without manual calls
|
6
|
+
Used to start and mount App, usually without manual calls. This API is only required when using [Custom App](/guides/concept/entries#自定义-app).
|
7
7
|
|
8
8
|
## Usage
|
9
9
|
|
@@ -3,7 +3,7 @@ title: createApp
|
|
3
3
|
---
|
4
4
|
# createApp
|
5
5
|
|
6
|
-
Used to create custom entries, custom runtime plugins. This API is only required when using [Custom App](/guides/concept/entries
|
6
|
+
Used to create custom entries, custom runtime plugins. This API is only required when using [Custom App](/guides/concept/entries#app).
|
7
7
|
|
8
8
|
## Usage
|
9
9
|
|
@@ -28,7 +28,7 @@ function createApp(options: { plugins: Plugin[] }): React.ComponentType<any>;
|
|
28
28
|
|
29
29
|
### Create Custom Entry
|
30
30
|
|
31
|
-
For details, see [`bootstrap`](./bootstrap.
|
31
|
+
For details, see [`bootstrap`](./bootstrap.mdx).
|
32
32
|
|
33
33
|
### Custom Plugins
|
34
34
|
|
@@ -3,7 +3,7 @@ title: useLoader
|
|
3
3
|
---
|
4
4
|
# useLoader
|
5
5
|
|
6
|
-
Isomorphic API,usually used to make asynchronous requests
|
6
|
+
Isomorphic API,usually used to make asynchronous requests. When SSR, the server level uses `useLoader` to prefetch the data, and the browser side also reuses this part of the data.
|
7
7
|
|
8
8
|
## Usage
|
9
9
|
|
@@ -35,7 +35,7 @@ function useLoader(loaderFn: LoaderFn, options: Options): ReturnData;
|
|
35
35
|
```
|
36
36
|
|
37
37
|
:::info
|
38
|
-
`runtimeContext` can refer to [useRuntimeContext](/apis/app/runtime/core/use-runtime-context)
|
38
|
+
`runtimeContext` can refer to [useRuntimeContext](/apis/app/runtime/core/use-runtime-context).
|
39
39
|
|
40
40
|
:::
|
41
41
|
|
@@ -47,14 +47,14 @@ function useLoader(loaderFn: LoaderFn, options: Options): ReturnData;
|
|
47
47
|
- `onError`: error callback.
|
48
48
|
- `initialData`: the initial data before the first execution,.
|
49
49
|
- `skip`: when the value is `true`, the function does not execute.
|
50
|
-
- `params`: when the result of the `params` serialization changes,the function is re-executed
|
50
|
+
- `params`: when the result of the `params` serialization changes,the function is re-executed. `params` is also passed in as the second argument of the function.
|
51
51
|
- `static`: when the value is `true`, `useLoader` is used for [SSG](/guides/advanced-features/ssg).
|
52
52
|
|
53
53
|
### Return Value
|
54
54
|
|
55
55
|
- `data`: return data on successful execution.
|
56
56
|
- `loading`: indicates whether the function is in execution.
|
57
|
-
- `error`: error message when function execution fails
|
57
|
+
- `error`: error message when function execution fails.
|
58
58
|
- `reload`: the function can be re-executed after the call.
|
59
59
|
- `params`: when the value is `undefined`, the last value will be reused; otherwise, the function will be re-executed with the new value.
|
60
60
|
- `reloading`: during the execution of the call to `reload`, the value of `reloading` is `true`.
|
@@ -46,7 +46,7 @@ defineConfig(App, {
|
|
46
46
|
masterApp: {
|
47
47
|
apps: [
|
48
48
|
{
|
49
|
-
// name
|
49
|
+
// name is case-sensitive, what name provides is what useModuleApps returns
|
50
50
|
name: 'Home',
|
51
51
|
entry: 'http://127.0.0.1:8081/',
|
52
52
|
},
|
@@ -63,7 +63,7 @@ Get the `Home` and `Contact` sub-application components(the same as name in the
|
|
63
63
|
|
64
64
|
### Centralized Routing
|
65
65
|
|
66
|
-
**Centralized Routing** is a way to centrally configure the activation routes of sub-applications. Add `activeWhen` config to enable **Centralized Routing
|
66
|
+
**Centralized Routing** is a way to centrally configure the activation routes of sub-applications. Add `activeWhen` config to enable **Centralized Routing**.
|
67
67
|
|
68
68
|
import MicroRuntimeConfig from "@site-docs-en/components/micro-runtime-config";
|
69
69
|
|
@@ -21,8 +21,8 @@ interface ProviderProps {
|
|
21
21
|
|
22
22
|
### Input
|
23
23
|
|
24
|
-
- store: the Store object created by [`createStore`](./create-store.
|
25
|
-
- config: this config to create Reduck Store, same as `config` param in [`createApp`](./create-app.
|
24
|
+
- store: the Store object created by [`createStore`](./create-store.mdx).
|
25
|
+
- config: this config to create Reduck Store, same as `config` param in [`createApp`](./create-app.mdx).
|
26
26
|
|
27
27
|
## Example
|
28
28
|
|
@@ -19,7 +19,7 @@ can use [`runtime.state.autoActions`](/configure/app/runtime/state#autoactions)
|
|
19
19
|
|
20
20
|
### Basic Data Type
|
21
21
|
|
22
|
-
State type in `string`、`number`、`boolean`、`null`,generate `setState` Action
|
22
|
+
State type in `string`、`number`、`boolean`、`null`,generate `setState` Action.
|
23
23
|
|
24
24
|
```tsx title="example"
|
25
25
|
const fooModel = model('foo').define({
|
@@ -93,7 +93,7 @@ function App() {
|
|
93
93
|
|
94
94
|
### PlainObject
|
95
95
|
|
96
|
-
State type is PlainObject,base on the names contained in State,generate `set${key}`(Camel-Case) Actions
|
96
|
+
State type is PlainObject,base on the names contained in State,generate `set${key}`(Camel-Case) Actions.
|
97
97
|
|
98
98
|
```tsx title="example"
|
99
99
|
const fooModel = model('foo').define({
|
@@ -9,7 +9,7 @@ import ReduckTip from "@site-docs-en/components/reduck-tip"
|
|
9
9
|
<ReduckTip />
|
10
10
|
|
11
11
|
:::tip
|
12
|
-
The original type of Reduck is complex. The following type definition shows the simplified type information. For the original type, see [**connect**](https://github.com/modern-js-dev/reduck/blob/main/packages/react/src/connect.ts)
|
12
|
+
The original type of Reduck is complex. The following type definition shows the simplified type information. For the original type, see [**connect**](https://github.com/modern-js-dev/reduck/blob/main/packages/react/src/connect.ts).
|
13
13
|
|
14
14
|
:::
|
15
15
|
|
@@ -82,11 +82,11 @@ const modelB = model('modelB').define({
|
|
82
82
|
});
|
83
83
|
|
84
84
|
function Test(props) {
|
85
|
-
props.incA(); // call modelA
|
86
|
-
props.incB(); // call modelB
|
85
|
+
props.incA(); // call modelA's action
|
86
|
+
props.incB(); // call modelB's action
|
87
87
|
|
88
|
-
props.a; // get modelA
|
89
|
-
props.b; // get modelB
|
88
|
+
props.a; // get modelA's state: a
|
89
|
+
props.b; // get modelB's state: b
|
90
90
|
}
|
91
91
|
|
92
92
|
export default connect([modelA, modelB])(Test);
|
@@ -8,7 +8,7 @@ import ReduckTip from "@site-docs-en/components/reduck-tip"
|
|
8
8
|
|
9
9
|
<ReduckTip />
|
10
10
|
|
11
|
-
Reduck will call `createApp` to create a global application by default. If the entire application only needs one Store, then there is no need to call `createApp` manually
|
11
|
+
Reduck will call `createApp` to create a global application by default. If the entire application only needs one Store, then there is no need to call `createApp` manually.Only need to use `createApp` when you need to create a Store locally in the app.
|
12
12
|
|
13
13
|
:::caution
|
14
14
|
Note that the exported `createApp` in `@modern-js/runtime/model` is used to manage state, while the exported `createApp` in `@modern-js/runtime` is used to create the entire application. The two are differently.
|
@@ -29,19 +29,19 @@ function createApp(config: AppConfig): object;
|
|
29
29
|
### Input
|
30
30
|
|
31
31
|
- `config`
|
32
|
-
- `StoreConfig`: the same as [`createStore`](./create-store.
|
33
|
-
- `devTools`: the default value is `true`. when it is an object type,configuring [Options](https://github.com/reduxjs/redux-devtools/blob/main/extension/docs/API/Arguments.md) of Redux DevTools
|
34
|
-
- `autoActions`: the default value is `true
|
32
|
+
- `StoreConfig`: the same as [`createStore`](./create-store.mdx) params.
|
33
|
+
- `devTools`: the default value is `true`. when it is an object type,configuring [Options](https://github.com/reduxjs/redux-devtools/blob/main/extension/docs/API/Arguments.md) of Redux DevTools.
|
34
|
+
- `autoActions`: the default value is `true`.if [auto generate Actions](./auto-actions.mdx).
|
35
35
|
|
36
36
|
### Return Value
|
37
37
|
|
38
38
|
Reduck App, consists of the following properties:
|
39
39
|
|
40
|
-
- `Provider`: inject shared Store into locally component tree, same as [`Provider`](./Provider.
|
41
|
-
- `useModel`: get the Model mounted by the app's local Store, same as [`useModel`](./use-model.
|
42
|
-
- `useStaticModel`: get the Model mounted by the app's local Store. same as [`useStaticModel`](./use-static-model.
|
43
|
-
- `useLocalModel`: get the Model mounted by the app's local Store. same as [`useLocalModel`](./use-local-model.
|
44
|
-
- `useStore`: get the Store used locally by the app. same as [`useStore`](./use-store.
|
40
|
+
- `Provider`: inject shared Store into locally component tree, same as [`Provider`](./Provider.mdx).
|
41
|
+
- `useModel`: get the Model mounted by the app's local Store, same as [`useModel`](./use-model.mdx).
|
42
|
+
- `useStaticModel`: get the Model mounted by the app's local Store. same as [`useStaticModel`](./use-static-model.mdx).
|
43
|
+
- `useLocalModel`: get the Model mounted by the app's local Store. same as [`useLocalModel`](./use-local-model.mdx).
|
44
|
+
- `useStore`: get the Store used locally by the app. same as [`useStore`](./use-store.mdx).
|
45
45
|
|
46
46
|
## Example
|
47
47
|
|
@@ -10,7 +10,7 @@ import ReduckTip from "@site-docs-en/components/reduck-tip"
|
|
10
10
|
|
11
11
|
`createStore` is used to create a Store. Reduck’s Store based on Redux's [Store](https://redux.js.org/api/store) implementatio. Used to store the state of the application and managing the state and Model.
|
12
12
|
|
13
|
-
In general, this API is only used when you need to have full control over the creation of the Store. For example, to customize a Store, pass in the ['Provider'](./Provider.
|
13
|
+
In general, this API is only used when you need to have full control over the creation of the Store. For example, to customize a Store, pass in the ['Provider'](./Provider.mdx) component to use.
|
14
14
|
|
15
15
|
## Function Signature
|
16
16
|
|
@@ -38,13 +38,13 @@ function createStore(config?: StoreConfig): ReduckStore;
|
|
38
38
|
- `models`: set the Model to mount to the Store in advance(No need for normal use).
|
39
39
|
- `middlewares`: set Redux [middleware](https://redux.js.org/understanding/thinking-in-redux/glossary#middleware).
|
40
40
|
- `enhancers`: set Redux [Store enhancer](https://redux.js.org/understanding/thinking-in-redux/glossary#store-enhancer).
|
41
|
-
- `plugins`: set Reduck plugin
|
41
|
+
- `plugins`: set Reduck plugin.***experimental API, not recommended***.
|
42
42
|
|
43
43
|
### Return Value
|
44
44
|
|
45
45
|
Reduck Store:
|
46
46
|
|
47
|
-
- `use`: mount and fetch Model objects dynamically. Usage is the same as ['useModel'](./use-model.
|
47
|
+
- `use`: mount and fetch Model objects dynamically. Usage is the same as ['useModel'](./use-model.mdx), but can be used outside of React components.
|
48
48
|
- `unmount`: unmount the Model object, and the Model State is cleared from the Store.
|
49
49
|
- `ReduxStore`: [Redux Store API](https://redux.js.org/tutorials/fundamentals/part-4-store#redux-store).
|
50
50
|
|
@@ -59,7 +59,7 @@ interface State {
|
|
59
59
|
|
60
60
|
```ts
|
61
61
|
interface State {
|
62
|
-
items: any; //
|
62
|
+
items: any; // Default result -> items
|
63
63
|
pending: boolean;
|
64
64
|
error: string;
|
65
65
|
}
|
@@ -78,7 +78,7 @@ interface State {
|
|
78
78
|
|
79
79
|
- `error`: the default value is `"error"`. Change the name of the `error` field in the returned State. Usage is the same as `result`.
|
80
80
|
|
81
|
-
- `combineMode`: the default value is `"merge"
|
81
|
+
- `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):
|
82
82
|
|
83
83
|
- `"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}`.
|
84
84
|
- `"replace"`: the current data directly replaces the previous data.
|
@@ -9,7 +9,7 @@ import ReduckTip from "@site-docs-en/components/reduck-tip"
|
|
9
9
|
<ReduckTip />
|
10
10
|
|
11
11
|
:::tip
|
12
|
-
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
|
+
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).
|
13
13
|
|
14
14
|
:::
|
15
15
|
|
@@ -8,7 +8,7 @@ import ReduckTip from "@site-docs-en/components/reduck-tip"
|
|
8
8
|
|
9
9
|
<ReduckTip />
|
10
10
|
|
11
|
-
To use the State in the Model as a local state, the effect is similar to React's `useState`. `useLocalModel` API same as `useModel`. For detail, see [`useModel`](./use-model.
|
11
|
+
To use the State in the Model as a local state, the effect is similar to React's `useState`. `useLocalModel` API same as `useModel`. For detail, see [`useModel`](./use-model.mdx).
|
12
12
|
|
13
13
|
## Example
|
14
14
|
|
@@ -9,7 +9,7 @@ import ReduckTip from "@site-docs-en/components/reduck-tip"
|
|
9
9
|
<ReduckTip />
|
10
10
|
|
11
11
|
:::tip
|
12
|
-
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
|
+
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).
|
13
13
|
|
14
14
|
:::
|
15
15
|
|
@@ -8,18 +8,18 @@ import ReduckTip from "@site-docs-en/components/reduck-tip"
|
|
8
8
|
|
9
9
|
<ReduckTip />
|
10
10
|
|
11
|
-
If want to consume a Model in the form of React Hook in the component,and can get the current latest state at any time,but you don't want the Model state to be updated, which will cause the component to be re-rendered, we can use `useStaticModel
|
11
|
+
If want to consume a Model in the form of React Hook in the component,and can get the current latest state at any time,but you don't want the Model state to be updated, which will cause the component to be re-rendered, we can use `useStaticModel`.
|
12
12
|
|
13
|
-
`useStaticModel` API is same as `useModel
|
13
|
+
`useStaticModel` API is same as `useModel`.For detail, see [`useModel`](./use-model.mdx).
|
14
14
|
|
15
15
|
To ensure that the latest state is always available, be careful not to deconstruct the returned `state`.
|
16
16
|
|
17
17
|
```tsx
|
18
18
|
function App() {
|
19
|
-
// ❌ Do not deconstruct state,but can deconstruct actions
|
19
|
+
// ❌ Do not deconstruct state,but can deconstruct actions.
|
20
20
|
const [{ username }, { logout }] = useStaticModel(userModel);
|
21
21
|
|
22
|
-
// ✅ True Usage
|
22
|
+
// ✅ True Usage.
|
23
23
|
const [state, { logout }] = useStaticModel(userModel);
|
24
24
|
|
25
25
|
useEffect(() => {
|
@@ -18,7 +18,7 @@ function useStore(): ReduckStore;
|
|
18
18
|
|
19
19
|
### Return Type
|
20
20
|
|
21
|
-
- ReduckStore: Reduck Store,type refer to the return type of [createStore](./create-store.
|
21
|
+
- ReduckStore: Reduck Store,type refer to the return type of [createStore](./create-store.mdx).
|
22
22
|
|
23
23
|
:::info More
|
24
24
|
[Use Model](/guides/topic-detail/model/use-model).
|
@@ -29,7 +29,7 @@ interface NavigateFunction {
|
|
29
29
|
}
|
30
30
|
```
|
31
31
|
|
32
|
-
The `useNavigate` hook returns a function that lets you navigate programmatically
|
32
|
+
The `useNavigate` hook returns a function that lets you navigate programmatically.
|
33
33
|
|
34
34
|
```tsx
|
35
35
|
import { useNavigate } from '@modern-js/runtime/router';
|