@modern-js/module-tools-docs 2.0.0-beta.4 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +13 -0
- package/doc_build/html/main/index.html +16 -0
- package/doc_build/route.json +10 -0
- package/doc_build/static/css/main.css +3370 -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 +85 -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/api_.js +56 -0
- package/doc_build/static/js/async/api_.js.map +1 -0
- package/doc_build/static/js/async/api_config_build-config.js +11309 -0
- package/doc_build/static/js/async/api_config_build-config.js.map +1 -0
- package/doc_build/static/js/async/api_config_build-preset.js +7849 -0
- package/doc_build/static/js/async/api_config_build-preset.js.map +1 -0
- package/doc_build/static/js/async/api_config_design-system.js +48708 -0
- package/doc_build/static/js/async/api_config_design-system.js.map +1 -0
- package/doc_build/static/js/async/api_config_plugins.js +1492 -0
- package/doc_build/static/js/async/api_config_plugins.js.map +1 -0
- package/doc_build/static/js/async/api_config_testing.js +2130 -0
- package/doc_build/static/js/async/api_config_testing.js.map +1 -0
- package/doc_build/static/js/async/api_plugin-api_plugin-hooks.js +14394 -0
- package/doc_build/static/js/async/api_plugin-api_plugin-hooks.js.map +1 -0
- package/doc_build/static/js/async/en_.js +85 -0
- package/doc_build/static/js/async/en_.js.map +1 -0
- package/doc_build/static/js/async/en_api_.js +55 -0
- package/doc_build/static/js/async/en_api_.js.map +1 -0
- package/doc_build/static/js/async/en_api_config_build-config.js +8363 -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 +7845 -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 +16345 -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 +1492 -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 +2137 -0
- package/doc_build/static/js/async/en_api_config_testing.js.map +1 -0
- package/doc_build/static/js/async/en_api_plugin-api_plugin-hooks.js +14362 -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 +3997 -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 +9861 -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 +6539 -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 +3810 -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 +5046 -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 +150 -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 +2484 -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 +3671 -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 +3961 -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 +2970 -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 +2182 -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 +3892 -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 +168 -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 +4762 -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 +21388 -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 +1906 -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 +148 -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 +92 -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_plugins_guide_getting-started.js +2560 -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 +4177 -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 +3819 -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 +70 -0
- package/doc_build/static/js/async/en_plugins_official-list_overview.js.map +1 -0
- package/doc_build/static/js/async/guide_advance_asset.js +3997 -0
- package/doc_build/static/js/async/guide_advance_asset.js.map +1 -0
- package/doc_build/static/js/async/guide_advance_build-umd.js +9863 -0
- package/doc_build/static/js/async/guide_advance_build-umd.js.map +1 -0
- package/doc_build/static/js/async/guide_advance_copy.js +6539 -0
- package/doc_build/static/js/async/guide_advance_copy.js.map +1 -0
- package/doc_build/static/js/async/guide_advance_external-dependency.js +3812 -0
- package/doc_build/static/js/async/guide_advance_external-dependency.js.map +1 -0
- package/doc_build/static/js/async/guide_advance_in-depth-about-build.js +5046 -0
- package/doc_build/static/js/async/guide_advance_in-depth-about-build.js.map +1 -0
- package/doc_build/static/js/async/guide_advance_in-depth-about-dev-command.js +152 -0
- package/doc_build/static/js/async/guide_advance_in-depth-about-dev-command.js.map +1 -0
- package/doc_build/static/js/async/guide_advance_theme-config.js +2475 -0
- package/doc_build/static/js/async/guide_advance_theme-config.js.map +1 -0
- package/doc_build/static/js/async/guide_basic_before-getting-started.js +3662 -0
- package/doc_build/static/js/async/guide_basic_before-getting-started.js.map +1 -0
- package/doc_build/static/js/async/guide_basic_command-preview.js +3793 -0
- package/doc_build/static/js/async/guide_basic_command-preview.js.map +1 -0
- package/doc_build/static/js/async/guide_basic_modify-output-product.js +2949 -0
- package/doc_build/static/js/async/guide_basic_modify-output-product.js.map +1 -0
- package/doc_build/static/js/async/guide_basic_publish-your-project.js +2243 -0
- package/doc_build/static/js/async/guide_basic_publish-your-project.js.map +1 -0
- package/doc_build/static/js/async/guide_basic_test-your-project.js +3892 -0
- package/doc_build/static/js/async/guide_basic_test-your-project.js.map +1 -0
- package/doc_build/static/js/async/guide_basic_use-micro-generator.js +172 -0
- package/doc_build/static/js/async/guide_basic_use-micro-generator.js.map +1 -0
- package/doc_build/static/js/async/guide_basic_using-storybook.js +4762 -0
- package/doc_build/static/js/async/guide_basic_using-storybook.js.map +1 -0
- package/doc_build/static/js/async/guide_best-practices_components.js +21088 -0
- package/doc_build/static/js/async/guide_best-practices_components.js.map +1 -0
- package/doc_build/static/js/async/guide_intro_getting-started.js +1782 -0
- package/doc_build/static/js/async/guide_intro_getting-started.js.map +1 -0
- package/doc_build/static/js/async/guide_intro_welcome.js +148 -0
- package/doc_build/static/js/async/guide_intro_welcome.js.map +1 -0
- package/doc_build/static/js/async/guide_intro_why-module-engineering-solution.js +92 -0
- package/doc_build/static/js/async/guide_intro_why-module-engineering-solution.js.map +1 -0
- package/doc_build/static/js/async/index.js +85 -0
- package/doc_build/static/js/async/index.js.map +1 -0
- package/doc_build/static/js/async/packages_cli_doc-core_src_theme-default_components_Search_logic_search_ts.js +447 -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/plugins_guide_getting-started.js +2608 -0
- package/doc_build/static/js/async/plugins_guide_getting-started.js.map +1 -0
- package/doc_build/static/js/async/plugins_guide_plugin-object.js +4173 -0
- package/doc_build/static/js/async/plugins_guide_plugin-object.js.map +1 -0
- package/doc_build/static/js/async/plugins_guide_setup-function.js +3819 -0
- package/doc_build/static/js/async/plugins_guide_setup-function.js.map +1 -0
- package/doc_build/static/js/async/plugins_official-list_overview.js +70 -0
- package/doc_build/static/js/async/plugins_official-list_overview.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/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 +24769 -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 +9237 -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 +8532 -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/docs/en/api/config/_category_.json +4 -0
- package/docs/en/api/{build-config.md → config/build-config.md} +201 -108
- package/docs/en/api/{build-preset.md → config/build-preset.md} +65 -46
- package/docs/{zh/api → en/api/config}/design-system.md +130 -127
- package/docs/en/api/config/plugins.md +18 -0
- package/docs/en/api/{test.md → config/testing.md} +21 -12
- package/docs/en/api/index.md +3 -1
- package/docs/en/api/plugin-api/_category_.json +4 -0
- package/docs/en/api/plugin-api/plugin-hooks.md +501 -0
- package/docs/en/guide/advance/_category_.json +4 -0
- package/docs/en/guide/advance/asset.mdx +48 -31
- package/docs/en/guide/advance/build-umd.mdx +91 -83
- package/docs/en/guide/advance/copy.md +33 -30
- package/docs/en/guide/advance/external-dependency.mdx +27 -23
- package/docs/en/guide/advance/in-depth-about-build.md +61 -55
- package/docs/en/guide/advance/in-depth-about-dev-command.md +7 -4
- package/docs/en/guide/advance/theme-config.mdx +80 -0
- package/docs/en/guide/basic/_category_.json +4 -0
- package/docs/en/guide/basic/before-getting-started.md +29 -24
- package/docs/en/guide/basic/command-preview.md +20 -16
- package/docs/en/guide/basic/modify-output-product.md +45 -37
- package/docs/en/guide/basic/publish-your-project.md +21 -19
- package/docs/en/guide/basic/test-your-project.mdx +23 -18
- package/docs/en/guide/basic/use-micro-generator.md +15 -8
- package/docs/en/guide/basic/using-storybook.mdx +29 -26
- package/docs/en/guide/best-practices/_category_.json +4 -0
- package/docs/en/guide/best-practices/components.mdx +789 -0
- package/docs/en/guide/intro/_category_.json +4 -0
- package/docs/en/guide/intro/getting-started.md +11 -6
- package/docs/en/guide/intro/welcome.md +4 -0
- package/docs/en/guide/intro/why-module-engineering-solution.md +5 -1
- package/docs/en/index.md +15 -20
- package/docs/en/plugins/guide/_category_.json +4 -0
- package/docs/en/plugins/guide/getting-started.mdx +84 -0
- package/docs/en/plugins/guide/plugin-object.mdx +85 -0
- package/docs/en/plugins/guide/setup-function.mdx +117 -0
- package/docs/en/plugins/official-list/_category_.json +4 -0
- package/docs/en/plugins/official-list/overview.md +6 -0
- package/docs/zh/api/config/_category_.json +4 -0
- package/docs/zh/api/config/build-config.md +669 -0
- package/docs/zh/api/{build-preset.md → config/build-preset.md} +49 -36
- package/docs/zh/api/config/design-system.md +1166 -0
- package/docs/zh/api/config/plugins.md +18 -0
- package/docs/zh/api/{testing.md → config/testing.md} +18 -13
- package/docs/zh/api/index.md +5 -1
- package/docs/zh/api/plugin-api/_category_.json +4 -0
- package/docs/zh/api/plugin-api/plugin-hooks.md +501 -0
- package/docs/zh/guide/advance/_category_.json +4 -0
- package/docs/zh/guide/advance/asset.mdx +48 -31
- package/docs/zh/guide/advance/build-umd.mdx +91 -74
- package/docs/zh/guide/advance/copy.md +33 -30
- package/docs/zh/guide/advance/external-dependency.mdx +28 -24
- package/docs/zh/guide/advance/in-depth-about-build.md +60 -55
- package/docs/zh/guide/advance/in-depth-about-dev-command.md +7 -4
- package/docs/zh/guide/advance/theme-config.mdx +78 -0
- package/docs/zh/guide/basic/_category_.json +4 -0
- package/docs/zh/guide/basic/before-getting-started.md +28 -23
- package/docs/zh/guide/basic/command-preview.md +19 -15
- package/docs/zh/guide/basic/modify-output-product.md +45 -38
- package/docs/zh/guide/basic/publish-your-project.md +22 -17
- package/docs/zh/guide/basic/test-your-project.mdx +24 -18
- package/docs/zh/guide/basic/use-micro-generator.md +12 -9
- package/docs/zh/guide/basic/using-storybook.mdx +29 -24
- package/docs/zh/guide/best-practices/_category_.json +4 -0
- package/docs/zh/guide/best-practices/components.mdx +793 -0
- package/docs/zh/guide/intro/_category_.json +4 -0
- package/docs/zh/guide/intro/getting-started.md +12 -6
- package/docs/zh/guide/intro/welcome.md +4 -0
- package/docs/zh/guide/intro/why-module-engineering-solution.md +5 -1
- package/docs/zh/index.md +3 -2
- package/docs/zh/plugins/guide/_category_.json +4 -0
- package/docs/zh/plugins/guide/getting-started.mdx +84 -0
- package/docs/zh/plugins/guide/plugin-object.mdx +85 -0
- package/docs/zh/plugins/guide/setup-function.mdx +117 -0
- package/docs/zh/plugins/official-list/_category_.json +4 -0
- package/docs/zh/plugins/official-list/overview.md +5 -0
- package/modern.config.ts +119 -0
- package/package.json +8 -6
- package/{docs/.island/styles → theme}/index.css +0 -1
- package/theme/index.ts +4 -0
- package/tsconfig.json +7 -0
- package/docs/.island/config.ts +0 -245
- package/docs/.island/dist/404.html +0 -41
- package/docs/.island/dist/assets/before-getting-started.1b82b538.js +0 -87
- package/docs/.island/dist/assets/before-getting-started.582a31cc.js +0 -87
- package/docs/.island/dist/assets/build-config.72eb0918.js +0 -804
- package/docs/.island/dist/assets/build-config.d8bb1658.js +0 -809
- package/docs/.island/dist/assets/build-preset.96805d7d.js +0 -256
- package/docs/.island/dist/assets/build-preset.c20dcd40.js +0 -256
- package/docs/.island/dist/assets/build-your-ui.7f349247.js +0 -2
- package/docs/.island/dist/assets/build-your-ui.a8361604.js +0 -2
- package/docs/.island/dist/assets/command-preview.2d45fc82.js +0 -264
- package/docs/.island/dist/assets/command-preview.dc51b953.js +0 -264
- package/docs/.island/dist/assets/components.esm.03560353.js +0 -9
- package/docs/.island/dist/assets/design-system.86694ff5.js +0 -1254
- package/docs/.island/dist/assets/design-system.c4745cce.js +0 -639
- package/docs/.island/dist/assets/dev.1d326a37.js +0 -37
- package/docs/.island/dist/assets/dev.1fd06000.js +0 -37
- package/docs/.island/dist/assets/down.f35427d3.svg +0 -1
- package/docs/.island/dist/assets/extension.12299fd6.js +0 -2
- package/docs/.island/dist/assets/extension.96dc63a4.js +0 -2
- package/docs/.island/dist/assets/getting-started.40e9218d.js +0 -117
- package/docs/.island/dist/assets/getting-started.b1ed3f10.js +0 -114
- package/docs/.island/dist/assets/github.3bf8ccee.svg +0 -1
- package/docs/.island/dist/assets/index.2b2347ea.js +0 -33
- package/docs/.island/dist/assets/index.6cef6f5f.js +0 -4
- package/docs/.island/dist/assets/index.cb118238.js +0 -36
- package/docs/.island/dist/assets/index.ccb6ce27.js +0 -4
- package/docs/.island/dist/assets/island_inject.11a12ecc.js +0 -1
- package/docs/.island/dist/assets/island_inject.b13deaee.js +0 -1
- package/docs/.island/dist/assets/loading.8c9bb911.svg +0 -1
- package/docs/.island/dist/assets/modify-output-product.7f6bff35.js +0 -100
- package/docs/.island/dist/assets/modify-output-product.b91eff1f.js +0 -100
- package/docs/.island/dist/assets/moon.6b705924.svg +0 -3
- package/docs/.island/dist/assets/plugin.895932d8.js +0 -42
- package/docs/.island/dist/assets/plugin.d2fbc531.js +0 -42
- package/docs/.island/dist/assets/publish-your-project.21b8309f.js +0 -164
- package/docs/.island/dist/assets/publish-your-project.8d398b17.js +0 -166
- package/docs/.island/dist/assets/right.89674cd7.svg +0 -1
- package/docs/.island/dist/assets/search.0aea6901.svg +0 -1
- package/docs/.island/dist/assets/search.1c85d17c.js +0 -3
- package/docs/.island/dist/assets/search.484eca11.js +0 -222
- package/docs/.island/dist/assets/search.54fca8d0.js +0 -3
- package/docs/.island/dist/assets/style.09015a4b.css +0 -1
- package/docs/.island/dist/assets/style.2e5f7bc2.css +0 -1970
- package/docs/.island/dist/assets/sun.841dac10.svg +0 -11
- package/docs/.island/dist/assets/test-your-project.18bd4582.js +0 -190
- package/docs/.island/dist/assets/test-your-project.f53bebf7.js +0 -190
- package/docs/.island/dist/assets/test.0da1f99f.js +0 -67
- package/docs/.island/dist/assets/test.0e81f002.js +0 -66
- package/docs/.island/dist/assets/translator.b1077c44.svg +0 -1
- package/docs/.island/dist/assets/use-micro-generator.7d9e4016.js +0 -60
- package/docs/.island/dist/assets/use-micro-generator.db5520c1.js +0 -60
- package/docs/.island/dist/assets/using-storybook.57ea6b77.js +0 -260
- package/docs/.island/dist/assets/using-storybook.a2212f2e.js +0 -260
- package/docs/.island/dist/assets/welcome.0449a9c8.js +0 -13
- package/docs/.island/dist/assets/welcome.a8448931.js +0 -13
- package/docs/.island/dist/assets/why-module-engineering-solution.6ae8c0e3.js +0 -26
- package/docs/.island/dist/assets/why-module-engineering-solution.c9a45cbd.js +0 -26
- package/docs/.island/dist/chunk-COLCRJ2V.js +0 -1
- package/docs/.island/dist/chunk-K5FMOYDC.js +0 -10
- package/docs/.island/dist/chunk-WE42KMYS.js +0 -26
- package/docs/.island/dist/client-entry.js +0 -3
- package/docs/.island/dist/en/api/build-config.html +0 -344
- package/docs/.island/dist/en/api/build-preset.html +0 -82
- package/docs/.island/dist/en/api/design-system.html +0 -155
- package/docs/.island/dist/en/api/dev.html +0 -45
- package/docs/.island/dist/en/api/index.html +0 -41
- package/docs/.island/dist/en/api/plugin.html +0 -48
- package/docs/.island/dist/en/api/test.html +0 -58
- package/docs/.island/dist/en/guide/before-getting-started.html +0 -127
- package/docs/.island/dist/en/guide/build-your-ui.html +0 -41
- package/docs/.island/dist/en/guide/command-preview.html +0 -100
- package/docs/.island/dist/en/guide/extension.html +0 -41
- package/docs/.island/dist/en/guide/getting-started.html +0 -76
- package/docs/.island/dist/en/guide/modify-output-product.html +0 -140
- package/docs/.island/dist/en/guide/publish-your-project.html +0 -91
- package/docs/.island/dist/en/guide/test-your-project.html +0 -72
- package/docs/.island/dist/en/guide/use-micro-generator.html +0 -65
- package/docs/.island/dist/en/guide/using-storybook.html +0 -113
- package/docs/.island/dist/en/guide/welcome.html +0 -53
- package/docs/.island/dist/en/guide/why-module-engineering-solution.html +0 -49
- package/docs/.island/dist/en/index.html +0 -42
- package/docs/.island/dist/react-dom.js +0 -1
- package/docs/.island/dist/react-dom_client.js +0 -1
- package/docs/.island/dist/react.js +0 -1
- package/docs/.island/dist/react_jsx-runtime.js +0 -10
- package/docs/.island/dist/ssr-manifest.json +0 -57
- package/docs/.island/dist/test-result.png +0 -0
- package/docs/.island/dist/why-module-solution.png +0 -0
- package/docs/.island/dist/zh/api/build-config.html +0 -347
- package/docs/.island/dist/zh/api/build-preset.html +0 -82
- package/docs/.island/dist/zh/api/design-system.html +0 -149
- package/docs/.island/dist/zh/api/dev.html +0 -46
- package/docs/.island/dist/zh/api/index.html +0 -41
- package/docs/.island/dist/zh/api/plugin.html +0 -48
- package/docs/.island/dist/zh/api/test.html +0 -59
- package/docs/.island/dist/zh/guide/before-getting-started.html +0 -127
- package/docs/.island/dist/zh/guide/build-your-ui.html +0 -41
- package/docs/.island/dist/zh/guide/command-preview.html +0 -100
- package/docs/.island/dist/zh/guide/extension.html +0 -41
- package/docs/.island/dist/zh/guide/getting-started.html +0 -79
- package/docs/.island/dist/zh/guide/modify-output-product.html +0 -140
- package/docs/.island/dist/zh/guide/publish-your-project.html +0 -92
- package/docs/.island/dist/zh/guide/test-your-project.html +0 -72
- package/docs/.island/dist/zh/guide/use-micro-generator.html +0 -65
- package/docs/.island/dist/zh/guide/using-storybook.html +0 -114
- package/docs/.island/dist/zh/guide/welcome.html +0 -53
- package/docs/.island/dist/zh/guide/why-module-engineering-solution.html +0 -49
- package/docs/.island/dist/zh/index.html +0 -42
- package/docs/.island/index.html +0 -39
- package/docs/en/api/design-system.md +0 -524
- package/docs/en/api/dev.md +0 -32
- package/docs/en/api/plugin.md +0 -34
- package/docs/zh/api/build-config.md +0 -570
- package/docs/zh/api/dev.md +0 -33
- package/docs/zh/api/plugins.md +0 -108
|
@@ -0,0 +1,501 @@
|
|
|
1
|
+
# Plugin Hooks
|
|
2
|
+
|
|
3
|
+
This chapter describes the lifecycle hooks supported by module-tools.
|
|
4
|
+
|
|
5
|
+
Currently there are two main types of lifecycle hooks.
|
|
6
|
+
|
|
7
|
+
* Build hooks: triggered only when the `build` command is executed to build the source code product.
|
|
8
|
+
* `buildPlatform` hook: triggered only when the `build --platform` command is executed to generate other build products.
|
|
9
|
+
* dev hooks: hooks that are triggered when running the `dev` command.
|
|
10
|
+
|
|
11
|
+
## build hooks
|
|
12
|
+
|
|
13
|
+
The following Hooks are triggered in order when the `build` command is executed.
|
|
14
|
+
|
|
15
|
+
* `beforeBuild`
|
|
16
|
+
* `beforeBuildTask`
|
|
17
|
+
* `afterBuildTask`
|
|
18
|
+
* `afterBuild`
|
|
19
|
+
|
|
20
|
+
### `beforeBuild`
|
|
21
|
+
|
|
22
|
+
Triggered before the execution of the overall build process.
|
|
23
|
+
|
|
24
|
+
``` ts
|
|
25
|
+
export default (): CliPlugin<ModuleTools> => ({
|
|
26
|
+
name: 'my-plugin',
|
|
27
|
+
|
|
28
|
+
setup() {
|
|
29
|
+
return {
|
|
30
|
+
beforeBuild(options: Options): Return {
|
|
31
|
+
return options.config;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Parameters and return value types.
|
|
39
|
+
|
|
40
|
+
``` ts
|
|
41
|
+
type Options = { options: { config: BuildConfig; cliOptions: BuildCommandOptions } }
|
|
42
|
+
|
|
43
|
+
export interface BuildCommandOptions {
|
|
44
|
+
config: string;
|
|
45
|
+
clear?: boolean;
|
|
46
|
+
dts?: boolean;
|
|
47
|
+
platform?: boolean | string[];
|
|
48
|
+
tsconfig: string;
|
|
49
|
+
watch?: boolean;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
type Return = BuildConfig;
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
> `BuildConfig` type reference [API configuration](en/api/)
|
|
56
|
+
|
|
57
|
+
### `beforeBuildTask`
|
|
58
|
+
|
|
59
|
+
Based on the build configuration, Module Tools will split the overall build into multiple sub-build tasks. The Hook will be triggered before each build subtask.
|
|
60
|
+
|
|
61
|
+
``` ts
|
|
62
|
+
export default (): CliPlugin<ModuleTools> => ({
|
|
63
|
+
name: 'my-plugin',
|
|
64
|
+
|
|
65
|
+
setup() {
|
|
66
|
+
return {
|
|
67
|
+
beforeBuildTask(config: BaseBuildConfig): BaseBuildConfig {
|
|
68
|
+
return config;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Parameters and return value types.
|
|
76
|
+
|
|
77
|
+
`BaseBuildConfig` type reference [API configuration](en/api/)
|
|
78
|
+
|
|
79
|
+
### `afterBuildTask`
|
|
80
|
+
|
|
81
|
+
Triggered after the end of each build subtask.
|
|
82
|
+
|
|
83
|
+
``` ts
|
|
84
|
+
export default (): CliPlugin<ModuleTools> => ({
|
|
85
|
+
name: 'my-plugin',
|
|
86
|
+
|
|
87
|
+
setup() {
|
|
88
|
+
return {
|
|
89
|
+
afterBuildTask(options: BuildTaskResult): void {
|
|
90
|
+
// ...
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Parameters and return value types.
|
|
98
|
+
|
|
99
|
+
``` ts
|
|
100
|
+
export interface BuildTaskResult {
|
|
101
|
+
status: 'success' | 'fail';
|
|
102
|
+
message?: string;
|
|
103
|
+
config: BaseBuildConfig;
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### `afterBuild`
|
|
108
|
+
|
|
109
|
+
Triggered after the end of the overall build process.
|
|
110
|
+
|
|
111
|
+
``` ts
|
|
112
|
+
export default (): CliPlugin<ModuleTools> => ({
|
|
113
|
+
name: 'my-plugin',
|
|
114
|
+
|
|
115
|
+
setup() {
|
|
116
|
+
return {
|
|
117
|
+
afterBuild(options: BuildResult): void {
|
|
118
|
+
// ...
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Parameters and return value types.
|
|
126
|
+
|
|
127
|
+
``` ts
|
|
128
|
+
export interface BuildResult {
|
|
129
|
+
status: 'success' | 'fail';
|
|
130
|
+
message?: string;
|
|
131
|
+
config: BuildConfig;
|
|
132
|
+
commandOptions: BuildCommandOptions;
|
|
133
|
+
totalDuration: number;
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## buildPlatform hooks
|
|
138
|
+
|
|
139
|
+
module-tools also provides the `build --platform` command to perform specific build tasks.
|
|
140
|
+
|
|
141
|
+
For example, after installing the Storybook plugin, you can run `build --platform` or `build --platform storybook` to perform Storybook build tasks. This is because the Storybook plugin is based on the buildPlatform Hooks.
|
|
142
|
+
|
|
143
|
+
Hooks are triggered in the following order after executing `build --platform`.
|
|
144
|
+
|
|
145
|
+
* `registerBuildPlatform`
|
|
146
|
+
* `beforeBuildPlatform`
|
|
147
|
+
* `buildPlatform`
|
|
148
|
+
* `afterBuildPlatform`
|
|
149
|
+
|
|
150
|
+
### `registerBuildPlatform`
|
|
151
|
+
|
|
152
|
+
Gets information about the tasks that need to be run when executing the `build --platform` command.
|
|
153
|
+
|
|
154
|
+
``` ts
|
|
155
|
+
export default (): CliPlugin<ModuleTools> => ({
|
|
156
|
+
name: 'my-plugin',
|
|
157
|
+
|
|
158
|
+
setup() {
|
|
159
|
+
return {
|
|
160
|
+
registerBuildPlatform(): RegisterBuildPlatformResult {
|
|
161
|
+
// ...
|
|
162
|
+
return {
|
|
163
|
+
platform: 'stroybook',
|
|
164
|
+
build() {
|
|
165
|
+
// run storybook logic
|
|
166
|
+
},
|
|
167
|
+
}, };
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
},
|
|
171
|
+
});
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Types of parameters entered and returned.
|
|
175
|
+
|
|
176
|
+
``` ts
|
|
177
|
+
export interface RegisterBuildPlatformResult {
|
|
178
|
+
platform: string | string[];
|
|
179
|
+
build: (
|
|
180
|
+
currentPlatform: string, // the currently running platform build task
|
|
181
|
+
context: { isTsProject: boolean },
|
|
182
|
+
) => void | Promise<void>;
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### `beforeBuildPlatform`
|
|
187
|
+
|
|
188
|
+
Triggers all registered build tasks when the `build --platform` command is executed. `beforeBuildPlatform` will be triggered before the execution of the overall build task.
|
|
189
|
+
|
|
190
|
+
``` ts
|
|
191
|
+
export default (): CliPlugin<ModuleTools> => ({
|
|
192
|
+
name: 'my-plugin',
|
|
193
|
+
|
|
194
|
+
setup() {
|
|
195
|
+
return {
|
|
196
|
+
beforeBuildPlatform(platforms: RegisterBuildPlatformResult[]): void {
|
|
197
|
+
console.info(`have ${platforms.length} platform tasks`);
|
|
198
|
+
},
|
|
199
|
+
};
|
|
200
|
+
},
|
|
201
|
+
});
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Types of parameters entered and returned.
|
|
205
|
+
|
|
206
|
+
``` ts
|
|
207
|
+
export interface RegisterBuildPlatformResult {
|
|
208
|
+
platform: string | string[];
|
|
209
|
+
build: (
|
|
210
|
+
currentPlatform: string, // the currently running platform build task
|
|
211
|
+
context: { isTsProject: boolean },
|
|
212
|
+
) => void | Promise<void>;
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### `buildPlatform`
|
|
217
|
+
|
|
218
|
+
When the `build --platform` command is executed, all registered build tasks will be triggered. `buildPlatform` will be triggered before each build task is executed.
|
|
219
|
+
|
|
220
|
+
``` ts
|
|
221
|
+
export default (): CliPlugin<ModuleTools> => ({
|
|
222
|
+
name: 'my-plugin',
|
|
223
|
+
|
|
224
|
+
setup() {
|
|
225
|
+
return {
|
|
226
|
+
buildPlatform({ platform }: Options): void {
|
|
227
|
+
console.info(`current task is ${platform}`);
|
|
228
|
+
},
|
|
229
|
+
};
|
|
230
|
+
},
|
|
231
|
+
});
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
Types of parameters entered and returned.
|
|
235
|
+
|
|
236
|
+
``` ts
|
|
237
|
+
export interface Options {
|
|
238
|
+
platform: string;
|
|
239
|
+
}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### `afterBuildPlatform`
|
|
243
|
+
|
|
244
|
+
When the `build --platform` command is executed, all registered build tasks will be triggered. `afterBuildPlatform` will be triggered after the overall platform build task is finished.
|
|
245
|
+
|
|
246
|
+
``` ts
|
|
247
|
+
export default (): CliPlugin<ModuleTools> => ({
|
|
248
|
+
name: 'my-plugin',
|
|
249
|
+
|
|
250
|
+
setup() {
|
|
251
|
+
return {
|
|
252
|
+
afterBuildPlatform(result: BuildPlatformResult): void {
|
|
253
|
+
if (result.status === 'success') {
|
|
254
|
+
console.info(`all platform build task success`);
|
|
255
|
+
} else {
|
|
256
|
+
console.error(result.message);
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
};
|
|
260
|
+
},
|
|
261
|
+
});
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
Types of parameters entered and returned.
|
|
265
|
+
|
|
266
|
+
```ts
|
|
267
|
+
export interface BuildPlatformResult {
|
|
268
|
+
status: 'success' | 'fail';
|
|
269
|
+
message: string | Error | null;
|
|
270
|
+
}
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
## Dev Hooks
|
|
274
|
+
|
|
275
|
+
The following Hooks are triggered in order when the `dev` command is executed.
|
|
276
|
+
|
|
277
|
+
- `registerDev`: triggered when getting dev function information.
|
|
278
|
+
- `beforeDev`: Triggered before starting the dev process as a whole.
|
|
279
|
+
- `beforeDevMenu`: triggered before the dev list/menu appears.
|
|
280
|
+
- `afterDevMenu`: triggered after dev list/menu option is selected.
|
|
281
|
+
- `beforeDevTask`: Triggered before executing the dev task.
|
|
282
|
+
- `afterDev`: Triggered at the end of the overall dev process.
|
|
283
|
+
|
|
284
|
+
### `registerDev`.
|
|
285
|
+
|
|
286
|
+
Register dev tool related data. Mainly contains.
|
|
287
|
+
|
|
288
|
+
* the name of the dev tool
|
|
289
|
+
* The name of the item displayed in the menu list and the corresponding value.
|
|
290
|
+
* The definition of the `dev` subcommand.
|
|
291
|
+
* Whether to execute the source code build before running the dev task
|
|
292
|
+
* The function to execute the dev task.
|
|
293
|
+
|
|
294
|
+
``` ts
|
|
295
|
+
export default (): CliPlugin<ModuleTools> => ({
|
|
296
|
+
name: 'my-plugin',
|
|
297
|
+
|
|
298
|
+
setup() {
|
|
299
|
+
return {
|
|
300
|
+
registerDev() {
|
|
301
|
+
return {
|
|
302
|
+
// Dev tool name
|
|
303
|
+
name: 'storybook',
|
|
304
|
+
// Menu content
|
|
305
|
+
menuItem: {
|
|
306
|
+
name: 'Storybook',
|
|
307
|
+
value: 'storybook',
|
|
308
|
+
},
|
|
309
|
+
// Defined dev subcommands
|
|
310
|
+
subCommands: ['storybook', 'story'],
|
|
311
|
+
async action() {
|
|
312
|
+
// dev logic
|
|
313
|
+
},
|
|
314
|
+
};
|
|
315
|
+
},
|
|
316
|
+
};
|
|
317
|
+
},
|
|
318
|
+
});
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
Types of parameters entered and returned.
|
|
322
|
+
|
|
323
|
+
``` ts
|
|
324
|
+
export interface DevToolData {
|
|
325
|
+
name: string;
|
|
326
|
+
subCommands?: string[];
|
|
327
|
+
menuItem?: {
|
|
328
|
+
name: string;
|
|
329
|
+
value: string;
|
|
330
|
+
};
|
|
331
|
+
// Whether to disable the source build before the dev command is executed
|
|
332
|
+
disableRunBuild?: boolean;
|
|
333
|
+
action: (
|
|
334
|
+
options: { port?: string },
|
|
335
|
+
context: { isTsProject?: boolean },
|
|
336
|
+
) => void | Promise<void>;
|
|
337
|
+
}
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
:::tip{title='About disableRunBuild configuration'}
|
|
341
|
+
When dev a project, it may be possible to set `disableRunBuild: true` to disable build tasks for source execution (in listening mode) if you only need to dev code functionality.
|
|
342
|
+
|
|
343
|
+
The currently supported Storybook dev supports using source code products as dev objects, so `disableRunBuild: false` in the Storybook plugin.
|
|
344
|
+
:::
|
|
345
|
+
|
|
346
|
+
### `beforeDev`
|
|
347
|
+
|
|
348
|
+
Triggered before the dev task is executed after all dev tool metadata has been collected.
|
|
349
|
+
|
|
350
|
+
``` ts
|
|
351
|
+
export default (): CliPlugin<ModuleTools> => ({
|
|
352
|
+
name: 'my-plugin',
|
|
353
|
+
|
|
354
|
+
setup() {
|
|
355
|
+
return {
|
|
356
|
+
beforeDev(metas: DevToolData[]) {
|
|
357
|
+
console.info(`have ${metas.length} dev tools`);
|
|
358
|
+
},
|
|
359
|
+
};
|
|
360
|
+
},
|
|
361
|
+
});
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
Types of parameters entered and returned.
|
|
365
|
+
|
|
366
|
+
``` ts
|
|
367
|
+
export interface DevToolData {
|
|
368
|
+
name: string;
|
|
369
|
+
subCommands?: string[];
|
|
370
|
+
menuItem?: {
|
|
371
|
+
name: string;
|
|
372
|
+
value: string;
|
|
373
|
+
};
|
|
374
|
+
// Whether to disable the source build before the dev command is executed
|
|
375
|
+
disableRunBuild?: boolean;
|
|
376
|
+
action: (
|
|
377
|
+
options: { port?: string },
|
|
378
|
+
context: { isTsProject?: boolean },
|
|
379
|
+
) => void | Promise<void>;
|
|
380
|
+
}
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
### `(before|after)DevMenu`
|
|
384
|
+
|
|
385
|
+
`beforeDevMenu` is triggered before the dev list/menu appears. Receives [inquirer question](https://github.com/SBoudrias/Inquirer.js#question) as argument. Default value is.
|
|
386
|
+
|
|
387
|
+
``` ts
|
|
388
|
+
const question = [
|
|
389
|
+
{
|
|
390
|
+
name: 'choiceDevTool',
|
|
391
|
+
message: 'Select dev tool',
|
|
392
|
+
type: 'list',
|
|
393
|
+
// Registered dev messages
|
|
394
|
+
choices,
|
|
395
|
+
},
|
|
396
|
+
];
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
`afterDevMenu` Triggered after selecting dev list/menu options.
|
|
400
|
+
|
|
401
|
+
``` ts
|
|
402
|
+
export default (): CliPlugin<ModuleTools> => ({
|
|
403
|
+
name: 'my-plugin',
|
|
404
|
+
|
|
405
|
+
setup() {
|
|
406
|
+
return {
|
|
407
|
+
beforeDevMenu(questions) {
|
|
408
|
+
questions[0].message += '!' ;
|
|
409
|
+
return questions; // required
|
|
410
|
+
},
|
|
411
|
+
afterDevMenu(options: Options) {
|
|
412
|
+
console.info(`choise ${options.result.choiceDevTool} dev tools`);
|
|
413
|
+
}
|
|
414
|
+
};
|
|
415
|
+
},
|
|
416
|
+
});
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
Types of parameters entered and returned.
|
|
420
|
+
|
|
421
|
+
``` ts
|
|
422
|
+
export type { QuestionCollection } from 'inquirer';
|
|
423
|
+
|
|
424
|
+
export interface Options {
|
|
425
|
+
result: PromptResult;
|
|
426
|
+
devTools: DevToolData[];
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
export type PromptResult = { choiceDevTool: string }
|
|
430
|
+
export interface DevToolData {
|
|
431
|
+
name: string;
|
|
432
|
+
subCommands?: string[];
|
|
433
|
+
menuItem?: {
|
|
434
|
+
name: string;
|
|
435
|
+
value: string;
|
|
436
|
+
};
|
|
437
|
+
// Whether to disable the source build before the dev command is executed
|
|
438
|
+
disableRunBuild?: boolean;
|
|
439
|
+
action: (
|
|
440
|
+
options: { port?: string },
|
|
441
|
+
context: { isTsProject?: boolean },
|
|
442
|
+
) => void | Promise<void>;
|
|
443
|
+
}
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
### `beforeDevTask`
|
|
447
|
+
|
|
448
|
+
Triggered before the dev task is executed.
|
|
449
|
+
|
|
450
|
+
``` ts
|
|
451
|
+
export default (): CliPlugin<ModuleTools> => ({
|
|
452
|
+
name: 'my-plugin',
|
|
453
|
+
|
|
454
|
+
setup() {
|
|
455
|
+
return {
|
|
456
|
+
beforeDevTask(currentDevData: DevToolData) {
|
|
457
|
+
console.info(`${currentDevData.name} running`);
|
|
458
|
+
},
|
|
459
|
+
};
|
|
460
|
+
},
|
|
461
|
+
});
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
Types of parameters entered and returned.
|
|
465
|
+
|
|
466
|
+
``` ts
|
|
467
|
+
export interface DevToolData {
|
|
468
|
+
name: string;
|
|
469
|
+
subCommands?: string[];
|
|
470
|
+
menuItem?: {
|
|
471
|
+
name: string;
|
|
472
|
+
value: string;
|
|
473
|
+
};
|
|
474
|
+
// Whether to disable the source build before the dev command is executed
|
|
475
|
+
disableRunBuild?: boolean;
|
|
476
|
+
action: (
|
|
477
|
+
options: { port?: string },
|
|
478
|
+
context: { isTsProject?: boolean },
|
|
479
|
+
) => void | Promise<void>;
|
|
480
|
+
}
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
### `afterDev`
|
|
484
|
+
|
|
485
|
+
Triggered when the dev task process is interrupted.
|
|
486
|
+
|
|
487
|
+
``` ts
|
|
488
|
+
export default (): CliPlugin<ModuleTools> => ({
|
|
489
|
+
name: 'my-plugin',
|
|
490
|
+
|
|
491
|
+
setup() {
|
|
492
|
+
return {
|
|
493
|
+
afterDev() {
|
|
494
|
+
console.info(`exit!`);
|
|
495
|
+
},
|
|
496
|
+
};
|
|
497
|
+
},
|
|
498
|
+
});
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
|
|
@@ -1,79 +1,89 @@
|
|
|
1
|
+
---
|
|
2
|
+
sidebar_position: 6
|
|
3
|
+
---
|
|
4
|
+
|
|
1
5
|
# Handle static resource files
|
|
2
6
|
|
|
3
|
-
The module project will handle static resources used in the code. If configuration is required, then the [`buildConfig.asset`](/en/api/build-config#asset) API can be used.
|
|
7
|
+
The module project will handle static resources used in the code. If configuration is required, then the [`buildConfig.asset`](/en/api/config/build-config#asset) API can be used.
|
|
4
8
|
|
|
5
9
|
## Default behavior
|
|
6
10
|
|
|
7
11
|
By default, module projects are processed for the following static resources:
|
|
8
12
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
13
|
+
- `'.svg'`、`'.png'`、`'.jpg'`、`'.jpeg'`、`'.gif'`、`'.webp'`
|
|
14
|
+
- `'.ttf'`、`'.otf'`、`'.woff'`、`'.woff2'`、`'.eot'`
|
|
15
|
+
- `'.mp3'`、`'.mp4'`、`'.webm'`、`'.ogg'`、`'.wav'`、`'.flac'`、`'.aac'`、`'.mov'`
|
|
12
16
|
|
|
13
17
|
For the handling of static files, the module project currently supports the following functions.
|
|
14
18
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
- Set the static resource path to `. /assets`.
|
|
20
|
+
- For files over **10kb** they are inlined into the code.
|
|
21
|
+
- Use [SVGR](https://react-svgr.com/) for files with the `.svg` suffix.
|
|
18
22
|
|
|
19
23
|
Let us look at the following example:
|
|
20
24
|
|
|
21
25
|
<CH.Spotlight>
|
|
22
26
|
|
|
23
|
-
```
|
|
27
|
+
```ts ./src/asset.ts
|
|
24
28
|
import img from './bg.png';
|
|
25
29
|
//...
|
|
26
30
|
```
|
|
27
31
|
|
|
28
32
|
---
|
|
33
|
+
|
|
29
34
|
Project source code.
|
|
30
35
|
|
|
31
|
-
```
|
|
36
|
+
```ts ./src/asset.ts
|
|
32
37
|
import img from './bg.png';
|
|
33
38
|
//...
|
|
34
39
|
```
|
|
40
|
+
|
|
35
41
|
---
|
|
42
|
+
|
|
36
43
|
If the size of `bg.png` is less than 10 kb, then the product directory structure and product content are.
|
|
37
44
|
|
|
38
45
|
<CH.Code>
|
|
39
46
|
|
|
40
|
-
```
|
|
47
|
+
```bash
|
|
41
48
|
./dist
|
|
42
49
|
└── asset.js
|
|
43
50
|
```
|
|
51
|
+
|
|
44
52
|
---
|
|
45
53
|
|
|
46
|
-
```
|
|
47
|
-
var bg_default =
|
|
54
|
+
```js ./dist/asset.js
|
|
55
|
+
var bg_default = 'data:image/png;base64,';
|
|
48
56
|
console.info(bg_default);
|
|
49
57
|
```
|
|
58
|
+
|
|
50
59
|
</CH.Code>
|
|
51
|
-
---
|
|
52
60
|
|
|
53
61
|
If the size of `bg.png` is larger than 10 kb, then the product directory structure and product content are.
|
|
54
62
|
|
|
55
63
|
<CH.Code>
|
|
56
64
|
|
|
57
|
-
```
|
|
65
|
+
```bash
|
|
58
66
|
./dist
|
|
59
67
|
├── asset.js
|
|
60
68
|
└── assets
|
|
61
69
|
└── bg.13e2aba2.png
|
|
62
70
|
```
|
|
71
|
+
|
|
63
72
|
---
|
|
64
73
|
|
|
65
|
-
```
|
|
66
|
-
var bg_default =
|
|
74
|
+
```js ./dist/asset.js
|
|
75
|
+
var bg_default = 'assets/bg.13e2aba2.png';
|
|
67
76
|
console.info(bg_default);
|
|
68
77
|
```
|
|
78
|
+
|
|
69
79
|
</CH.Code>
|
|
70
80
|
|
|
71
81
|
</CH.Spotlight>
|
|
72
82
|
|
|
73
83
|
When wanting to modify the default behavior, the following API can be used:
|
|
74
84
|
|
|
75
|
-
|
|
76
|
-
|
|
85
|
+
- `asset.path`: modify the output path of the static resource file.
|
|
86
|
+
- `asset.limit`: modify the threshold value for inline static resource files.
|
|
77
87
|
|
|
78
88
|
## Setting CDN Prefix
|
|
79
89
|
|
|
@@ -83,21 +93,24 @@ Then we need to add the CDN base path in front of the path to the static resourc
|
|
|
83
93
|
|
|
84
94
|
<CH.Spotlight>
|
|
85
95
|
|
|
86
|
-
```
|
|
96
|
+
```ts ./src/asset.ts
|
|
87
97
|
import img from './bg.png';
|
|
88
98
|
//...
|
|
89
99
|
```
|
|
90
100
|
|
|
91
101
|
---
|
|
102
|
+
|
|
92
103
|
Project source code.
|
|
93
104
|
|
|
94
|
-
```
|
|
105
|
+
```ts ./src/asset.ts
|
|
106
|
+
|
|
95
107
|
```
|
|
108
|
+
|
|
96
109
|
---
|
|
97
110
|
|
|
98
111
|
`modern.config` config file。
|
|
99
112
|
|
|
100
|
-
```
|
|
113
|
+
```ts ./modern.config.ts
|
|
101
114
|
export default defineConfig({
|
|
102
115
|
buildConfig: {
|
|
103
116
|
format: 'umd',
|
|
@@ -112,16 +125,20 @@ export default defineConfig({
|
|
|
112
125
|
|
|
113
126
|
If the size of `bg.png` is larger than 10 kb, then the product content will be.
|
|
114
127
|
|
|
115
|
-
```
|
|
116
|
-
(function(global, factory) {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
128
|
+
```js ./dist/asset.js focus=7:7
|
|
129
|
+
(function (global, factory) {
|
|
130
|
+
if (typeof module === 'object' && typeof module.exports === 'object')
|
|
131
|
+
factory();
|
|
132
|
+
else if (typeof define === 'function' && define.amd) define([], factory);
|
|
133
|
+
else if (
|
|
134
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self)
|
|
135
|
+
)
|
|
136
|
+
factory();
|
|
137
|
+
})(this, function () {
|
|
138
|
+
'use strict';
|
|
139
|
+
var bg_default = 'http://cdn/assets/bg.13e2aba2.png';
|
|
140
|
+
// src/asset.tsx
|
|
141
|
+
console.info(bg_default);
|
|
125
142
|
});
|
|
126
143
|
```
|
|
127
144
|
|