@rspress/shared 2.0.0-beta.14 → 2.0.0-beta.16

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
@@ -449,9 +449,8 @@ export declare interface PageData {
449
449
  * and should not be used in the runtime (usePageData).
450
450
  */
451
451
  export declare interface PageIndexInfo {
452
- id: number;
453
- title: string;
454
452
  routePath: string;
453
+ title: string;
455
454
  toc: Header[];
456
455
  content: string;
457
456
  _flattenContent?: string;
@@ -626,6 +625,7 @@ declare interface RspressPlugin {
626
625
  addPages?: (config: UserConfig, isProd: boolean) => AdditionalPage[] | Promise<AdditionalPage[]>;
627
626
  /**
628
627
  * Add runtime modules
628
+ * @deprecated use [rsbuild-plugin-virtual-module](https://github.com/rspack-contrib/rsbuild-plugin-virtual-module) instead.
629
629
  */
630
630
  addRuntimeModules?: (config: UserConfig, isProd: boolean) => Record<string, string> | Promise<Record<string, string>>;
631
631
  /**
@@ -376,9 +376,8 @@ declare interface NavItemWithLinkAndChildren {
376
376
  * and should not be used in the runtime (usePageData).
377
377
  */
378
378
  declare interface PageIndexInfo {
379
- id: number;
380
- title: string;
381
379
  routePath: string;
380
+ title: string;
382
381
  toc: Header[];
383
382
  content: string;
384
383
  _flattenContent?: string;
@@ -493,6 +492,7 @@ declare interface RspressPlugin {
493
492
  addPages?: (config: UserConfig, isProd: boolean) => AdditionalPage[] | Promise<AdditionalPage[]>;
494
493
  /**
495
494
  * Add runtime modules
495
+ * @deprecated use [rsbuild-plugin-virtual-module](https://github.com/rspack-contrib/rsbuild-plugin-virtual-module) instead.
496
496
  */
497
497
  addRuntimeModules?: (config: UserConfig, isProd: boolean) => Record<string, string> | Promise<Record<string, string>>;
498
498
  /**
@@ -1,6 +1,6 @@
1
- import external_node_path_default from "node:path";
1
+ import node_path from "node:path";
2
2
  import { fileURLToPath } from "node:url";
3
- import external_gray_matter_default from "gray-matter";
3
+ import gray_matter from "gray-matter";
4
4
  import { logger } from "@rsbuild/core";
5
5
  const extractTextAndId = (title)=>{
6
6
  if (!title) return [
@@ -25,8 +25,8 @@ function getIconUrlPath(icon) {
25
25
  if (!icon) return;
26
26
  icon = icon.toString();
27
27
  if (icon.startsWith('file://')) icon = fileURLToPath(icon);
28
- if (!external_node_path_default.isAbsolute(icon)) return icon;
29
- return `/${external_node_path_default.basename(icon)}`;
28
+ if (!node_path.isAbsolute(icon)) return icon;
29
+ return `/${node_path.basename(icon)}`;
30
30
  }
31
31
  function getNodeAttribute(node, attrName, attribute) {
32
32
  const found = node.attributes.find((attr)=>'name' in attr && attr.name === attrName);
@@ -34,7 +34,7 @@ function getNodeAttribute(node, attrName, attribute) {
34
34
  }
35
35
  function loadFrontMatter(source, filepath, root, outputWarning = false) {
36
36
  try {
37
- const { content, data } = external_gray_matter_default(source);
37
+ const { content, data } = gray_matter(source);
38
38
  const rawFrontMatter = source.slice(0, source.length - content.length);
39
39
  const emptyLinesSource = rawFrontMatter.length ? `${rawFrontMatter.replace(/[^\n]/g, '')}${content}` : content;
40
40
  return {
@@ -43,7 +43,7 @@ function loadFrontMatter(source, filepath, root, outputWarning = false) {
43
43
  emptyLinesSource
44
44
  };
45
45
  } catch (e) {
46
- if (outputWarning) logger.warn(`Parse frontmatter error in ${external_node_path_default.relative(root, filepath)}: \n`, e);
46
+ if (outputWarning) logger.warn(`Parse frontmatter error in ${node_path.relative(root, filepath)}: \n`, e);
47
47
  }
48
48
  return {
49
49
  content: '',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspress/shared",
3
- "version": "2.0.0-beta.14",
3
+ "version": "2.0.0-beta.16",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/web-infra-dev/rspress.git",
@@ -39,11 +39,11 @@
39
39
  "unified": "^11.0.5"
40
40
  },
41
41
  "devDependencies": {
42
- "@rslib/core": "0.9.2",
42
+ "@rslib/core": "0.10.0",
43
43
  "@types/jest": "~29.5.14",
44
44
  "@types/lodash-es": "^4.17.12",
45
45
  "@types/node": "^22.8.1",
46
- "@types/react": "^19.1.6",
46
+ "@types/react": "^19.1.8",
47
47
  "mdast-util-mdx-jsx": "^3.2.0",
48
48
  "medium-zoom": "1.1.0",
49
49
  "rimraf": "^6.0.1",