@docusaurus/core 0.0.0-4525 → 0.0.0-4526

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.
@@ -23,7 +23,7 @@ const canPreload = (routePath) => !isSlowConnection() && !loaded[routePath];
23
23
  // Remove the last part containing the route hash
24
24
  // input: /blog/2018/12/14/Happy-First-Birthday-Slash-fe9
25
25
  // output: /blog/2018/12/14/Happy-First-Birthday-Slash
26
- const removeRouteNameHash = (str) => str.replace(/(-[^-]+)$/, '');
26
+ const removeRouteNameHash = (str) => str.replace(/-[^-]+$/, '');
27
27
  const getChunkNamesToLoad = (path) => Object.entries(routesChunkNames)
28
28
  .filter(([routeNameWithHash]) => removeRouteNameHash(routeNameWithHash) === path)
29
29
  .flatMap(([, routeChunks]) =>
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  export function hasProtocol(url) {
8
- return /^(\w*:|\/\/)/.test(url) === true;
8
+ return /^(?:\w*:|\/\/)/.test(url) === true;
9
9
  }
10
10
  export default function isInternalUrl(url) {
11
11
  return typeof url !== 'undefined' && !hasProtocol(url);
@@ -37,7 +37,7 @@ export default async function render(locals) {
37
37
  catch (e) {
38
38
  logger.error `Docusaurus Node/SSR could not render static page with path path=${locals.path} because of following error:
39
39
  ${e.stack}`;
40
- const isNotDefinedErrorRegex = /(window|document|localStorage|navigator|alert|location|buffer|self) is not defined/i;
40
+ const isNotDefinedErrorRegex = /(?:window|document|localStorage|navigator|alert|location|buffer|self) is not defined/i;
41
41
  if (isNotDefinedErrorRegex.test(e.message)) {
42
42
  logger.info `It looks like you are using code that should run on the client-side only.
43
43
  To get around it, try using code=${'<BrowserOnly>'} (path=${'https://docusaurus.io/docs/docusaurus-core/#browseronly'}) or code=${'ExecutionEnvironment'} (path=${'https://docusaurus.io/docs/docusaurus-core/#executionenvironment'}).
@@ -56,7 +56,7 @@ function hasSSHProtocol(sourceRepoUrl) {
56
56
  }
57
57
  catch {
58
58
  // Fails when there isn't a protocol
59
- return /^([\w-]+@)?[\w.-]+:[\w./_-]+(\.git)?/.test(sourceRepoUrl); // git@github.com:facebook/docusaurus.git
59
+ return /^(?:[\w-]+@)?[\w.-]+:[\w./_-]+/.test(sourceRepoUrl); // git@github.com:facebook/docusaurus.git
60
60
  }
61
61
  }
62
62
  exports.hasSSHProtocol = hasSSHProtocol;
@@ -45,8 +45,8 @@ function getPluginNames(plugins) {
45
45
  }
46
46
  exports.getPluginNames = getPluginNames;
47
47
  const formatComponentName = (componentName) => componentName
48
- .replace(/(\/|\\)index\.(js|tsx|ts|jsx)/, '')
49
- .replace(/\.(js|tsx|ts|jsx)/, '');
48
+ .replace(/[\\/]index\.(?:jsx?|tsx?)/, '')
49
+ .replace(/\.(?:jsx?|tsx?)/, '');
50
50
  function readComponent(themePath) {
51
51
  function walk(dir) {
52
52
  let results = [];
@@ -15,7 +15,7 @@ const init_1 = (0, tslib_1.__importDefault)(require("../server/plugins/init"));
15
15
  const utils_1 = require("@docusaurus/utils");
16
16
  const utils_2 = require("../server/utils");
17
17
  function unwrapMarkdownLinks(line) {
18
- return line.replace(/\[([^\]]+)\]\([^)]+\)/g, (match, p1) => p1);
18
+ return line.replace(/\[(?<alt>[^\]]+)\]\([^)]+\)/g, (match, p1) => p1);
19
19
  }
20
20
  function addHeadingId(line, slugger, maintainCase) {
21
21
  let headingLevel = 0;
@@ -178,7 +178,7 @@ function createMDXFallbackPlugin({ siteDir, siteConfig, }) {
178
178
  module: {
179
179
  rules: [
180
180
  {
181
- test: /(\.mdx?)$/,
181
+ test: /\.mdx?$/i,
182
182
  exclude: getMDXFallbackExcludedPaths(),
183
183
  use: [
184
184
  getJSLoader({ isServer }),
@@ -13,7 +13,7 @@ function getNamePatterns(moduleName, moduleType) {
13
13
  if (!moduleName.includes('/')) {
14
14
  return [`${moduleName}/docusaurus-${moduleType}`];
15
15
  }
16
- const [scope, packageName] = moduleName.split(/\/(.*)/);
16
+ const [scope, packageName] = moduleName.split(/\/(?<rest>.*)/);
17
17
  return [
18
18
  `${scope}/${packageName}`,
19
19
  `${scope}/docusaurus-${moduleType}-${packageName}`,
@@ -11,7 +11,7 @@ const lodash_1 = require("lodash");
11
11
  const querystring_1 = require("querystring");
12
12
  function indent(str) {
13
13
  const spaces = ' ';
14
- return `${spaces}${str.replace(/(\n)/g, `\n${spaces}`)}`;
14
+ return `${spaces}${str.replace(/\n/g, `\n${spaces}`)}`;
15
15
  }
16
16
  const createRouteCodeString = ({ routePath, routeHash, exact, subroutesCodeStrings, props, }) => {
17
17
  const parts = [
@@ -14,8 +14,8 @@ const path_1 = (0, tslib_1.__importDefault)(require("path"));
14
14
  const utils_1 = require("./utils");
15
15
  const themes_1 = require("../server/themes");
16
16
  const utils_2 = require("@docusaurus/utils");
17
- const CSS_REGEX = /\.css$/;
18
- const CSS_MODULE_REGEX = /\.module\.css$/;
17
+ const CSS_REGEX = /\.css$/i;
18
+ const CSS_MODULE_REGEX = /\.module\.css$/i;
19
19
  exports.clientDir = path_1.default.join(__dirname, '..', 'client');
20
20
  const LibrariesToTranspile = [
21
21
  'copy-text-to-clipboard', // contains optional catch binding, incompatible with recent versions of Edge
@@ -28,7 +28,7 @@ function excludeJS(modulePath) {
28
28
  }
29
29
  // Don't transpile node_modules except any docusaurus npm package
30
30
  return (/node_modules/.test(modulePath) &&
31
- !/(docusaurus)((?!node_modules).)*\.jsx?$/.test(modulePath) &&
31
+ !/docusaurus(?:(?!node_modules).)*\.jsx?$/.test(modulePath) &&
32
32
  !LibrariesToTranspileRegex.test(modulePath));
33
33
  }
34
34
  exports.excludeJS = excludeJS;
@@ -182,7 +182,7 @@ function createBaseConfig(props, isServer, minify = true) {
182
182
  fileLoaderUtils.rules.svg(),
183
183
  fileLoaderUtils.rules.otherAssets(),
184
184
  {
185
- test: /\.(j|t)sx?$/,
185
+ test: /\.[jt]sx?$/i,
186
186
  exclude: excludeJS,
187
187
  use: [
188
188
  (0, utils_1.getCustomizableJSLoader)((_a = siteConfig.webpack) === null || _a === void 0 ? void 0 : _a.jsLoader)({
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": "0.0.0-4525",
4
+ "version": "0.0.0-4526",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -41,13 +41,13 @@
41
41
  "@babel/runtime": "^7.16.3",
42
42
  "@babel/runtime-corejs3": "^7.16.3",
43
43
  "@babel/traverse": "^7.16.3",
44
- "@docusaurus/cssnano-preset": "0.0.0-4525",
45
- "@docusaurus/logger": "0.0.0-4525",
46
- "@docusaurus/mdx-loader": "0.0.0-4525",
44
+ "@docusaurus/cssnano-preset": "0.0.0-4526",
45
+ "@docusaurus/logger": "0.0.0-4526",
46
+ "@docusaurus/mdx-loader": "0.0.0-4526",
47
47
  "@docusaurus/react-loadable": "5.5.2",
48
- "@docusaurus/utils": "0.0.0-4525",
49
- "@docusaurus/utils-common": "0.0.0-4525",
50
- "@docusaurus/utils-validation": "0.0.0-4525",
48
+ "@docusaurus/utils": "0.0.0-4526",
49
+ "@docusaurus/utils-common": "0.0.0-4526",
50
+ "@docusaurus/utils-validation": "0.0.0-4526",
51
51
  "@slorber/static-site-generator-webpack-plugin": "^4.0.0",
52
52
  "@svgr/webpack": "^6.0.0",
53
53
  "autoprefixer": "^10.3.5",
@@ -105,8 +105,8 @@
105
105
  "webpackbar": "^5.0.2"
106
106
  },
107
107
  "devDependencies": {
108
- "@docusaurus/module-type-aliases": "0.0.0-4525",
109
- "@docusaurus/types": "0.0.0-4525",
108
+ "@docusaurus/module-type-aliases": "0.0.0-4526",
109
+ "@docusaurus/types": "0.0.0-4526",
110
110
  "@types/copy-webpack-plugin": "^8.0.1",
111
111
  "@types/detect-port": "^1.3.0",
112
112
  "@types/mini-css-extract-plugin": "^1.4.3",
@@ -129,5 +129,5 @@
129
129
  "engines": {
130
130
  "node": ">=14"
131
131
  },
132
- "gitHead": "c1122ee21d114f85261bed9b8296ab3501454098"
132
+ "gitHead": "3086e9e823783e306698097d959007f44de275b1"
133
133
  }