@rspress-theme-anatole/shared 0.6.1-alpha.1 → 0.6.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.
Files changed (2) hide show
  1. package/dist/index.js +57 -52
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,20 +1,20 @@
1
1
  "use strict";
2
2
  var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.d = function(exports1, definition) {
5
- for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
3
+ (() => {
4
+ __webpack_require__.d = function (exports1, definition) {
5
+ for (var key in definition) if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
6
  enumerable: true,
7
7
  get: definition[key]
8
8
  });
9
9
  };
10
10
  })();
11
- (()=>{
12
- __webpack_require__.o = function(obj, prop) {
11
+ (() => {
12
+ __webpack_require__.o = function (obj, prop) {
13
13
  return Object.prototype.hasOwnProperty.call(obj, prop);
14
14
  };
15
15
  })();
16
- (()=>{
17
- __webpack_require__.r = function(exports1) {
16
+ (() => {
17
+ __webpack_require__.r = function (exports1) {
18
18
  if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
19
19
  value: 'Module'
20
20
  });
@@ -26,37 +26,37 @@ var __webpack_require__ = {};
26
26
  var __webpack_exports__ = {};
27
27
  __webpack_require__.r(__webpack_exports__);
28
28
  __webpack_require__.d(__webpack_exports__, {
29
- SEARCH_INDEX_NAME: ()=>SEARCH_INDEX_NAME,
30
- RSPRESS_TEMP_DIR: ()=>RSPRESS_TEMP_DIR,
31
- QUERY_REGEXP: ()=>QUERY_REGEXP,
32
- isDebugMode: ()=>isDebugMode,
33
- addTrailingSlash: ()=>addTrailingSlash,
34
- slash: ()=>slash,
35
- removeLeadingSlash: ()=>removeLeadingSlash,
36
- withoutBase: ()=>withoutBase,
37
- replaceVersion: ()=>replaceVersion,
38
- HASH_REGEXP: ()=>HASH_REGEXP,
39
- isSCM: ()=>isSCM,
40
- MDX_OR_MD_REGEXP: ()=>MDX_OR_MD_REGEXP,
41
- normalizeHref: ()=>normalizeHref,
42
- normalizeSlash: ()=>normalizeSlash,
43
- normalizePosixPath: ()=>normalizePosixPath,
44
- inBrowser: ()=>inBrowser,
45
- isDataUrl: ()=>isDataUrl,
46
- replaceLang: ()=>replaceLang,
47
- removeHash: ()=>removeHash,
48
- cleanUrl: ()=>runtime_utils_cleanUrl,
49
- withBase: ()=>withBase,
50
- isDevDebugMode: ()=>isDevDebugMode,
51
- removeTrailingSlash: ()=>removeTrailingSlash,
52
- APPEARANCE_KEY: ()=>APPEARANCE_KEY,
53
- isExternalUrl: ()=>isExternalUrl,
54
- removeBase: ()=>removeBase,
55
- DEFAULT_HIGHLIGHT_LANGUAGES: ()=>DEFAULT_HIGHLIGHT_LANGUAGES,
56
- parseUrl: ()=>parseUrl,
57
- withoutLang: ()=>withoutLang,
58
- isProduction: ()=>isProduction,
59
- addLeadingSlash: ()=>addLeadingSlash
29
+ SEARCH_INDEX_NAME: () => SEARCH_INDEX_NAME,
30
+ RSPRESS_TEMP_DIR: () => RSPRESS_TEMP_DIR,
31
+ QUERY_REGEXP: () => QUERY_REGEXP,
32
+ isDebugMode: () => isDebugMode,
33
+ addTrailingSlash: () => addTrailingSlash,
34
+ slash: () => slash,
35
+ removeLeadingSlash: () => removeLeadingSlash,
36
+ withoutBase: () => withoutBase,
37
+ replaceVersion: () => replaceVersion,
38
+ HASH_REGEXP: () => HASH_REGEXP,
39
+ isSCM: () => isSCM,
40
+ MDX_OR_MD_REGEXP: () => MDX_OR_MD_REGEXP,
41
+ normalizeHref: () => normalizeHref,
42
+ normalizeSlash: () => normalizeSlash,
43
+ normalizePosixPath: () => normalizePosixPath,
44
+ inBrowser: () => inBrowser,
45
+ isDataUrl: () => isDataUrl,
46
+ replaceLang: () => replaceLang,
47
+ removeHash: () => removeHash,
48
+ cleanUrl: () => runtime_utils_cleanUrl,
49
+ withBase: () => withBase,
50
+ isDevDebugMode: () => isDevDebugMode,
51
+ removeTrailingSlash: () => removeTrailingSlash,
52
+ APPEARANCE_KEY: () => APPEARANCE_KEY,
53
+ isExternalUrl: () => isExternalUrl,
54
+ removeBase: () => removeBase,
55
+ DEFAULT_HIGHLIGHT_LANGUAGES: () => DEFAULT_HIGHLIGHT_LANGUAGES,
56
+ parseUrl: () => parseUrl,
57
+ withoutLang: () => withoutLang,
58
+ isProduction: () => isProduction,
59
+ addLeadingSlash: () => addLeadingSlash
60
60
  });
61
61
  const QUERY_REGEXP = /\?.*$/s;
62
62
  const HASH_REGEXP = /#.*$/s;
@@ -90,19 +90,19 @@ const DEFAULT_HIGHLIGHT_LANGUAGES = [
90
90
  'tsx'
91
91
  ]
92
92
  ];
93
- const isSCM = ()=>Boolean(process.env.BUILD_VERSION);
94
- const isProduction = ()=>'production' === process.env.NODE_ENV;
95
- const isDebugMode = ()=>{
93
+ const isSCM = () => Boolean(process.env.BUILD_VERSION);
94
+ const isProduction = () => 'production' === process.env.NODE_ENV;
95
+ const isDebugMode = () => {
96
96
  if (!process.env.DEBUG) return false;
97
97
  const values = process.env.DEBUG?.toLocaleLowerCase().split(',') ?? [];
98
98
  return [
99
99
  'rsbuild',
100
100
  'builder',
101
101
  '*'
102
- ].some((key)=>values.includes(key));
102
+ ].some((key) => values.includes(key));
103
103
  };
104
- const isDevDebugMode = ()=>'rspress-dev' === process.env.DEBUG;
105
- const runtime_utils_cleanUrl = (url)=>url.replace(HASH_REGEXP, '').replace(QUERY_REGEXP, '');
104
+ const isDevDebugMode = () => 'rspress-dev' === process.env.DEBUG;
105
+ const runtime_utils_cleanUrl = (url) => url.replace(HASH_REGEXP, '').replace(QUERY_REGEXP, '');
106
106
  function slash(str) {
107
107
  return str.replace(/\\/g, '/');
108
108
  }
@@ -114,7 +114,7 @@ function normalizePosixPath(id) {
114
114
  const isAbsolutePath = path.startsWith('/');
115
115
  const parts = path.split('/');
116
116
  const normalizedParts = [];
117
- for (const part of parts)if ('.' === part || '' === part) ;
117
+ for (const part of parts) if ('.' === part || '' === part);
118
118
  else if ('..' === part) {
119
119
  if (normalizedParts.length > 0 && '..' !== normalizedParts[normalizedParts.length - 1]) normalizedParts.pop();
120
120
  else if (isAbsolutePath) normalizedParts.push('..');
@@ -123,7 +123,7 @@ function normalizePosixPath(id) {
123
123
  if (isAbsolutePath) normalizedPath = `/${normalizedPath}`;
124
124
  return normalizedPath;
125
125
  }
126
- const inBrowser = ()=>!process.env.__SSR__;
126
+ const inBrowser = () => !process.env.__SSR__;
127
127
  function addLeadingSlash(url) {
128
128
  return '/' === url.charAt(0) || isExternalUrl(url) ? url : `/${url}`;
129
129
  }
@@ -154,10 +154,15 @@ function replaceLang(rawUrl, lang, version, base = '', cleanUrls = false, isPage
154
154
  let purePathPart = '';
155
155
  const parts = url.split('/').filter(Boolean);
156
156
  if (version.current && version.current !== version.default) versionPart = parts.shift() || '';
157
- if (lang.target !== lang.default) {
158
- langPart = lang.target;
159
- if (lang.current !== lang.default) parts.shift();
160
- } else parts.shift();
157
+
158
+ // if (lang.target !== lang.default) {
159
+ // langPart = lang.target;
160
+ // if (lang.current !== lang.default) parts.shift();
161
+ // } else parts.shift();
162
+
163
+ langPart = lang.target;
164
+ if (lang.current !== lang.default) parts.shift();
165
+
161
166
  purePathPart = parts.join('/') || '';
162
167
  if ((versionPart || langPart) && !purePathPart) purePathPart = cleanUrls ? 'index' : 'index.html';
163
168
  return withBase(addLeadingSlash([
@@ -182,7 +187,7 @@ function replaceVersion(rawUrl, version, base = '', cleanUrls = false, isPageNot
182
187
  restPart
183
188
  ].filter(Boolean).join('/')), base);
184
189
  }
185
- const parseUrl = (url)=>{
190
+ const parseUrl = (url) => {
186
191
  const [withoutHash, hash = ''] = url.split('#');
187
192
  return {
188
193
  url: withoutHash,
@@ -217,7 +222,7 @@ function removeBase(url, base) {
217
222
  return addLeadingSlash(url).replace(new RegExp(`^${normalizeSlash(base)}`), '');
218
223
  }
219
224
  var __webpack_export_target__ = exports;
220
- for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
225
+ for (var __webpack_i__ in __webpack_exports__) __webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
221
226
  if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
222
227
  value: true
223
228
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rspress-theme-anatole/shared",
3
3
  "author": "Anatole Tong",
4
- "version": "0.6.1-alpha.1",
4
+ "version": "0.6.3",
5
5
  "license": "MIT",
6
6
  "exports": {
7
7
  ".": {