@rspress/core 2.0.0-beta.11 → 2.0.0-beta.12

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/dist/index.js CHANGED
@@ -1,28 +1,28 @@
1
1
  import __rslib_shim_module__ from 'module';
2
2
  const require = /*#__PURE__*/ __rslib_shim_module__.createRequire(import.meta.url);
3
- import * as __WEBPACK_EXTERNAL_MODULE__rspress_plugin_container_syntax_12d3c700__ from "@rspress/plugin-container-syntax";
4
- import * as __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__ from "node:fs/promises";
5
- import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
6
- import * as __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__ from "node:url";
7
- import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_plugin_react_7b149ee4__ from "@rsbuild/plugin-react";
8
- import * as __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__ from "@rspress/shared";
9
- import * as __WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__ from "@rspress/shared/logger";
10
- import * as __WEBPACK_EXTERNAL_MODULE_picocolors__ from "picocolors";
11
- import * as __WEBPACK_EXTERNAL_MODULE__rspress_shared_constants_70084e62__ from "@rspress/shared/constants";
12
- import * as __WEBPACK_EXTERNAL_MODULE_tinyglobby__ from "tinyglobby";
13
- import * as __WEBPACK_EXTERNAL_MODULE_node_os_74b4b876__ from "node:os";
14
- import * as __WEBPACK_EXTERNAL_MODULE_rspack_plugin_virtual_module_609978fd__ from "rspack-plugin-virtual-module";
15
- import * as __WEBPACK_EXTERNAL_MODULE__rspress_shared_node_utils_78947ce6__ from "@rspress/shared/node-utils";
16
- import * as __WEBPACK_EXTERNAL_MODULE_lodash_es_18c59938__ from "lodash-es";
17
- import * as __WEBPACK_EXTERNAL_MODULE_node_crypto_9ba42079__ from "node:crypto";
18
- import * as __WEBPACK_EXTERNAL_MODULE__rspress_mdx_rs_d2f3021f__ from "@rspress/mdx-rs";
19
- import * as __WEBPACK_EXTERNAL_MODULE_html_to_text_2c51ed38__ from "html-to-text";
20
- import * as __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__ from "node:fs";
21
- import * as __WEBPACK_EXTERNAL_MODULE__mdx_js_mdx_b904bd09__ from "@mdx-js/mdx";
22
- import * as __WEBPACK_EXTERNAL_MODULE_enhanced_resolve_bf4706da__ from "enhanced-resolve";
23
- import * as __WEBPACK_EXTERNAL_MODULE__unhead_react_server_7e85c952__ from "@unhead/react/server";
24
- import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__ from "@rsbuild/core";
25
- import * as __WEBPACK_EXTERNAL_MODULE_unist_util_visit_555e002a__ from "unist-util-visit";
3
+ import { pluginContainerSyntax } from "@rspress/plugin-container-syntax";
4
+ import promises_default, { mkdir, readFile, rm, writeFile } from "node:fs/promises";
5
+ import external_node_path_default, { extname as external_node_path_extname, join } from "node:path";
6
+ import { fileURLToPath, pathToFileURL } from "node:url";
7
+ import { PLUGIN_REACT_NAME, pluginReact } from "@rsbuild/plugin-react";
8
+ import { APPEARANCE_KEY, MDX_OR_MD_REGEXP, RSPRESS_TEMP_DIR, SEARCH_INDEX_NAME, addLeadingSlash, addTrailingSlash, isDebugMode, isExternalUrl, isSCM, normalizeHref, normalizeSlash, parseUrl, removeLeadingSlash, removeTrailingSlash, slash, withBase, withoutBase } from "@rspress/shared";
9
+ import { logger } from "@rspress/shared/logger";
10
+ import external_picocolors_default from "picocolors";
11
+ import { DEFAULT_PAGE_EXTENSIONS } from "@rspress/shared/constants";
12
+ import { glob } from "tinyglobby";
13
+ import external_node_os_default from "node:os";
14
+ import { RspackVirtualModulePlugin } from "rspack-plugin-virtual-module";
15
+ import { getIconUrlPath, getNodeAttribute, loadFrontMatter, mergeDocConfig } from "@rspress/shared/node-utils";
16
+ import { groupBy } from "lodash-es";
17
+ import { createHash } from "node:crypto";
18
+ import { compile } from "@rspress/mdx-rs";
19
+ import { htmlToText } from "html-to-text";
20
+ import external_node_fs_default, { createReadStream, existsSync } from "node:fs";
21
+ import { createProcessor } from "@mdx-js/mdx";
22
+ import external_enhanced_resolve_default from "enhanced-resolve";
23
+ import { createHead, transformHtmlTemplate } from "@unhead/react/server";
24
+ import { mergeRsbuildConfig as core_mergeRsbuildConfig } from "@rsbuild/core";
25
+ import { visit } from "unist-util-visit";
26
26
  export * from "@rspress/shared";
27
27
  class PluginDriver {
28
28
  #config;
@@ -49,7 +49,7 @@ class PluginDriver {
49
49
  const { pluginMediumZoom } = await import("@rspress/plugin-medium-zoom");
50
50
  this.addPlugin(pluginMediumZoom('object' == typeof mediumZoomConfig ? mediumZoomConfig : void 0));
51
51
  }
52
- this.addPlugin((0, __WEBPACK_EXTERNAL_MODULE__rspress_plugin_container_syntax_12d3c700__.pluginContainerSyntax)());
52
+ this.addPlugin(pluginContainerSyntax());
53
53
  const { pluginShiki } = await import("@rspress/plugin-shiki");
54
54
  (config.plugins || []).forEach((plugin)=>{
55
55
  this.addPlugin(plugin);
@@ -149,10 +149,10 @@ const pluginVirtualModule = (pluginOptions = {})=>({
149
149
  name: PLUGIN_VIRTUAL_MODULE_NAME,
150
150
  async setup (api) {
151
151
  const { virtualModules = {}, tempDir: virtualFolderName = '.rsbuild-virtual-module' } = pluginOptions;
152
- const TEMP_DIR = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(api.context.rootPath, 'node_modules', virtualFolderName);
152
+ const TEMP_DIR = join(api.context.rootPath, 'node_modules', virtualFolderName);
153
153
  const virtualFileAbsolutePaths = Object.keys(virtualModules).map((i)=>{
154
- let absolutePath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(TEMP_DIR, i);
155
- if (!(0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.extname)(absolutePath)) absolutePath = `${absolutePath}.js`;
154
+ let absolutePath = join(TEMP_DIR, i);
155
+ if (!external_node_path_extname(absolutePath)) absolutePath = `${absolutePath}.js`;
156
156
  return [
157
157
  i,
158
158
  absolutePath
@@ -166,10 +166,10 @@ const pluginVirtualModule = (pluginOptions = {})=>({
166
166
  ];
167
167
  });
168
168
  api.onBeforeCreateCompiler(async ()=>{
169
- await (0, __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__.mkdir)(TEMP_DIR, {
169
+ await mkdir(TEMP_DIR, {
170
170
  recursive: true
171
171
  });
172
- await Promise.all(virtualFileAbsolutePaths.map(([_, absolutePath])=>(0, __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__.writeFile)(absolutePath, '', 'utf-8')));
172
+ await Promise.all(virtualFileAbsolutePaths.map(([_, absolutePath])=>writeFile(absolutePath, '', 'utf-8')));
173
173
  });
174
174
  api.modifyBundlerChain((chain)=>{
175
175
  chain.resolve.alias.merge(Object.fromEntries(virtualFileAbsolutePaths));
@@ -182,41 +182,41 @@ const pluginVirtualModule = (pluginOptions = {})=>({
182
182
  }
183
183
  }
184
184
  });
185
- var package_namespaceObject = JSON.parse('{"i8":"2.0.0-beta.11"}');
185
+ var package_namespaceObject = JSON.parse('{"i8":"2.0.0-beta.12"}');
186
186
  const RSPRESS_VERSION = package_namespaceObject.i8;
187
187
  const isProduction = ()=>'production' === process.env.NODE_ENV;
188
188
  const importStatementRegex = /import\s+(.*?)\s+from\s+(['"])(.*?)(?:"|');?/gm;
189
189
  const inlineThemeScript = `{
190
- const saved = localStorage.getItem('${__WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.APPEARANCE_KEY}')
190
+ const saved = localStorage.getItem('${APPEARANCE_KEY}')
191
191
  const preferDark = window.matchMedia('(prefers-color-scheme: dark)').matches
192
192
  const isDark = !saved || saved === 'auto' ? preferDark : saved === 'dark'
193
193
  document.documentElement.classList.toggle('dark', isDark)
194
194
  document.documentElement.classList.toggle('rp-dark', isDark)
195
195
  document.documentElement.style.colorScheme = isDark ? 'dark' : 'light'
196
196
  }`.replace(/\n/g, ';').replace(/\s{2,}/g, '');
197
- const dirname = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname((0, __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__.fileURLToPath)(new URL(import.meta.url)));
198
- const PACKAGE_ROOT = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(dirname, '..');
199
- const TEMPLATE_PATH = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(PACKAGE_ROOT, 'index.html');
200
- const CSR_CLIENT_ENTRY = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(PACKAGE_ROOT, 'dist', 'runtime', 'csrClientEntry.js');
201
- const SSR_CLIENT_ENTRY = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(PACKAGE_ROOT, 'dist', 'runtime', 'ssrClientEntry.js');
202
- const SSR_SERVER_ENTRY = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(PACKAGE_ROOT, 'dist', 'runtime', 'ssrServerEntry.js');
197
+ const dirname = external_node_path_default.dirname(fileURLToPath(new URL(import.meta.url)));
198
+ const PACKAGE_ROOT = external_node_path_default.join(dirname, '..');
199
+ const TEMPLATE_PATH = external_node_path_default.join(PACKAGE_ROOT, 'index.html');
200
+ const CSR_CLIENT_ENTRY = external_node_path_default.join(PACKAGE_ROOT, 'dist', 'runtime', 'csrClientEntry.js');
201
+ const SSR_CLIENT_ENTRY = external_node_path_default.join(PACKAGE_ROOT, 'dist', 'runtime', 'ssrClientEntry.js');
202
+ const SSR_SERVER_ENTRY = external_node_path_default.join(PACKAGE_ROOT, 'dist', 'runtime', 'ssrServerEntry.js');
203
203
  const OUTPUT_DIR = 'doc_build';
204
204
  const APP_HTML_MARKER = '<!--<?- DOC_CONTENT ?>-->';
205
205
  const HEAD_MARKER = '<!--<?- HEAD ?>-->';
206
206
  const META_GENERATOR = '<!--<?- GENERATOR ?>-->';
207
207
  const DEFAULT_TITLE = 'Rspress';
208
208
  const PUBLIC_DIR = 'public';
209
- const constants_TEMP_DIR = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(process.cwd(), 'node_modules', __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.RSPRESS_TEMP_DIR);
209
+ const constants_TEMP_DIR = external_node_path_default.join(process.cwd(), 'node_modules', RSPRESS_TEMP_DIR);
210
210
  async function pathExists(path) {
211
211
  try {
212
- await __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__["default"].access(path);
212
+ await promises_default.access(path);
213
213
  return true;
214
214
  } catch {
215
215
  return false;
216
216
  }
217
217
  }
218
218
  async function readJson(path) {
219
- const raw = await __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__["default"].readFile(path, 'utf8');
219
+ const raw = await promises_default.readFile(path, 'utf8');
220
220
  return JSON.parse(raw);
221
221
  }
222
222
  const THEME_DEFAULT_EXPORT_PATTERN = /export\s+default\s+\{/;
@@ -229,22 +229,22 @@ async function hintThemeBreakingChange(customThemeDir) {
229
229
  ];
230
230
  let useDefaultExportFilePath = null;
231
231
  for (const file of fileList){
232
- const filePath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(customThemeDir, file);
232
+ const filePath = join(customThemeDir, file);
233
233
  if (await pathExists(filePath)) {
234
- const content = await (0, __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__.readFile)(filePath, {
234
+ const content = await readFile(filePath, {
235
235
  encoding: 'utf-8'
236
236
  });
237
237
  if (THEME_DEFAULT_EXPORT_PATTERN.test(content)) useDefaultExportFilePath = filePath;
238
238
  break;
239
239
  }
240
240
  }
241
- if (useDefaultExportFilePath) __WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__.logger.warn(`[Rspress v2] Breaking Change: The "theme/index.tsx" is now using named export instead of default export, please update ${__WEBPACK_EXTERNAL_MODULE_picocolors__["default"].greenBright(useDefaultExportFilePath)} (https://github.com/web-infra-dev/rspress/discussions/1891#discussioncomment-12422737).\n`, __WEBPACK_EXTERNAL_MODULE_picocolors__["default"].redBright(`
241
+ if (useDefaultExportFilePath) logger.warn(`[Rspress v2] Breaking Change: The "theme/index.tsx" is now using named export instead of default export, please update ${external_picocolors_default.greenBright(useDefaultExportFilePath)} (https://github.com/web-infra-dev/rspress/discussions/1891#discussioncomment-12422737).\n`, external_picocolors_default.redBright(`
242
242
  - import Theme from '@rspress/theme-default';
243
243
  - export default {
244
244
  - ...Theme,
245
245
  - Layout,
246
246
  - };
247
- - export * from 'rspress/theme';`) + __WEBPACK_EXTERNAL_MODULE_picocolors__["default"].greenBright(`
247
+ - export * from 'rspress/theme';`) + external_picocolors_default.greenBright(`
248
248
  + import { Layout } from '@rspress/theme-default';
249
249
 
250
250
  + export { Layout };
@@ -252,25 +252,25 @@ async function hintThemeBreakingChange(customThemeDir) {
252
252
  `));
253
253
  }
254
254
  function hintSSGFailed() {
255
- __WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__.logger.info(`[Rspress v2] \`ssg: true\` requires the source code to support SSR. If the code is not compatible to SSR, the build process will fail. You can try:
255
+ logger.info(`[Rspress v2] \`ssg: true\` requires the source code to support SSR. If the code is not compatible to SSR, the build process will fail. You can try:
256
256
  1. Fix code to make it SSR-compatible.
257
257
  2. Set \`ssg: false\`, but the SSG feature will be lost.`);
258
258
  }
259
259
  function hintSSGFalse() {
260
- __WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__.logger.info('`ssg: false` detected, SSG will be disabled.');
260
+ logger.info('`ssg: false` detected, SSG will be disabled.');
261
261
  }
262
262
  function hintReactVersion() {
263
- __WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__.logger.info('[Rspress v2] Rspress support React 18 and 19, please confirm that both react and react-dom are installed in package.json with the same version. ');
263
+ logger.info('[Rspress v2] Rspress support React 18 and 19, please confirm that both react and react-dom are installed in package.json with the same version. ');
264
264
  }
265
- const isWindows = 'win32' === __WEBPACK_EXTERNAL_MODULE_node_os_74b4b876__["default"].platform();
266
- function slash(p) {
265
+ const isWindows = 'win32' === external_node_os_default.platform();
266
+ function normalizePath_slash(p) {
267
267
  return p.replace(/\\/g, '/');
268
268
  }
269
269
  function normalizePath(id) {
270
- return __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].posix.normalize(isWindows ? slash(id) : id);
270
+ return external_node_path_default.posix.normalize(isWindows ? normalizePath_slash(id) : id);
271
271
  }
272
272
  function getPageKey(route) {
273
- const cleanRoute = (0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.removeLeadingSlash)(route);
273
+ const cleanRoute = removeLeadingSlash(route);
274
274
  return cleanRoute.replace(/\//g, '_').replace(/\.[^.]+$/, '') || 'index';
275
275
  }
276
276
  const getRoutePathParts = (routePath, lang, version, langs, versions)=>{
@@ -297,19 +297,19 @@ const getRoutePathParts = (routePath, lang, version, langs, versions)=>{
297
297
  return [
298
298
  versionPart,
299
299
  langPart,
300
- hasTrailSlash ? (0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.addTrailingSlash)(purePathPart) : purePathPart
300
+ hasTrailSlash ? addTrailingSlash(purePathPart) : purePathPart
301
301
  ];
302
302
  };
303
- const normalizeRoutePath = (routePath, base, lang, version, langs, versions, extensions = __WEBPACK_EXTERNAL_MODULE__rspress_shared_constants_70084e62__.DEFAULT_PAGE_EXTENSIONS)=>{
303
+ const normalizeRoutePath = (routePath, base, lang, version, langs, versions, extensions = DEFAULT_PAGE_EXTENSIONS)=>{
304
304
  const [versionPart, langPart, purePathPart] = getRoutePathParts(routePath, lang, version, langs, versions);
305
305
  const extensionsWithoutDot = extensions.map((i)=>i.slice(1));
306
306
  const cleanExtensionPattern = new RegExp(`\\.(${extensionsWithoutDot.join('|')})$`, 'i');
307
- const normalizedRoutePath = (0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.addLeadingSlash)([
307
+ const normalizedRoutePath = addLeadingSlash([
308
308
  versionPart,
309
309
  langPart
310
- ].filter(Boolean).join('/') + (0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.addLeadingSlash)(purePathPart)).replace(cleanExtensionPattern, '').replace(/\.html$/, '').replace(/\/index$/, '/');
310
+ ].filter(Boolean).join('/') + addLeadingSlash(purePathPart)).replace(cleanExtensionPattern, '').replace(/\.html$/, '').replace(/\/index$/, '/');
311
311
  return {
312
- routePath: (0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.withBase)(normalizedRoutePath, base),
312
+ routePath: withBase(normalizedRoutePath, base),
313
313
  lang: langPart || lang,
314
314
  version: versionPart || version
315
315
  };
@@ -330,7 +330,7 @@ class RouteService {
330
330
  constructor(scanDir, userConfig, tempDir, pluginDriver){
331
331
  const routeOptions = userConfig?.route || {};
332
332
  this.#scanDir = scanDir;
333
- this.#extensions = routeOptions.extensions || __WEBPACK_EXTERNAL_MODULE__rspress_shared_constants_70084e62__.DEFAULT_PAGE_EXTENSIONS;
333
+ this.#extensions = routeOptions.extensions || DEFAULT_PAGE_EXTENSIONS;
334
334
  this.#include = routeOptions.include || [];
335
335
  this.#exclude = routeOptions.exclude || [];
336
336
  this.#defaultLang = userConfig?.lang || '';
@@ -348,7 +348,7 @@ class RouteService {
348
348
  }
349
349
  async init() {
350
350
  const extensions = this.#extensions.map((i)=>i.slice(1));
351
- const files = (await (0, __WEBPACK_EXTERNAL_MODULE_tinyglobby__.glob)([
351
+ const files = (await glob([
352
352
  `**/*.{${extensions.join(',')}}`,
353
353
  ...this.#include
354
354
  ], {
@@ -364,9 +364,9 @@ class RouteService {
364
364
  ]
365
365
  })).sort();
366
366
  files.forEach((filePath)=>{
367
- const fileRelativePath = normalizePath(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].relative(this.#scanDir, filePath));
367
+ const fileRelativePath = normalizePath(external_node_path_default.relative(this.#scanDir, filePath));
368
368
  const { routePath, lang, version } = this.normalizeRoutePath(fileRelativePath);
369
- const absolutePath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(this.#scanDir, fileRelativePath);
369
+ const absolutePath = external_node_path_default.join(this.#scanDir, fileRelativePath);
370
370
  const routeInfo = {
371
371
  routePath,
372
372
  absolutePath: normalizePath(absolutePath),
@@ -396,13 +396,13 @@ class RouteService {
396
396
  addRoute(routeInfo) {
397
397
  const { routePath, absolutePath } = routeInfo;
398
398
  if (this.routeData.has(routePath)) {
399
- const preRouteExtIndex = this.#extensions.indexOf(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].extname(this.routeData.get(routePath).absolutePath));
400
- const currRouteExtIndex = this.#extensions.indexOf(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].extname(absolutePath));
399
+ const preRouteExtIndex = this.#extensions.indexOf(external_node_path_default.extname(this.routeData.get(routePath).absolutePath));
400
+ const currRouteExtIndex = this.#extensions.indexOf(external_node_path_default.extname(absolutePath));
401
401
  if (-1 !== currRouteExtIndex && (currRouteExtIndex < preRouteExtIndex || -1 === preRouteExtIndex)) this.routeData.set(routePath, routeInfo);
402
402
  } else this.routeData.set(routePath, routeInfo);
403
403
  }
404
404
  removeRoute(filePath) {
405
- const fileRelativePath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].relative(this.#scanDir, filePath);
405
+ const fileRelativePath = external_node_path_default.relative(this.#scanDir, filePath);
406
406
  const { routePath } = this.normalizeRoutePath(fileRelativePath);
407
407
  this.routeData.delete(routePath);
408
408
  }
@@ -443,8 +443,8 @@ ${routeMeta.map((route, index)=>{
443
443
  return normalizeRoutePath(routePath, this.#base, this.#defaultLang, this.#defaultVersion, this.#langs, this.#versions, this.#extensions);
444
444
  }
445
445
  async #writeTempFile(index, content) {
446
- const tempFilePath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(this.#tempDir, `temp-${index}.mdx`);
447
- await __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__["default"].writeFile(tempFilePath, content);
446
+ const tempFilePath = external_node_path_default.join(this.#tempDir, `temp-${index}.mdx`);
447
+ await promises_default.writeFile(tempFilePath, content);
448
448
  return tempFilePath;
449
449
  }
450
450
  #generateRouteInfo(routePath, filepath) {
@@ -452,7 +452,7 @@ ${routeMeta.map((route, index)=>{
452
452
  return {
453
453
  routePath: normalizedPath,
454
454
  absolutePath: normalizePath(filepath),
455
- relativePath: normalizePath(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].relative(this.#scanDir, filepath)),
455
+ relativePath: normalizePath(external_node_path_default.relative(this.#scanDir, filepath)),
456
456
  pageName: getPageKey(routePath),
457
457
  lang,
458
458
  version
@@ -467,8 +467,8 @@ async function initRouteService(options) {
467
467
  await pluginDriver.routeServiceGenerated(init_routeService);
468
468
  return init_routeService;
469
469
  }
470
- function createHash(str) {
471
- return (0, __WEBPACK_EXTERNAL_MODULE_node_crypto_9ba42079__.createHash)('sha256').update(str).digest('hex').slice(0, 8);
470
+ function createHash_createHash(str) {
471
+ return createHash('sha256').update(str).digest('hex').slice(0, 8);
472
472
  }
473
473
  var types_RuntimeModuleID = /*#__PURE__*/ function(RuntimeModuleID) {
474
474
  RuntimeModuleID["GlobalStyles"] = "virtual-global-styles";
@@ -482,9 +482,9 @@ var types_RuntimeModuleID = /*#__PURE__*/ function(RuntimeModuleID) {
482
482
  }({});
483
483
  let flattenMdxContent_resolver;
484
484
  let startFlatten = false;
485
- const processor = (0, __WEBPACK_EXTERNAL_MODULE__mdx_js_mdx_b904bd09__.createProcessor)();
486
- const { CachedInputFileSystem, ResolverFactory } = __WEBPACK_EXTERNAL_MODULE_enhanced_resolve_bf4706da__["default"];
487
- const fileSystem = __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"];
485
+ const processor = createProcessor();
486
+ const { CachedInputFileSystem, ResolverFactory } = external_enhanced_resolve_default;
487
+ const fileSystem = external_node_fs_default;
488
488
  async function resolveDepPath(importPath, importer, alias) {
489
489
  if (!flattenMdxContent_resolver) flattenMdxContent_resolver = ResolverFactory.createResolver({
490
490
  fileSystem: new CachedInputFileSystem(fileSystem, 0),
@@ -529,7 +529,7 @@ async function flattenMdxContent(content, basePath, alias) {
529
529
  try {
530
530
  ast = processor.parse(content);
531
531
  } catch (e) {
532
- __WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__.logger.debug('flattenMdxContent parse failed: \n', e);
532
+ logger.debug('flattenMdxContent parse failed: \n', e);
533
533
  return {
534
534
  flattenContent: content,
535
535
  deps
@@ -541,12 +541,12 @@ async function flattenMdxContent(content, basePath, alias) {
541
541
  const importPath = importNode.source.value;
542
542
  let absoluteImportPath;
543
543
  try {
544
- absoluteImportPath = await resolveDepPath(importPath, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(basePath), alias);
544
+ absoluteImportPath = await resolveDepPath(importPath, external_node_path_default.dirname(basePath), alias);
545
545
  } catch (_e) {
546
546
  continue;
547
547
  }
548
- if (__WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.MDX_OR_MD_REGEXP.test(absoluteImportPath)) {
549
- const importedContent = __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].readFileSync(absoluteImportPath, 'utf-8');
548
+ if (MDX_OR_MD_REGEXP.test(absoluteImportPath)) {
549
+ const importedContent = external_node_fs_default.readFileSync(absoluteImportPath, 'utf-8');
550
550
  const { flattenContent: replacedValue, deps: subDeps } = await flattenMdxContent(importedContent, absoluteImportPath, alias);
551
551
  result = result.replace(new RegExp(`import\\s+${id}\\s+from\\s+['"](${importPath})['"];?`), '').replace(new RegExp(`<${id}\\s*/>`, 'g'), ()=>replacedValue);
552
552
  deps.push(...subDeps, absoluteImportPath);
@@ -582,15 +582,15 @@ async function extractPageData(replaceRules, alias, domain, root, routeService,
582
582
  frontmatter: {},
583
583
  version: route.version,
584
584
  _filepath: route.absolutePath,
585
- _relativePath: __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].relative(root, route.absolutePath).split(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].sep).join('/')
585
+ _relativePath: external_node_path_default.relative(root, route.absolutePath).split(external_node_path_default.sep).join('/')
586
586
  };
587
- if (!__WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.MDX_OR_MD_REGEXP.test(route.absolutePath)) return defaultIndexInfo;
588
- let content = await __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__["default"].readFile(route.absolutePath, 'utf8');
589
- const { frontmatter, content: contentWithoutFrontMatter } = (0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_node_utils_78947ce6__.loadFrontMatter)(content, route.absolutePath, root);
587
+ if (!MDX_OR_MD_REGEXP.test(route.absolutePath)) return defaultIndexInfo;
588
+ let content = await promises_default.readFile(route.absolutePath, 'utf8');
589
+ const { frontmatter, content: contentWithoutFrontMatter } = loadFrontMatter(content, route.absolutePath, root);
590
590
  applyReplaceRulesToNestedObject(frontmatter, replaceRules);
591
591
  const { flattenContent } = await flattenMdxContent(applyReplaceRules(contentWithoutFrontMatter, replaceRules), route.absolutePath, alias);
592
592
  content = flattenContent.replace(importStatementRegex, '');
593
- const { html: rawHtml, title, toc: rawToc, languages } = await (0, __WEBPACK_EXTERNAL_MODULE__rspress_mdx_rs_d2f3021f__.compile)({
593
+ const { html: rawHtml, title, toc: rawToc, languages } = await compile({
594
594
  value: content,
595
595
  filepath: route.absolutePath,
596
596
  development: 'production' !== process.env.NODE_ENV,
@@ -602,7 +602,7 @@ async function extractPageData(replaceRules, alias, domain, root, routeService,
602
602
  });
603
603
  }
604
604
  const html = encodeHtml(String(rawHtml));
605
- content = (0, __WEBPACK_EXTERNAL_MODULE_html_to_text_2c51ed38__.htmlToText)(html, {
605
+ content = htmlToText(html, {
606
606
  wordwrap: 80,
607
607
  selectors: [
608
608
  {
@@ -667,7 +667,7 @@ async function extractPageData(replaceRules, alias, domain, root, routeService,
667
667
  }));
668
668
  return pageData.filter(Boolean);
669
669
  }
670
- const DEFAULT_I18N_SOURCE = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(process.cwd(), 'i18n.json');
670
+ const DEFAULT_I18N_SOURCE = join(process.cwd(), 'i18n.json');
671
671
  function getI18nData(docConfig) {
672
672
  const { i18nSourcePath = DEFAULT_I18N_SOURCE } = docConfig;
673
673
  try {
@@ -675,7 +675,7 @@ function getI18nData(docConfig) {
675
675
  const i18nSource = require(i18nSourcePath);
676
676
  return i18nSource;
677
677
  } catch (e) {
678
- __WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__.logger.debug('getI18nData Failed: \n', e);
678
+ logger.debug('getI18nData Failed: \n', e);
679
679
  return {};
680
680
  }
681
681
  }
@@ -699,9 +699,9 @@ function normalizeThemeConfig(docConfig, pages = []) {
699
699
  const locales = siteLocales ?? (themeConfig?.locales || []);
700
700
  const i18nTextData = getI18nData(docConfig);
701
701
  const normalizeLinkPrefix = (link = '', currentLang = '')=>{
702
- const normalizedLink = (0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.slash)(link);
703
- if (!currentLang || !link || (0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.withoutBase)(normalizedLink, base).startsWith(`/${currentLang}`) || (0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.isExternalUrl)(normalizedLink) || hasMultiVersion) return normalizedLink;
704
- return lang === currentLang ? normalizedLink : `/${currentLang}${(0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.addLeadingSlash)(normalizedLink)}`;
702
+ const normalizedLink = slash(link);
703
+ if (!currentLang || !link || withoutBase(normalizedLink, base).startsWith(`/${currentLang}`) || isExternalUrl(normalizedLink) || hasMultiVersion) return normalizedLink;
704
+ return lang === currentLang ? normalizedLink : `/${currentLang}${addLeadingSlash(normalizedLink)}`;
705
705
  };
706
706
  const getI18nText = (key = '', currentLang = '')=>{
707
707
  const text = i18nTextData[key]?.[currentLang];
@@ -727,11 +727,11 @@ function normalizeThemeConfig(docConfig, pages = []) {
727
727
  };
728
728
  if ('string' == typeof item) {
729
729
  const normalizedItem = normalizeLinkPrefix(item, currentLang);
730
- const page = pages.find((page)=>page.routePath === (0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.withBase)(normalizedItem, base));
730
+ const page = pages.find((page)=>page.routePath === withBase(normalizedItem, base));
731
731
  return {
732
732
  text: applyReplaceRules(page?.title || '', replaceRules),
733
733
  link: normalizedItem,
734
- _fileKey: page?._relativePath.replace(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].extname(page._relativePath), '')
734
+ _fileKey: page?._relativePath.replace(external_node_path_default.extname(page._relativePath), '')
735
735
  };
736
736
  }
737
737
  return {
@@ -813,7 +813,7 @@ async function siteDataVMPlugin(context) {
813
813
  const pages = await extractPageData(replaceRules, alias, domain, userDocRoot, routeService, highlightLanguages, searchCodeBlocks);
814
814
  await pluginDriver.modifySearchIndexData(pages);
815
815
  const versioned = userConfig.search && 'remote' !== userConfig.search.mode && userConfig.search.versioned;
816
- const groupedPages = (0, __WEBPACK_EXTERNAL_MODULE_lodash_es_18c59938__.groupBy)(pages, (page)=>{
816
+ const groupedPages = groupBy(pages, (page)=>{
817
817
  if (page.frontmatter?.pageType === 'home') return 'noindex';
818
818
  const version = versioned ? page.version : '';
819
819
  const lang = page.lang || '';
@@ -823,21 +823,21 @@ async function siteDataVMPlugin(context) {
823
823
  const indexHashByGroup = {};
824
824
  await Promise.all(Object.keys(groupedPages).map(async (group)=>{
825
825
  const stringifiedIndex = JSON.stringify(groupedPages[group].map(deletePrivateField));
826
- const indexHash = createHash(stringifiedIndex);
826
+ const indexHash = createHash_createHash(stringifiedIndex);
827
827
  indexHashByGroup[group] = indexHash;
828
828
  const [version, lang] = group.split('###');
829
829
  const indexVersion = version ? `.${version.replace('.', '_')}` : '';
830
830
  const indexLang = lang ? `.${lang}` : '';
831
- await __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__["default"].mkdir(constants_TEMP_DIR, {
831
+ await promises_default.mkdir(constants_TEMP_DIR, {
832
832
  recursive: true
833
833
  });
834
- await __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__["default"].writeFile(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(constants_TEMP_DIR, `${__WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.SEARCH_INDEX_NAME}${indexVersion}${indexLang}.${indexHash}.json`), stringifiedIndex);
834
+ await promises_default.writeFile(external_node_path_default.join(constants_TEMP_DIR, `${SEARCH_INDEX_NAME}${indexVersion}${indexLang}.${indexHash}.json`), stringifiedIndex);
835
835
  }));
836
836
  await Promise.all(pages.map(async (pageData)=>pluginDriver.extendPageData(pageData)));
837
837
  const siteData = {
838
838
  title: userConfig?.title || '',
839
839
  description: userConfig?.description || '',
840
- icon: (0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_node_utils_78947ce6__.getIconUrlPath)(userConfig?.icon) || '',
840
+ icon: getIconUrlPath(userConfig?.icon) || '',
841
841
  route: userConfig?.route || {},
842
842
  themeConfig: normalizeThemeConfig(userConfig, pages),
843
843
  base: userConfig?.base || '/',
@@ -895,7 +895,7 @@ function rsbuildPluginDocVM(factoryContext) {
895
895
  if (runtimeModule[key]) throw new Error(`The runtime module ${key} is duplicated, please check your plugin`);
896
896
  runtimeModule[key] = modulesByPlugin[key];
897
897
  });
898
- bundlerChain.plugin('rspress-runtime-module').use(new __WEBPACK_EXTERNAL_MODULE_rspack_plugin_virtual_module_609978fd__.RspackVirtualModulePlugin(runtimeModule));
898
+ bundlerChain.plugin('rspress-runtime-module').use(new RspackVirtualModulePlugin(runtimeModule));
899
899
  });
900
900
  }
901
901
  };
@@ -952,24 +952,24 @@ const searchHookVMPlugin = (context)=>({
952
952
  async function writeSearchIndex(config) {
953
953
  if (config?.search === false) return;
954
954
  const cwd = process.cwd();
955
- const searchIndexFiles = await __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__["default"].readdir(constants_TEMP_DIR);
956
- const outDir = config?.outDir ?? (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(cwd, OUTPUT_DIR);
957
- const targetDir = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(outDir, 'static');
958
- await __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__["default"].mkdir(targetDir, {
955
+ const searchIndexFiles = await promises_default.readdir(constants_TEMP_DIR);
956
+ const outDir = config?.outDir ?? join(cwd, OUTPUT_DIR);
957
+ const targetDir = join(outDir, 'static');
958
+ await promises_default.mkdir(targetDir, {
959
959
  recursive: true
960
960
  });
961
961
  let searchIndexData = '[]';
962
962
  let scanning = false;
963
963
  for (const searchIndexFile of searchIndexFiles){
964
- if (!searchIndexFile.includes(__WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.SEARCH_INDEX_NAME) || !searchIndexFile.endsWith('.json')) continue;
965
- const source = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(constants_TEMP_DIR, searchIndexFile);
966
- const target = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(targetDir, searchIndexFile);
967
- const searchIndex = await __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__["default"].readFile((0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(constants_TEMP_DIR, searchIndexFile), 'utf-8');
964
+ if (!searchIndexFile.includes(SEARCH_INDEX_NAME) || !searchIndexFile.endsWith('.json')) continue;
965
+ const source = join(constants_TEMP_DIR, searchIndexFile);
966
+ const target = join(targetDir, searchIndexFile);
967
+ const searchIndex = await promises_default.readFile(join(constants_TEMP_DIR, searchIndexFile), 'utf-8');
968
968
  searchIndexData = `${searchIndexData.slice(0, -1)}${scanning ? ',' : ''}${searchIndex.slice(1)}`;
969
- await __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__["default"].rename(source, target);
969
+ await promises_default.rename(source, target);
970
970
  scanning = true;
971
971
  }
972
- if (isProduction() && (0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.isSCM)() && config?.search?.mode === 'remote') {
972
+ if (isProduction() && isSCM() && config?.search?.mode === 'remote') {
973
973
  const { apiUrl, indexName } = config.search;
974
974
  try {
975
975
  await fetch(`${apiUrl}?index=${indexName}`, {
@@ -979,20 +979,20 @@ async function writeSearchIndex(config) {
979
979
  'Content-Type': 'application/json'
980
980
  }
981
981
  });
982
- __WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__.logger.info(__WEBPACK_EXTERNAL_MODULE_picocolors__["default"].green(`[doc-tools] Search index uploaded to ${apiUrl}, indexName: ${indexName}`));
982
+ logger.info(external_picocolors_default.green(`[doc-tools] Search index uploaded to ${apiUrl}, indexName: ${indexName}`));
983
983
  } catch (e) {
984
- __WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__.logger.info(__WEBPACK_EXTERNAL_MODULE_picocolors__["default"].red(`[doc-tools] Upload search index \`${indexName}\` failed:\n ${e}`));
984
+ logger.info(external_picocolors_default.red(`[doc-tools] Upload search index \`${indexName}\` failed:\n ${e}`));
985
985
  }
986
986
  }
987
987
  }
988
988
  function serveSearchIndexMiddleware(config) {
989
989
  return (req, res, next)=>{
990
- const searchIndexRequestMatch = `/${__WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.SEARCH_INDEX_NAME}.`;
990
+ const searchIndexRequestMatch = `/${SEARCH_INDEX_NAME}.`;
991
991
  if (req.url?.includes(searchIndexRequestMatch)) {
992
992
  res.setHeader('Content-Type', 'application/json');
993
- const outDir = config?.outDir ?? (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(process.cwd(), OUTPUT_DIR);
993
+ const outDir = config?.outDir ?? join(process.cwd(), OUTPUT_DIR);
994
994
  const searchIndexFile = req.url.split('/').pop();
995
- (0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.createReadStream)((0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(outDir, 'static', searchIndexFile), 'utf-8').pipe(res, {
995
+ createReadStream(join(outDir, 'static', searchIndexFile), 'utf-8').pipe(res, {
996
996
  end: true
997
997
  });
998
998
  } else next?.();
@@ -1091,10 +1091,10 @@ async function pMap(iterable, mapper, { concurrency = Number.POSITIVE_INFINITY,
1091
1091
  const pMapSkip = Symbol('skip');
1092
1092
  async function renderFrontmatterHead(route) {
1093
1093
  if (!isRouteMeta(route)) return '';
1094
- const content = await __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__["default"].readFile(route.absolutePath, {
1094
+ const content = await promises_default.readFile(route.absolutePath, {
1095
1095
  encoding: 'utf-8'
1096
1096
  });
1097
- const { frontmatter: { head } } = (0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_node_utils_78947ce6__.loadFrontMatter)(content, route.absolutePath, '', true);
1097
+ const { frontmatter: { head } } = loadFrontMatter(content, route.absolutePath, '', true);
1098
1098
  if (!head || 0 === head.length) return '';
1099
1099
  return head.map(([tag, attrs])=>`<${tag} ${renderAttrs(attrs)}>`).join('');
1100
1100
  }
@@ -1123,16 +1123,16 @@ function isRouteMeta(route) {
1123
1123
  return !!route && 'object' == typeof route && 'routePath' in route && 'absolutePath' in route;
1124
1124
  }
1125
1125
  async function renderPages(routeService, config, pluginDriver, ssrBundlePath, htmlTemplate, emitAsset) {
1126
- __WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__.logger.info('Rendering pages...');
1126
+ logger.info('Rendering pages...');
1127
1127
  const startTime = Date.now();
1128
1128
  let render;
1129
1129
  try {
1130
- const { default: ssrExports } = await import((0, __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__.pathToFileURL)(ssrBundlePath).toString());
1130
+ const { default: ssrExports } = await import(pathToFileURL(ssrBundlePath).toString());
1131
1131
  ({ render } = ssrExports);
1132
1132
  } catch (e) {
1133
1133
  if (e instanceof Error) {
1134
- __WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__.logger.error(`Failed to load SSG bundle: ${__WEBPACK_EXTERNAL_MODULE_picocolors__["default"].yellow(ssrBundlePath)}: ${e.message}`);
1135
- __WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__.logger.debug(e);
1134
+ logger.error(`Failed to load SSG bundle: ${external_picocolors_default.yellow(ssrBundlePath)}: ${e.message}`);
1135
+ logger.debug(e);
1136
1136
  hintSSGFailed();
1137
1137
  }
1138
1138
  throw e;
@@ -1141,7 +1141,7 @@ async function renderPages(routeService, config, pluginDriver, ssrBundlePath, ht
1141
1141
  const routes = routeService.getRoutes();
1142
1142
  const base = config?.base ?? '';
1143
1143
  const additionalRoutes = (await pluginDriver.addSSGRoutes()).map((route)=>({
1144
- routePath: (0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.withBase)(route.path, base)
1144
+ routePath: withBase(route.path, base)
1145
1145
  }));
1146
1146
  const allRoutes = [
1147
1147
  ...routes,
@@ -1153,14 +1153,14 @@ async function renderPages(routeService, config, pluginDriver, ssrBundlePath, ht
1153
1153
  });
1154
1154
  const filteredRoutes = allRoutes.filter((route)=>!route.routePath.includes(':'));
1155
1155
  await pMap(filteredRoutes, async (route)=>{
1156
- const head = (0, __WEBPACK_EXTERNAL_MODULE__unhead_react_server_7e85c952__.createHead)();
1156
+ const head = createHead();
1157
1157
  const { routePath } = route;
1158
1158
  let appHtml = '';
1159
1159
  if (render) try {
1160
1160
  ({ appHtml } = await render(routePath, head));
1161
1161
  } catch (e) {
1162
1162
  if (e instanceof Error) {
1163
- __WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__.logger.error(`Page "${__WEBPACK_EXTERNAL_MODULE_picocolors__["default"].yellow(routePath)}" SSG rendering failed.\n ${__WEBPACK_EXTERNAL_MODULE_picocolors__["default"].gray(e.toString())}`);
1163
+ logger.error(`Page "${external_picocolors_default.yellow(routePath)}" SSG rendering failed.\n ${external_picocolors_default.gray(e.toString())}`);
1164
1164
  throw e;
1165
1165
  }
1166
1166
  }
@@ -1168,9 +1168,9 @@ async function renderPages(routeService, config, pluginDriver, ssrBundlePath, ht
1168
1168
  await renderConfigHead(config, route),
1169
1169
  await renderFrontmatterHead(route)
1170
1170
  ].join(''));
1171
- const html = await (0, __WEBPACK_EXTERNAL_MODULE__unhead_react_server_7e85c952__.transformHtmlTemplate)(head, replacedHtmlTemplate);
1171
+ const html = await transformHtmlTemplate(head, replacedHtmlTemplate);
1172
1172
  const normalizeHtmlFilePath = (path)=>{
1173
- const normalizedBase = `${(0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.normalizeSlash)(config?.base || '/')}/`;
1173
+ const normalizedBase = `${normalizeSlash(config?.base || '/')}/`;
1174
1174
  if (path.endsWith('/')) return `${path}index.html`.replace(normalizedBase, '');
1175
1175
  return `${path}.html`.replace(normalizedBase, '');
1176
1176
  };
@@ -1180,11 +1180,11 @@ async function renderPages(routeService, config, pluginDriver, ssrBundlePath, ht
1180
1180
  concurrency: process.env.RSPRESS_SSG_CONCURRENCY ? Number.parseInt(process.env.RSPRESS_SSG_CONCURRENCY, 10) : 32
1181
1181
  });
1182
1182
  const totalTime = Date.now() - startTime;
1183
- __WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__.logger.success(`Pages rendered in ${__WEBPACK_EXTERNAL_MODULE_picocolors__["default"].yellow(totalTime)} ms.`);
1183
+ logger.success(`Pages rendered in ${external_picocolors_default.yellow(totalTime)} ms.`);
1184
1184
  } catch (e) {
1185
1185
  if (e instanceof Error) {
1186
- __WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__.logger.error(`Pages render error: ${e.message}`);
1187
- __WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__.logger.debug(e);
1186
+ logger.error(`Pages render error: ${e.message}`);
1187
+ logger.debug(e);
1188
1188
  hintSSGFailed();
1189
1189
  }
1190
1190
  throw e;
@@ -1213,7 +1213,7 @@ const rsbuildPluginSSG = ({ routeService, config, pluginDriver })=>({
1213
1213
  });
1214
1214
  }).catch(()=>{
1215
1215
  const message = 'SSG requires an `index.html` as entry, but this file is not emitted successfully in the web target.';
1216
- __WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__.logger.error(message);
1216
+ logger.error(message);
1217
1217
  const error = new Error(message);
1218
1218
  throw error;
1219
1219
  });
@@ -1224,13 +1224,13 @@ const rsbuildPluginSSG = ({ routeService, config, pluginDriver })=>({
1224
1224
  ]
1225
1225
  }, async ({ assets, compilation, environment, compiler })=>{
1226
1226
  const distPath = environment.distPath;
1227
- await (0, __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__.mkdir)(distPath, {
1227
+ await mkdir(distPath, {
1228
1228
  recursive: true
1229
1229
  });
1230
1230
  let mainCjsAbsolutePath = '';
1231
1231
  for (const [assetName, assetSource] of Object.entries(assets))if (assetName.includes(NODE_SSR_BUNDLE_NAME)) {
1232
- mainCjsAbsolutePath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(distPath, assetName);
1233
- await (0, __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__.writeFile)(mainCjsAbsolutePath, assetSource.source().toString());
1232
+ mainCjsAbsolutePath = join(distPath, assetName);
1233
+ await writeFile(mainCjsAbsolutePath, assetSource.source().toString());
1234
1234
  compilation.deleteAsset(assetName);
1235
1235
  break;
1236
1236
  }
@@ -1239,17 +1239,17 @@ const rsbuildPluginSSG = ({ routeService, config, pluginDriver })=>({
1239
1239
  };
1240
1240
  await indexHtmlEmittedInWeb;
1241
1241
  await renderPages(routeService, config, pluginDriver, mainCjsAbsolutePath, htmlTemplate, emitAsset);
1242
- if (!(0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.isDebugMode)()) await (0, __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__.rm)(mainCjsAbsolutePath);
1242
+ if (!isDebugMode()) await rm(mainCjsAbsolutePath);
1243
1243
  });
1244
1244
  });
1245
1245
  }
1246
1246
  });
1247
- const { CachedInputFileSystem: detectReactVersion_CachedInputFileSystem, ResolverFactory: detectReactVersion_ResolverFactory } = __WEBPACK_EXTERNAL_MODULE_enhanced_resolve_bf4706da__["default"];
1247
+ const { CachedInputFileSystem: detectReactVersion_CachedInputFileSystem, ResolverFactory: detectReactVersion_ResolverFactory } = external_enhanced_resolve_default;
1248
1248
  async function detectPackageMajorVersion(name) {
1249
1249
  const cwd = process.cwd();
1250
- const pkgPath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(cwd, 'node_modules', name);
1250
+ const pkgPath = external_node_path_default.join(cwd, 'node_modules', name);
1251
1251
  if (await pathExists(pkgPath)) {
1252
- const pkgJson = await readJson(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(pkgPath, 'package.json'));
1252
+ const pkgJson = await readJson(external_node_path_default.join(pkgPath, 'package.json'));
1253
1253
  const version = Number(pkgJson.version?.split('.')[0]);
1254
1254
  return version;
1255
1255
  }
@@ -1261,7 +1261,7 @@ async function detectReactVersion() {
1261
1261
  async function resolveReactRouterDomAlias() {
1262
1262
  const alias = {};
1263
1263
  const resolver = detectReactVersion_ResolverFactory.createResolver({
1264
- fileSystem: new detectReactVersion_CachedInputFileSystem(__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"], 0),
1264
+ fileSystem: new detectReactVersion_CachedInputFileSystem(external_node_fs_default, 0),
1265
1265
  mainFields: [
1266
1266
  'browser',
1267
1267
  'module',
@@ -1285,7 +1285,7 @@ async function resolveReactRouterDomAlias() {
1285
1285
  'react-router-dom': pkgPath
1286
1286
  };
1287
1287
  } catch (e) {
1288
- __WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__.logger.warn('react-router-dom not found: \n', e);
1288
+ logger.warn('react-router-dom not found: \n', e);
1289
1289
  }
1290
1290
  return {};
1291
1291
  }
@@ -1301,7 +1301,7 @@ async function resolveReactAlias(reactVersion, isSSR) {
1301
1301
  ];
1302
1302
  const alias = {};
1303
1303
  const resolver = detectReactVersion_ResolverFactory.createResolver({
1304
- fileSystem: new detectReactVersion_CachedInputFileSystem(__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"], 0),
1304
+ fileSystem: new detectReactVersion_CachedInputFileSystem(external_node_fs_default, 0),
1305
1305
  extensions: [
1306
1306
  '.js'
1307
1307
  ],
@@ -1325,7 +1325,7 @@ async function resolveReactAlias(reactVersion, isSSR) {
1325
1325
  });
1326
1326
  } catch (e) {
1327
1327
  if (e instanceof Error) {
1328
- __WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__.logger.warn(`${lib} not found: \n ${__WEBPACK_EXTERNAL_MODULE_picocolors__["default"].gray(e.toString())}`);
1328
+ logger.warn(`${lib} not found: \n ${external_picocolors_default.gray(e.toString())}`);
1329
1329
  hintReactVersion();
1330
1330
  }
1331
1331
  }
@@ -1333,15 +1333,15 @@ async function resolveReactAlias(reactVersion, isSSR) {
1333
1333
  return alias;
1334
1334
  }
1335
1335
  const detectCustomIcon = async (customThemeDir)=>{
1336
- const assetsDir = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(customThemeDir, 'assets');
1336
+ const assetsDir = external_node_path_default.join(customThemeDir, 'assets');
1337
1337
  const alias = {};
1338
- if (!(0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.existsSync)(assetsDir)) return alias;
1339
- const files = await (0, __WEBPACK_EXTERNAL_MODULE_tinyglobby__.glob)('*.svg', {
1338
+ if (!existsSync(assetsDir)) return alias;
1339
+ const files = await glob('*.svg', {
1340
1340
  cwd: assetsDir
1341
1341
  });
1342
1342
  files.forEach((file)=>{
1343
- const name = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].basename(file, '.svg');
1344
- alias[`@theme-assets/${name}`] = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(assetsDir, file);
1343
+ const name = external_node_path_default.basename(file, '.svg');
1344
+ alias[`@theme-assets/${name}`] = external_node_path_default.join(assetsDir, file);
1345
1345
  });
1346
1346
  return alias;
1347
1347
  };
@@ -1379,17 +1379,17 @@ function isPluginIncluded(config, pluginName) {
1379
1379
  }
1380
1380
  async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeService, pluginDriver) {
1381
1381
  const cwd = process.cwd();
1382
- const CUSTOM_THEME_DIR = config?.themeDir ?? __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(process.cwd(), 'theme');
1382
+ const CUSTOM_THEME_DIR = config?.themeDir ?? external_node_path_default.join(process.cwd(), 'theme');
1383
1383
  const outDir = config?.outDir ?? OUTPUT_DIR;
1384
1384
  const DEFAULT_THEME = require.resolve('@rspress/theme-default');
1385
1385
  const base = config?.base ?? '';
1386
- const assetPrefix = isProduction() ? (0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.removeTrailingSlash)(config?.builderConfig?.output?.assetPrefix ?? base) : '';
1386
+ const assetPrefix = isProduction() ? removeTrailingSlash(config?.builderConfig?.output?.assetPrefix ?? base) : '';
1387
1387
  const reactVersion = await detectReactVersion();
1388
1388
  const normalizeIcon = (icon)=>{
1389
1389
  if (!icon) return;
1390
1390
  icon = icon.toString();
1391
- if (icon.startsWith('file://')) icon = (0, __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__.fileURLToPath)(icon);
1392
- else if (__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].isAbsolute(icon)) return __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(userDocRoot, PUBLIC_DIR, icon);
1391
+ if (icon.startsWith('file://')) icon = fileURLToPath(icon);
1392
+ else if (external_node_path_default.isAbsolute(icon)) return external_node_path_default.join(userDocRoot, PUBLIC_DIR, icon);
1393
1393
  return icon;
1394
1394
  };
1395
1395
  await hintThemeBreakingChange(CUSTOM_THEME_DIR);
@@ -1407,8 +1407,8 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
1407
1407
  };
1408
1408
  return {
1409
1409
  plugins: [
1410
- ...isPluginIncluded(config, __WEBPACK_EXTERNAL_MODULE__rsbuild_plugin_react_7b149ee4__.PLUGIN_REACT_NAME) ? [] : [
1411
- (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_plugin_react_7b149ee4__.pluginReact)()
1410
+ ...isPluginIncluded(config, PLUGIN_REACT_NAME) ? [] : [
1411
+ pluginReact()
1412
1412
  ],
1413
1413
  rsbuildPluginDocVM(context),
1414
1414
  pluginVirtualModule({
@@ -1431,9 +1431,9 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
1431
1431
  ],
1432
1432
  server: {
1433
1433
  port: !isProduction() && process.env.PORT ? Number(process.env.PORT) : void 0,
1434
- printUrls: ({ urls })=>urls.map((url)=>`${url}/${(0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.removeLeadingSlash)(base)}`),
1434
+ printUrls: ({ urls })=>urls.map((url)=>`${url}/${removeLeadingSlash(base)}`),
1435
1435
  publicDir: {
1436
- name: __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(userDocRoot, PUBLIC_DIR)
1436
+ name: external_node_path_default.join(userDocRoot, PUBLIC_DIR)
1437
1437
  }
1438
1438
  },
1439
1439
  dev: {
@@ -1474,7 +1474,7 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
1474
1474
  CUSTOM_THEME_DIR,
1475
1475
  DEFAULT_THEME
1476
1476
  ],
1477
- '@theme-assets': __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(DEFAULT_THEME, '../assets'),
1477
+ '@theme-assets': external_node_path_default.join(DEFAULT_THEME, '../assets'),
1478
1478
  '@rspress/core': PACKAGE_ROOT,
1479
1479
  'react-lazy-with-preload': require.resolve('react-lazy-with-preload')
1480
1480
  }
@@ -1482,7 +1482,7 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
1482
1482
  source: {
1483
1483
  include: [
1484
1484
  PACKAGE_ROOT,
1485
- __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(cwd, 'node_modules', __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.RSPRESS_TEMP_DIR)
1485
+ external_node_path_default.join(cwd, 'node_modules', RSPRESS_TEMP_DIR)
1486
1486
  ],
1487
1487
  define: {
1488
1488
  'process.env.TEST': JSON.stringify(process.env.TEST),
@@ -1510,7 +1510,7 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
1510
1510
  const jsModuleRule = chain.module.rule(CHAIN_ID.RULE.JS);
1511
1511
  const swcLoaderOptions = jsModuleRule.use(CHAIN_ID.USE.SWC).get('options');
1512
1512
  const checkDeadLinks = (config?.markdown?.checkDeadLinks && !isServer) ?? false;
1513
- chain.module.rule('MDX').type("javascript/auto").test(__WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.MDX_OR_MD_REGEXP).resolve.merge({
1513
+ chain.module.rule('MDX').type("javascript/auto").test(MDX_OR_MD_REGEXP).resolve.merge({
1514
1514
  conditionNames: jsModuleRule.resolve.conditionNames.values(),
1515
1515
  mainFields: jsModuleRule.resolve.mainFields.values()
1516
1516
  }).end().oneOf('MDXCompile').use('builtin:swc-loader').loader('builtin:swc-loader').options(swcLoaderOptions).end().use('mdx-loader').loader(require.resolve('./loader.js')).options({
@@ -1524,7 +1524,7 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
1524
1524
  options[0] ??= {};
1525
1525
  options[0].include = [
1526
1526
  /\.([cm]js|[jt]sx?|flow)$/i,
1527
- __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.MDX_OR_MD_REGEXP
1527
+ MDX_OR_MD_REGEXP
1528
1528
  ];
1529
1529
  return options;
1530
1530
  });
@@ -1548,7 +1548,7 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
1548
1548
  index: enableSSG && isProduction() ? SSR_CLIENT_ENTRY : CSR_CLIENT_ENTRY
1549
1549
  },
1550
1550
  preEntry: [
1551
- __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(DEFAULT_THEME, '../styles/index.js'),
1551
+ external_node_path_default.join(DEFAULT_THEME, '../styles/index.js'),
1552
1552
  'virtual-global-styles'
1553
1553
  ],
1554
1554
  define: {
@@ -1602,11 +1602,11 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
1602
1602
  }
1603
1603
  async function initRsbuild(rootDir, config, pluginDriver, enableSSG, extraRsbuildConfig) {
1604
1604
  const cwd = process.cwd();
1605
- const userDocRoot = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(rootDir || config?.root || cwd);
1605
+ const userDocRoot = external_node_path_default.resolve(rootDir || config?.root || cwd);
1606
1606
  const builderPlugins = config?.builderPlugins ?? [];
1607
- const runtimeTempDir = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(__WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.RSPRESS_TEMP_DIR, 'runtime');
1608
- const runtimeAbsTempDir = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(cwd, 'node_modules', runtimeTempDir);
1609
- await __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__["default"].mkdir(runtimeAbsTempDir, {
1607
+ const runtimeTempDir = external_node_path_default.join(RSPRESS_TEMP_DIR, 'runtime');
1608
+ const runtimeAbsTempDir = external_node_path_default.join(cwd, 'node_modules', runtimeTempDir);
1609
+ await promises_default.mkdir(runtimeAbsTempDir, {
1610
1610
  recursive: true
1611
1611
  });
1612
1612
  const routeService = await initRouteService({
@@ -1625,34 +1625,34 @@ async function initRsbuild(rootDir, config, pluginDriver, enableSSG, extraRsbuil
1625
1625
  return rsbuild;
1626
1626
  }
1627
1627
  function checkLanguageParity_normalizePath(filePath) {
1628
- return filePath.split(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].sep).join('/');
1628
+ return filePath.split(external_node_path_default.sep).join('/');
1629
1629
  }
1630
1630
  async function getAllMarkdownFilesFrom(dirPath) {
1631
- const files = await __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__["default"].readdir(dirPath, {
1631
+ const files = await promises_default.readdir(dirPath, {
1632
1632
  withFileTypes: true
1633
1633
  });
1634
1634
  const allFiles = [];
1635
1635
  for (const file of files){
1636
- const fullPath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(dirPath, file.name);
1636
+ const fullPath = external_node_path_default.join(dirPath, file.name);
1637
1637
  if (file.isDirectory()) {
1638
1638
  const nestedFiles = await getAllMarkdownFilesFrom(fullPath);
1639
1639
  allFiles.push(...nestedFiles);
1640
1640
  } else if ([
1641
1641
  '.md',
1642
1642
  '.mdx'
1643
- ].includes(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].extname(file.name))) allFiles.push(fullPath);
1643
+ ].includes(external_node_path_default.extname(file.name))) allFiles.push(fullPath);
1644
1644
  }
1645
1645
  return allFiles;
1646
1646
  }
1647
1647
  async function collectModuleFiles(contentPath, lang, includedDir, excludedDirs, fileLangMap) {
1648
- const langDirPath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(contentPath, lang);
1649
- const langModuleDir = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(langDirPath, includedDir);
1648
+ const langDirPath = external_node_path_default.join(contentPath, lang);
1649
+ const langModuleDir = external_node_path_default.join(langDirPath, includedDir);
1650
1650
  try {
1651
- const moduleDirStats = await __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__["default"].stat(langModuleDir);
1651
+ const moduleDirStats = await promises_default.stat(langModuleDir);
1652
1652
  if (!moduleDirStats.isDirectory()) return fileLangMap;
1653
1653
  const files = await getAllMarkdownFilesFrom(langModuleDir);
1654
1654
  for (const file of files){
1655
- const relativePath = checkLanguageParity_normalizePath(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].relative(langDirPath, file));
1655
+ const relativePath = checkLanguageParity_normalizePath(external_node_path_default.relative(langDirPath, file));
1656
1656
  if (excludedDirs.some((excludedDir)=>{
1657
1657
  const isFilePath = /\.(md|mdx)$/.test(excludedDir);
1658
1658
  return relativePath.includes(excludedDir + (isFilePath ? '' : '/'));
@@ -1662,21 +1662,21 @@ async function collectModuleFiles(contentPath, lang, includedDir, excludedDirs,
1662
1662
  fileLangMap[baseName].add(lang);
1663
1663
  }
1664
1664
  } catch (e) {
1665
- __WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__.logger.error(e);
1665
+ logger.error(e);
1666
1666
  throw new Error(`Failed to access directory: ${checkLanguageParity_normalizePath(langModuleDir)}`);
1667
1667
  }
1668
1668
  return fileLangMap;
1669
1669
  }
1670
1670
  async function checkLanguageParity(config) {
1671
1671
  if (!config?.languageParity || false === config.languageParity.enabled) return;
1672
- __WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__.logger.info('Checking language parity...');
1673
- const contentPath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(config.root);
1672
+ logger.info('Checking language parity...');
1673
+ const contentPath = external_node_path_default.resolve(config.root);
1674
1674
  const includedDirs = config.languageParity.include?.length ? config.languageParity.include : [
1675
1675
  ''
1676
1676
  ];
1677
1677
  const excludedDirs = config.languageParity.exclude ?? [];
1678
1678
  const supportedLanguages = (config.locales ?? config.themeConfig?.locales)?.map((locale)=>locale.lang) || [];
1679
- if (!supportedLanguages.length) return void __WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__.logger.error('No supported languages found in the configuration.');
1679
+ if (!supportedLanguages.length) return void logger.error('No supported languages found in the configuration.');
1680
1680
  const missingLanguagesFile = [];
1681
1681
  try {
1682
1682
  for (const includedDir of includedDirs){
@@ -1686,15 +1686,15 @@ async function checkLanguageParity(config) {
1686
1686
  for (const [baseName, langs] of Object.entries(curFileLangMap)){
1687
1687
  const missingLangs = supportedLanguages.filter((lang)=>!langs.has(lang));
1688
1688
  missingLangs.forEach((lang)=>{
1689
- const missingPath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(lang, baseName);
1689
+ const missingPath = external_node_path_default.join(lang, baseName);
1690
1690
  missingLanguagesFile.push(missingPath);
1691
1691
  });
1692
1692
  }
1693
1693
  }
1694
1694
  if (missingLanguagesFile.length > 0) throw new Error(`Check language parity failed! Missing content:\n${missingLanguagesFile.map((file)=>` - ${checkLanguageParity_normalizePath(file)}`).join('\n')}`);
1695
- __WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__.logger.success('Language parity checked successfully.');
1695
+ logger.success('Language parity checked successfully.');
1696
1696
  } catch (err) {
1697
- __WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__.logger.error('Error during language parity check: \n', err);
1697
+ logger.error('Error during language parity check: \n', err);
1698
1698
  throw err;
1699
1699
  }
1700
1700
  }
@@ -1729,7 +1729,7 @@ async function bundle(docDirectory, config, pluginDriver, enableSSG) {
1729
1729
  }
1730
1730
  }
1731
1731
  function emptyDir(path) {
1732
- return __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__["default"].rm(path, {
1732
+ return promises_default.rm(path, {
1733
1733
  force: true,
1734
1734
  recursive: true
1735
1735
  });
@@ -1753,7 +1753,7 @@ async function serve(options) {
1753
1753
  const { builderConfig } = config;
1754
1754
  const port = Number(envPort || userPort || builderConfig?.server?.port || 4173);
1755
1755
  const host = envHost || userHost || builderConfig?.server?.host || 'localhost';
1756
- config.builderConfig = (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.mergeRsbuildConfig)(builderConfig, {
1756
+ config.builderConfig = core_mergeRsbuildConfig(builderConfig, {
1757
1757
  server: {
1758
1758
  port,
1759
1759
  host
@@ -1797,40 +1797,40 @@ const getASTNodeImport = (name, from)=>({
1797
1797
  function normalizeLink(nodeUrl, routeService, relativePath, cleanUrls) {
1798
1798
  if (!nodeUrl) return '';
1799
1799
  if (nodeUrl.startsWith('#')) return `#${nodeUrl.slice(1)}`;
1800
- let { url, hash } = (0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.parseUrl)(nodeUrl);
1801
- if ((0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.isExternalUrl)(url)) return url + (hash ? `#${hash}` : '');
1802
- const extname = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].extname(url);
1803
- if ((routeService?.extensions ?? __WEBPACK_EXTERNAL_MODULE__rspress_shared_constants_70084e62__.DEFAULT_PAGE_EXTENSIONS).includes(extname)) url = url.replace(new RegExp(`\\${extname}$`), '');
1804
- if (url.startsWith('.')) url = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].posix.join((0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.slash)(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(relativePath)), url);
1800
+ let { url, hash } = parseUrl(nodeUrl);
1801
+ if (isExternalUrl(url)) return url + (hash ? `#${hash}` : '');
1802
+ const extname = external_node_path_default.extname(url);
1803
+ if ((routeService?.extensions ?? DEFAULT_PAGE_EXTENSIONS).includes(extname)) url = url.replace(new RegExp(`\\${extname}$`), '');
1804
+ if (url.startsWith('.')) url = external_node_path_default.posix.join(slash(external_node_path_default.dirname(relativePath)), url);
1805
1805
  else if (routeService) {
1806
- const [pathVersion, pathLang] = routeService.getRoutePathParts((0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.slash)(relativePath));
1806
+ const [pathVersion, pathLang] = routeService.getRoutePathParts(slash(relativePath));
1807
1807
  const [urlVersion, urlLang, urlPath] = routeService.getRoutePathParts(url);
1808
- url = (0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.addLeadingSlash)(urlPath);
1808
+ url = addLeadingSlash(urlPath);
1809
1809
  if (pathLang && urlLang !== pathLang) url = `/${pathLang}${url}`;
1810
1810
  if (pathVersion && urlVersion !== pathVersion) url = `/${pathVersion}${url}`;
1811
1811
  }
1812
- if ('boolean' == typeof cleanUrls) url = (0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.normalizeHref)(url, cleanUrls);
1812
+ if ('boolean' == typeof cleanUrls) url = normalizeHref(url, cleanUrls);
1813
1813
  else {
1814
- url = (0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.normalizeHref)(url, false);
1814
+ url = normalizeHref(url, false);
1815
1815
  url = url.replace(/\.html$/, cleanUrls);
1816
1816
  }
1817
1817
  if (hash) url += `#${hash}`;
1818
1818
  return url;
1819
1819
  }
1820
1820
  const normalizeImageUrl = (imageUrl)=>{
1821
- if ((0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.isExternalUrl)(imageUrl) || imageUrl.startsWith('/')) return '';
1821
+ if (isExternalUrl(imageUrl) || imageUrl.startsWith('/')) return '';
1822
1822
  return imageUrl;
1823
1823
  };
1824
1824
  const remarkPluginNormalizeLink = ({ root, cleanUrls, routeService })=>(tree, file)=>{
1825
1825
  const images = [];
1826
- (0, __WEBPACK_EXTERNAL_MODULE_unist_util_visit_555e002a__.visit)(tree, 'link', (node)=>{
1826
+ visit(tree, 'link', (node)=>{
1827
1827
  const { url: nodeUrl } = node;
1828
- const relativePath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].relative(root, file.path);
1828
+ const relativePath = external_node_path_default.relative(root, file.path);
1829
1829
  node.url = normalizeLink(nodeUrl, routeService, relativePath, cleanUrls);
1830
1830
  });
1831
- (0, __WEBPACK_EXTERNAL_MODULE_unist_util_visit_555e002a__.visit)(tree, 'definition', (node)=>{
1831
+ visit(tree, 'definition', (node)=>{
1832
1832
  const { url: nodeUrl } = node;
1833
- const relativePath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].relative(root, file.path);
1833
+ const relativePath = external_node_path_default.relative(root, file.path);
1834
1834
  node.url = normalizeLink(nodeUrl, routeService, relativePath, cleanUrls);
1835
1835
  });
1836
1836
  const getMdxSrcAttribute = (tempVar)=>({
@@ -1856,7 +1856,7 @@ const remarkPluginNormalizeLink = ({ root, cleanUrls, routeService })=>(tree, fi
1856
1856
  }
1857
1857
  }
1858
1858
  });
1859
- (0, __WEBPACK_EXTERNAL_MODULE_unist_util_visit_555e002a__.visit)(tree, 'image', (node)=>{
1859
+ visit(tree, 'image', (node)=>{
1860
1860
  const { alt, url } = node;
1861
1861
  if (!url) return;
1862
1862
  const imagePath = normalizeImageUrl(url);
@@ -1877,9 +1877,9 @@ const remarkPluginNormalizeLink = ({ root, cleanUrls, routeService })=>(tree, fi
1877
1877
  });
1878
1878
  images.push(getASTNodeImport(tempVariableName, imagePath));
1879
1879
  });
1880
- (0, __WEBPACK_EXTERNAL_MODULE_unist_util_visit_555e002a__.visit)(tree, (node)=>{
1880
+ visit(tree, (node)=>{
1881
1881
  if ('mdxJsxFlowElement' !== node.type && 'mdxJsxTextElement' !== node.type || 'img' !== node.name) return;
1882
- const srcAttr = (0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_node_utils_78947ce6__.getNodeAttribute)(node, 'src', true);
1882
+ const srcAttr = getNodeAttribute(node, 'src', true);
1883
1883
  if ('string' != typeof srcAttr?.value) return;
1884
1884
  const imagePath = normalizeImageUrl(srcAttr.value);
1885
1885
  if (!imagePath) return;
@@ -1889,5 +1889,4 @@ const remarkPluginNormalizeLink = ({ root, cleanUrls, routeService })=>(tree, fi
1889
1889
  });
1890
1890
  tree.children.unshift(...images);
1891
1891
  };
1892
- var __webpack_exports__mergeDocConfig = __WEBPACK_EXTERNAL_MODULE__rspress_shared_node_utils_78947ce6__.mergeDocConfig;
1893
- export { build, dev, remarkPluginNormalizeLink, serve, __webpack_exports__mergeDocConfig as mergeDocConfig };
1892
+ export { build, dev, mergeDocConfig, remarkPluginNormalizeLink, serve };