@docusaurus/core 4.0.0-canary-6978 → 4.0.0-canary-6979

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.
@@ -11,6 +11,15 @@ const tslib_1 = require("tslib");
11
11
  const node_path_1 = tslib_1.__importDefault(require("node:path"));
12
12
  const utils_1 = require("@docusaurus/utils");
13
13
  const routeConfig_1 = require("./routeConfig");
14
+ // The custom route context declared by plugins is namespaced under `data`
15
+ // This applies to nested routes too: the client merges their route context
16
+ function namespaceRouteContextData(route) {
17
+ return {
18
+ ...route,
19
+ ...(route.context && { context: { data: route.context } }),
20
+ ...(route.routes && { routes: route.routes.map(namespaceRouteContextData) }),
21
+ };
22
+ }
14
23
  // TODO refactor historical action system and make this side-effect-free
15
24
  // If the function were pure, we could more easily compare previous/next values
16
25
  // on site reloads, and bail-out of the reload process earlier
@@ -38,14 +47,14 @@ async function createPluginActionsUtils({ plugin, generatedFilesDir, baseUrl, tr
38
47
  const actions = {
39
48
  addRoute(initialRouteConfig) {
40
49
  // Trailing slash behavior is handled generically for all plugins
41
- const finalRouteConfig = (0, routeConfig_1.applyRouteTrailingSlash)(initialRouteConfig, {
50
+ const finalRouteConfig = namespaceRouteContextData((0, routeConfig_1.applyRouteTrailingSlash)(initialRouteConfig, {
42
51
  baseUrl,
43
52
  trailingSlash,
44
- });
53
+ }));
45
54
  routes.push({
46
55
  ...finalRouteConfig,
47
56
  context: {
48
- ...(finalRouteConfig.context && { data: finalRouteConfig.context }),
57
+ ...finalRouteConfig.context,
49
58
  plugin: aliasedSource(pluginRouteContextModulePath),
50
59
  },
51
60
  });
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": "4.0.0-canary-6978",
4
+ "version": "4.0.0-canary-6979",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -27,15 +27,15 @@
27
27
  "url": "https://github.com/facebook/docusaurus/issues"
28
28
  },
29
29
  "dependencies": {
30
- "@docusaurus/babel": "4.0.0-canary-6978",
31
- "@docusaurus/bundler": "4.0.0-canary-6978",
32
- "@docusaurus/fs": "4.0.0-canary-6978",
33
- "@docusaurus/glob": "4.0.0-canary-6978",
34
- "@docusaurus/logger": "4.0.0-canary-6978",
35
- "@docusaurus/mdx-loader": "4.0.0-canary-6978",
36
- "@docusaurus/utils": "4.0.0-canary-6978",
37
- "@docusaurus/utils-common": "4.0.0-canary-6978",
38
- "@docusaurus/utils-validation": "4.0.0-canary-6978",
30
+ "@docusaurus/babel": "4.0.0-canary-6979",
31
+ "@docusaurus/bundler": "4.0.0-canary-6979",
32
+ "@docusaurus/fs": "4.0.0-canary-6979",
33
+ "@docusaurus/glob": "4.0.0-canary-6979",
34
+ "@docusaurus/logger": "4.0.0-canary-6979",
35
+ "@docusaurus/mdx-loader": "4.0.0-canary-6979",
36
+ "@docusaurus/utils": "4.0.0-canary-6979",
37
+ "@docusaurus/utils-common": "4.0.0-canary-6979",
38
+ "@docusaurus/utils-validation": "4.0.0-canary-6979",
39
39
  "@rspack/core": "^2.2.3",
40
40
  "@rspack/dev-server": "^2.2.1",
41
41
  "boxen": "^9.0.0",
@@ -68,8 +68,8 @@
68
68
  "webpack-merge": "^6.0.1"
69
69
  },
70
70
  "devDependencies": {
71
- "@docusaurus/module-type-aliases": "4.0.0-canary-6978",
72
- "@docusaurus/types": "4.0.0-canary-6978",
71
+ "@docusaurus/module-type-aliases": "4.0.0-canary-6979",
72
+ "@docusaurus/types": "4.0.0-canary-6979",
73
73
  "@total-typescript/shoehorn": "^0.1.2",
74
74
  "@types/escape-html": "^1.0.4",
75
75
  "@types/history": "^4.7.11",