@docusaurus/core 4.0.0-canary-6928 → 4.0.0-canary-6930

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.
Files changed (2) hide show
  1. package/lib/webpack/base.js +16 -8
  2. package/package.json +12 -12
@@ -21,7 +21,7 @@ const CSS_REGEX = /\.css$/i;
21
21
  const CSS_MODULE_REGEX = /\.module\.css$/i;
22
22
  exports.clientDir = node_path_1.default.join(__dirname, '..', 'client');
23
23
  // The RealContentHashPlugin replaces every occurrence of a provisional chunk
24
- // hash in all assets, even inside unrelated hex strings (file-loader asset
24
+ // hash in all assets, even inside unrelated hex strings (asset file
25
25
  // names, colors, numbers...). The client and server compilations do it
26
26
  // independently, so a false positive can make the SSG HTML reference a missing
27
27
  // file. 10 chars instead of 8 makes it ~256x less likely.
@@ -53,7 +53,7 @@ async function createBaseConfig({ props, isServer, minify, configureWebpackUtils
53
53
  const totalPages = routesPaths.length;
54
54
  const isProd = process.env.NODE_ENV === 'production';
55
55
  const minimizeEnabled = minify && isProd;
56
- const fileLoaderUtils = (0, utils_1.getFileLoaderUtils)(isServer);
56
+ const assetRuleUtils = (0, utils_1.getAssetRuleUtils)(isServer);
57
57
  const name = isServer ? 'server' : 'client';
58
58
  const mode = isProd ? 'production' : 'development';
59
59
  const themeAliases = await (0, aliases_1.loadThemeAliases)({ siteDir, plugins });
@@ -71,7 +71,9 @@ async function createBaseConfig({ props, isServer, minify, configureWebpackUtils
71
71
  // Because Webpack does not evict the cache on alias/swizzle changes,
72
72
  // See https://github.com/webpack/webpack/issues/13627
73
73
  const themeAliasesHash = (0, utils_1.md5Hash)(JSON.stringify(themeAliases));
74
- return `${siteMetadata.docusaurusVersion}-${themeAliasesHash}`;
74
+ // Asset module parser options are not part of the cache key
75
+ // Changing the asset inline max size must evict the cache
76
+ return `${siteMetadata.docusaurusVersion}-${themeAliasesHash}-${utils_1.ASSET_INLINE_MAX_SIZE}`;
75
77
  }
76
78
  // When one of those modules/dependencies change (including transitive
77
79
  // deps), cache is invalidated
@@ -208,12 +210,18 @@ async function createBaseConfig({ props, isServer, minify, configureWebpackUtils
208
210
  },
209
211
  },
210
212
  module: {
213
+ parser: {
214
+ javascript: {
215
+ // Allow referencing assets with the standard and portable syntax:
216
+ // new URL('./img.png', import.meta.url)
217
+ // Relative URLs are needed for SSR: absolute URLs would otherwise
218
+ // be resolved against the server bundle file:// URL
219
+ // See https://github.com/facebook/docusaurus/pull/12655
220
+ url: 'relative',
221
+ },
222
+ },
211
223
  rules: [
212
- fileLoaderUtils.rules.images(),
213
- fileLoaderUtils.rules.svgs(),
214
- fileLoaderUtils.rules.fonts(),
215
- fileLoaderUtils.rules.media(),
216
- fileLoaderUtils.rules.otherAssets(),
224
+ assetRuleUtils.rules.assets(),
217
225
  {
218
226
  test: /\.[jt]sx?$/i,
219
227
  exclude: excludeJS,
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-6928",
4
+ "version": "4.0.0-canary-6930",
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-6928",
31
- "@docusaurus/bundler": "4.0.0-canary-6928",
32
- "@docusaurus/fs": "4.0.0-canary-6928",
33
- "@docusaurus/glob": "4.0.0-canary-6928",
34
- "@docusaurus/logger": "4.0.0-canary-6928",
35
- "@docusaurus/mdx-loader": "4.0.0-canary-6928",
36
- "@docusaurus/utils": "4.0.0-canary-6928",
37
- "@docusaurus/utils-common": "4.0.0-canary-6928",
38
- "@docusaurus/utils-validation": "4.0.0-canary-6928",
30
+ "@docusaurus/babel": "4.0.0-canary-6930",
31
+ "@docusaurus/bundler": "4.0.0-canary-6930",
32
+ "@docusaurus/fs": "4.0.0-canary-6930",
33
+ "@docusaurus/glob": "4.0.0-canary-6930",
34
+ "@docusaurus/logger": "4.0.0-canary-6930",
35
+ "@docusaurus/mdx-loader": "4.0.0-canary-6930",
36
+ "@docusaurus/utils": "4.0.0-canary-6930",
37
+ "@docusaurus/utils-common": "4.0.0-canary-6930",
38
+ "@docusaurus/utils-validation": "4.0.0-canary-6930",
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-6928",
72
- "@docusaurus/types": "4.0.0-canary-6928",
71
+ "@docusaurus/module-type-aliases": "4.0.0-canary-6930",
72
+ "@docusaurus/types": "4.0.0-canary-6930",
73
73
  "@total-typescript/shoehorn": "^0.1.2",
74
74
  "@types/escape-html": "^1.0.4",
75
75
  "@types/history": "^4.7.11",