effect-errors 1.7.28 → 1.7.30
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/cjs/capture-errors.js +18 -21
- package/cjs/capture-errors.js.map +1 -1
- package/cjs/index.js +20 -69
- package/cjs/index.js.map +1 -1
- package/cjs/logic/effects/fs/fs-error.js +4 -6
- package/cjs/logic/effects/fs/fs-error.js.map +1 -1
- package/cjs/logic/effects/fs/fs-extra.effects.js +20 -45
- package/cjs/logic/effects/fs/fs-extra.effects.js.map +1 -1
- package/cjs/logic/errors/capture-errors-from-cause.js +10 -13
- package/cjs/logic/errors/capture-errors-from-cause.js.map +1 -1
- package/cjs/logic/errors/extract-error-details.js +53 -57
- package/cjs/logic/errors/extract-error-details.js.map +1 -1
- package/cjs/logic/errors/parse-error.js +17 -19
- package/cjs/logic/errors/parse-error.js.map +1 -1
- package/cjs/logic/pretty-printing/format-failures-title.js +11 -14
- package/cjs/logic/pretty-printing/format-failures-title.js.map +1 -1
- package/cjs/logic/pretty-printing/format-span-attributes.js +38 -51
- package/cjs/logic/pretty-printing/format-span-attributes.js.map +1 -1
- package/cjs/logic/pretty-printing/maybe-print-node-stacktrace.js +13 -19
- package/cjs/logic/pretty-printing/maybe-print-node-stacktrace.js.map +1 -1
- package/cjs/logic/pretty-printing/maybe-print-span-attributes.js +18 -26
- package/cjs/logic/pretty-printing/maybe-print-span-attributes.js.map +1 -1
- package/cjs/logic/pretty-printing/maybe-warn-about-plain-strings.js +9 -14
- package/cjs/logic/pretty-printing/maybe-warn-about-plain-strings.js.map +1 -1
- package/cjs/logic/pretty-printing/print-effect-stacktrace.js +12 -19
- package/cjs/logic/pretty-printing/print-effect-stacktrace.js.map +1 -1
- package/cjs/logic/spans/get-span-attributes.js +16 -25
- package/cjs/logic/spans/get-span-attributes.js.map +1 -1
- package/cjs/logic/spans/get-span-duration.js +10 -15
- package/cjs/logic/spans/get-span-duration.js.map +1 -1
- package/cjs/logic/spans/maybe-add-error-to-spans-stack.js +13 -16
- package/cjs/logic/spans/maybe-add-error-to-spans-stack.js.map +1 -1
- package/cjs/logic/spans/spans-stack-trailing-char.js +6 -11
- package/cjs/logic/spans/spans-stack-trailing-char.js.map +1 -1
- package/cjs/logic/spans/split-spans-attributes-by-type.js +12 -15
- package/cjs/logic/spans/split-spans-attributes-by-type.js.map +1 -1
- package/cjs/logic/stack/filter-stack.js +14 -17
- package/cjs/logic/stack/filter-stack.js.map +1 -1
- package/cjs/logic/stack/stack-regex.js +4 -7
- package/cjs/logic/stack/stack-regex.js.map +1 -1
- package/cjs/logic/strip-cwd-path.js +3 -6
- package/cjs/logic/strip-cwd-path.js.map +1 -1
- package/cjs/logic/util/big-int-replacer.js +8 -11
- package/cjs/logic/util/big-int-replacer.js.map +1 -1
- package/cjs/package.json +1 -0
- package/cjs/pretty-print.js +34 -40
- package/cjs/pretty-print.js.map +1 -1
- package/cjs/runners/run-promise.js +11 -14
- package/cjs/runners/run-promise.js.map +1 -1
- package/cjs/runners/run-sync.js +10 -13
- package/cjs/runners/run-sync.js.map +1 -1
- package/cjs/source-maps/get-error-location-from-file-path.js +11 -18
- package/cjs/source-maps/get-error-location-from-file-path.js.map +1 -1
- package/cjs/source-maps/get-error-related-sources.js +22 -29
- package/cjs/source-maps/get-error-related-sources.js.map +1 -1
- package/cjs/source-maps/get-source-code.js +18 -22
- package/cjs/source-maps/get-source-code.js.map +1 -1
- package/cjs/source-maps/get-sources-from-map-file.js +42 -45
- package/cjs/source-maps/get-sources-from-map-file.js.map +1 -1
- package/cjs/source-maps/get-sources-from-span.js +36 -48
- package/cjs/source-maps/get-sources-from-span.js.map +1 -1
- package/cjs/source-maps/get-sources-from-stack.js +16 -19
- package/cjs/source-maps/get-sources-from-stack.js.map +1 -1
- package/cjs/source-maps/maybe-map-sourcemaps.js +24 -25
- package/cjs/source-maps/maybe-map-sourcemaps.js.map +1 -1
- package/cjs/source-maps/transform-raw-error.js +30 -48
- package/cjs/source-maps/transform-raw-error.js.map +1 -1
- package/cjs/types/pretty-error.type.js +13 -16
- package/cjs/types/pretty-error.type.js.map +1 -1
- package/cjs/types/pretty-print-options.type.js +5 -8
- package/cjs/types/pretty-print-options.type.js.map +1 -1
- package/dts/capture-errors.d.ts +0 -1
- package/dts/index.d.ts +0 -1
- package/dts/logic/effects/fs/fs-error.d.ts +0 -1
- package/dts/logic/effects/fs/fs-extra.effects.d.ts +0 -1
- package/dts/logic/errors/capture-errors-from-cause.d.ts +0 -1
- package/dts/logic/errors/extract-error-details.d.ts +0 -1
- package/dts/logic/errors/parse-error.d.ts +0 -1
- package/dts/logic/pretty-printing/format-failures-title.d.ts +0 -1
- package/dts/logic/pretty-printing/format-span-attributes.d.ts +0 -1
- package/dts/logic/pretty-printing/maybe-print-node-stacktrace.d.ts +0 -1
- package/dts/logic/pretty-printing/maybe-print-span-attributes.d.ts +0 -1
- package/dts/logic/pretty-printing/maybe-warn-about-plain-strings.d.ts +0 -1
- package/dts/logic/pretty-printing/print-effect-stacktrace.d.ts +0 -1
- package/dts/logic/spans/get-span-attributes.d.ts +0 -1
- package/dts/logic/spans/get-span-duration.d.ts +0 -1
- package/dts/logic/spans/maybe-add-error-to-spans-stack.d.ts +0 -1
- package/dts/logic/spans/spans-stack-trailing-char.d.ts +0 -1
- package/dts/logic/spans/split-spans-attributes-by-type.d.ts +0 -1
- package/dts/logic/stack/filter-stack.d.ts +0 -1
- package/dts/logic/stack/stack-regex.d.ts +0 -1
- package/dts/logic/strip-cwd-path.d.ts +0 -1
- package/dts/logic/util/big-int-replacer.d.ts +0 -1
- package/dts/pretty-print.d.ts +0 -1
- package/dts/runners/run-promise.d.ts +0 -1
- package/dts/runners/run-sync.d.ts +0 -1
- package/dts/source-maps/get-error-location-from-file-path.d.ts +0 -1
- package/dts/source-maps/get-error-related-sources.d.ts +0 -1
- package/dts/source-maps/get-source-code.d.ts +0 -1
- package/dts/source-maps/get-sources-from-map-file.d.ts +0 -1
- package/dts/source-maps/get-sources-from-span.d.ts +0 -1
- package/dts/source-maps/get-sources-from-stack.d.ts +0 -1
- package/dts/source-maps/maybe-map-sourcemaps.d.ts +0 -1
- package/dts/source-maps/transform-raw-error.d.ts +0 -1
- package/dts/types/pretty-error.type.d.ts +0 -1
- package/dts/types/pretty-print-options.type.d.ts +0 -1
- package/esm/capture-errors.js +12 -12
- package/esm/capture-errors.js.map +1 -1
- package/esm/index.js.map +1 -1
- package/esm/logic/effects/fs/fs-error.js +2 -1
- package/esm/logic/effects/fs/fs-error.js.map +1 -1
- package/esm/logic/effects/fs/fs-extra.effects.js +12 -32
- package/esm/logic/effects/fs/fs-extra.effects.js.map +1 -1
- package/esm/logic/errors/capture-errors-from-cause.js +7 -7
- package/esm/logic/errors/capture-errors-from-cause.js.map +1 -1
- package/esm/logic/errors/extract-error-details.js +50 -51
- package/esm/logic/errors/extract-error-details.js.map +1 -1
- package/esm/logic/errors/parse-error.js +13 -12
- package/esm/logic/errors/parse-error.js.map +1 -1
- package/esm/logic/pretty-printing/format-failures-title.js +6 -4
- package/esm/logic/pretty-printing/format-failures-title.js.map +1 -1
- package/esm/logic/pretty-printing/format-span-attributes.js +28 -36
- package/esm/logic/pretty-printing/format-span-attributes.js.map +1 -1
- package/esm/logic/pretty-printing/maybe-print-node-stacktrace.js +7 -8
- package/esm/logic/pretty-printing/maybe-print-node-stacktrace.js.map +1 -1
- package/esm/logic/pretty-printing/maybe-print-span-attributes.js +12 -15
- package/esm/logic/pretty-printing/maybe-print-span-attributes.js.map +1 -1
- package/esm/logic/pretty-printing/maybe-warn-about-plain-strings.js +4 -4
- package/esm/logic/pretty-printing/maybe-warn-about-plain-strings.js.map +1 -1
- package/esm/logic/pretty-printing/print-effect-stacktrace.js +6 -8
- package/esm/logic/pretty-printing/print-effect-stacktrace.js.map +1 -1
- package/esm/logic/spans/get-span-attributes.js +10 -14
- package/esm/logic/spans/get-span-attributes.js.map +1 -1
- package/esm/logic/spans/get-span-duration.js +5 -5
- package/esm/logic/spans/get-span-duration.js.map +1 -1
- package/esm/logic/spans/maybe-add-error-to-spans-stack.js +11 -11
- package/esm/logic/spans/maybe-add-error-to-spans-stack.js.map +1 -1
- package/esm/logic/spans/spans-stack-trailing-char.js +1 -1
- package/esm/logic/spans/spans-stack-trailing-char.js.map +1 -1
- package/esm/logic/spans/split-spans-attributes-by-type.js +11 -11
- package/esm/logic/spans/split-spans-attributes-by-type.js.map +1 -1
- package/esm/logic/stack/filter-stack.js +10 -10
- package/esm/logic/stack/filter-stack.js.map +1 -1
- package/esm/logic/stack/stack-regex.js.map +1 -1
- package/esm/logic/strip-cwd-path.js +2 -2
- package/esm/logic/strip-cwd-path.js.map +1 -1
- package/esm/logic/util/big-int-replacer.js +7 -7
- package/esm/logic/util/big-int-replacer.js.map +1 -1
- package/esm/package.json +1 -0
- package/esm/pretty-print.js +20 -21
- package/esm/pretty-print.js.map +1 -1
- package/esm/runners/run-promise.js +8 -8
- package/esm/runners/run-promise.js.map +1 -1
- package/esm/runners/run-sync.js +7 -7
- package/esm/runners/run-sync.js.map +1 -1
- package/esm/source-maps/get-error-location-from-file-path.js +9 -13
- package/esm/source-maps/get-error-location-from-file-path.js.map +1 -1
- package/esm/source-maps/get-error-related-sources.js +18 -22
- package/esm/source-maps/get-error-related-sources.js.map +1 -1
- package/esm/source-maps/get-source-code.js +15 -16
- package/esm/source-maps/get-source-code.js.map +1 -1
- package/esm/source-maps/get-sources-from-map-file.js +34 -32
- package/esm/source-maps/get-sources-from-map-file.js.map +1 -1
- package/esm/source-maps/get-sources-from-span.js +31 -40
- package/esm/source-maps/get-sources-from-span.js.map +1 -1
- package/esm/source-maps/get-sources-from-stack.js +11 -11
- package/esm/source-maps/get-sources-from-stack.js.map +1 -1
- package/esm/source-maps/maybe-map-sourcemaps.js +20 -18
- package/esm/source-maps/maybe-map-sourcemaps.js.map +1 -1
- package/esm/source-maps/transform-raw-error.js +23 -38
- package/esm/source-maps/transform-raw-error.js.map +1 -1
- package/esm/types/pretty-error.type.js +12 -12
- package/esm/types/pretty-error.type.js.map +1 -1
- package/esm/types/pretty-print-options.type.js +3 -3
- package/esm/types/pretty-print-options.type.js.map +1 -1
- package/package.json +11 -10
- package/dts/capture-errors.d.ts.map +0 -1
- package/dts/index.d.ts.map +0 -1
- package/dts/logic/effects/fs/fs-error.d.ts.map +0 -1
- package/dts/logic/effects/fs/fs-extra.effects.d.ts.map +0 -1
- package/dts/logic/errors/capture-errors-from-cause.d.ts.map +0 -1
- package/dts/logic/errors/extract-error-details.d.ts.map +0 -1
- package/dts/logic/errors/parse-error.d.ts.map +0 -1
- package/dts/logic/pretty-printing/format-failures-title.d.ts.map +0 -1
- package/dts/logic/pretty-printing/format-span-attributes.d.ts.map +0 -1
- package/dts/logic/pretty-printing/maybe-print-node-stacktrace.d.ts.map +0 -1
- package/dts/logic/pretty-printing/maybe-print-span-attributes.d.ts.map +0 -1
- package/dts/logic/pretty-printing/maybe-warn-about-plain-strings.d.ts.map +0 -1
- package/dts/logic/pretty-printing/print-effect-stacktrace.d.ts.map +0 -1
- package/dts/logic/spans/get-span-attributes.d.ts.map +0 -1
- package/dts/logic/spans/get-span-duration.d.ts.map +0 -1
- package/dts/logic/spans/maybe-add-error-to-spans-stack.d.ts.map +0 -1
- package/dts/logic/spans/spans-stack-trailing-char.d.ts.map +0 -1
- package/dts/logic/spans/split-spans-attributes-by-type.d.ts.map +0 -1
- package/dts/logic/stack/filter-stack.d.ts.map +0 -1
- package/dts/logic/stack/stack-regex.d.ts.map +0 -1
- package/dts/logic/strip-cwd-path.d.ts.map +0 -1
- package/dts/logic/util/big-int-replacer.d.ts.map +0 -1
- package/dts/pretty-print.d.ts.map +0 -1
- package/dts/runners/run-promise.d.ts.map +0 -1
- package/dts/runners/run-sync.d.ts.map +0 -1
- package/dts/source-maps/get-error-location-from-file-path.d.ts.map +0 -1
- package/dts/source-maps/get-error-related-sources.d.ts.map +0 -1
- package/dts/source-maps/get-source-code.d.ts.map +0 -1
- package/dts/source-maps/get-sources-from-map-file.d.ts.map +0 -1
- package/dts/source-maps/get-sources-from-span.d.ts.map +0 -1
- package/dts/source-maps/get-sources-from-stack.d.ts.map +0 -1
- package/dts/source-maps/maybe-map-sourcemaps.d.ts.map +0 -1
- package/dts/source-maps/transform-raw-error.d.ts.map +0 -1
- package/dts/types/pretty-error.type.d.ts.map +0 -1
- package/dts/types/pretty-print-options.type.d.ts.map +0 -1
- package/esm/tsconfig-prod.tsbuildinfo +0 -1
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.stackAtRegex = exports.sourceFileWithMapPointerRegex = void 0;
|
|
7
|
-
const stackAtRegex = exports.stackAtRegex = / {4}at /g;
|
|
8
|
-
const sourceFileWithMapPointerRegex = exports.sourceFileWithMapPointerRegex = /^(file:\/\/)?(.*.([jt])sx?)(\?.*)?:(\d*):(\d*)$/;
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sourceFileWithMapPointerRegex = exports.stackAtRegex = void 0;
|
|
4
|
+
exports.stackAtRegex = / {4}at /g;
|
|
5
|
+
exports.sourceFileWithMapPointerRegex = /^(file:\/\/)?(.*.([jt])sx?)(\?.*)?:(\d*):(\d*)$/;
|
|
9
6
|
//# sourceMappingURL=stack-regex.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stack-regex.js","
|
|
1
|
+
{"version":3,"file":"stack-regex.js","sourceRoot":"","sources":["../../../../src/logic/stack/stack-regex.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG,UAAU,CAAC;AAC1B,QAAA,6BAA6B,GACxC,iDAAiD,CAAC"}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.stripCwdPath = void 0;
|
|
7
|
-
const cwdRegex = global.process !== undefined ?
|
|
8
|
-
const stripCwdPath = path => cwdRegex === null ? path : path.replace(cwdRegex, '.');
|
|
4
|
+
const cwdRegex = global.process !== undefined ? new RegExp(global.process.cwd(), 'g') : null;
|
|
5
|
+
const stripCwdPath = (path) => cwdRegex === null ? path : path.replace(cwdRegex, '.');
|
|
9
6
|
exports.stripCwdPath = stripCwdPath;
|
|
10
7
|
//# sourceMappingURL=strip-cwd-path.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strip-cwd-path.js","
|
|
1
|
+
{"version":3,"file":"strip-cwd-path.js","sourceRoot":"","sources":["../../../src/logic/strip-cwd-path.ts"],"names":[],"mappings":";;;AAAA,MAAM,QAAQ,GACZ,MAAM,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAEvE,MAAM,YAAY,GAAG,CAAC,IAAY,EAAU,EAAE,CACnD,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;AAD5C,QAAA,YAAY,gBACgC"}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.bigIntReplacer = void 0;
|
|
7
4
|
const bigIntReplacer = (_key, value) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
if (typeof value === 'bigint') {
|
|
6
|
+
return {
|
|
7
|
+
type: 'bigint',
|
|
8
|
+
value: value.toString(),
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
return value;
|
|
15
12
|
};
|
|
16
13
|
exports.bigIntReplacer = bigIntReplacer;
|
|
17
14
|
//# sourceMappingURL=big-int-replacer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"big-int-replacer.js","
|
|
1
|
+
{"version":3,"file":"big-int-replacer.js","sourceRoot":"","sources":["../../../../src/logic/util/big-int-replacer.ts"],"names":[],"mappings":";;;AAAO,MAAM,cAAc,GAAG,CAAC,IAAY,EAAE,KAAc,EAAE,EAAE;IAC7D,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO;YACL,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,KAAK,CAAC,QAAQ,EAAE;SACxB,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AARW,QAAA,cAAc,kBAQzB"}
|
package/cjs/package.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type": "commonjs"}
|
package/cjs/pretty-print.js
CHANGED
|
@@ -1,45 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.prettyPrint = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const spanAttributesStack = (0, _maybePrintSpanAttributes.maybePrintSpanAttributes)(d, span, isPlainString, options);
|
|
38
|
-
const effectStack = (0, _maybeAddErrorToSpansStack.maybeAddErrorToSpansStack)(stack, spanAttributesStack);
|
|
39
|
-
(0, _printEffectStacktrace.printEffectStacktrace)(d, span, effectStack, options);
|
|
40
|
-
(0, _maybePrintNodeStacktrace.maybePrintNodeStacktrace)(d, span, stack, isPlainString, options);
|
|
41
|
-
return [...d, '\r\n'].join('');
|
|
42
|
-
}).join('\r\n');
|
|
7
|
+
const Cause_1 = require("effect/Cause");
|
|
8
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
9
|
+
const capture_errors_from_cause_js_1 = require("./logic/errors/capture-errors-from-cause.js");
|
|
10
|
+
const format_failures_title_js_1 = require("./logic/pretty-printing/format-failures-title.js");
|
|
11
|
+
const maybe_print_node_stacktrace_js_1 = require("./logic/pretty-printing/maybe-print-node-stacktrace.js");
|
|
12
|
+
const maybe_print_span_attributes_js_1 = require("./logic/pretty-printing/maybe-print-span-attributes.js");
|
|
13
|
+
const maybe_warn_about_plain_strings_js_1 = require("./logic/pretty-printing/maybe-warn-about-plain-strings.js");
|
|
14
|
+
const print_effect_stacktrace_js_1 = require("./logic/pretty-printing/print-effect-stacktrace.js");
|
|
15
|
+
const maybe_add_error_to_spans_stack_js_1 = require("./logic/spans/maybe-add-error-to-spans-stack.js");
|
|
16
|
+
const pretty_print_options_type_js_1 = require("./types/pretty-print-options.type.js");
|
|
17
|
+
const prettyPrint = (cause, options = pretty_print_options_type_js_1.prettyPrintOptionsDefault) => {
|
|
18
|
+
if ((0, Cause_1.isInterruptedOnly)(cause)) {
|
|
19
|
+
return 'All fibers interrupted without errors.';
|
|
20
|
+
}
|
|
21
|
+
const failures = (0, capture_errors_from_cause_js_1.captureErrorsFrom)(cause);
|
|
22
|
+
const title = `\r\n🫠 ${picocolors_1.default.bold(picocolors_1.default.yellow(picocolors_1.default.underline(`${failures.length} error${failures.length > 1 ? 's' : ''} occured`)))}\r\n\r\n`;
|
|
23
|
+
return (title +
|
|
24
|
+
failures
|
|
25
|
+
.map(({ errorType, message: errorMessage, stack, span, isPlainString }, failureIndex) => {
|
|
26
|
+
const d = [
|
|
27
|
+
(0, format_failures_title_js_1.formatFailuresTitle)(errorType, errorMessage, failures.length, failureIndex),
|
|
28
|
+
];
|
|
29
|
+
(0, maybe_warn_about_plain_strings_js_1.maybeWarnAboutPlainStrings)(d, isPlainString);
|
|
30
|
+
const spanAttributesStack = (0, maybe_print_span_attributes_js_1.maybePrintSpanAttributes)(d, span, isPlainString, options);
|
|
31
|
+
const effectStack = (0, maybe_add_error_to_spans_stack_js_1.maybeAddErrorToSpansStack)(stack, spanAttributesStack);
|
|
32
|
+
(0, print_effect_stacktrace_js_1.printEffectStacktrace)(d, span, effectStack, options);
|
|
33
|
+
(0, maybe_print_node_stacktrace_js_1.maybePrintNodeStacktrace)(d, span, stack, isPlainString, options);
|
|
34
|
+
return [...d, '\r\n'].join('');
|
|
35
|
+
})
|
|
36
|
+
.join('\r\n'));
|
|
43
37
|
};
|
|
44
38
|
exports.prettyPrint = prettyPrint;
|
|
45
39
|
//# sourceMappingURL=pretty-print.js.map
|
package/cjs/pretty-print.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pretty-print.js","
|
|
1
|
+
{"version":3,"file":"pretty-print.js","sourceRoot":"","sources":["../../src/pretty-print.ts"],"names":[],"mappings":";;;;;;AAAA,wCAA6D;AAC7D,4DAA+B;AAE/B,8FAAgF;AAChF,+FAAuF;AACvF,2GAAkG;AAClG,2GAAkG;AAClG,iHAAuG;AACvG,mGAA2F;AAC3F,uGAA4F;AAC5F,uFAG8C;AAEvC,MAAM,WAAW,GAAG,CACzB,KAAe,EACf,UAA8B,wDAAyB,EAC/C,EAAE;IACV,IAAI,IAAA,yBAAiB,EAAC,KAAK,CAAC,EAAE,CAAC;QAC7B,OAAO,wCAAwC,CAAC;IAClD,CAAC;IAED,MAAM,QAAQ,GAAG,IAAA,gDAAiB,EAAI,KAAK,CAAC,CAAC;IAE7C,MAAM,KAAK,GAAG,WAAW,oBAAK,CAAC,IAAI,CACjC,oBAAK,CAAC,MAAM,CACV,oBAAK,CAAC,SAAS,CACb,GAAG,QAAQ,CAAC,MAAM,SAAS,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,UAAU,CACpE,CACF,CACF,UAAU,CAAC;IAEZ,OAAO,CACL,KAAK;QACL,QAAQ;aACL,GAAG,CACF,CACE,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,EAChE,YAAY,EACZ,EAAE;YACF,MAAM,CAAC,GAAa;gBAClB,IAAA,8CAAmB,EACjB,SAAS,EACT,YAAY,EACZ,QAAQ,CAAC,MAAM,EACf,YAAY,CACb;aACF,CAAC;YAEF,IAAA,8DAA0B,EAAC,CAAC,EAAE,aAAa,CAAC,CAAC;YAE7C,MAAM,mBAAmB,GAAG,IAAA,yDAAwB,EAClD,CAAC,EACD,IAAI,EACJ,aAAa,EACb,OAAO,CACR,CAAC;YAEF,MAAM,WAAW,GAAG,IAAA,6DAAyB,EAC3C,KAAK,EACL,mBAAmB,CACpB,CAAC;YAEF,IAAA,kDAAqB,EAAC,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;YACrD,IAAA,yDAAwB,EAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;YAEjE,OAAO,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACjC,CAAC,CACF;aACA,IAAI,CAAC,MAAM,CAAC,CAChB,CAAC;AACJ,CAAC,CAAC;AAzDW,QAAA,WAAW,eAyDtB"}
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.runPromise = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const runPromise = async (effect, options =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
4
|
+
const effect_1 = require("effect");
|
|
5
|
+
const index_js_1 = require("../index.js");
|
|
6
|
+
const pretty_print_options_type_js_1 = require("../types/pretty-print-options.type.js");
|
|
7
|
+
const runPromise = async (effect, options = pretty_print_options_type_js_1.prettyPrintOptionsDefault) => await effect_1.Effect.runPromise((0, effect_1.pipe)(effect, effect_1.Effect.sandbox, effect_1.Effect.catchAll((e) => {
|
|
8
|
+
if (options.enabled === false) {
|
|
9
|
+
return effect_1.Effect.fail(e);
|
|
10
|
+
}
|
|
11
|
+
const prettyError = (0, index_js_1.prettyPrint)(e, options);
|
|
12
|
+
console.error(prettyError);
|
|
13
|
+
return effect_1.Effect.fail('❌ runPromise failure');
|
|
17
14
|
})));
|
|
18
15
|
exports.runPromise = runPromise;
|
|
19
16
|
//# sourceMappingURL=run-promise.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-promise.js","
|
|
1
|
+
{"version":3,"file":"run-promise.js","sourceRoot":"","sources":["../../../src/runners/run-promise.ts"],"names":[],"mappings":";;;AAAA,mCAAsC;AAEtC,0CAA0C;AAC1C,wFAG+C;AAExC,MAAM,UAAU,GAAG,KAAK,EAC7B,MAA2B,EAC3B,UAA8B,wDAAyB,EAC3C,EAAE,CACd,MAAM,eAAM,CAAC,UAAU,CACrB,IAAA,aAAI,EACF,MAAM,EACN,eAAM,CAAC,OAAO,EACd,eAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE;IACpB,IAAI,OAAO,CAAC,OAAO,KAAK,KAAK,EAAE,CAAC;QAC9B,OAAO,eAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACxB,CAAC;IAED,MAAM,WAAW,GAAG,IAAA,sBAAW,EAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IAC5C,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAE3B,OAAO,eAAM,CAAC,IAAI,CAAC,sBAA+B,CAAC,CAAC;AACtD,CAAC,CAAC,CACH,CACF,CAAC;AAnBS,QAAA,UAAU,cAmBnB"}
|
package/cjs/runners/run-sync.js
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.runSync = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const runSync = (effect, options =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
4
|
+
const effect_1 = require("effect");
|
|
5
|
+
const index_js_1 = require("../index.js");
|
|
6
|
+
const pretty_print_options_type_js_1 = require("../types/pretty-print-options.type.js");
|
|
7
|
+
const runSync = (effect, options = pretty_print_options_type_js_1.prettyPrintOptionsDefault) => effect_1.Effect.runSync((0, effect_1.pipe)(effect, effect_1.Effect.sandbox, effect_1.Effect.catchAll((e) => {
|
|
8
|
+
if (options.enabled === true) {
|
|
9
|
+
console.error((0, index_js_1.prettyPrint)(e, options));
|
|
10
|
+
return effect_1.Effect.fail('❌ runSync failure');
|
|
11
|
+
}
|
|
12
|
+
return effect_1.Effect.fail(e);
|
|
16
13
|
})));
|
|
17
14
|
exports.runSync = runSync;
|
|
18
15
|
//# sourceMappingURL=run-sync.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-sync.js","
|
|
1
|
+
{"version":3,"file":"run-sync.js","sourceRoot":"","sources":["../../../src/runners/run-sync.ts"],"names":[],"mappings":";;;AAAA,mCAAsC;AAEtC,0CAA0C;AAC1C,wFAG+C;AAExC,MAAM,OAAO,GAAG,CACrB,MAA2B,EAC3B,UAA8B,wDAAyB,EACpD,EAAE,CACL,eAAM,CAAC,OAAO,CACZ,IAAA,aAAI,EACF,MAAM,EACN,eAAM,CAAC,OAAO,EACd,eAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE;IACpB,IAAI,OAAO,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;QAC7B,OAAO,CAAC,KAAK,CAAC,IAAA,sBAAW,EAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;QAEvC,OAAO,eAAM,CAAC,IAAI,CAAC,mBAAmB,CAAU,CAAC;IACnD,CAAC;IAED,OAAO,eAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACxB,CAAC,CAAC,CACH,CACF,CAAC;AAlBS,QAAA,OAAO,WAkBhB"}
|
|
@@ -1,23 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.getErrorLocationFrom = void 0;
|
|
7
|
-
|
|
8
|
-
const getErrorLocationFrom = sourceFile => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
filePath,
|
|
18
|
-
line,
|
|
19
|
-
column
|
|
20
|
-
};
|
|
4
|
+
const stack_regex_js_1 = require("../logic/stack/stack-regex.js");
|
|
5
|
+
const getErrorLocationFrom = (sourceFile) => {
|
|
6
|
+
const regex = stack_regex_js_1.sourceFileWithMapPointerRegex.exec(sourceFile);
|
|
7
|
+
if (regex === null || regex.length !== 7) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
const filePath = regex[2];
|
|
11
|
+
const line = +regex[5];
|
|
12
|
+
const column = +regex[6];
|
|
13
|
+
return { filePath, line, column };
|
|
21
14
|
};
|
|
22
15
|
exports.getErrorLocationFrom = getErrorLocationFrom;
|
|
23
16
|
//# sourceMappingURL=get-error-location-from-file-path.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-error-location-from-file-path.js","
|
|
1
|
+
{"version":3,"file":"get-error-location-from-file-path.js","sourceRoot":"","sources":["../../../src/source-maps/get-error-location-from-file-path.ts"],"names":[],"mappings":";;;AAAA,kEAA8E;AAQvE,MAAM,oBAAoB,GAAG,CAClC,UAAkB,EACS,EAAE;IAC7B,MAAM,KAAK,GAAG,8CAA6B,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC7D,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzC,OAAO;IACT,CAAC;IAED,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAC1B,MAAM,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACvB,MAAM,MAAM,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAEzB,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AACpC,CAAC,CAAC;AAbW,QAAA,oBAAoB,wBAa/B"}
|
|
@@ -1,34 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.getErrorRelatedSources = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const getErrorRelatedSources = sourceFile =>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
filePath
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
source
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
return yield* (0, _getSourcesFromMapFile.getSourcesFromMapFile)(location);
|
|
4
|
+
const effect_1 = require("effect");
|
|
5
|
+
const get_error_location_from_file_path_js_1 = require("./get-error-location-from-file-path.js");
|
|
6
|
+
const get_source_code_js_1 = require("./get-source-code.js");
|
|
7
|
+
const get_sources_from_map_file_js_1 = require("./get-sources-from-map-file.js");
|
|
8
|
+
const getErrorRelatedSources = (sourceFile) => effect_1.Effect.gen(function* () {
|
|
9
|
+
const location = (0, get_error_location_from_file_path_js_1.getErrorLocationFrom)(sourceFile);
|
|
10
|
+
if (location === undefined) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const { filePath, line, column } = location;
|
|
14
|
+
const isTypescriptFile = filePath.endsWith('.ts') || filePath.endsWith('.tsx');
|
|
15
|
+
if (isTypescriptFile) {
|
|
16
|
+
const source = yield* (0, get_source_code_js_1.getSourceCode)(location);
|
|
17
|
+
return {
|
|
18
|
+
_tag: 'sources',
|
|
19
|
+
runPath: `${filePath}:${line}:${column}`,
|
|
20
|
+
sourcesPath: undefined,
|
|
21
|
+
source,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
return yield* (0, get_sources_from_map_file_js_1.getSourcesFromMapFile)(location);
|
|
32
25
|
});
|
|
33
26
|
exports.getErrorRelatedSources = getErrorRelatedSources;
|
|
34
27
|
//# sourceMappingURL=get-error-related-sources.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-error-related-sources.js","
|
|
1
|
+
{"version":3,"file":"get-error-related-sources.js","sourceRoot":"","sources":["../../../src/source-maps/get-error-related-sources.ts"],"names":[],"mappings":";;;AAAA,mCAAgC;AAIhC,iGAA8E;AAC9E,6DAAqD;AACrD,iFAIwC;AAEjC,MAAM,sBAAsB,GAAG,CACpC,UAAkB,EAC0D,EAAE,CAC9E,eAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,QAAQ,GAAG,IAAA,2DAAoB,EAAC,UAAU,CAAC,CAAC;IAClD,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO;IACT,CAAC;IAED,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAC;IAE5C,MAAM,gBAAgB,GACpB,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACxD,IAAI,gBAAgB,EAAE,CAAC;QACrB,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,IAAA,kCAAa,EAAC,QAAQ,CAAC,CAAC;QAE9C,OAAO;YACL,IAAI,EAAE,SAAkB;YACxB,OAAO,EAAE,GAAG,QAAQ,IAAI,IAAI,IAAI,MAAM,EAAE;YACxC,WAAW,EAAE,SAAS;YACtB,MAAM;SACP,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,CAAC,CAAC,IAAA,oDAAqB,EAAC,QAAQ,CAAC,CAAC;AAChD,CAAC,CAAC,CAAC;AAzBQ,QAAA,sBAAsB,0BAyB9B"}
|
|
@@ -1,28 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.getSourceCode = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
const effect_1 = require("effect");
|
|
5
|
+
const fs_extra_effects_js_1 = require("../logic/effects/fs/fs-extra.effects.js");
|
|
9
6
|
const numberOflinesToExtract = 7;
|
|
10
|
-
const getSourceCode = ({
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
});
|
|
7
|
+
const getSourceCode = ({ filePath, line, column }, isFromJs = false) => effect_1.Effect.gen(function* () {
|
|
8
|
+
const start = line >= 4 ? line - 4 : 0;
|
|
9
|
+
const sourceCode = yield* (0, fs_extra_effects_js_1.readFileEffect)(filePath);
|
|
10
|
+
return sourceCode
|
|
11
|
+
.split('\n')
|
|
12
|
+
.splice(start, numberOflinesToExtract)
|
|
13
|
+
.map((currentLine, index) => {
|
|
14
|
+
const currentLineNumber = index + start + 1;
|
|
15
|
+
const actualColumn = isFromJs ? column + 1 : column;
|
|
16
|
+
return {
|
|
17
|
+
line: currentLineNumber,
|
|
18
|
+
code: currentLine,
|
|
19
|
+
column: currentLineNumber === line ? actualColumn : undefined,
|
|
20
|
+
};
|
|
21
|
+
});
|
|
26
22
|
});
|
|
27
23
|
exports.getSourceCode = getSourceCode;
|
|
28
24
|
//# sourceMappingURL=get-source-code.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-source-code.js","
|
|
1
|
+
{"version":3,"file":"get-source-code.js","sourceRoot":"","sources":["../../../src/source-maps/get-source-code.ts"],"names":[],"mappings":";;;AAAA,mCAAgC;AAGhC,iFAAyE;AAUzE,MAAM,sBAAsB,GAAG,CAAC,CAAC;AAE1B,MAAM,aAAa,GAAG,CAC3B,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAiB,EACzC,QAAQ,GAAG,KAAK,EACsB,EAAE,CACxC,eAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAEvC,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,IAAA,oCAAc,EAAC,QAAQ,CAAC,CAAC;IAEnD,OAAO,UAAU;SACd,KAAK,CAAC,IAAI,CAAC;SACX,MAAM,CAAC,KAAK,EAAE,sBAAsB,CAAC;SACrC,GAAG,CAAC,CAAC,WAAW,EAAE,KAAK,EAAE,EAAE;QAC1B,MAAM,iBAAiB,GAAG,KAAK,GAAG,KAAK,GAAG,CAAC,CAAC;QAE5C,MAAM,YAAY,GAAG,QAAQ,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QAEpD,OAAO;YACL,IAAI,EAAE,iBAAiB;YACvB,IAAI,EAAE,WAAW;YACjB,MAAM,EAAE,iBAAiB,KAAK,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS;SAC9D,CAAC;IACJ,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC;AAvBQ,QAAA,aAAa,iBAuBrB"}
|
|
@@ -1,52 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getSourcesFromMapFile = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
const effect_1 = require("effect");
|
|
9
|
+
const source_map_js_1 = require("source-map-js");
|
|
10
|
+
const fs_extra_effects_js_1 = require("../logic/effects/fs/fs-extra.effects.js");
|
|
11
|
+
const get_source_code_js_1 = require("./get-source-code.js");
|
|
12
|
+
const getSourcesFromMapFile = (location) => effect_1.Effect.gen(function* () {
|
|
13
|
+
const fileExists = yield* (0, fs_extra_effects_js_1.existsEffect)(`${location.filePath}.map`);
|
|
14
|
+
if (!fileExists) {
|
|
15
|
+
return {
|
|
16
|
+
_tag: 'location',
|
|
17
|
+
...location,
|
|
18
|
+
filePath: location.filePath.replace(process.cwd(), ''),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const data = yield* (0, fs_extra_effects_js_1.readJsonEffect)(`${location.filePath}.map`);
|
|
22
|
+
if (data.version === undefined || data.sources === undefined) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const consumer = new source_map_js_1.SourceMapConsumer(data);
|
|
26
|
+
const sources = consumer.originalPositionFor({
|
|
27
|
+
column: location.column,
|
|
28
|
+
line: location.line,
|
|
29
|
+
});
|
|
30
|
+
if (sources.source === null ||
|
|
31
|
+
sources.line === null ||
|
|
32
|
+
sources.column === null) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const absolutePath = node_path_1.default.resolve(location.filePath.substring(0, location.filePath.lastIndexOf('/')), sources.source);
|
|
36
|
+
const source = yield* (0, get_source_code_js_1.getSourceCode)({
|
|
37
|
+
filePath: absolutePath,
|
|
38
|
+
line: sources.line,
|
|
39
|
+
column: sources.column,
|
|
40
|
+
}, true);
|
|
20
41
|
return {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
42
|
+
_tag: 'sources',
|
|
43
|
+
runPath: `${location.filePath}:${location.line}:${location.column}`,
|
|
44
|
+
sourcesPath: `${absolutePath}:${sources.line}:${sources.column + 1}`,
|
|
45
|
+
source,
|
|
24
46
|
};
|
|
25
|
-
}
|
|
26
|
-
const data = yield* (0, _fsExtraEffects.readJsonEffect)(`${location.filePath}.map`);
|
|
27
|
-
if (data.version === undefined || data.sources === undefined) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
const consumer = new _sourceMapJs.SourceMapConsumer(data);
|
|
31
|
-
const sources = consumer.originalPositionFor({
|
|
32
|
-
column: location.column,
|
|
33
|
-
line: location.line
|
|
34
|
-
});
|
|
35
|
-
if (sources.source === null || sources.line === null || sources.column === null) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
const absolutePath = _nodePath.default.resolve(location.filePath.substring(0, location.filePath.lastIndexOf('/')), sources.source);
|
|
39
|
-
const source = yield* (0, _getSourceCode.getSourceCode)({
|
|
40
|
-
filePath: absolutePath,
|
|
41
|
-
line: sources.line,
|
|
42
|
-
column: sources.column
|
|
43
|
-
}, true);
|
|
44
|
-
return {
|
|
45
|
-
_tag: 'sources',
|
|
46
|
-
runPath: `${location.filePath}:${location.line}:${location.column}`,
|
|
47
|
-
sourcesPath: `${absolutePath}:${sources.line}:${sources.column + 1}`,
|
|
48
|
-
source
|
|
49
|
-
};
|
|
50
47
|
});
|
|
51
48
|
exports.getSourcesFromMapFile = getSourcesFromMapFile;
|
|
52
49
|
//# sourceMappingURL=get-sources-from-map-file.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-sources-from-map-file.js","
|
|
1
|
+
{"version":3,"file":"get-sources-from-map-file.js","sourceRoot":"","sources":["../../../src/source-maps/get-sources-from-map-file.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA6B;AAE7B,mCAAgC;AAChC,iDAAqE;AAGrE,iFAGiD;AAGjD,6DAAsE;AAa/D,MAAM,qBAAqB,GAAG,CACnC,QAAuB,EACqD,EAAE,CAC9E,eAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,IAAA,kCAAY,EAAC,GAAG,QAAQ,CAAC,QAAQ,MAAM,CAAC,CAAC;IACnE,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO;YACL,IAAI,EAAE,UAAmB;YACzB,GAAG,QAAQ;YACX,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC;SACvD,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,IAAA,oCAAc,EAChC,GAAG,QAAQ,CAAC,QAAQ,MAAM,CAC3B,CAAC;IACF,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QAC7D,OAAO;IACT,CAAC;IAED,MAAM,QAAQ,GAAG,IAAI,iCAAiB,CAAC,IAAI,CAAC,CAAC;IAC7C,MAAM,OAAO,GAAG,QAAQ,CAAC,mBAAmB,CAAC;QAC3C,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,IAAI,EAAE,QAAQ,CAAC,IAAI;KACpB,CAAC,CAAC;IACH,IACE,OAAO,CAAC,MAAM,KAAK,IAAI;QACvB,OAAO,CAAC,IAAI,KAAK,IAAI;QACrB,OAAO,CAAC,MAAM,KAAK,IAAI,EACvB,CAAC;QACD,OAAO;IACT,CAAC;IAED,MAAM,YAAY,GAAG,mBAAI,CAAC,OAAO,CAC/B,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,EAClE,OAAO,CAAC,MAAM,CACf,CAAC;IACF,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,IAAA,kCAAa,EACjC;QACE,QAAQ,EAAE,YAAY;QACtB,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,MAAM,EAAE,OAAO,CAAC,MAAM;KACvB,EACD,IAAI,CACL,CAAC;IAEF,OAAO;QACL,IAAI,EAAE,SAAkB;QACxB,OAAO,EAAE,GAAG,QAAQ,CAAC,QAAQ,IAAI,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,MAAM,EAAE;QACnE,WAAW,EAAE,GAAG,YAAY,IAAI,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;QACpE,MAAM;KACP,CAAC;AACJ,CAAC,CAAC,CAAC;AApDQ,QAAA,qBAAqB,yBAoD7B"}
|