@docusaurus/utils-common 3.3.2 → 3.5.0
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/lib/applyTrailingSlash.js +4 -5
- package/lib/applyTrailingSlash.js.map +1 -1
- package/lib/errorUtils.js +1 -2
- package/lib/errorUtils.js.map +1 -1
- package/lib/index.js +2 -4
- package/lib/index.js.map +1 -1
- package/lib/stringUtils.js +4 -5
- package/lib/stringUtils.js.map +1 -1
- package/package.json +2 -2
|
@@ -6,12 +6,14 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.addTrailingSlash = addTrailingSlash;
|
|
10
|
+
exports.default = applyTrailingSlash;
|
|
11
|
+
exports.addLeadingSlash = addLeadingSlash;
|
|
12
|
+
exports.removeTrailingSlash = removeTrailingSlash;
|
|
10
13
|
const stringUtils_1 = require("./stringUtils");
|
|
11
14
|
function addTrailingSlash(str) {
|
|
12
15
|
return str.endsWith('/') ? str : `${str}/`;
|
|
13
16
|
}
|
|
14
|
-
exports.addTrailingSlash = addTrailingSlash;
|
|
15
17
|
// Trailing slash handling depends in some site configuration options
|
|
16
18
|
function applyTrailingSlash(path, options) {
|
|
17
19
|
const { trailingSlash, baseUrl } = options;
|
|
@@ -38,15 +40,12 @@ function applyTrailingSlash(path, options) {
|
|
|
38
40
|
: handleTrailingSlash(pathname, trailingSlash);
|
|
39
41
|
return path.replace(pathname, newPathname);
|
|
40
42
|
}
|
|
41
|
-
exports.default = applyTrailingSlash;
|
|
42
43
|
/** Appends a leading slash to `str`, if one doesn't exist. */
|
|
43
44
|
function addLeadingSlash(str) {
|
|
44
45
|
return (0, stringUtils_1.addPrefix)(str, '/');
|
|
45
46
|
}
|
|
46
|
-
exports.addLeadingSlash = addLeadingSlash;
|
|
47
47
|
/** Removes the trailing slash from `str`. */
|
|
48
48
|
function removeTrailingSlash(str) {
|
|
49
49
|
return (0, stringUtils_1.removeSuffix)(str, '/');
|
|
50
50
|
}
|
|
51
|
-
exports.removeTrailingSlash = removeTrailingSlash;
|
|
52
51
|
//# sourceMappingURL=applyTrailingSlash.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applyTrailingSlash.js","sourceRoot":"","sources":["../src/applyTrailingSlash.ts"],"names":[],"mappings":";AAAA;;;;;GAKG
|
|
1
|
+
{"version":3,"file":"applyTrailingSlash.js","sourceRoot":"","sources":["../src/applyTrailingSlash.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAUH,4CAEC;AAGD,qCAkCC;AAGD,0CAEC;AAGD,kDAEC;AAzDD,+CAAsD;AAQtD,SAAgB,gBAAgB,CAAC,GAAW;IAC1C,OAAO,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC;AAC7C,CAAC;AAED,qEAAqE;AACrE,SAAwB,kBAAkB,CACxC,IAAY,EACZ,OAAiC;IAEjC,MAAM,EAAC,aAAa,EAAE,OAAO,EAAC,GAAG,OAAO,CAAC;IAEzC,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACzB,+CAA+C;QAC/C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,SAAS,mBAAmB,CAAC,GAAW,EAAE,QAAiB;QACzD,OAAO,QAAQ,CAAC,CAAC,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC;IACrE,CAAC;IAED,8CAA8C;IAC9C,IAAI,OAAO,aAAa,KAAK,WAAW,EAAE,CAAC;QACzC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,iEAAiE;IACjE,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAA0B,CAAC;IAE/D,4BAA4B;IAC5B,2CAA2C;IAC3C,oEAAoE;IACpE,uEAAuE;IACvE,MAAM,cAAc,GAAG,QAAQ,KAAK,GAAG,IAAI,QAAQ,KAAK,OAAO,CAAC;IAEhE,MAAM,WAAW,GAAG,cAAc;QAChC,CAAC,CAAC,QAAQ;QACV,CAAC,CAAC,mBAAmB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;IAEjD,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;AAC7C,CAAC;AAED,8DAA8D;AAC9D,SAAgB,eAAe,CAAC,GAAW;IACzC,OAAO,IAAA,uBAAS,EAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAC7B,CAAC;AAED,6CAA6C;AAC7C,SAAgB,mBAAmB,CAAC,GAAW;IAC7C,OAAO,IAAA,0BAAY,EAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAChC,CAAC"}
|
package/lib/errorUtils.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getErrorCausalChain =
|
|
3
|
+
exports.getErrorCausalChain = getErrorCausalChain;
|
|
4
4
|
function getErrorCausalChain(error) {
|
|
5
5
|
if (error.cause) {
|
|
6
6
|
return [error, ...getErrorCausalChain(error.cause)];
|
|
7
7
|
}
|
|
8
8
|
return [error];
|
|
9
9
|
}
|
|
10
|
-
exports.getErrorCausalChain = getErrorCausalChain;
|
|
11
10
|
//# sourceMappingURL=errorUtils.js.map
|
package/lib/errorUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errorUtils.js","sourceRoot":"","sources":["../src/errorUtils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"errorUtils.js","sourceRoot":"","sources":["../src/errorUtils.ts"],"names":[],"mappings":";;AAQA,kDAKC;AALD,SAAgB,mBAAmB,CAAC,KAAY;IAC9C,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,EAAE,GAAG,mBAAmB,CAAC,KAAK,CAAC,KAAc,CAAC,CAAC,CAAC;IAC/D,CAAC;IACD,OAAO,CAAC,KAAK,CAAC,CAAC;AACjB,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -5,16 +5,14 @@
|
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
-
};
|
|
11
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
9
|
exports.getErrorCausalChain = exports.removePrefix = exports.addSuffix = exports.removeSuffix = exports.addPrefix = exports.removeTrailingSlash = exports.addLeadingSlash = exports.addTrailingSlash = exports.applyTrailingSlash = exports.blogPostContainerID = void 0;
|
|
10
|
+
const tslib_1 = require("tslib");
|
|
13
11
|
// __ prefix allows search crawlers (Algolia/DocSearch) to ignore anchors
|
|
14
12
|
// https://github.com/facebook/docusaurus/issues/8883#issuecomment-1516328368
|
|
15
13
|
exports.blogPostContainerID = '__blog-post-container';
|
|
16
14
|
var applyTrailingSlash_1 = require("./applyTrailingSlash");
|
|
17
|
-
Object.defineProperty(exports, "applyTrailingSlash", { enumerable: true, get: function () { return __importDefault(applyTrailingSlash_1).default; } });
|
|
15
|
+
Object.defineProperty(exports, "applyTrailingSlash", { enumerable: true, get: function () { return tslib_1.__importDefault(applyTrailingSlash_1).default; } });
|
|
18
16
|
Object.defineProperty(exports, "addTrailingSlash", { enumerable: true, get: function () { return applyTrailingSlash_1.addTrailingSlash; } });
|
|
19
17
|
Object.defineProperty(exports, "addLeadingSlash", { enumerable: true, get: function () { return applyTrailingSlash_1.addLeadingSlash; } });
|
|
20
18
|
Object.defineProperty(exports, "removeTrailingSlash", { enumerable: true, get: function () { return applyTrailingSlash_1.removeTrailingSlash; } });
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;AAEH,yEAAyE;AACzE,6EAA6E;AAChE,QAAA,mBAAmB,GAAG,uBAAuB,CAAC;AAE3D,2DAM8B;AAL5B,iJAAA,OAAO,OAAsB;AAC7B,sHAAA,gBAAgB,OAAA;AAChB,qHAAA,eAAe,OAAA;AACf,yHAAA,mBAAmB,OAAA;AAGrB,6CAA+E;AAAvE,wGAAA,SAAS,OAAA;AAAE,2GAAA,YAAY,OAAA;AAAE,wGAAA,SAAS,OAAA;AAAE,2GAAA,YAAY,OAAA;AACxD,2CAAiD;AAAzC,iHAAA,mBAAmB,OAAA"}
|
package/lib/stringUtils.js
CHANGED
|
@@ -6,12 +6,14 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.addPrefix = addPrefix;
|
|
10
|
+
exports.removeSuffix = removeSuffix;
|
|
11
|
+
exports.addSuffix = addSuffix;
|
|
12
|
+
exports.removePrefix = removePrefix;
|
|
10
13
|
/** Adds a given string prefix to `str`. */
|
|
11
14
|
function addPrefix(str, prefix) {
|
|
12
15
|
return str.startsWith(prefix) ? str : `${prefix}${str}`;
|
|
13
16
|
}
|
|
14
|
-
exports.addPrefix = addPrefix;
|
|
15
17
|
/** Removes a given string suffix from `str`. */
|
|
16
18
|
function removeSuffix(str, suffix) {
|
|
17
19
|
if (suffix === '') {
|
|
@@ -20,15 +22,12 @@ function removeSuffix(str, suffix) {
|
|
|
20
22
|
}
|
|
21
23
|
return str.endsWith(suffix) ? str.slice(0, -suffix.length) : str;
|
|
22
24
|
}
|
|
23
|
-
exports.removeSuffix = removeSuffix;
|
|
24
25
|
/** Adds a given string suffix to `str`. */
|
|
25
26
|
function addSuffix(str, suffix) {
|
|
26
27
|
return str.endsWith(suffix) ? str : `${str}${suffix}`;
|
|
27
28
|
}
|
|
28
|
-
exports.addSuffix = addSuffix;
|
|
29
29
|
/** Removes a given string prefix from `str`. */
|
|
30
30
|
function removePrefix(str, prefix) {
|
|
31
31
|
return str.startsWith(prefix) ? str.slice(prefix.length) : str;
|
|
32
32
|
}
|
|
33
|
-
exports.removePrefix = removePrefix;
|
|
34
33
|
//# sourceMappingURL=stringUtils.js.map
|
package/lib/stringUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stringUtils.js","sourceRoot":"","sources":["../src/stringUtils.ts"],"names":[],"mappings":";AAAA;;;;;GAKG
|
|
1
|
+
{"version":3,"file":"stringUtils.js","sourceRoot":"","sources":["../src/stringUtils.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAGH,8BAEC;AAGD,oCAMC;AAGD,8BAEC;AAGD,oCAEC;AAtBD,2CAA2C;AAC3C,SAAgB,SAAS,CAAC,GAAW,EAAE,MAAc;IACnD,OAAO,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,MAAM,GAAG,GAAG,EAAE,CAAC;AAC1D,CAAC;AAED,gDAAgD;AAChD,SAAgB,YAAY,CAAC,GAAW,EAAE,MAAc;IACtD,IAAI,MAAM,KAAK,EAAE,EAAE,CAAC;QAClB,wBAAwB;QACxB,OAAO,GAAG,CAAC;IACb,CAAC;IACD,OAAO,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AACnE,CAAC;AAED,2CAA2C;AAC3C,SAAgB,SAAS,CAAC,GAAW,EAAE,MAAc;IACnD,OAAO,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,MAAM,EAAE,CAAC;AACxD,CAAC;AAED,gDAAgD;AAChD,SAAgB,YAAY,CAAC,GAAW,EAAE,MAAc;IACtD,OAAO,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AACjE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/utils-common",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
4
4
|
"description": "Common (Node/Browser) utility functions for Docusaurus packages.",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"engines": {
|
|
33
33
|
"node": ">=18.0"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "cb5829f3c34b26d798b869e38ee25073488140bd"
|
|
36
36
|
}
|