@rspress/shared 0.0.0-next-20231115072918 → 0.0.0-next-20240201084444

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.
@@ -0,0 +1,2 @@
1
+ export * from 'chalk';
2
+ export { default } from 'chalk';
package/dist/chalk.js ADDED
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+
31
+ // src/chalk.ts
32
+ var chalk_exports = {};
33
+ __export(chalk_exports, {
34
+ default: () => import_chalk.default
35
+ });
36
+ module.exports = __toCommonJS(chalk_exports);
37
+ __reExport(chalk_exports, require("chalk"), module.exports);
38
+ var import_chalk = __toESM(require("chalk"));
39
+ // Annotate the CommonJS export names for ESM import in node:
40
+ 0 && (module.exports = {
41
+ ...require("chalk")
42
+ });
package/dist/chalk.mjs ADDED
@@ -0,0 +1,6 @@
1
+ // src/chalk.ts
2
+ export * from "chalk";
3
+ import { default as default2 } from "chalk";
4
+ export {
5
+ default2 as default
6
+ };
@@ -0,0 +1,2 @@
1
+ export * from 'execa';
2
+ export { default } from 'execa';
package/dist/execa.js ADDED
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+
31
+ // src/execa.ts
32
+ var execa_exports = {};
33
+ __export(execa_exports, {
34
+ default: () => import_execa.default
35
+ });
36
+ module.exports = __toCommonJS(execa_exports);
37
+ __reExport(execa_exports, require("execa"), module.exports);
38
+ var import_execa = __toESM(require("execa"));
39
+ // Annotate the CommonJS export names for ESM import in node:
40
+ 0 && (module.exports = {
41
+ ...require("execa")
42
+ });
package/dist/execa.mjs ADDED
@@ -0,0 +1,6 @@
1
+ // src/execa.ts
2
+ export * from "execa";
3
+ import { default as default2 } from "execa";
4
+ export {
5
+ default2 as default
6
+ };
@@ -0,0 +1,2 @@
1
+ export * from 'fs-extra';
2
+ export { default } from 'fs-extra';
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+
31
+ // src/fs-extra.ts
32
+ var fs_extra_exports = {};
33
+ __export(fs_extra_exports, {
34
+ default: () => import_fs_extra.default
35
+ });
36
+ module.exports = __toCommonJS(fs_extra_exports);
37
+ __reExport(fs_extra_exports, require("fs-extra"), module.exports);
38
+ var import_fs_extra = __toESM(require("fs-extra"));
39
+ // Annotate the CommonJS export names for ESM import in node:
40
+ 0 && (module.exports = {
41
+ ...require("fs-extra")
42
+ });
@@ -0,0 +1,6 @@
1
+ // src/fs-extra.ts
2
+ export * from "fs-extra";
3
+ import { default as default2 } from "fs-extra";
4
+ export {
5
+ default2 as default
6
+ };
package/dist/index.d.ts CHANGED
@@ -111,6 +111,10 @@ interface Config$1 {
111
111
  * The next page text.
112
112
  */
113
113
  nextPageText?: string;
114
+ /**
115
+ * The source code text.
116
+ */
117
+ sourceCodeText?: string;
114
118
  /**
115
119
  * Locale config
116
120
  */
@@ -119,6 +123,10 @@ interface Config$1 {
119
123
  * Whether to open the full text search
120
124
  */
121
125
  search?: boolean;
126
+ /**
127
+ * The placeholder of search input
128
+ */
129
+ searchPlaceholderText?: string;
122
130
  /**
123
131
  * The behavior of hiding navbar
124
132
  */
@@ -150,7 +158,9 @@ interface LocaleConfig {
150
158
  editLink?: EditLink;
151
159
  prevPageText?: string;
152
160
  nextPageText?: string;
161
+ sourceCodeText?: string;
153
162
  langRoutePrefix?: string;
163
+ searchPlaceholderText?: string;
154
164
  }
155
165
  type Nav = NavItem[] | {
156
166
  [key: string]: NavItem[];
@@ -616,7 +626,7 @@ interface SearchHooks {
616
626
  searchHooks?: string;
617
627
  }
618
628
  type LocalSearchOptions = SearchHooks & {
619
- mode: 'local';
629
+ mode?: 'local';
620
630
  };
621
631
  type RemoteSearchIndexInfo = string | {
622
632
  value: string;
@@ -630,6 +640,12 @@ type RemoteSearchOptions = SearchHooks & {
630
640
  searchIndexes?: RemoteSearchIndexInfo[];
631
641
  };
632
642
  type SearchOptions = LocalSearchOptions | RemoteSearchOptions | false;
643
+ interface MdxRsOptions {
644
+ /**
645
+ * Determine whether the file use mdxRs compiler
646
+ */
647
+ include?: (filepath: string) => boolean;
648
+ }
633
649
  interface MarkdownOptions {
634
650
  remarkPlugins?: PluggableList;
635
651
  rehypePlugins?: PluggableList;
@@ -657,7 +673,7 @@ interface MarkdownOptions {
657
673
  /**
658
674
  * Whether to enable mdx-rs, default is true
659
675
  */
660
- mdxRs?: boolean;
676
+ mdxRs?: boolean | MdxRsOptions;
661
677
  /**
662
678
  * @deprecated, use `mdxRs` instead
663
679
  */
@@ -685,7 +701,8 @@ declare function removeLeadingSlash(url: string): string;
685
701
  declare function addTrailingSlash(url: string): string;
686
702
  declare function removeTrailingSlash(url: string): string;
687
703
  declare function normalizeSlash(url: string): string;
688
- declare function isExternalUrl(url: string): boolean;
704
+ declare function isExternalUrl(url?: string): boolean;
705
+ declare function isDataUrl(url?: string): boolean;
689
706
  declare function replaceLang(rawUrl: string, lang: {
690
707
  current: string;
691
708
  target: string;
@@ -693,12 +710,12 @@ declare function replaceLang(rawUrl: string, lang: {
693
710
  }, version: {
694
711
  current: string;
695
712
  default: string;
696
- }, base?: string): string;
713
+ }, base?: string, cleanUrls?: boolean): string;
697
714
  declare function replaceVersion(rawUrl: string, version: {
698
715
  current: string;
699
716
  target: string;
700
717
  default: string;
701
- }, base?: string): string;
718
+ }, base?: string, cleanUrls?: boolean): string;
702
719
  declare const omit: (obj: Record<string, unknown>, keys: string[]) => {
703
720
  [x: string]: unknown;
704
721
  };
@@ -714,4 +731,4 @@ declare function removeBase(url: string, base: string): string;
714
731
  declare function withoutHash(url: string): string;
715
732
  declare const mergeDocConfig: (...configs: UserConfig[]) => UserConfig;
716
733
 
717
- export { APPEARANCE_KEY, AdditionalPage, BaseRuntimePageInfo, Config, DEFAULT_HIGHLIGHT_LANGUAGES, Config$1 as DefaultThemeConfig, DocFooter, EditLink, Feature, Footer, FrontMatterMeta, HASH_REGEXP, Header, Hero, Image, LocalSearchOptions, Locale, LocaleConfig, LocaleLink, LocaleLinks, MDX_REGEXP, MarkdownOptions, Nav, NavItem, NavItemWithChildren, NavItemWithLink, NavItemWithLinkAndChildren, NormalizedConfig, NormalizedConfig as NormalizedDefaultThemeConfig, NormalizedLocales, NormalizedSidebar, NormalizedSidebarGroup, PageData, PageIndexInfo, PageModule, PageType, RspressPlugin as Plugin, QUERY_REGEXP, RSPRESS_TEMP_DIR, RemotePageInfo, RemoteSearchIndexInfo, RemoteSearchOptions, ReplaceRule, Route, RouteMeta, RouteOptions, RspressPlugin, SEARCH_INDEX_NAME, SearchHooks, SearchOptions, Sidebar, SidebarDivider, SidebarGroup, SidebarItem, SiteData, SocialLink, SocialLinkIcon, UserConfig, addLeadingSlash, addTrailingSlash, cleanUrl, inBrowser, isDebugMode, isExternalUrl, isProduction, isSCM, mergeDocConfig, normalizeHref, normalizePosixPath, normalizeSlash, omit, parseUrl, removeBase, removeHash, removeLeadingSlash, removeTrailingSlash, replaceLang, replaceVersion, slash, withBase, withoutBase, withoutHash, withoutLang };
734
+ export { APPEARANCE_KEY, type AdditionalPage, type BaseRuntimePageInfo, type Config, DEFAULT_HIGHLIGHT_LANGUAGES, type Config$1 as DefaultThemeConfig, type DocFooter, type EditLink, type Feature, type Footer, type FrontMatterMeta, HASH_REGEXP, type Header, type Hero, type Image, type LocalSearchOptions, type Locale, type LocaleConfig, type LocaleLink, type LocaleLinks, MDX_REGEXP, type MarkdownOptions, type MdxRsOptions, type Nav, type NavItem, type NavItemWithChildren, type NavItemWithLink, type NavItemWithLinkAndChildren, type NormalizedConfig, type NormalizedConfig as NormalizedDefaultThemeConfig, type NormalizedLocales, type NormalizedSidebar, type NormalizedSidebarGroup, type PageData, type PageIndexInfo, type PageModule, type PageType, type RspressPlugin as Plugin, QUERY_REGEXP, RSPRESS_TEMP_DIR, type RemotePageInfo, type RemoteSearchIndexInfo, type RemoteSearchOptions, type ReplaceRule, type Route, type RouteMeta, type RouteOptions, type RspressPlugin, SEARCH_INDEX_NAME, type SearchHooks, type SearchOptions, type Sidebar, type SidebarDivider, type SidebarGroup, type SidebarItem, type SiteData, type SocialLink, type SocialLinkIcon, type UserConfig, addLeadingSlash, addTrailingSlash, cleanUrl, inBrowser, isDataUrl, isDebugMode, isExternalUrl, isProduction, isSCM, mergeDocConfig, normalizeHref, normalizePosixPath, normalizeSlash, omit, parseUrl, removeBase, removeHash, removeLeadingSlash, removeTrailingSlash, replaceLang, replaceVersion, slash, withBase, withoutBase, withoutHash, withoutLang };
package/dist/index.js CHANGED
@@ -31,6 +31,7 @@ __export(src_exports, {
31
31
  addTrailingSlash: () => addTrailingSlash,
32
32
  cleanUrl: () => cleanUrl,
33
33
  inBrowser: () => inBrowser,
34
+ isDataUrl: () => isDataUrl,
34
35
  isDebugMode: () => isDebugMode,
35
36
  isExternalUrl: () => isExternalUrl,
36
37
  isProduction: () => isProduction,
@@ -1110,7 +1111,7 @@ function isUndefined(value) {
1110
1111
  }
1111
1112
  var isUndefined_default = isUndefined;
1112
1113
 
1113
- // src/utils/index.ts
1114
+ // src/runtime-utils/index.ts
1114
1115
  var QUERY_REGEXP = /\?.*$/s;
1115
1116
  var HASH_REGEXP = /#.*$/s;
1116
1117
  var MDX_REGEXP = /\.mdx?$/;
@@ -1183,16 +1184,19 @@ function removeTrailingSlash(url) {
1183
1184
  function normalizeSlash(url) {
1184
1185
  return removeTrailingSlash(addLeadingSlash(normalizePosixPath(url)));
1185
1186
  }
1186
- function isExternalUrl(url) {
1187
+ function isExternalUrl(url = "") {
1187
1188
  return url.startsWith("http://") || url.startsWith("https://") || url.startsWith("mailto:") || url.startsWith("tel:");
1188
1189
  }
1189
- function replaceLang(rawUrl, lang, version, base = "") {
1190
+ function isDataUrl(url = "") {
1191
+ return /^\s*data:/i.test(url);
1192
+ }
1193
+ function replaceLang(rawUrl, lang, version, base = "", cleanUrls = false) {
1190
1194
  let url = removeBase(rawUrl, base);
1191
1195
  if (!url) {
1192
- url = "/index.html";
1196
+ url = cleanUrls ? "/index" : "/index.html";
1193
1197
  }
1194
1198
  if (url.endsWith("/")) {
1195
- url += "index.html";
1199
+ url += cleanUrls ? "/index" : "/index.html";
1196
1200
  }
1197
1201
  let versionPart = "";
1198
1202
  let langPart = "";
@@ -1211,7 +1215,7 @@ function replaceLang(rawUrl, lang, version, base = "") {
1211
1215
  }
1212
1216
  purePathPart = parts.join("/") || "";
1213
1217
  if ((versionPart || langPart) && !purePathPart) {
1214
- purePathPart = "index.html";
1218
+ purePathPart = cleanUrls ? "index" : "index.html";
1215
1219
  }
1216
1220
  return withBase(
1217
1221
  addLeadingSlash(
@@ -1220,10 +1224,10 @@ function replaceLang(rawUrl, lang, version, base = "") {
1220
1224
  base
1221
1225
  );
1222
1226
  }
1223
- function replaceVersion(rawUrl, version, base = "") {
1227
+ function replaceVersion(rawUrl, version, base = "", cleanUrls = false) {
1224
1228
  let url = removeBase(rawUrl, base);
1225
1229
  if (!url) {
1226
- url = "/index.html";
1230
+ url = cleanUrls ? "/index" : "/index.html";
1227
1231
  }
1228
1232
  let versionPart = "";
1229
1233
  const parts = url.split("/").filter(Boolean);
@@ -1237,7 +1241,7 @@ function replaceVersion(rawUrl, version, base = "") {
1237
1241
  }
1238
1242
  let restPart = parts.join("/") || "";
1239
1243
  if (versionPart && !restPart) {
1240
- restPart = "index.html";
1244
+ restPart = cleanUrls ? "index" : "index.html";
1241
1245
  }
1242
1246
  return withBase(
1243
1247
  addLeadingSlash([versionPart, restPart].filter(Boolean).join("/")),
@@ -1266,9 +1270,6 @@ function normalizeHref(url, cleanUrls = false) {
1266
1270
  return url;
1267
1271
  }
1268
1272
  let { url: cleanUrl2, hash } = parseUrl(decodeURIComponent(url));
1269
- if (url.startsWith("mailto:") || url.startsWith("tel:")) {
1270
- return url;
1271
- }
1272
1273
  const hasExt = cleanUrl2.split("/").pop()?.includes(".");
1273
1274
  if (!cleanUrls && !cleanUrl2.endsWith(".html") && !hasExt) {
1274
1275
  if (cleanUrl2.endsWith("/")) {
@@ -1277,6 +1278,9 @@ function normalizeHref(url, cleanUrls = false) {
1277
1278
  cleanUrl2 += ".html";
1278
1279
  }
1279
1280
  }
1281
+ if (cleanUrls && cleanUrl2.endsWith("/")) {
1282
+ cleanUrl2 += "index";
1283
+ }
1280
1284
  return addLeadingSlash(hash ? `${cleanUrl2}#${hash}` : cleanUrl2);
1281
1285
  }
1282
1286
  function withoutLang(path, langs) {
@@ -1323,6 +1327,7 @@ var mergeDocConfig = (...configs) => mergeWith_default({}, ...configs, (target,
1323
1327
  addTrailingSlash,
1324
1328
  cleanUrl,
1325
1329
  inBrowser,
1330
+ isDataUrl,
1326
1331
  isDebugMode,
1327
1332
  isExternalUrl,
1328
1333
  isProduction,
package/dist/index.mjs CHANGED
@@ -1053,7 +1053,7 @@ function isUndefined(value) {
1053
1053
  }
1054
1054
  var isUndefined_default = isUndefined;
1055
1055
 
1056
- // src/utils/index.ts
1056
+ // src/runtime-utils/index.ts
1057
1057
  var QUERY_REGEXP = /\?.*$/s;
1058
1058
  var HASH_REGEXP = /#.*$/s;
1059
1059
  var MDX_REGEXP = /\.mdx?$/;
@@ -1126,16 +1126,19 @@ function removeTrailingSlash(url) {
1126
1126
  function normalizeSlash(url) {
1127
1127
  return removeTrailingSlash(addLeadingSlash(normalizePosixPath(url)));
1128
1128
  }
1129
- function isExternalUrl(url) {
1129
+ function isExternalUrl(url = "") {
1130
1130
  return url.startsWith("http://") || url.startsWith("https://") || url.startsWith("mailto:") || url.startsWith("tel:");
1131
1131
  }
1132
- function replaceLang(rawUrl, lang, version, base = "") {
1132
+ function isDataUrl(url = "") {
1133
+ return /^\s*data:/i.test(url);
1134
+ }
1135
+ function replaceLang(rawUrl, lang, version, base = "", cleanUrls = false) {
1133
1136
  let url = removeBase(rawUrl, base);
1134
1137
  if (!url) {
1135
- url = "/index.html";
1138
+ url = cleanUrls ? "/index" : "/index.html";
1136
1139
  }
1137
1140
  if (url.endsWith("/")) {
1138
- url += "index.html";
1141
+ url += cleanUrls ? "/index" : "/index.html";
1139
1142
  }
1140
1143
  let versionPart = "";
1141
1144
  let langPart = "";
@@ -1154,7 +1157,7 @@ function replaceLang(rawUrl, lang, version, base = "") {
1154
1157
  }
1155
1158
  purePathPart = parts.join("/") || "";
1156
1159
  if ((versionPart || langPart) && !purePathPart) {
1157
- purePathPart = "index.html";
1160
+ purePathPart = cleanUrls ? "index" : "index.html";
1158
1161
  }
1159
1162
  return withBase(
1160
1163
  addLeadingSlash(
@@ -1163,10 +1166,10 @@ function replaceLang(rawUrl, lang, version, base = "") {
1163
1166
  base
1164
1167
  );
1165
1168
  }
1166
- function replaceVersion(rawUrl, version, base = "") {
1169
+ function replaceVersion(rawUrl, version, base = "", cleanUrls = false) {
1167
1170
  let url = removeBase(rawUrl, base);
1168
1171
  if (!url) {
1169
- url = "/index.html";
1172
+ url = cleanUrls ? "/index" : "/index.html";
1170
1173
  }
1171
1174
  let versionPart = "";
1172
1175
  const parts = url.split("/").filter(Boolean);
@@ -1180,7 +1183,7 @@ function replaceVersion(rawUrl, version, base = "") {
1180
1183
  }
1181
1184
  let restPart = parts.join("/") || "";
1182
1185
  if (versionPart && !restPart) {
1183
- restPart = "index.html";
1186
+ restPart = cleanUrls ? "index" : "index.html";
1184
1187
  }
1185
1188
  return withBase(
1186
1189
  addLeadingSlash([versionPart, restPart].filter(Boolean).join("/")),
@@ -1209,9 +1212,6 @@ function normalizeHref(url, cleanUrls = false) {
1209
1212
  return url;
1210
1213
  }
1211
1214
  let { url: cleanUrl2, hash } = parseUrl(decodeURIComponent(url));
1212
- if (url.startsWith("mailto:") || url.startsWith("tel:")) {
1213
- return url;
1214
- }
1215
1215
  const hasExt = cleanUrl2.split("/").pop()?.includes(".");
1216
1216
  if (!cleanUrls && !cleanUrl2.endsWith(".html") && !hasExt) {
1217
1217
  if (cleanUrl2.endsWith("/")) {
@@ -1220,6 +1220,9 @@ function normalizeHref(url, cleanUrls = false) {
1220
1220
  cleanUrl2 += ".html";
1221
1221
  }
1222
1222
  }
1223
+ if (cleanUrls && cleanUrl2.endsWith("/")) {
1224
+ cleanUrl2 += "index";
1225
+ }
1223
1226
  return addLeadingSlash(hash ? `${cleanUrl2}#${hash}` : cleanUrl2);
1224
1227
  }
1225
1228
  function withoutLang(path, langs) {
@@ -1265,6 +1268,7 @@ export {
1265
1268
  addTrailingSlash,
1266
1269
  cleanUrl,
1267
1270
  inBrowser,
1271
+ isDataUrl,
1268
1272
  isDebugMode,
1269
1273
  isExternalUrl,
1270
1274
  isProduction,
package/dist/logger.d.ts CHANGED
@@ -1 +1,4 @@
1
- export { logger } from 'rslog';
1
+ export { logger } from '@rsbuild/core';
2
+ import 'fs-extra';
3
+ import 'chalk';
4
+ import 'execa';
package/dist/logger.js CHANGED
@@ -20,10 +20,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/logger.ts
21
21
  var logger_exports = {};
22
22
  __export(logger_exports, {
23
- logger: () => import_rslog.logger
23
+ logger: () => import_core.logger
24
24
  });
25
25
  module.exports = __toCommonJS(logger_exports);
26
- var import_rslog = require("rslog");
26
+ var import_core = require("@rsbuild/core");
27
27
  // Annotate the CommonJS export names for ESM import in node:
28
28
  0 && (module.exports = {
29
29
  logger
package/dist/logger.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/logger.ts
2
- import { logger } from "rslog";
2
+ import { logger } from "@rsbuild/core";
3
3
  export {
4
4
  logger
5
5
  };
@@ -0,0 +1,6 @@
1
+ declare function loadFrontMatter(source: string, filepath: string, root: string, outputWarning?: boolean): {
2
+ frontmatter: Record<string, string>;
3
+ content: string;
4
+ };
5
+
6
+ export { loadFrontMatter };
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/node-utils.ts
31
+ var node_utils_exports = {};
32
+ __export(node_utils_exports, {
33
+ loadFrontMatter: () => loadFrontMatter
34
+ });
35
+ module.exports = __toCommonJS(node_utils_exports);
36
+
37
+ // src/node-utils/loadFrontMatter.ts
38
+ var import_path = __toESM(require("path"));
39
+ var import_gray_matter = __toESM(require("gray-matter"));
40
+
41
+ // src/logger.ts
42
+ var import_core = require("@rsbuild/core");
43
+
44
+ // src/node-utils/loadFrontMatter.ts
45
+ function loadFrontMatter(source, filepath, root, outputWarning = false) {
46
+ let frontmatter = {};
47
+ let content = "";
48
+ try {
49
+ ({ data: frontmatter, content } = (0, import_gray_matter.default)(source));
50
+ } catch (e) {
51
+ if (outputWarning) {
52
+ import_core.logger.warn(
53
+ `Parse frontmatter error: ${e.message} in ${import_path.default.relative(
54
+ root,
55
+ filepath
56
+ )}`
57
+ );
58
+ }
59
+ }
60
+ return { frontmatter, content };
61
+ }
62
+ // Annotate the CommonJS export names for ESM import in node:
63
+ 0 && (module.exports = {
64
+ loadFrontMatter
65
+ });
@@ -0,0 +1,28 @@
1
+ // src/node-utils/loadFrontMatter.ts
2
+ import path from "path";
3
+ import grayMatter from "gray-matter";
4
+
5
+ // src/logger.ts
6
+ import { logger } from "@rsbuild/core";
7
+
8
+ // src/node-utils/loadFrontMatter.ts
9
+ function loadFrontMatter(source, filepath, root, outputWarning = false) {
10
+ let frontmatter = {};
11
+ let content = "";
12
+ try {
13
+ ({ data: frontmatter, content } = grayMatter(source));
14
+ } catch (e) {
15
+ if (outputWarning) {
16
+ logger.warn(
17
+ `Parse frontmatter error: ${e.message} in ${path.relative(
18
+ root,
19
+ filepath
20
+ )}`
21
+ );
22
+ }
23
+ }
24
+ return { frontmatter, content };
25
+ }
26
+ export {
27
+ loadFrontMatter
28
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspress/shared",
3
- "version": "0.0.0-next-20231115072918",
3
+ "version": "0.0.0-next-20240201084444",
4
4
  "types": "./dist/index.d.ts",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -15,17 +15,39 @@
15
15
  "require": "./dist/index.js",
16
16
  "types": "./dist/index.d.ts"
17
17
  },
18
+ "./execa": {
19
+ "import": "./dist/execa.mjs",
20
+ "require": "./dist/execa.js",
21
+ "types": "./dist/execa.d.ts"
22
+ },
23
+ "./chalk": {
24
+ "import": "./dist/chalk.mjs",
25
+ "require": "./dist/chalk.js",
26
+ "types": "./dist/chalk.d.ts"
27
+ },
28
+ "./fs-extra": {
29
+ "import": "./dist/fs-extra.mjs",
30
+ "require": "./dist/fs-extra.js",
31
+ "types": "./dist/fs-extra.d.ts"
32
+ },
18
33
  "./logger": {
19
34
  "import": "./dist/logger.mjs",
20
35
  "require": "./dist/logger.js",
21
36
  "types": "./dist/logger.d.ts"
37
+ },
38
+ "./node-utils": {
39
+ "import": "./dist/node-utils.mjs",
40
+ "require": "./dist/node-utils.js",
41
+ "types": "./dist/node-utils.d.ts"
22
42
  }
23
43
  },
24
44
  "dependencies": {
25
- "@rsbuild/core": "0.0.0-next-20231115072032",
45
+ "@rsbuild/core": "0.3.10",
26
46
  "unified": "10.1.2",
27
47
  "chalk": "4.1.2",
28
- "rslog": "^1.1.0"
48
+ "execa": "5.1.1",
49
+ "fs-extra": "11.2.0",
50
+ "gray-matter": "4.0.3"
29
51
  },
30
52
  "devDependencies": {
31
53
  "lodash-es": "^4.17.21",
@@ -39,7 +61,8 @@
39
61
  "rimraf": "~3.0.2",
40
62
  "ts-node": "^10.9.1",
41
63
  "typescript": "~5.0.4",
42
- "medium-zoom": "1.0.8"
64
+ "medium-zoom": "1.0.8",
65
+ "@types/fs-extra": "11.0.4"
43
66
  },
44
67
  "sideEffects": [],
45
68
  "publishConfig": {
@@ -47,6 +70,7 @@
47
70
  "provenance": true,
48
71
  "registry": "https://registry.npmjs.org/"
49
72
  },
73
+ "license": "MIT",
50
74
  "files": [
51
75
  "bin",
52
76
  "dist"