@modern-js/module-tools-docs 2.2.1-beta.1 → 2.3.0

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 (160) hide show
  1. package/docs/en/api/plugin-api/plugin-hooks.md +2 -10
  2. package/docs/en/guide/advance/in-depth-about-dev-command.md +0 -9
  3. package/docs/en/guide/basic/command-preview.md +1 -1
  4. package/docs/en/guide/basic/using-storybook.mdx +28 -6
  5. package/docs/en/guide/intro/getting-started.md +1 -1
  6. package/docs/en/index.md +14 -8
  7. package/docs/en/plugins/guide/getting-started.mdx +1 -1
  8. package/docs/zh/api/plugin-api/plugin-hooks.md +2 -10
  9. package/docs/zh/guide/advance/in-depth-about-dev-command.md +0 -8
  10. package/docs/zh/guide/basic/command-preview.md +1 -1
  11. package/docs/zh/guide/basic/using-storybook.mdx +28 -5
  12. package/docs/zh/index.md +16 -10
  13. package/docs/zh/plugins/guide/getting-started.mdx +1 -1
  14. package/modern.config.ts +4 -6
  15. package/package.json +4 -4
  16. package/doc_build/html/main/index.html +0 -16
  17. package/doc_build/route.json +0 -10
  18. package/doc_build/static/css/main.css +0 -2977
  19. package/doc_build/static/css/main.css.map +0 -1
  20. 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 +0 -68
  21. 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 +0 -1
  22. package/doc_build/static/js/async/en_api_config_build-config.js +0 -8406
  23. package/doc_build/static/js/async/en_api_config_build-config.js.map +0 -1
  24. package/doc_build/static/js/async/en_api_config_build-preset.js +0 -7865
  25. package/doc_build/static/js/async/en_api_config_build-preset.js.map +0 -1
  26. package/doc_build/static/js/async/en_api_config_design-system.js +0 -47805
  27. package/doc_build/static/js/async/en_api_config_design-system.js.map +0 -1
  28. package/doc_build/static/js/async/en_api_config_plugins.js +0 -1488
  29. package/doc_build/static/js/async/en_api_config_plugins.js.map +0 -1
  30. package/doc_build/static/js/async/en_api_config_testing.js +0 -2139
  31. package/doc_build/static/js/async/en_api_config_testing.js.map +0 -1
  32. package/doc_build/static/js/async/en_api_index.js +0 -51
  33. package/doc_build/static/js/async/en_api_index.js.map +0 -1
  34. package/doc_build/static/js/async/en_api_plugin-api_plugin-hooks.js +0 -14360
  35. package/doc_build/static/js/async/en_api_plugin-api_plugin-hooks.js.map +0 -1
  36. package/doc_build/static/js/async/en_guide_advance_asset.js +0 -3972
  37. package/doc_build/static/js/async/en_guide_advance_asset.js.map +0 -1
  38. package/doc_build/static/js/async/en_guide_advance_build-umd.js +0 -9857
  39. package/doc_build/static/js/async/en_guide_advance_build-umd.js.map +0 -1
  40. package/doc_build/static/js/async/en_guide_advance_copy.js +0 -6541
  41. package/doc_build/static/js/async/en_guide_advance_copy.js.map +0 -1
  42. package/doc_build/static/js/async/en_guide_advance_external-dependency.js +0 -3806
  43. package/doc_build/static/js/async/en_guide_advance_external-dependency.js.map +0 -1
  44. package/doc_build/static/js/async/en_guide_advance_in-depth-about-build.js +0 -5304
  45. package/doc_build/static/js/async/en_guide_advance_in-depth-about-build.js.map +0 -1
  46. package/doc_build/static/js/async/en_guide_advance_in-depth-about-dev-command.js +0 -2526
  47. package/doc_build/static/js/async/en_guide_advance_in-depth-about-dev-command.js.map +0 -1
  48. package/doc_build/static/js/async/en_guide_advance_theme-config.js +0 -2486
  49. package/doc_build/static/js/async/en_guide_advance_theme-config.js.map +0 -1
  50. package/doc_build/static/js/async/en_guide_basic_before-getting-started.js +0 -3720
  51. package/doc_build/static/js/async/en_guide_basic_before-getting-started.js.map +0 -1
  52. package/doc_build/static/js/async/en_guide_basic_command-preview.js +0 -3973
  53. package/doc_build/static/js/async/en_guide_basic_command-preview.js.map +0 -1
  54. package/doc_build/static/js/async/en_guide_basic_modify-output-product.js +0 -3137
  55. package/doc_build/static/js/async/en_guide_basic_modify-output-product.js.map +0 -1
  56. package/doc_build/static/js/async/en_guide_basic_publish-your-project.js +0 -2180
  57. package/doc_build/static/js/async/en_guide_basic_publish-your-project.js.map +0 -1
  58. package/doc_build/static/js/async/en_guide_basic_test-your-project.js +0 -3887
  59. package/doc_build/static/js/async/en_guide_basic_test-your-project.js.map +0 -1
  60. package/doc_build/static/js/async/en_guide_basic_use-micro-generator.js +0 -2973
  61. package/doc_build/static/js/async/en_guide_basic_use-micro-generator.js.map +0 -1
  62. package/doc_build/static/js/async/en_guide_basic_using-storybook.js +0 -4723
  63. package/doc_build/static/js/async/en_guide_basic_using-storybook.js.map +0 -1
  64. package/doc_build/static/js/async/en_guide_best-practices_components.js +0 -21400
  65. package/doc_build/static/js/async/en_guide_best-practices_components.js.map +0 -1
  66. package/doc_build/static/js/async/en_guide_intro_getting-started.js +0 -2149
  67. package/doc_build/static/js/async/en_guide_intro_getting-started.js.map +0 -1
  68. package/doc_build/static/js/async/en_guide_intro_welcome.js +0 -162
  69. package/doc_build/static/js/async/en_guide_intro_welcome.js.map +0 -1
  70. package/doc_build/static/js/async/en_guide_intro_why-module-engineering-solution.js +0 -96
  71. package/doc_build/static/js/async/en_guide_intro_why-module-engineering-solution.js.map +0 -1
  72. package/doc_build/static/js/async/en_index.js +0 -81
  73. package/doc_build/static/js/async/en_index.js.map +0 -1
  74. package/doc_build/static/js/async/en_plugins_guide_getting-started.js +0 -2556
  75. package/doc_build/static/js/async/en_plugins_guide_getting-started.js.map +0 -1
  76. package/doc_build/static/js/async/en_plugins_guide_plugin-object.js +0 -4173
  77. package/doc_build/static/js/async/en_plugins_guide_plugin-object.js.map +0 -1
  78. package/doc_build/static/js/async/en_plugins_guide_setup-function.js +0 -3815
  79. package/doc_build/static/js/async/en_plugins_guide_setup-function.js.map +0 -1
  80. package/doc_build/static/js/async/en_plugins_official-list_overview.js +0 -66
  81. package/doc_build/static/js/async/en_plugins_official-list_overview.js.map +0 -1
  82. package/doc_build/static/js/async/packages_cli_doc-core_src_theme-default_components_Search_logic_search_ts.js +0 -246
  83. package/doc_build/static/js/async/packages_cli_doc-core_src_theme-default_components_Search_logic_search_ts.js.map +0 -1
  84. 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 +0 -6656
  85. 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 +0 -1
  86. package/doc_build/static/js/async/vendors-node_modules_pnpm_flexsearch_0_6_32_node_modules_flexsearch_dist_flexsearch_min_js.js +0 -54
  87. package/doc_build/static/js/async/vendors-node_modules_pnpm_flexsearch_0_6_32_node_modules_flexsearch_dist_flexsearch_min_js.js.map +0 -1
  88. package/doc_build/static/js/async/zh_api_config_build-config.js +0 -11354
  89. package/doc_build/static/js/async/zh_api_config_build-config.js.map +0 -1
  90. package/doc_build/static/js/async/zh_api_config_build-preset.js +0 -7867
  91. package/doc_build/static/js/async/zh_api_config_build-preset.js.map +0 -1
  92. package/doc_build/static/js/async/zh_api_config_design-system.js +0 -48712
  93. package/doc_build/static/js/async/zh_api_config_design-system.js.map +0 -1
  94. package/doc_build/static/js/async/zh_api_config_plugins.js +0 -1488
  95. package/doc_build/static/js/async/zh_api_config_plugins.js.map +0 -1
  96. package/doc_build/static/js/async/zh_api_config_testing.js +0 -2132
  97. package/doc_build/static/js/async/zh_api_config_testing.js.map +0 -1
  98. package/doc_build/static/js/async/zh_api_index.js +0 -52
  99. package/doc_build/static/js/async/zh_api_index.js.map +0 -1
  100. package/doc_build/static/js/async/zh_api_plugin-api_plugin-hooks.js +0 -14392
  101. package/doc_build/static/js/async/zh_api_plugin-api_plugin-hooks.js.map +0 -1
  102. package/doc_build/static/js/async/zh_guide_advance_asset.js +0 -3972
  103. package/doc_build/static/js/async/zh_guide_advance_asset.js.map +0 -1
  104. package/doc_build/static/js/async/zh_guide_advance_build-umd.js +0 -9859
  105. package/doc_build/static/js/async/zh_guide_advance_build-umd.js.map +0 -1
  106. package/doc_build/static/js/async/zh_guide_advance_copy.js +0 -6541
  107. package/doc_build/static/js/async/zh_guide_advance_copy.js.map +0 -1
  108. package/doc_build/static/js/async/zh_guide_advance_external-dependency.js +0 -3808
  109. package/doc_build/static/js/async/zh_guide_advance_external-dependency.js.map +0 -1
  110. package/doc_build/static/js/async/zh_guide_advance_in-depth-about-build.js +0 -5304
  111. package/doc_build/static/js/async/zh_guide_advance_in-depth-about-build.js.map +0 -1
  112. package/doc_build/static/js/async/zh_guide_advance_in-depth-about-dev-command.js +0 -2526
  113. package/doc_build/static/js/async/zh_guide_advance_in-depth-about-dev-command.js.map +0 -1
  114. package/doc_build/static/js/async/zh_guide_advance_theme-config.js +0 -2477
  115. package/doc_build/static/js/async/zh_guide_advance_theme-config.js.map +0 -1
  116. package/doc_build/static/js/async/zh_guide_basic_before-getting-started.js +0 -3711
  117. package/doc_build/static/js/async/zh_guide_basic_before-getting-started.js.map +0 -1
  118. package/doc_build/static/js/async/zh_guide_basic_command-preview.js +0 -3805
  119. package/doc_build/static/js/async/zh_guide_basic_command-preview.js.map +0 -1
  120. package/doc_build/static/js/async/zh_guide_basic_modify-output-product.js +0 -3142
  121. package/doc_build/static/js/async/zh_guide_basic_modify-output-product.js.map +0 -1
  122. package/doc_build/static/js/async/zh_guide_basic_publish-your-project.js +0 -2241
  123. package/doc_build/static/js/async/zh_guide_basic_publish-your-project.js.map +0 -1
  124. package/doc_build/static/js/async/zh_guide_basic_test-your-project.js +0 -4286
  125. package/doc_build/static/js/async/zh_guide_basic_test-your-project.js.map +0 -1
  126. package/doc_build/static/js/async/zh_guide_basic_use-micro-generator.js +0 -2979
  127. package/doc_build/static/js/async/zh_guide_basic_use-micro-generator.js.map +0 -1
  128. package/doc_build/static/js/async/zh_guide_basic_using-storybook.js +0 -4760
  129. package/doc_build/static/js/async/zh_guide_basic_using-storybook.js.map +0 -1
  130. package/doc_build/static/js/async/zh_guide_best-practices_components.js +0 -21100
  131. package/doc_build/static/js/async/zh_guide_best-practices_components.js.map +0 -1
  132. package/doc_build/static/js/async/zh_guide_intro_getting-started.js +0 -2031
  133. package/doc_build/static/js/async/zh_guide_intro_getting-started.js.map +0 -1
  134. package/doc_build/static/js/async/zh_guide_intro_welcome.js +0 -162
  135. package/doc_build/static/js/async/zh_guide_intro_welcome.js.map +0 -1
  136. package/doc_build/static/js/async/zh_guide_intro_why-module-engineering-solution.js +0 -96
  137. package/doc_build/static/js/async/zh_guide_intro_why-module-engineering-solution.js.map +0 -1
  138. package/doc_build/static/js/async/zh_index.js +0 -81
  139. package/doc_build/static/js/async/zh_index.js.map +0 -1
  140. package/doc_build/static/js/async/zh_plugins_guide_getting-started.js +0 -2604
  141. package/doc_build/static/js/async/zh_plugins_guide_getting-started.js.map +0 -1
  142. package/doc_build/static/js/async/zh_plugins_guide_plugin-object.js +0 -4169
  143. package/doc_build/static/js/async/zh_plugins_guide_plugin-object.js.map +0 -1
  144. package/doc_build/static/js/async/zh_plugins_guide_setup-function.js +0 -3815
  145. package/doc_build/static/js/async/zh_plugins_guide_setup-function.js.map +0 -1
  146. package/doc_build/static/js/async/zh_plugins_official-list_overview.js +0 -66
  147. package/doc_build/static/js/async/zh_plugins_official-list_overview.js.map +0 -1
  148. package/doc_build/static/js/builder-runtime.js +0 -1375
  149. package/doc_build/static/js/builder-runtime.js.map +0 -1
  150. package/doc_build/static/js/lib-lodash.js +0 -4907
  151. package/doc_build/static/js/lib-lodash.js.map +0 -1
  152. package/doc_build/static/js/lib-polyfill.js +0 -11847
  153. package/doc_build/static/js/lib-polyfill.js.map +0 -1
  154. package/doc_build/static/js/lib-react.js +0 -39510
  155. package/doc_build/static/js/lib-react.js.map +0 -1
  156. package/doc_build/static/js/main.js +0 -8610
  157. package/doc_build/static/js/main.js.map +0 -1
  158. 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 +0 -7328
  159. 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 +0 -1
  160. package/doc_build/static/search_index.json +0 -1
@@ -1,3711 +0,0 @@
1
- "use strict";
2
- (self["webpackChunk_modern_js_module_tools_docs"] = self["webpackChunk_modern_js_module_tools_docs"] || []).push([["zh_guide_basic_before-getting-started"],{
3
-
4
- /***/ "./docs/zh/guide/basic/before-getting-started.md":
5
- /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
6
-
7
- __webpack_require__.r(__webpack_exports__);
8
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9
- /* harmony export */ "CH": function() { return /* binding */ CH; },
10
- /* harmony export */ "chCodeConfig": function() { return /* binding */ chCodeConfig; },
11
- /* harmony export */ "content": function() { return /* binding */ content; },
12
- /* harmony export */ "frontmatter": function() { return /* binding */ frontmatter; },
13
- /* harmony export */ "title": function() { return /* binding */ title; },
14
- /* harmony export */ "toc": function() { return /* binding */ toc; }
15
- /* harmony export */ });
16
- /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.js");
17
- /* harmony import */ var _code_hike_mdx_dist_components_cjs_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@code-hike+mdx@0.7.4_react@18.2.0/node_modules/@code-hike/mdx/dist/components.esm.mjs");
18
- /*@jsxRuntime automatic @jsxImportSource react*/
19
-
20
-
21
- const CH = {
22
- annotations: _code_hike_mdx_dist_components_cjs_js__WEBPACK_IMPORTED_MODULE_1__.annotations,
23
- Code: _code_hike_mdx_dist_components_cjs_js__WEBPACK_IMPORTED_MODULE_1__.Code
24
- };
25
- const chCodeConfig = {
26
- "staticMediaQuery": "not screen, (max-width: 768px)",
27
- "theme": {
28
- "name": "nord",
29
- "type": "dark",
30
- "semanticHighlighting": true,
31
- "colors": {
32
- "focusBorder": "#3b4252",
33
- "foreground": "#d8dee9",
34
- "activityBar.background": "#2e3440",
35
- "activityBar.dropBackground": "#3b4252",
36
- "activityBar.foreground": "#d8dee9",
37
- "activityBar.activeBorder": "#88c0d0",
38
- "activityBar.activeBackground": "#3b4252",
39
- "activityBarBadge.background": "#88c0d0",
40
- "activityBarBadge.foreground": "#2e3440",
41
- "badge.foreground": "#2e3440",
42
- "badge.background": "#88c0d0",
43
- "button.background": "#88c0d0ee",
44
- "button.foreground": "#2e3440",
45
- "button.hoverBackground": "#88c0d0",
46
- "button.secondaryBackground": "#434c5e",
47
- "button.secondaryForeground": "#d8dee9",
48
- "button.secondaryHoverBackground": "#4c566a",
49
- "charts.red": "#bf616a",
50
- "charts.blue": "#81a1c1",
51
- "charts.yellow": "#ebcb8b",
52
- "charts.orange": "#d08770",
53
- "charts.green": "#a3be8c",
54
- "charts.purple": "#b48ead",
55
- "charts.foreground": "#d8dee9",
56
- "charts.lines": "#88c0d0",
57
- "debugConsole.infoForeground": "#88c0d0",
58
- "debugConsole.warningForeground": "#ebcb8b",
59
- "debugConsole.errorForeground": "#bf616a",
60
- "debugConsole.sourceForeground": "#616e88",
61
- "debugConsoleInputIcon.foreground": "#81a1c1",
62
- "debugExceptionWidget.background": "#4c566a",
63
- "debugExceptionWidget.border": "#2e3440",
64
- "debugToolBar.background": "#3b4252",
65
- "descriptionForeground": "#d8dee9e6",
66
- "diffEditor.insertedTextBackground": "#81a1c133",
67
- "diffEditor.removedTextBackground": "#bf616a4d",
68
- "dropdown.background": "#3b4252",
69
- "dropdown.border": "#3b4252",
70
- "dropdown.foreground": "#d8dee9",
71
- "editorActiveLineNumber.foreground": "#d8dee9cc",
72
- "editorCursor.foreground": "#d8dee9",
73
- "editorHint.border": "#ebcb8b00",
74
- "editorHint.foreground": "#ebcb8b",
75
- "editorIndentGuide.background": "#434c5eb3",
76
- "editorIndentGuide.activeBackground": "#4c566a",
77
- "editorInlayHint.background": "#434c5e",
78
- "editorInlayHint.foreground": "#d8dee9",
79
- "editorLineNumber.foreground": "#4c566a",
80
- "editorLineNumber.activeForeground": "#d8dee9",
81
- "editorWhitespace.foreground": "#4c566ab3",
82
- "editorWidget.background": "#2e3440",
83
- "editorWidget.border": "#3b4252",
84
- "editor.background": "#2e3440",
85
- "editor.foreground": "#d8dee9",
86
- "editor.hoverHighlightBackground": "#3b4252",
87
- "editor.findMatchBackground": "#88c0d066",
88
- "editor.findMatchHighlightBackground": "#88c0d033",
89
- "editor.findRangeHighlightBackground": "#88c0d033",
90
- "editor.lineHighlightBackground": "#3b4252",
91
- "editor.lineHighlightBorder": "#3b4252",
92
- "editor.inactiveSelectionBackground": "#434c5ecc",
93
- "editor.inlineValuesBackground": "#4c566a",
94
- "editor.inlineValuesForeground": "#eceff4",
95
- "editor.selectionBackground": "#434c5ecc",
96
- "editor.selectionHighlightBackground": "#434c5ecc",
97
- "editor.rangeHighlightBackground": "#434c5e52",
98
- "editor.wordHighlightBackground": "#81a1c166",
99
- "editor.wordHighlightStrongBackground": "#81a1c199",
100
- "editor.stackFrameHighlightBackground": "#5e81ac",
101
- "editor.focusedStackFrameHighlightBackground": "#5e81ac",
102
- "editorError.foreground": "#bf616a",
103
- "editorError.border": "#bf616a00",
104
- "editorWarning.foreground": "#ebcb8b",
105
- "editorWarning.border": "#ebcb8b00",
106
- "editorBracketMatch.background": "#2e344000",
107
- "editorBracketMatch.border": "#88c0d0",
108
- "editorBracketHighlight.foreground1": "#8fbcbb",
109
- "editorBracketHighlight.foreground2": "#88c0d0",
110
- "editorBracketHighlight.foreground3": "#81a1c1",
111
- "editorBracketHighlight.foreground4": "#5e81ac",
112
- "editorBracketHighlight.foreground5": "#8fbcbb",
113
- "editorBracketHighlight.foreground6": "#88c0d0",
114
- "editorBracketHighlight.unexpectedBracket.foreground": "#bf616a",
115
- "editorCodeLens.foreground": "#4c566a",
116
- "editorGroup.background": "#2e3440",
117
- "editorGroup.border": "#3b425201",
118
- "editorGroup.dropBackground": "#3b425299",
119
- "editorGroupHeader.border": "#3b425200",
120
- "editorGroupHeader.noTabsBackground": "#2e3440",
121
- "editorGroupHeader.tabsBackground": "#2e3440",
122
- "editorGroupHeader.tabsBorder": "#3b425200",
123
- "editorGutter.background": "#2e3440",
124
- "editorGutter.modifiedBackground": "#ebcb8b",
125
- "editorGutter.addedBackground": "#a3be8c",
126
- "editorGutter.deletedBackground": "#bf616a",
127
- "editorHoverWidget.background": "#3b4252",
128
- "editorHoverWidget.border": "#3b4252",
129
- "editorLink.activeForeground": "#88c0d0",
130
- "editorMarkerNavigation.background": "#5e81acc0",
131
- "editorMarkerNavigationError.background": "#bf616ac0",
132
- "editorMarkerNavigationWarning.background": "#ebcb8bc0",
133
- "editorOverviewRuler.border": "#3b4252",
134
- "editorOverviewRuler.currentContentForeground": "#3b4252",
135
- "editorOverviewRuler.incomingContentForeground": "#3b4252",
136
- "editorOverviewRuler.findMatchForeground": "#88c0d066",
137
- "editorOverviewRuler.rangeHighlightForeground": "#88c0d066",
138
- "editorOverviewRuler.selectionHighlightForeground": "#88c0d066",
139
- "editorOverviewRuler.wordHighlightForeground": "#88c0d066",
140
- "editorOverviewRuler.wordHighlightStrongForeground": "#88c0d066",
141
- "editorOverviewRuler.modifiedForeground": "#ebcb8b",
142
- "editorOverviewRuler.addedForeground": "#a3be8c",
143
- "editorOverviewRuler.deletedForeground": "#bf616a",
144
- "editorOverviewRuler.errorForeground": "#bf616a",
145
- "editorOverviewRuler.warningForeground": "#ebcb8b",
146
- "editorOverviewRuler.infoForeground": "#81a1c1",
147
- "editorRuler.foreground": "#434c5e",
148
- "editorSuggestWidget.background": "#2e3440",
149
- "editorSuggestWidget.border": "#3b4252",
150
- "editorSuggestWidget.foreground": "#d8dee9",
151
- "editorSuggestWidget.focusHighlightForeground": "#88c0d0",
152
- "editorSuggestWidget.highlightForeground": "#88c0d0",
153
- "editorSuggestWidget.selectedBackground": "#434c5e",
154
- "editorSuggestWidget.selectedForeground": "#d8dee9",
155
- "extensionButton.prominentForeground": "#d8dee9",
156
- "extensionButton.prominentBackground": "#434c5e",
157
- "extensionButton.prominentHoverBackground": "#4c566a",
158
- "errorForeground": "#bf616a",
159
- "gitDecoration.modifiedResourceForeground": "#ebcb8b",
160
- "gitDecoration.deletedResourceForeground": "#bf616a",
161
- "gitDecoration.untrackedResourceForeground": "#a3be8c",
162
- "gitDecoration.ignoredResourceForeground": "#d8dee966",
163
- "gitDecoration.conflictingResourceForeground": "#5e81ac",
164
- "gitDecoration.submoduleResourceForeground": "#8fbcbb",
165
- "gitDecoration.stageDeletedResourceForeground": "#bf616a",
166
- "gitDecoration.stageModifiedResourceForeground": "#ebcb8b",
167
- "input.background": "#3b4252",
168
- "input.foreground": "#d8dee9",
169
- "input.placeholderForeground": "#d8dee999",
170
- "input.border": "#3b4252",
171
- "inputOption.activeBackground": "#5e81ac",
172
- "inputOption.activeBorder": "#5e81ac",
173
- "inputOption.activeForeground": "#eceff4",
174
- "inputValidation.errorBackground": "#bf616a",
175
- "inputValidation.errorBorder": "#bf616a",
176
- "inputValidation.infoBackground": "#81a1c1",
177
- "inputValidation.infoBorder": "#81a1c1",
178
- "inputValidation.warningBackground": "#d08770",
179
- "inputValidation.warningBorder": "#d08770",
180
- "keybindingLabel.background": "#4c566a",
181
- "keybindingLabel.border": "#4c566a",
182
- "keybindingLabel.bottomBorder": "#4c566a",
183
- "keybindingLabel.foreground": "#d8dee9",
184
- "list.activeSelectionBackground": "#88c0d0",
185
- "list.activeSelectionForeground": "#2e3440",
186
- "list.inactiveSelectionBackground": "#434c5e",
187
- "list.inactiveSelectionForeground": "#d8dee9",
188
- "list.inactiveFocusBackground": "#434c5ecc",
189
- "list.hoverForeground": "#eceff4",
190
- "list.focusForeground": "#d8dee9",
191
- "list.focusBackground": "#88c0d099",
192
- "list.focusHighlightForeground": "#eceff4",
193
- "list.hoverBackground": "#3b4252",
194
- "list.dropBackground": "#88c0d099",
195
- "list.highlightForeground": "#88c0d0",
196
- "list.errorForeground": "#bf616a",
197
- "list.warningForeground": "#ebcb8b",
198
- "merge.currentHeaderBackground": "#81a1c166",
199
- "merge.currentContentBackground": "#81a1c14d",
200
- "merge.incomingHeaderBackground": "#8fbcbb66",
201
- "merge.incomingContentBackground": "#8fbcbb4d",
202
- "merge.border": "#3b425200",
203
- "minimap.background": "#2e3440",
204
- "minimap.errorHighlight": "#bf616acc",
205
- "minimap.findMatchHighlight": "#88c0d0",
206
- "minimap.selectionHighlight": "#88c0d0cc",
207
- "minimap.warningHighlight": "#ebcb8bcc",
208
- "minimapGutter.addedBackground": "#a3be8c",
209
- "minimapGutter.deletedBackground": "#bf616a",
210
- "minimapGutter.modifiedBackground": "#ebcb8b",
211
- "minimapSlider.activeBackground": "#434c5eaa",
212
- "minimapSlider.background": "#434c5e99",
213
- "minimapSlider.hoverBackground": "#434c5eaa",
214
- "notification.background": "#3b4252",
215
- "notification.buttonBackground": "#434c5e",
216
- "notification.buttonForeground": "#d8dee9",
217
- "notification.buttonHoverBackground": "#4c566a",
218
- "notification.errorBackground": "#bf616a",
219
- "notification.errorForeground": "#2e3440",
220
- "notification.foreground": "#d8dee9",
221
- "notification.infoBackground": "#88c0d0",
222
- "notification.infoForeground": "#2e3440",
223
- "notification.warningBackground": "#ebcb8b",
224
- "notification.warningForeground": "#2e3440",
225
- "notificationCenter.border": "#3b425200",
226
- "notificationCenterHeader.background": "#2e3440",
227
- "notificationCenterHeader.foreground": "#88c0d0",
228
- "notificationLink.foreground": "#88c0d0",
229
- "notifications.background": "#3b4252",
230
- "notifications.border": "#2e3440",
231
- "notifications.foreground": "#d8dee9",
232
- "notificationToast.border": "#3b425200",
233
- "panel.background": "#2e3440",
234
- "panel.border": "#3b4252",
235
- "panelTitle.activeBorder": "#88c0d000",
236
- "panelTitle.activeForeground": "#88c0d0",
237
- "panelTitle.inactiveForeground": "#d8dee9",
238
- "peekView.border": "#4c566a",
239
- "peekViewEditor.background": "#2e3440",
240
- "peekViewEditorGutter.background": "#2e3440",
241
- "peekViewEditor.matchHighlightBackground": "#88c0d04d",
242
- "peekViewResult.background": "#2e3440",
243
- "peekViewResult.fileForeground": "#88c0d0",
244
- "peekViewResult.lineForeground": "#d8dee966",
245
- "peekViewResult.matchHighlightBackground": "#88c0d0cc",
246
- "peekViewResult.selectionBackground": "#434c5e",
247
- "peekViewResult.selectionForeground": "#d8dee9",
248
- "peekViewTitle.background": "#3b4252",
249
- "peekViewTitleDescription.foreground": "#d8dee9",
250
- "peekViewTitleLabel.foreground": "#88c0d0",
251
- "pickerGroup.border": "#3b4252",
252
- "pickerGroup.foreground": "#88c0d0",
253
- "progressBar.background": "#88c0d0",
254
- "quickInputList.focusBackground": "#88c0d0",
255
- "quickInputList.focusForeground": "#2e3440",
256
- "sash.hoverBorder": "#88c0d0",
257
- "scrollbar.shadow": "#00000066",
258
- "scrollbarSlider.activeBackground": "#434c5eaa",
259
- "scrollbarSlider.background": "#434c5e99",
260
- "scrollbarSlider.hoverBackground": "#434c5eaa",
261
- "selection.background": "#88c0d099",
262
- "sideBar.background": "#2e3440",
263
- "sideBar.foreground": "#d8dee9",
264
- "sideBar.border": "#3b4252",
265
- "sideBarSectionHeader.background": "#3b4252",
266
- "sideBarSectionHeader.foreground": "#d8dee9",
267
- "sideBarTitle.foreground": "#d8dee9",
268
- "statusBar.background": "#3b4252",
269
- "statusBar.debuggingBackground": "#5e81ac",
270
- "statusBar.debuggingForeground": "#d8dee9",
271
- "statusBar.noFolderForeground": "#d8dee9",
272
- "statusBar.noFolderBackground": "#3b4252",
273
- "statusBar.foreground": "#d8dee9",
274
- "statusBarItem.activeBackground": "#4c566a",
275
- "statusBarItem.hoverBackground": "#434c5e",
276
- "statusBarItem.prominentBackground": "#3b4252",
277
- "statusBarItem.prominentHoverBackground": "#434c5e",
278
- "statusBarItem.errorBackground": "#3b4252",
279
- "statusBarItem.errorForeground": "#bf616a",
280
- "statusBarItem.warningBackground": "#ebcb8b",
281
- "statusBarItem.warningForeground": "#2e3440",
282
- "statusBar.border": "#3b425200",
283
- "tab.activeBackground": "#3b4252",
284
- "tab.activeForeground": "#d8dee9",
285
- "tab.border": "#3b425200",
286
- "tab.activeBorder": "#88c0d000",
287
- "tab.unfocusedActiveBorder": "#88c0d000",
288
- "tab.inactiveBackground": "#2e3440",
289
- "tab.inactiveForeground": "#d8dee966",
290
- "tab.unfocusedActiveForeground": "#d8dee999",
291
- "tab.unfocusedInactiveForeground": "#d8dee966",
292
- "tab.hoverBackground": "#3b4252cc",
293
- "tab.unfocusedHoverBackground": "#3b4252b3",
294
- "tab.hoverBorder": "#88c0d000",
295
- "tab.unfocusedHoverBorder": "#88c0d000",
296
- "tab.activeBorderTop": "#88c0d000",
297
- "tab.unfocusedActiveBorderTop": "#88c0d000",
298
- "tab.lastPinnedBorder": "#4c566a",
299
- "terminal.background": "#2e3440",
300
- "terminal.foreground": "#d8dee9",
301
- "terminal.ansiBlack": "#3b4252",
302
- "terminal.ansiRed": "#bf616a",
303
- "terminal.ansiGreen": "#a3be8c",
304
- "terminal.ansiYellow": "#ebcb8b",
305
- "terminal.ansiBlue": "#81a1c1",
306
- "terminal.ansiMagenta": "#b48ead",
307
- "terminal.ansiCyan": "#88c0d0",
308
- "terminal.ansiWhite": "#e5e9f0",
309
- "terminal.ansiBrightBlack": "#4c566a",
310
- "terminal.ansiBrightRed": "#bf616a",
311
- "terminal.ansiBrightGreen": "#a3be8c",
312
- "terminal.ansiBrightYellow": "#ebcb8b",
313
- "terminal.ansiBrightBlue": "#81a1c1",
314
- "terminal.ansiBrightMagenta": "#b48ead",
315
- "terminal.ansiBrightCyan": "#8fbcbb",
316
- "terminal.ansiBrightWhite": "#eceff4",
317
- "terminal.tab.activeBorder": "#88c0d0",
318
- "textBlockQuote.background": "#3b4252",
319
- "textBlockQuote.border": "#81a1c1",
320
- "textCodeBlock.background": "#4c566a",
321
- "textLink.activeForeground": "#88c0d0",
322
- "textLink.foreground": "#88c0d0",
323
- "textPreformat.foreground": "#8fbcbb",
324
- "textSeparator.foreground": "#eceff4",
325
- "titleBar.activeBackground": "#2e3440",
326
- "titleBar.activeForeground": "#d8dee9",
327
- "titleBar.border": "#2e344000",
328
- "titleBar.inactiveBackground": "#2e3440",
329
- "titleBar.inactiveForeground": "#d8dee966",
330
- "tree.indentGuidesStroke": "#616e88",
331
- "walkThrough.embeddedEditorBackground": "#2e3440",
332
- "welcomePage.buttonBackground": "#434c5e",
333
- "welcomePage.buttonHoverBackground": "#4c566a",
334
- "widget.shadow": "#00000066"
335
- },
336
- "tokenColors": [{
337
- "settings": {
338
- "foreground": "#d8dee9ff",
339
- "background": "#2e3440ff"
340
- }
341
- }, {
342
- "scope": "emphasis",
343
- "settings": {
344
- "fontStyle": "italic"
345
- }
346
- }, {
347
- "scope": "strong",
348
- "settings": {
349
- "fontStyle": "bold"
350
- }
351
- }, {
352
- "name": "Comment",
353
- "scope": "comment",
354
- "settings": {
355
- "foreground": "#616E88"
356
- }
357
- }, {
358
- "name": "Constant Character",
359
- "scope": "constant.character",
360
- "settings": {
361
- "foreground": "#EBCB8B"
362
- }
363
- }, {
364
- "name": "Constant Character Escape",
365
- "scope": "constant.character.escape",
366
- "settings": {
367
- "foreground": "#EBCB8B"
368
- }
369
- }, {
370
- "name": "Constant Language",
371
- "scope": "constant.language",
372
- "settings": {
373
- "foreground": "#81A1C1"
374
- }
375
- }, {
376
- "name": "Constant Numeric",
377
- "scope": "constant.numeric",
378
- "settings": {
379
- "foreground": "#B48EAD"
380
- }
381
- }, {
382
- "name": "Constant Regexp",
383
- "scope": "constant.regexp",
384
- "settings": {
385
- "foreground": "#EBCB8B"
386
- }
387
- }, {
388
- "name": "Entity Name Class/Type",
389
- "scope": ["entity.name.class", "entity.name.type.class"],
390
- "settings": {
391
- "foreground": "#8FBCBB"
392
- }
393
- }, {
394
- "name": "Entity Name Function",
395
- "scope": "entity.name.function",
396
- "settings": {
397
- "foreground": "#88C0D0"
398
- }
399
- }, {
400
- "name": "Entity Name Tag",
401
- "scope": "entity.name.tag",
402
- "settings": {
403
- "foreground": "#81A1C1"
404
- }
405
- }, {
406
- "name": "Entity Other Attribute Name",
407
- "scope": "entity.other.attribute-name",
408
- "settings": {
409
- "foreground": "#8FBCBB"
410
- }
411
- }, {
412
- "name": "Entity Other Inherited Class",
413
- "scope": "entity.other.inherited-class",
414
- "settings": {
415
- "fontStyle": "bold",
416
- "foreground": "#8FBCBB"
417
- }
418
- }, {
419
- "name": "Invalid Deprecated",
420
- "scope": "invalid.deprecated",
421
- "settings": {
422
- "foreground": "#D8DEE9",
423
- "background": "#EBCB8B"
424
- }
425
- }, {
426
- "name": "Invalid Illegal",
427
- "scope": "invalid.illegal",
428
- "settings": {
429
- "foreground": "#D8DEE9",
430
- "background": "#BF616A"
431
- }
432
- }, {
433
- "name": "Keyword",
434
- "scope": "keyword",
435
- "settings": {
436
- "foreground": "#81A1C1"
437
- }
438
- }, {
439
- "name": "Keyword Operator",
440
- "scope": "keyword.operator",
441
- "settings": {
442
- "foreground": "#81A1C1"
443
- }
444
- }, {
445
- "name": "Keyword Other New",
446
- "scope": "keyword.other.new",
447
- "settings": {
448
- "foreground": "#81A1C1"
449
- }
450
- }, {
451
- "name": "Markup Bold",
452
- "scope": "markup.bold",
453
- "settings": {
454
- "fontStyle": "bold"
455
- }
456
- }, {
457
- "name": "Markup Changed",
458
- "scope": "markup.changed",
459
- "settings": {
460
- "foreground": "#EBCB8B"
461
- }
462
- }, {
463
- "name": "Markup Deleted",
464
- "scope": "markup.deleted",
465
- "settings": {
466
- "foreground": "#BF616A"
467
- }
468
- }, {
469
- "name": "Markup Inserted",
470
- "scope": "markup.inserted",
471
- "settings": {
472
- "foreground": "#A3BE8C"
473
- }
474
- }, {
475
- "name": "Meta Preprocessor",
476
- "scope": "meta.preprocessor",
477
- "settings": {
478
- "foreground": "#5E81AC"
479
- }
480
- }, {
481
- "name": "Punctuation",
482
- "scope": "punctuation",
483
- "settings": {
484
- "foreground": "#ECEFF4"
485
- }
486
- }, {
487
- "name": "Punctuation Definition Parameters",
488
- "scope": ["punctuation.definition.method-parameters", "punctuation.definition.function-parameters", "punctuation.definition.parameters"],
489
- "settings": {
490
- "foreground": "#ECEFF4"
491
- }
492
- }, {
493
- "name": "Punctuation Definition Tag",
494
- "scope": "punctuation.definition.tag",
495
- "settings": {
496
- "foreground": "#81A1C1"
497
- }
498
- }, {
499
- "name": "Punctuation Definition Comment",
500
- "scope": ["punctuation.definition.comment", "punctuation.end.definition.comment", "punctuation.start.definition.comment"],
501
- "settings": {
502
- "foreground": "#616E88"
503
- }
504
- }, {
505
- "name": "Punctuation Section",
506
- "scope": "punctuation.section",
507
- "settings": {
508
- "foreground": "#ECEFF4"
509
- }
510
- }, {
511
- "name": "Punctuation Section Embedded",
512
- "scope": ["punctuation.section.embedded.begin", "punctuation.section.embedded.end"],
513
- "settings": {
514
- "foreground": "#81A1C1"
515
- }
516
- }, {
517
- "name": "Punctuation Terminator",
518
- "scope": "punctuation.terminator",
519
- "settings": {
520
- "foreground": "#81A1C1"
521
- }
522
- }, {
523
- "name": "Punctuation Variable",
524
- "scope": "punctuation.definition.variable",
525
- "settings": {
526
- "foreground": "#81A1C1"
527
- }
528
- }, {
529
- "name": "Storage",
530
- "scope": "storage",
531
- "settings": {
532
- "foreground": "#81A1C1"
533
- }
534
- }, {
535
- "name": "String",
536
- "scope": "string",
537
- "settings": {
538
- "foreground": "#A3BE8C"
539
- }
540
- }, {
541
- "name": "String Regexp",
542
- "scope": "string.regexp",
543
- "settings": {
544
- "foreground": "#EBCB8B"
545
- }
546
- }, {
547
- "name": "Support Class",
548
- "scope": "support.class",
549
- "settings": {
550
- "foreground": "#8FBCBB"
551
- }
552
- }, {
553
- "name": "Support Constant",
554
- "scope": "support.constant",
555
- "settings": {
556
- "foreground": "#81A1C1"
557
- }
558
- }, {
559
- "name": "Support Function",
560
- "scope": "support.function",
561
- "settings": {
562
- "foreground": "#88C0D0"
563
- }
564
- }, {
565
- "name": "Support Function Construct",
566
- "scope": "support.function.construct",
567
- "settings": {
568
- "foreground": "#81A1C1"
569
- }
570
- }, {
571
- "name": "Support Type",
572
- "scope": "support.type",
573
- "settings": {
574
- "foreground": "#8FBCBB"
575
- }
576
- }, {
577
- "name": "Support Type Exception",
578
- "scope": "support.type.exception",
579
- "settings": {
580
- "foreground": "#8FBCBB"
581
- }
582
- }, {
583
- "name": "Token Debug",
584
- "scope": "token.debug-token",
585
- "settings": {
586
- "foreground": "#b48ead"
587
- }
588
- }, {
589
- "name": "Token Error",
590
- "scope": "token.error-token",
591
- "settings": {
592
- "foreground": "#bf616a"
593
- }
594
- }, {
595
- "name": "Token Info",
596
- "scope": "token.info-token",
597
- "settings": {
598
- "foreground": "#88c0d0"
599
- }
600
- }, {
601
- "name": "Token Warning",
602
- "scope": "token.warn-token",
603
- "settings": {
604
- "foreground": "#ebcb8b"
605
- }
606
- }, {
607
- "name": "Variable",
608
- "scope": "variable.other",
609
- "settings": {
610
- "foreground": "#D8DEE9"
611
- }
612
- }, {
613
- "name": "Variable Language",
614
- "scope": "variable.language",
615
- "settings": {
616
- "foreground": "#81A1C1"
617
- }
618
- }, {
619
- "name": "Variable Parameter",
620
- "scope": "variable.parameter",
621
- "settings": {
622
- "foreground": "#D8DEE9"
623
- }
624
- }, {
625
- "name": "[C/CPP] Punctuation Separator Pointer-Access",
626
- "scope": "punctuation.separator.pointer-access.c",
627
- "settings": {
628
- "foreground": "#81A1C1"
629
- }
630
- }, {
631
- "name": "[C/CPP] Meta Preprocessor Include",
632
- "scope": ["source.c meta.preprocessor.include", "source.c string.quoted.other.lt-gt.include"],
633
- "settings": {
634
- "foreground": "#8FBCBB"
635
- }
636
- }, {
637
- "name": "[C/CPP] Conditional Directive",
638
- "scope": ["source.cpp keyword.control.directive.conditional", "source.cpp punctuation.definition.directive", "source.c keyword.control.directive.conditional", "source.c punctuation.definition.directive"],
639
- "settings": {
640
- "foreground": "#5E81AC",
641
- "fontStyle": "bold"
642
- }
643
- }, {
644
- "name": "[CSS] Constant Other Color RGB Value",
645
- "scope": "source.css constant.other.color.rgb-value",
646
- "settings": {
647
- "foreground": "#B48EAD"
648
- }
649
- }, {
650
- "name": "[CSS](Function) Meta Property-Value",
651
- "scope": "source.css meta.property-value",
652
- "settings": {
653
- "foreground": "#88C0D0"
654
- }
655
- }, {
656
- "name": "[CSS] Media Queries",
657
- "scope": ["source.css keyword.control.at-rule.media", "source.css keyword.control.at-rule.media punctuation.definition.keyword"],
658
- "settings": {
659
- "foreground": "#D08770"
660
- }
661
- }, {
662
- "name": "[CSS] Punctuation Definition Keyword",
663
- "scope": "source.css punctuation.definition.keyword",
664
- "settings": {
665
- "foreground": "#81A1C1"
666
- }
667
- }, {
668
- "name": "[CSS] Support Type Property Name",
669
- "scope": "source.css support.type.property-name",
670
- "settings": {
671
- "foreground": "#D8DEE9"
672
- }
673
- }, {
674
- "name": "[diff] Meta Range Context",
675
- "scope": "source.diff meta.diff.range.context",
676
- "settings": {
677
- "foreground": "#8FBCBB"
678
- }
679
- }, {
680
- "name": "[diff] Meta Header From-File",
681
- "scope": "source.diff meta.diff.header.from-file",
682
- "settings": {
683
- "foreground": "#8FBCBB"
684
- }
685
- }, {
686
- "name": "[diff] Punctuation Definition From-File",
687
- "scope": "source.diff punctuation.definition.from-file",
688
- "settings": {
689
- "foreground": "#8FBCBB"
690
- }
691
- }, {
692
- "name": "[diff] Punctuation Definition Range",
693
- "scope": "source.diff punctuation.definition.range",
694
- "settings": {
695
- "foreground": "#8FBCBB"
696
- }
697
- }, {
698
- "name": "[diff] Punctuation Definition Separator",
699
- "scope": "source.diff punctuation.definition.separator",
700
- "settings": {
701
- "foreground": "#81A1C1"
702
- }
703
- }, {
704
- "name": "[Elixir](JakeBecker.elixir-ls) module names",
705
- "scope": "entity.name.type.module.elixir",
706
- "settings": {
707
- "foreground": "#8FBCBB"
708
- }
709
- }, {
710
- "name": "[Elixir](JakeBecker.elixir-ls) module attributes",
711
- "scope": "variable.other.readwrite.module.elixir",
712
- "settings": {
713
- "foreground": "#D8DEE9",
714
- "fontStyle": "bold"
715
- }
716
- }, {
717
- "name": "[Elixir](JakeBecker.elixir-ls) atoms",
718
- "scope": "constant.other.symbol.elixir",
719
- "settings": {
720
- "foreground": "#D8DEE9",
721
- "fontStyle": "bold"
722
- }
723
- }, {
724
- "name": "[Elixir](JakeBecker.elixir-ls) modules",
725
- "scope": "variable.other.constant.elixir",
726
- "settings": {
727
- "foreground": "#8FBCBB"
728
- }
729
- }, {
730
- "name": "[Go] String Format Placeholder",
731
- "scope": "source.go constant.other.placeholder.go",
732
- "settings": {
733
- "foreground": "#EBCB8B"
734
- }
735
- }, {
736
- "name": "[Java](JavaDoc) Comment Block Documentation HTML Entities",
737
- "scope": "source.java comment.block.documentation.javadoc punctuation.definition.entity.html",
738
- "settings": {
739
- "foreground": "#81A1C1"
740
- }
741
- }, {
742
- "name": "[Java](JavaDoc) Constant Other",
743
- "scope": "source.java constant.other",
744
- "settings": {
745
- "foreground": "#D8DEE9"
746
- }
747
- }, {
748
- "name": "[Java](JavaDoc) Keyword Other Documentation",
749
- "scope": "source.java keyword.other.documentation",
750
- "settings": {
751
- "foreground": "#8FBCBB"
752
- }
753
- }, {
754
- "name": "[Java](JavaDoc) Keyword Other Documentation Author",
755
- "scope": "source.java keyword.other.documentation.author.javadoc",
756
- "settings": {
757
- "foreground": "#8FBCBB"
758
- }
759
- }, {
760
- "name": "[Java](JavaDoc) Keyword Other Documentation Directive/Custom",
761
- "scope": ["source.java keyword.other.documentation.directive", "source.java keyword.other.documentation.custom"],
762
- "settings": {
763
- "foreground": "#8FBCBB"
764
- }
765
- }, {
766
- "name": "[Java](JavaDoc) Keyword Other Documentation See",
767
- "scope": "source.java keyword.other.documentation.see.javadoc",
768
- "settings": {
769
- "foreground": "#8FBCBB"
770
- }
771
- }, {
772
- "name": "[Java] Meta Method-Call",
773
- "scope": "source.java meta.method-call meta.method",
774
- "settings": {
775
- "foreground": "#88C0D0"
776
- }
777
- }, {
778
- "name": "[Java](JavaDoc) Meta Tag Template Link",
779
- "scope": ["source.java meta.tag.template.link.javadoc", "source.java string.other.link.title.javadoc"],
780
- "settings": {
781
- "foreground": "#8FBCBB"
782
- }
783
- }, {
784
- "name": "[Java](JavaDoc) Meta Tag Template Value",
785
- "scope": "source.java meta.tag.template.value.javadoc",
786
- "settings": {
787
- "foreground": "#88C0D0"
788
- }
789
- }, {
790
- "name": "[Java](JavaDoc) Punctuation Definition Keyword",
791
- "scope": "source.java punctuation.definition.keyword.javadoc",
792
- "settings": {
793
- "foreground": "#8FBCBB"
794
- }
795
- }, {
796
- "name": "[Java](JavaDoc) Punctuation Definition Tag",
797
- "scope": ["source.java punctuation.definition.tag.begin.javadoc", "source.java punctuation.definition.tag.end.javadoc"],
798
- "settings": {
799
- "foreground": "#616E88"
800
- }
801
- }, {
802
- "name": "[Java] Storage Modifier Import",
803
- "scope": "source.java storage.modifier.import",
804
- "settings": {
805
- "foreground": "#8FBCBB"
806
- }
807
- }, {
808
- "name": "[Java] Storage Modifier Package",
809
- "scope": "source.java storage.modifier.package",
810
- "settings": {
811
- "foreground": "#8FBCBB"
812
- }
813
- }, {
814
- "name": "[Java] Storage Type",
815
- "scope": "source.java storage.type",
816
- "settings": {
817
- "foreground": "#8FBCBB"
818
- }
819
- }, {
820
- "name": "[Java] Storage Type Annotation",
821
- "scope": "source.java storage.type.annotation",
822
- "settings": {
823
- "foreground": "#D08770"
824
- }
825
- }, {
826
- "name": "[Java] Storage Type Generic",
827
- "scope": "source.java storage.type.generic",
828
- "settings": {
829
- "foreground": "#8FBCBB"
830
- }
831
- }, {
832
- "name": "[Java] Storage Type Primitive",
833
- "scope": "source.java storage.type.primitive",
834
- "settings": {
835
- "foreground": "#81A1C1"
836
- }
837
- }, {
838
- "name": "[JavaScript] Decorator",
839
- "scope": ["source.js punctuation.decorator", "source.js meta.decorator variable.other.readwrite", "source.js meta.decorator entity.name.function"],
840
- "settings": {
841
- "foreground": "#D08770"
842
- }
843
- }, {
844
- "name": "[JavaScript] Meta Object-Literal Key",
845
- "scope": "source.js meta.object-literal.key",
846
- "settings": {
847
- "foreground": "#88C0D0"
848
- }
849
- }, {
850
- "name": "[JavaScript](JSDoc) Storage Type Class",
851
- "scope": "source.js storage.type.class.jsdoc",
852
- "settings": {
853
- "foreground": "#8FBCBB"
854
- }
855
- }, {
856
- "name": "[JavaScript] String Template Literals Punctuation",
857
- "scope": ["source.js string.quoted.template punctuation.quasi.element.begin", "source.js string.quoted.template punctuation.quasi.element.end", "source.js string.template punctuation.definition.template-expression"],
858
- "settings": {
859
- "foreground": "#81A1C1"
860
- }
861
- }, {
862
- "name": "[JavaScript] Interpolated String Template Punctuation Functions",
863
- "scope": "source.js string.quoted.template meta.method-call.with-arguments",
864
- "settings": {
865
- "foreground": "#ECEFF4"
866
- }
867
- }, {
868
- "name": "[JavaScript] String Template Literal Variable",
869
- "scope": ["source.js string.template meta.template.expression support.variable.property", "source.js string.template meta.template.expression variable.other.object"],
870
- "settings": {
871
- "foreground": "#D8DEE9"
872
- }
873
- }, {
874
- "name": "[JavaScript] Support Type Primitive",
875
- "scope": "source.js support.type.primitive",
876
- "settings": {
877
- "foreground": "#81A1C1"
878
- }
879
- }, {
880
- "name": "[JavaScript] Variable Other Object",
881
- "scope": "source.js variable.other.object",
882
- "settings": {
883
- "foreground": "#D8DEE9"
884
- }
885
- }, {
886
- "name": "[JavaScript] Variable Other Read-Write Alias",
887
- "scope": "source.js variable.other.readwrite.alias",
888
- "settings": {
889
- "foreground": "#8FBCBB"
890
- }
891
- }, {
892
- "name": "[JavaScript] Parentheses in Template Strings",
893
- "scope": ["source.js meta.embedded.line meta.brace.square", "source.js meta.embedded.line meta.brace.round", "source.js string.quoted.template meta.brace.square", "source.js string.quoted.template meta.brace.round"],
894
- "settings": {
895
- "foreground": "#ECEFF4"
896
- }
897
- }, {
898
- "name": "[HTML] Constant Character Entity",
899
- "scope": "text.html.basic constant.character.entity.html",
900
- "settings": {
901
- "foreground": "#EBCB8B"
902
- }
903
- }, {
904
- "name": "[HTML] Constant Other Inline-Data",
905
- "scope": "text.html.basic constant.other.inline-data",
906
- "settings": {
907
- "foreground": "#D08770",
908
- "fontStyle": "italic"
909
- }
910
- }, {
911
- "name": "[HTML] Meta Tag SGML Doctype",
912
- "scope": "text.html.basic meta.tag.sgml.doctype",
913
- "settings": {
914
- "foreground": "#5E81AC"
915
- }
916
- }, {
917
- "name": "[HTML] Punctuation Definition Entity",
918
- "scope": "text.html.basic punctuation.definition.entity",
919
- "settings": {
920
- "foreground": "#81A1C1"
921
- }
922
- }, {
923
- "name": "[INI] Entity Name Section Group-Title",
924
- "scope": "source.properties entity.name.section.group-title.ini",
925
- "settings": {
926
- "foreground": "#88C0D0"
927
- }
928
- }, {
929
- "name": "[INI] Punctuation Separator Key-Value",
930
- "scope": "source.properties punctuation.separator.key-value.ini",
931
- "settings": {
932
- "foreground": "#81A1C1"
933
- }
934
- }, {
935
- "name": "[Markdown] Markup Fenced Code Block",
936
- "scope": ["text.html.markdown markup.fenced_code.block", "text.html.markdown markup.fenced_code.block punctuation.definition"],
937
- "settings": {
938
- "foreground": "#8FBCBB"
939
- }
940
- }, {
941
- "name": "[Markdown] Markup Heading",
942
- "scope": "markup.heading",
943
- "settings": {
944
- "foreground": "#88C0D0"
945
- }
946
- }, {
947
- "name": "[Markdown] Markup Inline",
948
- "scope": ["text.html.markdown markup.inline.raw", "text.html.markdown markup.inline.raw punctuation.definition.raw"],
949
- "settings": {
950
- "foreground": "#8FBCBB"
951
- }
952
- }, {
953
- "name": "[Markdown] Markup Italic",
954
- "scope": "text.html.markdown markup.italic",
955
- "settings": {
956
- "fontStyle": "italic"
957
- }
958
- }, {
959
- "name": "[Markdown] Markup Link",
960
- "scope": "text.html.markdown markup.underline.link",
961
- "settings": {
962
- "fontStyle": "underline"
963
- }
964
- }, {
965
- "name": "[Markdown] Markup List Numbered/Unnumbered",
966
- "scope": "text.html.markdown beginning.punctuation.definition.list",
967
- "settings": {
968
- "foreground": "#81A1C1"
969
- }
970
- }, {
971
- "name": "[Markdown] Markup Quote Punctuation Definition",
972
- "scope": "text.html.markdown beginning.punctuation.definition.quote",
973
- "settings": {
974
- "foreground": "#8FBCBB"
975
- }
976
- }, {
977
- "name": "[Markdown] Markup Quote Punctuation Definition",
978
- "scope": "text.html.markdown markup.quote",
979
- "settings": {
980
- "foreground": "#616E88"
981
- }
982
- }, {
983
- "name": "[Markdown] Markup Math Constant",
984
- "scope": "text.html.markdown constant.character.math.tex",
985
- "settings": {
986
- "foreground": "#81A1C1"
987
- }
988
- }, {
989
- "name": "[Markdown] Markup Math Definition Marker",
990
- "scope": ["text.html.markdown punctuation.definition.math.begin", "text.html.markdown punctuation.definition.math.end"],
991
- "settings": {
992
- "foreground": "#5E81AC"
993
- }
994
- }, {
995
- "name": "[Markdown] Markup Math Function Definition Marker",
996
- "scope": "text.html.markdown punctuation.definition.function.math.tex",
997
- "settings": {
998
- "foreground": "#88C0D0"
999
- }
1000
- }, {
1001
- "name": "[Markdown] Markup Math Operator",
1002
- "scope": "text.html.markdown punctuation.math.operator.latex",
1003
- "settings": {
1004
- "foreground": "#81A1C1"
1005
- }
1006
- }, {
1007
- "name": "[Markdown] Punctuation Definition Heading",
1008
- "scope": "text.html.markdown punctuation.definition.heading",
1009
- "settings": {
1010
- "foreground": "#81A1C1"
1011
- }
1012
- }, {
1013
- "name": "[Markdown] Punctuation Definition Constant/String",
1014
- "scope": ["text.html.markdown punctuation.definition.constant", "text.html.markdown punctuation.definition.string"],
1015
- "settings": {
1016
- "foreground": "#81A1C1"
1017
- }
1018
- }, {
1019
- "name": "[Markdown] String Other Link Description/Title",
1020
- "scope": ["text.html.markdown constant.other.reference.link", "text.html.markdown string.other.link.description", "text.html.markdown string.other.link.title"],
1021
- "settings": {
1022
- "foreground": "#88C0D0"
1023
- }
1024
- }, {
1025
- "name": "[Perl] Perl Sigils",
1026
- "scope": "source.perl punctuation.definition.variable",
1027
- "settings": {
1028
- "foreground": "#D8DEE9"
1029
- }
1030
- }, {
1031
- "name": "[PHP] Meta Function-Call Object",
1032
- "scope": ["source.php meta.function-call", "source.php meta.function-call.object"],
1033
- "settings": {
1034
- "foreground": "#88C0D0"
1035
- }
1036
- }, {
1037
- "name": "[Python] Decorator",
1038
- "scope": ["source.python entity.name.function.decorator", "source.python meta.function.decorator support.type"],
1039
- "settings": {
1040
- "foreground": "#D08770"
1041
- }
1042
- }, {
1043
- "name": "[Python] Function Call",
1044
- "scope": "source.python meta.function-call.generic",
1045
- "settings": {
1046
- "foreground": "#88C0D0"
1047
- }
1048
- }, {
1049
- "name": "[Python] Support Type",
1050
- "scope": "source.python support.type",
1051
- "settings": {
1052
- "foreground": "#88C0D0"
1053
- }
1054
- }, {
1055
- "name": "[Python] Function Parameter",
1056
- "scope": ["source.python variable.parameter.function.language"],
1057
- "settings": {
1058
- "foreground": "#D8DEE9"
1059
- }
1060
- }, {
1061
- "name": "[Python] Function Parameter Special",
1062
- "scope": ["source.python meta.function.parameters variable.parameter.function.language.special.self"],
1063
- "settings": {
1064
- "foreground": "#81A1C1"
1065
- }
1066
- }, {
1067
- "name": "[Rust] Entity types",
1068
- "scope": "source.rust entity.name.type",
1069
- "settings": {
1070
- "foreground": "#8FBCBB"
1071
- }
1072
- }, {
1073
- "name": "[Rust] Macro",
1074
- "scope": "source.rust meta.macro entity.name.function",
1075
- "settings": {
1076
- "fontStyle": "bold",
1077
- "foreground": "#88C0D0"
1078
- }
1079
- }, {
1080
- "name": "[Rust] Attributes",
1081
- "scope": ["source.rust meta.attribute", "source.rust meta.attribute punctuation", "source.rust meta.attribute keyword.operator"],
1082
- "settings": {
1083
- "foreground": "#5E81AC"
1084
- }
1085
- }, {
1086
- "name": "[Rust] Traits",
1087
- "scope": "source.rust entity.name.type.trait",
1088
- "settings": {
1089
- "fontStyle": "bold"
1090
- }
1091
- }, {
1092
- "name": "[Rust] Interpolation Bracket Curly",
1093
- "scope": "source.rust punctuation.definition.interpolation",
1094
- "settings": {
1095
- "foreground": "#EBCB8B"
1096
- }
1097
- }, {
1098
- "name": "[SCSS] Punctuation Definition Interpolation Bracket Curly",
1099
- "scope": ["source.css.scss punctuation.definition.interpolation.begin.bracket.curly", "source.css.scss punctuation.definition.interpolation.end.bracket.curly"],
1100
- "settings": {
1101
- "foreground": "#81A1C1"
1102
- }
1103
- }, {
1104
- "name": "[SCSS] Variable Interpolation",
1105
- "scope": "source.css.scss variable.interpolation",
1106
- "settings": {
1107
- "foreground": "#D8DEE9",
1108
- "fontStyle": "italic"
1109
- }
1110
- }, {
1111
- "name": "[TypeScript] Decorators",
1112
- "scope": ["source.ts punctuation.decorator", "source.ts meta.decorator variable.other.readwrite", "source.ts meta.decorator entity.name.function", "source.tsx punctuation.decorator", "source.tsx meta.decorator variable.other.readwrite", "source.tsx meta.decorator entity.name.function"],
1113
- "settings": {
1114
- "foreground": "#D08770"
1115
- }
1116
- }, {
1117
- "name": "[TypeScript] Object-literal keys",
1118
- "scope": ["source.ts meta.object-literal.key", "source.tsx meta.object-literal.key"],
1119
- "settings": {
1120
- "foreground": "#D8DEE9"
1121
- }
1122
- }, {
1123
- "name": "[TypeScript] Object-literal functions",
1124
- "scope": ["source.ts meta.object-literal.key entity.name.function", "source.tsx meta.object-literal.key entity.name.function"],
1125
- "settings": {
1126
- "foreground": "#88C0D0"
1127
- }
1128
- }, {
1129
- "name": "[TypeScript] Type/Class",
1130
- "scope": ["source.ts support.class", "source.ts support.type", "source.ts entity.name.type", "source.ts entity.name.class", "source.tsx support.class", "source.tsx support.type", "source.tsx entity.name.type", "source.tsx entity.name.class"],
1131
- "settings": {
1132
- "foreground": "#8FBCBB"
1133
- }
1134
- }, {
1135
- "name": "[TypeScript] Static Class Support",
1136
- "scope": ["source.ts support.constant.math", "source.ts support.constant.dom", "source.ts support.constant.json", "source.tsx support.constant.math", "source.tsx support.constant.dom", "source.tsx support.constant.json"],
1137
- "settings": {
1138
- "foreground": "#8FBCBB"
1139
- }
1140
- }, {
1141
- "name": "[TypeScript] Variables",
1142
- "scope": ["source.ts support.variable", "source.tsx support.variable"],
1143
- "settings": {
1144
- "foreground": "#D8DEE9"
1145
- }
1146
- }, {
1147
- "name": "[TypeScript] Parentheses in Template Strings",
1148
- "scope": ["source.ts meta.embedded.line meta.brace.square", "source.ts meta.embedded.line meta.brace.round", "source.tsx meta.embedded.line meta.brace.square", "source.tsx meta.embedded.line meta.brace.round"],
1149
- "settings": {
1150
- "foreground": "#ECEFF4"
1151
- }
1152
- }, {
1153
- "name": "[XML] Entity Name Tag Namespace",
1154
- "scope": "text.xml entity.name.tag.namespace",
1155
- "settings": {
1156
- "foreground": "#8FBCBB"
1157
- }
1158
- }, {
1159
- "name": "[XML] Keyword Other Doctype",
1160
- "scope": "text.xml keyword.other.doctype",
1161
- "settings": {
1162
- "foreground": "#5E81AC"
1163
- }
1164
- }, {
1165
- "name": "[XML] Meta Tag Preprocessor",
1166
- "scope": "text.xml meta.tag.preprocessor entity.name.tag",
1167
- "settings": {
1168
- "foreground": "#5E81AC"
1169
- }
1170
- }, {
1171
- "name": "[XML] Entity Name Tag Namespace",
1172
- "scope": ["text.xml string.unquoted.cdata", "text.xml string.unquoted.cdata punctuation.definition.string"],
1173
- "settings": {
1174
- "foreground": "#D08770",
1175
- "fontStyle": "italic"
1176
- }
1177
- }, {
1178
- "name": "[YAML] Entity Name Tag",
1179
- "scope": "source.yaml entity.name.tag",
1180
- "settings": {
1181
- "foreground": "#8FBCBB"
1182
- }
1183
- }]
1184
- },
1185
- "autoImport": true,
1186
- "showCopyButton": true,
1187
- "skipLanguages": [],
1188
- "filepath": "/Users/bytedance/github/targeral/modern-dev/website/module-tools/docs/zh/guide/basic/before-getting-started.md"
1189
- };
1190
- const frontmatter = {
1191
- "sidebar_position": 1
1192
- };
1193
- const toc = [{
1194
- "id": "环境准备",
1195
- "text": "环境准备",
1196
- "depth": 2
1197
- }, {
1198
- "id": "初识-npm",
1199
- "text": "初识 npm",
1200
- "depth": 2
1201
- }, {
1202
- "id": "npm-包类型项目",
1203
- "text": "npm 包类型项目",
1204
- "depth": 2
1205
- }, {
1206
- "id": "使用第三方-npm-包",
1207
- "text": "使用第三方 npm 包",
1208
- "depth": 2
1209
- }, {
1210
- "id": "还需要了解的-npm-零碎知识",
1211
- "text": "还需要了解的 npm 零碎知识",
1212
- "depth": 2
1213
- }, {
1214
- "id": "npm-包的程序入口",
1215
- "text": "npm 包的程序入口",
1216
- "depth": 3
1217
- }, {
1218
- "id": "scripts",
1219
- "text": "\"scripts\"",
1220
- "depth": 3
1221
- }, {
1222
- "id": "npm-install",
1223
- "text": "npm install",
1224
- "depth": 4
1225
- }, {
1226
- "id": "npm-publish",
1227
- "text": "npm publish",
1228
- "depth": 4
1229
- }, {
1230
- "id": "peerdependencies",
1231
- "text": "peerDependencies",
1232
- "depth": 3
1233
- }, {
1234
- "id": "npm-包管理器",
1235
- "text": "npm 包管理器",
1236
- "depth": 2
1237
- }, {
1238
- "id": "module-tools-配置文件",
1239
- "text": "Module Tools 配置文件",
1240
- "depth": 2
1241
- }];
1242
- const title = `开始之前`;
1243
- const content = "\"---\\nsidebar_position: 1\\n---\\n\\n# 开始之前\\n\\n## 环境准备\\n\\n为了使用 Modern.js 模块工程解决方案,首先需要 [NodeJS](https://nodejs.org/zh/),我们推荐最新的[长期维护版本](https://github.com/nodejs/Release),并确保 Node 版本大于等于 **14.18.0**。因为非稳定的 NodeJS 时常有一些 Bug,你可以使用 [nvm-windows](https://github.com/coreybutler/nvm-windows) 和 [nvm](https://github.com/nvm-sh/nvm)(Mac/linux)安装,这样你就可以方便地切换到不同的 NodeJS 版本,这些版本可能会用于不同的项目。\\n\\n## 初识 npm\\n\\n当 NodeJS 被安装后,你不仅可以在命令行中访问 `node` 可执行程序,同时你也可以执行 `npm` 命令。\\n\\nnpm 是 NodeJS 的标准软件包管理器。它一开始的用途是用于下载和管理 NodeJS 包的依赖关系,但后来它逐渐变成为一个用于前端 JavaScript 的工具。\\n\\n**如果你已经对 npm 和 npm 包的使用方式有所了解,那么可以直接跳到[【npm 包管理器】](/guide/basic/before-getting-started#npm-包管理器)部分。**\\n\\n## npm 包类型项目\\n\\n那么什么是 npm 包类型的项目呢?当我们在一个空的项目目录下执行 `npm init` 命令的时候,它会在当前目录下面创建一个文件名为 `package.json` 的 JSON 文件。在创建过程中,我们需要填写包括但不限于 npm 包的名称、版本号、描述等等内容,这些填写的内容都会在生成的 `package.json` 文件中找到:\\n\\n```json\\n{\\n \\\"name\\\": \\\"npm-demo\\\",\\n \\\"version\\\": \\\"1.0.0\\\",\\n \\\"description\\\": \\\"\\\",\\n \\\"main\\\": \\\"index.js\\\",\\n \\\"scripts\\\": {\\n \\\"test\\\": \\\"echo \\\\\\\"Error: no test specified\\\\\\\" && exit 1\\\"\\n },\\n \\\"author\\\": \\\"\\\",\\n \\\"license\\\": \\\"ISC\\\"\\n}\\n```\\n\\n此时这个包含了初始化后的 `package.json` 文件的项目就是一个 npm 包类型的项目,你可以执行 `npm publish` 命令将这个项目发布到 [npm Registry](https://www.npmjs.com/)。\\n\\nnpm Registry 是一个 [npm 包存储的地方](https://docs.npmjs.com/about-the-public-npm-registry),开发者们不仅可以将他们自己的 npm 包发布到 npm Registry,还可以通过 npm Registry 使用其他开发者发布的 npm 包。\\n\\n优质的 npm 包会有更多的人去使用,因为它不仅节省了很多代码实现的工作,同时也不容易让项目出现问题。\\n\\n## 使用第三方 npm 包\\n\\n当要为初始化的项目增加第三方的 npm 包的时候,我们可以把这一过程叫做“为项目安装依赖”或是“为项目增加依赖”。在增加依赖之前,首先我们要特别了解一件事情 —— **npm 依赖的软件包类型**:\\n\\n- `\\\"dependencies\\\"`:一种是你的应用程序在生产环境中需要的软件包。\\n- `\\\"devDependencies\\\"`:另一种是仅在本地开发和测试中需要的软件包。\\n > 软件包可以理解为是第三方的 npm 包。\\n\\n你可以通过执行 `npm install npm-package-name` 或者 `npm add npm-package-name` 的方式来安装在**生产环境中需要的软件包**,或者也可以在 `package.json` 文件中手动的将需要安装的包和对应的[语义化版本](https://docs.npmjs.com/about-semantic-versioning)写在 `\\\"dependencies\\\"` 里,并执行 `npm install` 命令:\\n\\n```json\\n{\\n \\\"name\\\": \\\"your-npm-project\\\",\\n \\\"dependencies\\\": {\\n \\\"npm-package-name\\\": \\\"0.1.0\\\"\\n }\\n}\\n```\\n\\n同理,你也可以执行 `npm install npm-package-name --save-dev` 或 `npm add npm-package-name --save-dev` 的方式来安装**仅在本地开发和测试中需要的软件包**,或者也可以在 `package.json` 文件中手动的将需要安装的包和对应的[语义化版本](https://docs.npmjs.com/about-semantic-versioning)写在 `\\\"devDependencies\\\"` 里,并执行 `npm install` 命令:\\n\\n```json\\n{\\n \\\"name\\\": \\\"your-npm-project\\\",\\n \\\"devDependencies\\\": {\\n \\\"npm-package-name\\\": \\\"0.1.0\\\"\\n }\\n}\\n```\\n\\n**在安装或者使用第三方 npm 包的时候一定要确定它们的用途,以及通过区分它们的类型确定好它们应该放在 `\\\"dependencies\\\"` 还是 `\\\"devDependencies\\\"` 中。**\\n\\n:::tip\\n一般来说,需要在源代码中使用到的包都属于 `dependencies` 依赖。除非你通过打包的方式将依赖的代码输出到本地,那么这种情况可以将它作为 `devDependencies` 依赖。\\n:::\\n\\n## 还需要了解的 npm 零碎知识\\n\\n### npm 包的程序入口\\n\\n在 `package.json` 中存在一个 `\\\"main\\\"` 属性,它对应的值是一个模块 ID,或者更直观的说是一个 NodeJS 文件路径,它是你程序的主要入口。\\n\\n例如你的包名为 `foo`,并且用户安装了它,然后执行 `require(\\\"foo\\\")` 代码,那么 `foo` 这个 npm 包的 `\\\"main\\\"` 字段对应的文件将会被导出。\\n\\n**推荐在你的 npm 包里一定要设置 `\\\"main\\\"` 字段**。如果没有设置 `\\\"main\\\"`,则默认入口为包的根目录下的 `index.js` 文件。\\n\\n除了需要设置 `\\\"main\\\"` 属性以外,一般还会设置 `\\\"module\\\"` 属性。它与 `\\\"main\\\"` 属性的用途类似,它主要是用于在 webpack 场景下使用。webpack 在大多数情况下,会以 **\\\"module\\\" -> \\\"main\\\"** 这个顺序读取 npm 包的入口(文件)。\\n\\n> 想要了解关于 webpack 如何做这件事,可以查看这个[链接](https://webpack.js.org/configuration/resolve/#resolvemainfields)。\\n\\n### `\\\"scripts\\\"`\\n\\n`package.json` 文件的 `\\\"scripts\\\"` 属性支持一些内置的脚本和 npm 预设的生命周期事件,以及任意的脚本。\\n\\n这些都可以通过运行 `npm run-script <stage>` 或简称 `npm run <stage>` 来执行。\\n\\n名称匹配的[前置命令和后置命令](https://docs.npmjs.com/cli/v9/using-npm/scripts#pre--post-scripts)也会被运行(例如 `premyscript`、`myscript`、`postmyscript`)。\\n\\n```json\\n{\\n \\\"scripts\\\": {\\n \\\"premyscript\\\": \\\"\\\",\\n \\\"myscript\\\": \\\"\\\",\\n \\\"postmyscript\\\": \\\"\\\"\\n }\\n}\\n```\\n\\n当执行 `npm run myscripts` 的时候,`premyscripts` 对应的脚本会在它之前执行,`postmyscripts` 对应的脚本会在它之后执行。\\n\\n来自依赖的脚本命令可以用 `npm explore <pkg> -- npm run <stage>` 运行。\\n\\n还有一些特殊的生命周期脚本(Life Scripts),只在某些情况下发生。这里介绍几个通常需要了解的情况。\\n\\n#### `npm install`\\n\\n当你运行 `npm install -g <pkg-name>` 时,以下脚本会运行。\\n\\n- `preinstall`\\n- `install`\\n- `postinstall`\\n- `prepublish`\\n- `preprepare`\\n- `prepare`\\n- `postprepare`\\n\\n如果你的软件包根目录有一个 `binding.gyp` 文件,而你没有定义 `install` 或 `preinstall` 脚本,那么 npm 将以 `node-gyp rebuild` 作为默认的 install 命令,使用 [node-gyp](https://github.com/nodejs/node-gyp) 进行编译。\\n\\n#### `npm publish`\\n\\n当发布项目的时候,执行该命令会触发以下脚本:\\n\\n- `prepublishOnly`\\n- `prepack`\\n- `prepare`\\n- `postpack`\\n- `publish`\\n- `postpublish`\\n\\n当以 [`--dry-run`](https://docs.npmjs.com/cli/v7/commands/npm-publish#dry-run) 模式运行的时候,`prepare` 对应的脚本将不会执行。\\n\\n### peerDependencies\\n\\n在某些情况下,你的 npm 项目与它的宿主工具或者库之间存在某种兼容关系(例如一个 webpack 插件项目和 webpack),同时你的 npm 项目不想将宿主作为必要的依赖,这个时候通常说明你的项目可能是这个宿主工具或者库的插件。你的 npm 项目会对宿主包的版本有一定的要求,因为只有在特定的版本下才会暴露出 npm 项目所需要的 API。\\n\\n关于更多 `peerDependencies` 的解释,可以通过下面的链接了解 npm、pnpm、Yarn 对于它的不同处理方式:\\n\\n- [npm 对 peerDependencies 的解释](https://docs.npmjs.com/cli/v9/configuring-npm/package-json#peerdependencies)\\n- [pnpm vs npm VS Yarn](https://pnpm.io/feature-comparison)\\n\\n## npm 包管理器\\n\\n除了 npm 这种标准的包管理器以外,目前主流的还有 **pnpm** 和 **Yarn**,它们都是不错的 npm cli 替代品。\\n\\n推荐使用 [pnpm](https://pnpm.io/installation) 来管理项目依赖,可以通过下面的方式安装它:\\n\\n```bash\\nnpm install -g pnpm\\n```\\n\\n## Module Tools 配置文件\\n\\n通过`@modern-js/create`创建的模块工程项目目录下提供了 Module Tools 的配置文件 —— `modern.config.(j|t)s`。但 `modern.config` 配置文件不是必须存在的。\\n\\n默认情况下,生成的配置文件的内容如下:\\n\\n```typescript\\n// modern.config.ts\\nimport moduleTools, { defineConfig } from '@modern-js/module-tools';\\n\\nexport default defineConfig({\\n plugins: [moduleTools()],\\n buildPreset: 'npm-library',\\n});\\n```\\n\\n**我们推荐使用 `defineConfig` 函数**,不过并不强制使用它。因此你也可以在配置文件中直接返回一个对象:\\n\\n```ts\\n// modern.config.ts\\nimport moduleTools from '@modern-js/module-tools';\\n\\nexport default {\\n plugins: [moduleTools()],\\n buildPreset: 'npm-library',\\n};\\n```\\n\"";
1244
- function _createMdxContent(props) {
1245
- const _components = Object.assign({
1246
- h1: "h1",
1247
- a: "a",
1248
- h2: "h2",
1249
- p: "p",
1250
- strong: "strong",
1251
- code: "code",
1252
- ul: "ul",
1253
- li: "li",
1254
- blockquote: "blockquote",
1255
- div: "div",
1256
- h3: "h3",
1257
- h4: "h4"
1258
- }, props.components);
1259
- if (!CH) _missingMdxReference("CH", false, "23:1-35:4");
1260
- if (!CH.Code) _missingMdxReference("CH.Code", true, "23:1-35:4");
1261
- return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
1262
- children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.h1, {
1263
- id: "开始之前",
1264
- children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.a, {
1265
- className: "header-anchor",
1266
- "aria-hidden": "true",
1267
- href: "#开始之前",
1268
- children: "#"
1269
- }), "开始之前"]
1270
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.h2, {
1271
- id: "环境准备",
1272
- children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.a, {
1273
- className: "header-anchor",
1274
- "aria-hidden": "true",
1275
- href: "#环境准备",
1276
- children: "#"
1277
- }), "环境准备"]
1278
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.p, {
1279
- children: ["为了使用 Modern.js 模块工程解决方案,首先需要 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.a, {
1280
- href: "https://nodejs.org/zh/",
1281
- target: "_blank",
1282
- rel: "nofollow",
1283
- children: "NodeJS"
1284
- }), ",我们推荐最新的", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.a, {
1285
- href: "https://github.com/nodejs/Release",
1286
- target: "_blank",
1287
- rel: "nofollow",
1288
- children: "长期维护版本"
1289
- }), ",并确保 Node 版本大于等于 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.strong, {
1290
- children: "14.18.0"
1291
- }), "。因为非稳定的 NodeJS 时常有一些 Bug,你可以使用 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.a, {
1292
- href: "https://github.com/coreybutler/nvm-windows",
1293
- target: "_blank",
1294
- rel: "nofollow",
1295
- children: "nvm-windows"
1296
- }), " 和 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.a, {
1297
- href: "https://github.com/nvm-sh/nvm",
1298
- target: "_blank",
1299
- rel: "nofollow",
1300
- children: "nvm"
1301
- }), "(Mac/linux)安装,这样你就可以方便地切换到不同的 NodeJS 版本,这些版本可能会用于不同的项目。"]
1302
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.h2, {
1303
- id: "初识-npm",
1304
- children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.a, {
1305
- className: "header-anchor",
1306
- "aria-hidden": "true",
1307
- href: "#初识-npm",
1308
- children: "#"
1309
- }), "初识 npm"]
1310
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.p, {
1311
- children: ["当 NodeJS 被安装后,你不仅可以在命令行中访问 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
1312
- children: "node"
1313
- }), " 可执行程序,同时你也可以执行 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
1314
- children: "npm"
1315
- }), " 命令。"]
1316
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.p, {
1317
- children: "npm 是 NodeJS 的标准软件包管理器。它一开始的用途是用于下载和管理 NodeJS 包的依赖关系,但后来它逐渐变成为一个用于前端 JavaScript 的工具。"
1318
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.p, {
1319
- children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.strong, {
1320
- children: ["如果你已经对 npm 和 npm 包的使用方式有所了解,那么可以直接跳到", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.a, {
1321
- href: "/module-tools/guide/basic/before-getting-started.html#npm-%E5%8C%85%E7%AE%A1%E7%90%86%E5%99%A8",
1322
- children: "【npm 包管理器】"
1323
- }), "部分。"]
1324
- })
1325
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.h2, {
1326
- id: "npm-包类型项目",
1327
- children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.a, {
1328
- className: "header-anchor",
1329
- "aria-hidden": "true",
1330
- href: "#npm-包类型项目",
1331
- children: "#"
1332
- }), "npm 包类型项目"]
1333
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.p, {
1334
- children: ["那么什么是 npm 包类型的项目呢?当我们在一个空的项目目录下执行 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
1335
- children: "npm init"
1336
- }), " 命令的时候,它会在当前目录下面创建一个文件名为 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
1337
- children: "package.json"
1338
- }), " 的 JSON 文件。在创建过程中,我们需要填写包括但不限于 npm 包的名称、版本号、描述等等内容,这些填写的内容都会在生成的 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
1339
- children: "package.json"
1340
- }), " 文件中找到:"]
1341
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(CH.Code, {
1342
- codeConfig: chCodeConfig,
1343
- northPanel: {
1344
- "tabs": [""],
1345
- "active": "",
1346
- "heightRatio": 1
1347
- },
1348
- files: [{
1349
- "name": "",
1350
- "focus": "",
1351
- "code": {
1352
- "lines": [{
1353
- "tokens": [{
1354
- "content": "{",
1355
- "props": {
1356
- "style": {
1357
- "color": "#ECEFF4"
1358
- }
1359
- }
1360
- }]
1361
- }, {
1362
- "tokens": [{
1363
- "content": " ",
1364
- "props": {
1365
- "style": {
1366
- "color": "#D8DEE9FF"
1367
- }
1368
- }
1369
- }, {
1370
- "content": "\"",
1371
- "props": {
1372
- "style": {
1373
- "color": "#ECEFF4"
1374
- }
1375
- }
1376
- }, {
1377
- "content": "name",
1378
- "props": {
1379
- "style": {
1380
- "color": "#8FBCBB"
1381
- }
1382
- }
1383
- }, {
1384
- "content": "\"",
1385
- "props": {
1386
- "style": {
1387
- "color": "#ECEFF4"
1388
- }
1389
- }
1390
- }, {
1391
- "content": ":",
1392
- "props": {
1393
- "style": {
1394
- "color": "#ECEFF4"
1395
- }
1396
- }
1397
- }, {
1398
- "content": " ",
1399
- "props": {
1400
- "style": {
1401
- "color": "#D8DEE9FF"
1402
- }
1403
- }
1404
- }, {
1405
- "content": "\"",
1406
- "props": {
1407
- "style": {
1408
- "color": "#ECEFF4"
1409
- }
1410
- }
1411
- }, {
1412
- "content": "npm-demo",
1413
- "props": {
1414
- "style": {
1415
- "color": "#A3BE8C"
1416
- }
1417
- }
1418
- }, {
1419
- "content": "\"",
1420
- "props": {
1421
- "style": {
1422
- "color": "#ECEFF4"
1423
- }
1424
- }
1425
- }, {
1426
- "content": ",",
1427
- "props": {
1428
- "style": {
1429
- "color": "#ECEFF4"
1430
- }
1431
- }
1432
- }]
1433
- }, {
1434
- "tokens": [{
1435
- "content": " ",
1436
- "props": {
1437
- "style": {
1438
- "color": "#D8DEE9FF"
1439
- }
1440
- }
1441
- }, {
1442
- "content": "\"",
1443
- "props": {
1444
- "style": {
1445
- "color": "#ECEFF4"
1446
- }
1447
- }
1448
- }, {
1449
- "content": "version",
1450
- "props": {
1451
- "style": {
1452
- "color": "#8FBCBB"
1453
- }
1454
- }
1455
- }, {
1456
- "content": "\"",
1457
- "props": {
1458
- "style": {
1459
- "color": "#ECEFF4"
1460
- }
1461
- }
1462
- }, {
1463
- "content": ":",
1464
- "props": {
1465
- "style": {
1466
- "color": "#ECEFF4"
1467
- }
1468
- }
1469
- }, {
1470
- "content": " ",
1471
- "props": {
1472
- "style": {
1473
- "color": "#D8DEE9FF"
1474
- }
1475
- }
1476
- }, {
1477
- "content": "\"",
1478
- "props": {
1479
- "style": {
1480
- "color": "#ECEFF4"
1481
- }
1482
- }
1483
- }, {
1484
- "content": "1.0.0",
1485
- "props": {
1486
- "style": {
1487
- "color": "#A3BE8C"
1488
- }
1489
- }
1490
- }, {
1491
- "content": "\"",
1492
- "props": {
1493
- "style": {
1494
- "color": "#ECEFF4"
1495
- }
1496
- }
1497
- }, {
1498
- "content": ",",
1499
- "props": {
1500
- "style": {
1501
- "color": "#ECEFF4"
1502
- }
1503
- }
1504
- }]
1505
- }, {
1506
- "tokens": [{
1507
- "content": " ",
1508
- "props": {
1509
- "style": {
1510
- "color": "#D8DEE9FF"
1511
- }
1512
- }
1513
- }, {
1514
- "content": "\"",
1515
- "props": {
1516
- "style": {
1517
- "color": "#ECEFF4"
1518
- }
1519
- }
1520
- }, {
1521
- "content": "description",
1522
- "props": {
1523
- "style": {
1524
- "color": "#8FBCBB"
1525
- }
1526
- }
1527
- }, {
1528
- "content": "\"",
1529
- "props": {
1530
- "style": {
1531
- "color": "#ECEFF4"
1532
- }
1533
- }
1534
- }, {
1535
- "content": ":",
1536
- "props": {
1537
- "style": {
1538
- "color": "#ECEFF4"
1539
- }
1540
- }
1541
- }, {
1542
- "content": " ",
1543
- "props": {
1544
- "style": {
1545
- "color": "#D8DEE9FF"
1546
- }
1547
- }
1548
- }, {
1549
- "content": "\"\"",
1550
- "props": {
1551
- "style": {
1552
- "color": "#ECEFF4"
1553
- }
1554
- }
1555
- }, {
1556
- "content": ",",
1557
- "props": {
1558
- "style": {
1559
- "color": "#ECEFF4"
1560
- }
1561
- }
1562
- }]
1563
- }, {
1564
- "tokens": [{
1565
- "content": " ",
1566
- "props": {
1567
- "style": {
1568
- "color": "#D8DEE9FF"
1569
- }
1570
- }
1571
- }, {
1572
- "content": "\"",
1573
- "props": {
1574
- "style": {
1575
- "color": "#ECEFF4"
1576
- }
1577
- }
1578
- }, {
1579
- "content": "main",
1580
- "props": {
1581
- "style": {
1582
- "color": "#8FBCBB"
1583
- }
1584
- }
1585
- }, {
1586
- "content": "\"",
1587
- "props": {
1588
- "style": {
1589
- "color": "#ECEFF4"
1590
- }
1591
- }
1592
- }, {
1593
- "content": ":",
1594
- "props": {
1595
- "style": {
1596
- "color": "#ECEFF4"
1597
- }
1598
- }
1599
- }, {
1600
- "content": " ",
1601
- "props": {
1602
- "style": {
1603
- "color": "#D8DEE9FF"
1604
- }
1605
- }
1606
- }, {
1607
- "content": "\"",
1608
- "props": {
1609
- "style": {
1610
- "color": "#ECEFF4"
1611
- }
1612
- }
1613
- }, {
1614
- "content": "index.js",
1615
- "props": {
1616
- "style": {
1617
- "color": "#A3BE8C"
1618
- }
1619
- }
1620
- }, {
1621
- "content": "\"",
1622
- "props": {
1623
- "style": {
1624
- "color": "#ECEFF4"
1625
- }
1626
- }
1627
- }, {
1628
- "content": ",",
1629
- "props": {
1630
- "style": {
1631
- "color": "#ECEFF4"
1632
- }
1633
- }
1634
- }]
1635
- }, {
1636
- "tokens": [{
1637
- "content": " ",
1638
- "props": {
1639
- "style": {
1640
- "color": "#D8DEE9FF"
1641
- }
1642
- }
1643
- }, {
1644
- "content": "\"",
1645
- "props": {
1646
- "style": {
1647
- "color": "#ECEFF4"
1648
- }
1649
- }
1650
- }, {
1651
- "content": "scripts",
1652
- "props": {
1653
- "style": {
1654
- "color": "#8FBCBB"
1655
- }
1656
- }
1657
- }, {
1658
- "content": "\"",
1659
- "props": {
1660
- "style": {
1661
- "color": "#ECEFF4"
1662
- }
1663
- }
1664
- }, {
1665
- "content": ":",
1666
- "props": {
1667
- "style": {
1668
- "color": "#ECEFF4"
1669
- }
1670
- }
1671
- }, {
1672
- "content": " ",
1673
- "props": {
1674
- "style": {
1675
- "color": "#D8DEE9FF"
1676
- }
1677
- }
1678
- }, {
1679
- "content": "{",
1680
- "props": {
1681
- "style": {
1682
- "color": "#ECEFF4"
1683
- }
1684
- }
1685
- }]
1686
- }, {
1687
- "tokens": [{
1688
- "content": " ",
1689
- "props": {
1690
- "style": {
1691
- "color": "#D8DEE9FF"
1692
- }
1693
- }
1694
- }, {
1695
- "content": "\"",
1696
- "props": {
1697
- "style": {
1698
- "color": "#ECEFF4"
1699
- }
1700
- }
1701
- }, {
1702
- "content": "test",
1703
- "props": {
1704
- "style": {
1705
- "color": "#8FBCBB"
1706
- }
1707
- }
1708
- }, {
1709
- "content": "\"",
1710
- "props": {
1711
- "style": {
1712
- "color": "#ECEFF4"
1713
- }
1714
- }
1715
- }, {
1716
- "content": ":",
1717
- "props": {
1718
- "style": {
1719
- "color": "#ECEFF4"
1720
- }
1721
- }
1722
- }, {
1723
- "content": " ",
1724
- "props": {
1725
- "style": {
1726
- "color": "#D8DEE9FF"
1727
- }
1728
- }
1729
- }, {
1730
- "content": "\"",
1731
- "props": {
1732
- "style": {
1733
- "color": "#ECEFF4"
1734
- }
1735
- }
1736
- }, {
1737
- "content": "echo ",
1738
- "props": {
1739
- "style": {
1740
- "color": "#A3BE8C"
1741
- }
1742
- }
1743
- }, {
1744
- "content": "\\\"",
1745
- "props": {
1746
- "style": {
1747
- "color": "#EBCB8B"
1748
- }
1749
- }
1750
- }, {
1751
- "content": "Error: no test specified",
1752
- "props": {
1753
- "style": {
1754
- "color": "#A3BE8C"
1755
- }
1756
- }
1757
- }, {
1758
- "content": "\\\"",
1759
- "props": {
1760
- "style": {
1761
- "color": "#EBCB8B"
1762
- }
1763
- }
1764
- }, {
1765
- "content": " && exit 1",
1766
- "props": {
1767
- "style": {
1768
- "color": "#A3BE8C"
1769
- }
1770
- }
1771
- }, {
1772
- "content": "\"",
1773
- "props": {
1774
- "style": {
1775
- "color": "#ECEFF4"
1776
- }
1777
- }
1778
- }]
1779
- }, {
1780
- "tokens": [{
1781
- "content": " ",
1782
- "props": {
1783
- "style": {
1784
- "color": "#D8DEE9FF"
1785
- }
1786
- }
1787
- }, {
1788
- "content": "},",
1789
- "props": {
1790
- "style": {
1791
- "color": "#ECEFF4"
1792
- }
1793
- }
1794
- }]
1795
- }, {
1796
- "tokens": [{
1797
- "content": " ",
1798
- "props": {
1799
- "style": {
1800
- "color": "#D8DEE9FF"
1801
- }
1802
- }
1803
- }, {
1804
- "content": "\"",
1805
- "props": {
1806
- "style": {
1807
- "color": "#ECEFF4"
1808
- }
1809
- }
1810
- }, {
1811
- "content": "author",
1812
- "props": {
1813
- "style": {
1814
- "color": "#8FBCBB"
1815
- }
1816
- }
1817
- }, {
1818
- "content": "\"",
1819
- "props": {
1820
- "style": {
1821
- "color": "#ECEFF4"
1822
- }
1823
- }
1824
- }, {
1825
- "content": ":",
1826
- "props": {
1827
- "style": {
1828
- "color": "#ECEFF4"
1829
- }
1830
- }
1831
- }, {
1832
- "content": " ",
1833
- "props": {
1834
- "style": {
1835
- "color": "#D8DEE9FF"
1836
- }
1837
- }
1838
- }, {
1839
- "content": "\"\"",
1840
- "props": {
1841
- "style": {
1842
- "color": "#ECEFF4"
1843
- }
1844
- }
1845
- }, {
1846
- "content": ",",
1847
- "props": {
1848
- "style": {
1849
- "color": "#ECEFF4"
1850
- }
1851
- }
1852
- }]
1853
- }, {
1854
- "tokens": [{
1855
- "content": " ",
1856
- "props": {
1857
- "style": {
1858
- "color": "#D8DEE9FF"
1859
- }
1860
- }
1861
- }, {
1862
- "content": "\"",
1863
- "props": {
1864
- "style": {
1865
- "color": "#ECEFF4"
1866
- }
1867
- }
1868
- }, {
1869
- "content": "license",
1870
- "props": {
1871
- "style": {
1872
- "color": "#8FBCBB"
1873
- }
1874
- }
1875
- }, {
1876
- "content": "\"",
1877
- "props": {
1878
- "style": {
1879
- "color": "#ECEFF4"
1880
- }
1881
- }
1882
- }, {
1883
- "content": ":",
1884
- "props": {
1885
- "style": {
1886
- "color": "#ECEFF4"
1887
- }
1888
- }
1889
- }, {
1890
- "content": " ",
1891
- "props": {
1892
- "style": {
1893
- "color": "#D8DEE9FF"
1894
- }
1895
- }
1896
- }, {
1897
- "content": "\"",
1898
- "props": {
1899
- "style": {
1900
- "color": "#ECEFF4"
1901
- }
1902
- }
1903
- }, {
1904
- "content": "ISC",
1905
- "props": {
1906
- "style": {
1907
- "color": "#A3BE8C"
1908
- }
1909
- }
1910
- }, {
1911
- "content": "\"",
1912
- "props": {
1913
- "style": {
1914
- "color": "#ECEFF4"
1915
- }
1916
- }
1917
- }]
1918
- }, {
1919
- "tokens": [{
1920
- "content": "}",
1921
- "props": {
1922
- "style": {
1923
- "color": "#ECEFF4"
1924
- }
1925
- }
1926
- }]
1927
- }],
1928
- "lang": "json"
1929
- },
1930
- "annotations": []
1931
- }]
1932
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.p, {
1933
- children: ["此时这个包含了初始化后的 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
1934
- children: "package.json"
1935
- }), " 文件的项目就是一个 npm 包类型的项目,你可以执行 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
1936
- children: "npm publish"
1937
- }), " 命令将这个项目发布到 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.a, {
1938
- href: "https://www.npmjs.com/",
1939
- target: "_blank",
1940
- rel: "nofollow",
1941
- children: "npm Registry"
1942
- }), "。"]
1943
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.p, {
1944
- children: ["npm Registry 是一个 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.a, {
1945
- href: "https://docs.npmjs.com/about-the-public-npm-registry",
1946
- target: "_blank",
1947
- rel: "nofollow",
1948
- children: "npm 包存储的地方"
1949
- }), ",开发者们不仅可以将他们自己的 npm 包发布到 npm Registry,还可以通过 npm Registry 使用其他开发者发布的 npm 包。"]
1950
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.p, {
1951
- children: "优质的 npm 包会有更多的人去使用,因为它不仅节省了很多代码实现的工作,同时也不容易让项目出现问题。"
1952
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.h2, {
1953
- id: "使用第三方-npm-包",
1954
- children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.a, {
1955
- className: "header-anchor",
1956
- "aria-hidden": "true",
1957
- href: "#使用第三方-npm-包",
1958
- children: "#"
1959
- }), "使用第三方 npm 包"]
1960
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.p, {
1961
- children: ["当要为初始化的项目增加第三方的 npm 包的时候,我们可以把这一过程叫做“为项目安装依赖”或是“为项目增加依赖”。在增加依赖之前,首先我们要特别了解一件事情 —— ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.strong, {
1962
- children: "npm 依赖的软件包类型"
1963
- }), ":"]
1964
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.ul, {
1965
- children: ["\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.li, {
1966
- children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
1967
- children: "\"dependencies\""
1968
- }), ":一种是你的应用程序在生产环境中需要的软件包。"]
1969
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.li, {
1970
- children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
1971
- children: "\"devDependencies\""
1972
- }), ":另一种是仅在本地开发和测试中需要的软件包。", "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.blockquote, {
1973
- children: ["\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.p, {
1974
- children: "软件包可以理解为是第三方的 npm 包。"
1975
- }), "\n"]
1976
- }), "\n"]
1977
- }), "\n"]
1978
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.p, {
1979
- children: ["你可以通过执行 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
1980
- children: "npm install npm-package-name"
1981
- }), " 或者 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
1982
- children: "npm add npm-package-name"
1983
- }), " 的方式来安装在", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.strong, {
1984
- children: "生产环境中需要的软件包"
1985
- }), ",或者也可以在 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
1986
- children: "package.json"
1987
- }), " 文件中手动的将需要安装的包和对应的", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.a, {
1988
- href: "https://docs.npmjs.com/about-semantic-versioning",
1989
- target: "_blank",
1990
- rel: "nofollow",
1991
- children: "语义化版本"
1992
- }), "写在 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
1993
- children: "\"dependencies\""
1994
- }), " 里,并执行 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
1995
- children: "npm install"
1996
- }), " 命令:"]
1997
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(CH.Code, {
1998
- codeConfig: chCodeConfig,
1999
- northPanel: {
2000
- "tabs": [""],
2001
- "active": "",
2002
- "heightRatio": 1
2003
- },
2004
- files: [{
2005
- "name": "",
2006
- "focus": "",
2007
- "code": {
2008
- "lines": [{
2009
- "tokens": [{
2010
- "content": "{",
2011
- "props": {
2012
- "style": {
2013
- "color": "#ECEFF4"
2014
- }
2015
- }
2016
- }]
2017
- }, {
2018
- "tokens": [{
2019
- "content": " ",
2020
- "props": {
2021
- "style": {
2022
- "color": "#D8DEE9FF"
2023
- }
2024
- }
2025
- }, {
2026
- "content": "\"",
2027
- "props": {
2028
- "style": {
2029
- "color": "#ECEFF4"
2030
- }
2031
- }
2032
- }, {
2033
- "content": "name",
2034
- "props": {
2035
- "style": {
2036
- "color": "#8FBCBB"
2037
- }
2038
- }
2039
- }, {
2040
- "content": "\"",
2041
- "props": {
2042
- "style": {
2043
- "color": "#ECEFF4"
2044
- }
2045
- }
2046
- }, {
2047
- "content": ":",
2048
- "props": {
2049
- "style": {
2050
- "color": "#ECEFF4"
2051
- }
2052
- }
2053
- }, {
2054
- "content": " ",
2055
- "props": {
2056
- "style": {
2057
- "color": "#D8DEE9FF"
2058
- }
2059
- }
2060
- }, {
2061
- "content": "\"",
2062
- "props": {
2063
- "style": {
2064
- "color": "#ECEFF4"
2065
- }
2066
- }
2067
- }, {
2068
- "content": "your-npm-project",
2069
- "props": {
2070
- "style": {
2071
- "color": "#A3BE8C"
2072
- }
2073
- }
2074
- }, {
2075
- "content": "\"",
2076
- "props": {
2077
- "style": {
2078
- "color": "#ECEFF4"
2079
- }
2080
- }
2081
- }, {
2082
- "content": ",",
2083
- "props": {
2084
- "style": {
2085
- "color": "#ECEFF4"
2086
- }
2087
- }
2088
- }]
2089
- }, {
2090
- "tokens": [{
2091
- "content": " ",
2092
- "props": {
2093
- "style": {
2094
- "color": "#D8DEE9FF"
2095
- }
2096
- }
2097
- }, {
2098
- "content": "\"",
2099
- "props": {
2100
- "style": {
2101
- "color": "#ECEFF4"
2102
- }
2103
- }
2104
- }, {
2105
- "content": "dependencies",
2106
- "props": {
2107
- "style": {
2108
- "color": "#8FBCBB"
2109
- }
2110
- }
2111
- }, {
2112
- "content": "\"",
2113
- "props": {
2114
- "style": {
2115
- "color": "#ECEFF4"
2116
- }
2117
- }
2118
- }, {
2119
- "content": ":",
2120
- "props": {
2121
- "style": {
2122
- "color": "#ECEFF4"
2123
- }
2124
- }
2125
- }, {
2126
- "content": " ",
2127
- "props": {
2128
- "style": {
2129
- "color": "#D8DEE9FF"
2130
- }
2131
- }
2132
- }, {
2133
- "content": "{",
2134
- "props": {
2135
- "style": {
2136
- "color": "#ECEFF4"
2137
- }
2138
- }
2139
- }]
2140
- }, {
2141
- "tokens": [{
2142
- "content": " ",
2143
- "props": {
2144
- "style": {
2145
- "color": "#D8DEE9FF"
2146
- }
2147
- }
2148
- }, {
2149
- "content": "\"",
2150
- "props": {
2151
- "style": {
2152
- "color": "#ECEFF4"
2153
- }
2154
- }
2155
- }, {
2156
- "content": "npm-package-name",
2157
- "props": {
2158
- "style": {
2159
- "color": "#8FBCBB"
2160
- }
2161
- }
2162
- }, {
2163
- "content": "\"",
2164
- "props": {
2165
- "style": {
2166
- "color": "#ECEFF4"
2167
- }
2168
- }
2169
- }, {
2170
- "content": ":",
2171
- "props": {
2172
- "style": {
2173
- "color": "#ECEFF4"
2174
- }
2175
- }
2176
- }, {
2177
- "content": " ",
2178
- "props": {
2179
- "style": {
2180
- "color": "#D8DEE9FF"
2181
- }
2182
- }
2183
- }, {
2184
- "content": "\"",
2185
- "props": {
2186
- "style": {
2187
- "color": "#ECEFF4"
2188
- }
2189
- }
2190
- }, {
2191
- "content": "0.1.0",
2192
- "props": {
2193
- "style": {
2194
- "color": "#A3BE8C"
2195
- }
2196
- }
2197
- }, {
2198
- "content": "\"",
2199
- "props": {
2200
- "style": {
2201
- "color": "#ECEFF4"
2202
- }
2203
- }
2204
- }]
2205
- }, {
2206
- "tokens": [{
2207
- "content": " ",
2208
- "props": {
2209
- "style": {
2210
- "color": "#D8DEE9FF"
2211
- }
2212
- }
2213
- }, {
2214
- "content": "}",
2215
- "props": {
2216
- "style": {
2217
- "color": "#ECEFF4"
2218
- }
2219
- }
2220
- }]
2221
- }, {
2222
- "tokens": [{
2223
- "content": "}",
2224
- "props": {
2225
- "style": {
2226
- "color": "#ECEFF4"
2227
- }
2228
- }
2229
- }]
2230
- }],
2231
- "lang": "json"
2232
- },
2233
- "annotations": []
2234
- }]
2235
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.p, {
2236
- children: ["同理,你也可以执行 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2237
- children: "npm install npm-package-name --save-dev"
2238
- }), " 或 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2239
- children: "npm add npm-package-name --save-dev"
2240
- }), " 的方式来安装", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.strong, {
2241
- children: "仅在本地开发和测试中需要的软件包"
2242
- }), ",或者也可以在 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2243
- children: "package.json"
2244
- }), " 文件中手动的将需要安装的包和对应的", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.a, {
2245
- href: "https://docs.npmjs.com/about-semantic-versioning",
2246
- target: "_blank",
2247
- rel: "nofollow",
2248
- children: "语义化版本"
2249
- }), "写在 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2250
- children: "\"devDependencies\""
2251
- }), " 里,并执行 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2252
- children: "npm install"
2253
- }), " 命令:"]
2254
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(CH.Code, {
2255
- codeConfig: chCodeConfig,
2256
- northPanel: {
2257
- "tabs": [""],
2258
- "active": "",
2259
- "heightRatio": 1
2260
- },
2261
- files: [{
2262
- "name": "",
2263
- "focus": "",
2264
- "code": {
2265
- "lines": [{
2266
- "tokens": [{
2267
- "content": "{",
2268
- "props": {
2269
- "style": {
2270
- "color": "#ECEFF4"
2271
- }
2272
- }
2273
- }]
2274
- }, {
2275
- "tokens": [{
2276
- "content": " ",
2277
- "props": {
2278
- "style": {
2279
- "color": "#D8DEE9FF"
2280
- }
2281
- }
2282
- }, {
2283
- "content": "\"",
2284
- "props": {
2285
- "style": {
2286
- "color": "#ECEFF4"
2287
- }
2288
- }
2289
- }, {
2290
- "content": "name",
2291
- "props": {
2292
- "style": {
2293
- "color": "#8FBCBB"
2294
- }
2295
- }
2296
- }, {
2297
- "content": "\"",
2298
- "props": {
2299
- "style": {
2300
- "color": "#ECEFF4"
2301
- }
2302
- }
2303
- }, {
2304
- "content": ":",
2305
- "props": {
2306
- "style": {
2307
- "color": "#ECEFF4"
2308
- }
2309
- }
2310
- }, {
2311
- "content": " ",
2312
- "props": {
2313
- "style": {
2314
- "color": "#D8DEE9FF"
2315
- }
2316
- }
2317
- }, {
2318
- "content": "\"",
2319
- "props": {
2320
- "style": {
2321
- "color": "#ECEFF4"
2322
- }
2323
- }
2324
- }, {
2325
- "content": "your-npm-project",
2326
- "props": {
2327
- "style": {
2328
- "color": "#A3BE8C"
2329
- }
2330
- }
2331
- }, {
2332
- "content": "\"",
2333
- "props": {
2334
- "style": {
2335
- "color": "#ECEFF4"
2336
- }
2337
- }
2338
- }, {
2339
- "content": ",",
2340
- "props": {
2341
- "style": {
2342
- "color": "#ECEFF4"
2343
- }
2344
- }
2345
- }]
2346
- }, {
2347
- "tokens": [{
2348
- "content": " ",
2349
- "props": {
2350
- "style": {
2351
- "color": "#D8DEE9FF"
2352
- }
2353
- }
2354
- }, {
2355
- "content": "\"",
2356
- "props": {
2357
- "style": {
2358
- "color": "#ECEFF4"
2359
- }
2360
- }
2361
- }, {
2362
- "content": "devDependencies",
2363
- "props": {
2364
- "style": {
2365
- "color": "#8FBCBB"
2366
- }
2367
- }
2368
- }, {
2369
- "content": "\"",
2370
- "props": {
2371
- "style": {
2372
- "color": "#ECEFF4"
2373
- }
2374
- }
2375
- }, {
2376
- "content": ":",
2377
- "props": {
2378
- "style": {
2379
- "color": "#ECEFF4"
2380
- }
2381
- }
2382
- }, {
2383
- "content": " ",
2384
- "props": {
2385
- "style": {
2386
- "color": "#D8DEE9FF"
2387
- }
2388
- }
2389
- }, {
2390
- "content": "{",
2391
- "props": {
2392
- "style": {
2393
- "color": "#ECEFF4"
2394
- }
2395
- }
2396
- }]
2397
- }, {
2398
- "tokens": [{
2399
- "content": " ",
2400
- "props": {
2401
- "style": {
2402
- "color": "#D8DEE9FF"
2403
- }
2404
- }
2405
- }, {
2406
- "content": "\"",
2407
- "props": {
2408
- "style": {
2409
- "color": "#ECEFF4"
2410
- }
2411
- }
2412
- }, {
2413
- "content": "npm-package-name",
2414
- "props": {
2415
- "style": {
2416
- "color": "#8FBCBB"
2417
- }
2418
- }
2419
- }, {
2420
- "content": "\"",
2421
- "props": {
2422
- "style": {
2423
- "color": "#ECEFF4"
2424
- }
2425
- }
2426
- }, {
2427
- "content": ":",
2428
- "props": {
2429
- "style": {
2430
- "color": "#ECEFF4"
2431
- }
2432
- }
2433
- }, {
2434
- "content": " ",
2435
- "props": {
2436
- "style": {
2437
- "color": "#D8DEE9FF"
2438
- }
2439
- }
2440
- }, {
2441
- "content": "\"",
2442
- "props": {
2443
- "style": {
2444
- "color": "#ECEFF4"
2445
- }
2446
- }
2447
- }, {
2448
- "content": "0.1.0",
2449
- "props": {
2450
- "style": {
2451
- "color": "#A3BE8C"
2452
- }
2453
- }
2454
- }, {
2455
- "content": "\"",
2456
- "props": {
2457
- "style": {
2458
- "color": "#ECEFF4"
2459
- }
2460
- }
2461
- }]
2462
- }, {
2463
- "tokens": [{
2464
- "content": " ",
2465
- "props": {
2466
- "style": {
2467
- "color": "#D8DEE9FF"
2468
- }
2469
- }
2470
- }, {
2471
- "content": "}",
2472
- "props": {
2473
- "style": {
2474
- "color": "#ECEFF4"
2475
- }
2476
- }
2477
- }]
2478
- }, {
2479
- "tokens": [{
2480
- "content": "}",
2481
- "props": {
2482
- "style": {
2483
- "color": "#ECEFF4"
2484
- }
2485
- }
2486
- }]
2487
- }],
2488
- "lang": "json"
2489
- },
2490
- "annotations": []
2491
- }]
2492
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.p, {
2493
- children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.strong, {
2494
- children: ["在安装或者使用第三方 npm 包的时候一定要确定它们的用途,以及通过区分它们的类型确定好它们应该放在 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2495
- children: "\"dependencies\""
2496
- }), " 还是 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2497
- children: "\"devDependencies\""
2498
- }), " 中。"]
2499
- })
2500
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.div, {
2501
- className: "modern-directive tip",
2502
- children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.p, {
2503
- className: "modern-directive-title",
2504
- children: "TIP"
2505
- }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.div, {
2506
- className: "modern-directive-content",
2507
- children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.p, {
2508
- children: ["\n一般来说,需要在源代码中使用到的包都属于 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2509
- children: "dependencies"
2510
- }), " 依赖。除非你通过打包的方式将依赖的代码输出到本地,那么这种情况可以将它作为 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2511
- children: "devDependencies"
2512
- }), "依赖。"]
2513
- })
2514
- })]
2515
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.h2, {
2516
- id: "还需要了解的-npm-零碎知识",
2517
- children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.a, {
2518
- className: "header-anchor",
2519
- "aria-hidden": "true",
2520
- href: "#还需要了解的-npm-零碎知识",
2521
- children: "#"
2522
- }), "还需要了解的 npm 零碎知识"]
2523
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.h3, {
2524
- id: "npm-包的程序入口",
2525
- children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.a, {
2526
- className: "header-anchor",
2527
- "aria-hidden": "true",
2528
- href: "#npm-包的程序入口",
2529
- children: "#"
2530
- }), "npm 包的程序入口"]
2531
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.p, {
2532
- children: ["在 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2533
- children: "package.json"
2534
- }), " 中存在一个 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2535
- children: "\"main\""
2536
- }), " 属性,它对应的值是一个模块 ID,或者更直观的说是一个 NodeJS 文件路径,它是你程序的主要入口。"]
2537
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.p, {
2538
- children: ["例如你的包名为 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2539
- children: "foo"
2540
- }), ",并且用户安装了它,然后执行 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2541
- children: "require(\"foo\")"
2542
- }), " 代码,那么 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2543
- children: "foo"
2544
- }), " 这个 npm 包的 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2545
- children: "\"main\""
2546
- }), " 字段对应的文件将会被导出。"]
2547
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.p, {
2548
- children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.strong, {
2549
- children: ["推荐在你的 npm 包里一定要设置 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2550
- children: "\"main\""
2551
- }), " 字段"]
2552
- }), "。如果没有设置 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2553
- children: "\"main\""
2554
- }), ",则默认入口为包的根目录下的 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2555
- children: "index.js"
2556
- }), " 文件。"]
2557
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.p, {
2558
- children: ["除了需要设置 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2559
- children: "\"main\""
2560
- }), " 属性以外,一般还会设置 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2561
- children: "\"module\""
2562
- }), " 属性。它与 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2563
- children: "\"main\""
2564
- }), " 属性的用途类似,它主要是用于在 webpack 场景下使用。webpack 在大多数情况下,会以 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.strong, {
2565
- children: "\"module\" -> \"main\""
2566
- }), " 这个顺序读取 npm 包的入口(文件)。"]
2567
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.blockquote, {
2568
- children: ["\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.p, {
2569
- children: ["想要了解关于 webpack 如何做这件事,可以查看这个", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.a, {
2570
- href: "https://webpack.js.org/configuration/resolve/#resolvemainfields",
2571
- target: "_blank",
2572
- rel: "nofollow",
2573
- children: "链接"
2574
- }), "。"]
2575
- }), "\n"]
2576
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.h3, {
2577
- id: "scripts",
2578
- children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.a, {
2579
- className: "header-anchor",
2580
- "aria-hidden": "true",
2581
- href: "#scripts",
2582
- children: "#"
2583
- }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2584
- children: "\"scripts\""
2585
- })]
2586
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.p, {
2587
- children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2588
- children: "package.json"
2589
- }), " 文件的 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2590
- children: "\"scripts\""
2591
- }), " 属性支持一些内置的脚本和 npm 预设的生命周期事件,以及任意的脚本。"]
2592
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.p, {
2593
- children: ["这些都可以通过运行 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2594
- children: "npm run-script <stage>"
2595
- }), " 或简称 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2596
- children: "npm run <stage>"
2597
- }), " 来执行。"]
2598
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.p, {
2599
- children: ["名称匹配的", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.a, {
2600
- href: "https://docs.npmjs.com/cli/v9/using-npm/scripts#pre--post-scripts",
2601
- target: "_blank",
2602
- rel: "nofollow",
2603
- children: "前置命令和后置命令"
2604
- }), "也会被运行(例如 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2605
- children: "premyscript"
2606
- }), "、", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2607
- children: "myscript"
2608
- }), "、", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2609
- children: "postmyscript"
2610
- }), ")。"]
2611
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(CH.Code, {
2612
- codeConfig: chCodeConfig,
2613
- northPanel: {
2614
- "tabs": [""],
2615
- "active": "",
2616
- "heightRatio": 1
2617
- },
2618
- files: [{
2619
- "name": "",
2620
- "focus": "",
2621
- "code": {
2622
- "lines": [{
2623
- "tokens": [{
2624
- "content": "{",
2625
- "props": {
2626
- "style": {
2627
- "color": "#ECEFF4"
2628
- }
2629
- }
2630
- }]
2631
- }, {
2632
- "tokens": [{
2633
- "content": " ",
2634
- "props": {
2635
- "style": {
2636
- "color": "#D8DEE9FF"
2637
- }
2638
- }
2639
- }, {
2640
- "content": "\"",
2641
- "props": {
2642
- "style": {
2643
- "color": "#ECEFF4"
2644
- }
2645
- }
2646
- }, {
2647
- "content": "scripts",
2648
- "props": {
2649
- "style": {
2650
- "color": "#8FBCBB"
2651
- }
2652
- }
2653
- }, {
2654
- "content": "\"",
2655
- "props": {
2656
- "style": {
2657
- "color": "#ECEFF4"
2658
- }
2659
- }
2660
- }, {
2661
- "content": ":",
2662
- "props": {
2663
- "style": {
2664
- "color": "#ECEFF4"
2665
- }
2666
- }
2667
- }, {
2668
- "content": " ",
2669
- "props": {
2670
- "style": {
2671
- "color": "#D8DEE9FF"
2672
- }
2673
- }
2674
- }, {
2675
- "content": "{",
2676
- "props": {
2677
- "style": {
2678
- "color": "#ECEFF4"
2679
- }
2680
- }
2681
- }]
2682
- }, {
2683
- "tokens": [{
2684
- "content": " ",
2685
- "props": {
2686
- "style": {
2687
- "color": "#D8DEE9FF"
2688
- }
2689
- }
2690
- }, {
2691
- "content": "\"",
2692
- "props": {
2693
- "style": {
2694
- "color": "#ECEFF4"
2695
- }
2696
- }
2697
- }, {
2698
- "content": "premyscript",
2699
- "props": {
2700
- "style": {
2701
- "color": "#8FBCBB"
2702
- }
2703
- }
2704
- }, {
2705
- "content": "\"",
2706
- "props": {
2707
- "style": {
2708
- "color": "#ECEFF4"
2709
- }
2710
- }
2711
- }, {
2712
- "content": ":",
2713
- "props": {
2714
- "style": {
2715
- "color": "#ECEFF4"
2716
- }
2717
- }
2718
- }, {
2719
- "content": " ",
2720
- "props": {
2721
- "style": {
2722
- "color": "#D8DEE9FF"
2723
- }
2724
- }
2725
- }, {
2726
- "content": "\"\"",
2727
- "props": {
2728
- "style": {
2729
- "color": "#ECEFF4"
2730
- }
2731
- }
2732
- }, {
2733
- "content": ",",
2734
- "props": {
2735
- "style": {
2736
- "color": "#ECEFF4"
2737
- }
2738
- }
2739
- }]
2740
- }, {
2741
- "tokens": [{
2742
- "content": " ",
2743
- "props": {
2744
- "style": {
2745
- "color": "#D8DEE9FF"
2746
- }
2747
- }
2748
- }, {
2749
- "content": "\"",
2750
- "props": {
2751
- "style": {
2752
- "color": "#ECEFF4"
2753
- }
2754
- }
2755
- }, {
2756
- "content": "myscript",
2757
- "props": {
2758
- "style": {
2759
- "color": "#8FBCBB"
2760
- }
2761
- }
2762
- }, {
2763
- "content": "\"",
2764
- "props": {
2765
- "style": {
2766
- "color": "#ECEFF4"
2767
- }
2768
- }
2769
- }, {
2770
- "content": ":",
2771
- "props": {
2772
- "style": {
2773
- "color": "#ECEFF4"
2774
- }
2775
- }
2776
- }, {
2777
- "content": " ",
2778
- "props": {
2779
- "style": {
2780
- "color": "#D8DEE9FF"
2781
- }
2782
- }
2783
- }, {
2784
- "content": "\"\"",
2785
- "props": {
2786
- "style": {
2787
- "color": "#ECEFF4"
2788
- }
2789
- }
2790
- }, {
2791
- "content": ",",
2792
- "props": {
2793
- "style": {
2794
- "color": "#ECEFF4"
2795
- }
2796
- }
2797
- }]
2798
- }, {
2799
- "tokens": [{
2800
- "content": " ",
2801
- "props": {
2802
- "style": {
2803
- "color": "#D8DEE9FF"
2804
- }
2805
- }
2806
- }, {
2807
- "content": "\"",
2808
- "props": {
2809
- "style": {
2810
- "color": "#ECEFF4"
2811
- }
2812
- }
2813
- }, {
2814
- "content": "postmyscript",
2815
- "props": {
2816
- "style": {
2817
- "color": "#8FBCBB"
2818
- }
2819
- }
2820
- }, {
2821
- "content": "\"",
2822
- "props": {
2823
- "style": {
2824
- "color": "#ECEFF4"
2825
- }
2826
- }
2827
- }, {
2828
- "content": ":",
2829
- "props": {
2830
- "style": {
2831
- "color": "#ECEFF4"
2832
- }
2833
- }
2834
- }, {
2835
- "content": " ",
2836
- "props": {
2837
- "style": {
2838
- "color": "#D8DEE9FF"
2839
- }
2840
- }
2841
- }, {
2842
- "content": "\"\"",
2843
- "props": {
2844
- "style": {
2845
- "color": "#ECEFF4"
2846
- }
2847
- }
2848
- }]
2849
- }, {
2850
- "tokens": [{
2851
- "content": " ",
2852
- "props": {
2853
- "style": {
2854
- "color": "#D8DEE9FF"
2855
- }
2856
- }
2857
- }, {
2858
- "content": "}",
2859
- "props": {
2860
- "style": {
2861
- "color": "#ECEFF4"
2862
- }
2863
- }
2864
- }]
2865
- }, {
2866
- "tokens": [{
2867
- "content": "}",
2868
- "props": {
2869
- "style": {
2870
- "color": "#ECEFF4"
2871
- }
2872
- }
2873
- }]
2874
- }],
2875
- "lang": "json"
2876
- },
2877
- "annotations": []
2878
- }]
2879
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.p, {
2880
- children: ["当执行 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2881
- children: "npm run myscripts"
2882
- }), " 的时候,", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2883
- children: "premyscripts"
2884
- }), " 对应的脚本会在它之前执行,", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2885
- children: "postmyscripts"
2886
- }), " 对应的脚本会在它之后执行。"]
2887
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.p, {
2888
- children: ["来自依赖的脚本命令可以用 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2889
- children: "npm explore <pkg> -- npm run <stage>"
2890
- }), " 运行。"]
2891
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.p, {
2892
- children: "还有一些特殊的生命周期脚本(Life Scripts),只在某些情况下发生。这里介绍几个通常需要了解的情况。"
2893
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.h4, {
2894
- id: "npm-install",
2895
- children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.a, {
2896
- className: "header-anchor",
2897
- "aria-hidden": "true",
2898
- href: "#npm-install",
2899
- children: "#"
2900
- }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2901
- children: "npm install"
2902
- })]
2903
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.p, {
2904
- children: ["当你运行 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2905
- children: "npm install -g <pkg-name>"
2906
- }), " 时,以下脚本会运行。"]
2907
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.ul, {
2908
- children: ["\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.li, {
2909
- children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2910
- children: "preinstall"
2911
- })
2912
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.li, {
2913
- children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2914
- children: "install"
2915
- })
2916
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.li, {
2917
- children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2918
- children: "postinstall"
2919
- })
2920
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.li, {
2921
- children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2922
- children: "prepublish"
2923
- })
2924
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.li, {
2925
- children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2926
- children: "preprepare"
2927
- })
2928
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.li, {
2929
- children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2930
- children: "prepare"
2931
- })
2932
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.li, {
2933
- children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2934
- children: "postprepare"
2935
- })
2936
- }), "\n"]
2937
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.p, {
2938
- children: ["如果你的软件包根目录有一个 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2939
- children: "binding.gyp"
2940
- }), " 文件,而你没有定义 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2941
- children: "install"
2942
- }), " 或 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2943
- children: "preinstall"
2944
- }), " 脚本,那么 npm 将以 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2945
- children: "node-gyp rebuild"
2946
- }), " 作为默认的 install 命令,使用 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.a, {
2947
- href: "https://github.com/nodejs/node-gyp",
2948
- target: "_blank",
2949
- rel: "nofollow",
2950
- children: "node-gyp"
2951
- }), " 进行编译。"]
2952
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.h4, {
2953
- id: "npm-publish",
2954
- children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.a, {
2955
- className: "header-anchor",
2956
- "aria-hidden": "true",
2957
- href: "#npm-publish",
2958
- children: "#"
2959
- }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2960
- children: "npm publish"
2961
- })]
2962
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.p, {
2963
- children: "当发布项目的时候,执行该命令会触发以下脚本:"
2964
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.ul, {
2965
- children: ["\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.li, {
2966
- children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2967
- children: "prepublishOnly"
2968
- })
2969
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.li, {
2970
- children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2971
- children: "prepack"
2972
- })
2973
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.li, {
2974
- children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2975
- children: "prepare"
2976
- })
2977
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.li, {
2978
- children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2979
- children: "postpack"
2980
- })
2981
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.li, {
2982
- children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2983
- children: "publish"
2984
- })
2985
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.li, {
2986
- children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2987
- children: "postpublish"
2988
- })
2989
- }), "\n"]
2990
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.p, {
2991
- children: ["当以 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.a, {
2992
- href: "https://docs.npmjs.com/cli/v7/commands/npm-publish#dry-run",
2993
- target: "_blank",
2994
- rel: "nofollow",
2995
- children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2996
- children: "--dry-run"
2997
- })
2998
- }), " 模式运行的时候,", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
2999
- children: "prepare"
3000
- }), " 对应的脚本将不会执行。"]
3001
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.h3, {
3002
- id: "peerdependencies",
3003
- children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.a, {
3004
- className: "header-anchor",
3005
- "aria-hidden": "true",
3006
- href: "#peerdependencies",
3007
- children: "#"
3008
- }), "peerDependencies"]
3009
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.p, {
3010
- children: "在某些情况下,你的 npm 项目与它的宿主工具或者库之间存在某种兼容关系(例如一个 webpack 插件项目和 webpack),同时你的 npm 项目不想将宿主作为必要的依赖,这个时候通常说明你的项目可能是这个宿主工具或者库的插件。你的 npm 项目会对宿主包的版本有一定的要求,因为只有在特定的版本下才会暴露出 npm 项目所需要的 API。"
3011
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.p, {
3012
- children: ["关于更多 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
3013
- children: "peerDependencies"
3014
- }), " 的解释,可以通过下面的链接了解 npm、pnpm、Yarn 对于它的不同处理方式:"]
3015
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.ul, {
3016
- children: ["\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.li, {
3017
- children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.a, {
3018
- href: "https://docs.npmjs.com/cli/v9/configuring-npm/package-json#peerdependencies",
3019
- target: "_blank",
3020
- rel: "nofollow",
3021
- children: "npm 对 peerDependencies 的解释"
3022
- })
3023
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.li, {
3024
- children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.a, {
3025
- href: "https://pnpm.io/feature-comparison",
3026
- target: "_blank",
3027
- rel: "nofollow",
3028
- children: "pnpm vs npm VS Yarn"
3029
- })
3030
- }), "\n"]
3031
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.h2, {
3032
- id: "npm-包管理器",
3033
- children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.a, {
3034
- className: "header-anchor",
3035
- "aria-hidden": "true",
3036
- href: "#npm-包管理器",
3037
- children: "#"
3038
- }), "npm 包管理器"]
3039
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.p, {
3040
- children: ["除了 npm 这种标准的包管理器以外,目前主流的还有 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.strong, {
3041
- children: "pnpm"
3042
- }), " 和 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.strong, {
3043
- children: "Yarn"
3044
- }), ",它们都是不错的 npm cli 替代品。"]
3045
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.p, {
3046
- children: ["推荐使用 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.a, {
3047
- href: "https://pnpm.io/installation",
3048
- target: "_blank",
3049
- rel: "nofollow",
3050
- children: "pnpm"
3051
- }), " 来管理项目依赖,可以通过下面的方式安装它:"]
3052
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(CH.Code, {
3053
- codeConfig: chCodeConfig,
3054
- northPanel: {
3055
- "tabs": [""],
3056
- "active": "",
3057
- "heightRatio": 1
3058
- },
3059
- files: [{
3060
- "name": "",
3061
- "focus": "",
3062
- "code": {
3063
- "lines": [{
3064
- "tokens": [{
3065
- "content": "npm install -g pnpm",
3066
- "props": {
3067
- "style": {
3068
- "color": "#D8DEE9FF"
3069
- }
3070
- }
3071
- }]
3072
- }],
3073
- "lang": "bash"
3074
- },
3075
- "annotations": []
3076
- }]
3077
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.h2, {
3078
- id: "module-tools-配置文件",
3079
- children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.a, {
3080
- className: "header-anchor",
3081
- "aria-hidden": "true",
3082
- href: "#module-tools-配置文件",
3083
- children: "#"
3084
- }), "Module Tools 配置文件"]
3085
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.p, {
3086
- children: ["通过", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
3087
- children: "@modern-js/create"
3088
- }), "创建的模块工程项目目录下提供了 Module Tools 的配置文件 —— ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
3089
- children: "modern.config.(j|t)s"
3090
- }), "。但 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
3091
- children: "modern.config"
3092
- }), " 配置文件不是必须存在的。"]
3093
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.p, {
3094
- children: "默认情况下,生成的配置文件的内容如下:"
3095
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(CH.Code, {
3096
- codeConfig: chCodeConfig,
3097
- northPanel: {
3098
- "tabs": [""],
3099
- "active": "",
3100
- "heightRatio": 1
3101
- },
3102
- files: [{
3103
- "name": "",
3104
- "focus": "",
3105
- "code": {
3106
- "lines": [{
3107
- "tokens": [{
3108
- "content": "// modern.config.ts",
3109
- "props": {
3110
- "style": {
3111
- "color": "#616E88"
3112
- }
3113
- }
3114
- }]
3115
- }, {
3116
- "tokens": [{
3117
- "content": "import",
3118
- "props": {
3119
- "style": {
3120
- "color": "#81A1C1"
3121
- }
3122
- }
3123
- }, {
3124
- "content": " ",
3125
- "props": {
3126
- "style": {
3127
- "color": "#D8DEE9FF"
3128
- }
3129
- }
3130
- }, {
3131
- "content": "moduleTools",
3132
- "props": {
3133
- "style": {
3134
- "color": "#D8DEE9"
3135
- }
3136
- }
3137
- }, {
3138
- "content": ",",
3139
- "props": {
3140
- "style": {
3141
- "color": "#ECEFF4"
3142
- }
3143
- }
3144
- }, {
3145
- "content": " ",
3146
- "props": {
3147
- "style": {
3148
- "color": "#D8DEE9FF"
3149
- }
3150
- }
3151
- }, {
3152
- "content": "{",
3153
- "props": {
3154
- "style": {
3155
- "color": "#ECEFF4"
3156
- }
3157
- }
3158
- }, {
3159
- "content": " ",
3160
- "props": {
3161
- "style": {
3162
- "color": "#D8DEE9FF"
3163
- }
3164
- }
3165
- }, {
3166
- "content": "defineConfig",
3167
- "props": {
3168
- "style": {
3169
- "color": "#D8DEE9"
3170
- }
3171
- }
3172
- }, {
3173
- "content": " ",
3174
- "props": {
3175
- "style": {
3176
- "color": "#D8DEE9FF"
3177
- }
3178
- }
3179
- }, {
3180
- "content": "}",
3181
- "props": {
3182
- "style": {
3183
- "color": "#ECEFF4"
3184
- }
3185
- }
3186
- }, {
3187
- "content": " ",
3188
- "props": {
3189
- "style": {
3190
- "color": "#D8DEE9FF"
3191
- }
3192
- }
3193
- }, {
3194
- "content": "from",
3195
- "props": {
3196
- "style": {
3197
- "color": "#81A1C1"
3198
- }
3199
- }
3200
- }, {
3201
- "content": " ",
3202
- "props": {
3203
- "style": {
3204
- "color": "#D8DEE9FF"
3205
- }
3206
- }
3207
- }, {
3208
- "content": "'",
3209
- "props": {
3210
- "style": {
3211
- "color": "#ECEFF4"
3212
- }
3213
- }
3214
- }, {
3215
- "content": "@modern-js/module-tools",
3216
- "props": {
3217
- "style": {
3218
- "color": "#A3BE8C"
3219
- }
3220
- }
3221
- }, {
3222
- "content": "'",
3223
- "props": {
3224
- "style": {
3225
- "color": "#ECEFF4"
3226
- }
3227
- }
3228
- }, {
3229
- "content": ";",
3230
- "props": {
3231
- "style": {
3232
- "color": "#81A1C1"
3233
- }
3234
- }
3235
- }]
3236
- }, {
3237
- "tokens": []
3238
- }, {
3239
- "tokens": [{
3240
- "content": "export",
3241
- "props": {
3242
- "style": {
3243
- "color": "#81A1C1"
3244
- }
3245
- }
3246
- }, {
3247
- "content": " ",
3248
- "props": {
3249
- "style": {
3250
- "color": "#D8DEE9FF"
3251
- }
3252
- }
3253
- }, {
3254
- "content": "default",
3255
- "props": {
3256
- "style": {
3257
- "color": "#81A1C1"
3258
- }
3259
- }
3260
- }, {
3261
- "content": " ",
3262
- "props": {
3263
- "style": {
3264
- "color": "#D8DEE9FF"
3265
- }
3266
- }
3267
- }, {
3268
- "content": "defineConfig",
3269
- "props": {
3270
- "style": {
3271
- "color": "#88C0D0"
3272
- }
3273
- }
3274
- }, {
3275
- "content": "(",
3276
- "props": {
3277
- "style": {
3278
- "color": "#D8DEE9FF"
3279
- }
3280
- }
3281
- }, {
3282
- "content": "{",
3283
- "props": {
3284
- "style": {
3285
- "color": "#ECEFF4"
3286
- }
3287
- }
3288
- }]
3289
- }, {
3290
- "tokens": [{
3291
- "content": " ",
3292
- "props": {
3293
- "style": {
3294
- "color": "#D8DEE9FF"
3295
- }
3296
- }
3297
- }, {
3298
- "content": "plugins",
3299
- "props": {
3300
- "style": {
3301
- "color": "#D8DEE9"
3302
- }
3303
- }
3304
- }, {
3305
- "content": ":",
3306
- "props": {
3307
- "style": {
3308
- "color": "#ECEFF4"
3309
- }
3310
- }
3311
- }, {
3312
- "content": " [",
3313
- "props": {
3314
- "style": {
3315
- "color": "#D8DEE9FF"
3316
- }
3317
- }
3318
- }, {
3319
- "content": "moduleTools",
3320
- "props": {
3321
- "style": {
3322
- "color": "#88C0D0"
3323
- }
3324
- }
3325
- }, {
3326
- "content": "()]",
3327
- "props": {
3328
- "style": {
3329
- "color": "#D8DEE9FF"
3330
- }
3331
- }
3332
- }, {
3333
- "content": ",",
3334
- "props": {
3335
- "style": {
3336
- "color": "#ECEFF4"
3337
- }
3338
- }
3339
- }]
3340
- }, {
3341
- "tokens": [{
3342
- "content": " ",
3343
- "props": {
3344
- "style": {
3345
- "color": "#D8DEE9FF"
3346
- }
3347
- }
3348
- }, {
3349
- "content": "buildPreset",
3350
- "props": {
3351
- "style": {
3352
- "color": "#D8DEE9"
3353
- }
3354
- }
3355
- }, {
3356
- "content": ":",
3357
- "props": {
3358
- "style": {
3359
- "color": "#ECEFF4"
3360
- }
3361
- }
3362
- }, {
3363
- "content": " ",
3364
- "props": {
3365
- "style": {
3366
- "color": "#D8DEE9FF"
3367
- }
3368
- }
3369
- }, {
3370
- "content": "'",
3371
- "props": {
3372
- "style": {
3373
- "color": "#ECEFF4"
3374
- }
3375
- }
3376
- }, {
3377
- "content": "npm-library",
3378
- "props": {
3379
- "style": {
3380
- "color": "#A3BE8C"
3381
- }
3382
- }
3383
- }, {
3384
- "content": "'",
3385
- "props": {
3386
- "style": {
3387
- "color": "#ECEFF4"
3388
- }
3389
- }
3390
- }, {
3391
- "content": ",",
3392
- "props": {
3393
- "style": {
3394
- "color": "#ECEFF4"
3395
- }
3396
- }
3397
- }]
3398
- }, {
3399
- "tokens": [{
3400
- "content": "}",
3401
- "props": {
3402
- "style": {
3403
- "color": "#ECEFF4"
3404
- }
3405
- }
3406
- }, {
3407
- "content": ")",
3408
- "props": {
3409
- "style": {
3410
- "color": "#D8DEE9FF"
3411
- }
3412
- }
3413
- }, {
3414
- "content": ";",
3415
- "props": {
3416
- "style": {
3417
- "color": "#81A1C1"
3418
- }
3419
- }
3420
- }]
3421
- }],
3422
- "lang": "typescript"
3423
- },
3424
- "annotations": []
3425
- }]
3426
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.p, {
3427
- children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components.strong, {
3428
- children: ["我们推荐使用 ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components.code, {
3429
- children: "defineConfig"
3430
- }), " 函数"]
3431
- }), ",不过并不强制使用它。因此你也可以在配置文件中直接返回一个对象:"]
3432
- }), "\n", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(CH.Code, {
3433
- codeConfig: chCodeConfig,
3434
- northPanel: {
3435
- "tabs": [""],
3436
- "active": "",
3437
- "heightRatio": 1
3438
- },
3439
- files: [{
3440
- "name": "",
3441
- "focus": "",
3442
- "code": {
3443
- "lines": [{
3444
- "tokens": [{
3445
- "content": "// modern.config.ts",
3446
- "props": {
3447
- "style": {
3448
- "color": "#616E88"
3449
- }
3450
- }
3451
- }]
3452
- }, {
3453
- "tokens": [{
3454
- "content": "import",
3455
- "props": {
3456
- "style": {
3457
- "color": "#81A1C1"
3458
- }
3459
- }
3460
- }, {
3461
- "content": " ",
3462
- "props": {
3463
- "style": {
3464
- "color": "#D8DEE9FF"
3465
- }
3466
- }
3467
- }, {
3468
- "content": "moduleTools",
3469
- "props": {
3470
- "style": {
3471
- "color": "#D8DEE9"
3472
- }
3473
- }
3474
- }, {
3475
- "content": " ",
3476
- "props": {
3477
- "style": {
3478
- "color": "#D8DEE9FF"
3479
- }
3480
- }
3481
- }, {
3482
- "content": "from",
3483
- "props": {
3484
- "style": {
3485
- "color": "#81A1C1"
3486
- }
3487
- }
3488
- }, {
3489
- "content": " ",
3490
- "props": {
3491
- "style": {
3492
- "color": "#D8DEE9FF"
3493
- }
3494
- }
3495
- }, {
3496
- "content": "'",
3497
- "props": {
3498
- "style": {
3499
- "color": "#ECEFF4"
3500
- }
3501
- }
3502
- }, {
3503
- "content": "@modern-js/module-tools",
3504
- "props": {
3505
- "style": {
3506
- "color": "#A3BE8C"
3507
- }
3508
- }
3509
- }, {
3510
- "content": "'",
3511
- "props": {
3512
- "style": {
3513
- "color": "#ECEFF4"
3514
- }
3515
- }
3516
- }, {
3517
- "content": ";",
3518
- "props": {
3519
- "style": {
3520
- "color": "#81A1C1"
3521
- }
3522
- }
3523
- }]
3524
- }, {
3525
- "tokens": []
3526
- }, {
3527
- "tokens": [{
3528
- "content": "export",
3529
- "props": {
3530
- "style": {
3531
- "color": "#81A1C1"
3532
- }
3533
- }
3534
- }, {
3535
- "content": " ",
3536
- "props": {
3537
- "style": {
3538
- "color": "#D8DEE9FF"
3539
- }
3540
- }
3541
- }, {
3542
- "content": "default",
3543
- "props": {
3544
- "style": {
3545
- "color": "#81A1C1"
3546
- }
3547
- }
3548
- }, {
3549
- "content": " ",
3550
- "props": {
3551
- "style": {
3552
- "color": "#D8DEE9FF"
3553
- }
3554
- }
3555
- }, {
3556
- "content": "{",
3557
- "props": {
3558
- "style": {
3559
- "color": "#ECEFF4"
3560
- }
3561
- }
3562
- }]
3563
- }, {
3564
- "tokens": [{
3565
- "content": " ",
3566
- "props": {
3567
- "style": {
3568
- "color": "#D8DEE9FF"
3569
- }
3570
- }
3571
- }, {
3572
- "content": "plugins",
3573
- "props": {
3574
- "style": {
3575
- "color": "#D8DEE9"
3576
- }
3577
- }
3578
- }, {
3579
- "content": ":",
3580
- "props": {
3581
- "style": {
3582
- "color": "#ECEFF4"
3583
- }
3584
- }
3585
- }, {
3586
- "content": " [",
3587
- "props": {
3588
- "style": {
3589
- "color": "#D8DEE9FF"
3590
- }
3591
- }
3592
- }, {
3593
- "content": "moduleTools",
3594
- "props": {
3595
- "style": {
3596
- "color": "#88C0D0"
3597
- }
3598
- }
3599
- }, {
3600
- "content": "()]",
3601
- "props": {
3602
- "style": {
3603
- "color": "#D8DEE9FF"
3604
- }
3605
- }
3606
- }, {
3607
- "content": ",",
3608
- "props": {
3609
- "style": {
3610
- "color": "#ECEFF4"
3611
- }
3612
- }
3613
- }]
3614
- }, {
3615
- "tokens": [{
3616
- "content": " ",
3617
- "props": {
3618
- "style": {
3619
- "color": "#D8DEE9FF"
3620
- }
3621
- }
3622
- }, {
3623
- "content": "buildPreset",
3624
- "props": {
3625
- "style": {
3626
- "color": "#D8DEE9"
3627
- }
3628
- }
3629
- }, {
3630
- "content": ":",
3631
- "props": {
3632
- "style": {
3633
- "color": "#ECEFF4"
3634
- }
3635
- }
3636
- }, {
3637
- "content": " ",
3638
- "props": {
3639
- "style": {
3640
- "color": "#D8DEE9FF"
3641
- }
3642
- }
3643
- }, {
3644
- "content": "'",
3645
- "props": {
3646
- "style": {
3647
- "color": "#ECEFF4"
3648
- }
3649
- }
3650
- }, {
3651
- "content": "npm-library",
3652
- "props": {
3653
- "style": {
3654
- "color": "#A3BE8C"
3655
- }
3656
- }
3657
- }, {
3658
- "content": "'",
3659
- "props": {
3660
- "style": {
3661
- "color": "#ECEFF4"
3662
- }
3663
- }
3664
- }, {
3665
- "content": ",",
3666
- "props": {
3667
- "style": {
3668
- "color": "#ECEFF4"
3669
- }
3670
- }
3671
- }]
3672
- }, {
3673
- "tokens": [{
3674
- "content": "}",
3675
- "props": {
3676
- "style": {
3677
- "color": "#ECEFF4"
3678
- }
3679
- }
3680
- }, {
3681
- "content": ";",
3682
- "props": {
3683
- "style": {
3684
- "color": "#81A1C1"
3685
- }
3686
- }
3687
- }]
3688
- }],
3689
- "lang": "ts"
3690
- },
3691
- "annotations": []
3692
- }]
3693
- })]
3694
- });
3695
- }
3696
- function MDXContent(props = {}) {
3697
- const {wrapper: MDXLayout} = props.components || ({});
3698
- return MDXLayout ? (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(MDXLayout, Object.assign({}, props, {
3699
- children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_createMdxContent, props)
3700
- })) : _createMdxContent(props);
3701
- }
3702
- /* harmony default export */ __webpack_exports__["default"] = (MDXContent);
3703
- function _missingMdxReference(id, component, place) {
3704
- 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/before-getting-started.md`" : ""));
3705
- }
3706
-
3707
-
3708
- /***/ })
3709
-
3710
- }]);
3711
- //# sourceMappingURL=zh_guide_basic_before-getting-started.js.map