@rspress/shared 1.1.3 → 1.2.1

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/dist/index.d.ts +16 -7
  2. package/package.json +3 -3
package/dist/index.d.ts CHANGED
@@ -220,7 +220,7 @@ interface SocialLink {
220
220
  mode: 'link' | 'text' | 'img';
221
221
  content: string;
222
222
  }
223
- type SocialLinkIcon = 'lark' | 'discord' | 'facebook' | 'github' | 'instagram' | 'linkedin' | 'slack' | 'twitter' | 'youtube' | 'weixin' | 'qq' | 'juejin' | 'zhihu' | 'bilibili' | 'weibo' | 'gitlab' | {
223
+ type SocialLinkIcon = 'lark' | 'discord' | 'facebook' | 'github' | 'instagram' | 'linkedin' | 'slack' | 'twitter' | 'youtube' | 'wechat' | 'qq' | 'juejin' | 'zhihu' | 'bilibili' | 'weibo' | 'gitlab' | {
224
224
  svg: string;
225
225
  };
226
226
  interface Footer {
@@ -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 {
@@ -448,6 +452,10 @@ interface UserConfig<ThemeConfig = Config$1> {
448
452
  * Search options
449
453
  */
450
454
  search?: SearchOptions;
455
+ /**
456
+ * Whether to enable ssg, default is true
457
+ */
458
+ ssg?: boolean;
451
459
  /**
452
460
  * Whether to enable medium-zoom, default is true
453
461
  */
@@ -493,6 +501,7 @@ interface SiteData<ThemeConfig = NormalizedConfig> {
493
501
  };
494
502
  pages: BaseRuntimePageInfo[];
495
503
  search: SearchOptions;
504
+ ssg: boolean;
496
505
  markdown: {
497
506
  showLineNumbers: boolean;
498
507
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspress/shared",
3
- "version": "1.1.3",
3
+ "version": "1.2.1",
4
4
  "types": "./dist/index.d.ts",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -22,8 +22,8 @@
22
22
  }
23
23
  },
24
24
  "dependencies": {
25
- "@modern-js/builder": "2.37.1",
26
- "@modern-js/builder-rspack-provider": "2.37.1",
25
+ "@modern-js/builder": "2.38.0",
26
+ "@modern-js/builder-rspack-provider": "2.38.0",
27
27
  "unified": "10.1.2",
28
28
  "chalk": "4.1.2",
29
29
  "rslog": "^1.1.0"