@rspress/shared 0.0.0-nightly-20231018160139 → 0.0.0-nightly-20231020160328

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.d.ts CHANGED
@@ -291,29 +291,33 @@ interface RspressPlugin {
291
291
  config?: (config: UserConfig, utils: {
292
292
  addPlugin: (plugin: RspressPlugin) => void;
293
293
  removePlugin: (pluginName: string) => void;
294
- }) => UserConfig | Promise<UserConfig>;
294
+ }, isProd: boolean) => UserConfig | Promise<UserConfig>;
295
295
  /**
296
296
  * Callback before build
297
297
  */
298
- beforeBuild?: (config: UserConfig, isProd: boolean) => Promise<void>;
298
+ beforeBuild?: (config: UserConfig, isProd: boolean) => void | Promise<void>;
299
299
  /**
300
300
  * Callback after build
301
301
  */
302
- afterBuild?: (config: UserConfig, isProd: boolean) => Promise<void>;
302
+ afterBuild?: (config: UserConfig, isProd: boolean) => void | Promise<void>;
303
303
  /**
304
304
  * Extend every page's data
305
305
  */
306
306
  extendPageData?: (pageData: PageIndexInfo & {
307
307
  [key: string]: unknown;
308
- }) => void | Promise<void>;
308
+ }, isProd: boolean) => void | Promise<void>;
309
309
  /**
310
310
  * Add custom route
311
311
  */
312
312
  addPages?: (config: UserConfig, isProd: boolean) => AdditionalPage[] | Promise<AdditionalPage[]>;
313
+ /**
314
+ * Add runtime modules
315
+ */
316
+ addRuntimeModules?: (config: UserConfig, isProd: boolean) => Record<string, string> | Promise<Record<string, string>>;
313
317
  /**
314
318
  * Callback after route generated
315
319
  */
316
- routeGenerated?: (routes: RouteMeta[]) => Promise<void> | void;
320
+ routeGenerated?: (routes: RouteMeta[], isProd: boolean) => Promise<void> | void;
317
321
  /**
318
322
  * Add addition ssg routes, for dynamic routes.
319
323
  */
@@ -326,7 +330,7 @@ interface RspressPlugin {
326
330
  * @private
327
331
  * Modify search index data.
328
332
  */
329
- modifySearchIndexData?: (data: PageIndexInfo[]) => void | Promise<void>;
333
+ modifySearchIndexData?: (data: PageIndexInfo[], isProd: boolean) => void | Promise<void>;
330
334
  }
331
335
 
332
336
  interface Route {
@@ -664,6 +668,11 @@ declare function replaceLang(rawUrl: string, lang: {
664
668
  current: string;
665
669
  default: string;
666
670
  }, base?: string): string;
671
+ declare function replaceVersion(rawUrl: string, version: {
672
+ current: string;
673
+ target: string;
674
+ default: string;
675
+ }, base?: string): string;
667
676
  declare const omit: (obj: Record<string, unknown>, keys: string[]) => {
668
677
  [x: string]: unknown;
669
678
  };
@@ -679,4 +688,4 @@ declare function removeBase(url: string, base: string): string;
679
688
  declare function withoutHash(url: string): string;
680
689
  declare const mergeDocConfig: (...configs: UserConfig[]) => UserConfig;
681
690
 
682
- export { APPEARANCE_KEY, AdditionalPage, BaseRuntimePageInfo, Config, Config$1 as DefaultThemeConfig, DocFooter, EditLink, Feature, Footer, FrontMatterMeta, HASH_REGEXP, Header, Hero, Image, LocalSearchOptions, Locale, LocaleConfig, LocaleLink, LocaleLinks, MDX_REGEXP, MarkdownOptions, NavItem, NavItemWithChildren, NavItemWithLink, NavItemWithLinkAndChildren, NormalizedConfig, NormalizedConfig as NormalizedDefaultThemeConfig, NormalizedLocales, NormalizedSidebar, NormalizedSidebarGroup, PageData, PageIndexInfo, PageModule, PageType, RspressPlugin as Plugin, QUERY_REGEXP, RSPRESS_TEMP_DIR, RemotePageInfo, RemoteSearchIndexInfo, RemoteSearchOptions, ReplaceRule, Route, RouteMeta, RouteOptions, RspressPlugin, SEARCH_INDEX_NAME, SearchHooks, SearchOptions, Sidebar, SidebarGroup, SidebarItem, SiteData, SocialLink, SocialLinkIcon, UserConfig, addLeadingSlash, cleanUrl, inBrowser, isDebugMode, isExternalUrl, isProduction, isSCM, mergeDocConfig, normalizeHref, normalizePosixPath, normalizeSlash, omit, parseUrl, removeBase, removeLeadingSlash, removeTrailingSlash, replaceLang, slash, withBase, withoutBase, withoutHash, withoutLang };
691
+ export { APPEARANCE_KEY, AdditionalPage, BaseRuntimePageInfo, Config, Config$1 as DefaultThemeConfig, DocFooter, EditLink, Feature, Footer, FrontMatterMeta, HASH_REGEXP, Header, Hero, Image, LocalSearchOptions, Locale, LocaleConfig, LocaleLink, LocaleLinks, MDX_REGEXP, MarkdownOptions, NavItem, NavItemWithChildren, NavItemWithLink, NavItemWithLinkAndChildren, NormalizedConfig, NormalizedConfig as NormalizedDefaultThemeConfig, NormalizedLocales, NormalizedSidebar, NormalizedSidebarGroup, PageData, PageIndexInfo, PageModule, PageType, RspressPlugin as Plugin, QUERY_REGEXP, RSPRESS_TEMP_DIR, RemotePageInfo, RemoteSearchIndexInfo, RemoteSearchOptions, ReplaceRule, Route, RouteMeta, RouteOptions, RspressPlugin, SEARCH_INDEX_NAME, SearchHooks, SearchOptions, Sidebar, SidebarGroup, SidebarItem, SiteData, SocialLink, SocialLinkIcon, UserConfig, addLeadingSlash, cleanUrl, inBrowser, isDebugMode, isExternalUrl, isProduction, isSCM, mergeDocConfig, normalizeHref, normalizePosixPath, normalizeSlash, omit, parseUrl, removeBase, removeLeadingSlash, removeTrailingSlash, replaceLang, replaceVersion, slash, withBase, withoutBase, withoutHash, withoutLang };