@modern-js/module-tools-docs 2.2.0-beta.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.
Files changed (212) hide show
  1. package/doc_build/static/css/main.css +3 -3
  2. package/doc_build/static/css/main.css.map +1 -1
  3. package/doc_build/static/js/async/en_api_config_build-config.js +2 -2
  4. package/doc_build/static/js/async/en_api_config_build-preset.js +2 -2
  5. package/doc_build/static/js/async/en_api_config_design-system.js +2 -2
  6. package/doc_build/static/js/async/en_api_config_plugins.js +2 -2
  7. package/doc_build/static/js/async/en_api_config_testing.js +2 -2
  8. package/doc_build/static/js/async/en_api_plugin-api_plugin-hooks.js +2 -2
  9. package/doc_build/static/js/async/en_guide_advance_asset.js +2 -2
  10. package/doc_build/static/js/async/en_guide_advance_build-umd.js +4 -4
  11. package/doc_build/static/js/async/en_guide_advance_copy.js +3 -3
  12. package/doc_build/static/js/async/en_guide_advance_external-dependency.js +4 -4
  13. package/doc_build/static/js/async/en_guide_advance_in-depth-about-build.js +5 -5
  14. package/doc_build/static/js/async/en_guide_advance_in-depth-about-dev-command.js +2455 -75
  15. package/doc_build/static/js/async/en_guide_advance_in-depth-about-dev-command.js.map +1 -1
  16. package/doc_build/static/js/async/en_guide_advance_theme-config.js +3 -3
  17. package/doc_build/static/js/async/en_guide_basic_before-getting-started.js +14 -152
  18. package/doc_build/static/js/async/en_guide_basic_before-getting-started.js.map +1 -1
  19. package/doc_build/static/js/async/en_guide_basic_command-preview.js +8 -8
  20. package/doc_build/static/js/async/en_guide_basic_modify-output-product.js +126 -37
  21. package/doc_build/static/js/async/en_guide_basic_modify-output-product.js.map +1 -1
  22. package/doc_build/static/js/async/en_guide_basic_publish-your-project.js +2 -2
  23. package/doc_build/static/js/async/en_guide_basic_test-your-project.js +2 -2
  24. package/doc_build/static/js/async/en_guide_basic_use-micro-generator.js +2791 -4
  25. package/doc_build/static/js/async/en_guide_basic_use-micro-generator.js.map +1 -1
  26. package/doc_build/static/js/async/en_guide_basic_using-storybook.js +10 -10
  27. package/doc_build/static/js/async/en_guide_best-practices_components.js +3 -3
  28. package/doc_build/static/js/async/en_guide_intro_getting-started.js +2 -2
  29. package/doc_build/static/js/async/en_plugins_guide_getting-started.js +2 -2
  30. package/doc_build/static/js/async/en_plugins_guide_plugin-object.js +2 -2
  31. package/doc_build/static/js/async/en_plugins_guide_setup-function.js +2 -2
  32. package/doc_build/static/js/async/zh_api_config_build-config.js +2 -2
  33. package/doc_build/static/js/async/zh_api_config_build-preset.js +2 -2
  34. package/doc_build/static/js/async/zh_api_config_design-system.js +2 -2
  35. package/doc_build/static/js/async/zh_api_config_plugins.js +2 -2
  36. package/doc_build/static/js/async/zh_api_config_testing.js +2 -2
  37. package/doc_build/static/js/async/zh_api_plugin-api_plugin-hooks.js +2 -2
  38. package/doc_build/static/js/async/zh_guide_advance_asset.js +2 -2
  39. package/doc_build/static/js/async/zh_guide_advance_build-umd.js +2 -2
  40. package/doc_build/static/js/async/zh_guide_advance_copy.js +3 -3
  41. package/doc_build/static/js/async/zh_guide_advance_external-dependency.js +3 -3
  42. package/doc_build/static/js/async/zh_guide_advance_in-depth-about-build.js +5 -5
  43. package/doc_build/static/js/async/zh_guide_advance_in-depth-about-dev-command.js +2450 -74
  44. package/doc_build/static/js/async/zh_guide_advance_in-depth-about-dev-command.js.map +1 -1
  45. package/doc_build/static/js/async/zh_guide_advance_theme-config.js +3 -3
  46. package/doc_build/static/js/async/zh_guide_basic_before-getting-started.js +14 -152
  47. package/doc_build/static/js/async/zh_guide_basic_before-getting-started.js.map +1 -1
  48. package/doc_build/static/js/async/zh_guide_basic_command-preview.js +8 -8
  49. package/doc_build/static/js/async/zh_guide_basic_modify-output-product.js +87 -9
  50. package/doc_build/static/js/async/zh_guide_basic_modify-output-product.js.map +1 -1
  51. package/doc_build/static/js/async/zh_guide_basic_publish-your-project.js +7 -7
  52. package/doc_build/static/js/async/zh_guide_basic_test-your-project.js +410 -11
  53. package/doc_build/static/js/async/zh_guide_basic_test-your-project.js.map +1 -1
  54. package/doc_build/static/js/async/zh_guide_basic_use-micro-generator.js +2790 -3
  55. package/doc_build/static/js/async/zh_guide_basic_use-micro-generator.js.map +1 -1
  56. package/doc_build/static/js/async/zh_guide_basic_using-storybook.js +496 -405
  57. package/doc_build/static/js/async/zh_guide_basic_using-storybook.js.map +1 -1
  58. package/doc_build/static/js/async/zh_guide_best-practices_components.js +4 -4
  59. package/doc_build/static/js/async/zh_guide_intro_getting-started.js +2 -2
  60. package/doc_build/static/js/async/zh_plugins_guide_getting-started.js +2 -2
  61. package/doc_build/static/js/async/zh_plugins_guide_plugin-object.js +2 -2
  62. package/doc_build/static/js/async/zh_plugins_guide_setup-function.js +2 -2
  63. package/doc_build/static/js/builder-runtime.js +1 -1
  64. package/doc_build/static/js/builder-runtime.js.map +1 -1
  65. package/doc_build/static/js/main.js +211 -211
  66. package/doc_build/static/js/main.js.map +1 -1
  67. 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 +70 -70
  68. 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 -1
  69. package/doc_build/static/search_index.json +1 -1
  70. package/docs/en/guide/advance/in-depth-about-dev-command.md +65 -12
  71. package/docs/en/guide/basic/before-getting-started.md +4 -14
  72. package/docs/en/guide/basic/command-preview.md +1 -1
  73. package/docs/en/guide/basic/modify-output-product.md +6 -2
  74. package/docs/en/guide/basic/use-micro-generator.md +62 -1
  75. package/docs/en/guide/basic/using-storybook.mdx +4 -4
  76. package/docs/zh/guide/advance/in-depth-about-dev-command.md +60 -13
  77. package/docs/zh/guide/basic/before-getting-started.md +4 -14
  78. package/docs/zh/guide/basic/command-preview.md +2 -2
  79. package/docs/zh/guide/basic/modify-output-product.md +5 -3
  80. package/docs/zh/guide/basic/publish-your-project.md +4 -4
  81. package/docs/zh/guide/basic/test-your-project.mdx +18 -5
  82. package/docs/zh/guide/basic/use-micro-generator.md +61 -1
  83. package/docs/zh/guide/basic/using-storybook.mdx +13 -10
  84. package/package.json +4 -4
  85. package/docs/.island/dist/404.html +0 -41
  86. package/docs/.island/dist/assets/asset.26aea654.js +0 -160
  87. package/docs/.island/dist/assets/asset.36e3d3c9.js +0 -160
  88. package/docs/.island/dist/assets/before-getting-started.0e863740.js +0 -87
  89. package/docs/.island/dist/assets/before-getting-started.2c6e6b8a.js +0 -87
  90. package/docs/.island/dist/assets/build-config.460d11d9.js +0 -804
  91. package/docs/.island/dist/assets/build-config.e155e534.js +0 -854
  92. package/docs/.island/dist/assets/build-preset.6c2c6c62.js +0 -256
  93. package/docs/.island/dist/assets/build-preset.d3da921d.js +0 -256
  94. package/docs/.island/dist/assets/build-umd.ba00f028.js +0 -264
  95. package/docs/.island/dist/assets/build-umd.edb9d163.js +0 -273
  96. package/docs/.island/dist/assets/command-preview.1dc93921.js +0 -264
  97. package/docs/.island/dist/assets/command-preview.ef7a9d01.js +0 -264
  98. package/docs/.island/dist/assets/components.esm.03560353.js +0 -9
  99. package/docs/.island/dist/assets/copy.28dc4d5f.js +0 -277
  100. package/docs/.island/dist/assets/copy.f4625565.js +0 -277
  101. package/docs/.island/dist/assets/design-system.8993234c.js +0 -1254
  102. package/docs/.island/dist/assets/design-system.b0ba163f.js +0 -639
  103. package/docs/.island/dist/assets/dev.b373b152.js +0 -37
  104. package/docs/.island/dist/assets/dev.b39fd42a.js +0 -37
  105. package/docs/.island/dist/assets/down.f35427d3.svg +0 -1
  106. package/docs/.island/dist/assets/extension.4bf3526b.js +0 -1
  107. package/docs/.island/dist/assets/extension.d64ed0b8.js +0 -469
  108. package/docs/.island/dist/assets/external-dependency.2ede7532.js +0 -156
  109. package/docs/.island/dist/assets/external-dependency.92ca89e0.js +0 -156
  110. package/docs/.island/dist/assets/getting-started.822cf0b2.js +0 -117
  111. package/docs/.island/dist/assets/getting-started.e2764829.js +0 -114
  112. package/docs/.island/dist/assets/github.3bf8ccee.svg +0 -1
  113. package/docs/.island/dist/assets/in-depth-about-build.94cc902d.js +0 -375
  114. package/docs/.island/dist/assets/in-depth-about-build.aa74de10.js +0 -374
  115. package/docs/.island/dist/assets/in-depth-about-dev-command.877bdb83.js +0 -33
  116. package/docs/.island/dist/assets/in-depth-about-dev-command.9736befd.js +0 -39
  117. package/docs/.island/dist/assets/index.01786ba7.js +0 -30
  118. package/docs/.island/dist/assets/index.6cef6f5f.js +0 -4
  119. package/docs/.island/dist/assets/index.cb118238.js +0 -36
  120. package/docs/.island/dist/assets/index.ccb6ce27.js +0 -4
  121. package/docs/.island/dist/assets/island_inject.69495876.js +0 -1
  122. package/docs/.island/dist/assets/island_inject.cdfb22d9.js +0 -1
  123. package/docs/.island/dist/assets/loading.8c9bb911.svg +0 -1
  124. package/docs/.island/dist/assets/modify-output-product.9e2394d7.js +0 -100
  125. package/docs/.island/dist/assets/modify-output-product.f363845a.js +0 -100
  126. package/docs/.island/dist/assets/moon.6b705924.svg +0 -3
  127. package/docs/.island/dist/assets/plugin.70a61997.js +0 -42
  128. package/docs/.island/dist/assets/plugin.80b12ee2.js +0 -42
  129. package/docs/.island/dist/assets/publish-your-project.7321c10e.js +0 -164
  130. package/docs/.island/dist/assets/publish-your-project.7326359f.js +0 -166
  131. package/docs/.island/dist/assets/right.89674cd7.svg +0 -1
  132. package/docs/.island/dist/assets/search.0aea6901.svg +0 -1
  133. package/docs/.island/dist/assets/search.11353245.js +0 -222
  134. package/docs/.island/dist/assets/search.a1b1cff3.js +0 -3
  135. package/docs/.island/dist/assets/search.f9025ced.js +0 -3
  136. package/docs/.island/dist/assets/style.09015a4b.css +0 -1
  137. package/docs/.island/dist/assets/style.2e5f7bc2.css +0 -1970
  138. package/docs/.island/dist/assets/sun.841dac10.svg +0 -11
  139. package/docs/.island/dist/assets/test-your-project.8ab2809e.js +0 -190
  140. package/docs/.island/dist/assets/test-your-project.9ae2a49e.js +0 -190
  141. package/docs/.island/dist/assets/test.2bfe276b.js +0 -66
  142. package/docs/.island/dist/assets/test.a2c00a3f.js +0 -67
  143. package/docs/.island/dist/assets/translator.b1077c44.svg +0 -1
  144. package/docs/.island/dist/assets/use-micro-generator.13c1a09f.js +0 -60
  145. package/docs/.island/dist/assets/use-micro-generator.dfe877f6.js +0 -60
  146. package/docs/.island/dist/assets/using-storybook.adb88cb8.js +0 -260
  147. package/docs/.island/dist/assets/using-storybook.b8e7dd04.js +0 -260
  148. package/docs/.island/dist/assets/welcome.94880043.js +0 -13
  149. package/docs/.island/dist/assets/welcome.b2140e7e.js +0 -13
  150. package/docs/.island/dist/assets/why-module-engineering-solution.bfe7981a.js +0 -26
  151. package/docs/.island/dist/assets/why-module-engineering-solution.e31cd19f.js +0 -26
  152. package/docs/.island/dist/chunk-COLCRJ2V.js +0 -1
  153. package/docs/.island/dist/chunk-K5FMOYDC.js +0 -10
  154. package/docs/.island/dist/chunk-WE42KMYS.js +0 -26
  155. package/docs/.island/dist/client-entry.js +0 -3
  156. package/docs/.island/dist/en/api/build-config.html +0 -344
  157. package/docs/.island/dist/en/api/build-preset.html +0 -82
  158. package/docs/.island/dist/en/api/design-system.html +0 -155
  159. package/docs/.island/dist/en/api/dev.html +0 -45
  160. package/docs/.island/dist/en/api/index.html +0 -41
  161. package/docs/.island/dist/en/api/plugin.html +0 -48
  162. package/docs/.island/dist/en/api/test.html +0 -58
  163. package/docs/.island/dist/en/guide/advance/asset.html +0 -68
  164. package/docs/.island/dist/en/guide/advance/build-umd.html +0 -72
  165. package/docs/.island/dist/en/guide/advance/copy.html +0 -82
  166. package/docs/.island/dist/en/guide/advance/extension.html +0 -41
  167. package/docs/.island/dist/en/guide/advance/external-dependency.html +0 -71
  168. package/docs/.island/dist/en/guide/advance/in-depth-about-build.html +0 -148
  169. package/docs/.island/dist/en/guide/advance/in-depth-about-dev-command.html +0 -51
  170. package/docs/.island/dist/en/guide/basic/before-getting-started.html +0 -127
  171. package/docs/.island/dist/en/guide/basic/command-preview.html +0 -100
  172. package/docs/.island/dist/en/guide/basic/modify-output-product.html +0 -140
  173. package/docs/.island/dist/en/guide/basic/publish-your-project.html +0 -91
  174. package/docs/.island/dist/en/guide/basic/test-your-project.html +0 -72
  175. package/docs/.island/dist/en/guide/basic/use-micro-generator.html +0 -65
  176. package/docs/.island/dist/en/guide/basic/using-storybook.html +0 -113
  177. package/docs/.island/dist/en/guide/intro/getting-started.html +0 -76
  178. package/docs/.island/dist/en/guide/intro/welcome.html +0 -53
  179. package/docs/.island/dist/en/guide/intro/why-module-engineering-solution.html +0 -49
  180. package/docs/.island/dist/en/index.html +0 -42
  181. package/docs/.island/dist/react-dom.js +0 -1
  182. package/docs/.island/dist/react-dom_client.js +0 -1
  183. package/docs/.island/dist/react.js +0 -1
  184. package/docs/.island/dist/react_jsx-runtime.js +0 -10
  185. package/docs/.island/dist/ssr-manifest.json +0 -57
  186. package/docs/.island/dist/test-result.png +0 -0
  187. package/docs/.island/dist/why-module-solution.png +0 -0
  188. package/docs/.island/dist/zh/api/build-config.html +0 -361
  189. package/docs/.island/dist/zh/api/build-preset.html +0 -82
  190. package/docs/.island/dist/zh/api/design-system.html +0 -149
  191. package/docs/.island/dist/zh/api/dev.html +0 -46
  192. package/docs/.island/dist/zh/api/index.html +0 -41
  193. package/docs/.island/dist/zh/api/plugin.html +0 -48
  194. package/docs/.island/dist/zh/api/test.html +0 -59
  195. package/docs/.island/dist/zh/guide/advance/asset.html +0 -68
  196. package/docs/.island/dist/zh/guide/advance/build-umd.html +0 -72
  197. package/docs/.island/dist/zh/guide/advance/copy.html +0 -82
  198. package/docs/.island/dist/zh/guide/advance/extension.html +0 -127
  199. package/docs/.island/dist/zh/guide/advance/external-dependency.html +0 -71
  200. package/docs/.island/dist/zh/guide/advance/in-depth-about-build.html +0 -148
  201. package/docs/.island/dist/zh/guide/advance/in-depth-about-dev-command.html +0 -53
  202. package/docs/.island/dist/zh/guide/basic/before-getting-started.html +0 -127
  203. package/docs/.island/dist/zh/guide/basic/command-preview.html +0 -100
  204. package/docs/.island/dist/zh/guide/basic/modify-output-product.html +0 -140
  205. package/docs/.island/dist/zh/guide/basic/publish-your-project.html +0 -92
  206. package/docs/.island/dist/zh/guide/basic/test-your-project.html +0 -72
  207. package/docs/.island/dist/zh/guide/basic/use-micro-generator.html +0 -65
  208. package/docs/.island/dist/zh/guide/basic/using-storybook.html +0 -114
  209. package/docs/.island/dist/zh/guide/intro/getting-started.html +0 -79
  210. package/docs/.island/dist/zh/guide/intro/welcome.html +0 -53
  211. package/docs/.island/dist/zh/guide/intro/why-module-engineering-solution.html +0 -49
  212. package/docs/.island/dist/zh/index.html +0 -42
@@ -1187,7 +1187,7 @@ const chCodeConfig = {
1187
1187
  "autoImport": true,
1188
1188
  "showCopyButton": true,
1189
1189
  "skipLanguages": [],
1190
- "filepath": "/Users/targeral/github/targeral-modern-js/website/module-tools/docs/zh/guide/basic/using-storybook.mdx"
1190
+ "filepath": "/Users/bytedance/github/targeral/modern-dev/website/module-tools/docs/zh/guide/basic/using-storybook.mdx"
1191
1191
  };
1192
1192
  const frontmatter = {
1193
1193
  "sidebar_position": 5
@@ -1214,7 +1214,7 @@ const toc = [{
1214
1214
  "depth": 2
1215
1215
  }];
1216
1216
  const title = `使用 Storybook`;
1217
- const content = "\"---\\nsidebar_position: 5\\n---\\n\\n# 使用 Storybook\\n\\n首先如果没有看过以下内容的话,可以先花几分钟先了解一下:\\n\\n- [使用微生成器开启 Storybook 调试](/guide/basic/use-micro-generator#storybook-调试)\\n- [`modern dev`](/guide/basic/command-preview#modern-dev)\\n\\n[Storybook](https://storybook.js.org/) 是一个专门用于组件调试的工具,围绕着组件开发提供了:\\n\\n- 丰富多样的调试能力\\n- 可与一些测试工具结合使用\\n- 可重复使用的文档内容\\n- 可分享能力\\n- 工作流程自动化\\n\\n因此它是一个复杂且功能强大的工具。\\n\\n模块工程解决方案集成了 Storybook ,因此你几乎可以按照 Storybook 官方文档的内容进行使用。不过依然有一些地方需要注意,接下来讲解一下:\\n\\n## 调试代码\\n\\n在调试代码过程中需要引入组件代码,目前可以通过两种方式引入组件代码:\\n\\n- 引用组件产物\\n- 引用组件源码\\n\\n我们更推荐使用第一种“**引用组件产物**”的方式。因为它几乎接近真实的使用场景,不仅可以对组件功能进行调试,同时也对构建产物的正确性进行了验证。\\n\\n接下来我们分别讲一下这两种方式具体如何使用。\\n\\n### 引用组件产物\\n\\n假如存在 TypeScript 项目 `foo`:\\n\\n<CH.Spotlight>\\n\\n```json package.json\\n{\\n \\\"name\\\": \\\"foo\\\",\\n \\\"main\\\": \\\"./dist/index.js\\\",\\n \\\"types\\\": \\\"./dist/types/index.d.ts\\\"\\n}\\n```\\n\\n---\\n\\n确保 `package.json` 的 `main` 和 `types`\\n的值为真实的路径。\\n\\n```json package.json\\n{\\n \\\"name\\\": \\\"foo\\\",\\n \\\"main\\\": \\\"./dist/index.js\\\",\\n \\\"types\\\": \\\"./dist/types/index.d.ts\\\"\\n}\\n```\\n\\n---\\n\\n`foo` 项目的源码。\\n\\n```typescript src/index.ts\\nexport const content = 'hello world';\\n```\\n\\n---\\n\\n确保在 `stories/tsconfig.json` 中设置了指向项目根目录的 `paths` 配置。\\n`paths` 的 `key` 与项目名称相同。\\n\\n```json stories/tsconfig.json focus=5:7\\n{\\n \\\"extends\\\": \\\"../tsconfig.json\\\",\\n \\\"compilerOptions\\\": {\\n \\\"baseUrl\\\": \\\"../\\\",\\n \\\"paths\\\": {\\n \\\"foo\\\": [\\\".\\\"]\\n }\\n },\\n \\\"include\\\": [\\n \\\"**/*\\\"\\n ]\\n}\\n```\\n\\n---\\n\\n最后在 Story 代码中直接以项目名称的方式引用。\\n\\n```tsx stories/index.stories.tsx focus=1:1\\nimport { content } from 'foo';\\n\\nconst Component = () => <div>this is a Story Component {content}</div>;\\n\\nexport const YourStory = () => <Component />;\\n\\nexport default {\\n title: 'Your Stories',\\n};\\n```\\n\\n</CH.Spotlight>\\n\\n如果在开发过程中,遇到无法实时获得类型定义的情况,此时:\\n\\n对于 `pnpm` 的项目,可以按照下面的内容对 `package.json` 进行修改:\\n\\n```ts focus=4:7\\n{\\n \\\"name\\\": \\\"foo\\\",\\n \\\"main\\\": \\\"./dist/index.js\\\",\\n \\\"types\\\": \\\"./src/index.ts\\\",\\n \\\"publishConfig\\\": {\\n \\\"types\\\": \\\"./dist/index.d.ts\\\",\\n }\\n}\\n```\\n\\n> 关于 pnpm 的 `publishConfig` 的使用,可以阅读下面这个[链接](https://pnpm.io/package_json#publishconfig)。\\n\\n而对于 npm 和 Yarn 的项目,则只能通过手动的方式在**开发阶段**和**发布阶段**对 `package.json` 的 `types` 的值进行修改。\\n\\n那么为什么可以直接引用产物呢?\\n\\n1. 在执行 `modern dev storybook` 命令之前,会自动执行 `modern build` 命令,保证项目构建产物的存在。\\n2. 在 Storybook 内部增加了以项目名称作为别名的处理,保证能够**根据 `package.json` 解析出项目的产物路径**。\\n\\n### 引用组件源码\\n\\n引用组件的源码可以通过相对路径的方式:\\n\\n```ts ./stories/index.tsx\\nimport { content } from '../src';\\n\\nconst Component = () => <div>this is a Story Component {content}</div>;\\n\\nexport const YourStory = () => <Component />;\\n\\nexport default {\\n title: 'Your Stories',\\n};\\n```\\n\\n那么为什么不推荐使用源码的方式呢?\\n\\n不仅仅是因为使用组件源码无法验证组件产物是否正确,**同时模块工程对于构建产物支持的一些配置无法完全转换为 Storybook\\n内部的配置**。如果某些配置无法进行相互转换的话,就会在 Storybook 调试过程中出现不符合预期的结果。\\n\\n## 配置 Storybook\\n\\nStorybook 官方通过一个名为 `.storybook` 的文件夹来进行项目配置,其中包含各种配置文件。**在模块工程方案中,可以在项目的 `config/storybook` 目录下增加 Storybook 配置文件。**\\n\\n关于 Storybook 各种配置文件的使用方式,可以查看下面的链接:\\n\\n- [Configure Storybook](https://storybook.js.org/docs/react/configure/overview)\\n\\n**不过在模块项目里进行 Storybook 存在一些限制**:\\n\\n- 目前不能修改 Story 文件存放的位置,即无法在 `main.js` 文件里修改 `stories` 配置。\\n- 目前不能修改 Webpack 和 Babel 相关的配置,即无法在 `main.js` 文件里修改 `webpackFinal` 和 `babel` 配置。\\n\\n在未来我们会考虑这些配置是否可以允许修改,不过目前为了减少不可预知的问题暂时限制使用这些配置。\\n\\n\\n## 构建 Storybook 产物\\n\\n除了可以对组件或者普通的模块进行 Storybook 调试,还可以通过下面的命令来执行 Storybook 的构建任务。\\n\\n```bash\\nmodern build --platform storybook\\n```\\n\\n关于 `modern build --platform` 命令可以查看:\\n\\n- [`modern build`](/guide/basic/command-preview#modern-build)\\n\\n构建完成后,可以在 `dist/storybook-static` 目录看到构建产物文件。\\n\"";
1217
+ const content = "\"---\\nsidebar_position: 5\\n---\\n\\n# 使用 Storybook\\n\\n首先如果没有看过以下内容的话,可以先花几分钟先了解一下:\\n\\n- [使用微生成器开启 Storybook 调试](/guide/basic/use-micro-generator#storybook-调试)\\n- [`modern dev`](/guide/basic/command-preview#modern-dev)\\n\\n[Storybook](https://storybook.js.org/) 是一个专门用于组件调试的工具,围绕着组件开发提供了:\\n\\n- 丰富多样的调试能力\\n- 可与一些测试工具结合使用\\n- 可重复使用的文档内容\\n- 可分享能力\\n- 工作流程自动化\\n\\n因此它是一个复杂且功能强大的工具。\\n\\n模块工程解决方案集成了 Storybook,因此你几乎可以按照 Storybook 官方文档的内容进行使用。不过依然有一些地方需要注意,接下来讲解一下。\\n\\n## 调试代码\\n\\n在调试代码过程中需要引入项目代码,目前可以通过两种方式引入项目代码:\\n\\n- 引用项目产物\\n- 引用项目源码\\n\\n我们更推荐使用第一种“**引用项目产物**”的方式。因为它更接近真实的使用场景,不仅可以对组件功能进行调试,同时也对构建产物的正确性进行了验证。\\n\\n接下来我们分别讲一下这两种方式具体如何使用。\\n\\n### 引用组件产物\\n\\n假如存在 TypeScript 项目 `foo`:\\n\\n<CH.Spotlight>\\n\\n```json package.json\\n{\\n \\\"name\\\": \\\"foo\\\",\\n \\\"main\\\": \\\"./dist/index.js\\\",\\n \\\"types\\\": \\\"./dist/types/index.d.ts\\\"\\n}\\n```\\n\\n---\\n\\n确保 `package.json` 的 `main` 和 `types`\\n的值为正确的产物路径。\\n\\n```json package.json\\n{\\n \\\"name\\\": \\\"foo\\\",\\n \\\"main\\\": \\\"./dist/index.js\\\",\\n \\\"types\\\": \\\"./dist/types/index.d.ts\\\"\\n}\\n```\\n\\n---\\n\\n`foo` 项目的源码。\\n\\n```typescript src/index.ts\\nexport const content = 'hello world';\\n```\\n\\n---\\n\\n确保在 `stories/tsconfig.json` 中设置了指向项目根目录的 `paths` 配置。\\n`paths` 的 `key` 与项目名称相同,这样在编译过程中以及在代码中不会出现问题。\\n\\n```json stories/tsconfig.json focus=5:7\\n{\\n \\\"extends\\\": \\\"../tsconfig.json\\\",\\n \\\"compilerOptions\\\": {\\n \\\"baseUrl\\\": \\\"../\\\",\\n \\\"paths\\\": {\\n \\\"foo\\\": [\\\".\\\"],\\n \\\"foo/*\\\": [\\\"./*\\\"]\\n }\\n },\\n \\\"include\\\": [\\n \\\"**/*\\\"\\n ]\\n}\\n```\\n\\n---\\n\\n最后在 Story 代码中直接以项目名称的方式引用。\\n\\n```tsx stories/index.stories.tsx focus=1:1\\nimport { content } from 'foo';\\n\\nconst Component = () => <div>this is a Story Component {content}</div>;\\n\\nexport const YourStory = () => <Component />;\\n\\nexport default {\\n title: 'Your Stories',\\n};\\n```\\n\\n</CH.Spotlight>\\n\\n:::info\\n在开发过程中,可能会遇到无法实时获得类型定义的情况。因为只有当保存代码后,产物目录下的类型文件才会更新。此时:\\n\\n对于 `pnpm` 的项目,可以按照下面的内容对 `package.json` 进行修改:\\n\\n```ts focus=4:7\\n{\\n \\\"name\\\": \\\"foo\\\",\\n \\\"main\\\": \\\"./dist/index.js\\\",\\n \\\"types\\\": \\\"./src/index.ts\\\",\\n \\\"publishConfig\\\": {\\n \\\"types\\\": \\\"./dist/index.d.ts\\\",\\n }\\n}\\n```\\n\\n> 关于 pnpm 的 `publishConfig` 的使用,可以阅读下面这个[链接](https://pnpm.io/package_json#publishconfig)。\\n\\n而对于 npm 和 Yarn 的项目,则只能通过手动的方式在**开发阶段**和**发布阶段**对 `package.json` 的 `types` 的值进行修改。\\n:::\\n\\n那么为什么可以直接引用产物呢?\\n\\n1. 在执行 `modern dev storybook` 命令之前,会自动执行 `modern build` 命令,保证项目构建产物的存在。\\n2. 在 Storybook 内部增加了针对 `tsconfig.json` 文件或者以项目名称作为别名的处理,保证能够**根据 `package.json` 解析出项目的产物路径**。\\n\\n### 引用组件源码\\n\\n引用组件的源码可以通过相对路径的方式:\\n\\n```ts ./stories/index.tsx\\nimport { content } from '../src';\\n\\nconst Component = () => <div>this is a Story Component {content}</div>;\\n\\nexport const YourStory = () => <Component />;\\n\\nexport default {\\n title: 'Your Stories',\\n};\\n```\\n\\n那么为什么不推荐使用源码的方式呢?\\n\\n不仅仅是因为使用组件源码无法验证组件产物是否正确,**同时模块工程对于构建产物支持的一些配置无法完全转换为 Storybook\\n内部的配置**。如果某些配置无法进行相互转换的话,就会在 Storybook 调试过程中出现不符合预期的结果。\\n\\n## 配置 Storybook\\n\\nStorybook 官方通过一个名为 `.storybook` 的文件夹来进行项目配置,其中包含各种配置文件。**在模块工程方案中,可以在项目的 `config/storybook` 目录下增加 Storybook 配置文件。**\\n\\n关于 Storybook 各种配置文件的使用方式,可以查看下面的链接:\\n\\n- [Configure Storybook](https://storybook.js.org/docs/react/configure/overview)\\n\\n**不过在模块项目里进行 Storybook 存在一些限制**:\\n\\n- 目前不能修改 Story 文件存放的位置,即无法在 `main.js` 文件里修改 `stories` 配置。\\n- 目前不能修改 Webpack 和 Babel 相关的配置,即无法在 `main.js` 文件里修改 `webpackFinal` 和 `babel` 配置。\\n\\n在未来我们会考虑这些配置是否可以允许修改,不过目前为了减少不可预知的问题暂时限制使用这些配置。\\n\\n\\n## 构建 Storybook 产物\\n\\n除了可以对组件或者普通的模块进行 Storybook 调试,还可以通过下面的命令来执行 Storybook 的构建任务。\\n\\n```bash\\nmodern build --platform storybook\\n```\\n\\n关于 `modern build --platform` 命令可以查看:\\n\\n- [`modern build`](/guide/basic/command-preview#modern-build)\\n\\n构建完成后,可以在 `dist/storybook-static` 目录看到构建产物文件。\\n\"";
1218
1218
  function _createMdxContent(props) {
1219
1219
  const _components = Object.assign({
1220
1220
  h1: "h1",
@@ -1226,13 +1226,14 @@ function _createMdxContent(props) {
1226
1226
  h2: "h2",
1227
1227
  strong: "strong",
1228
1228
  h3: "h3",
1229
+ div: "div",
1229
1230
  blockquote: "blockquote",
1230
1231
  ol: "ol"
1231
1232
  }, props.components);
1232
- if (!CH) _missingMdxReference("CH", false, "39:1-106:16");
1233
- if (!CH.Code) _missingMdxReference("CH.Code", true, "112:1-121:4");
1233
+ if (!CH) _missingMdxReference("CH", false, "39:1-107:16");
1234
+ if (!CH.Code) _missingMdxReference("CH.Code", true, "114:1-123:4");
1234
1235
  if (!CH.CodeSlot) _missingMdxReference("CH.CodeSlot", true);
1235
- if (!CH.Spotlight) _missingMdxReference("CH.Spotlight", true, "39:1-106:16");
1236
+ if (!CH.Spotlight) _missingMdxReference("CH.Spotlight", true, "39:1-107:16");
1236
1237
  return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
1237
1238
  children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.h1, {
1238
1239
  id: "使用-storybook",
@@ -1280,7 +1281,7 @@ function _createMdxContent(props) {
1280
1281
  }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.p, {
1281
1282
  children: "因此它是一个复杂且功能强大的工具。"
1282
1283
  }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.p, {
1283
- children: "模块工程解决方案集成了 Storybook ,因此你几乎可以按照 Storybook 官方文档的内容进行使用。不过依然有一些地方需要注意,接下来讲解一下:"
1284
+ children: "模块工程解决方案集成了 Storybook,因此你几乎可以按照 Storybook 官方文档的内容进行使用。不过依然有一些地方需要注意,接下来讲解一下。"
1284
1285
  }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.h2, {
1285
1286
  id: "调试代码",
1286
1287
  children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.a, {
@@ -1290,17 +1291,17 @@ function _createMdxContent(props) {
1290
1291
  children: "#"
1291
1292
  }), "调试代码"]
1292
1293
  }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.p, {
1293
- children: "在调试代码过程中需要引入组件代码,目前可以通过两种方式引入组件代码:"
1294
+ children: "在调试代码过程中需要引入项目代码,目前可以通过两种方式引入项目代码:"
1294
1295
  }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.ul, {
1295
1296
  children: ["\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.li, {
1296
- children: "引用组件产物"
1297
+ children: "引用项目产物"
1297
1298
  }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.li, {
1298
- children: "引用组件源码"
1299
+ children: "引用项目源码"
1299
1300
  }), "\n"]
1300
1301
  }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.p, {
1301
1302
  children: ["我们更推荐使用第一种“", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.strong, {
1302
- children: "引用组件产物"
1303
- }), "”的方式。因为它几乎接近真实的使用场景,不仅可以对组件功能进行调试,同时也对构建产物的正确性进行了验证。"]
1303
+ children: "引用项目产物"
1304
+ }), "”的方式。因为它更接近真实的使用场景,不仅可以对组件功能进行调试,同时也对构建产物的正确性进行了验证。"]
1304
1305
  }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.p, {
1305
1306
  children: "接下来我们分别讲一下这两种方式具体如何使用。"
1306
1307
  }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.h3, {
@@ -2710,6 +2711,85 @@ function _createMdxContent(props) {
2710
2711
  "color": "#ECEFF4"
2711
2712
  }
2712
2713
  }
2714
+ }, {
2715
+ "content": "],",
2716
+ "props": {
2717
+ "style": {
2718
+ "color": "#ECEFF4"
2719
+ }
2720
+ }
2721
+ }]
2722
+ }, {
2723
+ "tokens": [{
2724
+ "content": " ",
2725
+ "props": {
2726
+ "style": {
2727
+ "color": "#D8DEE9FF"
2728
+ }
2729
+ }
2730
+ }, {
2731
+ "content": "\"",
2732
+ "props": {
2733
+ "style": {
2734
+ "color": "#ECEFF4"
2735
+ }
2736
+ }
2737
+ }, {
2738
+ "content": "foo/*",
2739
+ "props": {
2740
+ "style": {
2741
+ "color": "#8FBCBB"
2742
+ }
2743
+ }
2744
+ }, {
2745
+ "content": "\"",
2746
+ "props": {
2747
+ "style": {
2748
+ "color": "#ECEFF4"
2749
+ }
2750
+ }
2751
+ }, {
2752
+ "content": ":",
2753
+ "props": {
2754
+ "style": {
2755
+ "color": "#ECEFF4"
2756
+ }
2757
+ }
2758
+ }, {
2759
+ "content": " ",
2760
+ "props": {
2761
+ "style": {
2762
+ "color": "#D8DEE9FF"
2763
+ }
2764
+ }
2765
+ }, {
2766
+ "content": "[",
2767
+ "props": {
2768
+ "style": {
2769
+ "color": "#ECEFF4"
2770
+ }
2771
+ }
2772
+ }, {
2773
+ "content": "\"",
2774
+ "props": {
2775
+ "style": {
2776
+ "color": "#ECEFF4"
2777
+ }
2778
+ }
2779
+ }, {
2780
+ "content": "./*",
2781
+ "props": {
2782
+ "style": {
2783
+ "color": "#A3BE8C"
2784
+ }
2785
+ }
2786
+ }, {
2787
+ "content": "\"",
2788
+ "props": {
2789
+ "style": {
2790
+ "color": "#ECEFF4"
2791
+ }
2792
+ }
2713
2793
  }, {
2714
2794
  "content": "]",
2715
2795
  "props": {
@@ -3562,7 +3642,7 @@ function _createMdxContent(props) {
3562
3642
  children: "main"
3563
3643
  }), " 和 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
3564
3644
  children: "types"
3565
- }), "\n的值为真实的路径。"]
3645
+ }), "\n的值为正确的产物路径。"]
3566
3646
  }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(CH.CodeSlot, {})]
3567
3647
  }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
3568
3648
  children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.p, {
@@ -3580,403 +3660,412 @@ function _createMdxContent(props) {
3580
3660
  children: "paths"
3581
3661
  }), " 的 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
3582
3662
  children: "key"
3583
- }), " 与项目名称相同。"]
3663
+ }), " 与项目名称相同,这样在编译过程中以及在代码中不会出现问题。"]
3584
3664
  }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(CH.CodeSlot, {})]
3585
3665
  }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
3586
3666
  children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.p, {
3587
3667
  children: "最后在 Story 代码中直接以项目名称的方式引用。"
3588
3668
  }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(CH.CodeSlot, {})]
3589
3669
  })]
3590
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.p, {
3591
- children: "如果在开发过程中,遇到无法实时获得类型定义的情况,此时:"
3592
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.p, {
3593
- children: ["对于 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
3594
- children: "pnpm"
3595
- }), " 的项目,可以按照下面的内容对 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
3596
- children: "package.json"
3597
- }), " 进行修改:"]
3598
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(CH.Code, {
3599
- codeConfig: chCodeConfig,
3600
- northPanel: {
3601
- "tabs": [""],
3602
- "active": "",
3603
- "heightRatio": 1
3604
- },
3605
- files: [{
3606
- "name": "",
3607
- "focus": "4:7",
3608
- "code": {
3609
- "lines": [{
3610
- "tokens": [{
3611
- "content": "{",
3612
- "props": {
3613
- "style": {
3614
- "color": "#ECEFF4"
3615
- }
3616
- }
3617
- }]
3618
- }, {
3619
- "tokens": [{
3620
- "content": " ",
3621
- "props": {
3622
- "style": {
3623
- "color": "#D8DEE9FF"
3624
- }
3625
- }
3626
- }, {
3627
- "content": "\"",
3628
- "props": {
3629
- "style": {
3630
- "color": "#ECEFF4"
3631
- }
3632
- }
3633
- }, {
3634
- "content": "name",
3635
- "props": {
3636
- "style": {
3637
- "color": "#A3BE8C"
3638
- }
3639
- }
3640
- }, {
3641
- "content": "\"",
3642
- "props": {
3643
- "style": {
3644
- "color": "#ECEFF4"
3645
- }
3646
- }
3647
- }, {
3648
- "content": ": ",
3649
- "props": {
3650
- "style": {
3651
- "color": "#D8DEE9FF"
3652
- }
3653
- }
3654
- }, {
3655
- "content": "\"",
3656
- "props": {
3657
- "style": {
3658
- "color": "#ECEFF4"
3659
- }
3660
- }
3661
- }, {
3662
- "content": "foo",
3663
- "props": {
3664
- "style": {
3665
- "color": "#A3BE8C"
3666
- }
3667
- }
3668
- }, {
3669
- "content": "\"",
3670
- "props": {
3671
- "style": {
3672
- "color": "#ECEFF4"
3673
- }
3674
- }
3675
- }, {
3676
- "content": ",",
3677
- "props": {
3678
- "style": {
3679
- "color": "#ECEFF4"
3680
- }
3681
- }
3682
- }]
3683
- }, {
3684
- "tokens": [{
3685
- "content": " ",
3686
- "props": {
3687
- "style": {
3688
- "color": "#D8DEE9FF"
3689
- }
3690
- }
3691
- }, {
3692
- "content": "\"",
3693
- "props": {
3694
- "style": {
3695
- "color": "#ECEFF4"
3696
- }
3697
- }
3698
- }, {
3699
- "content": "main",
3700
- "props": {
3701
- "style": {
3702
- "color": "#A3BE8C"
3703
- }
3704
- }
3705
- }, {
3706
- "content": "\"",
3707
- "props": {
3708
- "style": {
3709
- "color": "#ECEFF4"
3710
- }
3711
- }
3712
- }, {
3713
- "content": ": ",
3714
- "props": {
3715
- "style": {
3716
- "color": "#D8DEE9FF"
3717
- }
3718
- }
3719
- }, {
3720
- "content": "\"",
3721
- "props": {
3722
- "style": {
3723
- "color": "#ECEFF4"
3724
- }
3725
- }
3726
- }, {
3727
- "content": "./dist/index.js",
3728
- "props": {
3729
- "style": {
3730
- "color": "#A3BE8C"
3731
- }
3732
- }
3733
- }, {
3734
- "content": "\"",
3735
- "props": {
3736
- "style": {
3737
- "color": "#ECEFF4"
3738
- }
3739
- }
3740
- }, {
3741
- "content": ",",
3742
- "props": {
3743
- "style": {
3744
- "color": "#ECEFF4"
3745
- }
3746
- }
3747
- }]
3748
- }, {
3749
- "tokens": [{
3750
- "content": " ",
3751
- "props": {
3752
- "style": {
3753
- "color": "#D8DEE9FF"
3754
- }
3755
- }
3756
- }, {
3757
- "content": "\"",
3758
- "props": {
3759
- "style": {
3760
- "color": "#ECEFF4"
3761
- }
3762
- }
3763
- }, {
3764
- "content": "types",
3765
- "props": {
3766
- "style": {
3767
- "color": "#A3BE8C"
3768
- }
3769
- }
3770
- }, {
3771
- "content": "\"",
3772
- "props": {
3773
- "style": {
3774
- "color": "#ECEFF4"
3775
- }
3776
- }
3777
- }, {
3778
- "content": ": ",
3779
- "props": {
3780
- "style": {
3781
- "color": "#D8DEE9FF"
3782
- }
3783
- }
3784
- }, {
3785
- "content": "\"",
3786
- "props": {
3787
- "style": {
3788
- "color": "#ECEFF4"
3789
- }
3790
- }
3791
- }, {
3792
- "content": "./src/index.ts",
3793
- "props": {
3794
- "style": {
3795
- "color": "#A3BE8C"
3796
- }
3797
- }
3798
- }, {
3799
- "content": "\"",
3800
- "props": {
3801
- "style": {
3802
- "color": "#ECEFF4"
3803
- }
3804
- }
3805
- }, {
3806
- "content": ",",
3807
- "props": {
3808
- "style": {
3809
- "color": "#ECEFF4"
3810
- }
3811
- }
3812
- }]
3813
- }, {
3814
- "tokens": [{
3815
- "content": " ",
3816
- "props": {
3817
- "style": {
3818
- "color": "#D8DEE9FF"
3819
- }
3820
- }
3821
- }, {
3822
- "content": "\"",
3823
- "props": {
3824
- "style": {
3825
- "color": "#ECEFF4"
3826
- }
3827
- }
3828
- }, {
3829
- "content": "publishConfig",
3830
- "props": {
3831
- "style": {
3832
- "color": "#A3BE8C"
3833
- }
3834
- }
3835
- }, {
3836
- "content": "\"",
3837
- "props": {
3838
- "style": {
3839
- "color": "#ECEFF4"
3840
- }
3841
- }
3842
- }, {
3843
- "content": ": ",
3844
- "props": {
3845
- "style": {
3846
- "color": "#D8DEE9FF"
3847
- }
3848
- }
3849
- }, {
3850
- "content": "{",
3851
- "props": {
3852
- "style": {
3853
- "color": "#ECEFF4"
3854
- }
3855
- }
3856
- }]
3857
- }, {
3858
- "tokens": [{
3859
- "content": " ",
3860
- "props": {
3861
- "style": {
3862
- "color": "#D8DEE9FF"
3863
- }
3864
- }
3865
- }, {
3866
- "content": "\"",
3867
- "props": {
3868
- "style": {
3869
- "color": "#ECEFF4"
3870
- }
3871
- }
3872
- }, {
3873
- "content": "types",
3874
- "props": {
3875
- "style": {
3876
- "color": "#A3BE8C"
3877
- }
3878
- }
3879
- }, {
3880
- "content": "\"",
3881
- "props": {
3882
- "style": {
3883
- "color": "#ECEFF4"
3884
- }
3885
- }
3886
- }, {
3887
- "content": ":",
3888
- "props": {
3889
- "style": {
3890
- "color": "#ECEFF4"
3891
- }
3892
- }
3893
- }, {
3894
- "content": " ",
3895
- "props": {
3896
- "style": {
3897
- "color": "#D8DEE9FF"
3898
- }
3899
- }
3900
- }, {
3901
- "content": "\"",
3902
- "props": {
3903
- "style": {
3904
- "color": "#ECEFF4"
3905
- }
3906
- }
3907
- }, {
3908
- "content": "./dist/index.d.ts",
3909
- "props": {
3910
- "style": {
3911
- "color": "#A3BE8C"
3912
- }
3913
- }
3914
- }, {
3915
- "content": "\"",
3916
- "props": {
3917
- "style": {
3918
- "color": "#ECEFF4"
3919
- }
3920
- }
3921
- }, {
3922
- "content": ",",
3923
- "props": {
3924
- "style": {
3925
- "color": "#ECEFF4"
3926
- }
3927
- }
3928
- }]
3929
- }, {
3930
- "tokens": [{
3931
- "content": " ",
3932
- "props": {
3933
- "style": {
3934
- "color": "#D8DEE9FF"
3935
- }
3936
- }
3937
- }, {
3938
- "content": "}",
3939
- "props": {
3940
- "style": {
3941
- "color": "#ECEFF4"
3942
- }
3943
- }
3944
- }]
3945
- }, {
3946
- "tokens": [{
3947
- "content": "}",
3948
- "props": {
3949
- "style": {
3950
- "color": "#ECEFF4"
3951
- }
3952
- }
3953
- }]
3954
- }],
3955
- "lang": "ts"
3956
- },
3957
- "annotations": []
3958
- }]
3959
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.blockquote, {
3960
- children: ["\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.p, {
3961
- children: ["关于 pnpm 的 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
3962
- children: "publishConfig"
3963
- }), " 的使用,可以阅读下面这个", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.a, {
3964
- href: "https://pnpm.io/package_json#publishconfig",
3965
- target: "_blank",
3966
- rel: "nofollow",
3967
- children: "链接"
3968
- }), "。"]
3969
- }), "\n"]
3970
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.p, {
3971
- children: ["而对于 npm 和 Yarn 的项目,则只能通过手动的方式在", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.strong, {
3972
- children: "开发阶段"
3973
- }), "", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.strong, {
3974
- children: "发布阶段"
3975
- }), "", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
3976
- children: "package.json"
3977
- }), " ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
3978
- children: "types"
3979
- }), " 的值进行修改。"]
3670
+ }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.div, {
3671
+ className: "modern-directive info",
3672
+ children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.p, {
3673
+ className: "modern-directive-title",
3674
+ children: "INFO"
3675
+ }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.div, {
3676
+ className: "modern-directive-content",
3677
+ children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.p, {
3678
+ children: "\n在开发过程中,可能会遇到无法实时获得类型定义的情况。因为只有当保存代码后,产物目录下的类型文件才会更新。此时:"
3679
+ }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.p, {
3680
+ children: ["对于 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
3681
+ children: "pnpm"
3682
+ }), " 的项目,可以按照下面的内容对 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
3683
+ children: "package.json"
3684
+ }), " 进行修改:"]
3685
+ }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(CH.Code, {
3686
+ codeConfig: chCodeConfig,
3687
+ northPanel: {
3688
+ "tabs": [""],
3689
+ "active": "",
3690
+ "heightRatio": 1
3691
+ },
3692
+ files: [{
3693
+ "name": "",
3694
+ "focus": "4:7",
3695
+ "code": {
3696
+ "lines": [{
3697
+ "tokens": [{
3698
+ "content": "{",
3699
+ "props": {
3700
+ "style": {
3701
+ "color": "#ECEFF4"
3702
+ }
3703
+ }
3704
+ }]
3705
+ }, {
3706
+ "tokens": [{
3707
+ "content": " ",
3708
+ "props": {
3709
+ "style": {
3710
+ "color": "#D8DEE9FF"
3711
+ }
3712
+ }
3713
+ }, {
3714
+ "content": "\"",
3715
+ "props": {
3716
+ "style": {
3717
+ "color": "#ECEFF4"
3718
+ }
3719
+ }
3720
+ }, {
3721
+ "content": "name",
3722
+ "props": {
3723
+ "style": {
3724
+ "color": "#A3BE8C"
3725
+ }
3726
+ }
3727
+ }, {
3728
+ "content": "\"",
3729
+ "props": {
3730
+ "style": {
3731
+ "color": "#ECEFF4"
3732
+ }
3733
+ }
3734
+ }, {
3735
+ "content": ": ",
3736
+ "props": {
3737
+ "style": {
3738
+ "color": "#D8DEE9FF"
3739
+ }
3740
+ }
3741
+ }, {
3742
+ "content": "\"",
3743
+ "props": {
3744
+ "style": {
3745
+ "color": "#ECEFF4"
3746
+ }
3747
+ }
3748
+ }, {
3749
+ "content": "foo",
3750
+ "props": {
3751
+ "style": {
3752
+ "color": "#A3BE8C"
3753
+ }
3754
+ }
3755
+ }, {
3756
+ "content": "\"",
3757
+ "props": {
3758
+ "style": {
3759
+ "color": "#ECEFF4"
3760
+ }
3761
+ }
3762
+ }, {
3763
+ "content": ",",
3764
+ "props": {
3765
+ "style": {
3766
+ "color": "#ECEFF4"
3767
+ }
3768
+ }
3769
+ }]
3770
+ }, {
3771
+ "tokens": [{
3772
+ "content": " ",
3773
+ "props": {
3774
+ "style": {
3775
+ "color": "#D8DEE9FF"
3776
+ }
3777
+ }
3778
+ }, {
3779
+ "content": "\"",
3780
+ "props": {
3781
+ "style": {
3782
+ "color": "#ECEFF4"
3783
+ }
3784
+ }
3785
+ }, {
3786
+ "content": "main",
3787
+ "props": {
3788
+ "style": {
3789
+ "color": "#A3BE8C"
3790
+ }
3791
+ }
3792
+ }, {
3793
+ "content": "\"",
3794
+ "props": {
3795
+ "style": {
3796
+ "color": "#ECEFF4"
3797
+ }
3798
+ }
3799
+ }, {
3800
+ "content": ": ",
3801
+ "props": {
3802
+ "style": {
3803
+ "color": "#D8DEE9FF"
3804
+ }
3805
+ }
3806
+ }, {
3807
+ "content": "\"",
3808
+ "props": {
3809
+ "style": {
3810
+ "color": "#ECEFF4"
3811
+ }
3812
+ }
3813
+ }, {
3814
+ "content": "./dist/index.js",
3815
+ "props": {
3816
+ "style": {
3817
+ "color": "#A3BE8C"
3818
+ }
3819
+ }
3820
+ }, {
3821
+ "content": "\"",
3822
+ "props": {
3823
+ "style": {
3824
+ "color": "#ECEFF4"
3825
+ }
3826
+ }
3827
+ }, {
3828
+ "content": ",",
3829
+ "props": {
3830
+ "style": {
3831
+ "color": "#ECEFF4"
3832
+ }
3833
+ }
3834
+ }]
3835
+ }, {
3836
+ "tokens": [{
3837
+ "content": " ",
3838
+ "props": {
3839
+ "style": {
3840
+ "color": "#D8DEE9FF"
3841
+ }
3842
+ }
3843
+ }, {
3844
+ "content": "\"",
3845
+ "props": {
3846
+ "style": {
3847
+ "color": "#ECEFF4"
3848
+ }
3849
+ }
3850
+ }, {
3851
+ "content": "types",
3852
+ "props": {
3853
+ "style": {
3854
+ "color": "#A3BE8C"
3855
+ }
3856
+ }
3857
+ }, {
3858
+ "content": "\"",
3859
+ "props": {
3860
+ "style": {
3861
+ "color": "#ECEFF4"
3862
+ }
3863
+ }
3864
+ }, {
3865
+ "content": ": ",
3866
+ "props": {
3867
+ "style": {
3868
+ "color": "#D8DEE9FF"
3869
+ }
3870
+ }
3871
+ }, {
3872
+ "content": "\"",
3873
+ "props": {
3874
+ "style": {
3875
+ "color": "#ECEFF4"
3876
+ }
3877
+ }
3878
+ }, {
3879
+ "content": "./src/index.ts",
3880
+ "props": {
3881
+ "style": {
3882
+ "color": "#A3BE8C"
3883
+ }
3884
+ }
3885
+ }, {
3886
+ "content": "\"",
3887
+ "props": {
3888
+ "style": {
3889
+ "color": "#ECEFF4"
3890
+ }
3891
+ }
3892
+ }, {
3893
+ "content": ",",
3894
+ "props": {
3895
+ "style": {
3896
+ "color": "#ECEFF4"
3897
+ }
3898
+ }
3899
+ }]
3900
+ }, {
3901
+ "tokens": [{
3902
+ "content": " ",
3903
+ "props": {
3904
+ "style": {
3905
+ "color": "#D8DEE9FF"
3906
+ }
3907
+ }
3908
+ }, {
3909
+ "content": "\"",
3910
+ "props": {
3911
+ "style": {
3912
+ "color": "#ECEFF4"
3913
+ }
3914
+ }
3915
+ }, {
3916
+ "content": "publishConfig",
3917
+ "props": {
3918
+ "style": {
3919
+ "color": "#A3BE8C"
3920
+ }
3921
+ }
3922
+ }, {
3923
+ "content": "\"",
3924
+ "props": {
3925
+ "style": {
3926
+ "color": "#ECEFF4"
3927
+ }
3928
+ }
3929
+ }, {
3930
+ "content": ": ",
3931
+ "props": {
3932
+ "style": {
3933
+ "color": "#D8DEE9FF"
3934
+ }
3935
+ }
3936
+ }, {
3937
+ "content": "{",
3938
+ "props": {
3939
+ "style": {
3940
+ "color": "#ECEFF4"
3941
+ }
3942
+ }
3943
+ }]
3944
+ }, {
3945
+ "tokens": [{
3946
+ "content": " ",
3947
+ "props": {
3948
+ "style": {
3949
+ "color": "#D8DEE9FF"
3950
+ }
3951
+ }
3952
+ }, {
3953
+ "content": "\"",
3954
+ "props": {
3955
+ "style": {
3956
+ "color": "#ECEFF4"
3957
+ }
3958
+ }
3959
+ }, {
3960
+ "content": "types",
3961
+ "props": {
3962
+ "style": {
3963
+ "color": "#A3BE8C"
3964
+ }
3965
+ }
3966
+ }, {
3967
+ "content": "\"",
3968
+ "props": {
3969
+ "style": {
3970
+ "color": "#ECEFF4"
3971
+ }
3972
+ }
3973
+ }, {
3974
+ "content": ":",
3975
+ "props": {
3976
+ "style": {
3977
+ "color": "#ECEFF4"
3978
+ }
3979
+ }
3980
+ }, {
3981
+ "content": " ",
3982
+ "props": {
3983
+ "style": {
3984
+ "color": "#D8DEE9FF"
3985
+ }
3986
+ }
3987
+ }, {
3988
+ "content": "\"",
3989
+ "props": {
3990
+ "style": {
3991
+ "color": "#ECEFF4"
3992
+ }
3993
+ }
3994
+ }, {
3995
+ "content": "./dist/index.d.ts",
3996
+ "props": {
3997
+ "style": {
3998
+ "color": "#A3BE8C"
3999
+ }
4000
+ }
4001
+ }, {
4002
+ "content": "\"",
4003
+ "props": {
4004
+ "style": {
4005
+ "color": "#ECEFF4"
4006
+ }
4007
+ }
4008
+ }, {
4009
+ "content": ",",
4010
+ "props": {
4011
+ "style": {
4012
+ "color": "#ECEFF4"
4013
+ }
4014
+ }
4015
+ }]
4016
+ }, {
4017
+ "tokens": [{
4018
+ "content": " ",
4019
+ "props": {
4020
+ "style": {
4021
+ "color": "#D8DEE9FF"
4022
+ }
4023
+ }
4024
+ }, {
4025
+ "content": "}",
4026
+ "props": {
4027
+ "style": {
4028
+ "color": "#ECEFF4"
4029
+ }
4030
+ }
4031
+ }]
4032
+ }, {
4033
+ "tokens": [{
4034
+ "content": "}",
4035
+ "props": {
4036
+ "style": {
4037
+ "color": "#ECEFF4"
4038
+ }
4039
+ }
4040
+ }]
4041
+ }],
4042
+ "lang": "ts"
4043
+ },
4044
+ "annotations": []
4045
+ }]
4046
+ }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.blockquote, {
4047
+ children: ["\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.p, {
4048
+ children: ["关于 pnpm 的 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
4049
+ children: "publishConfig"
4050
+ }), " 的使用,可以阅读下面这个", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.a, {
4051
+ href: "https://pnpm.io/package_json#publishconfig",
4052
+ target: "_blank",
4053
+ rel: "nofollow",
4054
+ children: "链接"
4055
+ }), ""]
4056
+ }), "\n"]
4057
+ }), "而对于 npm 和 Yarn 的项目,则只能通过手动的方式在", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.strong, {
4058
+ children: "开发阶段"
4059
+ }), "和", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.strong, {
4060
+ children: "发布阶段"
4061
+ }), "对 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
4062
+ children: "package.json"
4063
+ }), " 的 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
4064
+ children: "types"
4065
+ }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.p, {
4066
+ children: "的值进行修改。"
4067
+ })]
4068
+ })]
3980
4069
  }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.p, {
3981
4070
  children: "那么为什么可以直接引用产物呢?"
3982
4071
  }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.ol, {
@@ -3987,7 +4076,9 @@ function _createMdxContent(props) {
3987
4076
  children: "modern build"
3988
4077
  }), " 命令,保证项目构建产物的存在。"]
3989
4078
  }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.li, {
3990
- children: ["在 Storybook 内部增加了以项目名称作为别名的处理,保证能够", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.strong, {
4079
+ children: ["在 Storybook 内部增加了针对 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
4080
+ children: "tsconfig.json"
4081
+ }), " 文件或者以项目名称作为别名的处理,保证能够", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.strong, {
3991
4082
  children: ["根据 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
3992
4083
  children: "package.json"
3993
4084
  }), " 解析出项目的产物路径"]
@@ -4659,7 +4750,7 @@ function MDXContent(props = {}) {
4659
4750
  }
4660
4751
  /* harmony default export */ __webpack_exports__["default"] = (MDXContent);
4661
4752
  function _missingMdxReference(id, component, place) {
4662
- throw new Error("Expected " + (component ? "component" : "object") + " `" + id + "` to be defined: you likely forgot to import, pass, or provide it." + (place ? "\nIt’s referenced in your code at `" + place + "` in `/Users/targeral/github/targeral-modern-js/website/module-tools/docs/zh/guide/basic/using-storybook.mdx`" : ""));
4753
+ throw new Error("Expected " + (component ? "component" : "object") + " `" + id + "` to be defined: you likely forgot to import, pass, or provide it." + (place ? "\nIt’s referenced in your code at `" + place + "` in `/Users/bytedance/github/targeral/modern-dev/website/module-tools/docs/zh/guide/basic/using-storybook.mdx`" : ""));
4663
4754
  }
4664
4755
 
4665
4756