@docusaurus/core 4.0.0-canary-7002 → 4.0.0-canary-7029
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.
- package/bin/beforeCli.mjs +2 -2
- package/bin/docusaurus.mjs +1 -1
- package/lib/client/BaseUrlIssueBanner/index.d.ts +1 -1
- package/lib/client/BaseUrlIssueBanner/index.js +3 -3
- package/lib/client/SiteMetadataDefaults.js +1 -1
- package/lib/client/exports/ErrorBoundary.js +1 -1
- package/lib/client/exports/Link.js +2 -2
- package/lib/client/exports/useBaseUrl.js +2 -2
- package/lib/client/hasHydratedDataAttribute.js +1 -1
- package/lib/client/renderToHtml.js +1 -1
- package/lib/client/theme-fallback/Error/index.js +1 -1
- package/lib/client/theme-fallback/Root/index.js +1 -1
- package/lib/commands/build/buildLocale.js +2 -2
- package/lib/commands/cli.js +2 -2
- package/lib/commands/deploy.js +1 -1
- package/lib/commands/serve.js +3 -3
- package/lib/commands/start/start.js +1 -1
- package/lib/commands/start/utils.js +1 -1
- package/lib/commands/start/webpack.js +1 -1
- package/lib/commands/swizzle/actions.js +1 -1
- package/lib/commands/swizzle/components.d.ts +1 -1
- package/lib/commands/swizzle/components.js +3 -3
- package/lib/commands/swizzle/tables.js +1 -1
- package/lib/commands/swizzle/themes.js +8 -6
- package/lib/commands/utils/openBrowser/openBrowser.js +3 -3
- package/lib/commands/utils/openBrowser/openChrome.applescript +1 -1
- package/lib/server/brokenLinks.js +5 -5
- package/lib/server/codegen/codegenRoutes.js +6 -4
- package/lib/server/configValidation.js +2 -2
- package/lib/server/i18n.js +3 -11
- package/lib/server/plugins/init.js +1 -1
- package/lib/server/plugins/pluginIds.js +4 -6
- package/lib/server/site.js +1 -1
- package/lib/server/siteMetadata.js +2 -2
- package/lib/server/translations/translations.js +8 -2
- package/lib/ssg/ssgEnv.js +2 -2
- package/lib/ssg/ssgExecutor.js +2 -2
- package/lib/ssg/ssgGlobalResult.js +2 -2
- package/lib/ssg/ssgRenderer.js +1 -1
- package/lib/webpack/aliases/index.d.ts +2 -2
- package/lib/webpack/aliases/index.js +2 -2
- package/lib/webpack/base.js +5 -5
- package/lib/webpack/client.js +1 -1
- package/lib/webpack/configure.js +1 -1
- package/lib/webpack/plugins/BundlerCPUProfilerPlugin.js +1 -1
- package/lib/webpack/plugins/ChunkAssetPlugin.js +1 -1
- package/lib/webpack/plugins/StaticDirectoriesCopyPlugin.js +1 -1
- package/lib/webpack/server.js +2 -2
- package/package.json +17 -17
package/bin/beforeCli.mjs
CHANGED
|
@@ -71,13 +71,13 @@ export default async function beforeCli() {
|
|
|
71
71
|
notifier.check();
|
|
72
72
|
}
|
|
73
73
|
} catch (err) {
|
|
74
|
-
// Do not stop cli if this fails, see https://github.com/
|
|
74
|
+
// Do not stop cli if this fails, see https://github.com/meta/docusaurus/issues/5400
|
|
75
75
|
logger.error(err);
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
/**
|
|
79
79
|
* We don't want to display update message for canary releases.
|
|
80
|
-
* See https://github.com/
|
|
80
|
+
* See https://github.com/meta/docusaurus/issues/5378
|
|
81
81
|
* @param {import('update-notifier').UpdateInfo} update
|
|
82
82
|
*/
|
|
83
83
|
function ignoreUpdate(update) {
|
package/bin/docusaurus.mjs
CHANGED
|
@@ -16,7 +16,7 @@ import beforeCli from './beforeCli.mjs';
|
|
|
16
16
|
|
|
17
17
|
// Env variables are initialized to dev, but can be overridden by each command
|
|
18
18
|
// For example, "docusaurus build" overrides them to "production"
|
|
19
|
-
// See also https://github.com/
|
|
19
|
+
// See also https://github.com/meta/docusaurus/issues/8599
|
|
20
20
|
process.env.BABEL_ENV ??= 'development';
|
|
21
21
|
process.env.NODE_ENV ??= 'development';
|
|
22
22
|
|
|
@@ -15,6 +15,6 @@ import './styles.module.css';
|
|
|
15
15
|
*
|
|
16
16
|
* Note: it might create false positives (ie network failures): not a big deal
|
|
17
17
|
*
|
|
18
|
-
* @see https://github.com/
|
|
18
|
+
* @see https://github.com/meta/docusaurus/pull/3621
|
|
19
19
|
*/
|
|
20
20
|
export default function MaybeBaseUrlIssueBanner(): ReactNode;
|
|
@@ -11,13 +11,13 @@ import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
|
11
11
|
// Double-security: critical CSS will hide the banner if CSS can load!
|
|
12
12
|
import './styles.module.css';
|
|
13
13
|
// __ prefix allows search crawlers (Algolia/DocSearch) to ignore anchors
|
|
14
|
-
// https://github.com/
|
|
14
|
+
// https://github.com/meta/docusaurus/issues/8883#issuecomment-1516328368
|
|
15
15
|
const BannerContainerId = '__docusaurus-base-url-issue-banner-container';
|
|
16
16
|
const BannerId = '__docusaurus-base-url-issue-banner';
|
|
17
17
|
const SuggestionContainerId = '__docusaurus-base-url-issue-banner-suggestion-container';
|
|
18
18
|
// It is important to not use React to render this banner
|
|
19
19
|
// otherwise Google would index it, even if it's hidden with some critical CSS!
|
|
20
|
-
// See https://github.com/
|
|
20
|
+
// See https://github.com/meta/docusaurus/issues/4028
|
|
21
21
|
// - We can't SSR (or it would be indexed)
|
|
22
22
|
// - We can't CSR (as it means the baseurl is correct)
|
|
23
23
|
function createInlineHtmlBanner(baseUrl) {
|
|
@@ -76,7 +76,7 @@ function BaseUrlIssueBanner() {
|
|
|
76
76
|
*
|
|
77
77
|
* Note: it might create false positives (ie network failures): not a big deal
|
|
78
78
|
*
|
|
79
|
-
* @see https://github.com/
|
|
79
|
+
* @see https://github.com/meta/docusaurus/pull/3621
|
|
80
80
|
*/
|
|
81
81
|
export default function MaybeBaseUrlIssueBanner() {
|
|
82
82
|
const { siteConfig: { baseUrl, baseUrlIssueBanner }, } = useDocusaurusContext();
|
|
@@ -14,7 +14,7 @@ export default function SiteMetadataDefaults() {
|
|
|
14
14
|
return (<Head>
|
|
15
15
|
{/*
|
|
16
16
|
charSet + generator are handled in the html templates
|
|
17
|
-
See https://github.com/
|
|
17
|
+
See https://github.com/meta/docusaurus/pull/7952
|
|
18
18
|
<meta charSet="UTF-8" />
|
|
19
19
|
<meta name="generator" content={`Docusaurus v${docusaurusVersion}`} />
|
|
20
20
|
*/}
|
|
@@ -31,7 +31,7 @@ export default class ErrorBoundary extends React.Component {
|
|
|
31
31
|
const fallback = this.props.fallback ?? DefaultFallback;
|
|
32
32
|
return fallback(fallbackParams);
|
|
33
33
|
}
|
|
34
|
-
// See https://github.com/
|
|
34
|
+
// See https://github.com/meta/docusaurus/issues/6337#issuecomment-1012913647
|
|
35
35
|
return children ?? null;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -40,7 +40,7 @@ function Link({ isNavLink, to, href, activeClassName, isActive, 'data-noBrokenLi
|
|
|
40
40
|
// pathname:// is a special "protocol" we use to tell Docusaurus link
|
|
41
41
|
// that a link is not "internal" and that we shouldn't use history.push()
|
|
42
42
|
// this is not ideal but a good enough escape hatch for now
|
|
43
|
-
// see https://github.com/
|
|
43
|
+
// see https://github.com/meta/docusaurus/issues/3309
|
|
44
44
|
// note: we want baseUrl to be appended (see issue for details)
|
|
45
45
|
// TODO read routes and automatically detect internal/external links?
|
|
46
46
|
const targetLinkWithoutPathnameProtocol = targetLinkUnprefixed?.replace('pathname://', '');
|
|
@@ -119,7 +119,7 @@ function Link({ isNavLink, to, href, activeClassName, isActive, 'data-noBrokenLi
|
|
|
119
119
|
// When using the hash router, we can't use the regular <a> link for anchors
|
|
120
120
|
// We need to use React Router to navigate to /#/pathname/#anchor
|
|
121
121
|
// And not /#anchor
|
|
122
|
-
// See also https://github.com/
|
|
122
|
+
// See also https://github.com/meta/docusaurus/pull/10311
|
|
123
123
|
(isAnchorLink && router !== 'hash');
|
|
124
124
|
if (!noBrokenLinkCheck && (isAnchorLink || !isRegularHtmlLink)) {
|
|
125
125
|
brokenLinks.collectLink(targetLink);
|
|
@@ -15,7 +15,7 @@ export function addBaseUrl({ siteUrl, baseUrl, url, options: { forcePrependBaseU
|
|
|
15
15
|
}
|
|
16
16
|
// TODO hash router + /baseUrl/ is unlikely to work well in all situations
|
|
17
17
|
// This will support most cases, but not all
|
|
18
|
-
// See https://github.com/
|
|
18
|
+
// See https://github.com/meta/docusaurus/pull/9859
|
|
19
19
|
if (router === 'hash') {
|
|
20
20
|
return url.startsWith('/') ? `.${url}` : `./${url}`;
|
|
21
21
|
}
|
|
@@ -23,7 +23,7 @@ export function addBaseUrl({ siteUrl, baseUrl, url, options: { forcePrependBaseU
|
|
|
23
23
|
return baseUrl + url.replace(/^\//, '');
|
|
24
24
|
}
|
|
25
25
|
// /baseUrl -> /baseUrl/
|
|
26
|
-
// https://github.com/
|
|
26
|
+
// https://github.com/meta/docusaurus/issues/6315
|
|
27
27
|
if (url === baseUrl.replace(/\/$/, '')) {
|
|
28
28
|
return baseUrl;
|
|
29
29
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import Head from '@docusaurus/Head';
|
|
8
8
|
import useIsBrowser from '@docusaurus/useIsBrowser';
|
|
9
|
-
// See https://github.com/
|
|
9
|
+
// See https://github.com/meta/docusaurus/pull/9256
|
|
10
10
|
// Docusaurus adds a <html data-has-hydrated="true"> after hydration
|
|
11
11
|
export default function HasHydratedDataAttribute() {
|
|
12
12
|
const isBrowser = useIsBrowser();
|
|
@@ -8,7 +8,7 @@ import { renderToPipeableStream } from 'react-dom/server';
|
|
|
8
8
|
import { PassThrough } from 'node:stream';
|
|
9
9
|
import { text } from 'node:stream/consumers';
|
|
10
10
|
// See also https://github.com/facebook/react/issues/31134
|
|
11
|
-
// See also https://github.com/
|
|
11
|
+
// See also https://github.com/meta/docusaurus/issues/9985#issuecomment-2396367797
|
|
12
12
|
export async function renderToHtml(app) {
|
|
13
13
|
return new Promise((resolve, reject) => {
|
|
14
14
|
const passThrough = new PassThrough();
|
|
@@ -43,7 +43,7 @@ function ErrorBoundaryError({ error }) {
|
|
|
43
43
|
// A bit hacky: we need to add an artificial RouteContextProvider here
|
|
44
44
|
// The goal is to be able to render the error inside the theme layout
|
|
45
45
|
// Without this, our theme classic would crash due to lack of route context
|
|
46
|
-
// See also https://github.com/
|
|
46
|
+
// See also https://github.com/meta/docusaurus/pull/9852
|
|
47
47
|
function ErrorRouteContextProvider({ children }) {
|
|
48
48
|
return (<RouteContextProvider value={{
|
|
49
49
|
plugin: { name: 'docusaurus-core-error-boundary', id: 'default' },
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
// Gives the opportunity to add stateful providers on top of the app
|
|
11
11
|
// and these providers won't reset state when we navigate
|
|
12
12
|
//
|
|
13
|
-
// See https://github.com/
|
|
13
|
+
// See https://github.com/meta/docusaurus/issues/3919
|
|
14
14
|
export default function Root({ children }) {
|
|
15
15
|
return <>{children}</>;
|
|
16
16
|
}
|
|
@@ -28,7 +28,7 @@ const ExitAfterBundling = process.env.DOCUSAURUS_EXIT_AFTER_BUNDLING === 'true';
|
|
|
28
28
|
async function buildLocale({ siteDir, locale, cliOptions, }) {
|
|
29
29
|
// Temporary workaround to unlock the ability to translate the site config
|
|
30
30
|
// We'll remove it if a better official API can be designed
|
|
31
|
-
// See https://github.com/
|
|
31
|
+
// See https://github.com/meta/docusaurus/issues/4542
|
|
32
32
|
process.env.DOCUSAURUS_CURRENT_LOCALE = locale;
|
|
33
33
|
logger_1.default.info `name=${`[${locale}]`} Creating an optimized production build...`;
|
|
34
34
|
const site = await logger_1.PerfLogger.async('Load site', () => (0, site_1.loadSite)({
|
|
@@ -64,7 +64,7 @@ async function buildLocale({ siteDir, locale, cliOptions, }) {
|
|
|
64
64
|
}),
|
|
65
65
|
// We also clear website/build dir
|
|
66
66
|
// returns void, no useful result needed before compilation
|
|
67
|
-
// See also https://github.com/
|
|
67
|
+
// See also https://github.com/meta/docusaurus/pull/11037
|
|
68
68
|
SkipBundling ? undefined : (0, clearPath_1.default)(outDir),
|
|
69
69
|
]));
|
|
70
70
|
if (SkipBundling) {
|
package/lib/commands/cli.js
CHANGED
|
@@ -40,10 +40,10 @@ function isInternalCommand(command) {
|
|
|
40
40
|
// no way to know the siteDir/config yet.
|
|
41
41
|
// The individual CLI commands can declare/read siteDir on their own
|
|
42
42
|
// The env variable is an escape hatch
|
|
43
|
-
// See https://github.com/
|
|
43
|
+
// See https://github.com/meta/docusaurus/issues/8903
|
|
44
44
|
const DEFAULT_SITE_DIR = process.env.DOCUSAURUS_CLI_SITE_DIR ?? '.';
|
|
45
45
|
// Similarly we give an env escape hatch for config
|
|
46
|
-
// See https://github.com/
|
|
46
|
+
// See https://github.com/meta/docusaurus/issues/8903
|
|
47
47
|
const DEFAULT_CONFIG = process.env.DOCUSAURUS_CLI_CONFIG ?? undefined;
|
|
48
48
|
async function runCLI(cliArgs) {
|
|
49
49
|
const program = await createCLIProgram({
|
package/lib/commands/deploy.js
CHANGED
|
@@ -23,7 +23,7 @@ function obfuscateGitPass(str) {
|
|
|
23
23
|
}
|
|
24
24
|
const debugMode = !!process.env.DOCUSAURUS_DEPLOY_DEBUG;
|
|
25
25
|
// Log executed commands so that user can figure out mistakes on his own
|
|
26
|
-
// for example: https://github.com/
|
|
26
|
+
// for example: https://github.com/meta/docusaurus/issues/3875
|
|
27
27
|
async function exec(file, args, options) {
|
|
28
28
|
const log = options?.log ?? true;
|
|
29
29
|
const failfast = options?.failfast ?? true;
|
package/lib/commands/serve.js
CHANGED
|
@@ -53,10 +53,10 @@ async function serve(siteDirParam = '.', cliOptions = {}) {
|
|
|
53
53
|
}
|
|
54
54
|
// We do the redirect ourselves for a good reason
|
|
55
55
|
// server-handler is annoying and won't include /baseUrl/ in redirects
|
|
56
|
-
// See https://github.com/
|
|
56
|
+
// See https://github.com/meta/docusaurus/issues/10078#issuecomment-2084932934
|
|
57
57
|
if (baseUrl !== '/') {
|
|
58
58
|
// Not super robust, but should be good enough for our use case
|
|
59
|
-
// See https://github.com/
|
|
59
|
+
// See https://github.com/meta/docusaurus/pull/10090
|
|
60
60
|
const looksLikeAsset = !!req.url.match(/\.[a-z\d]{1,4}$/i);
|
|
61
61
|
if (!looksLikeAsset) {
|
|
62
62
|
const normalizedUrl = (0, utils_common_1.applyTrailingSlash)(req.url, {
|
|
@@ -74,7 +74,7 @@ async function serve(siteDirParam = '.', cliOptions = {}) {
|
|
|
74
74
|
// Note server-handler is really annoying here:
|
|
75
75
|
// - no easy way to do rewrites such as "/baseUrl/:path" => "/:path"
|
|
76
76
|
// - no easy way to "reapply" the baseUrl to the redirect "Location" header
|
|
77
|
-
// See also https://github.com/
|
|
77
|
+
// See also https://github.com/meta/docusaurus/pull/10090
|
|
78
78
|
req.url = req.url.replace(baseUrl, '/');
|
|
79
79
|
(0, serve_handler_1.default)(req, res, {
|
|
80
80
|
cleanUrls: true,
|
|
@@ -17,7 +17,7 @@ async function doStart(siteDirParam = '.', cliOptions = {}) {
|
|
|
17
17
|
logger_1.default.info('Starting the development server...');
|
|
18
18
|
// Temporary workaround to unlock the ability to translate the site config
|
|
19
19
|
// We'll remove it if a better official API can be designed
|
|
20
|
-
// See https://github.com/
|
|
20
|
+
// See https://github.com/meta/docusaurus/issues/4542
|
|
21
21
|
process.env.DOCUSAURUS_CURRENT_LOCALE = cliOptions.locale;
|
|
22
22
|
const reloadableSite = await (0, utils_1.createReloadableSite)({ siteDirParam, cliOptions });
|
|
23
23
|
(0, watcher_1.setupSiteFileWatchers)({ props: reloadableSite.get().props, cliOptions }, ({ plugin }) => {
|
|
@@ -20,7 +20,7 @@ const site_1 = require("../../server/site");
|
|
|
20
20
|
const pluginsUtils_1 = require("../../server/plugins/pluginsUtils");
|
|
21
21
|
// This code was historically in CRA/react-dev-utils (deprecated in 2025)
|
|
22
22
|
// We internalized it, refactored and removed useless code paths
|
|
23
|
-
// See https://github.com/
|
|
23
|
+
// See https://github.com/meta/docusaurus/pull/10956
|
|
24
24
|
// See https://github.com/facebook/create-react-app/blob/main/packages/react-dev-utils/WebpackDevServerUtils.js
|
|
25
25
|
function getOpenUrlOrigin(protocol, host, port) {
|
|
26
26
|
const isUnspecifiedHost = host === '0.0.0.0' || host === '::';
|
|
@@ -58,7 +58,7 @@ function createDevServerConfig({ cliOptions, props, host, port, httpsConfig, })
|
|
|
58
58
|
},
|
|
59
59
|
devMiddleware: {
|
|
60
60
|
publicPath: siteConfig.future.experimental_router === 'hash' ? 'auto' : baseUrl,
|
|
61
|
-
// Reduce log verbosity, see https://github.com/
|
|
61
|
+
// Reduce log verbosity, see https://github.com/meta/docusaurus/pull/5420#issuecomment-906613105
|
|
62
62
|
stats: 'summary',
|
|
63
63
|
},
|
|
64
64
|
static: siteConfig.staticDirectories.map((dir) => ({
|
|
@@ -76,7 +76,7 @@ async function eject({ siteDir, themePath, componentName, typescript, }) {
|
|
|
76
76
|
async function wrap({ siteDir, themePath, componentName: themeComponentName, typescript, importType = 'original', }) {
|
|
77
77
|
const isDirectory = await isDir(node_path_1.default.join(themePath, themeComponentName));
|
|
78
78
|
// Top/Parent/ComponentName => ComponentName
|
|
79
|
-
const componentName =
|
|
79
|
+
const componentName = themeComponentName.split('/').at(-1);
|
|
80
80
|
const wrapperComponentName = `${componentName}Wrapper`;
|
|
81
81
|
const wrapperFileName = `${themeComponentName}${isDirectory ? '/index' : ''}${typescript ? '.tsx' : '.js'}`;
|
|
82
82
|
await fs_1.fs.mkdir(node_path_1.default.resolve(siteDir, utils_1.THEME_PATH), { recursive: true });
|
|
@@ -19,7 +19,7 @@ export type ThemeComponents = {
|
|
|
19
19
|
* Expand a list of components to include and return parent folders.
|
|
20
20
|
* If a folder is not directly a component (no Folder/index.tsx file),
|
|
21
21
|
* we still want to be able to swizzle --eject that folder.
|
|
22
|
-
* See https://github.com/
|
|
22
|
+
* See https://github.com/meta/docusaurus/pull/7175#issuecomment-1103757218
|
|
23
23
|
*
|
|
24
24
|
* @param componentNames the original list of component names
|
|
25
25
|
*/
|
|
@@ -28,7 +28,7 @@ function sortComponentNames(componentNames) {
|
|
|
28
28
|
* Expand a list of components to include and return parent folders.
|
|
29
29
|
* If a folder is not directly a component (no Folder/index.tsx file),
|
|
30
30
|
* we still want to be able to swizzle --eject that folder.
|
|
31
|
-
* See https://github.com/
|
|
31
|
+
* See https://github.com/meta/docusaurus/pull/7175#issuecomment-1103757218
|
|
32
32
|
*
|
|
33
33
|
* @param componentNames the original list of component names
|
|
34
34
|
*/
|
|
@@ -37,8 +37,8 @@ function getMissingIntermediateComponentFolderNames(componentNames) {
|
|
|
37
37
|
const paths = componentName.split('/');
|
|
38
38
|
return lodash_1.default.range(1, paths.length + 1).map((i) => paths.slice(0, i).join('/'));
|
|
39
39
|
}
|
|
40
|
-
const expandedComponentNames =
|
|
41
|
-
return
|
|
40
|
+
const expandedComponentNames = new Set(componentNames.flatMap((componentName) => getAllIntermediatePaths(componentName)));
|
|
41
|
+
return [...expandedComponentNames.difference(new Set(componentNames))];
|
|
42
42
|
}
|
|
43
43
|
const skipReadDirNames = ['__test__', '__tests__', '__mocks__', '__fixtures__'];
|
|
44
44
|
async function readComponentNames(themePath) {
|
|
@@ -41,7 +41,7 @@ Warning: we may release breaking changes within minor version upgrades.
|
|
|
41
41
|
You will have to upgrade your component manually and maintain it over time.
|
|
42
42
|
|
|
43
43
|
${logger_1.default.green('Tip')}: your customization can't be done in a ${tableStatusLabel('safe')} way?
|
|
44
|
-
Report it here: https://github.com/
|
|
44
|
+
Report it here: https://github.com/meta/docusaurus/discussions/5468
|
|
45
45
|
`,
|
|
46
46
|
],
|
|
47
47
|
}, {
|
|
@@ -31,12 +31,14 @@ function getPluginByThemeName(plugins, themeName) {
|
|
|
31
31
|
return plugin;
|
|
32
32
|
}
|
|
33
33
|
function getThemeNames(plugins) {
|
|
34
|
-
const themeNames =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
const themeNames = [
|
|
35
|
+
...new Set(
|
|
36
|
+
// The fact that getThemePath is attached to the plugin instance makes
|
|
37
|
+
// this code impossible to optimize. If this is a static method, we don't
|
|
38
|
+
// need to initialize all plugins just to filter which are themes
|
|
39
|
+
// Benchmark: loadContext-58ms; initPlugins-323ms
|
|
40
|
+
plugins.map((plugin) => pluginToThemeName(plugin)).filter(Boolean)),
|
|
41
|
+
];
|
|
40
42
|
// Opinionated ordering: user is most likely to swizzle:
|
|
41
43
|
// - the classic theme
|
|
42
44
|
// - official themes
|
|
@@ -10,7 +10,7 @@ exports.default = openBrowser;
|
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
11
|
// This code was initially in CRA/react-dev-utils (deprecated in 2025)
|
|
12
12
|
// We copied and refactored it
|
|
13
|
-
// See https://github.com/
|
|
13
|
+
// See https://github.com/meta/docusaurus/pull/10956
|
|
14
14
|
// See https://github.com/facebook/create-react-app/blob/main/packages/react-dev-utils/openBrowser.js
|
|
15
15
|
/* eslint-disable */
|
|
16
16
|
const node_child_process_1 = require("node:child_process");
|
|
@@ -52,11 +52,11 @@ async function tryOpenWithAppleScript({ url, browser, }) {
|
|
|
52
52
|
// Among all the supported browsers, retrieves to stdout the active ones
|
|
53
53
|
const command = `ps cax -o command | grep -E "^(${supportedChromiumBrowsers.join('|')})$"`;
|
|
54
54
|
// Promise.try() also catches errors thrown synchronously
|
|
55
|
-
// See https://github.com/
|
|
55
|
+
// See https://github.com/meta/docusaurus/issues/11204#issuecomment-3073480330
|
|
56
56
|
const result = await Promise.try(() => execPromise(command)).catch(() => {
|
|
57
57
|
// Ignore all errors
|
|
58
58
|
// In particular grep errors when macOS user has no Chromium-based browser open
|
|
59
|
-
// See https://github.com/
|
|
59
|
+
// See https://github.com/meta/docusaurus/issues/11204
|
|
60
60
|
});
|
|
61
61
|
if (!result) {
|
|
62
62
|
return [];
|
|
@@ -20,7 +20,7 @@ on run argv
|
|
|
20
20
|
end if
|
|
21
21
|
|
|
22
22
|
-- Arc: simple open + activate, no tab reuse
|
|
23
|
-
-- See https://github.com/
|
|
23
|
+
-- See https://github.com/meta/docusaurus/issues/11582
|
|
24
24
|
if theProgram is "Arc" then
|
|
25
25
|
tell application "Arc"
|
|
26
26
|
activate
|
|
@@ -38,7 +38,7 @@ function safeDecodeURIComponent(value) {
|
|
|
38
38
|
function createBrokenLinksHelper({ collectedLinks, routes, }) {
|
|
39
39
|
const validPathnames = new Set(collectedLinks.keys());
|
|
40
40
|
// IMPORTANT: this is an optimization
|
|
41
|
-
// See https://github.com/
|
|
41
|
+
// See https://github.com/meta/docusaurus/issues/9754
|
|
42
42
|
// Matching against the route array can be expensive
|
|
43
43
|
// If the route is already in the valid pathnames,
|
|
44
44
|
// we can avoid matching against it
|
|
@@ -64,7 +64,7 @@ function createBrokenLinksHelper({ collectedLinks, routes, }) {
|
|
|
64
64
|
function isPathnameMatchingAnyRoute(pathname) {
|
|
65
65
|
if (matchRoutes(remainingRoutes, pathname).length > 0) {
|
|
66
66
|
// IMPORTANT: this is an optimization
|
|
67
|
-
// See https://github.com/
|
|
67
|
+
// See https://github.com/meta/docusaurus/issues/9754
|
|
68
68
|
// Large Docusaurus sites have many routes!
|
|
69
69
|
// We try to minimize calls to a possibly expensive matchRoutes function
|
|
70
70
|
validPathnames.add(pathname);
|
|
@@ -90,7 +90,7 @@ function createBrokenLinksHelper({ collectedLinks, routes, }) {
|
|
|
90
90
|
}
|
|
91
91
|
// Link has empty hash ("#", "/page#"...): we do not report it as broken
|
|
92
92
|
// Empty hashes are used for various weird reasons, by us and other users...
|
|
93
|
-
// See for example: https://github.com/
|
|
93
|
+
// See for example: https://github.com/meta/docusaurus/pull/6003
|
|
94
94
|
if (hash === '') {
|
|
95
95
|
return false;
|
|
96
96
|
}
|
|
@@ -98,7 +98,7 @@ function createBrokenLinksHelper({ collectedLinks, routes, }) {
|
|
|
98
98
|
collectedLinks.get(safeDecodeURI(pathname)) ??
|
|
99
99
|
// The broken link checker should not care about a trailing slash
|
|
100
100
|
// Those are already covered by the broken pathname checker
|
|
101
|
-
// See https://github.com/
|
|
101
|
+
// See https://github.com/meta/docusaurus/issues/10116
|
|
102
102
|
collectedLinks.get((0, utils_common_1.addTrailingSlash)(pathname)) ??
|
|
103
103
|
collectedLinks.get((0, utils_common_1.addTrailingSlash)(safeDecodeURI(pathname))) ??
|
|
104
104
|
collectedLinks.get((0, utils_common_1.removeTrailingSlash)(pathname)) ??
|
|
@@ -211,7 +211,7 @@ function createBrokenPathsMessage(brokenPathsMap) {
|
|
|
211
211
|
/**
|
|
212
212
|
* If there's a broken link appearing very often, it is probably a broken link
|
|
213
213
|
* on the layout. Add an additional message in such case to help user figure
|
|
214
|
-
* this out. See https://github.com/
|
|
214
|
+
* this out. See https://github.com/meta/docusaurus/issues/3567#issuecomment-706973805
|
|
215
215
|
*/
|
|
216
216
|
function getLayoutBrokenLinksHelpMessage() {
|
|
217
217
|
const flatList = Object.entries(brokenPathsMap).flatMap(([pagePage, brokenLinks]) => brokenLinks.map((brokenLink) => ({ pagePage, brokenLink })));
|
|
@@ -122,7 +122,7 @@ function genRouteCode(routeConfig, res, index, level) {
|
|
|
122
122
|
${JSON.stringify(routeConfig)}`);
|
|
123
123
|
}
|
|
124
124
|
// Because 2 routes with the same path could lead to hash collisions
|
|
125
|
-
// See https://github.com/
|
|
125
|
+
// See https://github.com/meta/docusaurus/issues/10718#issuecomment-2498516394
|
|
126
126
|
function generateUniqueRouteKey() {
|
|
127
127
|
const hashes = [
|
|
128
128
|
// // OG algo to keep former snapshots
|
|
@@ -142,7 +142,7 @@ ${JSON.stringify(routeConfig)}`);
|
|
|
142
142
|
}
|
|
143
143
|
throw new Error(`Docusaurus couldn't generate a unique hash for route ${routeConfig.path} (level=${level} - index=${index}).
|
|
144
144
|
This is a bug, please report it here!
|
|
145
|
-
https://github.com/
|
|
145
|
+
https://github.com/meta/docusaurus/issues/10718`);
|
|
146
146
|
}
|
|
147
147
|
const { routeKey, routeHash } = generateUniqueRouteKey();
|
|
148
148
|
res.routesChunkNames[routeKey] = {
|
|
@@ -204,7 +204,7 @@ ${Object.entries(registry)
|
|
|
204
204
|
const genRoutesChunkNames = ({ generatedFilesDir, routesChunkNames, }) => (0, utils_1.generate)(generatedFilesDir, 'routesChunkNames.json', JSON.stringify(routesChunkNames, null, 2));
|
|
205
205
|
const genRoutes = ({ generatedFilesDir, routesConfig, }) => (0, utils_1.generate)(generatedFilesDir, 'routes.js', routesConfig);
|
|
206
206
|
// The generated filename per route must be unique to avoid conflicts
|
|
207
|
-
// See also https://github.com/
|
|
207
|
+
// See also https://github.com/meta/docusaurus/issues/10125
|
|
208
208
|
function generateRoutePropFilename(route) {
|
|
209
209
|
// TODO if possible, we could try to shorten the filename by removing
|
|
210
210
|
// the plugin routeBasePath prefix from the name
|
|
@@ -231,7 +231,9 @@ function ensureNoPropsConflict(route) {
|
|
|
231
231
|
if (!route.props && !route.modules) {
|
|
232
232
|
return;
|
|
233
233
|
}
|
|
234
|
-
const
|
|
234
|
+
const propNames = new Set(Object.keys(route.props ?? {}));
|
|
235
|
+
const moduleNames = new Set(Object.keys(route.modules ?? {}));
|
|
236
|
+
const conflictingPropNames = [...propNames.intersection(moduleNames)];
|
|
235
237
|
if (conflictingPropNames.length > 0) {
|
|
236
238
|
throw new Error(`Route ${route.path} has conflicting props declared using both route.modules and route.props APIs for keys: ${conflictingPropNames.join(', ')}\nThis is not permitted, otherwise one prop would override the over.`);
|
|
237
239
|
}
|
|
@@ -56,7 +56,7 @@ const DEFAULT_MARKDOWN_HOOKS = {
|
|
|
56
56
|
const DEFAULT_MARKDOWN_CONFIG = {
|
|
57
57
|
// TODO Docusaurus v5: change this to "detect"?
|
|
58
58
|
// we probably need stable CommonMark support first
|
|
59
|
-
// see https://github.com/
|
|
59
|
+
// see https://github.com/meta/docusaurus/issues/9092
|
|
60
60
|
format: 'mdx',
|
|
61
61
|
mermaid: false,
|
|
62
62
|
emoji: true,
|
|
@@ -310,7 +310,7 @@ exports.ConfigSchema = utils_validation_1.Joi.object({
|
|
|
310
310
|
async: utils_validation_1.Joi.bool(),
|
|
311
311
|
defer: utils_validation_1.Joi.bool(),
|
|
312
312
|
})
|
|
313
|
-
// See https://github.com/
|
|
313
|
+
// See https://github.com/meta/docusaurus/issues/3378
|
|
314
314
|
.unknown())
|
|
315
315
|
.messages({
|
|
316
316
|
'array.includes': '{#label} is invalid. A script must be a plain string (the src), or an object with at least a "src" property.',
|
package/lib/server/i18n.js
CHANGED
|
@@ -49,16 +49,8 @@ function getDefaultCalendar(localeStr) {
|
|
|
49
49
|
if (locale.calendar) {
|
|
50
50
|
return locale.calendar;
|
|
51
51
|
}
|
|
52
|
-
//
|
|
53
|
-
|
|
54
|
-
// See https://caniuse.com/mdn-javascript_builtins_intl_locale_getcalendars
|
|
55
|
-
const calendars = locale.getCalendars?.() ??
|
|
56
|
-
// @ts-expect-error: non-std attribute (V8/Chromium/Node)
|
|
57
|
-
locale.calendars;
|
|
58
|
-
if (calendars instanceof Array && calendars[0]) {
|
|
59
|
-
return calendars[0];
|
|
60
|
-
}
|
|
61
|
-
return 'gregory';
|
|
52
|
+
// Calendars are sorted by preference
|
|
53
|
+
return locale.getCalendars()[0] ?? 'gregory';
|
|
62
54
|
}
|
|
63
55
|
function getDefaultDirection(localeStr) {
|
|
64
56
|
const locale = new Intl.Locale(localeStr);
|
|
@@ -79,7 +71,7 @@ htmlLang) {
|
|
|
79
71
|
htmlLang: htmlLang ?? locale,
|
|
80
72
|
calendar: getDefaultCalendar(htmlLang ?? locale),
|
|
81
73
|
// Fot the i18n/<path>, we don't use htmlLang on purpose
|
|
82
|
-
// see bug https://github.com/
|
|
74
|
+
// see bug https://github.com/meta/docusaurus/issues/11952
|
|
83
75
|
path: locale,
|
|
84
76
|
};
|
|
85
77
|
}
|
|
@@ -91,7 +91,7 @@ async function initPluginsConfigs(context, pluginConfigs) {
|
|
|
91
91
|
const pluginInstance = await normalizedPluginConfig.plugin(context, pluginOptions);
|
|
92
92
|
// Returning null has been explicitly allowed
|
|
93
93
|
// It's a way for plugins to self-disable depending on context
|
|
94
|
-
// See https://github.com/
|
|
94
|
+
// See https://github.com/meta/docusaurus/pull/10286
|
|
95
95
|
if (pluginInstance === null) {
|
|
96
96
|
return { config: normalizedPluginConfig, plugin: null };
|
|
97
97
|
}
|
|
@@ -7,18 +7,16 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.ensureUniquePluginInstanceIds = ensureUniquePluginInstanceIds;
|
|
10
|
-
const tslib_1 = require("tslib");
|
|
11
|
-
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
12
10
|
const utils_1 = require("@docusaurus/utils");
|
|
13
11
|
/**
|
|
14
12
|
* It is forbidden to have 2 plugins of the same name sharing the same ID.
|
|
15
13
|
* This is required to support multi-instance plugins without conflict.
|
|
16
14
|
*/
|
|
17
15
|
function ensureUniquePluginInstanceIds(plugins) {
|
|
18
|
-
const pluginsByName =
|
|
19
|
-
|
|
20
|
-
const pluginInstancesById =
|
|
21
|
-
|
|
16
|
+
const pluginsByName = Map.groupBy(plugins, (p) => p.name);
|
|
17
|
+
pluginsByName.forEach((pluginInstances, pluginName) => {
|
|
18
|
+
const pluginInstancesById = Map.groupBy(pluginInstances, (p) => p.options.id ?? utils_1.DEFAULT_PLUGIN_ID);
|
|
19
|
+
pluginInstancesById.forEach((pluginInstancesWithId, pluginId) => {
|
|
22
20
|
if (pluginInstancesWithId.length !== 1) {
|
|
23
21
|
throw new Error(`Plugin "${pluginName}" is used ${pluginInstancesWithId.length} times with ID "${pluginId}".\nTo use the same plugin multiple times on a Docusaurus site, you need to assign a unique ID to each plugin instance.${pluginId === utils_1.DEFAULT_PLUGIN_ID
|
|
24
22
|
? `\n\nThe plugin ID is "${utils_1.DEFAULT_PLUGIN_ID}" by default. It's possible that the preset you are using already includes a plugin instance, in which case you either want to disable the plugin in the preset (to use a single instance), or assign another ID to your extra plugin instance (to use multiple instances).`
|
package/lib/server/site.js
CHANGED
|
@@ -69,7 +69,7 @@ async function loadContext(params) {
|
|
|
69
69
|
// The site baseUrl should be 100% decoupled from the file system output shape
|
|
70
70
|
// We added this logic to restore v3 retro-compatibility, because by default
|
|
71
71
|
// Docusaurus always wrote to ./build for sites having a baseUrl
|
|
72
|
-
// See also https://github.com/
|
|
72
|
+
// See also https://github.com/meta/docusaurus/issues/11433
|
|
73
73
|
// This logic assumes the locale baseUrl will start with the site baseUrl
|
|
74
74
|
// which is the case if an explicit locale baseUrl is not provided
|
|
75
75
|
// but in practice a custom locale baseUrl could be anything now
|
|
@@ -56,8 +56,8 @@ async function loadPluginVersion(pluginPath, siteDir) {
|
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
58
58
|
* We want all `@docusaurus/*` packages to have the exact same version!
|
|
59
|
-
* @see https://github.com/
|
|
60
|
-
* @see https://github.com/
|
|
59
|
+
* @see https://github.com/meta/docusaurus/issues/3371
|
|
60
|
+
* @see https://github.com/meta/docusaurus/pull/3386
|
|
61
61
|
*/
|
|
62
62
|
function checkDocusaurusPackagesVersion(siteMetadata) {
|
|
63
63
|
const { docusaurusVersion } = siteMetadata;
|
|
@@ -70,7 +70,9 @@ function mergeTranslationFileContent({ existingContent = {}, newContent, options
|
|
|
70
70
|
async function writeTranslationFileContent({ filePath, content: newContent, options = {}, }) {
|
|
71
71
|
const existingContent = await readTranslationFileContent(filePath);
|
|
72
72
|
// Warn about potential legacy keys
|
|
73
|
-
const
|
|
73
|
+
const existingKeys = new Set(Object.keys(existingContent ?? {}));
|
|
74
|
+
const newKeys = new Set(Object.keys(newContent));
|
|
75
|
+
const unknownKeys = [...existingKeys.difference(newKeys)];
|
|
74
76
|
if (unknownKeys.length > 0) {
|
|
75
77
|
logger_1.default.warn `Some translation keys looks unknown to us in file path=${filePath}.
|
|
76
78
|
Maybe you should remove them? ${unknownKeys}`;
|
|
@@ -162,7 +164,11 @@ function getPluginsDefaultCodeTranslations({ plugins, }) {
|
|
|
162
164
|
return mergeCodeTranslations(plugins.map((p) => p.defaultCodeTranslations));
|
|
163
165
|
}
|
|
164
166
|
function applyDefaultCodeTranslations({ extractedCodeTranslations, defaultCodeMessages, }) {
|
|
165
|
-
const
|
|
167
|
+
const defaultMessageIds = new Set(Object.keys(defaultCodeMessages));
|
|
168
|
+
const extractedMessageIds = new Set(Object.keys(extractedCodeTranslations));
|
|
169
|
+
const unusedDefaultCodeMessages = [
|
|
170
|
+
...defaultMessageIds.difference(extractedMessageIds),
|
|
171
|
+
];
|
|
166
172
|
if (unusedDefaultCodeMessages.length > 0) {
|
|
167
173
|
logger_1.default.warn `Unused default message codes found.
|
|
168
174
|
Please report this Docusaurus issue. name=${unusedDefaultCodeMessages}`;
|
package/lib/ssg/ssgEnv.js
CHANGED
|
@@ -27,8 +27,8 @@ exports.SSGWorkerThreadTaskSize = process.env
|
|
|
27
27
|
? parseInt(process.env.DOCUSAURUS_SSG_WORKER_THREAD_TASK_SIZE, 10)
|
|
28
28
|
: 10; // TODO need fine-tuning
|
|
29
29
|
// Controls worker thread recycling behavior (maxMemoryLimitBeforeRecycle)
|
|
30
|
-
// See https://github.com/
|
|
31
|
-
// See https://github.com/
|
|
30
|
+
// See https://github.com/meta/docusaurus/pull/11166
|
|
31
|
+
// See https://github.com/meta/docusaurus/issues/11161
|
|
32
32
|
exports.SSGWorkerThreadRecyclerMaxMemory = process.env
|
|
33
33
|
.DOCUSAURUS_SSG_WORKER_THREAD_RECYCLER_MAX_MEMORY
|
|
34
34
|
? parseInt(process.env.DOCUSAURUS_SSG_WORKER_THREAD_RECYCLER_MAX_MEMORY, 10)
|
package/lib/ssg/ssgExecutor.js
CHANGED
|
@@ -81,8 +81,8 @@ async function createSSGExecutor({ params, pathnames, }) {
|
|
|
81
81
|
},
|
|
82
82
|
// WORKER MEMORY MANAGEMENT
|
|
83
83
|
// Allows containing SSG memory leaks with a thread recycling workaround
|
|
84
|
-
// See https://github.com/
|
|
85
|
-
// See https://github.com/
|
|
84
|
+
// See https://github.com/meta/docusaurus/pull/11166
|
|
85
|
+
// See https://github.com/meta/docusaurus/issues/11161
|
|
86
86
|
maxMemoryLimitBeforeRecycle: ssgEnv_1.SSGWorkerThreadRecyclerMaxMemory,
|
|
87
87
|
resourceLimits: {
|
|
88
88
|
// For some reason I can't figure out how to limit memory on a worker
|
|
@@ -12,7 +12,7 @@ const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
|
12
12
|
const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
|
|
13
13
|
function printSSGWarnings(results) {
|
|
14
14
|
// Escape hatch because SWC is quite aggressive to report errors
|
|
15
|
-
// See https://github.com/
|
|
15
|
+
// See https://github.com/meta/docusaurus/pull/10554
|
|
16
16
|
// See https://github.com/swc-project/swc/discussions/9616#discussioncomment-10846201
|
|
17
17
|
if (process.env.DOCUSAURUS_IGNORE_SSG_WARNINGS === 'true') {
|
|
18
18
|
return;
|
|
@@ -28,7 +28,7 @@ function printSSGWarnings(results) {
|
|
|
28
28
|
if (resultsWithWarnings.length) {
|
|
29
29
|
const message = `Docusaurus static site generation process emitted warnings for ${resultsWithWarnings.length} path${resultsWithWarnings.length ? 's' : ''}
|
|
30
30
|
This is non-critical and can be disabled with DOCUSAURUS_IGNORE_SSG_WARNINGS=true
|
|
31
|
-
Troubleshooting guide: https://github.com/
|
|
31
|
+
Troubleshooting guide: https://github.com/meta/docusaurus/discussions/10580
|
|
32
32
|
|
|
33
33
|
- ${resultsWithWarnings
|
|
34
34
|
.map((result) => `${logger_1.default.path(result.pathname)}:
|
package/lib/ssg/ssgRenderer.js
CHANGED
|
@@ -60,7 +60,7 @@ async function loadSSGRenderer({ params, }) {
|
|
|
60
60
|
// Some data (modules, metadata.internal) is only useful to create the HTML file
|
|
61
61
|
// It's not useful to aggregate that collected data in memory
|
|
62
62
|
// Keep this data structure as small as possible
|
|
63
|
-
// See https://github.com/
|
|
63
|
+
// See https://github.com/meta/docusaurus/pull/11162
|
|
64
64
|
function reduceCollectedData(pageCollectedData) {
|
|
65
65
|
// We re-create the object from scratch
|
|
66
66
|
// We absolutely want to avoid TS duck typing
|
|
@@ -16,8 +16,8 @@ type ThemeAliases = {
|
|
|
16
16
|
* This ensures `@theme/NavbarItem` alias is after
|
|
17
17
|
* `@theme/NavbarItem/LocaleDropdown`.
|
|
18
18
|
*
|
|
19
|
-
* @see https://github.com/
|
|
20
|
-
* @see https://github.com/
|
|
19
|
+
* @see https://github.com/meta/docusaurus/pull/3922
|
|
20
|
+
* @see https://github.com/meta/docusaurus/issues/5382
|
|
21
21
|
*/
|
|
22
22
|
export declare function sortAliases(aliases: ThemeAliases): ThemeAliases;
|
|
23
23
|
export declare function createAliasesForTheme(themePath: string, addOriginalAlias: boolean): Promise<ThemeAliases>;
|
|
@@ -22,8 +22,8 @@ const ThemeFallbackDir = node_path_1.default.join(__dirname, '../../client/theme
|
|
|
22
22
|
* This ensures `@theme/NavbarItem` alias is after
|
|
23
23
|
* `@theme/NavbarItem/LocaleDropdown`.
|
|
24
24
|
*
|
|
25
|
-
* @see https://github.com/
|
|
26
|
-
* @see https://github.com/
|
|
25
|
+
* @see https://github.com/meta/docusaurus/pull/3922
|
|
26
|
+
* @see https://github.com/meta/docusaurus/issues/5382
|
|
27
27
|
*/
|
|
28
28
|
function sortAliases(aliases) {
|
|
29
29
|
// Alphabetical order by default
|
package/lib/webpack/base.js
CHANGED
|
@@ -148,7 +148,7 @@ async function createBaseConfig({ props, isServer, minify, configureWebpackUtils
|
|
|
148
148
|
devtool: isProd ? undefined : 'eval-cheap-module-source-map',
|
|
149
149
|
resolve: {
|
|
150
150
|
extensions: ['.wasm', '.mjs', '.js', '.jsx', '.ts', '.tsx', '.json'],
|
|
151
|
-
symlinks: true, // See https://github.com/
|
|
151
|
+
symlinks: true, // See https://github.com/meta/docusaurus/issues/3272
|
|
152
152
|
roots: [
|
|
153
153
|
// Allow resolution of url("/fonts/xyz.ttf") by webpack
|
|
154
154
|
// See https://webpack.js.org/configuration/resolve/#resolveroots
|
|
@@ -183,7 +183,7 @@ async function createBaseConfig({ props, isServer, minify, configureWebpackUtils
|
|
|
183
183
|
// - On the server, it's not useful to run it at all
|
|
184
184
|
// - On the client, we compared assets/js before/after and see 0 change
|
|
185
185
|
// `du -sk js-before js-after` => the JS assets have the exact same size
|
|
186
|
-
// See also https://github.com/
|
|
186
|
+
// See also https://github.com/meta/docusaurus/pull/11176
|
|
187
187
|
mergeDuplicateChunks: false,
|
|
188
188
|
// Only minimize client bundle in production because server bundle is only
|
|
189
189
|
// used for static site generation
|
|
@@ -209,7 +209,7 @@ async function createBaseConfig({ props, isServer, minify, configureWebpackUtils
|
|
|
209
209
|
// Only create one CSS file to avoid
|
|
210
210
|
// problems with code-split CSS loading in different orders
|
|
211
211
|
// causing inconsistent/non-deterministic styling
|
|
212
|
-
// See https://github.com/
|
|
212
|
+
// See https://github.com/meta/docusaurus/issues/2006
|
|
213
213
|
styles: {
|
|
214
214
|
name: 'styles',
|
|
215
215
|
type: 'css/mini-extract',
|
|
@@ -227,7 +227,7 @@ async function createBaseConfig({ props, isServer, minify, configureWebpackUtils
|
|
|
227
227
|
// new URL('./img.png', import.meta.url)
|
|
228
228
|
// Relative URLs are needed for SSR: absolute URLs would otherwise
|
|
229
229
|
// be resolved against the server bundle file:// URL
|
|
230
|
-
// See https://github.com/
|
|
230
|
+
// See https://github.com/meta/docusaurus/pull/12655
|
|
231
231
|
url: 'relative',
|
|
232
232
|
},
|
|
233
233
|
},
|
|
@@ -256,7 +256,7 @@ async function createBaseConfig({ props, isServer, minify, configureWebpackUtils
|
|
|
256
256
|
use: configureWebpackUtils.getStyleLoaders(isServer, {
|
|
257
257
|
modules: {
|
|
258
258
|
// Using the same CSS Module class pattern in dev/prod on purpose
|
|
259
|
-
// See https://github.com/
|
|
259
|
+
// See https://github.com/meta/docusaurus/pull/10423
|
|
260
260
|
localIdentName: `[local]_[contenthash:base64:4]`,
|
|
261
261
|
exportOnlyLocals: isServer,
|
|
262
262
|
// Export CSS module class names compatible with css-loader v6
|
package/lib/webpack/client.js
CHANGED
|
@@ -69,7 +69,7 @@ async function createStartClientConfig({ props, minify, poll, configureWebpackUt
|
|
|
69
69
|
poll,
|
|
70
70
|
},
|
|
71
71
|
infrastructureLogging: {
|
|
72
|
-
// Reduce log verbosity, see https://github.com/
|
|
72
|
+
// Reduce log verbosity, see https://github.com/meta/docusaurus/pull/5420#issuecomment-906613105
|
|
73
73
|
level: 'warn',
|
|
74
74
|
},
|
|
75
75
|
plugins: [
|
package/lib/webpack/configure.js
CHANGED
|
@@ -103,7 +103,7 @@ function executePluginsConfigureWebpack({ plugins, config: configInput, isServer
|
|
|
103
103
|
// Step2 - For client code, configure PostCSS
|
|
104
104
|
// The order matters! We want to configure PostCSS on loaders
|
|
105
105
|
// that were potentially added by configureWebpack
|
|
106
|
-
// See https://github.com/
|
|
106
|
+
// See https://github.com/meta/docusaurus/issues/10106
|
|
107
107
|
// Note: it's useless to configure postCSS for the server
|
|
108
108
|
if (!isServer) {
|
|
109
109
|
config = executePluginsConfigurePostCss({
|
|
@@ -13,7 +13,7 @@ const fs_1 = require("@docusaurus/fs");
|
|
|
13
13
|
// Bundle CPU profiling plugin, contributed by the Rspack team
|
|
14
14
|
// Can be opened in https://www.speedscope.app/
|
|
15
15
|
// See also https://github.com/jerrykingxyz/docusaurus/pull/1
|
|
16
|
-
// See also https://github.com/
|
|
16
|
+
// See also https://github.com/meta/docusaurus/pull/10985
|
|
17
17
|
class BundlerCPUProfilerPlugin {
|
|
18
18
|
constructor(output) {
|
|
19
19
|
this.output = output ?? './bundler-cpu-profile.json';
|
|
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
10
10
|
// gca = Get Chunk Asset, it converts a chunkName to a JS asset URL
|
|
11
11
|
// It is called in Core client/docusaurus.ts for chunk preloading/prefetching
|
|
12
12
|
// Example: gca("814f3328") = "/baseUrl/assets/js/814f3328.03fcc178.js"
|
|
13
|
-
// See also: https://github.com/
|
|
13
|
+
// See also: https://github.com/meta/docusaurus/pull/10485
|
|
14
14
|
// The name of the custom Docusaurus Webpack runtime function
|
|
15
15
|
const DocusaurusGetChunkAssetFn = '__webpack_require__.gca';
|
|
16
16
|
const PluginName = 'Docusaurus-ChunkAssetPlugin';
|
|
@@ -42,7 +42,7 @@ async function createStaticDirectoriesCopyPlugin({ props, }) {
|
|
|
42
42
|
to: '.',
|
|
43
43
|
info: {
|
|
44
44
|
// Prevents Webpack from minimizing static files (js/css)
|
|
45
|
-
// see https://github.com/
|
|
45
|
+
// see https://github.com/meta/docusaurus/pull/10658
|
|
46
46
|
// see https://github.com/webpack-contrib/copy-webpack-plugin#skip-running-javascript-files-through-a-minimizer
|
|
47
47
|
minimized: true,
|
|
48
48
|
},
|
package/lib/webpack/server.js
CHANGED
|
@@ -47,9 +47,9 @@ async function createServerConfig({ props, configureWebpackUtils, }) {
|
|
|
47
47
|
// - On the server, it's not useful to run it at all
|
|
48
48
|
// - On the client, it leads to a ~3% JS assets total size decrease
|
|
49
49
|
// Let's keep it by default, but large sites may prefer faster builds
|
|
50
|
-
// See also https://github.com/
|
|
50
|
+
// See also https://github.com/meta/docusaurus/pull/11176
|
|
51
51
|
// Note: we don't want to enable it on the client for "docusaurus start"
|
|
52
|
-
// See also https://github.com/
|
|
52
|
+
// See also https://github.com/meta/docusaurus/pull/11222
|
|
53
53
|
concatenateModules: false,
|
|
54
54
|
},
|
|
55
55
|
});
|
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-
|
|
4
|
+
"version": "4.0.0-canary-7029",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -17,27 +17,27 @@
|
|
|
17
17
|
],
|
|
18
18
|
"repository": {
|
|
19
19
|
"type": "git",
|
|
20
|
-
"url": "https://github.com/
|
|
20
|
+
"url": "https://github.com/meta/docusaurus.git",
|
|
21
21
|
"directory": "packages/docusaurus"
|
|
22
22
|
},
|
|
23
23
|
"bin": {
|
|
24
24
|
"docusaurus": "bin/docusaurus.mjs"
|
|
25
25
|
},
|
|
26
26
|
"bugs": {
|
|
27
|
-
"url": "https://github.com/
|
|
27
|
+
"url": "https://github.com/meta/docusaurus/issues"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@docusaurus/babel": "4.0.0-canary-
|
|
31
|
-
"@docusaurus/bundler": "4.0.0-canary-
|
|
32
|
-
"@docusaurus/fs": "4.0.0-canary-
|
|
33
|
-
"@docusaurus/glob": "4.0.0-canary-
|
|
34
|
-
"@docusaurus/logger": "4.0.0-canary-
|
|
35
|
-
"@docusaurus/mdx-loader": "4.0.0-canary-
|
|
36
|
-
"@docusaurus/utils": "4.0.0-canary-
|
|
37
|
-
"@docusaurus/utils-common": "4.0.0-canary-
|
|
38
|
-
"@docusaurus/utils-validation": "4.0.0-canary-
|
|
39
|
-
"@rspack/core": "^2.
|
|
40
|
-
"@rspack/dev-server": "^2.2.
|
|
30
|
+
"@docusaurus/babel": "4.0.0-canary-7029",
|
|
31
|
+
"@docusaurus/bundler": "4.0.0-canary-7029",
|
|
32
|
+
"@docusaurus/fs": "4.0.0-canary-7029",
|
|
33
|
+
"@docusaurus/glob": "4.0.0-canary-7029",
|
|
34
|
+
"@docusaurus/logger": "4.0.0-canary-7029",
|
|
35
|
+
"@docusaurus/mdx-loader": "4.0.0-canary-7029",
|
|
36
|
+
"@docusaurus/utils": "4.0.0-canary-7029",
|
|
37
|
+
"@docusaurus/utils-common": "4.0.0-canary-7029",
|
|
38
|
+
"@docusaurus/utils-validation": "4.0.0-canary-7029",
|
|
39
|
+
"@rspack/core": "^2.3.0",
|
|
40
|
+
"@rspack/dev-server": "^2.2.2",
|
|
41
41
|
"boxen": "^9.0.0",
|
|
42
42
|
"cli-table3": "^0.6.5",
|
|
43
43
|
"combine-promises": "^1.2.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-
|
|
72
|
-
"@docusaurus/types": "4.0.0-canary-
|
|
71
|
+
"@docusaurus/module-type-aliases": "4.0.0-canary-7029",
|
|
72
|
+
"@docusaurus/types": "4.0.0-canary-7029",
|
|
73
73
|
"@total-typescript/shoehorn": "^0.1.2",
|
|
74
74
|
"@types/escape-html": "^1.0.4",
|
|
75
75
|
"@types/history": "^4.7.11",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"react-dom": "^19.3.0"
|
|
89
89
|
},
|
|
90
90
|
"engines": {
|
|
91
|
-
"node": ">=
|
|
91
|
+
"node": ">=26.13"
|
|
92
92
|
},
|
|
93
93
|
"scripts": {
|
|
94
94
|
"build": "tsc --build && copy-untyped-files",
|