@rspress/core 1.0.0-beta.1 → 1.0.0-beta.3
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 +19 -12
- package/dist/index.js.map +1 -1
- package/dist/runtime/App.d.ts +1 -0
- package/dist/theme/bundle.d.ts +1 -0
- package/dist/theme/bundle.js +14 -4
- package/dist/theme/bundle.js.map +1 -1
- package/package.json +7 -10
- package/src/theme-default/components/Search/SearchPanel.tsx +1 -0
- package/src/theme-default/components/Tabs/index.tsx +9 -1
- package/src/theme-default/layout/DocLayout/docComponents/link.tsx +2 -1
- package/src/theme-default/layout/Layout/index.tsx +11 -1
package/dist/index.js
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
|
+
import { createRequire } from "module";
|
|
2
|
+
const { url } = import.meta;
|
|
3
|
+
const require = createRequire(url);
|
|
4
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
5
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
6
|
+
}) : x)(function(x) {
|
|
7
|
+
if (typeof require !== "undefined")
|
|
8
|
+
return require.apply(this, arguments);
|
|
9
|
+
throw new Error('Dynamic require of "' + x + '" is not supported');
|
|
10
|
+
});
|
|
11
|
+
|
|
1
12
|
// src/node/dev.ts
|
|
2
13
|
import { removeLeadingSlash as removeLeadingSlash2 } from "@rspress/shared";
|
|
3
14
|
import { logger as logger3 } from "@rspress/shared/logger";
|
|
4
15
|
|
|
5
16
|
// src/node/createBuilder.ts
|
|
6
17
|
import path8 from "path";
|
|
7
|
-
import { createRequire as createRequire2 } from "module";
|
|
8
18
|
import fs8 from "@modern-js/utils/fs-extra";
|
|
9
19
|
import { RSPRESS_TEMP_DIR as RSPRESS_TEMP_DIR2, isDebugMode, removeTrailingSlash } from "@rspress/shared";
|
|
10
20
|
import sirv from "sirv";
|
|
@@ -288,13 +298,11 @@ async function flattenMdxContent(content, basePath, alias) {
|
|
|
288
298
|
|
|
289
299
|
// src/node/runtimeModule/i18n.ts
|
|
290
300
|
import { join } from "path";
|
|
291
|
-
import { createRequire } from "module";
|
|
292
|
-
var require2 = createRequire(import.meta.url);
|
|
293
301
|
var DEFAULT_I18N_SOURCE = join(process.cwd(), "i18n.json");
|
|
294
302
|
function getI18nData(docConfig) {
|
|
295
303
|
const { i18nSourcePath = DEFAULT_I18N_SOURCE } = docConfig;
|
|
296
304
|
try {
|
|
297
|
-
const i18nSource =
|
|
305
|
+
const i18nSource = __require(i18nSourcePath);
|
|
298
306
|
return i18nSource;
|
|
299
307
|
} catch (e) {
|
|
300
308
|
return {};
|
|
@@ -1072,7 +1080,6 @@ async function initRouteService(options) {
|
|
|
1072
1080
|
}
|
|
1073
1081
|
|
|
1074
1082
|
// src/node/createBuilder.ts
|
|
1075
|
-
var require3 = createRequire2(import.meta.url);
|
|
1076
1083
|
async function createInternalBuildConfig(userDocRoot, config, isSSR, routeService2, pluginDriver) {
|
|
1077
1084
|
const cwd = process.cwd();
|
|
1078
1085
|
const { default: fs10 } = await import("@modern-js/utils/fs-extra");
|
|
@@ -1085,7 +1092,7 @@ async function createInternalBuildConfig(userDocRoot, config, isSSR, routeServic
|
|
|
1085
1092
|
const publicDir = path8.join(userDocRoot, "public");
|
|
1086
1093
|
const isPublicDirExist = await fs10.pathExists(publicDir);
|
|
1087
1094
|
const assetPrefix = isProduction() ? removeTrailingSlash(config?.builderConfig?.output?.assetPrefix ?? base) : "";
|
|
1088
|
-
const enableMdxRs = config?.markdown?.
|
|
1095
|
+
const enableMdxRs = config?.markdown?.mdxRs ?? true;
|
|
1089
1096
|
const reactVersion = await detectReactVersion();
|
|
1090
1097
|
const normalizeIcon = (icon) => {
|
|
1091
1098
|
if (!icon) {
|
|
@@ -1137,12 +1144,12 @@ async function createInternalBuildConfig(userDocRoot, config, isSSR, routeServic
|
|
|
1137
1144
|
},
|
|
1138
1145
|
source: {
|
|
1139
1146
|
alias: {
|
|
1140
|
-
"@mdx-js/react":
|
|
1147
|
+
"@mdx-js/react": __require.resolve("@mdx-js/react"),
|
|
1141
1148
|
"@/runtime": path8.join(PACKAGE_ROOT, "dist", "runtime"),
|
|
1142
1149
|
"@theme": themeDir,
|
|
1143
1150
|
"@/theme-default": DEFAULT_THEME_DIR,
|
|
1144
1151
|
"@rspress/core": PACKAGE_ROOT,
|
|
1145
|
-
"react-lazy-with-preload":
|
|
1152
|
+
"react-lazy-with-preload": __require.resolve("react-lazy-with-preload"),
|
|
1146
1153
|
...await resolveReactAlias(reactVersion)
|
|
1147
1154
|
},
|
|
1148
1155
|
include: [
|
|
@@ -1172,7 +1179,7 @@ async function createInternalBuildConfig(userDocRoot, config, isSSR, routeServic
|
|
|
1172
1179
|
},
|
|
1173
1180
|
postcss(config2) {
|
|
1174
1181
|
if (isDebugMode()) {
|
|
1175
|
-
config2.postcssOptions.plugins.push(
|
|
1182
|
+
config2.postcssOptions.plugins.push(__require("tailwindcss")({
|
|
1176
1183
|
config: {
|
|
1177
1184
|
...tailwindConfig,
|
|
1178
1185
|
content: [
|
|
@@ -1186,18 +1193,18 @@ async function createInternalBuildConfig(userDocRoot, config, isSSR, routeServic
|
|
|
1186
1193
|
// This config can be removed after upgrading Rspack v0.4
|
|
1187
1194
|
// https://github.com/web-infra-dev/rspack/issues/3096
|
|
1188
1195
|
optimization: {
|
|
1189
|
-
chunkIds: "deterministic"
|
|
1196
|
+
chunkIds: isProduction() ? "deterministic" : "named"
|
|
1190
1197
|
}
|
|
1191
1198
|
},
|
|
1192
1199
|
bundlerChain(chain) {
|
|
1193
|
-
chain.module.rule("MDX").type("jsx").test(/\.mdx?$/).oneOf("MDXCompile").use("mdx-loader").loader(
|
|
1200
|
+
chain.module.rule("MDX").type("jsx").test(/\.mdx?$/).oneOf("MDXCompile").use("mdx-loader").loader(__require.resolve("../loader.cjs")).options({
|
|
1194
1201
|
config,
|
|
1195
1202
|
docDirectory: userDocRoot,
|
|
1196
1203
|
checkDeadLinks,
|
|
1197
1204
|
enableMdxRs,
|
|
1198
1205
|
routeService: routeService2,
|
|
1199
1206
|
pluginDriver
|
|
1200
|
-
}).end().use("string-replace-loader").loader(
|
|
1207
|
+
}).end().use("string-replace-loader").loader(__require.resolve("string-replace-loader")).options({
|
|
1201
1208
|
multiple: config?.replaceRules || []
|
|
1202
1209
|
});
|
|
1203
1210
|
chain.resolve.extensions.prepend(".md").prepend(".mdx").prepend(".mjs");
|