@rspress/shared 2.0.8 → 2.0.9
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/584.js +710 -0
- package/dist/github-slugger.d.ts +47 -0
- package/dist/github-slugger.js +29 -0
- package/dist/gray-matter.d.ts +14 -0
- package/dist/gray-matter.js +2772 -0
- package/dist/gray-matter.js.LICENSE.txt +13 -0
- package/dist/index.d.ts +11 -0
- package/dist/lodash-es.d.ts +14 -0
- package/dist/lodash-es.js +678 -0
- package/dist/node-utils.d.ts +11 -0
- package/dist/node-utils.js +4 -6
- package/dist/rslib-runtime.js +38 -0
- package/package.json +18 -5
- package/LICENSE +0 -21
package/dist/node-utils.d.ts
CHANGED
|
@@ -251,6 +251,7 @@ declare interface MarkdownOptions {
|
|
|
251
251
|
remarkPlugins?: PluggableList;
|
|
252
252
|
rehypePlugins?: PluggableList;
|
|
253
253
|
link?: RemarkLinkOptions;
|
|
254
|
+
image?: RemarkImageOptions;
|
|
254
255
|
showLineNumbers?: boolean;
|
|
255
256
|
/**
|
|
256
257
|
* Whether to wrap code by default
|
|
@@ -360,6 +361,16 @@ declare interface PageIndexInfo {
|
|
|
360
361
|
|
|
361
362
|
declare type PageType = 'home' | 'doc' | 'doc-wide' | 'custom' | '404' | 'blank';
|
|
362
363
|
|
|
364
|
+
declare type RemarkImageOptions = {
|
|
365
|
+
/**
|
|
366
|
+
* Whether to enable check dead images
|
|
367
|
+
* @default true
|
|
368
|
+
*/
|
|
369
|
+
checkDeadImages?: boolean | {
|
|
370
|
+
excludes: string[] | ((url: string) => boolean);
|
|
371
|
+
};
|
|
372
|
+
};
|
|
373
|
+
|
|
363
374
|
declare type RemarkLinkOptions = {
|
|
364
375
|
/**
|
|
365
376
|
* Whether to enable check dead links
|
package/dist/node-utils.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import node_path from "node:path";
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
|
-
import
|
|
3
|
+
import { grayMatter } from "./gray-matter.js";
|
|
4
4
|
import { logger } from "./logger.js";
|
|
5
|
+
import { mergeWith as lodash_es_mergeWith } from "./584.js";
|
|
5
6
|
const extractTextAndId = (title)=>{
|
|
6
7
|
if (!title) return [
|
|
7
8
|
'',
|
|
@@ -34,7 +35,7 @@ function getNodeAttribute(node, attrName, attribute) {
|
|
|
34
35
|
}
|
|
35
36
|
function loadFrontMatter(source, filepath, root, outputWarning = false) {
|
|
36
37
|
try {
|
|
37
|
-
const { content, data } =
|
|
38
|
+
const { content, data } = grayMatter(source);
|
|
38
39
|
const rawFrontMatter = source.slice(0, source.length - content.length);
|
|
39
40
|
const emptyLinesSource = rawFrontMatter.length ? `${rawFrontMatter.replace(/[^\n]/g, '')}${content}` : content;
|
|
40
41
|
return {
|
|
@@ -54,9 +55,7 @@ function loadFrontMatter(source, filepath, root, outputWarning = false) {
|
|
|
54
55
|
const castArray = (value)=>Array.isArray(value) ? value : [
|
|
55
56
|
value
|
|
56
57
|
];
|
|
57
|
-
const mergeDocConfig = async (...configs)=>{
|
|
58
|
-
const { mergeWith } = await import("lodash-es");
|
|
59
|
-
return mergeWith({}, ...configs, (target, source)=>{
|
|
58
|
+
const mergeDocConfig = async (...configs)=>lodash_es_mergeWith({}, ...configs, (target, source)=>{
|
|
60
59
|
const pair = [
|
|
61
60
|
target,
|
|
62
61
|
source
|
|
@@ -67,5 +66,4 @@ const mergeDocConfig = async (...configs)=>{
|
|
|
67
66
|
...castArray(source)
|
|
68
67
|
];
|
|
69
68
|
});
|
|
70
|
-
};
|
|
71
69
|
export { extractTextAndId, getIconUrlPath, getNodeAttribute, loadFrontMatter, mergeDocConfig };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
var __webpack_modules__ = {};
|
|
2
|
+
var __webpack_module_cache__ = {};
|
|
3
|
+
function __webpack_require__(moduleId) {
|
|
4
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
5
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
6
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
7
|
+
exports: {}
|
|
8
|
+
};
|
|
9
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
10
|
+
return module.exports;
|
|
11
|
+
}
|
|
12
|
+
__webpack_require__.m = __webpack_modules__;
|
|
13
|
+
(()=>{
|
|
14
|
+
__webpack_require__.n = (module)=>{
|
|
15
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
16
|
+
__webpack_require__.d(getter, {
|
|
17
|
+
a: getter
|
|
18
|
+
});
|
|
19
|
+
return getter;
|
|
20
|
+
};
|
|
21
|
+
})();
|
|
22
|
+
(()=>{
|
|
23
|
+
__webpack_require__.d = (exports, definition)=>{
|
|
24
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: definition[key]
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
})();
|
|
30
|
+
(()=>{
|
|
31
|
+
__webpack_require__.add = function(modules) {
|
|
32
|
+
Object.assign(__webpack_require__.m, modules);
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
(()=>{
|
|
36
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
37
|
+
})();
|
|
38
|
+
export { __webpack_require__ };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspress/shared",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.9",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/web-infra-dev/rspress.git",
|
|
@@ -24,6 +24,18 @@
|
|
|
24
24
|
"./node-utils": {
|
|
25
25
|
"types": "./dist/node-utils.d.ts",
|
|
26
26
|
"default": "./dist/node-utils.js"
|
|
27
|
+
},
|
|
28
|
+
"./lodash-es": {
|
|
29
|
+
"types": "./dist/lodash-es.d.ts",
|
|
30
|
+
"default": "./dist/lodash-es.js"
|
|
31
|
+
},
|
|
32
|
+
"./github-slugger": {
|
|
33
|
+
"types": "./dist/github-slugger.d.ts",
|
|
34
|
+
"default": "./dist/github-slugger.js"
|
|
35
|
+
},
|
|
36
|
+
"./gray-matter": {
|
|
37
|
+
"types": "./dist/gray-matter.d.ts",
|
|
38
|
+
"default": "./dist/gray-matter.js"
|
|
27
39
|
}
|
|
28
40
|
},
|
|
29
41
|
"module": "./dist/index.js",
|
|
@@ -32,17 +44,18 @@
|
|
|
32
44
|
"dist"
|
|
33
45
|
],
|
|
34
46
|
"dependencies": {
|
|
35
|
-
"@rsbuild/core": "2.0.0-
|
|
47
|
+
"@rsbuild/core": "2.0.0-rc.1",
|
|
36
48
|
"@shikijs/rehype": "^4.0.2",
|
|
37
|
-
"gray-matter": "4.0.3",
|
|
38
|
-
"lodash-es": "^4.17.23",
|
|
39
49
|
"unified": "^11.0.5"
|
|
40
50
|
},
|
|
41
51
|
"devDependencies": {
|
|
42
|
-
"@rslib/core": "0.
|
|
52
|
+
"@rslib/core": "0.21.0",
|
|
43
53
|
"@types/lodash-es": "^4.17.12",
|
|
44
54
|
"@types/node": "^22.8.1",
|
|
45
55
|
"@types/react": "^19.2.14",
|
|
56
|
+
"github-slugger": "^2.0.0",
|
|
57
|
+
"gray-matter": "4.0.3",
|
|
58
|
+
"lodash-es": "^4.18.1",
|
|
46
59
|
"mdast-util-mdx-jsx": "^3.2.0",
|
|
47
60
|
"medium-zoom": "1.1.0",
|
|
48
61
|
"rimraf": "^6.1.3",
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2023-present Bytedance, Inc. and its affiliates.
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|