@docusaurus/utils-common 2.3.0 → 2.4.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.
@@ -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
@@ -6,4 +6,5 @@
6
6
  */
7
7
  export declare const blogPostContainerID = "post-content";
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;AAEH,eAAO,MAAM,mBAAmB,iBAAiB,CAAC;AAClD,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,10 @@ 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;
12
+ exports.getErrorCausalChain = exports.applyTrailingSlash = exports.blogPostContainerID = void 0;
13
13
  exports.blogPostContainerID = 'post-content';
14
14
  var applyTrailingSlash_1 = require("./applyTrailingSlash");
15
15
  Object.defineProperty(exports, "applyTrailingSlash", { enumerable: true, get: function () { return __importDefault(applyTrailingSlash_1).default; } });
16
+ var errorUtils_1 = require("./errorUtils");
17
+ Object.defineProperty(exports, "getErrorCausalChain", { enumerable: true, get: function () { return errorUtils_1.getErrorCausalChain; } });
16
18
  //# 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;;;;;;AAEU,QAAA,mBAAmB,GAAG,cAAc,CAAC;AAClD,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.0",
3
+ "version": "2.4.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": ">=16.14"
34
34
  },
35
- "gitHead": "ad477781bdca6a11fa9c6daef5048bdcec0ee37e"
35
+ "gitHead": "898b85ef134cc43bf3b1209aad0ca8cdcfb214c5"
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
@@ -10,3 +10,4 @@ export {
10
10
  default as applyTrailingSlash,
11
11
  type ApplyTrailingSlashParams,
12
12
  } from './applyTrailingSlash';
13
+ export {getErrorCausalChain} from './errorUtils';