@docusaurus/plugin-content-docs 0.0.0-4453 → 0.0.0-4460

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.
@@ -13,7 +13,10 @@ const router_1 = require("@docusaurus/router");
13
13
  // ie the docs of that plugin are currently browsed
14
14
  // it is useful to support multiple docs plugin instances
15
15
  function getActivePlugin(allPluginDatas, pathname, options = {}) {
16
- const activeEntry = Object.entries(allPluginDatas).find(([_id, pluginData]) => !!(0, router_1.matchPath)(pathname, {
16
+ const activeEntry = Object.entries(allPluginDatas)
17
+ // A quick route sorting: '/android/foo' should match '/android' instead of '/'
18
+ .sort((a, b) => b[1].path.localeCompare(a[1].path))
19
+ .find(([, pluginData]) => !!(0, router_1.matchPath)(pathname, {
17
20
  path: pluginData.path,
18
21
  exact: false,
19
22
  strict: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/plugin-content-docs",
3
- "version": "0.0.0-4453",
3
+ "version": "0.0.0-4460",
4
4
  "description": "Docs plugin for Docusaurus.",
5
5
  "main": "lib/index.js",
6
6
  "exports": {
@@ -22,11 +22,11 @@
22
22
  },
23
23
  "license": "MIT",
24
24
  "dependencies": {
25
- "@docusaurus/core": "0.0.0-4453",
26
- "@docusaurus/logger": "0.0.0-4453",
27
- "@docusaurus/mdx-loader": "0.0.0-4453",
28
- "@docusaurus/utils": "0.0.0-4453",
29
- "@docusaurus/utils-validation": "0.0.0-4453",
25
+ "@docusaurus/core": "0.0.0-4460",
26
+ "@docusaurus/logger": "0.0.0-4460",
27
+ "@docusaurus/mdx-loader": "0.0.0-4460",
28
+ "@docusaurus/utils": "0.0.0-4460",
29
+ "@docusaurus/utils-validation": "0.0.0-4460",
30
30
  "combine-promises": "^1.1.0",
31
31
  "escape-string-regexp": "^4.0.0",
32
32
  "fs-extra": "^10.0.0",
@@ -42,8 +42,8 @@
42
42
  "webpack": "^5.61.0"
43
43
  },
44
44
  "devDependencies": {
45
- "@docusaurus/module-type-aliases": "0.0.0-4453",
46
- "@docusaurus/types": "0.0.0-4453",
45
+ "@docusaurus/module-type-aliases": "0.0.0-4460",
46
+ "@docusaurus/types": "0.0.0-4460",
47
47
  "@types/js-yaml": "^4.0.0",
48
48
  "@types/picomatch": "^2.2.1",
49
49
  "commander": "^5.1.0",
@@ -57,5 +57,5 @@
57
57
  "engines": {
58
58
  "node": ">=14"
59
59
  },
60
- "gitHead": "5379d3424fde605d7bde0fa2ba86b9db1ca4becc"
60
+ "gitHead": "1de1d4788a6d04a452c2c7f2ef0a5cf2bd11e69b"
61
61
  }
@@ -27,14 +27,17 @@ export function getActivePlugin(
27
27
  pathname: string,
28
28
  options: GetActivePluginOptions = {},
29
29
  ): ActivePlugin | undefined {
30
- const activeEntry = Object.entries(allPluginDatas).find(
31
- ([_id, pluginData]) =>
32
- !!matchPath(pathname, {
33
- path: pluginData.path,
34
- exact: false,
35
- strict: false,
36
- }),
37
- );
30
+ const activeEntry = Object.entries(allPluginDatas)
31
+ // A quick route sorting: '/android/foo' should match '/android' instead of '/'
32
+ .sort((a, b) => b[1].path.localeCompare(a[1].path))
33
+ .find(
34
+ ([, pluginData]) =>
35
+ !!matchPath(pathname, {
36
+ path: pluginData.path,
37
+ exact: false,
38
+ strict: false,
39
+ }),
40
+ );
38
41
 
39
42
  const activePlugin: ActivePlugin | undefined = activeEntry
40
43
  ? {pluginId: activeEntry[0], pluginData: activeEntry[1]}