effect-errors 1.7.31 → 1.7.33

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.
Files changed (55) hide show
  1. package/README.md +3 -1
  2. package/cjs/capture-errors.js.map +1 -1
  3. package/cjs/logic/fs/read-json/index.js +19 -0
  4. package/cjs/logic/fs/read-json/index.js.map +1 -0
  5. package/cjs/logic/fs/read-json/json-parsing.error.js +8 -0
  6. package/cjs/logic/fs/read-json/json-parsing.error.js.map +1 -0
  7. package/cjs/logic/fs/read-json/parse-json.js +15 -0
  8. package/cjs/logic/fs/read-json/parse-json.js.map +1 -0
  9. package/cjs/logic/fs/read-json/read-json.js +14 -0
  10. package/cjs/logic/fs/read-json/read-json.js.map +1 -0
  11. package/cjs/source-maps/get-error-related-sources.js.map +1 -1
  12. package/cjs/source-maps/get-source-code.js +3 -2
  13. package/cjs/source-maps/get-source-code.js.map +1 -1
  14. package/cjs/source-maps/get-sources-from-map-file.js +7 -5
  15. package/cjs/source-maps/get-sources-from-map-file.js.map +1 -1
  16. package/cjs/source-maps/maybe-map-sourcemaps.js.map +1 -1
  17. package/dts/capture-errors.d.ts +4 -2
  18. package/dts/logic/fs/read-json/index.d.ts +2 -0
  19. package/dts/logic/fs/read-json/json-parsing.error.d.ts +9 -0
  20. package/dts/logic/fs/read-json/parse-json.d.ts +3 -0
  21. package/dts/logic/fs/read-json/read-json.d.ts +3 -0
  22. package/dts/source-maps/get-error-related-sources.d.ts +4 -2
  23. package/dts/source-maps/get-source-code.d.ts +3 -2
  24. package/dts/source-maps/get-sources-from-map-file.d.ts +4 -2
  25. package/dts/source-maps/get-sources-from-span.d.ts +1 -1
  26. package/dts/source-maps/get-sources-from-stack.d.ts +1 -1
  27. package/dts/source-maps/maybe-map-sourcemaps.d.ts +4 -2
  28. package/dts/source-maps/transform-raw-error.d.ts +1 -1
  29. package/dts/types/pretty-error.type.d.ts +2 -2
  30. package/esm/capture-errors.js.map +1 -1
  31. package/esm/logic/fs/read-json/index.js +3 -0
  32. package/esm/logic/fs/read-json/index.js.map +1 -0
  33. package/esm/logic/fs/read-json/json-parsing.error.js +4 -0
  34. package/esm/logic/fs/read-json/json-parsing.error.js.map +1 -0
  35. package/esm/logic/fs/read-json/parse-json.js +11 -0
  36. package/esm/logic/fs/read-json/parse-json.js.map +1 -0
  37. package/esm/logic/fs/read-json/read-json.js +10 -0
  38. package/esm/logic/fs/read-json/read-json.js.map +1 -0
  39. package/esm/source-maps/get-error-related-sources.js.map +1 -1
  40. package/esm/source-maps/get-source-code.js +3 -2
  41. package/esm/source-maps/get-source-code.js.map +1 -1
  42. package/esm/source-maps/get-sources-from-map-file.js +7 -5
  43. package/esm/source-maps/get-sources-from-map-file.js.map +1 -1
  44. package/esm/source-maps/maybe-map-sourcemaps.js.map +1 -1
  45. package/package.json +6 -6
  46. package/cjs/logic/effects/fs/fs-error.js +0 -8
  47. package/cjs/logic/effects/fs/fs-error.js.map +0 -1
  48. package/cjs/logic/effects/fs/fs-extra.effects.js +0 -25
  49. package/cjs/logic/effects/fs/fs-extra.effects.js.map +0 -1
  50. package/dts/logic/effects/fs/fs-error.d.ts +0 -9
  51. package/dts/logic/effects/fs/fs-extra.effects.d.ts +0 -5
  52. package/esm/logic/effects/fs/fs-error.js +0 -4
  53. package/esm/logic/effects/fs/fs-error.js.map +0 -1
  54. package/esm/logic/effects/fs/fs-extra.effects.js +0 -16
  55. package/esm/logic/effects/fs/fs-extra.effects.js.map +0 -1
package/README.md CHANGED
@@ -177,13 +177,14 @@ export interface CaptureErrorsOptions {
177
177
  const captureErrors: <E>(
178
178
  cause: Cause<E>,
179
179
  options?: CaptureErrorsOptions
180
- ) => Effect.Effect<CapturedErrors, FsError>
180
+ ) => Effect.Effect<CapturedErrors, FsError, FileSystem>
181
181
  ```
182
182
 
183
183
  You can use `captureErrors` like so:
184
184
 
185
185
  ```typescript
186
186
  import { captureErrors } from 'effect-errors';
187
+ import { NodeFileSystem } from '@effect/platform-node';
187
188
 
188
189
  await Effect.runPromise(
189
190
  pipe(
@@ -195,6 +196,7 @@ await Effect.runPromise(
195
196
  // ...
196
197
  }),
197
198
  ),
199
+ Effect.provide(NodeFileSystem.layer),
198
200
  ),
199
201
  );
200
202
  ```
@@ -1 +1 @@
1
- {"version":3,"file":"capture-errors.js","sourceRoot":"","sources":["../../src/capture-errors.ts"],"names":[],"mappings":";;;AAAA,mCAAgC;AAChC,wCAA6D;AAG7D,8FAAgF;AAGhF,iFAAyE;AA8BlE,MAAM,aAAa,GAAG,CAC3B,KAAe,EACf,UAAgC;IAC9B,YAAY,EAAE,IAAI;IAClB,QAAQ,EAAE,IAAI;CACf,EACuC,EAAE,CAC1C,eAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,IAAI,IAAA,yBAAiB,EAAC,KAAK,CAAC,EAAE,CAAC;QAC7B,OAAO;YACL,WAAW,EAAE,IAAI;YACjB,MAAM,EAAE,EAAE;SACX,CAAC;IACJ,CAAC;IAED,MAAM,SAAS,GAAG,IAAA,gDAAiB,EAAI,KAAK,CAAC,CAAC;IAC9C,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,eAAM,CAAC,OAAO,CAAC,SAAS,EAAE,IAAA,0CAAiB,EAAC,OAAO,CAAC,CAAC,CAAC;IAE5E,OAAO;QACL,WAAW,EAAE,KAAK;QAClB,MAAM;KACP,CAAC;AACJ,CAAC,CAAC,CAAC;AAtBQ,QAAA,aAAa,iBAsBrB"}
1
+ {"version":3,"file":"capture-errors.js","sourceRoot":"","sources":["../../src/capture-errors.ts"],"names":[],"mappings":";;;AAEA,mCAAgC;AAChC,wCAA6D;AAE7D,8FAAgF;AAIhF,iFAAyE;AA8BlE,MAAM,aAAa,GAAG,CAC3B,KAAe,EACf,UAAgC;IAC9B,YAAY,EAAE,IAAI;IAClB,QAAQ,EAAE,IAAI;CACf,EAKD,EAAE,CACF,eAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,IAAI,IAAA,yBAAiB,EAAC,KAAK,CAAC,EAAE,CAAC;QAC7B,OAAO;YACL,WAAW,EAAE,IAAI;YACjB,MAAM,EAAE,EAAE;SACX,CAAC;IACJ,CAAC;IAED,MAAM,SAAS,GAAG,IAAA,gDAAiB,EAAI,KAAK,CAAC,CAAC;IAC9C,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,eAAM,CAAC,OAAO,CAAC,SAAS,EAAE,IAAA,0CAAiB,EAAC,OAAO,CAAC,CAAC,CAAC;IAE5E,OAAO;QACL,WAAW,EAAE,KAAK;QAClB,MAAM;KACP,CAAC;AACJ,CAAC,CAAC,CAAC;AA1BQ,QAAA,aAAa,iBA0BrB"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./read-json.js"), exports);
18
+ __exportStar(require("./json-parsing.error.js"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/logic/fs/read-json/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,0DAAwC"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JsonParsingError = void 0;
4
+ const Data_1 = require("effect/Data");
5
+ class JsonParsingError extends (0, Data_1.TaggedError)('json-parsing-error') {
6
+ }
7
+ exports.JsonParsingError = JsonParsingError;
8
+ //# sourceMappingURL=json-parsing.error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-parsing.error.js","sourceRoot":"","sources":["../../../../../src/logic/fs/read-json/json-parsing.error.ts"],"names":[],"mappings":";;;AAAA,sCAA0C;AAE1C,MAAa,gBAAiB,SAAQ,IAAA,kBAAW,EAAC,oBAAoB,CAGpE;CAAG;AAHL,4CAGK"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseJson = void 0;
4
+ const comment_json_1 = require("comment-json");
5
+ const effect_1 = require("effect");
6
+ const json_parsing_error_js_1 = require("./json-parsing.error.js");
7
+ const parseJson = (data) => (0, effect_1.pipe)(effect_1.Effect.sync(() => (0, comment_json_1.parse)(data, null, true)), effect_1.Effect.catchAll((e) => effect_1.Effect.fail(new json_parsing_error_js_1.JsonParsingError({
8
+ cause: e,
9
+ }))), effect_1.Effect.withSpan('parse-json', {
10
+ attributes: {
11
+ data,
12
+ },
13
+ }));
14
+ exports.parseJson = parseJson;
15
+ //# sourceMappingURL=parse-json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-json.js","sourceRoot":"","sources":["../../../../../src/logic/fs/read-json/parse-json.ts"],"names":[],"mappings":";;;AAAA,+CAAqC;AACrC,mCAAsC;AACtC,mEAA2D;AAEpD,MAAM,SAAS,GAAG,CAAC,IAAY,EAAE,EAAE,CACxC,IAAA,aAAI,EACF,eAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAA,oBAAK,EAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,EAC1C,eAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,CACpB,eAAM,CAAC,IAAI,CACT,IAAI,wCAAgB,CAAC;IACnB,KAAK,EAAE,CAAC;CACT,CAAC,CACH,CACF,EACD,eAAM,CAAC,QAAQ,CAAC,YAAY,EAAE;IAC5B,UAAU,EAAE;QACV,IAAI;KACL;CACF,CAAC,CACH,CAAC;AAfS,QAAA,SAAS,aAelB"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.readJsonEffect = void 0;
4
+ const FileSystem_1 = require("@effect/platform/FileSystem");
5
+ const effect_1 = require("effect");
6
+ const parse_json_js_1 = require("./parse-json.js");
7
+ const readJsonEffect = (filePath) => (0, effect_1.pipe)(effect_1.Effect.gen(function* () {
8
+ const fs = yield* FileSystem_1.FileSystem;
9
+ const data = yield* fs.readFileString(filePath, 'utf8');
10
+ const json = yield* (0, parse_json_js_1.parseJson)(data);
11
+ return json;
12
+ }), effect_1.Effect.withSpan('read-json', { attributes: { filePath } }));
13
+ exports.readJsonEffect = readJsonEffect;
14
+ //# sourceMappingURL=read-json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-json.js","sourceRoot":"","sources":["../../../../../src/logic/fs/read-json/read-json.ts"],"names":[],"mappings":";;;AAAA,4DAAyD;AACzD,mCAAsC;AAEtC,mDAA4C;AAErC,MAAM,cAAc,GAAG,CAAQ,QAAgB,EAAE,EAAE,CACxD,IAAA,aAAI,EACF,eAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,uBAAU,CAAC;IAC7B,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC,cAAc,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAExD,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,IAAA,yBAAS,EAAC,IAAI,CAAC,CAAC;IAEpC,OAAO,IAAa,CAAC;AACvB,CAAC,CAAC,EACF,eAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,EAAE,UAAU,EAAE,EAAE,QAAQ,EAAE,EAAE,CAAC,CAC3D,CAAC;AAXS,QAAA,cAAc,kBAWvB"}
@@ -1 +1 @@
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
+ {"version":3,"file":"get-error-related-sources.js","sourceRoot":"","sources":["../../../src/source-maps/get-error-related-sources.ts"],"names":[],"mappings":";;;AAEA,mCAAgC;AAGhC,iGAA8E;AAC9E,6DAAqD;AACrD,iFAIwC;AAEjC,MAAM,sBAAsB,GAAG,CACpC,UAAkB,EAKlB,EAAE,CACF,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;AA7BQ,QAAA,sBAAsB,0BA6B9B"}
@@ -1,12 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getSourceCode = void 0;
4
+ const FileSystem_1 = require("@effect/platform/FileSystem");
4
5
  const effect_1 = require("effect");
5
- const fs_extra_effects_js_1 = require("../logic/effects/fs/fs-extra.effects.js");
6
6
  const numberOflinesToExtract = 7;
7
7
  const getSourceCode = ({ filePath, line, column }, isFromJs = false) => effect_1.Effect.gen(function* () {
8
+ const fs = yield* FileSystem_1.FileSystem;
9
+ const sourceCode = yield* fs.readFileString(filePath, 'utf8');
8
10
  const start = line >= 4 ? line - 4 : 0;
9
- const sourceCode = yield* (0, fs_extra_effects_js_1.readFileEffect)(filePath);
10
11
  return sourceCode
11
12
  .split('\n')
12
13
  .splice(start, numberOflinesToExtract)
@@ -1 +1 @@
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
+ {"version":3,"file":"get-source-code.js","sourceRoot":"","sources":["../../../src/source-maps/get-source-code.ts"],"names":[],"mappings":";;;AACA,4DAAyD;AACzD,mCAAgC;AAUhC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AAE1B,MAAM,aAAa,GAAG,CAC3B,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAiB,EACzC,QAAQ,GAAG,KAAK,EACwC,EAAE,CAC1D,eAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,uBAAU,CAAC;IAC7B,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC,cAAc,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAE9D,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAEvC,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;AAxBQ,QAAA,aAAa,iBAwBrB"}
@@ -5,12 +5,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getSourcesFromMapFile = void 0;
7
7
  const node_path_1 = __importDefault(require("node:path"));
8
+ const FileSystem_1 = require("@effect/platform/FileSystem");
8
9
  const effect_1 = require("effect");
9
10
  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 index_js_1 = require("../logic/fs/read-json/index.js");
11
12
  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`);
13
+ const getSourcesFromMapFile = (location) => (0, effect_1.pipe)(effect_1.Effect.gen(function* () {
14
+ const fs = yield* FileSystem_1.FileSystem;
15
+ const fileExists = yield* fs.exists(`${location.filePath}.map`);
14
16
  if (!fileExists) {
15
17
  return {
16
18
  _tag: 'location',
@@ -18,7 +20,7 @@ const getSourcesFromMapFile = (location) => effect_1.Effect.gen(function* () {
18
20
  filePath: location.filePath.replace(process.cwd(), ''),
19
21
  };
20
22
  }
21
- const data = yield* (0, fs_extra_effects_js_1.readJsonEffect)(`${location.filePath}.map`);
23
+ const data = yield* (0, index_js_1.readJsonEffect)(`${location.filePath}.map`);
22
24
  if (data.version === undefined || data.sources === undefined) {
23
25
  return;
24
26
  }
@@ -44,6 +46,6 @@ const getSourcesFromMapFile = (location) => effect_1.Effect.gen(function* () {
44
46
  sourcesPath: `${absolutePath}:${sources.line}:${sources.column + 1}`,
45
47
  source,
46
48
  };
47
- });
49
+ }), effect_1.Effect.withSpan('get-sources-from-map-file', { attributes: { location } }));
48
50
  exports.getSourcesFromMapFile = getSourcesFromMapFile;
49
51
  //# sourceMappingURL=get-sources-from-map-file.js.map
@@ -1 +1 @@
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,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CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC,CACH,EACD,eAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CACnB,KAAK,CAAC,MAAM,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,YAAY,KAAK,SAAS,CAAC,CAC3D,CACF,CAAC;AAtCS,QAAA,kBAAkB,sBAsC3B"}
@@ -1,6 +1,8 @@
1
+ import type { PlatformError } from '@effect/platform/Error';
2
+ import type { FileSystem } from '@effect/platform/FileSystem';
1
3
  import { Effect } from 'effect';
2
4
  import { type Cause } from 'effect/Cause';
3
- import type { FsError } from './logic/effects/fs/fs-error.js';
5
+ import type { JsonParsingError } from './logic/fs/read-json/index.js';
4
6
  import type { ErrorLocation } from './source-maps/get-error-location-from-file-path.js';
5
7
  import type { ErrorRelatedSources } from './source-maps/get-sources-from-map-file.js';
6
8
  export interface ErrorSpan {
@@ -27,4 +29,4 @@ export interface CaptureErrorsOptions {
27
29
  reverseSpans?: boolean;
28
30
  stripCwd?: boolean;
29
31
  }
30
- export declare const captureErrors: <E>(cause: Cause<E>, options?: CaptureErrorsOptions) => Effect.Effect<CapturedErrors, FsError>;
32
+ export declare const captureErrors: <E>(cause: Cause<E>, options?: CaptureErrorsOptions) => Effect.Effect<CapturedErrors, PlatformError | JsonParsingError, FileSystem>;
@@ -0,0 +1,2 @@
1
+ export * from './read-json.js';
2
+ export * from './json-parsing.error.js';
@@ -0,0 +1,9 @@
1
+ declare const JsonParsingError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
2
+ readonly _tag: "json-parsing-error";
3
+ } & Readonly<A>;
4
+ export declare class JsonParsingError extends JsonParsingError_base<{
5
+ cause?: unknown;
6
+ message?: string;
7
+ }> {
8
+ }
9
+ export {};
@@ -0,0 +1,3 @@
1
+ import { Effect } from 'effect';
2
+ import { JsonParsingError } from './json-parsing.error.js';
3
+ export declare const parseJson: (data: string) => Effect.Effect<import("comment-json").CommentJSONValue, JsonParsingError, never>;
@@ -0,0 +1,3 @@
1
+ import { FileSystem } from '@effect/platform/FileSystem';
2
+ import { Effect } from 'effect';
3
+ export declare const readJsonEffect: <TJson>(filePath: string) => Effect.Effect<TJson, import("./json-parsing.error.js").JsonParsingError | import("@effect/platform/Error").PlatformError, FileSystem>;
@@ -1,4 +1,6 @@
1
+ import type { PlatformError } from '@effect/platform/Error';
2
+ import type { FileSystem } from '@effect/platform/FileSystem';
1
3
  import { Effect } from 'effect';
2
- import type { FsError } from '../logic/effects/fs/fs-error.js';
4
+ import type { JsonParsingError } from '../logic/fs/read-json/index.js';
3
5
  import { type ErrorRelatedSources, type RawErrorLocation } from './get-sources-from-map-file.js';
4
- export declare const getErrorRelatedSources: (sourceFile: string) => Effect.Effect<ErrorRelatedSources | RawErrorLocation | undefined, FsError>;
6
+ export declare const getErrorRelatedSources: (sourceFile: string) => Effect.Effect<ErrorRelatedSources | RawErrorLocation | undefined, PlatformError | JsonParsingError, FileSystem>;
@@ -1,9 +1,10 @@
1
+ import type { PlatformError } from '@effect/platform/Error';
2
+ import { FileSystem } from '@effect/platform/FileSystem';
1
3
  import { Effect } from 'effect';
2
- import type { FsError } from '../logic/effects/fs/fs-error.js';
3
4
  import type { ErrorLocation } from './get-error-location-from-file-path.js';
4
5
  export interface SourceCode {
5
6
  line: number;
6
7
  code: string;
7
8
  column: number | undefined;
8
9
  }
9
- export declare const getSourceCode: ({ filePath, line, column }: ErrorLocation, isFromJs?: boolean) => Effect.Effect<SourceCode[], FsError>;
10
+ export declare const getSourceCode: ({ filePath, line, column }: ErrorLocation, isFromJs?: boolean) => Effect.Effect<SourceCode[], PlatformError, FileSystem>;
@@ -1,5 +1,7 @@
1
+ import type { PlatformError } from '@effect/platform/Error';
2
+ import { FileSystem } from '@effect/platform/FileSystem';
1
3
  import { Effect } from 'effect';
2
- import type { FsError } from '../logic/effects/fs/fs-error.js';
4
+ import { type JsonParsingError } from '../logic/fs/read-json/index.js';
3
5
  import type { ErrorLocation } from './get-error-location-from-file-path.js';
4
6
  import { type SourceCode } from './get-source-code.js';
5
7
  export interface ErrorRelatedSources {
@@ -11,4 +13,4 @@ export interface ErrorRelatedSources {
11
13
  export interface RawErrorLocation extends ErrorLocation {
12
14
  _tag: 'location';
13
15
  }
14
- export declare const getSourcesFromMapFile: (location: ErrorLocation) => Effect.Effect<ErrorRelatedSources | RawErrorLocation | undefined, FsError>;
16
+ export declare const getSourcesFromMapFile: (location: ErrorLocation) => Effect.Effect<ErrorRelatedSources | RawErrorLocation | undefined, PlatformError | JsonParsingError, FileSystem>;
@@ -17,4 +17,4 @@ export declare const getSourcesFromSpan: ({ span, sources, location, }: {
17
17
  }[];
18
18
  location: RawErrorLocation[];
19
19
  sources: ErrorRelatedSources[];
20
- }, import("../logic/effects/fs/fs-error.js").FsError, never>;
20
+ }, import("../logic/fs/read-json/json-parsing.error.js").JsonParsingError | import("@effect/platform/Error").PlatformError, import("@effect/platform/FileSystem").FileSystem>;
@@ -2,4 +2,4 @@ import { Effect } from 'effect';
2
2
  export declare const getSourcesFromStack: (maybeStack: string | undefined) => Effect.Effect<{
3
3
  sources: import("./get-sources-from-map-file.js").ErrorRelatedSources[];
4
4
  location: import("./get-sources-from-map-file.js").RawErrorLocation[];
5
- }, import("../logic/effects/fs/fs-error.js").FsError, never>;
5
+ }, import("../logic/fs/read-json/json-parsing.error.js").JsonParsingError | import("@effect/platform/Error").PlatformError, import("@effect/platform/FileSystem").FileSystem>;
@@ -1,9 +1,11 @@
1
+ import type { FileSystem } from '@effect/platform/FileSystem';
1
2
  import { Effect } from 'effect';
2
- import type { FsError } from '../logic/effects/fs/fs-error.js';
3
+ import type { PlatformError } from '@effect/platform/Error';
4
+ import type { JsonParsingError } from '../logic/fs/read-json/index.js';
3
5
  import type { ErrorRelatedSources, RawErrorLocation } from './get-sources-from-map-file.js';
4
6
  export type StackEntry = {
5
7
  _tag: 'stack-entry';
6
8
  runPath: string;
7
9
  };
8
10
  export type MaybeMappedSources = ErrorRelatedSources | RawErrorLocation | StackEntry;
9
- export declare const maybeMapSourcemaps: (stacktrace: string[]) => Effect.Effect<MaybeMappedSources[], FsError>;
11
+ export declare const maybeMapSourcemaps: (stacktrace: string[]) => Effect.Effect<MaybeMappedSources[], PlatformError | JsonParsingError, FileSystem>;
@@ -25,4 +25,4 @@ export declare const transformRawError: ({ reverseSpans, stripCwd }: CaptureErro
25
25
  endTime: bigint | undefined;
26
26
  }[];
27
27
  isPlainString: boolean;
28
- }, import("../logic/effects/fs/fs-error.js").FsError, never>;
28
+ }, import("../logic/fs/read-json/json-parsing.error.js").JsonParsingError | import("@effect/platform/Error").PlatformError, import("@effect/platform/FileSystem").FileSystem>;
@@ -4,6 +4,6 @@ export declare class PrettyError {
4
4
  readonly stack: string | undefined;
5
5
  readonly span: Span | undefined;
6
6
  readonly isPlainString: boolean;
7
- readonly errorType?: unknown;
8
- constructor(message: unknown, stack: string | undefined, span: Span | undefined, isPlainString: boolean, errorType?: unknown);
7
+ readonly errorType?: unknown | undefined;
8
+ constructor(message: unknown, stack: string | undefined, span: Span | undefined, isPlainString: boolean, errorType?: unknown | undefined);
9
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"capture-errors.js","sourceRoot":"","sources":["../../src/capture-errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAc,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAG7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AAGhF,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AA8BzE,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,KAAe,EACf,UAAgC;IAC9B,YAAY,EAAE,IAAI;IAClB,QAAQ,EAAE,IAAI;CACf,EACuC,EAAE,CAC1C,MAAM,CAAC,GAAG,CAAC,QAAQ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CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './read-json.js';
2
+ export * from './json-parsing.error.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/logic/fs/read-json/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { TaggedError } from 'effect/Data';
2
+ export class JsonParsingError extends TaggedError('json-parsing-error') {
3
+ }
4
+ //# sourceMappingURL=json-parsing.error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-parsing.error.js","sourceRoot":"","sources":["../../../../../src/logic/fs/read-json/json-parsing.error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,OAAO,gBAAiB,SAAQ,WAAW,CAAC,oBAAoB,CAGpE;CAAG"}
@@ -0,0 +1,11 @@
1
+ import { parse } from 'comment-json';
2
+ import { Effect, pipe } from 'effect';
3
+ import { JsonParsingError } from './json-parsing.error.js';
4
+ export const parseJson = (data) => pipe(Effect.sync(() => parse(data, null, true)), Effect.catchAll((e) => Effect.fail(new JsonParsingError({
5
+ cause: e,
6
+ }))), Effect.withSpan('parse-json', {
7
+ attributes: {
8
+ data,
9
+ },
10
+ }));
11
+ //# sourceMappingURL=parse-json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-json.js","sourceRoot":"","sources":["../../../../../src/logic/fs/read-json/parse-json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAAY,EAAE,EAAE,CACxC,IAAI,CACF,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,EAC1C,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,CACpB,MAAM,CAAC,IAAI,CACT,IAAI,gBAAgB,CAAC;IACnB,KAAK,EAAE,CAAC;CACT,CAAC,CACH,CACF,EACD,MAAM,CAAC,QAAQ,CAAC,YAAY,EAAE;IAC5B,UAAU,EAAE;QACV,IAAI;KACL;CACF,CAAC,CACH,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { FileSystem } from '@effect/platform/FileSystem';
2
+ import { Effect, pipe } from 'effect';
3
+ import { parseJson } from './parse-json.js';
4
+ export const readJsonEffect = (filePath) => pipe(Effect.gen(function* () {
5
+ const fs = yield* FileSystem;
6
+ const data = yield* fs.readFileString(filePath, 'utf8');
7
+ const json = yield* parseJson(data);
8
+ return json;
9
+ }), Effect.withSpan('read-json', { attributes: { filePath } }));
10
+ //# sourceMappingURL=read-json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-json.js","sourceRoot":"","sources":["../../../../../src/logic/fs/read-json/read-json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,CAAC,MAAM,cAAc,GAAG,CAAQ,QAAgB,EAAE,EAAE,CACxD,IAAI,CACF,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,UAAU,CAAC;IAC7B,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC,cAAc,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAExD,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,SAAS,CAA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ChD,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"get-error-related-sources.js","sourceRoot":"","sources":["../../../src/source-maps/get-error-related-sources.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAGL,qBAAqB,GACtB,MAAM,gCAAgC,CAAC;AAExC,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,UAAkB,EAKlB,EAAE,CACF,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,QAAQ,GAAG,oBAAoB,CAAC,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,aAAa,CAAC,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,qBAAqB,CAAC,QAAQ,CAAC,CAAC;AAChD,CAAC,CAAC,CAAC"}
@@ -1,9 +1,10 @@
1
+ import { FileSystem } from '@effect/platform/FileSystem';
1
2
  import { Effect } from 'effect';
2
- import { readFileEffect } from '../logic/effects/fs/fs-extra.effects.js';
3
3
  const numberOflinesToExtract = 7;
4
4
  export const getSourceCode = ({ filePath, line, column }, isFromJs = false) => Effect.gen(function* () {
5
+ const fs = yield* FileSystem;
6
+ const sourceCode = yield* fs.readFileString(filePath, 'utf8');
5
7
  const start = line >= 4 ? line - 4 : 0;
6
- const sourceCode = yield* readFileEffect(filePath);
7
8
  return sourceCode
8
9
  .split('\n')
9
10
  .splice(start, numberOflinesToExtract)
@@ -1 +1 @@
1
- {"version":3,"file":"get-source-code.js","sourceRoot":"","sources":["../../../src/source-maps/get-source-code.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAUzE,MAAM,sBAAsB,GAAG,CAAC,CAAC;AAEjC,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAiB,EACzC,QAAQ,GAAG,KAAK,EACsB,EAAE,CACxC,MAAM,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,cAAc,CAAC,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,IA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AC;IACJ,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -1,10 +1,12 @@
1
1
  import path from 'node:path';
2
- import { Effect } from 'effect';
2
+ import { FileSystem } from '@effect/platform/FileSystem';
3
+ import { Effect, pipe } from 'effect';
3
4
  import { SourceMapConsumer } from 'source-map-js';
4
- import { existsEffect, readJsonEffect, } from '../logic/effects/fs/fs-extra.effects.js';
5
+ import { readJsonEffect, } from '../logic/fs/read-json/index.js';
5
6
  import { getSourceCode } from './get-source-code.js';
6
- export const getSourcesFromMapFile = (location) => Effect.gen(function* () {
7
- const fileExists = yield* existsEffect(`${location.filePath}.map`);
7
+ export const getSourcesFromMapFile = (location) => pipe(Effect.gen(function* () {
8
+ const fs = yield* FileSystem;
9
+ const fileExists = yield* fs.exists(`${location.filePath}.map`);
8
10
  if (!fileExists) {
9
11
  return {
10
12
  _tag: 'location',
@@ -38,5 +40,5 @@ export const getSourcesFromMapFile = (location) => Effect.gen(function* () {
38
40
  sourcesPath: `${absolutePath}:${sources.line}:${sources.column + 1}`,
39
41
  source,
40
42
  };
41
- });
43
+ }), Effect.withSpan('get-sources-from-map-file', { attributes: { location } }));
42
44
  //# sourceMappingURL=get-sources-from-map-file.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-sources-from-map-file.js","sourceRoot":"","sources":["../../../src/source-maps/get-sources-from-map-file.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAqB,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGrE,OAAO,EACL,YAAY,EACZ,cAAc,GACf,MAAM,yCAAyC,CAAC;AAGjD,OAAO,EAAmB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAatE,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,QAAuB,EACqD,EAAE,CAC9E,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,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O,EAAE,SAAS,CAAC,UAAU,CAAC,YAAY,EAAE,KAAK,CAAC;SACnD,CAAC;IACJ,CAAC;IACD,IAAI,OAAO,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;QAChC,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,GAAG,OAAO,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;IAC3D,IAAI,OAAO,CAAC,WAAW,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;QACtC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC,CACH,EACD,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CACnB,KAAK,CAAC,MAAM,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,YAAY,KAAK,SAAS,CAAC,CAC3D,CACF,CAAC"}
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  }
18
18
  },
19
19
  "name": "effect-errors",
20
- "version": "1.7.31",
20
+ "version": "1.7.33",
21
21
  "author": "jpb06 <jp.bois.06@outlook.fr>",
22
22
  "description": "A POC for errors reporting in Effect",
23
23
  "keywords": [
@@ -53,11 +53,11 @@
53
53
  "bundle-example": "bun esbuild --bundle --platform=node --format=esm --sourcemap=external --minify --inject:./src/examples/bundling/cjs-shims.ts --outfile=./src/tests/bundle/from-promise.js ./src/examples/bundling/from-promise.bundle.ts"
54
54
  },
55
55
  "dependencies": {
56
- "@effect/platform": "^0.69.24",
57
- "@effect/platform-node": "^0.64.26",
56
+ "@effect/platform": "^0.69.25",
57
+ "@effect/platform-node": "^0.64.27",
58
58
  "@effect/schema": "^0.75.5",
59
59
  "comment-json": "^4.2.5",
60
- "effect": "^3.10.15",
60
+ "effect": "^3.10.16",
61
61
  "picocolors": "^1.1.1",
62
62
  "source-map-js": "^1.2.1"
63
63
  },
@@ -68,7 +68,7 @@
68
68
  "@babel/plugin-transform-modules-commonjs": "^7.25.9",
69
69
  "@biomejs/biome": "^1.9.4",
70
70
  "@types/fs-extra": "^11.0.4",
71
- "@types/node": "^22.9.0",
71
+ "@types/node": "^22.9.3",
72
72
  "@vitest/coverage-v8": "^2.1.5",
73
73
  "babel-plugin-annotate-pure-calls": "^0.4.0",
74
74
  "copyfiles": "^2.4.1",
@@ -79,7 +79,7 @@
79
79
  "readme-package-icons": "^1.1.16",
80
80
  "ts-node": "^10.9.2",
81
81
  "tsx": "^4.19.2",
82
- "typescript": "^5.6.3",
82
+ "typescript": "^5.7.2",
83
83
  "vitest": "^2.1.5",
84
84
  "vitest-mock-extended": "^2.0.2"
85
85
  }
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FsError = void 0;
4
- const Data_1 = require("effect/Data");
5
- class FsError extends (0, Data_1.TaggedError)('fs-error') {
6
- }
7
- exports.FsError = FsError;
8
- //# sourceMappingURL=fs-error.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fs-error.js","sourceRoot":"","sources":["../../../../../src/logic/effects/fs/fs-error.ts"],"names":[],"mappings":";;;AAAA,sCAA0C;AAE1C,MAAa,OAAQ,SAAQ,IAAA,kBAAW,EAAC,UAAU,CAGjD;CAAG;AAHL,0BAGK"}
@@ -1,25 +0,0 @@
1
- "use strict";
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
- exports.readJsonEffect = exports.existsEffect = exports.readFileEffect = void 0;
7
- const effect_1 = require("effect");
8
- const fs_extra_1 = __importDefault(require("fs-extra"));
9
- const fs_error_js_1 = require("./fs-error.js");
10
- const readFileEffect = (path) => (0, effect_1.pipe)(effect_1.Effect.tryPromise({
11
- try: async () => await fs_extra_1.default.readFile(path, { encoding: 'utf8' }),
12
- catch: (e) => new fs_error_js_1.FsError({ cause: e }),
13
- }), effect_1.Effect.withSpan('readFile', { attributes: { path } }));
14
- exports.readFileEffect = readFileEffect;
15
- const existsEffect = (path) => (0, effect_1.pipe)(effect_1.Effect.tryPromise({
16
- try: async () => await fs_extra_1.default.exists(path),
17
- catch: (e) => new fs_error_js_1.FsError({ cause: e }),
18
- }), effect_1.Effect.withSpan('exists', { attributes: { path } }));
19
- exports.existsEffect = existsEffect;
20
- const readJsonEffect = (path) => (0, effect_1.pipe)(effect_1.Effect.tryPromise({
21
- try: async () => await fs_extra_1.default.readJson(path),
22
- catch: (e) => new fs_error_js_1.FsError({ cause: e }),
23
- }), effect_1.Effect.withSpan('readJson', { attributes: { path } }));
24
- exports.readJsonEffect = readJsonEffect;
25
- //# sourceMappingURL=fs-extra.effects.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fs-extra.effects.js","sourceRoot":"","sources":["../../../../../src/logic/effects/fs/fs-extra.effects.ts"],"names":[],"mappings":";;;;;;AAAA,mCAAsC;AACtC,wDAA0B;AAE1B,+CAAwC;AAEjC,MAAM,cAAc,GAAG,CAAC,IAAY,EAAE,EAAE,CAC7C,IAAA,aAAI,EACF,eAAM,CAAC,UAAU,CAAC;IAChB,GAAG,EAAE,KAAK,IAAI,EAAE,CAAC,MAAM,kBAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;IAC9D,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,qBAAO,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;CACxC,CAAC,EACF,eAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC,CACtD,CAAC;AAPS,QAAA,cAAc,kBAOvB;AAEG,MAAM,YAAY,GAAG,CAAC,IAAY,EAAE,EAAE,CAC3C,IAAA,aAAI,EACF,eAAM,CAAC,UAAU,CAAC;IAChB,GAAG,EAAE,KAAK,IAAI,EAAE,CAAC,MAAM,kBAAE,CAAC,MAAM,CAAC,IAAI,CAAC;IACtC,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,qBAAO,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;CACxC,CAAC,EACF,eAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC,CACpD,CAAC;AAPS,QAAA,YAAY,gBAOrB;AAEG,MAAM,cAAc,GAAG,CAAU,IAAY,EAAE,EAAE,CACtD,IAAA,aAAI,EACF,eAAM,CAAC,UAAU,CAAC;IAChB,GAAG,EAAE,KAAK,IAAI,EAAE,CAAC,MAAO,kBAAE,CAAC,QAAQ,CAAC,IAAI,CAAsB;IAC9D,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,qBAAO,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;CACxC,CAAC,EACF,eAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC,CACtD,CAAC;AAPS,QAAA,cAAc,kBAOvB"}
@@ -1,9 +0,0 @@
1
- declare const FsError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
2
- readonly _tag: "fs-error";
3
- } & Readonly<A>;
4
- export declare class FsError extends FsError_base<{
5
- cause?: unknown;
6
- message?: string;
7
- }> {
8
- }
9
- export {};
@@ -1,5 +0,0 @@
1
- import { Effect } from 'effect';
2
- import { FsError } from './fs-error.js';
3
- export declare const readFileEffect: (path: string) => Effect.Effect<string, FsError, never>;
4
- export declare const existsEffect: (path: string) => Effect.Effect<boolean, FsError, never>;
5
- export declare const readJsonEffect: <TResult>(path: string) => Effect.Effect<TResult, FsError, never>;
@@ -1,4 +0,0 @@
1
- import { TaggedError } from 'effect/Data';
2
- export class FsError extends TaggedError('fs-error') {
3
- }
4
- //# sourceMappingURL=fs-error.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fs-error.js","sourceRoot":"","sources":["../../../../../src/logic/effects/fs/fs-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,OAAO,OAAQ,SAAQ,WAAW,CAAC,UAAU,CAGjD;CAAG"}
@@ -1,16 +0,0 @@
1
- import { Effect, pipe } from 'effect';
2
- import fs from 'fs-extra';
3
- import { FsError } from './fs-error.js';
4
- export const readFileEffect = (path) => pipe(Effect.tryPromise({
5
- try: async () => await fs.readFile(path, { encoding: 'utf8' }),
6
- catch: (e) => new FsError({ cause: e }),
7
- }), Effect.withSpan('readFile', { attributes: { path } }));
8
- export const existsEffect = (path) => pipe(Effect.tryPromise({
9
- try: async () => await fs.exists(path),
10
- catch: (e) => new FsError({ cause: e }),
11
- }), Effect.withSpan('exists', { attributes: { path } }));
12
- export const readJsonEffect = (path) => pipe(Effect.tryPromise({
13
- try: async () => await fs.readJson(path),
14
- catch: (e) => new FsError({ cause: e }),
15
- }), Effect.withSpan('readJson', { attributes: { path } }));
16
- //# sourceMappingURL=fs-extra.effects.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fs-extra.effects.js","sourceRoot":"","sources":["../../../../../src/logic/effects/fs/fs-extra.effects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,MAAM,UAAU,CAAC;AAE1B,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,IAAY,EAAE,EAAE,CAC7C,IAAI,CACF,MAAM,CAAC,UAAU,CAAC;IAChB,GAAG,EAAE,KAAK,IAAI,EAAE,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,MAAM,EA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