@docusaurus/core 2.0.0-beta.0f144213d → 2.0.0-beta.11

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 (111) hide show
  1. package/bin/beforeCli.js +125 -0
  2. package/bin/docusaurus.js +36 -105
  3. package/lib/.tsbuildinfo +1 -1
  4. package/lib/babel/preset.d.ts +6 -0
  5. package/lib/babel/preset.js +3 -3
  6. package/lib/choosePort.js +12 -13
  7. package/lib/client/.eslintrc.js +0 -1
  8. package/lib/client/.tsbuildinfo +1 -1
  9. package/lib/client/App.js +12 -22
  10. package/lib/client/LinksCollector.d.ts +2 -2
  11. package/lib/client/LinksCollector.js +4 -8
  12. package/lib/client/PendingNavigation.d.ts +24 -1
  13. package/lib/client/PendingNavigation.js +1 -1
  14. package/lib/client/baseUrlIssueBanner/BaseUrlIssueBanner.d.ts +5 -0
  15. package/lib/client/client-lifecycles-dispatcher.d.ts +2 -2
  16. package/lib/client/client-lifecycles-dispatcher.js +0 -2
  17. package/lib/client/docusaurus.d.ts +6 -0
  18. package/lib/client/docusaurus.js +11 -19
  19. package/lib/client/exports/BrowserOnly.js +5 -3
  20. package/lib/client/exports/ErrorBoundary.d.ts +18 -0
  21. package/lib/client/exports/ErrorBoundary.js +35 -0
  22. package/lib/client/exports/Interpolate.js +12 -15
  23. package/lib/client/exports/Link.js +9 -9
  24. package/lib/client/exports/Translate.d.ts +2 -2
  25. package/lib/client/exports/Translate.js +13 -9
  26. package/lib/client/exports/browserContext.d.ts +11 -0
  27. package/lib/client/exports/browserContext.js +21 -0
  28. package/lib/client/exports/constants.js +1 -11
  29. package/lib/client/exports/{context.d.ts → docusaurusContext.d.ts} +5 -3
  30. package/lib/client/exports/docusaurusContext.js +25 -0
  31. package/lib/client/exports/useBaseUrl.js +2 -4
  32. package/lib/client/exports/useDocusaurusContext.js +2 -7
  33. package/lib/client/exports/useGlobalData.js +1 -5
  34. package/lib/client/exports/{context.js → useIsBrowser.d.ts} +1 -2
  35. package/lib/{webpack/sharedModuleAliases.d.ts → client/exports/useIsBrowser.js} +5 -4
  36. package/lib/client/flat.d.ts +2 -1
  37. package/lib/client/flat.js +7 -9
  38. package/lib/client/normalizeLocation.d.ts +1 -3
  39. package/lib/client/prefetch.js +0 -1
  40. package/lib/client/serverEntry.js +15 -31
  41. package/lib/client/theme-fallback/Error/index.js +47 -0
  42. package/lib/client/theme-fallback/Layout/index.js +1 -1
  43. package/lib/client/theme-fallback/Loading/index.js +2 -2
  44. package/lib/client/theme-fallback/Root/index.js +1 -3
  45. package/lib/commands/build.js +34 -37
  46. package/lib/commands/clear.d.ts +6 -0
  47. package/lib/commands/clear.js +9 -9
  48. package/lib/commands/commandUtils.d.ts +6 -0
  49. package/lib/commands/commandUtils.js +7 -7
  50. package/lib/commands/deploy.d.ts +3 -0
  51. package/lib/commands/deploy.js +90 -53
  52. package/lib/commands/external.js +4 -4
  53. package/lib/commands/serve.js +13 -13
  54. package/lib/commands/start.js +82 -72
  55. package/lib/commands/swizzle.js +34 -34
  56. package/lib/commands/writeHeadingIds.d.ts +9 -6
  57. package/lib/commands/writeHeadingIds.js +32 -32
  58. package/lib/commands/writeTranslations.js +31 -11
  59. package/lib/server/brokenLinks.js +13 -17
  60. package/lib/server/client-modules/index.js +1 -3
  61. package/lib/server/config.js +4 -4
  62. package/lib/server/configValidation.d.ts +1 -1
  63. package/lib/server/configValidation.js +11 -6
  64. package/lib/server/duplicateRoutes.js +8 -2
  65. package/lib/server/html-tags/htmlTags.js +5 -6
  66. package/lib/server/html-tags/index.js +2 -2
  67. package/lib/server/i18n.js +16 -13
  68. package/lib/server/index.js +128 -58
  69. package/lib/server/loadSetup.js +3 -3
  70. package/lib/server/moduleShorthand.d.ts +9 -0
  71. package/lib/server/moduleShorthand.js +42 -0
  72. package/lib/server/plugins/applyRouteTrailingSlash.js +1 -1
  73. package/lib/server/plugins/index.d.ts +1 -1
  74. package/lib/server/plugins/index.js +24 -20
  75. package/lib/server/plugins/init.js +9 -12
  76. package/lib/server/plugins/pluginIds.js +6 -4
  77. package/lib/server/presets/index.js +12 -12
  78. package/lib/server/routes.js +41 -23
  79. package/lib/server/themes/alias.d.ts +1 -0
  80. package/lib/server/themes/alias.js +21 -12
  81. package/lib/server/themes/index.d.ts +1 -1
  82. package/lib/server/themes/index.js +22 -23
  83. package/lib/server/translations/translations.d.ts +6 -0
  84. package/lib/server/translations/translations.js +15 -17
  85. package/lib/server/translations/translationsExtractor.d.ts +7 -1
  86. package/lib/server/translations/translationsExtractor.js +65 -56
  87. package/lib/server/utils.d.ts +8 -2
  88. package/lib/server/utils.js +8 -10
  89. package/lib/server/versions/__fixtures__/dummy-plugin.d.ts +0 -0
  90. package/lib/server/versions/__tests/index.test.js +5 -5
  91. package/lib/server/versions/index.js +6 -6
  92. package/lib/webpack/base.js +13 -15
  93. package/lib/webpack/client.js +8 -17
  94. package/lib/webpack/plugins/CleanWebpackPlugin.js +4 -11
  95. package/lib/webpack/plugins/LogPlugin.js +5 -6
  96. package/lib/webpack/plugins/WaitPlugin.js +4 -4
  97. package/lib/webpack/server.js +9 -9
  98. package/lib/webpack/utils.d.ts +0 -22
  99. package/lib/webpack/utils.js +26 -125
  100. package/package.json +55 -50
  101. package/tsconfig.client.json +1 -2
  102. package/tsconfig.json +5 -4
  103. package/lib/commands/buildRemoteBranchUrl.d.ts +0 -7
  104. package/lib/commands/buildRemoteBranchUrl.js +0 -27
  105. package/lib/constants.d.ts +0 -18
  106. package/lib/constants.js +0 -23
  107. package/lib/webpack/react-dev-utils-webpack5/README.md +0 -11
  108. package/lib/webpack/react-dev-utils-webpack5/evalSourceMapMiddleware.js +0 -57
  109. package/lib/webpack/react-dev-utils-webpack5/formatWebpackMessages.js +0 -138
  110. package/lib/webpack/react-dev-utils-webpack5/webpackHotDevClient.js +0 -285
  111. package/lib/webpack/sharedModuleAliases.js +0 -18
@@ -6,18 +6,18 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.getMinimizer = exports.getHttpsConfig = exports.getFileLoaderUtils = exports.compile = exports.applyConfigurePostCss = exports.applyConfigureWebpack = exports.getCustomizableJSLoader = exports.getBabelOptions = exports.getCustomBabelConfigFilePath = exports.getStyleLoaders = void 0;
9
+ exports.getMinimizer = exports.getHttpsConfig = exports.compile = exports.applyConfigurePostCss = exports.applyConfigureWebpack = exports.getCustomizableJSLoader = exports.getBabelOptions = exports.getCustomBabelConfigFilePath = exports.getStyleLoaders = void 0;
10
10
  const tslib_1 = require("tslib");
11
- const mini_css_extract_plugin_1 = tslib_1.__importDefault(require("mini-css-extract-plugin"));
11
+ const mini_css_extract_plugin_1 = (0, tslib_1.__importDefault)(require("mini-css-extract-plugin"));
12
12
  const webpack_merge_1 = require("webpack-merge");
13
- const webpack_1 = tslib_1.__importDefault(require("webpack"));
14
- const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
15
- const terser_webpack_plugin_1 = tslib_1.__importDefault(require("terser-webpack-plugin"));
16
- const css_minimizer_webpack_plugin_1 = tslib_1.__importDefault(require("css-minimizer-webpack-plugin"));
17
- const path_1 = tslib_1.__importDefault(require("path"));
18
- const crypto_1 = tslib_1.__importDefault(require("crypto"));
19
- const chalk_1 = tslib_1.__importDefault(require("chalk"));
20
- const constants_1 = require("../constants");
13
+ const webpack_1 = (0, tslib_1.__importDefault)(require("webpack"));
14
+ const fs_extra_1 = (0, tslib_1.__importDefault)(require("fs-extra"));
15
+ const terser_webpack_plugin_1 = (0, tslib_1.__importDefault)(require("terser-webpack-plugin"));
16
+ const css_minimizer_webpack_plugin_1 = (0, tslib_1.__importDefault)(require("css-minimizer-webpack-plugin"));
17
+ const path_1 = (0, tslib_1.__importDefault)(require("path"));
18
+ const crypto_1 = (0, tslib_1.__importDefault)(require("crypto"));
19
+ const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
20
+ const utils_1 = require("@docusaurus/utils");
21
21
  const lodash_1 = require("lodash");
22
22
  // Utility method to get style loaders
23
23
  function getStyleLoaders(isServer, cssOptions = {}) {
@@ -66,7 +66,7 @@ function getStyleLoaders(isServer, cssOptions = {}) {
66
66
  // https://github.com/facebook/create-react-app/issues/2677
67
67
  ident: 'postcss',
68
68
  plugins: [
69
- // eslint-disable-next-line @typescript-eslint/no-var-requires, global-require
69
+ // eslint-disable-next-line global-require
70
70
  require('autoprefixer'),
71
71
  ],
72
72
  },
@@ -76,7 +76,7 @@ function getStyleLoaders(isServer, cssOptions = {}) {
76
76
  }
77
77
  exports.getStyleLoaders = getStyleLoaders;
78
78
  function getCustomBabelConfigFilePath(siteDir) {
79
- const customBabelConfigurationPath = path_1.default.join(siteDir, constants_1.BABEL_CONFIG_FILE_NAME);
79
+ const customBabelConfigurationPath = path_1.default.join(siteDir, utils_1.BABEL_CONFIG_FILE_NAME);
80
80
  return fs_extra_1.default.existsSync(customBabelConfigurationPath)
81
81
  ? customBabelConfigurationPath
82
82
  : undefined;
@@ -112,7 +112,7 @@ const getCustomizableJSLoader = (jsLoader = 'babel') => ({ isServer, babelOption
112
112
  : jsLoader(isServer);
113
113
  exports.getCustomizableJSLoader = getCustomizableJSLoader;
114
114
  // TODO remove this before end of 2021?
115
- const warnBabelLoaderOnce = lodash_1.memoize(function () {
115
+ const warnBabelLoaderOnce = (0, lodash_1.memoize)(() => {
116
116
  console.warn(chalk_1.default.yellow('Docusaurus plans to support multiple JS loader strategies (Babel, esbuild...): "getBabelLoader(isServer)" is now deprecated in favor of "getJSLoader({isServer})".'));
117
117
  });
118
118
  const getBabelLoaderDeprecated = function getBabelLoaderDeprecated(isServer, babelOptions) {
@@ -120,7 +120,7 @@ const getBabelLoaderDeprecated = function getBabelLoaderDeprecated(isServer, bab
120
120
  return getDefaultBabelLoader({ isServer, babelOptions });
121
121
  };
122
122
  // TODO remove this before end of 2021 ?
123
- const warnCacheLoaderOnce = lodash_1.memoize(function () {
123
+ const warnCacheLoaderOnce = (0, lodash_1.memoize)(() => {
124
124
  console.warn(chalk_1.default.yellow('Docusaurus uses Webpack 5 and getCacheLoader() usage is now deprecated.'));
125
125
  });
126
126
  function getCacheLoaderDeprecated() {
@@ -140,18 +140,17 @@ function applyConfigureWebpack(configureWebpack, config, isServer, jsLoader, con
140
140
  // Export some utility functions
141
141
  const utils = {
142
142
  getStyleLoaders,
143
- getJSLoader: exports.getCustomizableJSLoader(jsLoader),
143
+ getJSLoader: (0, exports.getCustomizableJSLoader)(jsLoader),
144
144
  getBabelLoader: getBabelLoaderDeprecated,
145
145
  getCacheLoader: getCacheLoaderDeprecated,
146
146
  };
147
147
  if (typeof configureWebpack === 'function') {
148
148
  const { mergeStrategy, ...res } = configureWebpack(config, isServer, utils, content);
149
149
  if (res && typeof res === 'object') {
150
- // @ts-expect-error: annoying error due to enums: https://github.com/survivejs/webpack-merge/issues/179
151
150
  const customizeRules = mergeStrategy !== null && mergeStrategy !== void 0 ? mergeStrategy : {};
152
- return webpack_merge_1.mergeWithCustomize({
153
- customizeArray: webpack_merge_1.customizeArray(customizeRules),
154
- customizeObject: webpack_merge_1.customizeObject(customizeRules),
151
+ return (0, webpack_merge_1.mergeWithCustomize)({
152
+ customizeArray: (0, webpack_merge_1.customizeArray)(customizeRules),
153
+ customizeObject: (0, webpack_merge_1.customizeObject)(customizeRules),
155
154
  })(config, res);
156
155
  }
157
156
  }
@@ -176,16 +175,16 @@ function applyConfigurePostCss(configurePostCss, config) {
176
175
  else if (Array.isArray(entry.use)) {
177
176
  entry.use
178
177
  .filter((u) => typeof u === 'object')
179
- .forEach(overridePostCssOptions);
178
+ .forEach((rule) => overridePostCssOptions(rule));
180
179
  }
181
180
  }
182
- (_b = (_a = config.module) === null || _a === void 0 ? void 0 : _a.rules) === null || _b === void 0 ? void 0 : _b.forEach(overridePostCssOptions);
181
+ (_b = (_a = config.module) === null || _a === void 0 ? void 0 : _a.rules) === null || _b === void 0 ? void 0 : _b.forEach((rule) => overridePostCssOptions(rule));
183
182
  return config;
184
183
  }
185
184
  exports.applyConfigurePostCss = applyConfigurePostCss;
186
185
  function compile(config) {
187
186
  return new Promise((resolve, reject) => {
188
- const compiler = webpack_1.default(config);
187
+ const compiler = (0, webpack_1.default)(config);
189
188
  compiler.run((err, stats) => {
190
189
  var _a;
191
190
  if (err) {
@@ -222,110 +221,9 @@ function compile(config) {
222
221
  });
223
222
  }
224
223
  exports.compile = compile;
225
- // Inspired by https://github.com/gatsbyjs/gatsby/blob/8e6e021014da310b9cc7d02e58c9b3efe938c665/packages/gatsby/src/utils/webpack-utils.ts#L447
226
- function getFileLoaderUtils() {
227
- // files/images < 10kb will be inlined as base64 strings directly in the html
228
- const urlLoaderLimit = 10000;
229
- // defines the path/pattern of the assets handled by webpack
230
- const fileLoaderFileName = (folder) => `${constants_1.OUTPUT_STATIC_ASSETS_DIR_NAME}/${folder}/[name]-[hash].[ext]`;
231
- const loaders = {
232
- file: (options) => {
233
- return {
234
- loader: require.resolve(`file-loader`),
235
- options: {
236
- name: fileLoaderFileName(options.folder),
237
- },
238
- };
239
- },
240
- url: (options) => {
241
- return {
242
- loader: require.resolve(`url-loader`),
243
- options: {
244
- limit: urlLoaderLimit,
245
- name: fileLoaderFileName(options.folder),
246
- fallback: require.resolve(`file-loader`),
247
- },
248
- };
249
- },
250
- // TODO find a better solution to avoid conflicts with the ideal-image plugin
251
- // TODO this may require a little breaking change for ideal-image users?
252
- // Maybe with the ideal image plugin, all md images should be "ideal"?
253
- // This is used to force url-loader+file-loader on markdown images
254
- // https://webpack.js.org/concepts/loaders/#inline
255
- inlineMarkdownImageFileLoader: `!url-loader?limit=${urlLoaderLimit}&name=${fileLoaderFileName('images')}&fallback=file-loader!`,
256
- inlineMarkdownLinkFileLoader: `!file-loader?name=${fileLoaderFileName('files')}!`,
257
- };
258
- const rules = {
259
- /**
260
- * Loads image assets, inlines images via a data URI if they are below
261
- * the size threshold
262
- */
263
- images: () => {
264
- return {
265
- use: [loaders.url({ folder: 'images' })],
266
- test: /\.(ico|jpg|jpeg|png|gif|webp)(\?.*)?$/,
267
- };
268
- },
269
- fonts: () => {
270
- return {
271
- use: [loaders.url({ folder: 'fonts' })],
272
- test: /\.(woff|woff2|eot|ttf|otf)$/,
273
- };
274
- },
275
- /**
276
- * Loads audio and video and inlines them via a data URI if they are below
277
- * the size threshold
278
- */
279
- media: () => {
280
- return {
281
- use: [loaders.url({ folder: 'medias' })],
282
- test: /\.(mp4|webm|ogv|wav|mp3|m4a|aac|oga|flac)$/,
283
- };
284
- },
285
- svg: () => {
286
- return {
287
- test: /\.svg?$/,
288
- oneOf: [
289
- {
290
- use: [
291
- {
292
- loader: '@svgr/webpack',
293
- options: {
294
- prettier: false,
295
- svgo: true,
296
- svgoConfig: {
297
- plugins: [{ removeViewBox: false }],
298
- },
299
- titleProp: true,
300
- ref: ![path_1.default],
301
- },
302
- },
303
- ],
304
- // We don't want to use SVGR loader for non-React source code
305
- // ie we don't want to use SVGR for CSS files...
306
- issuer: {
307
- and: [/\.(ts|tsx|js|jsx|md|mdx)$/],
308
- },
309
- },
310
- {
311
- use: [loaders.url({ folder: 'images' })],
312
- },
313
- ],
314
- };
315
- },
316
- otherAssets: () => {
317
- return {
318
- use: [loaders.file({ folder: 'files' })],
319
- test: /\.(pdf|doc|docx|xls|xlsx|zip|rar)$/,
320
- };
321
- },
322
- };
323
- return { loaders, rules };
324
- }
325
- exports.getFileLoaderUtils = getFileLoaderUtils;
326
224
  // Ensure the certificate and key provided are valid and if not
327
225
  // throw an easy to debug error
328
- function validateKeyAndCerts({ cert, key, keyFile, crtFile }) {
226
+ function validateKeyAndCerts({ cert, key, keyFile, crtFile, }) {
329
227
  let encrypted;
330
228
  try {
331
229
  // publicEncrypt will throw an error with an invalid cert
@@ -391,10 +289,11 @@ function getMinimizer(useSimpleCssMinifier = false) {
391
289
  // into invalid ecma 5 code. This is why the 'compress' and 'output'
392
290
  // sections only apply transformations that are ecma 5 safe
393
291
  // https://github.com/facebook/create-react-app/pull/4234
394
- ecma: 8,
292
+ ecma: 2020,
395
293
  },
396
294
  compress: {
397
295
  ecma: 5,
296
+ // @ts-expect-error: API change in new version?
398
297
  warnings: false,
399
298
  },
400
299
  mangle: {
@@ -425,10 +324,12 @@ function getMinimizer(useSimpleCssMinifier = false) {
425
324
  },
426
325
  // CleanCss options
427
326
  {
327
+ // @ts-expect-error: API change in new version?
428
328
  inline: false,
429
329
  level: {
430
330
  1: {
431
331
  all: false,
332
+ removeWhitespace: true,
432
333
  },
433
334
  2: {
434
335
  all: true,
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.0f144213d",
4
+ "version": "2.0.0-beta.11",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -30,98 +30,103 @@
30
30
  "bugs": {
31
31
  "url": "https://github.com/facebook/docusaurus/issues"
32
32
  },
33
- "devDependencies": {
34
- "@docusaurus/module-type-aliases": "2.0.0-beta.0f144213d",
35
- "@types/detect-port": "^1.3.0",
36
- "@types/nprogress": "^0.2.0",
37
- "tmp-promise": "^3.0.2"
38
- },
39
33
  "dependencies": {
40
- "@babel/core": "^7.12.16",
41
- "@babel/generator": "^7.12.15",
34
+ "@babel/core": "^7.16.0",
35
+ "@babel/generator": "^7.16.0",
42
36
  "@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.0f144213d",
51
- "@docusaurus/react-loadable": "5.5.0",
52
- "@docusaurus/types": "2.0.0-beta.0f144213d",
53
- "@docusaurus/utils": "2.0.0-beta.0f144213d",
54
- "@docusaurus/utils-common": "2.0.0-beta.0f144213d",
55
- "@docusaurus/utils-validation": "2.0.0-beta.0f144213d",
37
+ "@babel/plugin-transform-runtime": "^7.16.0",
38
+ "@babel/preset-env": "^7.16.4",
39
+ "@babel/preset-react": "^7.16.0",
40
+ "@babel/preset-typescript": "^7.16.0",
41
+ "@babel/runtime": "^7.16.3",
42
+ "@babel/runtime-corejs3": "^7.16.3",
43
+ "@babel/traverse": "^7.16.3",
44
+ "@docusaurus/cssnano-preset": "2.0.0-beta.11",
45
+ "@docusaurus/mdx-loader": "2.0.0-beta.11",
46
+ "@docusaurus/react-loadable": "5.5.2",
47
+ "@docusaurus/utils": "2.0.0-beta.11",
48
+ "@docusaurus/utils-common": "2.0.0-beta.11",
49
+ "@docusaurus/utils-validation": "2.0.0-beta.11",
56
50
  "@slorber/static-site-generator-webpack-plugin": "^4.0.0",
57
- "@svgr/webpack": "^5.5.0",
58
- "autoprefixer": "^10.2.5",
51
+ "@svgr/webpack": "^6.0.0",
52
+ "autoprefixer": "^10.3.5",
59
53
  "babel-loader": "^8.2.2",
60
54
  "babel-plugin-dynamic-import-node": "2.3.0",
61
55
  "boxen": "^5.0.1",
62
- "chalk": "^4.1.1",
63
- "chokidar": "^3.5.1",
64
- "clean-css": "^5.1.2",
56
+ "chalk": "^4.1.2",
57
+ "chokidar": "^3.5.2",
58
+ "clean-css": "^5.1.5",
65
59
  "commander": "^5.1.0",
66
- "copy-webpack-plugin": "^9.0.0",
67
- "core-js": "^3.9.1",
60
+ "copy-webpack-plugin": "^9.0.1",
61
+ "core-js": "^3.18.0",
68
62
  "css-loader": "^5.1.1",
69
- "css-minimizer-webpack-plugin": "^3.0.1",
70
- "cssnano": "^5.0.4",
63
+ "css-minimizer-webpack-plugin": "^3.0.2",
64
+ "cssnano": "^5.0.8",
71
65
  "del": "^6.0.0",
72
66
  "detect-port": "^1.3.0",
73
67
  "escape-html": "^1.0.3",
74
- "eta": "^1.12.1",
75
- "express": "^4.17.1",
68
+ "eta": "^1.12.3",
76
69
  "file-loader": "^6.2.0",
77
70
  "fs-extra": "^10.0.0",
78
- "github-slugger": "^1.3.0",
79
71
  "globby": "^11.0.2",
80
- "html-minifier-terser": "^5.1.1",
72
+ "html-minifier-terser": "^6.0.2",
81
73
  "html-tags": "^3.1.0",
82
- "html-webpack-plugin": "^5.3.2",
74
+ "html-webpack-plugin": "^5.4.0",
83
75
  "import-fresh": "^3.3.0",
84
76
  "is-root": "^2.1.0",
85
77
  "leven": "^3.1.0",
86
78
  "lodash": "^4.17.20",
87
79
  "mini-css-extract-plugin": "^1.6.0",
88
- "module-alias": "^2.2.2",
89
80
  "nprogress": "^0.2.0",
90
- "postcss": "^8.2.15",
91
- "postcss-loader": "^5.3.0",
81
+ "postcss": "^8.3.7",
82
+ "postcss-loader": "^6.1.1",
92
83
  "prompts": "^2.4.1",
93
- "react-dev-utils": "^11.0.1",
84
+ "react-dev-utils": "12.0.0-next.47",
94
85
  "react-error-overlay": "^6.0.9",
95
86
  "react-helmet": "^6.1.0",
96
- "react-loadable": "^5.5.0",
87
+ "react-loadable": "npm:@docusaurus/react-loadable@5.5.2",
97
88
  "react-loadable-ssr-addon-v5-slorber": "^1.0.1",
98
89
  "react-router": "^5.2.0",
99
90
  "react-router-config": "^5.1.1",
100
91
  "react-router-dom": "^5.2.0",
92
+ "remark-admonitions": "^1.2.1",
101
93
  "resolve-pathname": "^3.0.0",
102
- "rtl-detect": "^1.0.3",
94
+ "rtl-detect": "^1.0.4",
103
95
  "semver": "^7.3.4",
104
96
  "serve-handler": "^6.1.3",
105
97
  "shelljs": "^0.8.4",
106
- "std-env": "^2.2.1",
107
98
  "strip-ansi": "^6.0.0",
108
- "terser-webpack-plugin": "^5.1.3",
109
- "tslib": "^2.2.0",
99
+ "terser-webpack-plugin": "^5.2.4",
100
+ "tslib": "^2.3.1",
110
101
  "update-notifier": "^5.1.0",
111
102
  "url-loader": "^4.1.1",
112
- "wait-on": "^5.3.0",
113
- "webpack": "^5.40.0",
103
+ "wait-on": "^6.0.0",
104
+ "webpack": "^5.61.0",
114
105
  "webpack-bundle-analyzer": "^4.4.2",
115
- "webpack-dev-server": "^3.11.2",
106
+ "webpack-dev-server": "^4.5.0",
116
107
  "webpack-merge": "^5.8.0",
117
108
  "webpackbar": "^5.0.0-3"
118
109
  },
110
+ "devDependencies": {
111
+ "@docusaurus/module-type-aliases": "2.0.0-beta.11",
112
+ "@docusaurus/types": "2.0.0-beta.11",
113
+ "@types/copy-webpack-plugin": "^8.0.1",
114
+ "@types/css-minimizer-webpack-plugin": "^3.0.2",
115
+ "@types/detect-port": "^1.3.0",
116
+ "@types/mini-css-extract-plugin": "^1.4.3",
117
+ "@types/nprogress": "^0.2.0",
118
+ "@types/react-dom": "^17.0.9",
119
+ "@types/rtl-detect": "^1.0.0",
120
+ "@types/serve-handler": "^6.1.1",
121
+ "@types/webpack-bundle-analyzer": "^4.4.1",
122
+ "tmp-promise": "^3.0.2"
123
+ },
119
124
  "peerDependencies": {
120
125
  "react": "^16.8.4 || ^17.0.0",
121
126
  "react-dom": "^16.8.4 || ^17.0.0"
122
127
  },
123
128
  "engines": {
124
- "node": ">=12.13.0"
129
+ "node": ">=14"
125
130
  },
126
- "gitHead": "c225ed2569ce0021d8edf8c9137929fde36122fb"
131
+ "gitHead": "1cb6cdfb78c0bfc681bce9a9339270abb9a06215"
127
132
  }
@@ -2,11 +2,10 @@
2
2
  "extends": "../../tsconfig.json",
3
3
  "compilerOptions": {
4
4
  "incremental": true,
5
- "lib": ["DOM"],
5
+ "lib": ["DOM", "ES2019"],
6
6
  "module": "esnext",
7
7
  "tsBuildInfoFile": "./lib/client/.tsbuildinfo",
8
8
  "outDir": "lib/client",
9
- "noImplicitAny": false,
10
9
  "jsx": "react"
11
10
  },
12
11
  "include": ["src/client"]
package/tsconfig.json CHANGED
@@ -2,12 +2,13 @@
2
2
  "extends": "../../tsconfig.json",
3
3
  "compilerOptions": {
4
4
  "incremental": true,
5
- "lib": ["DOM"],
5
+ "lib": ["DOM", "ES2019"],
6
6
  "tsBuildInfoFile": "./lib/.tsbuildinfo",
7
7
  "rootDir": "src",
8
8
  "outDir": "lib",
9
- "noImplicitAny": false,
10
- "jsx": "react"
9
+ "jsx": "react",
10
+ "allowJs": true
11
11
  },
12
- "exclude": ["node_modules", "**/__tests__/**/*", "**/lib/**/*", "src/client"]
12
+ "include": ["src"],
13
+ "exclude": ["**/__tests__/**/*", "src/client"]
13
14
  }
@@ -1,7 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
- export declare function buildUrl(githubHost: string, githubPort: string | undefined, gitCredentials: string | undefined, organizationName: string, projectName: string, useSSH: boolean | undefined): string;
@@ -1,27 +0,0 @@
1
- "use strict";
2
- /**
3
- * Copyright (c) Facebook, Inc. and its affiliates.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE file in the root directory of this source tree.
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.buildUrl = void 0;
10
- function buildUrl(githubHost, githubPort, gitCredentials, organizationName, projectName, useSSH) {
11
- return useSSH
12
- ? buildSshUrl(githubHost, organizationName, projectName, githubPort)
13
- : buildHttpsUrl(gitCredentials, githubHost, organizationName, projectName, githubPort);
14
- }
15
- exports.buildUrl = buildUrl;
16
- function buildSshUrl(githubHost, organizationName, projectName, githubPort) {
17
- if (githubPort) {
18
- return `ssh://git@${githubHost}:${githubPort}/${organizationName}/${projectName}.git`;
19
- }
20
- return `git@${githubHost}:${organizationName}/${projectName}.git`;
21
- }
22
- function buildHttpsUrl(gitCredentials, githubHost, organizationName, projectName, githubPort) {
23
- if (githubPort) {
24
- return `https://${gitCredentials}@${githubHost}:${githubPort}/${organizationName}/${projectName}.git`;
25
- }
26
- return `https://${gitCredentials}@${githubHost}/${organizationName}/${projectName}.git`;
27
- }
@@ -1,18 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
- export declare const NODE_MAJOR_VERSION: number;
8
- export declare const NODE_MINOR_VERSION: number;
9
- export declare const DEFAULT_BUILD_DIR_NAME = "build";
10
- export declare const DEFAULT_CONFIG_FILE_NAME = "docusaurus.config.js";
11
- export declare const BABEL_CONFIG_FILE_NAME: string;
12
- export declare const GENERATED_FILES_DIR_NAME: string;
13
- export declare const SRC_DIR_NAME = "src";
14
- export declare const STATIC_DIR_NAME = "static";
15
- export declare const OUTPUT_STATIC_ASSETS_DIR_NAME = "assets";
16
- export declare const THEME_PATH: string;
17
- export declare const DEFAULT_PORT = 3000;
18
- export declare const DEFAULT_PLUGIN_ID = "default";
package/lib/constants.js DELETED
@@ -1,23 +0,0 @@
1
- "use strict";
2
- /**
3
- * Copyright (c) Facebook, Inc. and its affiliates.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE file in the root directory of this source tree.
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.DEFAULT_PLUGIN_ID = exports.DEFAULT_PORT = exports.THEME_PATH = exports.OUTPUT_STATIC_ASSETS_DIR_NAME = exports.STATIC_DIR_NAME = exports.SRC_DIR_NAME = exports.GENERATED_FILES_DIR_NAME = exports.BABEL_CONFIG_FILE_NAME = exports.DEFAULT_CONFIG_FILE_NAME = exports.DEFAULT_BUILD_DIR_NAME = exports.NODE_MINOR_VERSION = exports.NODE_MAJOR_VERSION = void 0;
10
- exports.NODE_MAJOR_VERSION = parseInt(process.versions.node.split('.')[0], 10);
11
- exports.NODE_MINOR_VERSION = parseInt(process.versions.node.split('.')[1], 10);
12
- // Can be overridden with cli option --out-dir
13
- exports.DEFAULT_BUILD_DIR_NAME = 'build';
14
- // Can be overridden with cli option --config
15
- exports.DEFAULT_CONFIG_FILE_NAME = 'docusaurus.config.js';
16
- exports.BABEL_CONFIG_FILE_NAME = process.env.DOCUSAURUS_BABEL_CONFIG_FILE_NAME || 'babel.config.js';
17
- exports.GENERATED_FILES_DIR_NAME = process.env.DOCUSAURUS_GENERATED_FILES_DIR_NAME || '.docusaurus';
18
- exports.SRC_DIR_NAME = 'src';
19
- exports.STATIC_DIR_NAME = 'static';
20
- exports.OUTPUT_STATIC_ASSETS_DIR_NAME = 'assets'; // files handled by webpack, hashed (can be cached aggressively)
21
- exports.THEME_PATH = `${exports.SRC_DIR_NAME}/theme`;
22
- exports.DEFAULT_PORT = 3000;
23
- exports.DEFAULT_PLUGIN_ID = 'default';
@@ -1,11 +0,0 @@
1
- This is a temporary copy of
2
-
3
- CRA / react-dev-utils does not support Webpack 5 yet
4
-
5
- https://github.com/facebook/create-react-app/issues/9994
6
-
7
- This folder is a temporary copy of some react-dev-utils code to which we made some changes to support Webpack 5 without warnings
8
-
9
- TODO remove this folder once Webpack 5 is supported (https://github.com/facebook/create-react-app/issues/9994)
10
-
11
- The comment `// modified for Docusaurus` is added near the modified elements
@@ -1,57 +0,0 @@
1
- /**
2
- * Copyright (c) 2015-present, Facebook, Inc.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
- /* eslint-disable */
8
- /*
9
- * THIS FILE IS MODIFIED FOR DOCUSAURUS
10
- * the above copyright header must be preserved for license compliance.
11
- */
12
-
13
- /*
14
- Implementation based on comment: https://github.com/facebook/create-react-app/issues/9994#issuecomment-811289191
15
- */
16
-
17
- function base64SourceMap(source) {
18
- const base64 = Buffer.from(JSON.stringify(source.map()), 'utf8').toString(
19
- 'base64',
20
- );
21
- return `data:application/json;charset=utf-8;base64,${base64}`;
22
- }
23
-
24
- // modified for Docusaurus => remove webpack 5 deprecation warnings
25
- // See https://github.com/facebook/create-react-app/issues/9994#issuecomment-811289191
26
- function getSourceById(server, id) {
27
- const module = Array.from(server._stats.compilation.modules).find(
28
- (m) => server._stats.compilation.chunkGraph.getModuleId(m) == id,
29
- );
30
- return module.originalSource();
31
- }
32
-
33
- /*
34
- * Middleware responsible for retrieving a generated source
35
- * Receives a webpack internal url: "webpack-internal:///<module-id>"
36
- * Returns a generated source: "<source-text><sourceMappingURL><sourceURL>"
37
- *
38
- * Based on EvalSourceMapDevToolModuleTemplatePlugin.js
39
- */
40
- module.exports = function createEvalSourceMapMiddleware(server) {
41
- return function handleWebpackInternalMiddleware(req, res, next) {
42
- if (req.url.startsWith('/__get-internal-source')) {
43
- const fileName = req.query.fileName;
44
- const id = fileName.match(/webpack-internal:\/\/\/(.+)/)[1];
45
- if (!id || !server._stats) {
46
- next();
47
- }
48
-
49
- const source = getSourceById(server, id);
50
- const sourceMapURL = `//# sourceMappingURL=${base64SourceMap(source)}`;
51
- const sourceURL = `//# sourceURL=webpack-internal:///${module.id}`;
52
- res.end(`${source.source()}\n${sourceMapURL}\n${sourceURL}`);
53
- } else {
54
- next();
55
- }
56
- };
57
- };