effect-errors 1.2.16 → 1.2.18

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/README.md CHANGED
@@ -42,8 +42,6 @@ await runPromise(
42
42
  );
43
43
  ```
44
44
 
45
- The fancy logging behavior is enabled if your node env is `development` or if you set `EFFECT_PRETTY_PRINT` env var to `true`.
46
-
47
45
  You can also directly import the `prettyPrint` function to do whatever with it if you want 🤷
48
46
 
49
47
  ```typescript
@@ -72,6 +70,10 @@ const prettyPrint: <E>(cause: Cause<E>, options?: PrettyPrintOptions) => string;
72
70
 
73
71
  `PrettyPrintOptions` allows you to tweak the following:
74
72
 
73
+ #### `enabled` - Whether pretty printing is enabled or not
74
+
75
+ > default: `true`
76
+
75
77
  #### `stripCwd` - Whether spans and stacktrace should contain absolute or relative paths
76
78
 
77
79
  > default: `false` (absolute paths)
@@ -9,7 +9,7 @@ var parseError = function (error) {
9
9
  var _a;
10
10
  var span = ((0, Predicate_1.hasProperty)(error, spanSymbol) && error[spanSymbol]);
11
11
  if (error instanceof Error) {
12
- return new pretty_error_type_1.PrettyError((0, pretty_error_message_1.prettyErrorMessage)(error), (_a = error.stack) === null || _a === void 0 ? void 0 : _a.split('\n').filter(function (el) { return el.match(/at (.*)/); }).join('\n'), span);
12
+ return new pretty_error_type_1.PrettyError((0, pretty_error_message_1.prettyErrorMessage)(error), (_a = error.stack) === null || _a === void 0 ? void 0 : _a.split('\n').filter(function (el) { return /at (.*)/.exec(el); }).join('\n'), span);
13
13
  }
14
14
  return new pretty_error_type_1.PrettyError((0, pretty_error_message_1.prettyErrorMessage)(error), void 0, span);
15
15
  };
@@ -23,21 +23,23 @@ exports.prettyErrorMessage = void 0;
23
23
  var chalk_1 = __importDefault(require("chalk"));
24
24
  var Function_1 = require("effect/Function");
25
25
  var Predicate_1 = require("effect/Predicate");
26
+ var redBackground = function (text) { return chalk_1.default.bgRed(" ".concat(text, " ")); };
27
+ var whiteBright = function (text) { return chalk_1.default.bold.whiteBright("\u2022 ".concat(text)); };
26
28
  var prettyErrorMessage = function (u) {
27
29
  if (typeof u === 'string') {
28
30
  return "".concat(u, "\r\n\r\n\u2139\uFE0F ").concat(chalk_1.default.gray('You used a plain string to represent a failure in the error channel (E). You should consider using tagged objects (with a _tag field), or yieldable errors such as Data.TaggedError and Schema.TaggedError for better handling experience.'));
29
31
  }
30
32
  // TaggedError with cause
31
33
  if (u instanceof Error && (0, Predicate_1.hasProperty)(u, 'cause') && (0, Predicate_1.hasProperty)(u, '_tag')) {
32
- return "".concat(chalk_1.default.bgRed(" ".concat(u._tag, " ")), " ").concat(chalk_1.default.bold.whiteBright("\u2022 ".concat(u.cause)), "\r\n");
34
+ return "".concat(redBackground(u._tag), " ").concat(whiteBright(u.cause), "\r\n");
33
35
  }
34
36
  // TaggedError with error ctor
35
37
  if (u instanceof Error && (0, Predicate_1.hasProperty)(u, 'error')) {
36
- return "".concat(chalk_1.default.bgRed(" ".concat(u.name, " ")), " ").concat(chalk_1.default.bold.whiteBright("\u2022 ".concat(u.error)), "\r\n");
38
+ return "".concat(redBackground(u.name), " ").concat(whiteBright(u.error), "\r\n");
37
39
  }
38
40
  // Plain objects with tag attribute
39
41
  if ((0, Predicate_1.hasProperty)(u, '_tag') && (0, Predicate_1.hasProperty)(u, 'message')) {
40
- return "".concat(chalk_1.default.bgRed(" ".concat(u._tag, " ")), " ").concat(chalk_1.default.bold.whiteBright("\u2022 ".concat(u.message)), "\r\n");
42
+ return "".concat(redBackground(u._tag), " ").concat(whiteBright(u.message), "\r\n");
41
43
  }
42
44
  // Plain objects with toString impl
43
45
  if ((0, Predicate_1.hasProperty)(u, 'toString') &&
@@ -48,7 +50,7 @@ var prettyErrorMessage = function (u) {
48
50
  var maybeWithUnderlyingType = message.split(': ');
49
51
  if (maybeWithUnderlyingType.length > 1) {
50
52
  var _a = __read(maybeWithUnderlyingType), type = _a[0], message_1 = _a.slice(1);
51
- return "".concat(chalk_1.default.bgRed(" ".concat(type, " ")), " ").concat(chalk_1.default.bold.whiteBright("\u2022 ".concat(message_1)));
53
+ return "".concat(redBackground(type), " ").concat(whiteBright(message_1));
52
54
  }
53
55
  return "".concat(message);
54
56
  }
@@ -31,6 +31,6 @@ var getSpanAttributes = function (attributes, isLastEntry) {
31
31
  return "".concat(isLastEntry ? ' ' : chalk_1.default.gray('│'), " ").concat(chalk_1.default.blue(key)).concat(chalk_1.default.gray(':'), " ").concat(value);
32
32
  })
33
33
  .join('\r\n');
34
- return "".concat("\r\n".concat(formattedAttributes));
34
+ return "\r\n".concat(formattedAttributes);
35
35
  };
36
36
  exports.getSpanAttributes = getSpanAttributes;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "repository": "https://github.com/jpb06/effect-errors.git",
3
3
  "main": "index.js",
4
4
  "name": "effect-errors",
5
- "version": "1.2.16",
5
+ "version": "1.2.18",
6
6
  "author": "jpb06 <jp.bois.06@outlook.fr>",
7
7
  "description": "A POC for errors reporting in Effect",
8
8
  "keywords": [],
@@ -27,10 +27,9 @@
27
27
  "run-examples": "bun run ./src/examples/util/run-all"
28
28
  },
29
29
  "dependencies": {
30
- "@effect/schema": "^0.64.8",
30
+ "@effect/schema": "^0.64.10",
31
31
  "chalk": "<5",
32
- "dotenv-flow": "^4.1.0",
33
- "effect": "^2.4.9"
32
+ "effect": "^2.4.10"
34
33
  },
35
34
  "devDependencies": {
36
35
  "@stylistic/eslint-plugin": "^1.7.0",
@@ -52,7 +51,7 @@
52
51
  "fs-extra": "^11.2.0",
53
52
  "prettier": "^3.2.5",
54
53
  "readme-package-icons": "^1.1.14",
55
- "typescript": "^5.4.2",
54
+ "typescript": "^5.4.3",
56
55
  "vitest": "^1.4.0",
57
56
  "vitest-mock-extended": "^1.3.1"
58
57
  }
package/pretty-print.js CHANGED
@@ -34,11 +34,11 @@ var prettyPrint = function (cause, _a) {
34
34
  message =
35
35
  '💥 ' +
36
36
  (failures.length > 1
37
- ? "".concat(chalk_1.default.bgRed.whiteBright(" #".concat(failuresIndex + 1, " -")))
37
+ ? chalk_1.default.bgRed.whiteBright(" #".concat(failuresIndex + 1, " -"))
38
38
  : '') +
39
39
  message +
40
40
  spans_1
41
- .reverse()
41
+ .toReversed()
42
42
  .map(function (_a, index) {
43
43
  var name = _a.name, attributes = _a.attributes, status = _a.status;
44
44
  var isFirstEntry = index === 0;
@@ -55,7 +55,7 @@ var prettyPrint = function (cause, _a) {
55
55
  .join('');
56
56
  }
57
57
  if (stack) {
58
- message += "\r\n".concat(span ? '\r\n' : '', "\uD83D\uDEA8 Stacktrace\r\n").concat(chalk_1.default.red((0, filter_stack_1.filterStack)(stack, stripCwd)));
58
+ message += "\r\n".concat(span ? '\r\n' : '', "\uD83D\uDEA8 Stacktrace\r\n").concat(chalk_1.default.red((0, filter_stack_1.filterStack)(stack, stripCwd === true)));
59
59
  }
60
60
  return message + '\r\n';
61
61
  })
@@ -3,16 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.runPromise = void 0;
4
4
  var effect_1 = require("effect");
5
5
  var __1 = require("..");
6
- var pretty_print_enabled_1 = require("../config/pretty-print-enabled");
7
6
  var pretty_print_options_type_1 = require("../types/pretty-print-options.type");
8
7
  var runPromise = function (effect, options) {
9
8
  if (options === void 0) { options = pretty_print_options_type_1.prettyPrintOptionsDefault; }
10
9
  return effect_1.Effect.runPromise((0, effect_1.pipe)(effect, effect_1.Effect.sandbox, effect_1.Effect.catchAll(function (e) {
11
- if (pretty_print_enabled_1.prettyPrintEnabled) {
12
- console.error((0, __1.prettyPrint)(e, options));
13
- return effect_1.Effect.fail('❌ runPromise failure');
10
+ if (options.enabled === false) {
11
+ return effect_1.Effect.fail(e);
14
12
  }
15
- return effect_1.Effect.fail(e);
13
+ console.error((0, __1.prettyPrint)(e, options));
14
+ return effect_1.Effect.fail('❌ runPromise failure');
16
15
  })));
17
16
  };
18
17
  exports.runPromise = runPromise;
@@ -3,12 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.runSync = void 0;
4
4
  var effect_1 = require("effect");
5
5
  var __1 = require("..");
6
- var pretty_print_enabled_1 = require("../config/pretty-print-enabled");
7
6
  var pretty_print_options_type_1 = require("../types/pretty-print-options.type");
8
7
  var runSync = function (effect, options) {
9
8
  if (options === void 0) { options = pretty_print_options_type_1.prettyPrintOptionsDefault; }
10
9
  return effect_1.Effect.runSync((0, effect_1.pipe)(effect, effect_1.Effect.sandbox, effect_1.Effect.catchAll(function (e) {
11
- if (pretty_print_enabled_1.prettyPrintEnabled) {
10
+ if (options.enabled) {
12
11
  console.error((0, __1.prettyPrint)(e, options));
13
12
  return effect_1.Effect.fail('❌ runSync failure');
14
13
  }
@@ -1,4 +1,5 @@
1
1
  export interface PrettyPrintOptions {
2
- stripCwd: boolean;
2
+ stripCwd?: boolean;
3
+ enabled?: boolean;
3
4
  }
4
5
  export declare const prettyPrintOptionsDefault: PrettyPrintOptions;
@@ -3,4 +3,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.prettyPrintOptionsDefault = void 0;
4
4
  exports.prettyPrintOptionsDefault = {
5
5
  stripCwd: false,
6
+ enabled: true,
6
7
  };
@@ -1 +0,0 @@
1
- export declare const prettyPrintEnabled: boolean;
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.prettyPrintEnabled = void 0;
4
- var dotenv_flow_1 = require("dotenv-flow");
5
- (0, dotenv_flow_1.config)({ silent: true });
6
- exports.prettyPrintEnabled = process.env.NODE_ENV === 'development' ||
7
- process.env.EFFECT_PRETTY_PRINT === 'true';
@@ -1 +0,0 @@
1
- export {};
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var to_chalk_match_1 = require("./to-chalk-match");
4
- var matchers = function () {
5
- Promise.all([(0, to_chalk_match_1.chalkMatcher)()]);
6
- };
7
- (function () {
8
- matchers();
9
- })();
@@ -1 +0,0 @@
1
- export declare const chalkMatcher: () => Promise<void>;
@@ -1,67 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.chalkMatcher = void 0;
40
- var vitest_1 = require("vitest");
41
- var chalkMatcher = function () { return __awaiter(void 0, void 0, void 0, function () {
42
- return __generator(this, function (_a) {
43
- vitest_1.expect.extend({
44
- toChalkMatch: function (received, expected) {
45
- var escaped;
46
- if (expected instanceof RegExp) {
47
- escaped = expected;
48
- }
49
- else {
50
- escaped = RegExp(expected.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'gm');
51
- }
52
- var match = escaped.test(received);
53
- return {
54
- pass: match === true,
55
- message: function () {
56
- return match
57
- ? "".concat(expected, " present in ").concat(received)
58
- : "".concat(expected, " not present in: \r\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n").concat(received, "\r\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
59
- },
60
- expected: expected,
61
- };
62
- },
63
- });
64
- return [2 /*return*/];
65
- });
66
- }); };
67
- exports.chalkMatcher = chalkMatcher;
@@ -1 +0,0 @@
1
- export declare const mockChalk: () => void;
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mockChalk = void 0;
4
- var vitest_1 = require("vitest");
5
- var vitest_mock_extended_1 = require("vitest-mock-extended");
6
- var mockChalk = function () {
7
- var chalkMock = (0, vitest_mock_extended_1.mockDeep)();
8
- vitest_1.vi.doMock('chalk', function () { return chalkMock; });
9
- };
10
- exports.mockChalk = mockChalk;
@@ -1,9 +0,0 @@
1
- import { Mock } from 'vitest';
2
- interface ConsoleMockingArgs {
3
- error?: Mock;
4
- info?: Mock;
5
- log?: Mock;
6
- warn?: Mock;
7
- }
8
- export declare const mockConsole: (args: ConsoleMockingArgs) => Promise<void>;
9
- export {};
@@ -1,66 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
- return new (P || (P = Promise))(function (resolve, reject) {
16
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
- step((generator = generator.apply(thisArg, _arguments || [])).next());
20
- });
21
- };
22
- var __generator = (this && this.__generator) || function (thisArg, body) {
23
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
- function verb(n) { return function (v) { return step([n, v]); }; }
26
- function step(op) {
27
- if (f) throw new TypeError("Generator is already executing.");
28
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
29
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
- if (y = 0, t) op = [op[0] & 2, t.value];
31
- switch (op[0]) {
32
- case 0: case 1: t = op; break;
33
- case 4: _.label++; return { value: op[1], done: false };
34
- case 5: _.label++; y = op[1]; op = [0]; continue;
35
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
- default:
37
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
- if (t[2]) _.ops.pop();
42
- _.trys.pop(); continue;
43
- }
44
- op = body.call(thisArg, _);
45
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
- }
48
- };
49
- Object.defineProperty(exports, "__esModule", { value: true });
50
- exports.mockConsole = void 0;
51
- var vitest_1 = require("vitest");
52
- var mockConsole = function (args) { return __awaiter(void 0, void 0, void 0, function () {
53
- var _a, _b;
54
- return __generator(this, function (_c) {
55
- switch (_c.label) {
56
- case 0:
57
- _a = global;
58
- _b = [{}];
59
- return [4 /*yield*/, vitest_1.vi.importActual('node:console')];
60
- case 1:
61
- _a.console = __assign.apply(void 0, [__assign.apply(void 0, _b.concat([(_c.sent())])), args]);
62
- return [2 /*return*/];
63
- }
64
- });
65
- }); };
66
- exports.mockConsole = mockConsole;
@@ -1,6 +0,0 @@
1
- import { Mock } from 'vitest';
2
- interface ProcessMockingArgs {
3
- cwd?: Mock;
4
- }
5
- export declare const mockProcess: (args: ProcessMockingArgs) => Promise<void>;
6
- export {};
@@ -1,66 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
- return new (P || (P = Promise))(function (resolve, reject) {
16
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
- step((generator = generator.apply(thisArg, _arguments || [])).next());
20
- });
21
- };
22
- var __generator = (this && this.__generator) || function (thisArg, body) {
23
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
- function verb(n) { return function (v) { return step([n, v]); }; }
26
- function step(op) {
27
- if (f) throw new TypeError("Generator is already executing.");
28
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
29
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
- if (y = 0, t) op = [op[0] & 2, t.value];
31
- switch (op[0]) {
32
- case 0: case 1: t = op; break;
33
- case 4: _.label++; return { value: op[1], done: false };
34
- case 5: _.label++; y = op[1]; op = [0]; continue;
35
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
- default:
37
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
- if (t[2]) _.ops.pop();
42
- _.trys.pop(); continue;
43
- }
44
- op = body.call(thisArg, _);
45
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
- }
48
- };
49
- Object.defineProperty(exports, "__esModule", { value: true });
50
- exports.mockProcess = void 0;
51
- var vitest_1 = require("vitest");
52
- var mockProcess = function (args) { return __awaiter(void 0, void 0, void 0, function () {
53
- var _a, _b;
54
- return __generator(this, function (_c) {
55
- switch (_c.label) {
56
- case 0:
57
- _a = global;
58
- _b = [{}];
59
- return [4 /*yield*/, vitest_1.vi.importActual('node:process')];
60
- case 1:
61
- _a.process = __assign.apply(void 0, [__assign.apply(void 0, _b.concat([(_c.sent())])), args]);
62
- return [2 /*return*/];
63
- }
64
- });
65
- }); };
66
- exports.mockProcess = mockProcess;
@@ -1 +0,0 @@
1
- export declare const durationRegex: RegExp;
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.durationRegex = void 0;
4
- exports.durationRegex = /~ \d+ms/;
@@ -1,2 +0,0 @@
1
- import { Effect } from 'effect';
2
- export declare const effectCause: <A, E>(effect: Effect.Effect<A, E>) => Promise<import("effect/Cause").Cause<E>>;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.effectCause = void 0;
4
- var effect_1 = require("effect");
5
- var effectCause = function (effect) {
6
- return effect_1.Effect.runPromise((0, effect_1.pipe)(effect, effect_1.Effect.catchAllCause(function (e) { return effect_1.Effect.fail(e); }), effect_1.Effect.flip));
7
- };
8
- exports.effectCause = effectCause;