@docusaurus/core 4.0.0-canary-6974 → 4.0.0-canary-6976

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.
@@ -47,7 +47,10 @@ async function buildLocale({ siteDir, locale, cliOptions, }) {
47
47
  const { props } = site;
48
48
  const { outDir, plugins, siteConfig } = props;
49
49
  const router = siteConfig.future.experimental_router;
50
- const configureWebpackUtils = await (0, configure_1.createConfigureWebpackUtils)({ siteConfig });
50
+ const configureWebpackUtils = await (0, configure_1.createConfigureWebpackUtils)({
51
+ siteDir: props.siteDir,
52
+ siteConfig,
53
+ });
51
54
  // We can build the 2 configs in parallel
52
55
  const [{ clientConfig, clientManifestPath }, { serverConfig, serverBundlePath }] = await logger_1.PerfLogger.async(`Creating ${props.currentBundler.name} bundler configs`, () => Promise.all([
53
56
  getBuildClientConfig({
@@ -106,6 +106,7 @@ async function getStartClientConfig({ props, minify, poll, configureWebpackUtils
106
106
  }
107
107
  async function createWebpackDevServer({ props, cliOptions, openUrlContext, }) {
108
108
  const configureWebpackUtils = await (0, configure_1.createConfigureWebpackUtils)({
109
+ siteDir: props.siteDir,
109
110
  siteConfig: props.siteConfig,
110
111
  });
111
112
  const config = await getStartClientConfig({
@@ -42,7 +42,7 @@ async function getSourceCodeFilePaths(siteDir, plugins) {
42
42
  async function extractSiteSourceCodeTranslations({ siteDir, plugins, extraSourceCodeFilePaths = [], }) {
43
43
  const babelOptions = (0, babel_1.getBabelOptions)({
44
44
  isServer: true,
45
- babelOptions: await (0, babel_1.getCustomBabelConfigFilePath)(siteDir),
45
+ configFile: await (0, babel_1.getCustomBabelConfigFilePath)(siteDir),
46
46
  });
47
47
  // Should we warn here if the same translation "key" is found in multiple
48
48
  // source code files?
@@ -11,7 +11,6 @@ exports.excludeJS = excludeJS;
11
11
  exports.createBaseConfig = createBaseConfig;
12
12
  const tslib_1 = require("tslib");
13
13
  const node_path_1 = tslib_1.__importDefault(require("node:path"));
14
- const babel_1 = require("@docusaurus/babel");
15
14
  const bundler_1 = require("@docusaurus/bundler");
16
15
  const utils_1 = require("@docusaurus/utils");
17
16
  const fs_1 = require("@docusaurus/fs");
@@ -57,7 +56,7 @@ async function createBaseConfig({ props, isServer, minify, configureWebpackUtils
57
56
  const name = isServer ? 'server' : 'client';
58
57
  const mode = isProd ? 'production' : 'development';
59
58
  const themeAliases = await (0, aliases_1.loadThemeAliases)({ siteDir, plugins });
60
- const createJsLoader = await (0, bundler_1.createJsLoaderFactory)({ siteConfig });
59
+ const createJsLoader = await (0, bundler_1.createJsLoaderFactory)({ siteDir, siteConfig });
61
60
  const CSSExtractPlugin = await (0, bundler_1.getCSSExtractPlugin)({
62
61
  currentBundler: props.currentBundler,
63
62
  });
@@ -71,9 +70,12 @@ async function createBaseConfig({ props, isServer, minify, configureWebpackUtils
71
70
  // Because Webpack does not evict the cache on alias/swizzle changes,
72
71
  // See https://github.com/webpack/webpack/issues/13627
73
72
  const themeAliasesHash = (0, utils_1.md5Hash)(JSON.stringify(themeAliases));
73
+ // Loader and minimizer options are not part of the cache key
74
+ // Changing the Browserslist config must evict the cache
75
+ const browserslistHash = (0, utils_1.md5Hash)(JSON.stringify((0, bundler_1.getBrowserslistQueries)()));
74
76
  // Asset module parser options are not part of the cache key
75
77
  // Changing the asset inline max size must evict the cache
76
- return `${siteMetadata.docusaurusVersion}-${themeAliasesHash}-${utils_1.ASSET_INLINE_MAX_SIZE}`;
78
+ return `${siteMetadata.docusaurusVersion}-${themeAliasesHash}-${browserslistHash}-${utils_1.ASSET_INLINE_MAX_SIZE}`;
77
79
  }
78
80
  // When one of those modules/dependencies change (including transitive
79
81
  // deps), cache is invalidated
@@ -226,12 +228,7 @@ async function createBaseConfig({ props, isServer, minify, configureWebpackUtils
226
228
  test: /\.[jt]sx?$/i,
227
229
  exclude: excludeJS,
228
230
  with: notTextImport,
229
- use: [
230
- createJsLoader({
231
- isServer,
232
- babelOptions: await (0, babel_1.getCustomBabelConfigFilePath)(siteDir),
233
- }),
234
- ],
231
+ use: [createJsLoader({ isServer })],
235
232
  },
236
233
  {
237
234
  test: CSS_REGEX,
@@ -9,9 +9,11 @@ import type { Configuration } from 'webpack';
9
9
  import type { Plugin, ConfigureWebpackUtils, LoadedPlugin } from '@docusaurus/types';
10
10
  /**
11
11
  * Creates convenient utils to inject into the configureWebpack() lifecycle
12
- * @param config the Docusaurus config
12
+ * @param siteDir the site directory
13
+ * @param siteConfig the Docusaurus config
13
14
  */
14
- export declare function createConfigureWebpackUtils({ siteConfig, }: {
15
+ export declare function createConfigureWebpackUtils({ siteDir, siteConfig, }: {
16
+ siteDir: string;
15
17
  siteConfig: Parameters<typeof createJsLoaderFactory>[0]['siteConfig'] & Parameters<typeof getCurrentBundler>[0]['siteConfig'];
16
18
  }): Promise<ConfigureWebpackUtils>;
17
19
  /**
@@ -14,12 +14,13 @@ const webpack_merge_1 = require("webpack-merge");
14
14
  const bundler_1 = require("@docusaurus/bundler");
15
15
  /**
16
16
  * Creates convenient utils to inject into the configureWebpack() lifecycle
17
- * @param config the Docusaurus config
17
+ * @param siteDir the site directory
18
+ * @param siteConfig the Docusaurus config
18
19
  */
19
- async function createConfigureWebpackUtils({ siteConfig, }) {
20
+ async function createConfigureWebpackUtils({ siteDir, siteConfig, }) {
20
21
  const currentBundler = await (0, bundler_1.getCurrentBundler)({ siteConfig });
21
22
  const getStyleLoaders = await (0, bundler_1.createStyleLoadersFactory)({ currentBundler });
22
- const getJSLoader = await (0, bundler_1.createJsLoaderFactory)({ siteConfig });
23
+ const getJSLoader = await (0, bundler_1.createJsLoaderFactory)({ siteDir, siteConfig });
23
24
  return {
24
25
  currentBundler,
25
26
  getStyleLoaders,
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-6974",
4
+ "version": "4.0.0-canary-6976",
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-6974",
31
- "@docusaurus/bundler": "4.0.0-canary-6974",
32
- "@docusaurus/fs": "4.0.0-canary-6974",
33
- "@docusaurus/glob": "4.0.0-canary-6974",
34
- "@docusaurus/logger": "4.0.0-canary-6974",
35
- "@docusaurus/mdx-loader": "4.0.0-canary-6974",
36
- "@docusaurus/utils": "4.0.0-canary-6974",
37
- "@docusaurus/utils-common": "4.0.0-canary-6974",
38
- "@docusaurus/utils-validation": "4.0.0-canary-6974",
30
+ "@docusaurus/babel": "4.0.0-canary-6976",
31
+ "@docusaurus/bundler": "4.0.0-canary-6976",
32
+ "@docusaurus/fs": "4.0.0-canary-6976",
33
+ "@docusaurus/glob": "4.0.0-canary-6976",
34
+ "@docusaurus/logger": "4.0.0-canary-6976",
35
+ "@docusaurus/mdx-loader": "4.0.0-canary-6976",
36
+ "@docusaurus/utils": "4.0.0-canary-6976",
37
+ "@docusaurus/utils-common": "4.0.0-canary-6976",
38
+ "@docusaurus/utils-validation": "4.0.0-canary-6976",
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-6974",
72
- "@docusaurus/types": "4.0.0-canary-6974",
71
+ "@docusaurus/module-type-aliases": "4.0.0-canary-6976",
72
+ "@docusaurus/types": "4.0.0-canary-6976",
73
73
  "@total-typescript/shoehorn": "^0.1.2",
74
74
  "@types/escape-html": "^1.0.4",
75
75
  "@types/history": "^4.7.11",