mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-22 21:47:01 +02:00
feat(core): Docusaurus Faster - Rspack Persistent Cache (#10931)
This commit is contained in:
parent
5b848cb2f0
commit
e641568e7f
13 changed files with 285 additions and 95 deletions
6
.github/workflows/tests-e2e.yml
vendored
6
.github/workflows/tests-e2e.yml
vendored
|
@ -68,7 +68,7 @@ jobs:
|
|||
env:
|
||||
# Our website should build even with limited memory
|
||||
# See https://github.com/facebook/docusaurus/pull/10590
|
||||
NODE_OPTIONS: '--max-old-space-size=250'
|
||||
NODE_OPTIONS: '--max-old-space-size=300'
|
||||
DOCUSAURUS_PERF_LOGGER: 'true'
|
||||
working-directory: ../test-website
|
||||
|
||||
|
@ -181,7 +181,7 @@ jobs:
|
|||
env:
|
||||
# Our website should build even with limited memory
|
||||
# See https://github.com/facebook/docusaurus/pull/10590
|
||||
NODE_OPTIONS: '--max-old-space-size=250'
|
||||
NODE_OPTIONS: '--max-old-space-size=300'
|
||||
DOCUSAURUS_PERF_LOGGER: 'true'
|
||||
working-directory: ../test-website
|
||||
|
||||
|
@ -223,6 +223,6 @@ jobs:
|
|||
env:
|
||||
# Our website should build even with limited memory
|
||||
# See https://github.com/facebook/docusaurus/pull/10590
|
||||
NODE_OPTIONS: '--max-old-space-size=250'
|
||||
NODE_OPTIONS: '--max-old-space-size=300'
|
||||
DOCUSAURUS_PERF_LOGGER: 'true'
|
||||
working-directory: ../test-website
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@docusaurus/types": "3.7.0",
|
||||
"@rspack/core": "^1.2.2",
|
||||
"@rspack/core": "^1.2.5",
|
||||
"@swc/core": "^1.7.39",
|
||||
"@swc/html": "^1.7.39",
|
||||
"browserslist": "^4.24.2",
|
||||
|
|
|
@ -76,7 +76,14 @@ async function createMdxLoaderDependencyFile({
|
|||
dataDir: string;
|
||||
options: PluginOptions;
|
||||
versionsMetadata: VersionMetadata[];
|
||||
}) {
|
||||
}): Promise<string | undefined> {
|
||||
// TODO this has been temporarily made opt-in until Rspack cache bug is fixed
|
||||
// See https://github.com/facebook/docusaurus/pull/10931
|
||||
// See https://github.com/facebook/docusaurus/pull/10934#issuecomment-2672253145
|
||||
if (!process.env.DOCUSAURUS_ENABLE_MDX_DEPENDENCY_FILE) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const filePath = path.join(dataDir, '__mdx-loader-dependency.json');
|
||||
// the cache is invalidated whenever this file content changes
|
||||
const fileContent = {
|
||||
|
@ -138,7 +145,7 @@ export default async function pluginContentDocs(
|
|||
options,
|
||||
versionsMetadata,
|
||||
}),
|
||||
],
|
||||
].filter((d): d is string => typeof d === 'string'),
|
||||
|
||||
useCrossCompilerCache:
|
||||
siteConfig.future.experimental_faster.mdxCrossCompilerCache,
|
||||
|
|
1
packages/docusaurus-types/src/config.d.ts
vendored
1
packages/docusaurus-types/src/config.d.ts
vendored
|
@ -130,6 +130,7 @@ export type FasterConfig = {
|
|||
lightningCssMinimizer: boolean;
|
||||
mdxCrossCompilerCache: boolean;
|
||||
rspackBundler: boolean;
|
||||
rspackPersistentCache: boolean;
|
||||
ssgWorkerThreads: boolean;
|
||||
};
|
||||
|
||||
|
|
|
@ -19,7 +19,10 @@ async function removePath(entry: {path: string; description: string}) {
|
|||
}
|
||||
try {
|
||||
await fs.remove(entry.path);
|
||||
logger.success`Removed the ${entry.description} at path=${entry.path}.`;
|
||||
logger.success`Removed the ${entry.description} at path=${path.relative(
|
||||
process.cwd(),
|
||||
entry.path,
|
||||
)}.`;
|
||||
} catch (err) {
|
||||
logger.error`Could not remove the ${entry.description} at path=${entry.path}.`;
|
||||
logger.error(err);
|
||||
|
@ -40,7 +43,7 @@ export async function clear(siteDirParam: string = '.'): Promise<void> {
|
|||
// In Yarn PnP, cache is stored in `.yarn/.cache` because n_m doesn't exist
|
||||
const cacheFolders = ['node_modules', '.yarn'].map((p) => ({
|
||||
path: path.join(siteDir, p, '.cache'),
|
||||
description: 'Webpack persistent cache folder',
|
||||
description: 'bundler persistent cache folder',
|
||||
}));
|
||||
await Promise.all(
|
||||
[generatedFolder, buildFolder, ...cacheFolders].map(removePath),
|
||||
|
|
|
@ -12,6 +12,7 @@ exports[`loadSiteConfig website with .cjs siteConfig 1`] = `
|
|||
"lightningCssMinimizer": false,
|
||||
"mdxCrossCompilerCache": false,
|
||||
"rspackBundler": false,
|
||||
"rspackPersistentCache": false,
|
||||
"ssgWorkerThreads": false,
|
||||
"swcHtmlMinimizer": false,
|
||||
"swcJsLoader": false,
|
||||
|
@ -85,6 +86,7 @@ exports[`loadSiteConfig website with ts + js config 1`] = `
|
|||
"lightningCssMinimizer": false,
|
||||
"mdxCrossCompilerCache": false,
|
||||
"rspackBundler": false,
|
||||
"rspackPersistentCache": false,
|
||||
"ssgWorkerThreads": false,
|
||||
"swcHtmlMinimizer": false,
|
||||
"swcJsLoader": false,
|
||||
|
@ -158,6 +160,7 @@ exports[`loadSiteConfig website with valid JS CJS config 1`] = `
|
|||
"lightningCssMinimizer": false,
|
||||
"mdxCrossCompilerCache": false,
|
||||
"rspackBundler": false,
|
||||
"rspackPersistentCache": false,
|
||||
"ssgWorkerThreads": false,
|
||||
"swcHtmlMinimizer": false,
|
||||
"swcJsLoader": false,
|
||||
|
@ -231,6 +234,7 @@ exports[`loadSiteConfig website with valid JS ESM config 1`] = `
|
|||
"lightningCssMinimizer": false,
|
||||
"mdxCrossCompilerCache": false,
|
||||
"rspackBundler": false,
|
||||
"rspackPersistentCache": false,
|
||||
"ssgWorkerThreads": false,
|
||||
"swcHtmlMinimizer": false,
|
||||
"swcJsLoader": false,
|
||||
|
@ -304,6 +308,7 @@ exports[`loadSiteConfig website with valid TypeScript CJS config 1`] = `
|
|||
"lightningCssMinimizer": false,
|
||||
"mdxCrossCompilerCache": false,
|
||||
"rspackBundler": false,
|
||||
"rspackPersistentCache": false,
|
||||
"ssgWorkerThreads": false,
|
||||
"swcHtmlMinimizer": false,
|
||||
"swcJsLoader": false,
|
||||
|
@ -377,6 +382,7 @@ exports[`loadSiteConfig website with valid TypeScript ESM config 1`] = `
|
|||
"lightningCssMinimizer": false,
|
||||
"mdxCrossCompilerCache": false,
|
||||
"rspackBundler": false,
|
||||
"rspackPersistentCache": false,
|
||||
"ssgWorkerThreads": false,
|
||||
"swcHtmlMinimizer": false,
|
||||
"swcJsLoader": false,
|
||||
|
@ -450,6 +456,7 @@ exports[`loadSiteConfig website with valid async config 1`] = `
|
|||
"lightningCssMinimizer": false,
|
||||
"mdxCrossCompilerCache": false,
|
||||
"rspackBundler": false,
|
||||
"rspackPersistentCache": false,
|
||||
"ssgWorkerThreads": false,
|
||||
"swcHtmlMinimizer": false,
|
||||
"swcJsLoader": false,
|
||||
|
@ -525,6 +532,7 @@ exports[`loadSiteConfig website with valid async config creator function 1`] = `
|
|||
"lightningCssMinimizer": false,
|
||||
"mdxCrossCompilerCache": false,
|
||||
"rspackBundler": false,
|
||||
"rspackPersistentCache": false,
|
||||
"ssgWorkerThreads": false,
|
||||
"swcHtmlMinimizer": false,
|
||||
"swcJsLoader": false,
|
||||
|
@ -600,6 +608,7 @@ exports[`loadSiteConfig website with valid config creator function 1`] = `
|
|||
"lightningCssMinimizer": false,
|
||||
"mdxCrossCompilerCache": false,
|
||||
"rspackBundler": false,
|
||||
"rspackPersistentCache": false,
|
||||
"ssgWorkerThreads": false,
|
||||
"swcHtmlMinimizer": false,
|
||||
"swcJsLoader": false,
|
||||
|
@ -678,6 +687,7 @@ exports[`loadSiteConfig website with valid siteConfig 1`] = `
|
|||
"lightningCssMinimizer": false,
|
||||
"mdxCrossCompilerCache": false,
|
||||
"rspackBundler": false,
|
||||
"rspackPersistentCache": false,
|
||||
"ssgWorkerThreads": false,
|
||||
"swcHtmlMinimizer": false,
|
||||
"swcJsLoader": false,
|
||||
|
|
|
@ -86,6 +86,7 @@ exports[`load loads props for site with custom i18n path 1`] = `
|
|||
"lightningCssMinimizer": false,
|
||||
"mdxCrossCompilerCache": false,
|
||||
"rspackBundler": false,
|
||||
"rspackPersistentCache": false,
|
||||
"ssgWorkerThreads": false,
|
||||
"swcHtmlMinimizer": false,
|
||||
"swcJsLoader": false,
|
||||
|
|
|
@ -58,6 +58,7 @@ describe('normalizeConfig', () => {
|
|||
lightningCssMinimizer: true,
|
||||
mdxCrossCompilerCache: true,
|
||||
rspackBundler: true,
|
||||
rspackPersistentCache: true,
|
||||
ssgWorkerThreads: true,
|
||||
},
|
||||
experimental_storage: {
|
||||
|
@ -761,6 +762,7 @@ describe('future', () => {
|
|||
lightningCssMinimizer: true,
|
||||
mdxCrossCompilerCache: true,
|
||||
rspackBundler: true,
|
||||
rspackPersistentCache: true,
|
||||
ssgWorkerThreads: true,
|
||||
},
|
||||
experimental_storage: {
|
||||
|
@ -1115,6 +1117,7 @@ describe('future', () => {
|
|||
lightningCssMinimizer: true,
|
||||
mdxCrossCompilerCache: true,
|
||||
rspackBundler: true,
|
||||
rspackPersistentCache: true,
|
||||
ssgWorkerThreads: true,
|
||||
};
|
||||
expect(
|
||||
|
@ -1156,7 +1159,8 @@ describe('future', () => {
|
|||
}),
|
||||
).toThrowErrorMatchingInlineSnapshot(`
|
||||
"Docusaurus config \`future.experimental_faster.ssgWorkerThreads\` requires the future flag \`future.v4.removeLegacyPostBuildHeadAttribute\` to be turned on.
|
||||
If you use Docusaurus Faster, we recommend that you also activate Docusaurus v4 future flags: \`{future: {v4: true}}\`"
|
||||
If you use Docusaurus Faster, we recommend that you also activate Docusaurus v4 future flags: \`{future: {v4: true}}\`
|
||||
All the v4 future flags are documented here: https://docusaurus.io/docs/api/docusaurus-config#future"
|
||||
`);
|
||||
});
|
||||
|
||||
|
@ -1170,7 +1174,8 @@ describe('future', () => {
|
|||
}),
|
||||
).toThrowErrorMatchingInlineSnapshot(`
|
||||
"Docusaurus config \`future.experimental_faster.ssgWorkerThreads\` requires the future flag \`future.v4.removeLegacyPostBuildHeadAttribute\` to be turned on.
|
||||
If you use Docusaurus Faster, we recommend that you also activate Docusaurus v4 future flags: \`{future: {v4: true}}\`"
|
||||
If you use Docusaurus Faster, we recommend that you also activate Docusaurus v4 future flags: \`{future: {v4: true}}\`
|
||||
All the v4 future flags are documented here: https://docusaurus.io/docs/api/docusaurus-config#future"
|
||||
`);
|
||||
});
|
||||
|
||||
|
@ -1615,6 +1620,110 @@ describe('future', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('rspackPersistentCache', () => {
|
||||
it('accepts - undefined', () => {
|
||||
const faster: Partial<FasterConfig> = {
|
||||
rspackPersistentCache: undefined,
|
||||
};
|
||||
expect(
|
||||
normalizeConfig({
|
||||
future: {
|
||||
experimental_faster: faster,
|
||||
},
|
||||
}),
|
||||
).toEqual(fasterContaining({rspackPersistentCache: false}));
|
||||
});
|
||||
|
||||
it('accepts - true (rspackBundler: true)', () => {
|
||||
const faster: Partial<FasterConfig> = {
|
||||
rspackBundler: true,
|
||||
rspackPersistentCache: true,
|
||||
};
|
||||
expect(
|
||||
normalizeConfig({
|
||||
future: {
|
||||
experimental_faster: faster,
|
||||
},
|
||||
}),
|
||||
).toEqual(fasterContaining({rspackPersistentCache: true}));
|
||||
});
|
||||
|
||||
it('rejects - true (rspackBundler: false)', () => {
|
||||
const faster: Partial<FasterConfig> = {
|
||||
rspackBundler: false,
|
||||
rspackPersistentCache: true,
|
||||
};
|
||||
expect(() =>
|
||||
normalizeConfig({
|
||||
future: {
|
||||
experimental_faster: faster,
|
||||
},
|
||||
}),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"Docusaurus config flag \`future.experimental_faster.rspackPersistentCache\` requires the flag \`future.experimental_faster.rspackBundler\` to be turned on."`,
|
||||
);
|
||||
});
|
||||
|
||||
it('rejects - true (rspackBundler: undefined)', () => {
|
||||
const faster: Partial<FasterConfig> = {
|
||||
rspackBundler: false,
|
||||
rspackPersistentCache: true,
|
||||
};
|
||||
expect(() =>
|
||||
normalizeConfig({
|
||||
future: {
|
||||
experimental_faster: faster,
|
||||
},
|
||||
}),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"Docusaurus config flag \`future.experimental_faster.rspackPersistentCache\` requires the flag \`future.experimental_faster.rspackBundler\` to be turned on."`,
|
||||
);
|
||||
});
|
||||
|
||||
it('accepts - false', () => {
|
||||
const faster: Partial<FasterConfig> = {
|
||||
rspackPersistentCache: false,
|
||||
};
|
||||
expect(
|
||||
normalizeConfig({
|
||||
future: {
|
||||
experimental_faster: faster,
|
||||
},
|
||||
}),
|
||||
).toEqual(fasterContaining({rspackPersistentCache: false}));
|
||||
});
|
||||
|
||||
it('rejects - null', () => {
|
||||
// @ts-expect-error: invalid
|
||||
const faster: Partial<FasterConfig> = {rspackPersistentCache: 42};
|
||||
expect(() =>
|
||||
normalizeConfig({
|
||||
future: {
|
||||
experimental_faster: faster,
|
||||
},
|
||||
}),
|
||||
).toThrowErrorMatchingInlineSnapshot(`
|
||||
""future.experimental_faster.rspackPersistentCache" must be a boolean
|
||||
"
|
||||
`);
|
||||
});
|
||||
|
||||
it('rejects - number', () => {
|
||||
// @ts-expect-error: invalid
|
||||
const faster: Partial<FasterConfig> = {rspackPersistentCache: 42};
|
||||
expect(() =>
|
||||
normalizeConfig({
|
||||
future: {
|
||||
experimental_faster: faster,
|
||||
},
|
||||
}),
|
||||
).toThrowErrorMatchingInlineSnapshot(`
|
||||
""future.experimental_faster.rspackPersistentCache" must be a boolean
|
||||
"
|
||||
`);
|
||||
});
|
||||
});
|
||||
|
||||
describe('ssgWorkerThreads', () => {
|
||||
it('accepts - undefined', () => {
|
||||
const faster: Partial<FasterConfig> = {
|
||||
|
@ -1656,7 +1765,8 @@ describe('future', () => {
|
|||
}),
|
||||
).toThrowErrorMatchingInlineSnapshot(`
|
||||
"Docusaurus config \`future.experimental_faster.ssgWorkerThreads\` requires the future flag \`future.v4.removeLegacyPostBuildHeadAttribute\` to be turned on.
|
||||
If you use Docusaurus Faster, we recommend that you also activate Docusaurus v4 future flags: \`{future: {v4: true}}\`"
|
||||
If you use Docusaurus Faster, we recommend that you also activate Docusaurus v4 future flags: \`{future: {v4: true}}\`
|
||||
All the v4 future flags are documented here: https://docusaurus.io/docs/api/docusaurus-config#future"
|
||||
`);
|
||||
});
|
||||
|
||||
|
@ -1673,7 +1783,8 @@ describe('future', () => {
|
|||
}),
|
||||
).toThrowErrorMatchingInlineSnapshot(`
|
||||
"Docusaurus config \`future.experimental_faster.ssgWorkerThreads\` requires the future flag \`future.v4.removeLegacyPostBuildHeadAttribute\` to be turned on.
|
||||
If you use Docusaurus Faster, we recommend that you also activate Docusaurus v4 future flags: \`{future: {v4: true}}\`"
|
||||
If you use Docusaurus Faster, we recommend that you also activate Docusaurus v4 future flags: \`{future: {v4: true}}\`
|
||||
All the v4 future flags are documented here: https://docusaurus.io/docs/api/docusaurus-config#future"
|
||||
`);
|
||||
});
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ export const DEFAULT_FASTER_CONFIG: FasterConfig = {
|
|||
lightningCssMinimizer: false,
|
||||
mdxCrossCompilerCache: false,
|
||||
rspackBundler: false,
|
||||
rspackPersistentCache: false,
|
||||
ssgWorkerThreads: false,
|
||||
};
|
||||
|
||||
|
@ -61,6 +62,7 @@ export const DEFAULT_FASTER_CONFIG_TRUE: FasterConfig = {
|
|||
lightningCssMinimizer: true,
|
||||
mdxCrossCompilerCache: true,
|
||||
rspackBundler: true,
|
||||
rspackPersistentCache: true,
|
||||
ssgWorkerThreads: true,
|
||||
};
|
||||
|
||||
|
@ -246,6 +248,9 @@ const FASTER_CONFIG_SCHEMA = Joi.alternatives()
|
|||
DEFAULT_FASTER_CONFIG.mdxCrossCompilerCache,
|
||||
),
|
||||
rspackBundler: Joi.boolean().default(DEFAULT_FASTER_CONFIG.rspackBundler),
|
||||
rspackPersistentCache: Joi.boolean().default(
|
||||
DEFAULT_FASTER_CONFIG.rspackPersistentCache,
|
||||
),
|
||||
ssgWorkerThreads: Joi.boolean().default(
|
||||
DEFAULT_FASTER_CONFIG.ssgWorkerThreads,
|
||||
),
|
||||
|
@ -466,7 +471,21 @@ function ensureDocusaurusConfigConsistency(config: DocusaurusConfig) {
|
|||
)} to be turned on.
|
||||
If you use Docusaurus Faster, we recommend that you also activate Docusaurus v4 future flags: ${logger.code(
|
||||
'{future: {v4: true}}',
|
||||
)}`,
|
||||
)}
|
||||
All the v4 future flags are documented here: https://docusaurus.io/docs/api/docusaurus-config#future`,
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
config.future.experimental_faster.rspackPersistentCache &&
|
||||
!config.future.experimental_faster.rspackBundler
|
||||
) {
|
||||
throw new Error(
|
||||
`Docusaurus config flag ${logger.code(
|
||||
'future.experimental_faster.rspackPersistentCache',
|
||||
)} requires the flag ${logger.code(
|
||||
'future.experimental_faster.rspackBundler',
|
||||
)} to be turned on.`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ async function loadAppRenderer({
|
|||
|
||||
if (!serverEntry?.default || typeof serverEntry.default !== 'function') {
|
||||
throw new Error(
|
||||
`Server bundle export from "${filename}" must be a function that renders the Docusaurus React app.`,
|
||||
`Docusaurus Bug: server bundle export from "${filename}" must be a function that renders the Docusaurus React app, not ${typeof serverEntry?.default}`,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -103,44 +103,78 @@ export async function createBaseConfig({
|
|||
currentBundler: props.currentBundler,
|
||||
});
|
||||
|
||||
// Can we share the same cache across locales?
|
||||
// Exploring that question at https://github.com/webpack/webpack/issues/13034
|
||||
function getCacheName() {
|
||||
return `${name}-${mode}-${props.i18n.currentLocale}`;
|
||||
}
|
||||
|
||||
// When the version string changes, the cache is evicted
|
||||
function getCacheVersion() {
|
||||
// Because Webpack does not evict the cache on alias/swizzle changes,
|
||||
// See https://github.com/webpack/webpack/issues/13627
|
||||
const themeAliasesHash = md5Hash(JSON.stringify(themeAliases));
|
||||
return `${siteMetadata.docusaurusVersion}-${themeAliasesHash}`;
|
||||
}
|
||||
|
||||
// When one of those modules/dependencies change (including transitive
|
||||
// deps), cache is invalidated
|
||||
function getCacheBuildDependencies(): string[] {
|
||||
return [
|
||||
__filename,
|
||||
path.join(__dirname, isServer ? 'server.js' : 'client.js'),
|
||||
// Docusaurus config changes can affect MDX/JSX compilation, so we'd
|
||||
// rather evict the cache.
|
||||
// See https://github.com/questdb/questdb.io/issues/493
|
||||
siteConfigPath,
|
||||
];
|
||||
}
|
||||
|
||||
function getCache(): Configuration['cache'] {
|
||||
if (props.currentBundler.name === 'rspack') {
|
||||
// TODO Rspack only supports memory cache (as of Sept 2024)
|
||||
// TODO re-enable file persistent cache one Rspack supports it
|
||||
// See also https://rspack.dev/config/cache#cache
|
||||
return undefined;
|
||||
// Use default: memory cache in dev, nothing in prod
|
||||
// See https://rspack.dev/config/cache#cache
|
||||
const disabledPersistentCacheValue = undefined;
|
||||
|
||||
if (process.env.DOCUSAURUS_NO_PERSISTENT_CACHE) {
|
||||
return disabledPersistentCacheValue;
|
||||
}
|
||||
if (props.currentBundler.name === 'rspack') {
|
||||
if (props.siteConfig.future.experimental_faster.rspackPersistentCache) {
|
||||
// Use cache: true + experiments.cache.type: "persistent"
|
||||
// See https://rspack.dev/config/experiments#persistent-cache
|
||||
return true;
|
||||
} else {
|
||||
return disabledPersistentCacheValue;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'filesystem',
|
||||
// Can we share the same cache across locales?
|
||||
// Exploring that question at https://github.com/webpack/webpack/issues/13034
|
||||
// name: `${name}-${mode}`,
|
||||
name: `${name}-${mode}-${props.i18n.currentLocale}`,
|
||||
// When version string changes, cache is evicted
|
||||
version: [
|
||||
siteMetadata.docusaurusVersion,
|
||||
// Webpack does not evict the cache correctly on alias/swizzle change,
|
||||
// so we force eviction.
|
||||
// See https://github.com/webpack/webpack/issues/13627
|
||||
md5Hash(JSON.stringify(themeAliases)),
|
||||
].join('-'),
|
||||
// When one of those modules/dependencies change (including transitive
|
||||
// deps), cache is invalidated
|
||||
name: getCacheName(),
|
||||
version: getCacheVersion(),
|
||||
buildDependencies: {
|
||||
config: [
|
||||
__filename,
|
||||
path.join(__dirname, isServer ? 'server.js' : 'client.js'),
|
||||
// Docusaurus config changes can affect MDX/JSX compilation, so we'd
|
||||
// rather evict the cache.
|
||||
// See https://github.com/questdb/questdb.io/issues/493
|
||||
siteConfigPath,
|
||||
],
|
||||
config: getCacheBuildDependencies(),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function getExperiments(): Configuration['experiments'] {
|
||||
if (props.currentBundler.name === 'rspack') {
|
||||
const PersistentCacheAttributes = process.env
|
||||
.DOCUSAURUS_NO_PERSISTENT_CACHE
|
||||
? {}
|
||||
: {
|
||||
cache: {
|
||||
type: 'persistent',
|
||||
// Rspack doesn't have "cache.name" like Webpack
|
||||
// This is not ideal but work around is to merge name/version
|
||||
// See https://github.com/web-infra-dev/rspack/pull/8920#issuecomment-2658938695
|
||||
version: `${getCacheName()}-${getCacheVersion()}`,
|
||||
buildDependencies: getCacheBuildDependencies(),
|
||||
},
|
||||
};
|
||||
|
||||
// TODO find a way to type this
|
||||
return {
|
||||
// This is mostly useful in dev
|
||||
// See https://rspack.dev/config/experiments#experimentsincremental
|
||||
|
@ -151,6 +185,8 @@ export async function createBaseConfig({
|
|||
// See https://github.com/facebook/docusaurus/issues/10646
|
||||
// @ts-expect-error: Rspack-only, not available in Webpack typedefs
|
||||
incremental: !isProd && !process.env.DISABLE_RSPACK_INCREMENTAL,
|
||||
|
||||
...PersistentCacheAttributes,
|
||||
};
|
||||
}
|
||||
return undefined;
|
||||
|
|
|
@ -206,6 +206,7 @@ export default {
|
|||
swcHtmlMinimizer: true,
|
||||
lightningCssMinimizer: true,
|
||||
rspackBundler: true,
|
||||
rspackPersistentCache: true,
|
||||
ssgWorkerThreads: true,
|
||||
mdxCrossCompilerCache: true,
|
||||
},
|
||||
|
@ -226,6 +227,7 @@ export default {
|
|||
- [`swcHtmlMinimizer `](https://github.com/facebook/docusaurus/pull/10554): Use [SWC](https://swc.rs/) to minify HTML and inlined JS/CSS (instead of [html-minifier-terser](https://github.com/terser/html-minifier-terser)).
|
||||
- [`lightningCssMinimizer`](https://github.com/facebook/docusaurus/pull/10522): Use [Lightning CSS](https://lightningcss.dev/) to minify CSS (instead of [cssnano](https://github.com/cssnano/cssnano) and [clean-css](https://github.com/clean-css/clean-css)).
|
||||
- [`rspackBundler`](https://github.com/facebook/docusaurus/pull/10402): Use [Rspack](https://rspack.dev/) to bundle your app (instead of [webpack](https://webpack.js.org/)).
|
||||
- [`rspackPersistentCache`](https://github.com/facebook/docusaurus/pull/10931): Use [Rspack Persistent Cache](https://rspack.dev/config/cache) to re-build your app faster on subsequent builds. Requires `rspackBundler: true`. Requires persisting `./node_modules/.cache` across rebuilds.
|
||||
- [`mdxCrossCompilerCache`](https://github.com/facebook/docusaurus/pull/10479): Compile MDX files only once for both browser/Node.js environments instead of twice.
|
||||
- [`ssgWorkerThreads`](https://github.com/facebook/docusaurus/pull/10826): Using a Node.js worker thread pool to execute the static site generation phase faster. Requires `future.v4.removeLegacyPostBuildHeadAttribute` to be turned on.
|
||||
- `experimental_storage`: Site-wide browser storage options that theme authors should strive to respect.
|
||||
|
|
108
yarn.lock
108
yarn.lock
|
@ -3216,73 +3216,73 @@
|
|||
fs-extra "^11.1.1"
|
||||
lodash "^4.17.21"
|
||||
|
||||
"@rspack/binding-darwin-arm64@1.2.2":
|
||||
version "1.2.2"
|
||||
resolved "https://registry.yarnpkg.com/@rspack/binding-darwin-arm64/-/binding-darwin-arm64-1.2.2.tgz#e2444ef46b3ee689a6021ae757bb55a0dbe7b491"
|
||||
integrity sha512-h23F8zEkXWhwMeScm0ZnN78Zh7hCDalxIWsm7bBS0eKadnlegUDwwCF8WE+8NjWr7bRzv0p3QBWlS5ufkcL4eA==
|
||||
"@rspack/binding-darwin-arm64@1.2.5":
|
||||
version "1.2.5"
|
||||
resolved "https://registry.yarnpkg.com/@rspack/binding-darwin-arm64/-/binding-darwin-arm64-1.2.5.tgz#69b35d70e543ac034daf0fea03d27e25112a5e8f"
|
||||
integrity sha512-ou0NXMLp6RxY9Bx8P9lA8ArVjz/WAI/gSu5kKrdKKtMs6WKutl4vvP9A4HHZnISd9Tn00dlvDwNeNSUR7fjoDQ==
|
||||
|
||||
"@rspack/binding-darwin-x64@1.2.2":
|
||||
version "1.2.2"
|
||||
resolved "https://registry.yarnpkg.com/@rspack/binding-darwin-x64/-/binding-darwin-x64-1.2.2.tgz#5a4b827692d3063a5d30577ba41f2d97ab452492"
|
||||
integrity sha512-vG5s7FkEvwrGLfksyDRHwKAHUkhZt1zHZZXJQn4gZKjTBonje8ezdc7IFlDiWpC4S+oBYp73nDWkUzkGRbSdcQ==
|
||||
"@rspack/binding-darwin-x64@1.2.5":
|
||||
version "1.2.5"
|
||||
resolved "https://registry.yarnpkg.com/@rspack/binding-darwin-x64/-/binding-darwin-x64-1.2.5.tgz#22b63d233f06afb88791bec8f4fdabd020cc93f5"
|
||||
integrity sha512-RdvH9YongQlDE9+T2Xh5D2+dyiLHx2Gz38Af1uObyBRNWjF1qbuR51hOas0f2NFUdyA03j1+HWZCbE7yZrmI3w==
|
||||
|
||||
"@rspack/binding-linux-arm64-gnu@1.2.2":
|
||||
version "1.2.2"
|
||||
resolved "https://registry.yarnpkg.com/@rspack/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.2.tgz#9c07f56fcac8ddc12bb818868fd5194c80d11fb5"
|
||||
integrity sha512-VykY/kiYOzO8E1nYzfJ9+gQEHxb5B6lt5wa8M6xFi5B6jEGU+OsaGskmAZB9/GFImeFDHxDPvhUalI4R9p8O2Q==
|
||||
"@rspack/binding-linux-arm64-gnu@1.2.5":
|
||||
version "1.2.5"
|
||||
resolved "https://registry.yarnpkg.com/@rspack/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.5.tgz#19eebeeddb26802d4e6bc0f2795bdd507bb91849"
|
||||
integrity sha512-jznk/CI/wN93fr8I1j3la/CAiGf8aG7ZHIpRBtT4CkNze0c5BcF3AaJVSBHVNQqgSv0qddxMt3SADpzV8rWZ6g==
|
||||
|
||||
"@rspack/binding-linux-arm64-musl@1.2.2":
|
||||
version "1.2.2"
|
||||
resolved "https://registry.yarnpkg.com/@rspack/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.2.tgz#e3aff4cd36de780f95ded65264363b444f7f3c4e"
|
||||
integrity sha512-Z5vAC4wGfXi8XXZ6hs8Q06TYjr3zHf819HB4DI5i4C1eQTeKdZSyoFD0NHFG23bP4NWJffp8KhmoObcy9jBT5Q==
|
||||
"@rspack/binding-linux-arm64-musl@1.2.5":
|
||||
version "1.2.5"
|
||||
resolved "https://registry.yarnpkg.com/@rspack/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.5.tgz#cf786f14621baf511f229288f873190fc4f7196b"
|
||||
integrity sha512-oYzcaJ0xjb1fWbbtPmjjPXeehExEgwJ8fEGYQ5TikB+p9oCLkAghnNjsz9evUhgjByxi+NTZ1YmUNwxRuQDY1Q==
|
||||
|
||||
"@rspack/binding-linux-x64-gnu@1.2.2":
|
||||
version "1.2.2"
|
||||
resolved "https://registry.yarnpkg.com/@rspack/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.2.tgz#5af03e8b21c4afecddd92d52f0994a7e4785aabd"
|
||||
integrity sha512-o3pDaL+cH5EeRbDE9gZcdZpBgp5iXvYZBBhe8vZQllYgI4zN5MJEuleV7WplG3UwTXlgZg3Kht4RORSOPn96vg==
|
||||
"@rspack/binding-linux-x64-gnu@1.2.5":
|
||||
version "1.2.5"
|
||||
resolved "https://registry.yarnpkg.com/@rspack/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.5.tgz#10082ab2550432306cf9a8b6f02042202975865c"
|
||||
integrity sha512-dzEKs8oi86Vi+TFRCPpgmfF5ANL0VmlZN45e1An7HipeI2C5B1xrz/H8V43vPy8XEvQuMmkXO6Sp82A0zlHvIA==
|
||||
|
||||
"@rspack/binding-linux-x64-musl@1.2.2":
|
||||
version "1.2.2"
|
||||
resolved "https://registry.yarnpkg.com/@rspack/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.2.tgz#e5be9d4d6d7e5369fa0708c3bc6281a8c52525ad"
|
||||
integrity sha512-RE3e0xe4DdchHssttKzryDwjLkbrNk/4H59TkkWeGYJcLw41tmcOZVFQUOwKLUvXWVyif/vjvV/w1SMlqB4wQg==
|
||||
"@rspack/binding-linux-x64-musl@1.2.5":
|
||||
version "1.2.5"
|
||||
resolved "https://registry.yarnpkg.com/@rspack/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.5.tgz#0c1bef36b7789b7d3b046b6e0bdbe86944e5aca4"
|
||||
integrity sha512-4ENeVPVSD97rRRGr6kJSm4sIPf1tKJ8vlr9hJi4sSvF7eMLWipSwIVmqRXJ2riVMRjYD2einmJ9KzI8rqQ2OwA==
|
||||
|
||||
"@rspack/binding-win32-arm64-msvc@1.2.2":
|
||||
version "1.2.2"
|
||||
resolved "https://registry.yarnpkg.com/@rspack/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.2.tgz#4b1e98a304f1ea10fefb1de2de8abc460a0a15a7"
|
||||
integrity sha512-R+PKBYn6uzTaDdVqTHvjqiJPBr5ZHg1wg5UmFDLNH9OklzVFyQh1JInSdJRb7lzfzTRz6bEkkwUFBPQK/CGScw==
|
||||
"@rspack/binding-win32-arm64-msvc@1.2.5":
|
||||
version "1.2.5"
|
||||
resolved "https://registry.yarnpkg.com/@rspack/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.5.tgz#70d3ab6079aa0c721dc32b989e3743a1ba59acf5"
|
||||
integrity sha512-WUoJvX/z43MWeW1JKAQIxdvqH02oLzbaGMCzIikvniZnakQovYLPH6tCYh7qD3p7uQsm+IafFddhFxTtogC3pg==
|
||||
|
||||
"@rspack/binding-win32-ia32-msvc@1.2.2":
|
||||
version "1.2.2"
|
||||
resolved "https://registry.yarnpkg.com/@rspack/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-1.2.2.tgz#3eff46acf9b1e11b33846edf0f7f916e8aeeb5e6"
|
||||
integrity sha512-dBqz3sRAGZ2f31FgzKLDvIRfq2haRP3X3XVCT0PsiMcvt7QJng+26aYYMy2THatd/nM8IwExYeitHWeiMBoruw==
|
||||
"@rspack/binding-win32-ia32-msvc@1.2.5":
|
||||
version "1.2.5"
|
||||
resolved "https://registry.yarnpkg.com/@rspack/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-1.2.5.tgz#141e1698d1cfb7007c918cb02c1aacc89001ba35"
|
||||
integrity sha512-YzPvmt/gpiacE6aAacz4dxgEbNWwoKYPaT4WYy/oITobnAui++iCFXC4IICSmlpoA1y7O8K3Qb9jbaB/lLhbwA==
|
||||
|
||||
"@rspack/binding-win32-x64-msvc@1.2.2":
|
||||
version "1.2.2"
|
||||
resolved "https://registry.yarnpkg.com/@rspack/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.2.tgz#6f4bf6a590ffbbda64316ef1dc0378c0c3d93f2e"
|
||||
integrity sha512-eeAvaN831KG553cMSHkVldyk6YQn4ujgRHov6r1wtREq7CD3/ka9LMkJUepCN85K7XtwYT0N4KpFIQyf5GTGoA==
|
||||
"@rspack/binding-win32-x64-msvc@1.2.5":
|
||||
version "1.2.5"
|
||||
resolved "https://registry.yarnpkg.com/@rspack/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.5.tgz#d1e5410784917fe8fd580805e5fc9eeef46d9822"
|
||||
integrity sha512-QDDshfteMZiglllm7WUh/ITemFNuexwn1Yul7cHBFGQu6HqtqKNAR0kGR8J3e15MPMlinSaygVpfRE4A0KPmjQ==
|
||||
|
||||
"@rspack/binding@1.2.2":
|
||||
version "1.2.2"
|
||||
resolved "https://registry.yarnpkg.com/@rspack/binding/-/binding-1.2.2.tgz#0be057d1668cfc753bfbf039704fb0eb1c69a953"
|
||||
integrity sha512-GCZwpGFYlLTdJ2soPLwjw9z4LSZ+GdpbHNfBt3Cm/f/bAF8n6mZc7dHUqN893RFh7MPU17HNEL3fMw7XR+6pHg==
|
||||
"@rspack/binding@1.2.5":
|
||||
version "1.2.5"
|
||||
resolved "https://registry.yarnpkg.com/@rspack/binding/-/binding-1.2.5.tgz#2038aafa0bb7899ef891437965f52634cf5ae684"
|
||||
integrity sha512-q9vQmGDFZyFVMULwOFL7488WNSgn4ue94R/njDLMMIPF4K0oEJP2QT02elfG4KVGv2CbP63D7vEFN4ZNreo/Rw==
|
||||
optionalDependencies:
|
||||
"@rspack/binding-darwin-arm64" "1.2.2"
|
||||
"@rspack/binding-darwin-x64" "1.2.2"
|
||||
"@rspack/binding-linux-arm64-gnu" "1.2.2"
|
||||
"@rspack/binding-linux-arm64-musl" "1.2.2"
|
||||
"@rspack/binding-linux-x64-gnu" "1.2.2"
|
||||
"@rspack/binding-linux-x64-musl" "1.2.2"
|
||||
"@rspack/binding-win32-arm64-msvc" "1.2.2"
|
||||
"@rspack/binding-win32-ia32-msvc" "1.2.2"
|
||||
"@rspack/binding-win32-x64-msvc" "1.2.2"
|
||||
"@rspack/binding-darwin-arm64" "1.2.5"
|
||||
"@rspack/binding-darwin-x64" "1.2.5"
|
||||
"@rspack/binding-linux-arm64-gnu" "1.2.5"
|
||||
"@rspack/binding-linux-arm64-musl" "1.2.5"
|
||||
"@rspack/binding-linux-x64-gnu" "1.2.5"
|
||||
"@rspack/binding-linux-x64-musl" "1.2.5"
|
||||
"@rspack/binding-win32-arm64-msvc" "1.2.5"
|
||||
"@rspack/binding-win32-ia32-msvc" "1.2.5"
|
||||
"@rspack/binding-win32-x64-msvc" "1.2.5"
|
||||
|
||||
"@rspack/core@^1.2.2":
|
||||
version "1.2.2"
|
||||
resolved "https://registry.yarnpkg.com/@rspack/core/-/core-1.2.2.tgz#c91b7d36aa080ca99459826ad2db0e665215da2c"
|
||||
integrity sha512-EeHAmY65Uj62hSbUKesbrcWGE7jfUI887RD03G++Gj8jS4WPHEu1TFODXNOXg6pa7zyIvs2BK0Bm16Kwz8AEaQ==
|
||||
"@rspack/core@^1.2.5":
|
||||
version "1.2.5"
|
||||
resolved "https://registry.yarnpkg.com/@rspack/core/-/core-1.2.5.tgz#cefb67c1696f7003a5816d9bde2542881f6d84f7"
|
||||
integrity sha512-x/riOl05gOVGgGQFimBqS5i8XbUpBxPIKUC+tDX4hmNNkzxRaGpspZfNtcL+1HBMyYuoM6fOWGyCp2R290Uy6g==
|
||||
dependencies:
|
||||
"@module-federation/runtime-tools" "0.8.4"
|
||||
"@rspack/binding" "1.2.2"
|
||||
"@rspack/binding" "1.2.5"
|
||||
"@rspack/lite-tapable" "1.0.1"
|
||||
caniuse-lite "^1.0.30001616"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue