@rspress/core 2.0.0-beta.4 → 2.0.0-beta.5
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.js +6 -54
- package/dist/loader.js +0 -1
- package/package.json +10 -9
package/dist/index.js
CHANGED
|
@@ -20,7 +20,6 @@ import * as __WEBPACK_EXTERNAL_MODULE_html_to_text_2c51ed38__ from "html-to-text
|
|
|
20
20
|
import * as __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__ from "node:fs";
|
|
21
21
|
import * as __WEBPACK_EXTERNAL_MODULE__mdx_js_mdx_b904bd09__ from "@mdx-js/mdx";
|
|
22
22
|
import * as __WEBPACK_EXTERNAL_MODULE_enhanced_resolve_bf4706da__ from "enhanced-resolve";
|
|
23
|
-
import * as __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__ from "node:module";
|
|
24
23
|
import * as __WEBPACK_EXTERNAL_MODULE__unhead_react_server_7e85c952__ from "@unhead/react/server";
|
|
25
24
|
import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__ from "@rsbuild/core";
|
|
26
25
|
import * as __WEBPACK_EXTERNAL_MODULE_unist_util_visit_555e002a__ from "unist-util-visit";
|
|
@@ -37,6 +36,7 @@ class PluginDriver {
|
|
|
37
36
|
async init() {
|
|
38
37
|
this.clearPlugins();
|
|
39
38
|
const config = this.#config;
|
|
39
|
+
const markdownConfig = config.markdown || {};
|
|
40
40
|
const themeConfig = config?.themeConfig || {};
|
|
41
41
|
const enableLastUpdated = themeConfig?.lastUpdated || themeConfig?.locales?.some((locale)=>locale.lastUpdated);
|
|
42
42
|
const mediumZoomConfig = config?.mediumZoom ?? true;
|
|
@@ -54,9 +54,11 @@ class PluginDriver {
|
|
|
54
54
|
const SourceBuildPlugin = await import("@rspress/theme-default/node/source-build-plugin.js").then((r)=>r.SourceBuildPlugin, ()=>null);
|
|
55
55
|
if (SourceBuildPlugin) this.addPlugin(SourceBuildPlugin());
|
|
56
56
|
}
|
|
57
|
+
const { pluginShiki } = await import("@rspress/plugin-shiki");
|
|
57
58
|
(config.plugins || []).forEach((plugin)=>{
|
|
58
59
|
this.addPlugin(plugin);
|
|
59
60
|
});
|
|
61
|
+
this.addPlugin(pluginShiki(markdownConfig.shiki));
|
|
60
62
|
if (!haveNavSidebarConfig) {
|
|
61
63
|
const { pluginAutoNavSidebar } = await import("@rspress/plugin-auto-nav-sidebar");
|
|
62
64
|
this.addPlugin(pluginAutoNavSidebar());
|
|
@@ -177,7 +179,7 @@ const pluginVirtualModule = (pluginOptions = {})=>({
|
|
|
177
179
|
}
|
|
178
180
|
}
|
|
179
181
|
});
|
|
180
|
-
var package_namespaceObject = JSON.parse('{"i8":"2.0.0-beta.
|
|
182
|
+
var package_namespaceObject = JSON.parse('{"i8":"2.0.0-beta.5"}');
|
|
181
183
|
const RSPRESS_VERSION = package_namespaceObject.i8;
|
|
182
184
|
const isProduction = ()=>'production' === process.env.NODE_ENV;
|
|
183
185
|
const importStatementRegex = /import\s+(.*?)\s+from\s+(['"])(.*?)(?:"|');?/gm;
|
|
@@ -468,7 +470,6 @@ var types_RuntimeModuleID = /*#__PURE__*/ function(RuntimeModuleID) {
|
|
|
468
470
|
RuntimeModuleID["SearchIndexHash"] = "virtual-search-index-hash";
|
|
469
471
|
RuntimeModuleID["I18nText"] = "virtual-i18n-text";
|
|
470
472
|
RuntimeModuleID["SearchHooks"] = "virtual-search-hooks";
|
|
471
|
-
RuntimeModuleID["PrismLanguages"] = "virtual-prism-languages";
|
|
472
473
|
return RuntimeModuleID;
|
|
473
474
|
}({});
|
|
474
475
|
async function routeVMPlugin(context) {
|
|
@@ -672,45 +673,6 @@ async function extractPageData(replaceRules, alias, domain, root, routeService,
|
|
|
672
673
|
}));
|
|
673
674
|
return pageData.filter(Boolean);
|
|
674
675
|
}
|
|
675
|
-
const highlightLanguages_require = (0, __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__.createRequire)(import.meta.url);
|
|
676
|
-
let highlightLanguages_supportedLanguages;
|
|
677
|
-
function handleHighlightLanguages(highlightLanguages, defaultLanguages) {
|
|
678
|
-
const aliases = {};
|
|
679
|
-
if (highlightLanguages.size) {
|
|
680
|
-
if (!highlightLanguages_supportedLanguages) {
|
|
681
|
-
const langs = highlightLanguages_require('react-syntax-highlighter/dist/cjs/languages/prism/supported-languages').default;
|
|
682
|
-
highlightLanguages_supportedLanguages = new Set(langs);
|
|
683
|
-
}
|
|
684
|
-
let useDeprecatedTypeWarning = true;
|
|
685
|
-
const names = {};
|
|
686
|
-
[
|
|
687
|
-
...__WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.DEFAULT_HIGHLIGHT_LANGUAGES,
|
|
688
|
-
...defaultLanguages
|
|
689
|
-
].forEach((lang)=>{
|
|
690
|
-
if (Array.isArray(lang)) {
|
|
691
|
-
const [alias, name] = lang;
|
|
692
|
-
names[alias] = name;
|
|
693
|
-
} else if (useDeprecatedTypeWarning) {
|
|
694
|
-
console.log(`${__WEBPACK_EXTERNAL_MODULE_picocolors__["default"].yellowBright('warning')} Automatic import is supported. \`highlightLanguages\` is now used only as alias, and string types will be ignored. \n`);
|
|
695
|
-
useDeprecatedTypeWarning = false;
|
|
696
|
-
}
|
|
697
|
-
});
|
|
698
|
-
[
|
|
699
|
-
...highlightLanguages.values()
|
|
700
|
-
].forEach((lang)=>{
|
|
701
|
-
const name = names[lang];
|
|
702
|
-
if (name && highlightLanguages_supportedLanguages.has(name)) {
|
|
703
|
-
const temp = aliases[name] || (aliases[name] = []);
|
|
704
|
-
if (!temp.includes(lang)) temp.push(lang);
|
|
705
|
-
highlightLanguages.delete(lang);
|
|
706
|
-
highlightLanguages.add(name);
|
|
707
|
-
return;
|
|
708
|
-
}
|
|
709
|
-
if (!highlightLanguages_supportedLanguages.has(lang)) highlightLanguages.delete(lang);
|
|
710
|
-
});
|
|
711
|
-
}
|
|
712
|
-
return aliases;
|
|
713
|
-
}
|
|
714
676
|
const DEFAULT_I18N_SOURCE = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(process.cwd(), 'i18n.json');
|
|
715
677
|
function getI18nData(docConfig) {
|
|
716
678
|
const { i18nSourcePath = DEFAULT_I18N_SOURCE } = docConfig;
|
|
@@ -907,23 +869,13 @@ async function siteDataVMPlugin(context) {
|
|
|
907
869
|
markdown: {
|
|
908
870
|
showLineNumbers: userConfig?.markdown?.showLineNumbers ?? false,
|
|
909
871
|
defaultWrapCode: userConfig?.markdown?.defaultWrapCode ?? false,
|
|
910
|
-
|
|
872
|
+
shiki: {}
|
|
911
873
|
}
|
|
912
874
|
};
|
|
913
|
-
const { highlightLanguages: defaultLanguages = [] } = config.markdown || {};
|
|
914
875
|
if (Array.isArray(siteData.pages[0]?.extraHighlightLanguages)) siteData.pages[0].extraHighlightLanguages.forEach((lang)=>highlightLanguages.add(lang));
|
|
915
|
-
const aliases = handleHighlightLanguages(highlightLanguages, defaultLanguages);
|
|
916
|
-
const sortedAliases = Object.fromEntries(Object.entries(aliases).sort());
|
|
917
|
-
const sortedHighlightLanguages = Array.from(highlightLanguages).sort();
|
|
918
876
|
return {
|
|
919
877
|
[`${types_RuntimeModuleID.SiteData}.mjs`]: `export default ${JSON.stringify(siteData, null, 2)}`,
|
|
920
|
-
[types_RuntimeModuleID.SearchIndexHash]: `export default ${JSON.stringify(indexHashByGroup, null, 2)}
|
|
921
|
-
[types_RuntimeModuleID.PrismLanguages]: `export const aliases = ${JSON.stringify(sortedAliases, null, 2)};
|
|
922
|
-
export const languages = {
|
|
923
|
-
${sortedHighlightLanguages.map((lang)=>`"${lang}": require(
|
|
924
|
-
"react-syntax-highlighter/dist/cjs/languages/prism/${lang}"
|
|
925
|
-
).default`)}
|
|
926
|
-
}`
|
|
878
|
+
[types_RuntimeModuleID.SearchIndexHash]: `export default ${JSON.stringify(indexHashByGroup, null, 2)}`
|
|
927
879
|
};
|
|
928
880
|
}
|
|
929
881
|
const runtimeModuleFactory = [
|
package/dist/loader.js
CHANGED
|
@@ -39,7 +39,6 @@ var types_RuntimeModuleID = /*#__PURE__*/ function(RuntimeModuleID) {
|
|
|
39
39
|
RuntimeModuleID["SearchIndexHash"] = "virtual-search-index-hash";
|
|
40
40
|
RuntimeModuleID["I18nText"] = "virtual-i18n-text";
|
|
41
41
|
RuntimeModuleID["SearchHooks"] = "virtual-search-hooks";
|
|
42
|
-
RuntimeModuleID["PrismLanguages"] = "virtual-prism-languages";
|
|
43
42
|
return RuntimeModuleID;
|
|
44
43
|
}({});
|
|
45
44
|
function applyReplaceRules(code = '', replaceRules = []) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspress/core",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.5",
|
|
4
4
|
"description": "The Rspress Documentation Framework",
|
|
5
5
|
"bugs": "https://github.com/web-infra-dev/rspress/issues",
|
|
6
6
|
"repository": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@mdx-js/loader": "^3.1.0",
|
|
46
46
|
"@mdx-js/mdx": "^3.1.0",
|
|
47
47
|
"@mdx-js/react": "^3.1.0",
|
|
48
|
-
"@rsbuild/core": "1.3.
|
|
48
|
+
"@rsbuild/core": "1.3.17",
|
|
49
49
|
"@rsbuild/plugin-react": "~1.3.0",
|
|
50
50
|
"@rspress/mdx-rs": "0.6.6",
|
|
51
51
|
"@types/unist": "^3.0.0",
|
|
@@ -71,13 +71,14 @@
|
|
|
71
71
|
"unified": "^11.0.5",
|
|
72
72
|
"unist-util-visit": "^5.0.0",
|
|
73
73
|
"unist-util-visit-children": "^3.0.0",
|
|
74
|
-
"@rspress/plugin-container-syntax": "2.0.0-beta.
|
|
75
|
-
"@rspress/plugin-last-updated": "2.0.0-beta.
|
|
76
|
-
"@rspress/plugin-
|
|
77
|
-
"@rspress/
|
|
78
|
-
"@rspress/
|
|
79
|
-
"@rspress/
|
|
80
|
-
"@rspress/
|
|
74
|
+
"@rspress/plugin-container-syntax": "2.0.0-beta.5",
|
|
75
|
+
"@rspress/plugin-last-updated": "2.0.0-beta.5",
|
|
76
|
+
"@rspress/plugin-auto-nav-sidebar": "2.0.0-beta.5",
|
|
77
|
+
"@rspress/plugin-medium-zoom": "2.0.0-beta.5",
|
|
78
|
+
"@rspress/runtime": "2.0.0-beta.5",
|
|
79
|
+
"@rspress/plugin-shiki": "2.0.0-beta.5",
|
|
80
|
+
"@rspress/shared": "2.0.0-beta.5",
|
|
81
|
+
"@rspress/theme-default": "2.0.0-beta.5"
|
|
81
82
|
},
|
|
82
83
|
"devDependencies": {
|
|
83
84
|
"@microsoft/api-extractor": "^7.52.7",
|