@docusaurus/utils-common 2.3.1 → 2.4.1

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,10 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ declare type CausalChain = [Error, ...Error[]];
8
+ export declare function getErrorCausalChain(error: Error): CausalChain;
9
+ export {};
10
+ //# sourceMappingURL=errorUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errorUtils.d.ts","sourceRoot":"","sources":["../src/errorUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,aAAK,WAAW,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;AAEvC,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,GAAG,WAAW,CAK7D"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getErrorCausalChain = void 0;
4
+ function getErrorCausalChain(error) {
5
+ if (error.cause) {
6
+ return [error, ...getErrorCausalChain(error.cause)];
7
+ }
8
+ return [error];
9
+ }
10
+ exports.getErrorCausalChain = getErrorCausalChain;
11
+ //# sourceMappingURL=errorUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errorUtils.js","sourceRoot":"","sources":["../src/errorUtils.ts"],"names":[],"mappings":";;;AAQA,SAAgB,mBAAmB,CAAC,KAAY;IAC9C,IAAI,KAAK,CAAC,KAAK,EAAE;QACf,OAAO,CAAC,KAAK,EAAE,GAAG,mBAAmB,CAAC,KAAK,CAAC,KAAc,CAAC,CAAC,CAAC;KAC9D;IACD,OAAO,CAAC,KAAK,CAAC,CAAC;AACjB,CAAC;AALD,kDAKC"}
package/lib/index.d.ts CHANGED
@@ -4,6 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- export declare const blogPostContainerID = "post-content";
7
+ export declare const blogPostContainerID = "__blog-post-container";
8
8
  export { default as applyTrailingSlash, type ApplyTrailingSlashParams, } from './applyTrailingSlash';
9
+ export { getErrorCausalChain } from './errorUtils';
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,mBAAmB,iBAAiB,CAAC;AAClD,OAAO,EACL,OAAO,IAAI,kBAAkB,EAC7B,KAAK,wBAAwB,GAC9B,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,eAAO,MAAM,mBAAmB,0BAA0B,CAAC;AAE3D,OAAO,EACL,OAAO,IAAI,kBAAkB,EAC7B,KAAK,wBAAwB,GAC9B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAC,mBAAmB,EAAC,MAAM,cAAc,CAAC"}
package/lib/index.js CHANGED
@@ -9,8 +9,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
9
9
  return (mod && mod.__esModule) ? mod : { "default": mod };
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.applyTrailingSlash = exports.blogPostContainerID = void 0;
13
- exports.blogPostContainerID = 'post-content';
12
+ exports.getErrorCausalChain = exports.applyTrailingSlash = exports.blogPostContainerID = void 0;
13
+ // __ prefix allows search crawlers (Algolia/DocSearch) to ignore anchors
14
+ // https://github.com/facebook/docusaurus/issues/8883#issuecomment-1516328368
15
+ exports.blogPostContainerID = '__blog-post-container';
14
16
  var applyTrailingSlash_1 = require("./applyTrailingSlash");
15
17
  Object.defineProperty(exports, "applyTrailingSlash", { enumerable: true, get: function () { return __importDefault(applyTrailingSlash_1).default; } });
18
+ var errorUtils_1 = require("./errorUtils");
19
+ Object.defineProperty(exports, "getErrorCausalChain", { enumerable: true, get: function () { return errorUtils_1.getErrorCausalChain; } });
16
20
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;AAEU,QAAA,mBAAmB,GAAG,cAAc,CAAC;AAClD,2DAG8B;AAF5B,yIAAA,OAAO,OAAsB"}
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,2DAG8B;AAF5B,yIAAA,OAAO,OAAsB;AAG/B,2CAAiD;AAAzC,iHAAA,mBAAmB,OAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/utils-common",
3
- "version": "2.3.1",
3
+ "version": "2.4.1",
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": ">=16.14"
34
34
  },
35
- "gitHead": "cf12f21a10f6c5439ff931e61419c4bb03a5a2dc"
35
+ "gitHead": "60e657d8ae5a4a9ed1c2d777f9defd882cc12681"
36
36
  }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ type CausalChain = [Error, ...Error[]];
8
+
9
+ export function getErrorCausalChain(error: Error): CausalChain {
10
+ if (error.cause) {
11
+ return [error, ...getErrorCausalChain(error.cause as Error)];
12
+ }
13
+ return [error];
14
+ }
package/src/index.ts CHANGED
@@ -5,8 +5,12 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- export const blogPostContainerID = 'post-content';
8
+ // __ prefix allows search crawlers (Algolia/DocSearch) to ignore anchors
9
+ // https://github.com/facebook/docusaurus/issues/8883#issuecomment-1516328368
10
+ export const blogPostContainerID = '__blog-post-container';
11
+
9
12
  export {
10
13
  default as applyTrailingSlash,
11
14
  type ApplyTrailingSlashParams,
12
15
  } from './applyTrailingSlash';
16
+ export {getErrorCausalChain} from './errorUtils';