@modern-js/module-tools-docs 2.2.0 → 2.2.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +144 -0
- package/doc_build/html/main/index.html +16 -0
- package/doc_build/route.json +10 -0
- package/doc_build/static/css/main.css +2977 -0
- package/doc_build/static/css/main.css.map +1 -0
- package/doc_build/static/css/vendors-node_modules_pnpm_remix-run_router_1_2_0_node_modules_remix-run_router_dist_router_js-9d5e9c.css +68 -0
- package/doc_build/static/css/vendors-node_modules_pnpm_remix-run_router_1_2_0_node_modules_remix-run_router_dist_router_js-9d5e9c.css.map +1 -0
- package/doc_build/static/js/async/en_api_config_build-config.js +8406 -0
- package/doc_build/static/js/async/en_api_config_build-config.js.map +1 -0
- package/doc_build/static/js/async/en_api_config_build-preset.js +7865 -0
- package/doc_build/static/js/async/en_api_config_build-preset.js.map +1 -0
- package/doc_build/static/js/async/en_api_config_design-system.js +47805 -0
- package/doc_build/static/js/async/en_api_config_design-system.js.map +1 -0
- package/doc_build/static/js/async/en_api_config_plugins.js +1488 -0
- package/doc_build/static/js/async/en_api_config_plugins.js.map +1 -0
- package/doc_build/static/js/async/en_api_config_testing.js +2139 -0
- package/doc_build/static/js/async/en_api_config_testing.js.map +1 -0
- package/doc_build/static/js/async/en_api_index.js +51 -0
- package/doc_build/static/js/async/en_api_index.js.map +1 -0
- package/doc_build/static/js/async/en_api_plugin-api_plugin-hooks.js +14360 -0
- package/doc_build/static/js/async/en_api_plugin-api_plugin-hooks.js.map +1 -0
- package/doc_build/static/js/async/en_guide_advance_asset.js +3972 -0
- package/doc_build/static/js/async/en_guide_advance_asset.js.map +1 -0
- package/doc_build/static/js/async/en_guide_advance_build-umd.js +9857 -0
- package/doc_build/static/js/async/en_guide_advance_build-umd.js.map +1 -0
- package/doc_build/static/js/async/en_guide_advance_copy.js +6541 -0
- package/doc_build/static/js/async/en_guide_advance_copy.js.map +1 -0
- package/doc_build/static/js/async/en_guide_advance_external-dependency.js +3806 -0
- package/doc_build/static/js/async/en_guide_advance_external-dependency.js.map +1 -0
- package/doc_build/static/js/async/en_guide_advance_in-depth-about-build.js +5304 -0
- package/doc_build/static/js/async/en_guide_advance_in-depth-about-build.js.map +1 -0
- package/doc_build/static/js/async/en_guide_advance_in-depth-about-dev-command.js +2526 -0
- package/doc_build/static/js/async/en_guide_advance_in-depth-about-dev-command.js.map +1 -0
- package/doc_build/static/js/async/en_guide_advance_theme-config.js +2486 -0
- package/doc_build/static/js/async/en_guide_advance_theme-config.js.map +1 -0
- package/doc_build/static/js/async/en_guide_basic_before-getting-started.js +3720 -0
- package/doc_build/static/js/async/en_guide_basic_before-getting-started.js.map +1 -0
- package/doc_build/static/js/async/en_guide_basic_command-preview.js +3973 -0
- package/doc_build/static/js/async/en_guide_basic_command-preview.js.map +1 -0
- package/doc_build/static/js/async/en_guide_basic_modify-output-product.js +3137 -0
- package/doc_build/static/js/async/en_guide_basic_modify-output-product.js.map +1 -0
- package/doc_build/static/js/async/en_guide_basic_publish-your-project.js +2180 -0
- package/doc_build/static/js/async/en_guide_basic_publish-your-project.js.map +1 -0
- package/doc_build/static/js/async/en_guide_basic_test-your-project.js +3887 -0
- package/doc_build/static/js/async/en_guide_basic_test-your-project.js.map +1 -0
- package/doc_build/static/js/async/en_guide_basic_use-micro-generator.js +2973 -0
- package/doc_build/static/js/async/en_guide_basic_use-micro-generator.js.map +1 -0
- package/doc_build/static/js/async/en_guide_basic_using-storybook.js +4723 -0
- package/doc_build/static/js/async/en_guide_basic_using-storybook.js.map +1 -0
- package/doc_build/static/js/async/en_guide_best-practices_components.js +21400 -0
- package/doc_build/static/js/async/en_guide_best-practices_components.js.map +1 -0
- package/doc_build/static/js/async/en_guide_intro_getting-started.js +2149 -0
- package/doc_build/static/js/async/en_guide_intro_getting-started.js.map +1 -0
- package/doc_build/static/js/async/en_guide_intro_welcome.js +162 -0
- package/doc_build/static/js/async/en_guide_intro_welcome.js.map +1 -0
- package/doc_build/static/js/async/en_guide_intro_why-module-engineering-solution.js +96 -0
- package/doc_build/static/js/async/en_guide_intro_why-module-engineering-solution.js.map +1 -0
- package/doc_build/static/js/async/en_index.js +81 -0
- package/doc_build/static/js/async/en_index.js.map +1 -0
- package/doc_build/static/js/async/en_plugins_guide_getting-started.js +2556 -0
- package/doc_build/static/js/async/en_plugins_guide_getting-started.js.map +1 -0
- package/doc_build/static/js/async/en_plugins_guide_plugin-object.js +4173 -0
- package/doc_build/static/js/async/en_plugins_guide_plugin-object.js.map +1 -0
- package/doc_build/static/js/async/en_plugins_guide_setup-function.js +3815 -0
- package/doc_build/static/js/async/en_plugins_guide_setup-function.js.map +1 -0
- package/doc_build/static/js/async/en_plugins_official-list_overview.js +66 -0
- package/doc_build/static/js/async/en_plugins_official-list_overview.js.map +1 -0
- package/doc_build/static/js/async/packages_cli_doc-core_src_theme-default_components_Search_logic_search_ts.js +246 -0
- package/doc_build/static/js/async/packages_cli_doc-core_src_theme-default_components_Search_logic_search_ts.js.map +1 -0
- package/doc_build/static/js/async/vendors-node_modules_pnpm_code-hike_mdx_0_7_4_react_18_2_0_node_modules_code-hike_mdx_dist_co-06dd41.js +6656 -0
- package/doc_build/static/js/async/vendors-node_modules_pnpm_code-hike_mdx_0_7_4_react_18_2_0_node_modules_code-hike_mdx_dist_co-06dd41.js.map +1 -0
- package/doc_build/static/js/async/vendors-node_modules_pnpm_flexsearch_0_6_32_node_modules_flexsearch_dist_flexsearch_min_js.js +54 -0
- package/doc_build/static/js/async/vendors-node_modules_pnpm_flexsearch_0_6_32_node_modules_flexsearch_dist_flexsearch_min_js.js.map +1 -0
- package/doc_build/static/js/async/zh_api_config_build-config.js +11354 -0
- package/doc_build/static/js/async/zh_api_config_build-config.js.map +1 -0
- package/doc_build/static/js/async/zh_api_config_build-preset.js +7867 -0
- package/doc_build/static/js/async/zh_api_config_build-preset.js.map +1 -0
- package/doc_build/static/js/async/zh_api_config_design-system.js +48712 -0
- package/doc_build/static/js/async/zh_api_config_design-system.js.map +1 -0
- package/doc_build/static/js/async/zh_api_config_plugins.js +1488 -0
- package/doc_build/static/js/async/zh_api_config_plugins.js.map +1 -0
- package/doc_build/static/js/async/zh_api_config_testing.js +2132 -0
- package/doc_build/static/js/async/zh_api_config_testing.js.map +1 -0
- package/doc_build/static/js/async/zh_api_index.js +52 -0
- package/doc_build/static/js/async/zh_api_index.js.map +1 -0
- package/doc_build/static/js/async/zh_api_plugin-api_plugin-hooks.js +14392 -0
- package/doc_build/static/js/async/zh_api_plugin-api_plugin-hooks.js.map +1 -0
- package/doc_build/static/js/async/zh_guide_advance_asset.js +3972 -0
- package/doc_build/static/js/async/zh_guide_advance_asset.js.map +1 -0
- package/doc_build/static/js/async/zh_guide_advance_build-umd.js +9859 -0
- package/doc_build/static/js/async/zh_guide_advance_build-umd.js.map +1 -0
- package/doc_build/static/js/async/zh_guide_advance_copy.js +6541 -0
- package/doc_build/static/js/async/zh_guide_advance_copy.js.map +1 -0
- package/doc_build/static/js/async/zh_guide_advance_external-dependency.js +3808 -0
- package/doc_build/static/js/async/zh_guide_advance_external-dependency.js.map +1 -0
- package/doc_build/static/js/async/zh_guide_advance_in-depth-about-build.js +5304 -0
- package/doc_build/static/js/async/zh_guide_advance_in-depth-about-build.js.map +1 -0
- package/doc_build/static/js/async/zh_guide_advance_in-depth-about-dev-command.js +2526 -0
- package/doc_build/static/js/async/zh_guide_advance_in-depth-about-dev-command.js.map +1 -0
- package/doc_build/static/js/async/zh_guide_advance_theme-config.js +2477 -0
- package/doc_build/static/js/async/zh_guide_advance_theme-config.js.map +1 -0
- package/doc_build/static/js/async/zh_guide_basic_before-getting-started.js +3711 -0
- package/doc_build/static/js/async/zh_guide_basic_before-getting-started.js.map +1 -0
- package/doc_build/static/js/async/zh_guide_basic_command-preview.js +3805 -0
- package/doc_build/static/js/async/zh_guide_basic_command-preview.js.map +1 -0
- package/doc_build/static/js/async/zh_guide_basic_modify-output-product.js +3142 -0
- package/doc_build/static/js/async/zh_guide_basic_modify-output-product.js.map +1 -0
- package/doc_build/static/js/async/zh_guide_basic_publish-your-project.js +2241 -0
- package/doc_build/static/js/async/zh_guide_basic_publish-your-project.js.map +1 -0
- package/doc_build/static/js/async/zh_guide_basic_test-your-project.js +4286 -0
- package/doc_build/static/js/async/zh_guide_basic_test-your-project.js.map +1 -0
- package/doc_build/static/js/async/zh_guide_basic_use-micro-generator.js +2979 -0
- package/doc_build/static/js/async/zh_guide_basic_use-micro-generator.js.map +1 -0
- package/doc_build/static/js/async/zh_guide_basic_using-storybook.js +4760 -0
- package/doc_build/static/js/async/zh_guide_basic_using-storybook.js.map +1 -0
- package/doc_build/static/js/async/zh_guide_best-practices_components.js +21100 -0
- package/doc_build/static/js/async/zh_guide_best-practices_components.js.map +1 -0
- package/doc_build/static/js/async/zh_guide_intro_getting-started.js +2031 -0
- package/doc_build/static/js/async/zh_guide_intro_getting-started.js.map +1 -0
- package/doc_build/static/js/async/zh_guide_intro_welcome.js +162 -0
- package/doc_build/static/js/async/zh_guide_intro_welcome.js.map +1 -0
- package/doc_build/static/js/async/zh_guide_intro_why-module-engineering-solution.js +96 -0
- package/doc_build/static/js/async/zh_guide_intro_why-module-engineering-solution.js.map +1 -0
- package/doc_build/static/js/async/zh_index.js +81 -0
- package/doc_build/static/js/async/zh_index.js.map +1 -0
- package/doc_build/static/js/async/zh_plugins_guide_getting-started.js +2604 -0
- package/doc_build/static/js/async/zh_plugins_guide_getting-started.js.map +1 -0
- package/doc_build/static/js/async/zh_plugins_guide_plugin-object.js +4169 -0
- package/doc_build/static/js/async/zh_plugins_guide_plugin-object.js.map +1 -0
- package/doc_build/static/js/async/zh_plugins_guide_setup-function.js +3815 -0
- package/doc_build/static/js/async/zh_plugins_guide_setup-function.js.map +1 -0
- package/doc_build/static/js/async/zh_plugins_official-list_overview.js +66 -0
- package/doc_build/static/js/async/zh_plugins_official-list_overview.js.map +1 -0
- package/doc_build/static/js/builder-runtime.js +1375 -0
- package/doc_build/static/js/builder-runtime.js.map +1 -0
- package/doc_build/static/js/lib-lodash.js +4907 -0
- package/doc_build/static/js/lib-lodash.js.map +1 -0
- package/doc_build/static/js/lib-polyfill.js +11847 -0
- package/doc_build/static/js/lib-polyfill.js.map +1 -0
- package/doc_build/static/js/lib-react.js +39510 -0
- package/doc_build/static/js/lib-react.js.map +1 -0
- package/doc_build/static/js/main.js +8610 -0
- package/doc_build/static/js/main.js.map +1 -0
- package/doc_build/static/js/vendors-node_modules_pnpm_remix-run_router_1_2_0_node_modules_remix-run_router_dist_router_js-9d5e9c.js +7328 -0
- package/doc_build/static/js/vendors-node_modules_pnpm_remix-run_router_1_2_0_node_modules_remix-run_router_dist_router_js-9d5e9c.js.map +1 -0
- package/doc_build/static/search_index.json +1 -1
- package/docs/en/guide/advance/in-depth-about-dev-command.md +65 -12
- package/docs/en/guide/basic/before-getting-started.md +4 -14
- package/docs/en/guide/basic/command-preview.md +1 -1
- package/docs/en/guide/basic/modify-output-product.md +6 -2
- package/docs/en/guide/basic/use-micro-generator.md +62 -1
- package/docs/en/guide/basic/using-storybook.mdx +4 -4
- package/docs/en/guide/intro/getting-started.md +16 -7
- package/docs/zh/guide/advance/in-depth-about-dev-command.md +60 -13
- package/docs/zh/guide/basic/before-getting-started.md +4 -14
- package/docs/zh/guide/basic/command-preview.md +2 -2
- package/docs/zh/guide/basic/modify-output-product.md +5 -3
- package/docs/zh/guide/basic/publish-your-project.md +4 -4
- package/docs/zh/guide/basic/test-your-project.mdx +18 -5
- package/docs/zh/guide/basic/use-micro-generator.md +61 -1
- package/docs/zh/guide/basic/using-storybook.mdx +13 -10
- package/docs/zh/guide/intro/getting-started.md +17 -11
- package/package.json +3 -3
- package/doc_build/api/config/build-config.html +0 -332
- package/doc_build/api/config/build-preset.html +0 -43
- package/doc_build/api/config/design-system.html +0 -103
- package/doc_build/api/config/plugins.html +0 -7
- package/doc_build/api/config/testing.html +0 -21
- package/doc_build/api/index.html +0 -1
- package/doc_build/api/plugin-api/plugin-hooks.html +0 -113
- package/doc_build/en/api/config/build-config.html +0 -316
- package/doc_build/en/api/config/build-preset.html +0 -43
- package/doc_build/en/api/config/design-system.html +0 -117
- package/doc_build/en/api/config/plugins.html +0 -7
- package/doc_build/en/api/config/testing.html +0 -21
- package/doc_build/en/api/index.html +0 -1
- package/doc_build/en/api/plugin-api/plugin-hooks.html +0 -113
- package/doc_build/en/guide/advance/asset.html +0 -25
- package/doc_build/en/guide/advance/build-umd.html +0 -32
- package/doc_build/en/guide/advance/copy.html +0 -42
- package/doc_build/en/guide/advance/external-dependency.html +0 -31
- package/doc_build/en/guide/advance/in-depth-about-build.html +0 -112
- package/doc_build/en/guide/advance/in-depth-about-dev-command.html +0 -12
- package/doc_build/en/guide/advance/theme-config.html +0 -29
- package/doc_build/en/guide/basic/before-getting-started.html +0 -89
- package/doc_build/en/guide/basic/command-preview.html +0 -63
- package/doc_build/en/guide/basic/modify-output-product.html +0 -98
- package/doc_build/en/guide/basic/publish-your-project.html +0 -50
- package/doc_build/en/guide/basic/test-your-project.html +0 -31
- package/doc_build/en/guide/basic/use-micro-generator.html +0 -29
- package/doc_build/en/guide/basic/using-storybook.html +0 -66
- package/doc_build/en/guide/best-practices/components.html +0 -111
- package/doc_build/en/guide/intro/getting-started.html +0 -36
- package/doc_build/en/guide/intro/welcome.html +0 -13
- package/doc_build/en/guide/intro/why-module-engineering-solution.html +0 -9
- package/doc_build/en/index.html +0 -1
- package/doc_build/en/plugins/guide/getting-started.html +0 -15
- package/doc_build/en/plugins/guide/plugin-object.html +0 -14
- package/doc_build/en/plugins/guide/setup-function.html +0 -30
- package/doc_build/en/plugins/official-list/overview.html +0 -3
- package/doc_build/guide/advance/asset.html +0 -25
- package/doc_build/guide/advance/build-umd.html +0 -32
- package/doc_build/guide/advance/copy.html +0 -42
- package/doc_build/guide/advance/external-dependency.html +0 -31
- package/doc_build/guide/advance/in-depth-about-build.html +0 -112
- package/doc_build/guide/advance/in-depth-about-dev-command.html +0 -14
- package/doc_build/guide/advance/theme-config.html +0 -28
- package/doc_build/guide/basic/before-getting-started.html +0 -89
- package/doc_build/guide/basic/command-preview.html +0 -63
- package/doc_build/guide/basic/modify-output-product.html +0 -97
- package/doc_build/guide/basic/publish-your-project.html +0 -52
- package/doc_build/guide/basic/test-your-project.html +0 -32
- package/doc_build/guide/basic/use-micro-generator.html +0 -27
- package/doc_build/guide/basic/using-storybook.html +0 -67
- package/doc_build/guide/best-practices/components.html +0 -111
- package/doc_build/guide/intro/getting-started.html +0 -39
- package/doc_build/guide/intro/welcome.html +0 -13
- package/doc_build/guide/intro/why-module-engineering-solution.html +0 -9
- package/doc_build/index.html +0 -1
- package/doc_build/plugins/guide/getting-started.html +0 -15
- package/doc_build/plugins/guide/plugin-object.html +0 -14
- package/doc_build/plugins/guide/setup-function.html +0 -30
- package/doc_build/plugins/official-list/overview.html +0 -3
- package/doc_build/static/css/main.edaad072.css +0 -1
- package/doc_build/static/js/1607.70af642a.js +0 -2
- package/doc_build/static/js/1607.70af642a.js.LICENSE.txt +0 -23
- package/doc_build/static/js/async/3799.e31e8293.js +0 -1
- package/doc_build/static/js/async/8652.6fbf1cb7.js +0 -1
- package/doc_build/static/js/async/en_api_config_build-config.367a5701.js +0 -1
- package/doc_build/static/js/async/en_api_config_build-preset.0d78b268.js +0 -1
- package/doc_build/static/js/async/en_api_config_design-system.b28d6723.js +0 -1
- package/doc_build/static/js/async/en_api_config_plugins.fc95fb77.js +0 -1
- package/doc_build/static/js/async/en_api_config_testing.8bc7f316.js +0 -1
- package/doc_build/static/js/async/en_api_index.669f0a56.js +0 -1
- package/doc_build/static/js/async/en_api_plugin-api_plugin-hooks.60d0260c.js +0 -1
- package/doc_build/static/js/async/en_guide_advance_asset.5ff1d623.js +0 -1
- package/doc_build/static/js/async/en_guide_advance_build-umd.c254ed46.js +0 -1
- package/doc_build/static/js/async/en_guide_advance_copy.45c0a51d.js +0 -1
- package/doc_build/static/js/async/en_guide_advance_external-dependency.a52d3247.js +0 -1
- package/doc_build/static/js/async/en_guide_advance_in-depth-about-build.51bf3569.js +0 -1
- package/doc_build/static/js/async/en_guide_advance_in-depth-about-dev-command.aec0b4e1.js +0 -1
- package/doc_build/static/js/async/en_guide_advance_theme-config.db0ad9fc.js +0 -1
- package/doc_build/static/js/async/en_guide_basic_before-getting-started.a22fc49a.js +0 -1
- package/doc_build/static/js/async/en_guide_basic_command-preview.1707ed29.js +0 -1
- package/doc_build/static/js/async/en_guide_basic_modify-output-product.ad453d13.js +0 -1
- package/doc_build/static/js/async/en_guide_basic_publish-your-project.08c5112f.js +0 -1
- package/doc_build/static/js/async/en_guide_basic_test-your-project.f5f6b204.js +0 -1
- package/doc_build/static/js/async/en_guide_basic_use-micro-generator.56325139.js +0 -1
- package/doc_build/static/js/async/en_guide_basic_using-storybook.9d721554.js +0 -1
- package/doc_build/static/js/async/en_guide_best-practices_components.45155af9.js +0 -1
- package/doc_build/static/js/async/en_guide_intro_getting-started.f8682be3.js +0 -1
- package/doc_build/static/js/async/en_guide_intro_welcome.9cc45924.js +0 -1
- package/doc_build/static/js/async/en_guide_intro_why-module-engineering-solution.7f2dae5c.js +0 -1
- package/doc_build/static/js/async/en_index.7bd869c4.js +0 -1
- package/doc_build/static/js/async/en_plugins_guide_getting-started.b850249c.js +0 -1
- package/doc_build/static/js/async/en_plugins_guide_plugin-object.bf6c6221.js +0 -1
- package/doc_build/static/js/async/en_plugins_guide_setup-function.80a2bd97.js +0 -1
- package/doc_build/static/js/async/en_plugins_official-list_overview.84e5cea0.js +0 -1
- package/doc_build/static/js/async/zh_api_config_build-config.048fd5ec.js +0 -1
- package/doc_build/static/js/async/zh_api_config_build-preset.7c13584d.js +0 -1
- package/doc_build/static/js/async/zh_api_config_design-system.1eecd474.js +0 -1
- package/doc_build/static/js/async/zh_api_config_plugins.c22dc4be.js +0 -1
- package/doc_build/static/js/async/zh_api_config_testing.a9888eed.js +0 -1
- package/doc_build/static/js/async/zh_api_index.22957707.js +0 -1
- package/doc_build/static/js/async/zh_api_plugin-api_plugin-hooks.a4d81bf6.js +0 -1
- package/doc_build/static/js/async/zh_guide_advance_asset.5b936003.js +0 -1
- package/doc_build/static/js/async/zh_guide_advance_build-umd.b6d541ff.js +0 -1
- package/doc_build/static/js/async/zh_guide_advance_copy.21a1aea4.js +0 -1
- package/doc_build/static/js/async/zh_guide_advance_external-dependency.c7cf5d4b.js +0 -1
- package/doc_build/static/js/async/zh_guide_advance_in-depth-about-build.64e795f3.js +0 -1
- package/doc_build/static/js/async/zh_guide_advance_in-depth-about-dev-command.168ce7dd.js +0 -1
- package/doc_build/static/js/async/zh_guide_advance_theme-config.b9570109.js +0 -1
- package/doc_build/static/js/async/zh_guide_basic_before-getting-started.6b06b54a.js +0 -1
- package/doc_build/static/js/async/zh_guide_basic_command-preview.1199124a.js +0 -1
- package/doc_build/static/js/async/zh_guide_basic_modify-output-product.8ccbc8d1.js +0 -1
- package/doc_build/static/js/async/zh_guide_basic_publish-your-project.bf11b1c4.js +0 -1
- package/doc_build/static/js/async/zh_guide_basic_test-your-project.ae52c47a.js +0 -1
- package/doc_build/static/js/async/zh_guide_basic_use-micro-generator.a091d57d.js +0 -1
- package/doc_build/static/js/async/zh_guide_basic_using-storybook.27829e44.js +0 -1
- package/doc_build/static/js/async/zh_guide_best-practices_components.7454d916.js +0 -1
- package/doc_build/static/js/async/zh_guide_intro_getting-started.a4c00d9a.js +0 -1
- package/doc_build/static/js/async/zh_guide_intro_welcome.71c3fe16.js +0 -1
- package/doc_build/static/js/async/zh_guide_intro_why-module-engineering-solution.6f8b5ff6.js +0 -1
- package/doc_build/static/js/async/zh_index.c19f9dcf.js +0 -1
- package/doc_build/static/js/async/zh_plugins_guide_getting-started.099dfaea.js +0 -1
- package/doc_build/static/js/async/zh_plugins_guide_plugin-object.963289d5.js +0 -1
- package/doc_build/static/js/async/zh_plugins_guide_setup-function.67d07b91.js +0 -1
- package/doc_build/static/js/async/zh_plugins_official-list_overview.a7635714.js +0 -1
- package/doc_build/static/js/lib-lodash.c5845536.js +0 -1
- package/doc_build/static/js/lib-polyfill.b3038509.js +0 -1
- package/doc_build/static/js/lib-react.d41ace5e.js +0 -2
- package/doc_build/static/js/lib-react.d41ace5e.js.LICENSE.txt +0 -29
- package/doc_build/static/js/main.2d3257a4.js +0 -1
|
@@ -2,25 +2,78 @@
|
|
|
2
2
|
sidebar_position: 2
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
#
|
|
5
|
+
# In-depth understanding of the dev command
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
The `dev` command provided by the module project is mainly used for debugging the code.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
如果你还不清楚 `buildConfig` 是什么,建议花一些时间通过下面的链接了解一下:
|
|
9
|
+
## The overall flow of the command run
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
1. When the `dev` command is executed, Module Tools starts looking for debugging tools or tasks that can be executed. A debugging tool or task is a Module Tools debugging tool plugin like Storybook.
|
|
12
|
+
2. When a debugging tool is found, it is executed immediately.
|
|
13
|
+
3. When multiple debugging tools are found, the debugging tools list menu is displayed. A debug tool can be started by selecting the name option corresponding to it.
|
|
14
|
+
4. When no debug tool is found, the user is informed that no debug tool is available.
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
In addition to the `dev` command, you can also start a debugging tool or task directly by using the `dev [debug tool name]` option.
|
|
15
17
|
|
|
16
|
-
|
|
18
|
+
When executing the `dev` command, the debugging tool can choose whether or not to perform a listening mode for code builds before starting, for example the Storybook debugging tool has this feature enabled.
|
|
17
19
|
|
|
18
|
-
## 深入理解 `buildConfig`
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
## Storybook
|
|
21
22
|
|
|
22
|
-
### bundle 和 bundleless
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
Storybook is currently the official Module Tools debugging tool plugin provided by Module Works.
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
As we mentioned above, Storybook performs the source build task in listening mode before it is started, so you will see log messages for both Storybook and the source build in the terminal. Changes to the build product are also triggered when the source code is updated, and Storybook hot updates are triggered when the build product changes.
|
|
27
|
+
|
|
28
|
+
## Extending the dev command
|
|
29
|
+
|
|
30
|
+
If you need to extend the dev command, or rather provide your own Module Tools debugging tool plug-in, then you will need to know the following first.
|
|
31
|
+
|
|
32
|
+
* [Development of plugins](plugins/guide/getting-started)
|
|
33
|
+
* [Debugging Tools Plugin API](/api/plugin-api/plugin-hooks#调试钩子)
|
|
34
|
+
|
|
35
|
+
In general, the code to implement a debugging tool that does nothing and the associated configuration is as follows.
|
|
36
|
+
|
|
37
|
+
``` ts do-nothing.ts
|
|
38
|
+
export default (): CliPlugin<ModuleTools> => ({
|
|
39
|
+
name: 'do-nothing',
|
|
40
|
+
setup() {
|
|
41
|
+
return {
|
|
42
|
+
registerDev() {
|
|
43
|
+
return {
|
|
44
|
+
// Debugging tool name
|
|
45
|
+
name: 'do-nothing',
|
|
46
|
+
// Menu display content
|
|
47
|
+
menuItem: {
|
|
48
|
+
name: 'DoNothing',
|
|
49
|
+
value: 'do-nothing',
|
|
50
|
+
},
|
|
51
|
+
// The defined dev subcommand
|
|
52
|
+
subCommands: ['donothing', 'dn'],
|
|
53
|
+
async action() {
|
|
54
|
+
// dev logic
|
|
55
|
+
console.info('Run build --watch, and do nothing.');
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
If this debugging tool plugin is required, it needs to be added to the configuration file.
|
|
65
|
+
|
|
66
|
+
``` ts
|
|
67
|
+
import doNothingPlugin from './plugins/do-nothing';
|
|
68
|
+
|
|
69
|
+
export default defineConfig({
|
|
70
|
+
plugins: [
|
|
71
|
+
//..
|
|
72
|
+
doNothingPlugin()
|
|
73
|
+
],
|
|
74
|
+
});
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
At this point we can execute it when we execute the `dev` or `dev do-nothing` command. After execution, it will first execute the source build task in listening mode and print the log messages immediately afterwards.
|
|
78
|
+
|
|
79
|
+
For currently officially supported debugging tools and third-party supported debugging tools, you can view them in [plugins list](plugins/official-list/overview).
|
|
@@ -176,8 +176,10 @@ export default defineConfig({
|
|
|
176
176
|
});
|
|
177
177
|
```
|
|
178
178
|
|
|
179
|
-
|
|
180
|
-
|
|
179
|
+
**We recommend using the `defineConfig` function**, but it is not mandatory to use it. So you can also return an object directly in the config file: the
|
|
180
|
+
|
|
181
|
+
``` ts
|
|
182
|
+
// modern.config.ts
|
|
181
183
|
import moduleTools from '@modern-js/module-tools';
|
|
182
184
|
|
|
183
185
|
export default {
|
|
@@ -185,15 +187,3 @@ export default {
|
|
|
185
187
|
buildPreset: 'npm-library',
|
|
186
188
|
};
|
|
187
189
|
```
|
|
188
|
-
|
|
189
|
-
**We recommend using the `defineConfig` function**, but it is not mandatory to use it. So you can also return an object directly in the config file: the
|
|
190
|
-
|
|
191
|
-
```typescript
|
|
192
|
-
// modern.config.ts
|
|
193
|
-
export default {};
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
```js
|
|
197
|
-
// modern.config.js
|
|
198
|
-
export default {};
|
|
199
|
-
```
|
|
@@ -33,7 +33,7 @@ When you want to start a project build, you can execute the `modern build` comma
|
|
|
33
33
|
In addition to the above, module projects also support `platform` build mode, which can be used to perform build tasks for other tools. For example, it is currently officially supported to start a Storybook build task to generate Storybook products by executing the `modern build --platform` or `modern build --platform storybook` commands after installing the `@modern-js/plugin-storybook` plugin.
|
|
34
34
|
|
|
35
35
|
:::tip{title=Note}
|
|
36
|
-
When executing a Storybook build, it
|
|
36
|
+
When executing a Storybook build, it may need to read the project's build product. So **when the `modern build --platform` command is executed to start a Storybook build, the `modern build --watch` program is automatically executed first to ensure the existence of the source build product**.
|
|
37
37
|
:::
|
|
38
38
|
|
|
39
39
|
## `modern new`
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
sidebar_position: 3
|
|
3
3
|
---
|
|
4
|
+
# modify-output-product
|
|
4
5
|
|
|
5
6
|
## Modify the output product
|
|
6
7
|
|
|
@@ -58,9 +59,10 @@ For example, if the output product is based on the preset string `"npm-library"`
|
|
|
58
59
|
For example, to achieve the same effect as the preset string ``npm-library-es5"` using the form of a preset function, you can do the following.
|
|
59
60
|
|
|
60
61
|
```typescript
|
|
61
|
-
import { defineConfig } from '@modern-js/module-tools';
|
|
62
|
+
import moduleTools, { defineConfig } from '@modern-js/module-tools';
|
|
62
63
|
|
|
63
64
|
export default defineConfig({
|
|
65
|
+
plugins: [moduleTools()],
|
|
64
66
|
buildPreset({ preset }) {
|
|
65
67
|
return preset.NPM_LIBRARY.map(config => {
|
|
66
68
|
return { ... .config, target: 'es5' }
|
|
@@ -69,9 +71,11 @@ export default defineConfig({
|
|
|
69
71
|
});
|
|
70
72
|
```
|
|
71
73
|
|
|
72
|
-
In the above code implementation, `preset.NPM_LIBRARY` corresponds to the preset string `"npm-library"`, which represents the `"npm-library"`
|
|
74
|
+
In the above code implementation, `preset.NPM_LIBRARY` corresponds to the preset string `"npm-library"`, which represents the equivalent of `"npm-library"` for multiple sets of build-related configurations. We traverse the `NPM_LIBRARY` array, which contains multiple `buildConfig` objects, using the `map` method. We made a shallow copy of the original `buildConfig` object and modified the value of the `target` after the shallow copy, specifying it as `es5`.
|
|
75
|
+
|
|
73
76
|
|
|
74
77
|
> NPM_LIBRARY`, you can check it with [BuildPreset API](/api/config/build-preset). The`preset`object contains not only`NPM_LIBRARY`, but also other similar constants.
|
|
78
|
+
> We can not only use `preset.NPM_LIBRARY` to get the build configuration corresponding to `"npm-library"`, but also `preset['npm-library']` in this way.
|
|
75
79
|
|
|
76
80
|
So what is the `buildConfig` object here? What is the basis for the build product feature mentioned before?
|
|
77
81
|
|
|
@@ -16,12 +16,43 @@ The microgenerator can be started via [`modern new`](/guide/basic/command-previe
|
|
|
16
16
|
|
|
17
17
|
## Test
|
|
18
18
|
|
|
19
|
-
When we want to test some modules, we can enable the test
|
|
19
|
+
When we want to test some modules, we can enable the test feature. When this feature is enabled, **a `tests` directory and related files will be created in the project directory, and a new `"@modern-js/plugin-testing"` dependency will be added to package.json**.
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
:::tip
|
|
23
|
+
After successfully enabling it, you will be prompted to manually add a code similar to the one below to the configuration.
|
|
24
|
+
``` ts
|
|
25
|
+
import moduleTools, { defineConfig } from '@modern-js/module-tools';
|
|
26
|
+
import testPlugin from '@modern-js/plugin-testing';
|
|
27
|
+
|
|
28
|
+
export default defineConfig({
|
|
29
|
+
plugins: [
|
|
30
|
+
moduleTools(),
|
|
31
|
+
testPlugin(),
|
|
32
|
+
],
|
|
33
|
+
});
|
|
34
|
+
```
|
|
35
|
+
:::
|
|
20
36
|
|
|
21
37
|
## Storybook
|
|
22
38
|
|
|
23
39
|
The **Storybook feature** can be enabled when we want to debug a component or a common module. When this feature is enabled, **the `stories` directory and related files are created in the project directory, and a new `"@modern-js/plugin-storybook"` dependency is added to package.json**.
|
|
24
40
|
|
|
41
|
+
:::tip
|
|
42
|
+
After successfully enabling it, you will be prompted to manually add a code similar to the one below to the configuration.
|
|
43
|
+
``` ts
|
|
44
|
+
import moduleTools, { defineConfig } from '@modern-js/module-tools';
|
|
45
|
+
import storybookPlugin from '@modern-js/plugin-storybook';
|
|
46
|
+
|
|
47
|
+
export default defineConfig({
|
|
48
|
+
plugins: [
|
|
49
|
+
moduleTools(),
|
|
50
|
+
storybookPlugin(),
|
|
51
|
+
],
|
|
52
|
+
});
|
|
53
|
+
```
|
|
54
|
+
:::
|
|
55
|
+
|
|
25
56
|
For more information on how to start Storybook and how to use it, check out the following link.
|
|
26
57
|
|
|
27
58
|
- [`modern dev`](/en/guide/basic/command-preview#modern-dev)
|
|
@@ -37,6 +68,21 @@ For more information on how to use Tailwind CSS in your module projects, check o
|
|
|
37
68
|
|
|
38
69
|
- Using Tailwind CSS
|
|
39
70
|
|
|
71
|
+
:::tip
|
|
72
|
+
After successfully enabling it, you will be prompted to manually add a code similar to the one below to the configuration.
|
|
73
|
+
``` ts
|
|
74
|
+
import moduleTools, { defineConfig } from '@modern-js/module-tools';
|
|
75
|
+
import tailwindPlugin from '@modern-js/plugin-tailwindcss';
|
|
76
|
+
|
|
77
|
+
export default defineConfig({
|
|
78
|
+
plugins: [
|
|
79
|
+
moduleTools(),
|
|
80
|
+
tailwindPlugin(),
|
|
81
|
+
],
|
|
82
|
+
});
|
|
83
|
+
```
|
|
84
|
+
:::
|
|
85
|
+
|
|
40
86
|
## Modern.js Runtime API
|
|
41
87
|
|
|
42
88
|
<!-- 链接待补充 -->
|
|
@@ -44,3 +90,18 @@ For more information on how to use Tailwind CSS in your module projects, check o
|
|
|
44
90
|
**Modern.js provides Runtime API capabilities that can only be used in the Modern.js application project environment**. If you need to develop a component for use in a Modern.js application environment, then you can turn on this feature and the microgenerator will add the `"@modern-js/runtime"` dependency.
|
|
45
91
|
|
|
46
92
|
Also, the Storybook debugging tool will determine if the project needs to use the Runtime API by checking the project's dependencies and providing the same Runtime API runtime environment as the Modern.js application project.
|
|
93
|
+
|
|
94
|
+
:::tip
|
|
95
|
+
After successfully enabling it, you will be prompted to manually add a code similar to the one below to the configuration.
|
|
96
|
+
``` ts
|
|
97
|
+
import moduleTools, { defineConfig } from '@modern-js/module-tools';
|
|
98
|
+
import runtime from '@modern-js/runtime/cli';
|
|
99
|
+
|
|
100
|
+
export default defineConfig({
|
|
101
|
+
plugins: [
|
|
102
|
+
moduleTools(),
|
|
103
|
+
runtime(),
|
|
104
|
+
],
|
|
105
|
+
});
|
|
106
|
+
```
|
|
107
|
+
:::
|
|
@@ -23,12 +23,12 @@ The modular engineering solution is integrated with Storybook, so you can pretty
|
|
|
23
23
|
|
|
24
24
|
## Debugging code
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
The project code needs to be introduced during the debugging process and can currently be introduced in two ways:
|
|
27
27
|
|
|
28
|
-
-
|
|
29
|
-
-
|
|
28
|
+
- Use of project products
|
|
29
|
+
- Using the project source code
|
|
30
30
|
|
|
31
|
-
We
|
|
31
|
+
We prefer to use the first "**use project product**" approach. This is because it is closer to a real-life usage scenario and not only allows you to debug the functionality of the component, but also to verify the correctness of the build product.
|
|
32
32
|
|
|
33
33
|
Next, we will talk about how to use each of these two methods.
|
|
34
34
|
|
|
@@ -6,22 +6,32 @@ sidebar_position: 3
|
|
|
6
6
|
|
|
7
7
|
## 3 minute demo
|
|
8
8
|
|
|
9
|
-
Want to experience Module Tools in action? The only prerequisite you need is [Node.js LTS](https://github.com/nodejs/Release) and make sure your Node version is **>= 14.
|
|
9
|
+
Want to experience Module Tools in action? The only prerequisite you need is [Node.js LTS](https://github.com/nodejs/Release) and make sure your Node version is **>= 14.18.0**.We recommend using the LTS version of Node.js 16.
|
|
10
10
|
|
|
11
11
|
From your shell, install the following dependencies in your project.
|
|
12
12
|
|
|
13
13
|
- `@modern-js/module-tools`
|
|
14
|
-
-
|
|
14
|
+
- `"typescript"` (omitted if not a TypeScript project)
|
|
15
15
|
|
|
16
16
|
> If it's a TypeScript project, add the `"typescript"` dependency.
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
|
-
npm install -D @modern-js/module-tools
|
|
19
|
+
npm install -D @modern-js/module-tools typescript
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
> For projects that use pnpm or the Yarn package manager, just replace npm. **pnpm is recommended**.
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
Next, create the `modern.config.(t|j)s` file in the root of the project.
|
|
25
|
+
|
|
26
|
+
``` ts
|
|
27
|
+
import moduleTools, { defineConfig } from '@modern-js/module-tools';
|
|
28
|
+
|
|
29
|
+
export default defineConfig({
|
|
30
|
+
plugins: [moduleTools()],
|
|
31
|
+
})
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Finally, add the command `"build": "modern build"` to the project's `package.json` file.
|
|
25
35
|
|
|
26
36
|
```json
|
|
27
37
|
{
|
|
@@ -33,11 +43,11 @@ Then add the command `"build": "modern build"` to your project's `package.json`
|
|
|
33
43
|
|
|
34
44
|
If your project has a `src/index.(js|jsx)` file or both `src/index.(ts|tsx)` and `tsconfig.json` files, then congratulations you can run the `npm run build` command directly to build your project with Module Tools.
|
|
35
45
|
|
|
36
|
-
**If you want to see
|
|
46
|
+
**If you want to see the complete project using the modular engineering scheme, you can execute the following command**.
|
|
37
47
|
|
|
38
48
|
```bash
|
|
39
49
|
git clone https://github.com/modern-js-dev/module-tools-examples
|
|
40
|
-
cd module-tools-example
|
|
50
|
+
cd module-tools-example/base
|
|
41
51
|
|
|
42
52
|
## Execute the build.
|
|
43
53
|
pnpm build
|
|
@@ -50,7 +60,6 @@ pnpm dev storybook
|
|
|
50
60
|
|
|
51
61
|
## Test
|
|
52
62
|
pnpm test
|
|
53
|
-
pnpm test
|
|
54
63
|
```
|
|
55
64
|
|
|
56
65
|
**If you want to create a complete module project, you can execute the following command:**
|
|
@@ -4,27 +4,74 @@ sidebar_position: 2
|
|
|
4
4
|
|
|
5
5
|
# 深入理解 dev 命令
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
模块工程提供的 `dev` 命令主要用于代码的调试。
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
如果你还不清楚 `buildConfig` 是什么,建议花一些时间通过下面的链接了解一下:
|
|
9
|
+
## 命令运行的整体流程
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
1. 当执行 `dev` 命令的时候,Module Tools 开始寻找是否存在可以执行的调试工具或者任务。调试工具或者任务就是类似 Storybook 这样的 Module Tools 调试工具插件。
|
|
12
|
+
2. 当发现存在一个调试工具的时候,则会立即执行它。
|
|
13
|
+
3. 当发现多个调试工具的时候,则显示调试工具列表菜单。可以通过选择某个调试工具对应的名称选项启动它。
|
|
14
|
+
4. 当没有发现调试工具的时候,则告诉用户没有可用的调试工具。
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
我们除了可以执行 `dev` 命令以外,也可以通过 `dev [调试工具名称]` 的方式来直接启动调试工具或者任务。
|
|
15
17
|
|
|
16
|
-
|
|
18
|
+
在执行 `dev` 命令的时候,调试工具可以选择是否在启动之前执行代码构建的监听模式,例如 Storybook 调试工具就开启了该功能。
|
|
17
19
|
|
|
18
|
-
##
|
|
20
|
+
## Storybook
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
Storybook 是目前模块工程官方提供的 Module Tools 调试工具插件。
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
上面我们说到 Storybook 在启动之前会执行监听模式的源码构建任务,因此在终端里你会看到 Storybook 和源码构建的日志信息同时出现。并且在更新源码后会触发构建产物的变化,当构建产物变化的时候也会触发 Storybook 热更新。
|
|
23
25
|
|
|
24
|
-
|
|
26
|
+
## 扩展 dev 命令
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
如果需要扩展 dev 命令或者说提供自己的 Module Tools 调试工具插件,那么你需要先了解以下内容:
|
|
27
29
|
|
|
28
|
-
|
|
30
|
+
* [开发插件](plugins/guide/getting-started)
|
|
31
|
+
* [调试工具插件 API](/api/plugin-api/plugin-hooks#调试钩子)
|
|
29
32
|
|
|
30
|
-
|
|
33
|
+
一般来说,实现一个什么都不做的调试工具,其实现代码以及相关配置如下:
|
|
34
|
+
|
|
35
|
+
``` ts do-nothing.ts
|
|
36
|
+
export default (): CliPlugin<ModuleTools> => ({
|
|
37
|
+
name: 'do-nothing',
|
|
38
|
+
setup() {
|
|
39
|
+
return {
|
|
40
|
+
registerDev() {
|
|
41
|
+
return {
|
|
42
|
+
// 调试工具名称
|
|
43
|
+
name: 'do-nothing',
|
|
44
|
+
// 菜单显示内容
|
|
45
|
+
menuItem: {
|
|
46
|
+
name: 'DoNothing',
|
|
47
|
+
value: 'do-nothing',
|
|
48
|
+
},
|
|
49
|
+
// 定义的 dev 子命令
|
|
50
|
+
subCommands: ['donothing', 'dn'],
|
|
51
|
+
async action() {
|
|
52
|
+
// dev logic
|
|
53
|
+
console.info('Run build --watch, and do nothing.');
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
如果需要使用该调试工具插件,则需要在配置文件中增加它:
|
|
63
|
+
|
|
64
|
+
``` ts
|
|
65
|
+
import doNothingPlugin from './plugins/do-nothing';
|
|
66
|
+
|
|
67
|
+
export default defineConfig({
|
|
68
|
+
plugins: [
|
|
69
|
+
//..
|
|
70
|
+
doNothingPlugin()
|
|
71
|
+
],
|
|
72
|
+
});
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
此时我们执行 `dev` 或者 `dev do-nothing` 命令的时候,就可以执行它了。在执行后,它会先执行监听模式的源码构建任务,并紧接着打印日志信息。
|
|
76
|
+
|
|
77
|
+
对于目前官方支持的调试工具和第三方支持的调试工具,可以在[插件列表](plugins/official-list/overview)中查看。
|
|
@@ -176,8 +176,10 @@ export default defineConfig({
|
|
|
176
176
|
});
|
|
177
177
|
```
|
|
178
178
|
|
|
179
|
-
|
|
180
|
-
|
|
179
|
+
**我们推荐使用 `defineConfig` 函数**,不过并不强制使用它。因此你也可以在配置文件中直接返回一个对象:
|
|
180
|
+
|
|
181
|
+
```ts
|
|
182
|
+
// modern.config.ts
|
|
181
183
|
import moduleTools from '@modern-js/module-tools';
|
|
182
184
|
|
|
183
185
|
export default {
|
|
@@ -185,15 +187,3 @@ export default {
|
|
|
185
187
|
buildPreset: 'npm-library',
|
|
186
188
|
};
|
|
187
189
|
```
|
|
188
|
-
|
|
189
|
-
**我们推荐使用 `defineConfig` 函数**,不过并不强制使用它。因此你也可以在配置文件中直接返回一个对象:
|
|
190
|
-
|
|
191
|
-
```typescript
|
|
192
|
-
// modern.config.ts
|
|
193
|
-
export default {};
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
```js
|
|
197
|
-
// modern.config.js
|
|
198
|
-
export default {};
|
|
199
|
-
```
|
|
@@ -33,7 +33,7 @@ Options:
|
|
|
33
33
|
除了以上,模块工程还支持 `platform` 构建模式,可以用于执行其他工具的构建任务。例如,目前官方支持在安装了 `@modern-js/plugin-storybook` 插件后,可以通过执行 `modern build --platform` 或者 `modern build --platform storybook` 命令启动 Storybook 构建任务生成 Storybook 产物。
|
|
34
34
|
|
|
35
35
|
:::tip{title=注意}
|
|
36
|
-
在执行 Storybook
|
|
36
|
+
在执行 Storybook 构建的时候,它可能需要读取项目的构建产物。因此**在执行 `modern build --platform` 命令启动 Storybook 构建的时候,会自动先执行 `modern build --watch` 程序确保源码构建产物的存在**。
|
|
37
37
|
:::
|
|
38
38
|
|
|
39
39
|
## `modern new`
|
|
@@ -90,7 +90,7 @@ Options:
|
|
|
90
90
|
```
|
|
91
91
|
|
|
92
92
|
需要先执行 `modern new` 开启测试功能,然后才可以执行 `modern test` 命令。
|
|
93
|
-
`modern test` 命令会自动将 `
|
|
93
|
+
`modern test` 命令会自动将 `tests/*.test.(js|ts|jsx|tsx)` 文件当做测试用例运行。
|
|
94
94
|
|
|
95
95
|
## `modern lint`
|
|
96
96
|
|
|
@@ -58,9 +58,10 @@ export default defineConfig({
|
|
|
58
58
|
例如,如果使用预设函数的形式达到预设字符串 `"npm-library-es5"` 同样的效果,可以按照如下的方式:
|
|
59
59
|
|
|
60
60
|
```typescript
|
|
61
|
-
import { defineConfig } from '@modern-js/module-tools';
|
|
61
|
+
import moduleTools, { defineConfig } from '@modern-js/module-tools';
|
|
62
62
|
|
|
63
63
|
export default defineConfig({
|
|
64
|
+
plugins: [moduleTools()],
|
|
64
65
|
buildPreset({ preset }) {
|
|
65
66
|
return preset.NPM_LIBRARY.map(config => {
|
|
66
67
|
return { ...config, target: 'es5' };
|
|
@@ -69,9 +70,10 @@ export default defineConfig({
|
|
|
69
70
|
});
|
|
70
71
|
```
|
|
71
72
|
|
|
72
|
-
在上面的代码实现中,`preset.NPM_LIBRARY` 与预设字符串 `"npm-library"` 是相对应的,它代表着 `"npm-library"` 等价的多组构建相关的配置。我们通过 `map` 方法遍历了 `NPM_LIBRARY` 这个数组,在这个数组中包含了多个 `buildConfig` 对象。我们将原本的 `buildConfig`
|
|
73
|
+
在上面的代码实现中,`preset.NPM_LIBRARY` 与预设字符串 `"npm-library"` 是相对应的,它代表着 `"npm-library"` 等价的多组构建相关的配置。我们通过 `map` 方法遍历了 `NPM_LIBRARY` 这个数组,在这个数组中包含了多个 `buildConfig` 对象。我们将原本的 `buildConfig` 对象进行了浅拷贝,并修改了浅拷贝后 `target` 的值,将它指定为 `es5`。
|
|
73
74
|
|
|
74
75
|
> 关于 `preset.NPM_LIBRARY` 具体对应的值,可以通过 [BuildPreset API](/api/config/build-preset) 查看。在 `preset` 对象下不仅包含了 `NPM_LIBRARY`,还包含了其他类似的常量。
|
|
76
|
+
> 我们不仅可以使用 `preset.NPM_LIBRARY` 来获取 `"npm-library"` 对应的构建配置,也可以使用 `preset['npm-library']` 这样的方式。
|
|
75
77
|
|
|
76
78
|
那么这里的 `buildConfig` 对象是什么呢?之前提到的构建产物特点又是根据什么呢?
|
|
77
79
|
|
|
@@ -112,7 +114,7 @@ export default defineConfig({
|
|
|
112
114
|
- 指定 umd 产物外部导入的全局变量:对应的 API 是 [`buildConfig.umdGlobals`](/api/config/build-config#umdglobals)。
|
|
113
115
|
- 指定 umd 产物的模块名:对应的 API 是 [`buildConfig.umdModuleName`](/api/config/build-config#umdmodulename)。
|
|
114
116
|
|
|
115
|
-
除了以上分类以外,关于这些 API
|
|
117
|
+
除了以上分类以外,关于这些 API 的常见问题和最佳实践可以通过下面的链接来了解:
|
|
116
118
|
|
|
117
119
|
- [什么是 `bundle` 和 `bundleless`?](/guide/advance/in-depth-about-build#bundle-和-bundleless)
|
|
118
120
|
- [`input` 与 `sourceDir` 的关系](/guide/advance/in-depth-about-build#input-与-sourcedir-的关系)。
|
|
@@ -6,8 +6,8 @@ sidebar_position: 7
|
|
|
6
6
|
|
|
7
7
|
一个 npm 类型的模块项目发布流程包含了两个阶段:
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
- 第二阶段是在发布期间,Module Tools
|
|
9
|
+
- 第一阶段是在开发期间,开发者需要提供变更文件,该文件记录了在发布期间需要的变更内容;
|
|
10
|
+
- 第二阶段是在发布期间,Module Tools 会收集所有的变更文件来更新版本、更新发布日志,并发布新的包到 [npm Registry](https://www.npmjs.com/) 上。
|
|
11
11
|
|
|
12
12
|
## 跟踪变更
|
|
13
13
|
|
|
@@ -18,7 +18,7 @@ sidebar_position: 7
|
|
|
18
18
|
- 配置文件修改
|
|
19
19
|
- ...
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
当这些任务一旦开发完成后,需要通过以下命令来对当前的变化进行记录:
|
|
22
22
|
|
|
23
23
|
- [`modern change`](/guide/basic/command-preview#modern-change)
|
|
24
24
|
|
|
@@ -71,7 +71,7 @@ publish test
|
|
|
71
71
|
|
|
72
72
|
发布项目可以执行以下命令:
|
|
73
73
|
|
|
74
|
-
- [`modern
|
|
74
|
+
- [`modern release`](/guide/basic/command-preview#modern-release)
|
|
75
75
|
|
|
76
76
|
`modern release` 命令可以将项目发布到 npm Registry。
|
|
77
77
|
|
|
@@ -8,7 +8,21 @@ sidebar_position: 6
|
|
|
8
8
|
|
|
9
9
|
## 先决条件和约定
|
|
10
10
|
|
|
11
|
-
想要使用项目的测试功能,需要确保项目中包含依赖:`"@modern-js/plugin-testing"
|
|
11
|
+
想要使用项目的测试功能,需要确保项目中包含依赖:`"@modern-js/plugin-testing"`,以及按照类似下面的内容进行配置:
|
|
12
|
+
|
|
13
|
+
``` ts
|
|
14
|
+
import moduleTools, { defineConfig } from '@modern-js/module-tools';
|
|
15
|
+
import testPlugin from '@modern-js/plugin-testing';
|
|
16
|
+
|
|
17
|
+
export default defineConfig({
|
|
18
|
+
plugins: [
|
|
19
|
+
moduleTools(),
|
|
20
|
+
testPlugin(),
|
|
21
|
+
],
|
|
22
|
+
});
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
可以通过执行 [`modern new`](/guide/basic/command-preview#modern-new) 命令来开启测试功能。
|
|
12
26
|
|
|
13
27
|
在模块工程方案中,对于测试用例或者说编写测试的文件有如下约定:
|
|
14
28
|
|
|
@@ -18,7 +32,7 @@ sidebar_position: 6
|
|
|
18
32
|
|
|
19
33
|
## 运行测试
|
|
20
34
|
|
|
21
|
-
|
|
35
|
+
当准备好了依赖、增加了相关配置以及了解了测试用例在哪里编写后,我们可以通过以下命令来执行测试:
|
|
22
36
|
|
|
23
37
|
```bash
|
|
24
38
|
modern test
|
|
@@ -33,7 +47,6 @@ modern test --updateSnapshot
|
|
|
33
47
|
|
|
34
48
|
## 使用配置
|
|
35
49
|
|
|
36
|
-
/obj/eden-cn/uhbfnupenuhf/test-result.png
|
|
37
50
|
模块工程方案对测试提供了以下配置:
|
|
38
51
|
|
|
39
52
|
- [`testing`](/api/config/testing)
|
|
@@ -68,7 +81,7 @@ export default function () {
|
|
|
68
81
|
|
|
69
82
|
然后在测试文件中,我们可以这样。
|
|
70
83
|
|
|
71
|
-
其中 `@` 指向了源码目录,在初始化项目的 `tests/tsconfig.json` 中定义了。
|
|
84
|
+
其中 `@` 指向了源码目录,在初始化项目的 `tests/tsconfig.json` 的 `paths` 中定义了。
|
|
72
85
|
|
|
73
86
|
```typescript ./tests/index.test.ts
|
|
74
87
|
import main from '@/index';
|
|
@@ -132,7 +145,7 @@ export const default () {
|
|
|
132
145
|
|
|
133
146
|
然后在测试文件中,我们可以这样。
|
|
134
147
|
|
|
135
|
-
其中 `@` 指向了源码目录,在初始化项目的 `tests/tsconfig.json` 中定义了。
|
|
148
|
+
其中 `@` 指向了源码目录,在初始化项目的 `tests/tsconfig.json` 的 `paths` 中定义了。
|
|
136
149
|
|
|
137
150
|
```tsx ./tests/index.test.tsx
|
|
138
151
|
import { render, screen } from '@modern-js/runtime/testing';
|