@rspress/core 0.0.6 → 0.0.8
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 +17 -11
- package/dist/index.js.map +1 -1
- package/dist/loader.js +2 -2
- package/dist/loader.js.map +1 -1
- package/dist/runtime/App.js +89 -0
- package/dist/runtime/Content.js +20 -0
- package/dist/runtime/NoSSR.js +16 -0
- package/dist/runtime/clientEntry.js +52 -0
- package/dist/runtime/hooks.js +20 -0
- package/dist/runtime/index.js +6 -0
- package/dist/runtime/ssrEntry.js +30 -0
- package/dist/runtime/utils.js +15 -0
- package/dist/theme/bundle.css +44 -19
- package/dist/theme/bundle.js +41 -38
- package/dist/theme/bundle.js.map +1 -1
- package/package.json +13 -13
- package/src/runtime/App.tsx +3 -1
- package/src/runtime/clientEntry.tsx +3 -1
- package/src/theme-default/components/HomeHero/index.tsx +2 -2
- package/src/theme-default/components/Sidebar/index.module.scss +6 -0
- package/src/theme-default/components/Tabs/index.module.scss +32 -6
- package/src/theme-default/components/Tabs/index.tsx +41 -39
- package/src/theme-default/styles/vars.css +7 -0
package/dist/index.js
CHANGED
|
@@ -63,6 +63,15 @@ var tailwindConfig = {
|
|
|
63
63
|
4: "var(--rp-c-gray-light-4)",
|
|
64
64
|
5: "var(--rp-c-gray-light-5)"
|
|
65
65
|
}
|
|
66
|
+
},
|
|
67
|
+
dark: {
|
|
68
|
+
light: {
|
|
69
|
+
1: "var(--rp-c-dark-light-1)",
|
|
70
|
+
2: "var(--rp-c-dark-light-2)",
|
|
71
|
+
3: "var(--rp-c-dark-light-3)",
|
|
72
|
+
4: "var(--rp-c-dark-light-4)",
|
|
73
|
+
5: "var(--rp-c-dark-light-5)"
|
|
74
|
+
}
|
|
66
75
|
}
|
|
67
76
|
}
|
|
68
77
|
}
|
|
@@ -77,8 +86,8 @@ var isProduction = () => process.env.NODE_ENV === "production";
|
|
|
77
86
|
var importStatementRegex = /import\s+(.*?)\s+from\s+['"](.*?)['"];?/gm;
|
|
78
87
|
var dirname = path.dirname(fileURLToPath(new URL(import.meta.url)));
|
|
79
88
|
var PACKAGE_ROOT = path.join(dirname, "..");
|
|
80
|
-
var CLIENT_ENTRY = path.join(PACKAGE_ROOT, "
|
|
81
|
-
var SSR_ENTRY = path.join(PACKAGE_ROOT, "
|
|
89
|
+
var CLIENT_ENTRY = path.join(PACKAGE_ROOT, "dist", "runtime", "clientEntry.js");
|
|
90
|
+
var SSR_ENTRY = path.join(PACKAGE_ROOT, "dist", "runtime", "ssrEntry.js");
|
|
82
91
|
var OUTPUT_DIR = "doc_build";
|
|
83
92
|
var APP_HTML_MARKER = "<!--<?- DOC_CONTENT ?>-->";
|
|
84
93
|
var HEAD_MARKER = "<!--<?- HEAD ?>-->";
|
|
@@ -129,8 +138,8 @@ var RuntimeModulesPlugin = class {
|
|
|
129
138
|
fs.writeFileSync(_class_private_method_get(this, _normalizePath, normalizePath).call(this, path10), content);
|
|
130
139
|
});
|
|
131
140
|
}
|
|
132
|
-
writeModule(
|
|
133
|
-
const normalizedPath = _class_private_method_get(this, _normalizePath, normalizePath).call(this,
|
|
141
|
+
writeModule(path10, content) {
|
|
142
|
+
const normalizedPath = _class_private_method_get(this, _normalizePath, normalizePath).call(this, path10);
|
|
134
143
|
this.staticModules[normalizedPath] = content;
|
|
135
144
|
fs.writeFileSync(normalizedPath, content);
|
|
136
145
|
}
|
|
@@ -648,7 +657,6 @@ async function globalStylesVMPlugin(context) {
|
|
|
648
657
|
const styleContent = await fs5.readFile(source, "utf-8");
|
|
649
658
|
const patchedStyleContent = styleContent.replace(/--modern-/g, "--rp-").replace(/\.modern-doc/g, ".rspress").replace(/\.modern-/g, ".rspress-");
|
|
650
659
|
await fs5.writeFile(source, patchedStyleContent, "utf-8");
|
|
651
|
-
console.log(`[globalStylesVMPlugin] patched ${source}`);
|
|
652
660
|
return `import ${JSON.stringify(source)};`;
|
|
653
661
|
}))).join("");
|
|
654
662
|
return new RuntimeModulesPlugin({
|
|
@@ -1067,15 +1075,15 @@ async function initRouteService(options) {
|
|
|
1067
1075
|
var require4 = createRequire3(import.meta.url);
|
|
1068
1076
|
async function createInternalBuildConfig(userRoot, config, isSSR, runtimeTempDir, routeService2) {
|
|
1069
1077
|
const cwd = process.cwd();
|
|
1070
|
-
const { default:
|
|
1078
|
+
const { default: fs12 } = await import("@modern-js/utils/fs-extra");
|
|
1071
1079
|
const CUSTOM_THEME_DIR = config?.themeDir ?? path9.join(process.cwd(), "theme");
|
|
1072
1080
|
const outDir = config?.outDir ?? OUTPUT_DIR;
|
|
1073
1081
|
const DEFAULT_THEME_DIR = isDebugMode() ? path9.join(PACKAGE_ROOT, "src", "theme-default") : path9.join(PACKAGE_ROOT, "dist", "theme");
|
|
1074
|
-
const themeDir = await
|
|
1082
|
+
const themeDir = await fs12.pathExists(CUSTOM_THEME_DIR) ? CUSTOM_THEME_DIR : DEFAULT_THEME_DIR;
|
|
1075
1083
|
const checkDeadLinks = (config?.markdown?.checkDeadLinks && !isSSR) ?? false;
|
|
1076
1084
|
const base = config?.base ?? "";
|
|
1077
1085
|
const publicDir = path9.join(userRoot, "public");
|
|
1078
|
-
const isPublicDirExist = await
|
|
1086
|
+
const isPublicDirExist = await fs12.pathExists(publicDir);
|
|
1079
1087
|
const assetPrefix = isProduction() ? removeTrailingSlash(config?.builderConfig?.output?.assetPrefix ?? base) : "";
|
|
1080
1088
|
const enableMdxRs = config?.markdown?.experimentalMdxRs ?? false;
|
|
1081
1089
|
const reactVersion = await detectReactVersion();
|
|
@@ -1121,8 +1129,7 @@ async function createInternalBuildConfig(userRoot, config, isSSR, runtimeTempDir
|
|
|
1121
1129
|
source: {
|
|
1122
1130
|
alias: {
|
|
1123
1131
|
"@mdx-js/react": require4.resolve("@mdx-js/react"),
|
|
1124
|
-
"
|
|
1125
|
-
"@/runtime": path9.join(PACKAGE_ROOT, "src", "runtime", "index.ts"),
|
|
1132
|
+
"@/runtime": path9.join(PACKAGE_ROOT, "dist", "runtime"),
|
|
1126
1133
|
"@theme": themeDir,
|
|
1127
1134
|
"@rspress/core": PACKAGE_ROOT,
|
|
1128
1135
|
"react-lazy-with-preload": require4.resolve("react-lazy-with-preload"),
|
|
@@ -1395,7 +1402,6 @@ async function dev(options) {
|
|
|
1395
1402
|
}));
|
|
1396
1403
|
},
|
|
1397
1404
|
// We will support the following options in the future
|
|
1398
|
-
// @ts-expect-error
|
|
1399
1405
|
getPortSilently: true,
|
|
1400
1406
|
logger: options.logger
|
|
1401
1407
|
});
|