@docusaurus/core 2.0.0-beta.2 → 2.0.0-beta.22

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 (223) hide show
  1. package/README.md +1 -0
  2. package/bin/beforeCli.mjs +140 -0
  3. package/bin/docusaurus.mjs +221 -0
  4. package/lib/babel/preset.d.ts +8 -3
  5. package/lib/babel/preset.js +10 -8
  6. package/lib/client/App.d.ts +2 -3
  7. package/lib/client/App.js +31 -28
  8. package/lib/client/BaseUrlIssueBanner/index.d.ts +27 -0
  9. package/lib/client/{baseUrlIssueBanner/BaseUrlIssueBanner.js → BaseUrlIssueBanner/index.js} +25 -14
  10. package/lib/client/{baseUrlIssueBanner → BaseUrlIssueBanner}/styles.module.css +0 -0
  11. package/lib/client/ClientLifecyclesDispatcher.d.ts +16 -0
  12. package/lib/client/ClientLifecyclesDispatcher.js +39 -0
  13. package/lib/client/LinksCollector.d.ts +3 -3
  14. package/lib/client/LinksCollector.js +8 -13
  15. package/lib/client/PendingNavigation.d.ts +17 -3
  16. package/lib/client/PendingNavigation.js +47 -72
  17. package/lib/client/{baseUrlIssueBanner/BaseUrlIssueBanner.d.ts → SiteMetadataDefaults.d.ts} +1 -2
  18. package/lib/client/SiteMetadataDefaults.js +21 -0
  19. package/lib/{choosePort.d.ts → client/browserContext.d.ts} +5 -5
  20. package/lib/client/browserContext.js +22 -0
  21. package/lib/client/clientEntry.js +14 -9
  22. package/lib/client/docusaurus.d.ts +12 -6
  23. package/lib/client/docusaurus.js +30 -43
  24. package/lib/client/docusaurusContext.d.ts +12 -0
  25. package/lib/client/docusaurusContext.js +25 -0
  26. package/lib/client/exports/BrowserOnly.d.ts +3 -5
  27. package/lib/client/exports/BrowserOnly.js +14 -8
  28. package/lib/client/exports/ComponentCreator.d.ts +6 -2
  29. package/lib/client/exports/ComponentCreator.js +75 -42
  30. package/lib/client/exports/ErrorBoundary.d.ts +18 -0
  31. package/lib/client/exports/ErrorBoundary.js +37 -0
  32. package/lib/client/exports/Head.d.ts +2 -3
  33. package/lib/client/exports/Head.js +3 -4
  34. package/lib/client/exports/Interpolate.d.ts +2 -2
  35. package/lib/client/exports/Interpolate.js +20 -49
  36. package/lib/client/exports/Link.d.ts +4 -10
  37. package/lib/client/exports/Link.js +40 -40
  38. package/lib/client/exports/Translate.d.ts +1 -1
  39. package/lib/client/exports/Translate.js +14 -9
  40. package/lib/client/exports/constants.js +1 -11
  41. package/lib/client/exports/isInternalUrl.js +1 -1
  42. package/lib/client/exports/renderRoutes.d.ts +1 -2
  43. package/lib/client/exports/renderRoutes.js +1 -2
  44. package/lib/client/exports/router.d.ts +1 -1
  45. package/lib/client/exports/router.js +1 -1
  46. package/lib/client/exports/useBaseUrl.js +11 -14
  47. package/lib/client/exports/useDocusaurusContext.d.ts +2 -3
  48. package/lib/client/exports/useDocusaurusContext.js +3 -9
  49. package/lib/client/exports/useGlobalData.d.ts +4 -3
  50. package/lib/client/exports/useGlobalData.js +6 -13
  51. package/lib/{server/versions/__tests/index.test.d.ts → client/exports/useIsBrowser.d.ts} +1 -1
  52. package/lib/client/exports/useIsBrowser.js +11 -0
  53. package/lib/client/exports/useRouteContext.d.ts +8 -0
  54. package/lib/client/exports/useRouteContext.js +15 -0
  55. package/lib/client/flat.d.ts +12 -2
  56. package/lib/client/flat.js +19 -15
  57. package/lib/client/normalizeLocation.d.ts +2 -5
  58. package/lib/client/normalizeLocation.js +14 -10
  59. package/lib/client/prefetch.d.ts +1 -2
  60. package/lib/client/prefetch.js +12 -32
  61. package/lib/client/preload.d.ts +3 -4
  62. package/lib/client/preload.js +5 -12
  63. package/lib/client/routeContext.d.ts +13 -0
  64. package/lib/client/routeContext.js +31 -0
  65. package/lib/client/serverEntry.d.ts +10 -0
  66. package/lib/client/serverEntry.js +108 -146
  67. package/lib/client/theme-fallback/Error/index.d.ts +10 -0
  68. package/lib/client/theme-fallback/Error/index.js +45 -0
  69. package/lib/client/theme-fallback/Layout/index.d.ts +10 -0
  70. package/lib/client/theme-fallback/Layout/index.js +2 -26
  71. package/lib/client/theme-fallback/Loading/index.d.ts +9 -0
  72. package/lib/client/theme-fallback/Loading/index.js +50 -116
  73. package/lib/client/{exports/context.js → theme-fallback/NotFound/index.d.ts} +2 -2
  74. package/lib/client/theme-fallback/NotFound/index.js +19 -18
  75. package/lib/client/theme-fallback/Root/index.d.ts +10 -0
  76. package/lib/client/theme-fallback/Root/index.js +2 -6
  77. package/lib/{server/html-tags/htmlTags.d.ts → client/theme-fallback/SiteMetadata/index.d.ts} +2 -1
  78. package/lib/client/theme-fallback/SiteMetadata/index.js +10 -0
  79. package/lib/commands/build.d.ts +6 -2
  80. package/lib/commands/build.js +81 -64
  81. package/lib/commands/clear.d.ts +7 -1
  82. package/lib/commands/clear.js +34 -21
  83. package/lib/commands/deploy.d.ts +5 -2
  84. package/lib/commands/deploy.js +104 -81
  85. package/lib/commands/external.d.ts +2 -2
  86. package/lib/commands/external.js +9 -11
  87. package/lib/commands/serve.d.ts +8 -2
  88. package/lib/commands/serve.js +29 -28
  89. package/lib/commands/start.d.ts +9 -2
  90. package/lib/commands/start.js +109 -101
  91. package/lib/commands/swizzle/actions.d.ts +23 -0
  92. package/lib/commands/swizzle/actions.js +101 -0
  93. package/lib/commands/swizzle/common.d.ts +33 -0
  94. package/lib/commands/swizzle/common.js +56 -0
  95. package/lib/commands/swizzle/components.d.ts +29 -0
  96. package/lib/commands/swizzle/components.js +200 -0
  97. package/lib/commands/swizzle/config.d.ts +10 -0
  98. package/lib/commands/swizzle/config.js +84 -0
  99. package/lib/{server/client-modules/index.d.ts → commands/swizzle/context.d.ts} +2 -2
  100. package/lib/commands/swizzle/context.js +24 -0
  101. package/lib/commands/swizzle/index.d.ts +8 -0
  102. package/lib/commands/swizzle/index.js +118 -0
  103. package/lib/commands/swizzle/prompts.d.ts +12 -0
  104. package/lib/commands/swizzle/prompts.js +110 -0
  105. package/lib/{client/exports/context.d.ts → commands/swizzle/tables.d.ts} +3 -4
  106. package/lib/commands/swizzle/tables.js +113 -0
  107. package/lib/commands/swizzle/themes.d.ts +20 -0
  108. package/lib/commands/swizzle/themes.js +106 -0
  109. package/lib/commands/writeHeadingIds.d.ts +2 -6
  110. package/lib/commands/writeHeadingIds.js +22 -81
  111. package/lib/commands/writeTranslations.d.ts +4 -5
  112. package/lib/commands/writeTranslations.js +46 -25
  113. package/lib/index.d.ts +9 -9
  114. package/lib/index.js +14 -14
  115. package/lib/server/brokenLinks.d.ts +4 -17
  116. package/lib/server/brokenLinks.js +67 -56
  117. package/lib/server/clientModules.d.ts +12 -0
  118. package/lib/server/clientModules.js +20 -0
  119. package/lib/server/config.d.ts +5 -2
  120. package/lib/server/config.js +29 -6
  121. package/lib/server/configValidation.d.ts +4 -4
  122. package/lib/server/configValidation.js +86 -41
  123. package/lib/server/getHostPort.d.ts +14 -0
  124. package/lib/server/getHostPort.js +79 -0
  125. package/lib/server/htmlTags.d.ts +12 -0
  126. package/lib/server/htmlTags.js +62 -0
  127. package/lib/server/i18n.d.ts +3 -13
  128. package/lib/server/i18n.js +21 -55
  129. package/lib/server/index.d.ts +28 -13
  130. package/lib/server/index.js +83 -165
  131. package/lib/server/plugins/configs.d.ts +51 -0
  132. package/lib/server/plugins/configs.js +101 -0
  133. package/lib/server/plugins/index.d.ts +9 -8
  134. package/lib/server/plugins/index.js +73 -134
  135. package/lib/server/plugins/init.d.ts +6 -5
  136. package/lib/server/plugins/init.js +44 -109
  137. package/lib/server/plugins/moduleShorthand.d.ts +9 -0
  138. package/lib/server/plugins/moduleShorthand.js +46 -0
  139. package/lib/server/plugins/pluginIds.d.ts +5 -1
  140. package/lib/server/plugins/pluginIds.js +12 -7
  141. package/lib/server/plugins/presets.d.ts +12 -0
  142. package/lib/server/plugins/presets.js +49 -0
  143. package/lib/server/plugins/routeConfig.d.ts +11 -0
  144. package/lib/server/plugins/routeConfig.js +54 -0
  145. package/lib/server/plugins/synthetic.d.ts +20 -0
  146. package/lib/server/plugins/synthetic.js +111 -0
  147. package/lib/server/routes.d.ts +39 -7
  148. package/lib/server/routes.js +182 -95
  149. package/lib/server/siteMetadata.d.ts +12 -0
  150. package/lib/server/siteMetadata.js +81 -0
  151. package/lib/server/translations/translations.d.ts +14 -19
  152. package/lib/server/translations/translations.js +40 -72
  153. package/lib/server/translations/translationsExtractor.d.ts +10 -4
  154. package/lib/server/translations/translationsExtractor.js +158 -122
  155. package/lib/server/utils.d.ts +9 -3
  156. package/lib/server/utils.js +7 -9
  157. package/lib/webpack/aliases/index.d.ts +34 -0
  158. package/lib/webpack/aliases/index.js +106 -0
  159. package/lib/webpack/base.d.ts +3 -4
  160. package/lib/webpack/base.js +45 -57
  161. package/lib/webpack/client.d.ts +3 -3
  162. package/lib/webpack/client.js +12 -19
  163. package/lib/webpack/plugins/ChunkAssetPlugin.d.ts +13 -3
  164. package/lib/webpack/plugins/ChunkAssetPlugin.js +24 -17
  165. package/lib/webpack/plugins/CleanWebpackPlugin.d.ts +6 -25
  166. package/lib/webpack/plugins/CleanWebpackPlugin.js +33 -17
  167. package/lib/webpack/plugins/LogPlugin.d.ts +1 -1
  168. package/lib/webpack/plugins/LogPlugin.js +4 -5
  169. package/lib/webpack/plugins/WaitPlugin.d.ts +3 -3
  170. package/lib/webpack/plugins/WaitPlugin.js +1 -1
  171. package/lib/webpack/server.d.ts +5 -5
  172. package/lib/webpack/server.js +22 -9
  173. package/lib/{client → webpack}/templates/index.html.template.ejs +0 -0
  174. package/lib/webpack/templates/ssr.html.template.d.ts +8 -0
  175. package/lib/{client → webpack}/templates/ssr.html.template.js +3 -2
  176. package/lib/webpack/utils.d.ts +15 -31
  177. package/lib/webpack/utils.js +61 -182
  178. package/package.json +81 -77
  179. package/bin/docusaurus.js +0 -325
  180. package/lib/.tsbuildinfo +0 -1
  181. package/lib/choosePort.js +0 -105
  182. package/lib/client/.eslintrc.js +0 -29
  183. package/lib/client/.tsbuildinfo +0 -1
  184. package/lib/client/client-lifecycles-dispatcher.d.ts +0 -12
  185. package/lib/client/client-lifecycles-dispatcher.js +0 -27
  186. package/lib/client/nprogress.css +0 -36
  187. package/lib/commands/buildRemoteBranchUrl.d.ts +0 -7
  188. package/lib/commands/buildRemoteBranchUrl.js +0 -27
  189. package/lib/commands/commandUtils.d.ts +0 -3
  190. package/lib/commands/commandUtils.js +0 -21
  191. package/lib/commands/swizzle.d.ts +0 -9
  192. package/lib/commands/swizzle.js +0 -245
  193. package/lib/constants.d.ts +0 -18
  194. package/lib/constants.js +0 -23
  195. package/lib/server/client-modules/index.js +0 -14
  196. package/lib/server/duplicateRoutes.d.ts +0 -10
  197. package/lib/server/duplicateRoutes.js +0 -38
  198. package/lib/server/html-tags/htmlTags.js +0 -40
  199. package/lib/server/html-tags/index.d.ts +0 -9
  200. package/lib/server/html-tags/index.js +0 -43
  201. package/lib/server/loadSetup.d.ts +0 -9
  202. package/lib/server/loadSetup.js +0 -25
  203. package/lib/server/plugins/applyRouteTrailingSlash.d.ts +0 -8
  204. package/lib/server/plugins/applyRouteTrailingSlash.js +0 -19
  205. package/lib/server/presets/index.d.ts +0 -11
  206. package/lib/server/presets/index.js +0 -48
  207. package/lib/server/themes/alias.d.ts +0 -8
  208. package/lib/server/themes/alias.js +0 -40
  209. package/lib/server/themes/index.d.ts +0 -12
  210. package/lib/server/themes/index.js +0 -47
  211. package/lib/server/versions/__fixtures__/dummy-plugin.js +0 -0
  212. package/lib/server/versions/__fixtures__/package.json +0 -3
  213. package/lib/server/versions/__tests/index.test.js +0 -25
  214. package/lib/server/versions/index.d.ts +0 -10
  215. package/lib/server/versions/index.js +0 -50
  216. package/lib/webpack/react-dev-utils-webpack5/README.md +0 -11
  217. package/lib/webpack/react-dev-utils-webpack5/evalSourceMapMiddleware.js +0 -57
  218. package/lib/webpack/react-dev-utils-webpack5/formatWebpackMessages.js +0 -138
  219. package/lib/webpack/react-dev-utils-webpack5/webpackHotDevClient.js +0 -285
  220. package/lib/webpack/sharedModuleAliases.d.ts +0 -10
  221. package/lib/webpack/sharedModuleAliases.js +0 -18
  222. package/tsconfig.client.json +0 -13
  223. package/tsconfig.json +0 -13
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@docusaurus/core",
3
3
  "description": "Easy to Maintain Open Source Documentation Websites",
4
- "version": "2.0.0-beta.2",
4
+ "version": "2.0.0-beta.22",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -21,107 +21,111 @@
21
21
  "directory": "packages/docusaurus"
22
22
  },
23
23
  "bin": {
24
- "docusaurus": "bin/docusaurus.js"
24
+ "docusaurus": "bin/docusaurus.mjs"
25
25
  },
26
26
  "scripts": {
27
- "build": "tsc && tsc -p tsconfig.client.json && node copyUntypedFiles.js",
28
- "watch": "node copyUntypedFiles.js && concurrently -n \"server,client\" --kill-others \"tsc --watch\" \"tsc -p tsconfig.client.json --watch\""
27
+ "build": "tsc --build && node ../../admin/scripts/copyUntypedFiles.js",
28
+ "watch": "run-p -c copy:watch build:watch",
29
+ "build:watch": "tsc --build --watch",
30
+ "copy:watch": "node ../../admin/scripts/copyUntypedFiles.js --watch"
29
31
  },
30
32
  "bugs": {
31
33
  "url": "https://github.com/facebook/docusaurus/issues"
32
34
  },
33
- "devDependencies": {
34
- "@docusaurus/module-type-aliases": "2.0.0-beta.2",
35
- "@types/detect-port": "^1.3.0",
36
- "@types/nprogress": "^0.2.0",
37
- "tmp-promise": "^3.0.2"
38
- },
39
35
  "dependencies": {
40
- "@babel/core": "^7.12.16",
41
- "@babel/generator": "^7.12.15",
36
+ "@babel/core": "^7.18.6",
37
+ "@babel/generator": "^7.18.7",
42
38
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
43
- "@babel/plugin-transform-runtime": "^7.12.15",
44
- "@babel/preset-env": "^7.12.16",
45
- "@babel/preset-react": "^7.12.13",
46
- "@babel/preset-typescript": "^7.12.16",
47
- "@babel/runtime": "^7.12.5",
48
- "@babel/runtime-corejs3": "^7.12.13",
49
- "@babel/traverse": "^7.12.13",
50
- "@docusaurus/cssnano-preset": "2.0.0-beta.2",
51
- "@docusaurus/react-loadable": "5.5.0",
52
- "@docusaurus/types": "2.0.0-beta.2",
53
- "@docusaurus/utils": "2.0.0-beta.2",
54
- "@docusaurus/utils-common": "2.0.0-beta.2",
55
- "@docusaurus/utils-validation": "2.0.0-beta.2",
56
- "@slorber/static-site-generator-webpack-plugin": "^4.0.0",
57
- "@svgr/webpack": "^5.5.0",
58
- "autoprefixer": "^10.2.5",
59
- "babel-loader": "^8.2.2",
60
- "babel-plugin-dynamic-import-node": "2.3.0",
61
- "boxen": "^5.0.1",
62
- "chalk": "^4.1.1",
63
- "chokidar": "^3.5.1",
64
- "clean-css": "^5.1.2",
39
+ "@babel/plugin-transform-runtime": "^7.18.6",
40
+ "@babel/preset-env": "^7.18.6",
41
+ "@babel/preset-react": "^7.18.6",
42
+ "@babel/preset-typescript": "^7.18.6",
43
+ "@babel/runtime": "^7.18.6",
44
+ "@babel/runtime-corejs3": "^7.18.6",
45
+ "@babel/traverse": "^7.18.6",
46
+ "@docusaurus/cssnano-preset": "2.0.0-beta.22",
47
+ "@docusaurus/logger": "2.0.0-beta.22",
48
+ "@docusaurus/mdx-loader": "2.0.0-beta.22",
49
+ "@docusaurus/react-loadable": "5.5.2",
50
+ "@docusaurus/utils": "2.0.0-beta.22",
51
+ "@docusaurus/utils-common": "2.0.0-beta.22",
52
+ "@docusaurus/utils-validation": "2.0.0-beta.22",
53
+ "@slorber/static-site-generator-webpack-plugin": "^4.0.7",
54
+ "@svgr/webpack": "^6.2.1",
55
+ "autoprefixer": "^10.4.7",
56
+ "babel-loader": "^8.2.5",
57
+ "babel-plugin-dynamic-import-node": "^2.3.3",
58
+ "boxen": "^6.2.1",
59
+ "chalk": "^4.1.2",
60
+ "chokidar": "^3.5.3",
61
+ "clean-css": "^5.3.0",
62
+ "cli-table3": "^0.6.2",
63
+ "combine-promises": "^1.1.0",
65
64
  "commander": "^5.1.0",
66
- "copy-webpack-plugin": "^9.0.0",
67
- "core-js": "^3.9.1",
68
- "css-loader": "^5.1.1",
69
- "css-minimizer-webpack-plugin": "^3.0.1",
70
- "cssnano": "^5.0.4",
71
- "del": "^6.0.0",
65
+ "copy-webpack-plugin": "^11.0.0",
66
+ "core-js": "^3.23.3",
67
+ "css-loader": "^6.7.1",
68
+ "css-minimizer-webpack-plugin": "^4.0.0",
69
+ "cssnano": "^5.1.12",
70
+ "del": "^6.1.1",
72
71
  "detect-port": "^1.3.0",
73
72
  "escape-html": "^1.0.3",
74
- "eta": "^1.12.1",
75
- "express": "^4.17.1",
73
+ "eta": "^1.12.3",
76
74
  "file-loader": "^6.2.0",
77
- "fs-extra": "^10.0.0",
78
- "github-slugger": "^1.3.0",
79
- "globby": "^11.0.2",
80
- "html-minifier-terser": "^5.1.1",
81
- "html-tags": "^3.1.0",
82
- "html-webpack-plugin": "^5.3.2",
75
+ "fs-extra": "^10.1.0",
76
+ "html-minifier-terser": "^6.1.0",
77
+ "html-tags": "^3.2.0",
78
+ "html-webpack-plugin": "^5.5.0",
83
79
  "import-fresh": "^3.3.0",
84
- "is-root": "^2.1.0",
85
80
  "leven": "^3.1.0",
86
- "lodash": "^4.17.20",
87
- "mini-css-extract-plugin": "^1.6.0",
88
- "module-alias": "^2.2.2",
89
- "nprogress": "^0.2.0",
90
- "postcss": "^8.2.15",
91
- "postcss-loader": "^5.3.0",
92
- "prompts": "^2.4.1",
93
- "react-dev-utils": "^11.0.1",
94
- "react-error-overlay": "^6.0.9",
95
- "react-helmet": "^6.1.0",
96
- "react-loadable": "^5.5.0",
81
+ "lodash": "^4.17.21",
82
+ "mini-css-extract-plugin": "^2.6.1",
83
+ "postcss": "^8.4.14",
84
+ "postcss-loader": "^7.0.0",
85
+ "prompts": "^2.4.2",
86
+ "react-dev-utils": "^12.0.1",
87
+ "react-helmet-async": "^1.3.0",
88
+ "react-loadable": "npm:@docusaurus/react-loadable@5.5.2",
97
89
  "react-loadable-ssr-addon-v5-slorber": "^1.0.1",
98
- "react-router": "^5.2.0",
90
+ "react-router": "^5.3.3",
99
91
  "react-router-config": "^5.1.1",
100
- "react-router-dom": "^5.2.0",
101
- "resolve-pathname": "^3.0.0",
102
- "rtl-detect": "^1.0.3",
103
- "semver": "^7.3.4",
92
+ "react-router-dom": "^5.3.3",
93
+ "rtl-detect": "^1.0.4",
94
+ "semver": "^7.3.7",
104
95
  "serve-handler": "^6.1.3",
105
- "shelljs": "^0.8.4",
106
- "std-env": "^2.2.1",
107
- "strip-ansi": "^6.0.0",
108
- "terser-webpack-plugin": "^5.1.3",
109
- "tslib": "^2.2.0",
96
+ "shelljs": "^0.8.5",
97
+ "terser-webpack-plugin": "^5.3.3",
98
+ "tslib": "^2.4.0",
110
99
  "update-notifier": "^5.1.0",
111
100
  "url-loader": "^4.1.1",
112
- "wait-on": "^5.3.0",
113
- "webpack": "^5.40.0",
114
- "webpack-bundle-analyzer": "^4.4.2",
115
- "webpack-dev-server": "^3.11.2",
101
+ "wait-on": "^6.0.1",
102
+ "webpack": "^5.73.0",
103
+ "webpack-bundle-analyzer": "^4.5.0",
104
+ "webpack-dev-server": "^4.9.3",
116
105
  "webpack-merge": "^5.8.0",
117
- "webpackbar": "^5.0.0-3"
106
+ "webpackbar": "^5.0.2"
107
+ },
108
+ "devDependencies": {
109
+ "@docusaurus/module-type-aliases": "2.0.0-beta.22",
110
+ "@docusaurus/types": "2.0.0-beta.22",
111
+ "@types/detect-port": "^1.3.2",
112
+ "@types/react-dom": "^18.0.5",
113
+ "@types/react-router-config": "^5.0.6",
114
+ "@types/rtl-detect": "^1.0.0",
115
+ "@types/serve-handler": "^6.1.1",
116
+ "@types/update-notifier": "^5.1.0",
117
+ "@types/wait-on": "^5.3.1",
118
+ "@types/webpack-bundle-analyzer": "^4.4.1",
119
+ "react-test-renderer": "^17.0.2",
120
+ "tmp-promise": "^3.0.3",
121
+ "tree-node-cli": "^1.5.2"
118
122
  },
119
123
  "peerDependencies": {
120
124
  "react": "^16.8.4 || ^17.0.0",
121
125
  "react-dom": "^16.8.4 || ^17.0.0"
122
126
  },
123
127
  "engines": {
124
- "node": ">=12.13.0"
128
+ "node": ">=16.14"
125
129
  },
126
- "gitHead": "883f07fddffaf1657407c8e202e370cc436e25f7"
130
+ "gitHead": "daf9e462c4eebb7ac26a940932311f987e768f87"
127
131
  }
package/bin/docusaurus.js DELETED
@@ -1,325 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- // TODO remove when fixed: https://github.com/Stuk/eslint-plugin-header/issues/39
4
- /* eslint-disable header/header */
5
- /**
6
- * Copyright (c) Facebook, Inc. and its affiliates.
7
- *
8
- * This source code is licensed under the MIT license found in the
9
- * LICENSE file in the root directory of this source tree.
10
- */
11
-
12
- const chalk = require('chalk');
13
- const fs = require('fs-extra');
14
- const semver = require('semver');
15
- const path = require('path');
16
- const cli = require('commander');
17
- const updateNotifier = require('update-notifier');
18
- const boxen = require('boxen');
19
- const {
20
- build,
21
- swizzle,
22
- deploy,
23
- start,
24
- externalCommand,
25
- serve,
26
- clear,
27
- writeTranslations,
28
- writeHeadingIds,
29
- } = require('../lib');
30
- const {
31
- name,
32
- version,
33
- engines: {node: requiredVersion},
34
- } = require('../package.json');
35
-
36
- // notify user if @docusaurus packages is outdated
37
- const notifier = updateNotifier({
38
- pkg: {
39
- name,
40
- version,
41
- },
42
- });
43
-
44
- // allow the user to be notified for updates on the first run
45
- if (notifier.lastUpdateCheck === Date.now()) {
46
- notifier.lastUpdateCheck = 0;
47
- }
48
-
49
- if (notifier.update && semver.gt(this.update.latest, this.update.current)) {
50
- // eslint-disable-next-line import/no-dynamic-require, global-require
51
- const sitePkg = require(path.resolve(process.cwd(), 'package.json'));
52
- const siteDocusaurusPackagesForUpdate = Object.keys(sitePkg.dependencies)
53
- .filter((p) => p.startsWith('@docusaurus'))
54
- .map((p) => p.concat('@latest'))
55
- .join(' ');
56
- const isYarnUsed = fs.existsSync(path.resolve(process.cwd(), 'yarn.lock'));
57
- const upgradeCommand = isYarnUsed
58
- ? `yarn upgrade ${siteDocusaurusPackagesForUpdate}`
59
- : `npm i ${siteDocusaurusPackagesForUpdate}`;
60
-
61
- const boxenOptions = {
62
- padding: 1,
63
- margin: 1,
64
- align: 'center',
65
- borderColor: 'yellow',
66
- borderStyle: 'round',
67
- };
68
-
69
- const docusaurusUpdateMessage = boxen(
70
- `Update available ${chalk.dim(`${notifier.update.current}`)}${chalk.reset(
71
- ' → ',
72
- )}${chalk.green(
73
- `${notifier.update.latest}`,
74
- )}\n\nTo upgrade Docusaurus packages with the latest version, run the following command:\n${chalk.cyan(
75
- `${upgradeCommand}`,
76
- )}`,
77
- boxenOptions,
78
- );
79
-
80
- console.log(docusaurusUpdateMessage);
81
- }
82
-
83
- // notify user if node version needs to be updated
84
- if (!semver.satisfies(process.version, requiredVersion)) {
85
- console.log(
86
- chalk.red(`\nMinimum Node.js version not met :(`) +
87
- chalk.yellow(
88
- `\n\nYou are using Node.js ${process.version}. We require Node.js ${requiredVersion} or up!\n`,
89
- ),
90
- );
91
- process.exit(1);
92
- }
93
-
94
- cli.version(require('../package.json').version).usage('<command> [options]');
95
-
96
- cli
97
- .command('build [siteDir]')
98
- .description('Build website.')
99
- .option(
100
- '--bundle-analyzer',
101
- 'visualize size of webpack output files with an interactive zoomable treemap (default: false)',
102
- )
103
- .option(
104
- '--out-dir <dir>',
105
- 'the full path for the new output directory, relative to the current workspace (default: build)',
106
- )
107
- .option(
108
- '--config <config>',
109
- 'path to docusaurus config file (default: `[siteDir]/docusaurus.config.js`)',
110
- )
111
- .option(
112
- '-l, --locale <locale>',
113
- 'build the site in a specified locale. Build all known locales otherwise',
114
- )
115
- .option(
116
- '--no-minify',
117
- 'build website without minimizing JS bundles (default: false)',
118
- )
119
- .action((siteDir = '.', {bundleAnalyzer, config, outDir, locale, minify}) => {
120
- build(path.resolve(siteDir), {
121
- bundleAnalyzer,
122
- outDir,
123
- config,
124
- locale,
125
- minify,
126
- });
127
- });
128
-
129
- cli
130
- .command('swizzle [themeName] [componentName] [siteDir]')
131
- .description('Copy the theme files into website folder for customization.')
132
- .option(
133
- '--typescript',
134
- 'copy TypeScript theme files when possible (default: false)',
135
- )
136
- .option('--danger', 'enable swizzle for internal component of themes')
137
- .action((themeName, componentName, siteDir = '.', {typescript, danger}) => {
138
- swizzle(
139
- path.resolve(siteDir),
140
- themeName,
141
- componentName,
142
- typescript,
143
- danger,
144
- );
145
- });
146
-
147
- cli
148
- .command('deploy [siteDir]')
149
- .description('Deploy website to GitHub pages.')
150
- .option(
151
- '-l, --locale <locale>',
152
- 'deploy the site in a specified locale. Deploy all known locales otherwise',
153
- )
154
- .option(
155
- '--out-dir <dir>',
156
- 'the full path for the new output directory, relative to the current workspace (default: build)',
157
- )
158
- .option(
159
- '--config <config>',
160
- 'path to Docusaurus config file (default: `[siteDir]/docusaurus.config.js`)',
161
- )
162
- .option(
163
- '--skip-build',
164
- 'skip building website before deploy it (default: false)',
165
- )
166
- .action((siteDir = '.', {outDir, skipBuild, config}) => {
167
- deploy(path.resolve(siteDir), {
168
- outDir,
169
- config,
170
- skipBuild,
171
- });
172
- });
173
-
174
- cli
175
- .command('start [siteDir]')
176
- .description('Start the development server.')
177
- .option('-p, --port <port>', 'use specified port (default: 3000)')
178
- .option('-h, --host <host>', 'use specified host (default: localhost)')
179
- .option('-l, --locale <locale>', 'use specified site locale')
180
- .option(
181
- '--hot-only',
182
- 'do not fallback to page refresh if hot reload fails (default: false)',
183
- )
184
- .option(
185
- '--config <config>',
186
- 'path to Docusaurus config file (default: `[siteDir]/docusaurus.config.js`)',
187
- )
188
- .option('--no-open', 'do not open page in the browser (default: false)')
189
- .option(
190
- '--poll [interval]',
191
- 'use polling rather than watching for reload (default: false). Can specify a poll interval in milliseconds',
192
- )
193
- .action(
194
- (siteDir = '.', {port, host, locale, config, hotOnly, open, poll}) => {
195
- start(path.resolve(siteDir), {
196
- port,
197
- host,
198
- locale,
199
- config,
200
- hotOnly,
201
- open,
202
- poll,
203
- });
204
- },
205
- );
206
-
207
- cli
208
- .command('serve [siteDir]')
209
- .description('Serve website locally.')
210
- .option(
211
- '--dir <dir>',
212
- 'the full path for the new output directory, relative to the current workspace (default: build)',
213
- )
214
- .option(
215
- '--config <config>',
216
- 'path to Docusaurus config file (default: `[siteDir]/docusaurus.config.js`)',
217
- )
218
- .option('-p, --port <port>', 'use specified port (default: 3000)')
219
- .option('--build', 'build website before serving (default: false)')
220
- .option('-h, --host <host>', 'use specified host (default: localhost)')
221
- .action(
222
- (
223
- siteDir = '.',
224
- {
225
- dir = 'build',
226
- port = 3000,
227
- host = 'localhost',
228
- build: buildSite = false,
229
- config,
230
- },
231
- ) => {
232
- serve(path.resolve(siteDir), {
233
- dir,
234
- port,
235
- build: buildSite,
236
- config,
237
- host,
238
- });
239
- },
240
- );
241
-
242
- cli
243
- .command('clear [siteDir]')
244
- .description('Remove build artifacts.')
245
- .action((siteDir = '.') => {
246
- clear(path.resolve(siteDir));
247
- });
248
-
249
- cli
250
- .command('write-translations [siteDir]')
251
- .description('Extract required translations of your site.')
252
- .option(
253
- '-l, --locale <locale>',
254
- 'the locale folder to write the translations\n"--locale fr" will write translations in ./i18n/fr folder)',
255
- )
256
- .option(
257
- '--override',
258
- 'by default, we only append missing translation messages to existing translation files. This option allows to override existing translation messages. Make sure to commit or backup your existing translations, as they may be overridden',
259
- )
260
- .option(
261
- '--config <config>',
262
- 'path to Docusaurus config file (default:`[siteDir]/docusaurus.config.js`)',
263
- )
264
- .option(
265
- '--messagePrefix <messagePrefix>',
266
- 'allows to init new written messages with a given prefix. This might help you to highlight untranslated message to make them stand out in the UI',
267
- )
268
- .action(
269
- (
270
- siteDir = '.',
271
- {locale = undefined, override = false, messagePrefix = '', config},
272
- ) => {
273
- writeTranslations(path.resolve(siteDir), {
274
- locale,
275
- override,
276
- config,
277
- messagePrefix,
278
- });
279
- },
280
- );
281
-
282
- cli
283
- .command('write-heading-ids [contentDir]')
284
- .description('Generate heading ids in Markdown content.')
285
- .action((siteDir = '.') => {
286
- writeHeadingIds(siteDir);
287
- });
288
-
289
- cli.arguments('<command>').action((cmd) => {
290
- cli.outputHelp();
291
- console.log(` ${chalk.red(`\n Unknown command ${chalk.yellow(cmd)}.`)}.`);
292
- console.log();
293
- });
294
-
295
- function isInternalCommand(command) {
296
- return [
297
- 'start',
298
- 'build',
299
- 'swizzle',
300
- 'deploy',
301
- 'serve',
302
- 'clear',
303
- 'write-translations',
304
- 'write-heading-ids',
305
- ].includes(command);
306
- }
307
-
308
- async function run() {
309
- if (!isInternalCommand(process.argv.slice(2)[0])) {
310
- await externalCommand(cli, path.resolve('.'));
311
- }
312
-
313
- cli.parse(process.argv);
314
-
315
- if (!process.argv.slice(2).length) {
316
- cli.outputHelp();
317
- }
318
- }
319
-
320
- run();
321
-
322
- process.on('unhandledRejection', (err) => {
323
- console.error(chalk.red(err.stack));
324
- process.exit(1);
325
- });