@docusaurus/core 0.0.0-4860 → 0.0.0-4865

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.
@@ -46,7 +46,7 @@ It might also require to wrap your client code in code=${'useEffect'} hook and/o
46
46
  }
47
47
  // Renderer for static-site-generator-webpack-plugin (async rendering).
48
48
  async function doRender(locals) {
49
- const { routesLocation, headTags, preBodyTags, postBodyTags, onLinksCollected, baseUrl, ssrTemplate, noIndex, } = locals;
49
+ const { routesLocation, headTags, preBodyTags, postBodyTags, onLinksCollected, onHeadTagsCollected, baseUrl, ssrTemplate, noIndex, } = locals;
50
50
  const location = routesLocation[locals.path];
51
51
  await preload(location);
52
52
  const modules = new Set();
@@ -75,6 +75,7 @@ async function doRender(locals) {
75
75
  helmet.link.toString(),
76
76
  helmet.script.toString(),
77
77
  ];
78
+ onHeadTagsCollected(location, helmet);
78
79
  const metaAttributes = metaStrings.filter(Boolean);
79
80
  const { generatedFilesDir } = locals;
80
81
  const manifestPath = path.join(generatedFilesDir, 'client-manifest.json');
@@ -104,11 +104,15 @@ async function buildLocale({ siteDir, locale, cliOptions, forceTerminate, isLast
104
104
  ].filter(Boolean),
105
105
  });
106
106
  const allCollectedLinks = {};
107
+ const headTags = {};
107
108
  let serverConfig = await (0, server_2.default)({
108
109
  props,
109
110
  onLinksCollected: (staticPagePath, links) => {
110
111
  allCollectedLinks[staticPagePath] = links;
111
112
  },
113
+ onHeadTagsCollected: (staticPagePath, tags) => {
114
+ headTags[staticPagePath] = tags;
115
+ },
112
116
  });
113
117
  if (staticDirectories.length > 0) {
114
118
  await Promise.all(staticDirectories.map((dir) => fs_extra_1.default.ensureDir(dir)));
@@ -154,7 +158,11 @@ async function buildLocale({ siteDir, locale, cliOptions, forceTerminate, isLast
154
158
  if (!plugin.postBuild) {
155
159
  return;
156
160
  }
157
- await plugin.postBuild({ ...props, content: plugin.content });
161
+ await plugin.postBuild({
162
+ ...props,
163
+ head: headTags,
164
+ content: plugin.content,
165
+ });
158
166
  }));
159
167
  await (0, brokenLinks_1.handleBrokenLinks)({
160
168
  allCollectedLinks,
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import type { Configuration } from 'webpack';
8
8
  import type { Props } from '@docusaurus/types';
9
- export default function createServerConfig({ props, onLinksCollected, }: {
9
+ import { type Locals } from '@slorber/static-site-generator-webpack-plugin';
10
+ export default function createServerConfig({ props, onLinksCollected, onHeadTagsCollected, }: Pick<Locals, 'onLinksCollected' | 'onHeadTagsCollected'> & {
10
11
  props: Props;
11
- onLinksCollected?: (staticPagePath: string, links: string[]) => void;
12
12
  }): Promise<Configuration>;
@@ -16,7 +16,7 @@ const utils_1 = require("@docusaurus/utils");
16
16
  const ssr_html_template_1 = tslib_1.__importDefault(require("./templates/ssr.html.template"));
17
17
  // Forked for Docusaurus: https://github.com/slorber/static-site-generator-webpack-plugin
18
18
  const static_site_generator_webpack_plugin_1 = tslib_1.__importDefault(require("@slorber/static-site-generator-webpack-plugin"));
19
- async function createServerConfig({ props, onLinksCollected = () => { }, }) {
19
+ async function createServerConfig({ props, onLinksCollected, onHeadTagsCollected, }) {
20
20
  const { baseUrl, routesPaths, generatedFilesDir, headTags, preBodyTags, postBodyTags, siteConfig: { noIndex, trailingSlash, ssrTemplate }, } = props;
21
21
  const config = await (0, base_1.createBaseConfig)(props, true);
22
22
  const routesLocation = {};
@@ -53,6 +53,7 @@ async function createServerConfig({ props, onLinksCollected = () => { }, }) {
53
53
  preBodyTags,
54
54
  postBodyTags,
55
55
  onLinksCollected,
56
+ onHeadTagsCollected,
56
57
  ssrTemplate: ssrTemplate ?? ssr_html_template_1.default,
57
58
  noIndex,
58
59
  },
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-4860",
4
+ "version": "0.0.0-4865",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -41,13 +41,13 @@
41
41
  "@babel/runtime": "^7.17.9",
42
42
  "@babel/runtime-corejs3": "^7.17.9",
43
43
  "@babel/traverse": "^7.17.9",
44
- "@docusaurus/cssnano-preset": "0.0.0-4860",
45
- "@docusaurus/logger": "0.0.0-4860",
46
- "@docusaurus/mdx-loader": "0.0.0-4860",
44
+ "@docusaurus/cssnano-preset": "0.0.0-4865",
45
+ "@docusaurus/logger": "0.0.0-4865",
46
+ "@docusaurus/mdx-loader": "0.0.0-4865",
47
47
  "@docusaurus/react-loadable": "5.5.2",
48
- "@docusaurus/utils": "0.0.0-4860",
49
- "@docusaurus/utils-common": "0.0.0-4860",
50
- "@docusaurus/utils-validation": "0.0.0-4860",
48
+ "@docusaurus/utils": "0.0.0-4865",
49
+ "@docusaurus/utils-common": "0.0.0-4865",
50
+ "@docusaurus/utils-validation": "0.0.0-4865",
51
51
  "@slorber/static-site-generator-webpack-plugin": "^4.0.4",
52
52
  "@svgr/webpack": "^6.2.1",
53
53
  "autoprefixer": "^10.4.4",
@@ -105,8 +105,8 @@
105
105
  "webpackbar": "^5.0.2"
106
106
  },
107
107
  "devDependencies": {
108
- "@docusaurus/module-type-aliases": "0.0.0-4860",
109
- "@docusaurus/types": "0.0.0-4860",
108
+ "@docusaurus/module-type-aliases": "0.0.0-4865",
109
+ "@docusaurus/types": "0.0.0-4865",
110
110
  "@types/detect-port": "^1.3.2",
111
111
  "@types/nprogress": "^0.2.0",
112
112
  "@types/react-dom": "^18.0.0",
@@ -127,5 +127,5 @@
127
127
  "engines": {
128
128
  "node": ">=14"
129
129
  },
130
- "gitHead": "dd89ce688ef649f835f2bf6be614c6997ba47165"
130
+ "gitHead": "3bfec620587180f9e7dad2bf2a2713172be65fe7"
131
131
  }