@rspress/shared 1.43.6 → 1.43.7

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.
@@ -1,4 +1,6 @@
1
- import { MdxJsxAttributeValueExpression } from 'mdast-util-mdx-jsx';
1
+ import type { MdxJsxAttribute } from 'mdast-util-mdx-jsx';
2
+ import type { MdxJsxAttributeValueExpression } from 'mdast-util-mdx-jsx';
3
+ import type { MdxJsxExpressionAttribute } from 'mdast-util-mdx-jsx';
2
4
  import type { MdxJsxFlowElement } from 'mdast-util-mdx-jsx';
3
5
  import type { MdxJsxTextElement } from 'mdast-util-mdx-jsx';
4
6
  import type { PluggableList } from 'unified';
@@ -204,7 +206,9 @@ declare interface FrontMatterMeta {
204
206
  [key: string]: unknown;
205
207
  }
206
208
 
207
- export declare const getNodeAttribute: (node: MdxJsxFlowElement | MdxJsxTextElement, attrName: string) => string | MdxJsxAttributeValueExpression | null | undefined;
209
+ export declare function getNodeAttribute(node: MdxJsxFlowElement | MdxJsxTextElement, attrName: string, attribute?: false): string | MdxJsxAttributeValueExpression | null | undefined;
210
+
211
+ export declare function getNodeAttribute(node: MdxJsxFlowElement | MdxJsxTextElement, attrName: string, attribute: true): MdxJsxAttribute | MdxJsxExpressionAttribute | undefined;
208
212
 
209
213
  declare interface Header {
210
214
  id: string;
@@ -72,7 +72,10 @@ var __webpack_exports__ = {};
72
72
  customId
73
73
  ];
74
74
  };
75
- const getNodeAttribute = (node, attrName)=>node.attributes.find((attr)=>'name' in attr && attr.name === attrName)?.value;
75
+ function getNodeAttribute(node, attrName, attribute) {
76
+ const found = node.attributes.find((attr)=>'name' in attr && attr.name === attrName);
77
+ return attribute ? found : found?.value;
78
+ }
76
79
  const external_node_path_namespaceObject = require("node:path");
77
80
  var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
78
81
  const external_gray_matter_namespaceObject = require("gray-matter");
@@ -14,7 +14,10 @@ const extractTextAndId = (title)=>{
14
14
  customId
15
15
  ];
16
16
  };
17
- const getNodeAttribute = (node, attrName)=>node.attributes.find((attr)=>'name' in attr && attr.name === attrName)?.value;
17
+ function getNodeAttribute(node, attrName, attribute) {
18
+ const found = node.attributes.find((attr)=>'name' in attr && attr.name === attrName);
19
+ return attribute ? found : found?.value;
20
+ }
18
21
  function loadFrontMatter(source, filepath, root, outputWarning = false) {
19
22
  try {
20
23
  const { content, data } = (0, __WEBPACK_EXTERNAL_MODULE_gray_matter_90c6cd0b__["default"])(source);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspress/shared",
3
- "version": "1.43.6",
3
+ "version": "1.43.7",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/web-infra-dev/rspress",