@effect/language-service 0.47.3 → 0.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/cli.js +215 -210
- package/cli.js.map +1 -1
- package/effect-lsp-patch-utils.js +31 -26
- package/effect-lsp-patch-utils.js.map +1 -1
- package/index.js +2976 -713
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/transform.js +31 -26
- package/transform.js.map +1 -1
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
// node_modules/.pnpm
|
|
3
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/Function.js
|
|
4
4
|
var isFunction = (input) => typeof input === "function";
|
|
5
5
|
var dual = function(arity, body) {
|
|
6
6
|
if (typeof arity === "function") {
|
|
@@ -65,6 +65,8 @@ var dual = function(arity, body) {
|
|
|
65
65
|
};
|
|
66
66
|
var identity = (a) => a;
|
|
67
67
|
var constant = (value) => () => value;
|
|
68
|
+
var constTrue = /* @__PURE__ */ constant(true);
|
|
69
|
+
var constFalse = /* @__PURE__ */ constant(false);
|
|
68
70
|
var constUndefined = /* @__PURE__ */ constant(void 0);
|
|
69
71
|
function pipe(a, ab, bc, cd, de, ef, fg, gh, hi) {
|
|
70
72
|
switch (arguments.length) {
|
|
@@ -96,7 +98,7 @@ function pipe(a, ab, bc, cd, de, ef, fg, gh, hi) {
|
|
|
96
98
|
}
|
|
97
99
|
}
|
|
98
100
|
|
|
99
|
-
// node_modules/.pnpm
|
|
101
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/Equivalence.js
|
|
100
102
|
var make = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that);
|
|
101
103
|
var array = (item) => make((self, that) => {
|
|
102
104
|
if (self.length !== that.length) {
|
|
@@ -111,7 +113,7 @@ var array = (item) => make((self, that) => {
|
|
|
111
113
|
return true;
|
|
112
114
|
});
|
|
113
115
|
|
|
114
|
-
// node_modules/.pnpm
|
|
116
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/GlobalValue.js
|
|
115
117
|
var globalStoreId = `effect/GlobalValue`;
|
|
116
118
|
var globalStore;
|
|
117
119
|
var globalValue = (id, compute) => {
|
|
@@ -125,7 +127,7 @@ var globalValue = (id, compute) => {
|
|
|
125
127
|
return globalStore.get(id);
|
|
126
128
|
};
|
|
127
129
|
|
|
128
|
-
// node_modules/.pnpm
|
|
130
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/Predicate.js
|
|
129
131
|
var isString = (input) => typeof input === "string";
|
|
130
132
|
var isNumber = (input) => typeof input === "number";
|
|
131
133
|
var isBoolean = (input) => typeof input === "boolean";
|
|
@@ -133,9 +135,13 @@ var isFunction2 = isFunction;
|
|
|
133
135
|
var isRecordOrArray = (input) => typeof input === "object" && input !== null;
|
|
134
136
|
var isObject = (input) => isRecordOrArray(input) || isFunction2(input);
|
|
135
137
|
var hasProperty = /* @__PURE__ */ dual(2, (self, property) => isObject(self) && property in self);
|
|
138
|
+
var isTagged = /* @__PURE__ */ dual(2, (self, tag) => hasProperty(self, "_tag") && self["_tag"] === tag);
|
|
136
139
|
var isRecord = (input) => isRecordOrArray(input) && !Array.isArray(input);
|
|
137
140
|
|
|
138
|
-
// node_modules/.pnpm
|
|
141
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/errors.js
|
|
142
|
+
var getBugErrorMessage = (message) => `BUG: ${message} - please report an issue at https://github.com/Effect-TS/effect/issues`;
|
|
143
|
+
|
|
144
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/Utils.js
|
|
139
145
|
var GenKindTypeId = /* @__PURE__ */ Symbol.for("effect/Gen/GenKind");
|
|
140
146
|
var GenKindImpl = class {
|
|
141
147
|
value;
|
|
@@ -257,7 +263,7 @@ var internalCall = isNotOptimizedAway ? standard.effect_internal_function : forc
|
|
|
257
263
|
var genConstructor = function* () {
|
|
258
264
|
}.constructor;
|
|
259
265
|
|
|
260
|
-
// node_modules/.pnpm
|
|
266
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/Hash.js
|
|
261
267
|
var randomHashCache = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("effect/Hash/randomHashCache"), () => /* @__PURE__ */ new WeakMap());
|
|
262
268
|
var symbol = /* @__PURE__ */ Symbol.for("effect/Hash");
|
|
263
269
|
var hash = (self) => {
|
|
@@ -324,14 +330,21 @@ var string = (str) => {
|
|
|
324
330
|
}
|
|
325
331
|
return optimize(h);
|
|
326
332
|
};
|
|
327
|
-
var structureKeys = (o,
|
|
333
|
+
var structureKeys = (o, keys3) => {
|
|
328
334
|
let h = 12289;
|
|
329
|
-
for (let i = 0; i <
|
|
330
|
-
h ^= pipe(string(
|
|
335
|
+
for (let i = 0; i < keys3.length; i++) {
|
|
336
|
+
h ^= pipe(string(keys3[i]), combine(hash(o[keys3[i]])));
|
|
331
337
|
}
|
|
332
338
|
return optimize(h);
|
|
333
339
|
};
|
|
334
340
|
var structure = (o) => structureKeys(o, Object.keys(o));
|
|
341
|
+
var array2 = (arr) => {
|
|
342
|
+
let h = 6151;
|
|
343
|
+
for (let i = 0; i < arr.length; i++) {
|
|
344
|
+
h = pipe(h, combine(hash(arr[i])));
|
|
345
|
+
}
|
|
346
|
+
return optimize(h);
|
|
347
|
+
};
|
|
335
348
|
var cached = function() {
|
|
336
349
|
if (arguments.length === 1) {
|
|
337
350
|
const self2 = arguments[0];
|
|
@@ -356,7 +369,7 @@ var cached = function() {
|
|
|
356
369
|
return hash2;
|
|
357
370
|
};
|
|
358
371
|
|
|
359
|
-
// node_modules/.pnpm
|
|
372
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/Equal.js
|
|
360
373
|
var symbol2 = /* @__PURE__ */ Symbol.for("effect/Equal");
|
|
361
374
|
function equals() {
|
|
362
375
|
if (arguments.length === 1) {
|
|
@@ -410,7 +423,7 @@ function compareBoth(self, that) {
|
|
|
410
423
|
var isEqual = (u) => hasProperty(u, symbol2);
|
|
411
424
|
var equivalence = () => equals;
|
|
412
425
|
|
|
413
|
-
// node_modules/.pnpm
|
|
426
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/Inspectable.js
|
|
414
427
|
var NodeInspectSymbol = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
|
|
415
428
|
var toJSON = (x) => {
|
|
416
429
|
try {
|
|
@@ -450,6 +463,12 @@ var Class = class {
|
|
|
450
463
|
return format(this.toJSON());
|
|
451
464
|
}
|
|
452
465
|
};
|
|
466
|
+
var stringifyCircular = (obj, whitespace) => {
|
|
467
|
+
let cache = [];
|
|
468
|
+
const retVal = JSON.stringify(obj, (_key, value) => typeof value === "object" && value !== null ? cache.includes(value) ? void 0 : cache.push(value) && (redactableState.fiberRefs !== void 0 && isRedactable(value) ? value[symbolRedactable](redactableState.fiberRefs) : value) : value, whitespace);
|
|
469
|
+
cache = void 0;
|
|
470
|
+
return retVal;
|
|
471
|
+
};
|
|
453
472
|
var symbolRedactable = /* @__PURE__ */ Symbol.for("effect/Inspectable/Redactable");
|
|
454
473
|
var isRedactable = (u) => typeof u === "object" && u !== null && symbolRedactable in u;
|
|
455
474
|
var redactableState = /* @__PURE__ */ globalValue("effect/Inspectable/redactableState", () => ({
|
|
@@ -462,7 +481,7 @@ var redact = (u) => {
|
|
|
462
481
|
return u;
|
|
463
482
|
};
|
|
464
483
|
|
|
465
|
-
// node_modules/.pnpm
|
|
484
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/Pipeable.js
|
|
466
485
|
var pipeArguments = (self, args2) => {
|
|
467
486
|
switch (args2.length) {
|
|
468
487
|
case 0:
|
|
@@ -495,14 +514,16 @@ var pipeArguments = (self, args2) => {
|
|
|
495
514
|
}
|
|
496
515
|
};
|
|
497
516
|
|
|
498
|
-
// node_modules/.pnpm
|
|
517
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/opCodes/effect.js
|
|
499
518
|
var OP_COMMIT = "Commit";
|
|
519
|
+
var OP_FAILURE = "Failure";
|
|
520
|
+
var OP_WITH_RUNTIME = "WithRuntime";
|
|
500
521
|
|
|
501
|
-
// node_modules/.pnpm
|
|
522
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/version.js
|
|
502
523
|
var moduleVersion = "3.18.4";
|
|
503
524
|
var getCurrentVersion = () => moduleVersion;
|
|
504
525
|
|
|
505
|
-
// node_modules/.pnpm
|
|
526
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/effectable.js
|
|
506
527
|
var EffectTypeId = /* @__PURE__ */ Symbol.for("effect/Effect");
|
|
507
528
|
var StreamTypeId = /* @__PURE__ */ Symbol.for("effect/Stream");
|
|
508
529
|
var SinkTypeId = /* @__PURE__ */ Symbol.for("effect/Sink");
|
|
@@ -589,7 +610,7 @@ var StructuralCommitPrototype = {
|
|
|
589
610
|
...StructuralPrototype
|
|
590
611
|
};
|
|
591
612
|
|
|
592
|
-
// node_modules/.pnpm
|
|
613
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/option.js
|
|
593
614
|
var TypeId = /* @__PURE__ */ Symbol.for("effect/Option");
|
|
594
615
|
var CommonProto = {
|
|
595
616
|
...EffectPrototype,
|
|
@@ -647,7 +668,7 @@ var some = (value) => {
|
|
|
647
668
|
return a;
|
|
648
669
|
};
|
|
649
670
|
|
|
650
|
-
// node_modules/.pnpm
|
|
671
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/either.js
|
|
651
672
|
var TypeId2 = /* @__PURE__ */ Symbol.for("effect/Either");
|
|
652
673
|
var CommonProto2 = {
|
|
653
674
|
...EffectPrototype,
|
|
@@ -709,7 +730,7 @@ var right = (right3) => {
|
|
|
709
730
|
return a;
|
|
710
731
|
};
|
|
711
732
|
|
|
712
|
-
// node_modules/.pnpm
|
|
733
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/Either.js
|
|
713
734
|
var right2 = right;
|
|
714
735
|
var left2 = left;
|
|
715
736
|
var isLeft2 = isLeft;
|
|
@@ -717,14 +738,16 @@ var isRight2 = isRight;
|
|
|
717
738
|
var map = /* @__PURE__ */ dual(2, (self, f) => isRight2(self) ? right2(f(self.right)) : left2(self.left));
|
|
718
739
|
var getOrElse = /* @__PURE__ */ dual(2, (self, onLeft) => isLeft2(self) ? onLeft(self.left) : self.right);
|
|
719
740
|
|
|
720
|
-
// node_modules/.pnpm
|
|
741
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/array.js
|
|
721
742
|
var isNonEmptyArray = (self) => self.length > 0;
|
|
722
743
|
|
|
723
|
-
// node_modules/.pnpm
|
|
744
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/Order.js
|
|
724
745
|
var make2 = (compare) => (self, that) => self === that ? 0 : compare(self, that);
|
|
725
746
|
var string2 = /* @__PURE__ */ make2((self, that) => self < that ? -1 : 1);
|
|
747
|
+
var number2 = /* @__PURE__ */ make2((self, that) => self < that ? -1 : 1);
|
|
748
|
+
var mapInput = /* @__PURE__ */ dual(2, (self, f) => make2((b1, b2) => self(f(b1), f(b2))));
|
|
726
749
|
|
|
727
|
-
// node_modules/.pnpm
|
|
750
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/Option.js
|
|
728
751
|
var none2 = () => none;
|
|
729
752
|
var some2 = some;
|
|
730
753
|
var isNone2 = isNone;
|
|
@@ -735,7 +758,7 @@ var fromNullable = (nullableValue) => nullableValue == null ? none2() : some2(nu
|
|
|
735
758
|
var getOrUndefined = /* @__PURE__ */ getOrElse2(constUndefined);
|
|
736
759
|
var map2 = /* @__PURE__ */ dual(2, (self, f) => isNone2(self) ? none2() : some2(f(self.value)));
|
|
737
760
|
|
|
738
|
-
// node_modules/.pnpm
|
|
761
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/Record.js
|
|
739
762
|
var map3 = /* @__PURE__ */ dual(2, (self, f) => {
|
|
740
763
|
const out = {
|
|
741
764
|
...self
|
|
@@ -747,7 +770,7 @@ var map3 = /* @__PURE__ */ dual(2, (self, f) => {
|
|
|
747
770
|
});
|
|
748
771
|
var keys = (self) => Object.keys(self);
|
|
749
772
|
|
|
750
|
-
// node_modules/.pnpm
|
|
773
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/Array.js
|
|
751
774
|
var fromIterable = (collection) => Array.isArray(collection) ? collection : Array.from(collection);
|
|
752
775
|
var append = /* @__PURE__ */ dual(2, (self, last) => [...self, last]);
|
|
753
776
|
var appendAll = /* @__PURE__ */ dual(2, (self, that) => fromIterable(self).concat(fromIterable(that)));
|
|
@@ -770,6 +793,7 @@ var unsafeGet = /* @__PURE__ */ dual(2, (self, index) => {
|
|
|
770
793
|
var head = /* @__PURE__ */ get(0);
|
|
771
794
|
var headNonEmpty = /* @__PURE__ */ unsafeGet(0);
|
|
772
795
|
var tailNonEmpty = (self) => self.slice(1);
|
|
796
|
+
var reverse = (self) => Array.from(self).reverse();
|
|
773
797
|
var sort = /* @__PURE__ */ dual(2, (self, O) => {
|
|
774
798
|
const out = Array.from(self);
|
|
775
799
|
out.sort(O);
|
|
@@ -785,8 +809,8 @@ var containsWith = (isEquivalent) => dual(2, (self, a) => {
|
|
|
785
809
|
});
|
|
786
810
|
var _equivalence = /* @__PURE__ */ equivalence();
|
|
787
811
|
var intersectionWith = (isEquivalent) => {
|
|
788
|
-
const
|
|
789
|
-
return dual(2, (self, that) => fromIterable(self).filter((a) =>
|
|
812
|
+
const has3 = containsWith(isEquivalent);
|
|
813
|
+
return dual(2, (self, that) => fromIterable(self).filter((a) => has3(that, a)));
|
|
790
814
|
};
|
|
791
815
|
var intersection = /* @__PURE__ */ intersectionWith(_equivalence);
|
|
792
816
|
var empty = () => [];
|
|
@@ -828,6 +852,7 @@ var partition = /* @__PURE__ */ dual(2, (self, predicate) => {
|
|
|
828
852
|
}
|
|
829
853
|
return [left3, right3];
|
|
830
854
|
});
|
|
855
|
+
var reduce = /* @__PURE__ */ dual(3, (self, b, f) => fromIterable(self).reduce((b2, a, i) => f(b2, a, i), b));
|
|
831
856
|
var every = /* @__PURE__ */ dual(2, (self, refinement) => self.every(refinement));
|
|
832
857
|
var dedupeWith = /* @__PURE__ */ dual(2, (self, isEquivalent) => {
|
|
833
858
|
const input = fromIterable(self);
|
|
@@ -1225,7 +1250,7 @@ function parseKeyPatterns(patterns) {
|
|
|
1225
1250
|
if (!isObject(entry)) continue;
|
|
1226
1251
|
result.push({
|
|
1227
1252
|
target: hasProperty(entry, "target") && isString(entry.target) && ["service", "error", "custom"].includes(entry.target.toLowerCase()) ? entry.target.toLowerCase() : "service",
|
|
1228
|
-
pattern: hasProperty(entry, "pattern") && isString(entry.pattern) && ["package-identifier", "default"].includes(entry.pattern.toLowerCase()) ? entry.pattern.toLowerCase() : "default",
|
|
1253
|
+
pattern: hasProperty(entry, "pattern") && isString(entry.pattern) && ["package-identifier", "default", "default-hashed"].includes(entry.pattern.toLowerCase()) ? entry.pattern.toLowerCase() : "default",
|
|
1229
1254
|
skipLeadingPath: hasProperty(entry, "skipLeadingPath") && isArray(entry.skipLeadingPath) && entry.skipLeadingPath.every(isString) ? entry.skipLeadingPath : ["src/"]
|
|
1230
1255
|
});
|
|
1231
1256
|
}
|
|
@@ -1811,71 +1836,6 @@ function makeTypeScriptUtils(ts) {
|
|
|
1811
1836
|
};
|
|
1812
1837
|
}
|
|
1813
1838
|
|
|
1814
|
-
// src/core/KeyBuilder.ts
|
|
1815
|
-
var makeKeyBuilder = fn("KeyBuilder")(
|
|
1816
|
-
function* (sourceFile) {
|
|
1817
|
-
const ts = yield* service(TypeScriptApi);
|
|
1818
|
-
const tsUtils = yield* service(TypeScriptUtils);
|
|
1819
|
-
const program = yield* service(TypeScriptProgram);
|
|
1820
|
-
const options = yield* service(LanguageServicePluginOptions);
|
|
1821
|
-
const packageInfo = tsUtils.resolveModuleWithPackageInfoFromSourceFile(program, sourceFile);
|
|
1822
|
-
function createString2(classNameText, kind) {
|
|
1823
|
-
if (!packageInfo) return;
|
|
1824
|
-
for (const keyPattern of options.keyPatterns) {
|
|
1825
|
-
if (keyPattern.target !== kind) continue;
|
|
1826
|
-
const lastIndex = sourceFile.fileName.lastIndexOf("/");
|
|
1827
|
-
let onlyFileName = lastIndex === -1 ? "" : sourceFile.fileName.slice(lastIndex + 1);
|
|
1828
|
-
const lastExtensionIndex = onlyFileName.lastIndexOf(".");
|
|
1829
|
-
if (lastExtensionIndex !== -1) onlyFileName = onlyFileName.slice(0, lastExtensionIndex);
|
|
1830
|
-
if (onlyFileName.toLowerCase().endsWith("/index")) onlyFileName = onlyFileName.slice(0, -6);
|
|
1831
|
-
if (onlyFileName.startsWith("/")) onlyFileName = onlyFileName.slice(1);
|
|
1832
|
-
let subDirectory = getDirectoryPath(ts, sourceFile.fileName);
|
|
1833
|
-
if (!subDirectory.startsWith(packageInfo.packageDirectory)) continue;
|
|
1834
|
-
subDirectory = subDirectory.slice(packageInfo.packageDirectory.length);
|
|
1835
|
-
if (!subDirectory.endsWith("/")) subDirectory = subDirectory + "/";
|
|
1836
|
-
if (subDirectory.startsWith("/")) subDirectory = subDirectory.slice(1);
|
|
1837
|
-
for (const prefix of keyPattern.skipLeadingPath) {
|
|
1838
|
-
if (subDirectory.startsWith(prefix)) {
|
|
1839
|
-
subDirectory = subDirectory.slice(prefix.length);
|
|
1840
|
-
break;
|
|
1841
|
-
}
|
|
1842
|
-
}
|
|
1843
|
-
let parts = [packageInfo.name, subDirectory, onlyFileName].concat(
|
|
1844
|
-
onlyFileName.toLowerCase() === classNameText.toLowerCase() ? [] : [classNameText]
|
|
1845
|
-
);
|
|
1846
|
-
if (keyPattern.pattern === "package-identifier") {
|
|
1847
|
-
parts = [packageInfo.name, onlyFileName].concat(
|
|
1848
|
-
onlyFileName.toLowerCase() === classNameText.toLowerCase() ? [] : [classNameText]
|
|
1849
|
-
);
|
|
1850
|
-
}
|
|
1851
|
-
parts = parts.map((part) => part.startsWith("/") ? part.slice(1) : part).map(
|
|
1852
|
-
(part) => part.endsWith("/") ? part.slice(0, -1) : part
|
|
1853
|
-
);
|
|
1854
|
-
return parts.filter((_) => String(_).trim().length > 0).join("/");
|
|
1855
|
-
}
|
|
1856
|
-
}
|
|
1857
|
-
return {
|
|
1858
|
-
createString: createString2
|
|
1859
|
-
};
|
|
1860
|
-
}
|
|
1861
|
-
);
|
|
1862
|
-
var keyBuilderCache = /* @__PURE__ */ new Map();
|
|
1863
|
-
var getOrMakeKeyBuilder = fn("getOrMakeKeyBuilder")(function* (sourceFile) {
|
|
1864
|
-
while (keyBuilderCache.size > 5) {
|
|
1865
|
-
const oldest = keyBuilderCache.keys().next().value;
|
|
1866
|
-
if (oldest) keyBuilderCache.delete(oldest);
|
|
1867
|
-
}
|
|
1868
|
-
const keyBuilder = keyBuilderCache.get(sourceFile.fileName) || (yield* makeKeyBuilder(sourceFile));
|
|
1869
|
-
keyBuilderCache.set(sourceFile.fileName, keyBuilder);
|
|
1870
|
-
return keyBuilder;
|
|
1871
|
-
});
|
|
1872
|
-
function createString(sourceFile, identifier, kind) {
|
|
1873
|
-
return map5(
|
|
1874
|
-
getOrMakeKeyBuilder(sourceFile),
|
|
1875
|
-
(identifierBuilder) => identifierBuilder.createString(identifier, kind)
|
|
1876
|
-
);
|
|
1877
|
-
}
|
|
1878
|
-
|
|
1879
1839
|
// src/core/LSP.ts
|
|
1880
1840
|
var RefactorNotApplicableError = class {
|
|
1881
1841
|
_tag = "@effect/language-service/RefactorNotApplicableError";
|
|
@@ -1982,10 +1942,10 @@ var createDiagnosticExecutor = fn("LSP.createCommentDirectivesProcessor")(
|
|
|
1982
1942
|
const sectionOverrides = {};
|
|
1983
1943
|
const skippedRules = [];
|
|
1984
1944
|
const regex = /@effect-diagnostics(-next-line)?((?:\s[a-zA-Z0-9/]+:(?:off|warning|error|message|suggestion|skip-file))+)?/gm;
|
|
1985
|
-
let
|
|
1986
|
-
while ((
|
|
1987
|
-
const nextLineCaptureGroup =
|
|
1988
|
-
const rulesCaptureGroup =
|
|
1945
|
+
let match3;
|
|
1946
|
+
while ((match3 = regex.exec(sourceFile.text)) !== null) {
|
|
1947
|
+
const nextLineCaptureGroup = match3[1];
|
|
1948
|
+
const rulesCaptureGroup = match3[2];
|
|
1989
1949
|
if (rulesCaptureGroup) {
|
|
1990
1950
|
const trimmedRuleString = rulesCaptureGroup.trim();
|
|
1991
1951
|
if (trimmedRuleString) {
|
|
@@ -1997,7 +1957,7 @@ var createDiagnosticExecutor = fn("LSP.createCommentDirectivesProcessor")(
|
|
|
1997
1957
|
if (ruleLevel === "skip-file") skippedRules.push(ruleName);
|
|
1998
1958
|
const isOverrideNextLine = nextLineCaptureGroup && nextLineCaptureGroup.trim().toLowerCase() === "-next-line";
|
|
1999
1959
|
if (isOverrideNextLine) {
|
|
2000
|
-
const foundNode = tsUtils.findNodeWithLeadingCommentAtPosition(sourceFile,
|
|
1960
|
+
const foundNode = tsUtils.findNodeWithLeadingCommentAtPosition(sourceFile, match3.index);
|
|
2001
1961
|
if (foundNode) {
|
|
2002
1962
|
lineOverrides[ruleName] = lineOverrides[ruleName] || [];
|
|
2003
1963
|
lineOverrides[ruleName].unshift({
|
|
@@ -2010,7 +1970,7 @@ var createDiagnosticExecutor = fn("LSP.createCommentDirectivesProcessor")(
|
|
|
2010
1970
|
} else {
|
|
2011
1971
|
sectionOverrides[ruleName] = sectionOverrides[ruleName] || [];
|
|
2012
1972
|
sectionOverrides[ruleName].unshift({
|
|
2013
|
-
pos:
|
|
1973
|
+
pos: match3.index,
|
|
2014
1974
|
level: ruleLevel
|
|
2015
1975
|
});
|
|
2016
1976
|
}
|
|
@@ -2153,9 +2113,9 @@ var getCodegensForSourceFile = fn("LSP.getApplicableCodegens")(function* (codege
|
|
|
2153
2113
|
const tsUtils = yield* service(TypeScriptUtils);
|
|
2154
2114
|
const result = [];
|
|
2155
2115
|
const regex = /@effect-codegens((?:\s[a-zA-Z0-9]+(?::(?:[a-zA-Z0-9]+))?)+)+/gmid;
|
|
2156
|
-
let
|
|
2157
|
-
while ((
|
|
2158
|
-
const pos =
|
|
2116
|
+
let match3;
|
|
2117
|
+
while ((match3 = regex.exec(sourceFile.text)) !== null) {
|
|
2118
|
+
const pos = match3.indices?.[0]?.[0];
|
|
2159
2119
|
if (!pos) continue;
|
|
2160
2120
|
const commentRange = tsUtils.getCommentAtPosition(sourceFile, pos);
|
|
2161
2121
|
if (!commentRange) continue;
|
|
@@ -2207,6 +2167,72 @@ var getEffectLspPatchSourceFileMetadata = (sourceFile) => {
|
|
|
2207
2167
|
return sourceFile["@effect-lsp-patch/metadata"];
|
|
2208
2168
|
};
|
|
2209
2169
|
|
|
2170
|
+
// src/core/KeyBuilder.ts
|
|
2171
|
+
var makeKeyBuilder = fn("KeyBuilder")(
|
|
2172
|
+
function* (sourceFile) {
|
|
2173
|
+
const ts = yield* service(TypeScriptApi);
|
|
2174
|
+
const tsUtils = yield* service(TypeScriptUtils);
|
|
2175
|
+
const program = yield* service(TypeScriptProgram);
|
|
2176
|
+
const options = yield* service(LanguageServicePluginOptions);
|
|
2177
|
+
const packageInfo = tsUtils.resolveModuleWithPackageInfoFromSourceFile(program, sourceFile);
|
|
2178
|
+
function createString2(classNameText, kind) {
|
|
2179
|
+
if (!packageInfo) return;
|
|
2180
|
+
for (const keyPattern of options.keyPatterns) {
|
|
2181
|
+
if (keyPattern.target !== kind) continue;
|
|
2182
|
+
const lastIndex = sourceFile.fileName.lastIndexOf("/");
|
|
2183
|
+
let onlyFileName = lastIndex === -1 ? "" : sourceFile.fileName.slice(lastIndex + 1);
|
|
2184
|
+
const lastExtensionIndex = onlyFileName.lastIndexOf(".");
|
|
2185
|
+
if (lastExtensionIndex !== -1) onlyFileName = onlyFileName.slice(0, lastExtensionIndex);
|
|
2186
|
+
if (onlyFileName.toLowerCase().endsWith("/index")) onlyFileName = onlyFileName.slice(0, -6);
|
|
2187
|
+
if (onlyFileName.startsWith("/")) onlyFileName = onlyFileName.slice(1);
|
|
2188
|
+
let subDirectory = getDirectoryPath(ts, sourceFile.fileName);
|
|
2189
|
+
if (!subDirectory.startsWith(packageInfo.packageDirectory)) continue;
|
|
2190
|
+
subDirectory = subDirectory.slice(packageInfo.packageDirectory.length);
|
|
2191
|
+
if (!subDirectory.endsWith("/")) subDirectory = subDirectory + "/";
|
|
2192
|
+
if (subDirectory.startsWith("/")) subDirectory = subDirectory.slice(1);
|
|
2193
|
+
for (const prefix of keyPattern.skipLeadingPath) {
|
|
2194
|
+
if (subDirectory.startsWith(prefix)) {
|
|
2195
|
+
subDirectory = subDirectory.slice(prefix.length);
|
|
2196
|
+
break;
|
|
2197
|
+
}
|
|
2198
|
+
}
|
|
2199
|
+
let parts = [packageInfo.name, subDirectory, onlyFileName].concat(
|
|
2200
|
+
onlyFileName.toLowerCase() === classNameText.toLowerCase() ? [] : [classNameText]
|
|
2201
|
+
);
|
|
2202
|
+
if (keyPattern.pattern === "package-identifier") {
|
|
2203
|
+
parts = [packageInfo.name, onlyFileName].concat(
|
|
2204
|
+
onlyFileName.toLowerCase() === classNameText.toLowerCase() ? [] : [classNameText]
|
|
2205
|
+
);
|
|
2206
|
+
}
|
|
2207
|
+
parts = parts.map((part) => part.startsWith("/") ? part.slice(1) : part).map(
|
|
2208
|
+
(part) => part.endsWith("/") ? part.slice(0, -1) : part
|
|
2209
|
+
);
|
|
2210
|
+
const fullKey = parts.filter((_) => String(_).trim().length > 0).join("/");
|
|
2211
|
+
return keyPattern.pattern === "default-hashed" ? cyrb53(fullKey) : fullKey;
|
|
2212
|
+
}
|
|
2213
|
+
}
|
|
2214
|
+
return {
|
|
2215
|
+
createString: createString2
|
|
2216
|
+
};
|
|
2217
|
+
}
|
|
2218
|
+
);
|
|
2219
|
+
var keyBuilderCache = /* @__PURE__ */ new Map();
|
|
2220
|
+
var getOrMakeKeyBuilder = fn("getOrMakeKeyBuilder")(function* (sourceFile) {
|
|
2221
|
+
while (keyBuilderCache.size > 5) {
|
|
2222
|
+
const oldest = keyBuilderCache.keys().next().value;
|
|
2223
|
+
if (oldest) keyBuilderCache.delete(oldest);
|
|
2224
|
+
}
|
|
2225
|
+
const keyBuilder = keyBuilderCache.get(sourceFile.fileName) || (yield* makeKeyBuilder(sourceFile));
|
|
2226
|
+
keyBuilderCache.set(sourceFile.fileName, keyBuilder);
|
|
2227
|
+
return keyBuilder;
|
|
2228
|
+
});
|
|
2229
|
+
function createString(sourceFile, identifier, kind) {
|
|
2230
|
+
return map5(
|
|
2231
|
+
getOrMakeKeyBuilder(sourceFile),
|
|
2232
|
+
(identifierBuilder) => identifierBuilder.createString(identifier, kind)
|
|
2233
|
+
);
|
|
2234
|
+
}
|
|
2235
|
+
|
|
2210
2236
|
// src/completions/contextSelfInClasses.ts
|
|
2211
2237
|
var contextSelfInClasses = createCompletion({
|
|
2212
2238
|
name: "contextSelfInClasses",
|
|
@@ -2495,17 +2521,21 @@ function makeTypeCheckerUtils(ts, typeChecker, tsUtils) {
|
|
|
2495
2521
|
return result;
|
|
2496
2522
|
};
|
|
2497
2523
|
function typeToSimplifiedTypeNode(type, enclosingNode, flags) {
|
|
2524
|
+
return typeToSimplifiedTypeNodeWorker(type, enclosingNode, flags, 0);
|
|
2525
|
+
}
|
|
2526
|
+
function typeToSimplifiedTypeNodeWorker(type, enclosingNode, flags, depth) {
|
|
2498
2527
|
const fallbackStandard = () => {
|
|
2499
2528
|
const typeNode = typeChecker.typeToTypeNode(type, enclosingNode, flags);
|
|
2500
2529
|
if (!typeNode) return void 0;
|
|
2501
2530
|
return tsUtils.simplifyTypeNode(typeNode);
|
|
2502
2531
|
};
|
|
2532
|
+
if (depth > 20) return fallbackStandard();
|
|
2503
2533
|
const members = unrollUnionMembers(type);
|
|
2504
|
-
if (members.length > 1) {
|
|
2534
|
+
if (members.length > 1 && !(type.flags & ts.TypeFlags.Boolean)) {
|
|
2505
2535
|
const typeNodes = [];
|
|
2506
2536
|
members.sort(deterministicTypeOrder);
|
|
2507
2537
|
for (const member of members) {
|
|
2508
|
-
const memberNode =
|
|
2538
|
+
const memberNode = typeToSimplifiedTypeNodeWorker(member, enclosingNode, flags, depth + 1);
|
|
2509
2539
|
if (!memberNode) return fallbackStandard();
|
|
2510
2540
|
typeNodes.push(memberNode);
|
|
2511
2541
|
}
|
|
@@ -2515,7 +2545,7 @@ function makeTypeCheckerUtils(ts, typeChecker, tsUtils) {
|
|
|
2515
2545
|
const intersectionType = type;
|
|
2516
2546
|
const typeNodes = [];
|
|
2517
2547
|
for (const member of intersectionType.types) {
|
|
2518
|
-
const memberNode =
|
|
2548
|
+
const memberNode = typeToSimplifiedTypeNodeWorker(member, enclosingNode, flags, depth + 1);
|
|
2519
2549
|
if (!memberNode) return fallbackStandard();
|
|
2520
2550
|
typeNodes.push(memberNode);
|
|
2521
2551
|
}
|
|
@@ -2551,7 +2581,7 @@ function makeTypeCheckerUtils(ts, typeChecker, tsUtils) {
|
|
|
2551
2581
|
if (signatures.length !== 1) return standard2;
|
|
2552
2582
|
const returnType = typeChecker.getReturnTypeOfSignature(signatures[0]);
|
|
2553
2583
|
if (!returnType) return standard2;
|
|
2554
|
-
const returnTypeNode =
|
|
2584
|
+
const returnTypeNode = typeToSimplifiedTypeNodeWorker(returnType, enclosingNode, flags, depth + 1);
|
|
2555
2585
|
if (!returnTypeNode) return standard2;
|
|
2556
2586
|
return tsUtils.simplifyTypeNode(ts.factory.updateFunctionTypeNode(
|
|
2557
2587
|
standard2,
|
|
@@ -3989,9 +4019,9 @@ var effectCodegensComment = createCompletion({
|
|
|
3989
4019
|
apply: fn("effectCodegensComment")(function* (sourceFile, position) {
|
|
3990
4020
|
const ts = yield* service(TypeScriptApi);
|
|
3991
4021
|
const sourceText = sourceFile.text;
|
|
3992
|
-
const
|
|
3993
|
-
if (
|
|
3994
|
-
const lastIndex =
|
|
4022
|
+
const match3 = /(\/\/|\/\*(?:\*?))\s*(@)\s*$/id.exec(sourceText.substring(0, position));
|
|
4023
|
+
if (match3 && match3.indices) {
|
|
4024
|
+
const lastIndex = match3.indices[2][0];
|
|
3995
4025
|
const replacementSpan = {
|
|
3996
4026
|
start: lastIndex,
|
|
3997
4027
|
length: Math.max(0, position - lastIndex)
|
|
@@ -4043,40 +4073,2270 @@ var effectDataClasses = createCompletion({
|
|
|
4043
4073
|
})
|
|
4044
4074
|
});
|
|
4045
4075
|
|
|
4046
|
-
// node_modules/.pnpm
|
|
4047
|
-
var
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
const length = bytes.length;
|
|
4052
|
-
let result = "";
|
|
4053
|
-
let i;
|
|
4054
|
-
for (i = 2; i < length; i += 3) {
|
|
4055
|
-
result += base64abc[bytes[i - 2] >> 2];
|
|
4056
|
-
result += base64abc[(bytes[i - 2] & 3) << 4 | bytes[i - 1] >> 4];
|
|
4057
|
-
result += base64abc[(bytes[i - 1] & 15) << 2 | bytes[i] >> 6];
|
|
4058
|
-
result += base64abc[bytes[i] & 63];
|
|
4076
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/Chunk.js
|
|
4077
|
+
var TypeId3 = /* @__PURE__ */ Symbol.for("effect/Chunk");
|
|
4078
|
+
function copy(src, srcPos, dest, destPos, len) {
|
|
4079
|
+
for (let i = srcPos; i < Math.min(src.length, srcPos + len); i++) {
|
|
4080
|
+
dest[destPos + i - srcPos] = src[i];
|
|
4059
4081
|
}
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4082
|
+
return dest;
|
|
4083
|
+
}
|
|
4084
|
+
var emptyArray = [];
|
|
4085
|
+
var getEquivalence = (isEquivalent) => make((self, that) => self.length === that.length && toReadonlyArray(self).every((value, i) => isEquivalent(value, unsafeGet2(that, i))));
|
|
4086
|
+
var _equivalence2 = /* @__PURE__ */ getEquivalence(equals);
|
|
4087
|
+
var ChunkProto = {
|
|
4088
|
+
[TypeId3]: {
|
|
4089
|
+
_A: (_) => _
|
|
4090
|
+
},
|
|
4091
|
+
toString() {
|
|
4092
|
+
return format(this.toJSON());
|
|
4093
|
+
},
|
|
4094
|
+
toJSON() {
|
|
4095
|
+
return {
|
|
4096
|
+
_id: "Chunk",
|
|
4097
|
+
values: toReadonlyArray(this).map(toJSON)
|
|
4098
|
+
};
|
|
4099
|
+
},
|
|
4100
|
+
[NodeInspectSymbol]() {
|
|
4101
|
+
return this.toJSON();
|
|
4102
|
+
},
|
|
4103
|
+
[symbol2](that) {
|
|
4104
|
+
return isChunk(that) && _equivalence2(this, that);
|
|
4105
|
+
},
|
|
4106
|
+
[symbol]() {
|
|
4107
|
+
return cached(this, array2(toReadonlyArray(this)));
|
|
4108
|
+
},
|
|
4109
|
+
[Symbol.iterator]() {
|
|
4110
|
+
switch (this.backing._tag) {
|
|
4111
|
+
case "IArray": {
|
|
4112
|
+
return this.backing.array[Symbol.iterator]();
|
|
4113
|
+
}
|
|
4114
|
+
case "IEmpty": {
|
|
4115
|
+
return emptyArray[Symbol.iterator]();
|
|
4116
|
+
}
|
|
4117
|
+
default: {
|
|
4118
|
+
return toReadonlyArray(this)[Symbol.iterator]();
|
|
4119
|
+
}
|
|
4120
|
+
}
|
|
4121
|
+
},
|
|
4122
|
+
pipe() {
|
|
4123
|
+
return pipeArguments(this, arguments);
|
|
4064
4124
|
}
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4125
|
+
};
|
|
4126
|
+
var makeChunk = (backing) => {
|
|
4127
|
+
const chunk = Object.create(ChunkProto);
|
|
4128
|
+
chunk.backing = backing;
|
|
4129
|
+
switch (backing._tag) {
|
|
4130
|
+
case "IEmpty": {
|
|
4131
|
+
chunk.length = 0;
|
|
4132
|
+
chunk.depth = 0;
|
|
4133
|
+
chunk.left = chunk;
|
|
4134
|
+
chunk.right = chunk;
|
|
4135
|
+
break;
|
|
4136
|
+
}
|
|
4137
|
+
case "IConcat": {
|
|
4138
|
+
chunk.length = backing.left.length + backing.right.length;
|
|
4139
|
+
chunk.depth = 1 + Math.max(backing.left.depth, backing.right.depth);
|
|
4140
|
+
chunk.left = backing.left;
|
|
4141
|
+
chunk.right = backing.right;
|
|
4142
|
+
break;
|
|
4143
|
+
}
|
|
4144
|
+
case "IArray": {
|
|
4145
|
+
chunk.length = backing.array.length;
|
|
4146
|
+
chunk.depth = 0;
|
|
4147
|
+
chunk.left = _empty;
|
|
4148
|
+
chunk.right = _empty;
|
|
4149
|
+
break;
|
|
4150
|
+
}
|
|
4151
|
+
case "ISingleton": {
|
|
4152
|
+
chunk.length = 1;
|
|
4153
|
+
chunk.depth = 0;
|
|
4154
|
+
chunk.left = _empty;
|
|
4155
|
+
chunk.right = _empty;
|
|
4156
|
+
break;
|
|
4157
|
+
}
|
|
4158
|
+
case "ISlice": {
|
|
4159
|
+
chunk.length = backing.length;
|
|
4160
|
+
chunk.depth = backing.chunk.depth + 1;
|
|
4161
|
+
chunk.left = _empty;
|
|
4162
|
+
chunk.right = _empty;
|
|
4163
|
+
break;
|
|
4164
|
+
}
|
|
4165
|
+
}
|
|
4166
|
+
return chunk;
|
|
4167
|
+
};
|
|
4168
|
+
var isChunk = (u) => hasProperty(u, TypeId3);
|
|
4169
|
+
var _empty = /* @__PURE__ */ makeChunk({
|
|
4170
|
+
_tag: "IEmpty"
|
|
4171
|
+
});
|
|
4172
|
+
var empty2 = () => _empty;
|
|
4173
|
+
var make4 = (...as) => unsafeFromNonEmptyArray(as);
|
|
4174
|
+
var of = (a) => makeChunk({
|
|
4175
|
+
_tag: "ISingleton",
|
|
4176
|
+
a
|
|
4177
|
+
});
|
|
4178
|
+
var fromIterable2 = (self) => isChunk(self) ? self : unsafeFromArray(fromIterable(self));
|
|
4179
|
+
var copyToArray = (self, array3, initial) => {
|
|
4180
|
+
switch (self.backing._tag) {
|
|
4181
|
+
case "IArray": {
|
|
4182
|
+
copy(self.backing.array, 0, array3, initial, self.length);
|
|
4183
|
+
break;
|
|
4184
|
+
}
|
|
4185
|
+
case "IConcat": {
|
|
4186
|
+
copyToArray(self.left, array3, initial);
|
|
4187
|
+
copyToArray(self.right, array3, initial + self.left.length);
|
|
4188
|
+
break;
|
|
4189
|
+
}
|
|
4190
|
+
case "ISingleton": {
|
|
4191
|
+
array3[initial] = self.backing.a;
|
|
4192
|
+
break;
|
|
4193
|
+
}
|
|
4194
|
+
case "ISlice": {
|
|
4195
|
+
let i = 0;
|
|
4196
|
+
let j = initial;
|
|
4197
|
+
while (i < self.length) {
|
|
4198
|
+
array3[j] = unsafeGet2(self, i);
|
|
4199
|
+
i += 1;
|
|
4200
|
+
j += 1;
|
|
4201
|
+
}
|
|
4202
|
+
break;
|
|
4203
|
+
}
|
|
4204
|
+
}
|
|
4205
|
+
};
|
|
4206
|
+
var toReadonlyArray_ = (self) => {
|
|
4207
|
+
switch (self.backing._tag) {
|
|
4208
|
+
case "IEmpty": {
|
|
4209
|
+
return emptyArray;
|
|
4210
|
+
}
|
|
4211
|
+
case "IArray": {
|
|
4212
|
+
return self.backing.array;
|
|
4213
|
+
}
|
|
4214
|
+
default: {
|
|
4215
|
+
const arr = new Array(self.length);
|
|
4216
|
+
copyToArray(self, arr, 0);
|
|
4217
|
+
self.backing = {
|
|
4218
|
+
_tag: "IArray",
|
|
4219
|
+
array: arr
|
|
4220
|
+
};
|
|
4221
|
+
self.left = _empty;
|
|
4222
|
+
self.right = _empty;
|
|
4223
|
+
self.depth = 0;
|
|
4224
|
+
return arr;
|
|
4225
|
+
}
|
|
4226
|
+
}
|
|
4227
|
+
};
|
|
4228
|
+
var toReadonlyArray = toReadonlyArray_;
|
|
4229
|
+
var reverseChunk = (self) => {
|
|
4230
|
+
switch (self.backing._tag) {
|
|
4231
|
+
case "IEmpty":
|
|
4232
|
+
case "ISingleton":
|
|
4233
|
+
return self;
|
|
4234
|
+
case "IArray": {
|
|
4235
|
+
return makeChunk({
|
|
4236
|
+
_tag: "IArray",
|
|
4237
|
+
array: reverse(self.backing.array)
|
|
4238
|
+
});
|
|
4239
|
+
}
|
|
4240
|
+
case "IConcat": {
|
|
4241
|
+
return makeChunk({
|
|
4242
|
+
_tag: "IConcat",
|
|
4243
|
+
left: reverse2(self.backing.right),
|
|
4244
|
+
right: reverse2(self.backing.left)
|
|
4245
|
+
});
|
|
4246
|
+
}
|
|
4247
|
+
case "ISlice":
|
|
4248
|
+
return unsafeFromArray(reverse(toReadonlyArray(self)));
|
|
4249
|
+
}
|
|
4250
|
+
};
|
|
4251
|
+
var reverse2 = reverseChunk;
|
|
4252
|
+
var unsafeFromArray = (self) => self.length === 0 ? empty2() : self.length === 1 ? of(self[0]) : makeChunk({
|
|
4253
|
+
_tag: "IArray",
|
|
4254
|
+
array: self
|
|
4255
|
+
});
|
|
4256
|
+
var unsafeFromNonEmptyArray = (self) => unsafeFromArray(self);
|
|
4257
|
+
var unsafeGet2 = /* @__PURE__ */ dual(2, (self, index) => {
|
|
4258
|
+
switch (self.backing._tag) {
|
|
4259
|
+
case "IEmpty": {
|
|
4260
|
+
throw new Error(`Index out of bounds`);
|
|
4261
|
+
}
|
|
4262
|
+
case "ISingleton": {
|
|
4263
|
+
if (index !== 0) {
|
|
4264
|
+
throw new Error(`Index out of bounds`);
|
|
4265
|
+
}
|
|
4266
|
+
return self.backing.a;
|
|
4267
|
+
}
|
|
4268
|
+
case "IArray": {
|
|
4269
|
+
if (index >= self.length || index < 0) {
|
|
4270
|
+
throw new Error(`Index out of bounds`);
|
|
4271
|
+
}
|
|
4272
|
+
return self.backing.array[index];
|
|
4273
|
+
}
|
|
4274
|
+
case "IConcat": {
|
|
4275
|
+
return index < self.left.length ? unsafeGet2(self.left, index) : unsafeGet2(self.right, index - self.left.length);
|
|
4276
|
+
}
|
|
4277
|
+
case "ISlice": {
|
|
4278
|
+
return unsafeGet2(self.backing.chunk, index + self.backing.offset);
|
|
4279
|
+
}
|
|
4280
|
+
}
|
|
4281
|
+
});
|
|
4282
|
+
var prepend = /* @__PURE__ */ dual(2, (self, elem) => appendAll2(of(elem), self));
|
|
4283
|
+
var appendAll2 = /* @__PURE__ */ dual(2, (self, that) => {
|
|
4284
|
+
if (self.backing._tag === "IEmpty") {
|
|
4285
|
+
return that;
|
|
4286
|
+
}
|
|
4287
|
+
if (that.backing._tag === "IEmpty") {
|
|
4288
|
+
return self;
|
|
4289
|
+
}
|
|
4290
|
+
const diff = that.depth - self.depth;
|
|
4291
|
+
if (Math.abs(diff) <= 1) {
|
|
4292
|
+
return makeChunk({
|
|
4293
|
+
_tag: "IConcat",
|
|
4294
|
+
left: self,
|
|
4295
|
+
right: that
|
|
4296
|
+
});
|
|
4297
|
+
} else if (diff < -1) {
|
|
4298
|
+
if (self.left.depth >= self.right.depth) {
|
|
4299
|
+
const nr = appendAll2(self.right, that);
|
|
4300
|
+
return makeChunk({
|
|
4301
|
+
_tag: "IConcat",
|
|
4302
|
+
left: self.left,
|
|
4303
|
+
right: nr
|
|
4304
|
+
});
|
|
4305
|
+
} else {
|
|
4306
|
+
const nrr = appendAll2(self.right.right, that);
|
|
4307
|
+
if (nrr.depth === self.depth - 3) {
|
|
4308
|
+
const nr = makeChunk({
|
|
4309
|
+
_tag: "IConcat",
|
|
4310
|
+
left: self.right.left,
|
|
4311
|
+
right: nrr
|
|
4312
|
+
});
|
|
4313
|
+
return makeChunk({
|
|
4314
|
+
_tag: "IConcat",
|
|
4315
|
+
left: self.left,
|
|
4316
|
+
right: nr
|
|
4317
|
+
});
|
|
4318
|
+
} else {
|
|
4319
|
+
const nl = makeChunk({
|
|
4320
|
+
_tag: "IConcat",
|
|
4321
|
+
left: self.left,
|
|
4322
|
+
right: self.right.left
|
|
4323
|
+
});
|
|
4324
|
+
return makeChunk({
|
|
4325
|
+
_tag: "IConcat",
|
|
4326
|
+
left: nl,
|
|
4327
|
+
right: nrr
|
|
4328
|
+
});
|
|
4329
|
+
}
|
|
4330
|
+
}
|
|
4331
|
+
} else {
|
|
4332
|
+
if (that.right.depth >= that.left.depth) {
|
|
4333
|
+
const nl = appendAll2(self, that.left);
|
|
4334
|
+
return makeChunk({
|
|
4335
|
+
_tag: "IConcat",
|
|
4336
|
+
left: nl,
|
|
4337
|
+
right: that.right
|
|
4338
|
+
});
|
|
4339
|
+
} else {
|
|
4340
|
+
const nll = appendAll2(self, that.left.left);
|
|
4341
|
+
if (nll.depth === that.depth - 3) {
|
|
4342
|
+
const nl = makeChunk({
|
|
4343
|
+
_tag: "IConcat",
|
|
4344
|
+
left: nll,
|
|
4345
|
+
right: that.left.right
|
|
4346
|
+
});
|
|
4347
|
+
return makeChunk({
|
|
4348
|
+
_tag: "IConcat",
|
|
4349
|
+
left: nl,
|
|
4350
|
+
right: that.right
|
|
4351
|
+
});
|
|
4352
|
+
} else {
|
|
4353
|
+
const nr = makeChunk({
|
|
4354
|
+
_tag: "IConcat",
|
|
4355
|
+
left: that.left.right,
|
|
4356
|
+
right: that.right
|
|
4357
|
+
});
|
|
4358
|
+
return makeChunk({
|
|
4359
|
+
_tag: "IConcat",
|
|
4360
|
+
left: nll,
|
|
4361
|
+
right: nr
|
|
4362
|
+
});
|
|
4363
|
+
}
|
|
4364
|
+
}
|
|
4365
|
+
}
|
|
4366
|
+
});
|
|
4367
|
+
var isEmpty = (self) => self.length === 0;
|
|
4368
|
+
var isNonEmpty = (self) => self.length > 0;
|
|
4369
|
+
var unsafeHead = (self) => unsafeGet2(self, 0);
|
|
4370
|
+
var headNonEmpty2 = unsafeHead;
|
|
4371
|
+
|
|
4372
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/hashMap/config.js
|
|
4373
|
+
var SIZE = 5;
|
|
4374
|
+
var BUCKET_SIZE = /* @__PURE__ */ Math.pow(2, SIZE);
|
|
4375
|
+
var MASK = BUCKET_SIZE - 1;
|
|
4376
|
+
var MAX_INDEX_NODE = BUCKET_SIZE / 2;
|
|
4377
|
+
var MIN_ARRAY_NODE = BUCKET_SIZE / 4;
|
|
4378
|
+
|
|
4379
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/hashMap/bitwise.js
|
|
4380
|
+
function popcount(x) {
|
|
4381
|
+
x -= x >> 1 & 1431655765;
|
|
4382
|
+
x = (x & 858993459) + (x >> 2 & 858993459);
|
|
4383
|
+
x = x + (x >> 4) & 252645135;
|
|
4384
|
+
x += x >> 8;
|
|
4385
|
+
x += x >> 16;
|
|
4386
|
+
return x & 127;
|
|
4387
|
+
}
|
|
4388
|
+
function hashFragment(shift, h) {
|
|
4389
|
+
return h >>> shift & MASK;
|
|
4390
|
+
}
|
|
4391
|
+
function toBitmap(x) {
|
|
4392
|
+
return 1 << x;
|
|
4393
|
+
}
|
|
4394
|
+
function fromBitmap(bitmap, bit) {
|
|
4395
|
+
return popcount(bitmap & bit - 1);
|
|
4396
|
+
}
|
|
4397
|
+
|
|
4398
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/stack.js
|
|
4399
|
+
var make5 = (value, previous) => ({
|
|
4400
|
+
value,
|
|
4401
|
+
previous
|
|
4402
|
+
});
|
|
4403
|
+
|
|
4404
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/hashMap/array.js
|
|
4405
|
+
function arrayUpdate(mutate3, at, v, arr) {
|
|
4406
|
+
let out = arr;
|
|
4407
|
+
if (!mutate3) {
|
|
4408
|
+
const len = arr.length;
|
|
4409
|
+
out = new Array(len);
|
|
4410
|
+
for (let i = 0; i < len; ++i) out[i] = arr[i];
|
|
4411
|
+
}
|
|
4412
|
+
out[at] = v;
|
|
4413
|
+
return out;
|
|
4414
|
+
}
|
|
4415
|
+
function arraySpliceOut(mutate3, at, arr) {
|
|
4416
|
+
const newLen = arr.length - 1;
|
|
4417
|
+
let i = 0;
|
|
4418
|
+
let g = 0;
|
|
4419
|
+
let out = arr;
|
|
4420
|
+
if (mutate3) {
|
|
4421
|
+
i = g = at;
|
|
4422
|
+
} else {
|
|
4423
|
+
out = new Array(newLen);
|
|
4424
|
+
while (i < at) out[g++] = arr[i++];
|
|
4425
|
+
}
|
|
4426
|
+
++i;
|
|
4427
|
+
while (i <= newLen) out[g++] = arr[i++];
|
|
4428
|
+
if (mutate3) {
|
|
4429
|
+
out.length = newLen;
|
|
4430
|
+
}
|
|
4431
|
+
return out;
|
|
4432
|
+
}
|
|
4433
|
+
function arraySpliceIn(mutate3, at, v, arr) {
|
|
4434
|
+
const len = arr.length;
|
|
4435
|
+
if (mutate3) {
|
|
4436
|
+
let i2 = len;
|
|
4437
|
+
while (i2 >= at) arr[i2--] = arr[i2];
|
|
4438
|
+
arr[at] = v;
|
|
4439
|
+
return arr;
|
|
4440
|
+
}
|
|
4441
|
+
let i = 0, g = 0;
|
|
4442
|
+
const out = new Array(len + 1);
|
|
4443
|
+
while (i < at) out[g++] = arr[i++];
|
|
4444
|
+
out[at] = v;
|
|
4445
|
+
while (i < len) out[++g] = arr[i++];
|
|
4446
|
+
return out;
|
|
4447
|
+
}
|
|
4448
|
+
|
|
4449
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/hashMap/node.js
|
|
4450
|
+
var EmptyNode = class _EmptyNode {
|
|
4451
|
+
_tag = "EmptyNode";
|
|
4452
|
+
modify(edit, _shift, f, hash2, key, size4) {
|
|
4453
|
+
const v = f(none2());
|
|
4454
|
+
if (isNone2(v)) return new _EmptyNode();
|
|
4455
|
+
++size4.value;
|
|
4456
|
+
return new LeafNode(edit, hash2, key, v);
|
|
4457
|
+
}
|
|
4458
|
+
};
|
|
4459
|
+
function isEmptyNode(a) {
|
|
4460
|
+
return isTagged(a, "EmptyNode");
|
|
4461
|
+
}
|
|
4462
|
+
function isLeafNode(node) {
|
|
4463
|
+
return isEmptyNode(node) || node._tag === "LeafNode" || node._tag === "CollisionNode";
|
|
4464
|
+
}
|
|
4465
|
+
function canEditNode(node, edit) {
|
|
4466
|
+
return isEmptyNode(node) ? false : edit === node.edit;
|
|
4467
|
+
}
|
|
4468
|
+
var LeafNode = class _LeafNode {
|
|
4469
|
+
edit;
|
|
4470
|
+
hash;
|
|
4471
|
+
key;
|
|
4472
|
+
value;
|
|
4473
|
+
_tag = "LeafNode";
|
|
4474
|
+
constructor(edit, hash2, key, value) {
|
|
4475
|
+
this.edit = edit;
|
|
4476
|
+
this.hash = hash2;
|
|
4477
|
+
this.key = key;
|
|
4478
|
+
this.value = value;
|
|
4479
|
+
}
|
|
4480
|
+
modify(edit, shift, f, hash2, key, size4) {
|
|
4481
|
+
if (equals(key, this.key)) {
|
|
4482
|
+
const v2 = f(this.value);
|
|
4483
|
+
if (v2 === this.value) return this;
|
|
4484
|
+
else if (isNone2(v2)) {
|
|
4485
|
+
--size4.value;
|
|
4486
|
+
return new EmptyNode();
|
|
4487
|
+
}
|
|
4488
|
+
if (canEditNode(this, edit)) {
|
|
4489
|
+
this.value = v2;
|
|
4490
|
+
return this;
|
|
4491
|
+
}
|
|
4492
|
+
return new _LeafNode(edit, hash2, key, v2);
|
|
4493
|
+
}
|
|
4494
|
+
const v = f(none2());
|
|
4495
|
+
if (isNone2(v)) return this;
|
|
4496
|
+
++size4.value;
|
|
4497
|
+
return mergeLeaves(edit, shift, this.hash, this, hash2, new _LeafNode(edit, hash2, key, v));
|
|
4498
|
+
}
|
|
4499
|
+
};
|
|
4500
|
+
var CollisionNode = class _CollisionNode {
|
|
4501
|
+
edit;
|
|
4502
|
+
hash;
|
|
4503
|
+
children;
|
|
4504
|
+
_tag = "CollisionNode";
|
|
4505
|
+
constructor(edit, hash2, children) {
|
|
4506
|
+
this.edit = edit;
|
|
4507
|
+
this.hash = hash2;
|
|
4508
|
+
this.children = children;
|
|
4509
|
+
}
|
|
4510
|
+
modify(edit, shift, f, hash2, key, size4) {
|
|
4511
|
+
if (hash2 === this.hash) {
|
|
4512
|
+
const canEdit = canEditNode(this, edit);
|
|
4513
|
+
const list = this.updateCollisionList(canEdit, edit, this.hash, this.children, f, key, size4);
|
|
4514
|
+
if (list === this.children) return this;
|
|
4515
|
+
return list.length > 1 ? new _CollisionNode(edit, this.hash, list) : list[0];
|
|
4516
|
+
}
|
|
4517
|
+
const v = f(none2());
|
|
4518
|
+
if (isNone2(v)) return this;
|
|
4519
|
+
++size4.value;
|
|
4520
|
+
return mergeLeaves(edit, shift, this.hash, this, hash2, new LeafNode(edit, hash2, key, v));
|
|
4521
|
+
}
|
|
4522
|
+
updateCollisionList(mutate3, edit, hash2, list, f, key, size4) {
|
|
4523
|
+
const len = list.length;
|
|
4524
|
+
for (let i = 0; i < len; ++i) {
|
|
4525
|
+
const child = list[i];
|
|
4526
|
+
if ("key" in child && equals(key, child.key)) {
|
|
4527
|
+
const value = child.value;
|
|
4528
|
+
const newValue2 = f(value);
|
|
4529
|
+
if (newValue2 === value) return list;
|
|
4530
|
+
if (isNone2(newValue2)) {
|
|
4531
|
+
--size4.value;
|
|
4532
|
+
return arraySpliceOut(mutate3, i, list);
|
|
4533
|
+
}
|
|
4534
|
+
return arrayUpdate(mutate3, i, new LeafNode(edit, hash2, key, newValue2), list);
|
|
4535
|
+
}
|
|
4536
|
+
}
|
|
4537
|
+
const newValue = f(none2());
|
|
4538
|
+
if (isNone2(newValue)) return list;
|
|
4539
|
+
++size4.value;
|
|
4540
|
+
return arrayUpdate(mutate3, len, new LeafNode(edit, hash2, key, newValue), list);
|
|
4541
|
+
}
|
|
4542
|
+
};
|
|
4543
|
+
var IndexedNode = class _IndexedNode {
|
|
4544
|
+
edit;
|
|
4545
|
+
mask;
|
|
4546
|
+
children;
|
|
4547
|
+
_tag = "IndexedNode";
|
|
4548
|
+
constructor(edit, mask, children) {
|
|
4549
|
+
this.edit = edit;
|
|
4550
|
+
this.mask = mask;
|
|
4551
|
+
this.children = children;
|
|
4552
|
+
}
|
|
4553
|
+
modify(edit, shift, f, hash2, key, size4) {
|
|
4554
|
+
const mask = this.mask;
|
|
4555
|
+
const children = this.children;
|
|
4556
|
+
const frag = hashFragment(shift, hash2);
|
|
4557
|
+
const bit = toBitmap(frag);
|
|
4558
|
+
const indx = fromBitmap(mask, bit);
|
|
4559
|
+
const exists = mask & bit;
|
|
4560
|
+
const canEdit = canEditNode(this, edit);
|
|
4561
|
+
if (!exists) {
|
|
4562
|
+
const _newChild = new EmptyNode().modify(edit, shift + SIZE, f, hash2, key, size4);
|
|
4563
|
+
if (!_newChild) return this;
|
|
4564
|
+
return children.length >= MAX_INDEX_NODE ? expand(edit, frag, _newChild, mask, children) : new _IndexedNode(edit, mask | bit, arraySpliceIn(canEdit, indx, _newChild, children));
|
|
4565
|
+
}
|
|
4566
|
+
const current = children[indx];
|
|
4567
|
+
const child = current.modify(edit, shift + SIZE, f, hash2, key, size4);
|
|
4568
|
+
if (current === child) return this;
|
|
4569
|
+
let bitmap = mask;
|
|
4570
|
+
let newChildren;
|
|
4571
|
+
if (isEmptyNode(child)) {
|
|
4572
|
+
bitmap &= ~bit;
|
|
4573
|
+
if (!bitmap) return new EmptyNode();
|
|
4574
|
+
if (children.length <= 2 && isLeafNode(children[indx ^ 1])) {
|
|
4575
|
+
return children[indx ^ 1];
|
|
4576
|
+
}
|
|
4577
|
+
newChildren = arraySpliceOut(canEdit, indx, children);
|
|
4578
|
+
} else {
|
|
4579
|
+
newChildren = arrayUpdate(canEdit, indx, child, children);
|
|
4580
|
+
}
|
|
4581
|
+
if (canEdit) {
|
|
4582
|
+
this.mask = bitmap;
|
|
4583
|
+
this.children = newChildren;
|
|
4584
|
+
return this;
|
|
4585
|
+
}
|
|
4586
|
+
return new _IndexedNode(edit, bitmap, newChildren);
|
|
4587
|
+
}
|
|
4588
|
+
};
|
|
4589
|
+
var ArrayNode = class _ArrayNode {
|
|
4590
|
+
edit;
|
|
4591
|
+
size;
|
|
4592
|
+
children;
|
|
4593
|
+
_tag = "ArrayNode";
|
|
4594
|
+
constructor(edit, size4, children) {
|
|
4595
|
+
this.edit = edit;
|
|
4596
|
+
this.size = size4;
|
|
4597
|
+
this.children = children;
|
|
4598
|
+
}
|
|
4599
|
+
modify(edit, shift, f, hash2, key, size4) {
|
|
4600
|
+
let count = this.size;
|
|
4601
|
+
const children = this.children;
|
|
4602
|
+
const frag = hashFragment(shift, hash2);
|
|
4603
|
+
const child = children[frag];
|
|
4604
|
+
const newChild = (child || new EmptyNode()).modify(edit, shift + SIZE, f, hash2, key, size4);
|
|
4605
|
+
if (child === newChild) return this;
|
|
4606
|
+
const canEdit = canEditNode(this, edit);
|
|
4607
|
+
let newChildren;
|
|
4608
|
+
if (isEmptyNode(child) && !isEmptyNode(newChild)) {
|
|
4609
|
+
++count;
|
|
4610
|
+
newChildren = arrayUpdate(canEdit, frag, newChild, children);
|
|
4611
|
+
} else if (!isEmptyNode(child) && isEmptyNode(newChild)) {
|
|
4612
|
+
--count;
|
|
4613
|
+
if (count <= MIN_ARRAY_NODE) {
|
|
4614
|
+
return pack(edit, count, frag, children);
|
|
4615
|
+
}
|
|
4616
|
+
newChildren = arrayUpdate(canEdit, frag, new EmptyNode(), children);
|
|
4617
|
+
} else {
|
|
4618
|
+
newChildren = arrayUpdate(canEdit, frag, newChild, children);
|
|
4619
|
+
}
|
|
4620
|
+
if (canEdit) {
|
|
4621
|
+
this.size = count;
|
|
4622
|
+
this.children = newChildren;
|
|
4623
|
+
return this;
|
|
4624
|
+
}
|
|
4625
|
+
return new _ArrayNode(edit, count, newChildren);
|
|
4626
|
+
}
|
|
4627
|
+
};
|
|
4628
|
+
function pack(edit, count, removed, elements) {
|
|
4629
|
+
const children = new Array(count - 1);
|
|
4630
|
+
let g = 0;
|
|
4631
|
+
let bitmap = 0;
|
|
4632
|
+
for (let i = 0, len = elements.length; i < len; ++i) {
|
|
4633
|
+
if (i !== removed) {
|
|
4634
|
+
const elem = elements[i];
|
|
4635
|
+
if (elem && !isEmptyNode(elem)) {
|
|
4636
|
+
children[g++] = elem;
|
|
4637
|
+
bitmap |= 1 << i;
|
|
4638
|
+
}
|
|
4639
|
+
}
|
|
4640
|
+
}
|
|
4641
|
+
return new IndexedNode(edit, bitmap, children);
|
|
4642
|
+
}
|
|
4643
|
+
function expand(edit, frag, child, bitmap, subNodes) {
|
|
4644
|
+
const arr = [];
|
|
4645
|
+
let bit = bitmap;
|
|
4646
|
+
let count = 0;
|
|
4647
|
+
for (let i = 0; bit; ++i) {
|
|
4648
|
+
if (bit & 1) arr[i] = subNodes[count++];
|
|
4649
|
+
bit >>>= 1;
|
|
4650
|
+
}
|
|
4651
|
+
arr[frag] = child;
|
|
4652
|
+
return new ArrayNode(edit, count + 1, arr);
|
|
4653
|
+
}
|
|
4654
|
+
function mergeLeavesInner(edit, shift, h1, n1, h2, n2) {
|
|
4655
|
+
if (h1 === h2) return new CollisionNode(edit, h1, [n2, n1]);
|
|
4656
|
+
const subH1 = hashFragment(shift, h1);
|
|
4657
|
+
const subH2 = hashFragment(shift, h2);
|
|
4658
|
+
if (subH1 === subH2) {
|
|
4659
|
+
return (child) => new IndexedNode(edit, toBitmap(subH1) | toBitmap(subH2), [child]);
|
|
4660
|
+
} else {
|
|
4661
|
+
const children = subH1 < subH2 ? [n1, n2] : [n2, n1];
|
|
4662
|
+
return new IndexedNode(edit, toBitmap(subH1) | toBitmap(subH2), children);
|
|
4663
|
+
}
|
|
4664
|
+
}
|
|
4665
|
+
function mergeLeaves(edit, shift, h1, n1, h2, n2) {
|
|
4666
|
+
let stack = void 0;
|
|
4667
|
+
let currentShift = shift;
|
|
4668
|
+
while (true) {
|
|
4669
|
+
const res = mergeLeavesInner(edit, currentShift, h1, n1, h2, n2);
|
|
4670
|
+
if (typeof res === "function") {
|
|
4671
|
+
stack = make5(res, stack);
|
|
4672
|
+
currentShift = currentShift + SIZE;
|
|
4673
|
+
} else {
|
|
4674
|
+
let final = res;
|
|
4675
|
+
while (stack != null) {
|
|
4676
|
+
final = stack.value(final);
|
|
4677
|
+
stack = stack.previous;
|
|
4678
|
+
}
|
|
4679
|
+
return final;
|
|
4680
|
+
}
|
|
4681
|
+
}
|
|
4682
|
+
}
|
|
4683
|
+
|
|
4684
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/hashMap.js
|
|
4685
|
+
var HashMapSymbolKey = "effect/HashMap";
|
|
4686
|
+
var HashMapTypeId = /* @__PURE__ */ Symbol.for(HashMapSymbolKey);
|
|
4687
|
+
var HashMapProto = {
|
|
4688
|
+
[HashMapTypeId]: HashMapTypeId,
|
|
4689
|
+
[Symbol.iterator]() {
|
|
4690
|
+
return new HashMapIterator(this, (k, v) => [k, v]);
|
|
4691
|
+
},
|
|
4692
|
+
[symbol]() {
|
|
4693
|
+
let hash2 = hash(HashMapSymbolKey);
|
|
4694
|
+
for (const item of this) {
|
|
4695
|
+
hash2 ^= pipe(hash(item[0]), combine(hash(item[1])));
|
|
4696
|
+
}
|
|
4697
|
+
return cached(this, hash2);
|
|
4698
|
+
},
|
|
4699
|
+
[symbol2](that) {
|
|
4700
|
+
if (isHashMap(that)) {
|
|
4701
|
+
if (that._size !== this._size) {
|
|
4702
|
+
return false;
|
|
4703
|
+
}
|
|
4704
|
+
for (const item of this) {
|
|
4705
|
+
const elem = pipe(that, getHash(item[0], hash(item[0])));
|
|
4706
|
+
if (isNone2(elem)) {
|
|
4707
|
+
return false;
|
|
4708
|
+
} else {
|
|
4709
|
+
if (!equals(item[1], elem.value)) {
|
|
4710
|
+
return false;
|
|
4711
|
+
}
|
|
4712
|
+
}
|
|
4713
|
+
}
|
|
4714
|
+
return true;
|
|
4715
|
+
}
|
|
4716
|
+
return false;
|
|
4717
|
+
},
|
|
4718
|
+
toString() {
|
|
4719
|
+
return format(this.toJSON());
|
|
4720
|
+
},
|
|
4721
|
+
toJSON() {
|
|
4722
|
+
return {
|
|
4723
|
+
_id: "HashMap",
|
|
4724
|
+
values: Array.from(this).map(toJSON)
|
|
4725
|
+
};
|
|
4726
|
+
},
|
|
4727
|
+
[NodeInspectSymbol]() {
|
|
4728
|
+
return this.toJSON();
|
|
4729
|
+
},
|
|
4730
|
+
pipe() {
|
|
4731
|
+
return pipeArguments(this, arguments);
|
|
4732
|
+
}
|
|
4733
|
+
};
|
|
4734
|
+
var makeImpl = (editable, edit, root, size4) => {
|
|
4735
|
+
const map9 = Object.create(HashMapProto);
|
|
4736
|
+
map9._editable = editable;
|
|
4737
|
+
map9._edit = edit;
|
|
4738
|
+
map9._root = root;
|
|
4739
|
+
map9._size = size4;
|
|
4740
|
+
return map9;
|
|
4741
|
+
};
|
|
4742
|
+
var HashMapIterator = class _HashMapIterator {
|
|
4743
|
+
map;
|
|
4744
|
+
f;
|
|
4745
|
+
v;
|
|
4746
|
+
constructor(map9, f) {
|
|
4747
|
+
this.map = map9;
|
|
4748
|
+
this.f = f;
|
|
4749
|
+
this.v = visitLazy(this.map._root, this.f, void 0);
|
|
4750
|
+
}
|
|
4751
|
+
next() {
|
|
4752
|
+
if (isNone2(this.v)) {
|
|
4753
|
+
return {
|
|
4754
|
+
done: true,
|
|
4755
|
+
value: void 0
|
|
4756
|
+
};
|
|
4757
|
+
}
|
|
4758
|
+
const v0 = this.v.value;
|
|
4759
|
+
this.v = applyCont(v0.cont);
|
|
4760
|
+
return {
|
|
4761
|
+
done: false,
|
|
4762
|
+
value: v0.value
|
|
4763
|
+
};
|
|
4764
|
+
}
|
|
4765
|
+
[Symbol.iterator]() {
|
|
4766
|
+
return new _HashMapIterator(this.map, this.f);
|
|
4767
|
+
}
|
|
4768
|
+
};
|
|
4769
|
+
var applyCont = (cont) => cont ? visitLazyChildren(cont[0], cont[1], cont[2], cont[3], cont[4]) : none2();
|
|
4770
|
+
var visitLazy = (node, f, cont = void 0) => {
|
|
4771
|
+
switch (node._tag) {
|
|
4772
|
+
case "LeafNode": {
|
|
4773
|
+
if (isSome2(node.value)) {
|
|
4774
|
+
return some2({
|
|
4775
|
+
value: f(node.key, node.value.value),
|
|
4776
|
+
cont
|
|
4777
|
+
});
|
|
4778
|
+
}
|
|
4779
|
+
return applyCont(cont);
|
|
4780
|
+
}
|
|
4781
|
+
case "CollisionNode":
|
|
4782
|
+
case "ArrayNode":
|
|
4783
|
+
case "IndexedNode": {
|
|
4784
|
+
const children = node.children;
|
|
4785
|
+
return visitLazyChildren(children.length, children, 0, f, cont);
|
|
4786
|
+
}
|
|
4787
|
+
default: {
|
|
4788
|
+
return applyCont(cont);
|
|
4789
|
+
}
|
|
4790
|
+
}
|
|
4791
|
+
};
|
|
4792
|
+
var visitLazyChildren = (len, children, i, f, cont) => {
|
|
4793
|
+
while (i < len) {
|
|
4794
|
+
const child = children[i++];
|
|
4795
|
+
if (child && !isEmptyNode(child)) {
|
|
4796
|
+
return visitLazy(child, f, [len, children, i, f, cont]);
|
|
4797
|
+
}
|
|
4798
|
+
}
|
|
4799
|
+
return applyCont(cont);
|
|
4800
|
+
};
|
|
4801
|
+
var _empty2 = /* @__PURE__ */ makeImpl(false, 0, /* @__PURE__ */ new EmptyNode(), 0);
|
|
4802
|
+
var empty3 = () => _empty2;
|
|
4803
|
+
var isHashMap = (u) => hasProperty(u, HashMapTypeId);
|
|
4804
|
+
var getHash = /* @__PURE__ */ dual(3, (self, key, hash2) => {
|
|
4805
|
+
let node = self._root;
|
|
4806
|
+
let shift = 0;
|
|
4807
|
+
while (true) {
|
|
4808
|
+
switch (node._tag) {
|
|
4809
|
+
case "LeafNode": {
|
|
4810
|
+
return equals(key, node.key) ? node.value : none2();
|
|
4811
|
+
}
|
|
4812
|
+
case "CollisionNode": {
|
|
4813
|
+
if (hash2 === node.hash) {
|
|
4814
|
+
const children = node.children;
|
|
4815
|
+
for (let i = 0, len = children.length; i < len; ++i) {
|
|
4816
|
+
const child = children[i];
|
|
4817
|
+
if ("key" in child && equals(key, child.key)) {
|
|
4818
|
+
return child.value;
|
|
4819
|
+
}
|
|
4820
|
+
}
|
|
4821
|
+
}
|
|
4822
|
+
return none2();
|
|
4823
|
+
}
|
|
4824
|
+
case "IndexedNode": {
|
|
4825
|
+
const frag = hashFragment(shift, hash2);
|
|
4826
|
+
const bit = toBitmap(frag);
|
|
4827
|
+
if (node.mask & bit) {
|
|
4828
|
+
node = node.children[fromBitmap(node.mask, bit)];
|
|
4829
|
+
shift += SIZE;
|
|
4830
|
+
break;
|
|
4831
|
+
}
|
|
4832
|
+
return none2();
|
|
4833
|
+
}
|
|
4834
|
+
case "ArrayNode": {
|
|
4835
|
+
node = node.children[hashFragment(shift, hash2)];
|
|
4836
|
+
if (node) {
|
|
4837
|
+
shift += SIZE;
|
|
4838
|
+
break;
|
|
4839
|
+
}
|
|
4840
|
+
return none2();
|
|
4841
|
+
}
|
|
4842
|
+
default:
|
|
4843
|
+
return none2();
|
|
4844
|
+
}
|
|
4845
|
+
}
|
|
4846
|
+
});
|
|
4847
|
+
var set = /* @__PURE__ */ dual(3, (self, key, value) => modifyAt(self, key, () => some2(value)));
|
|
4848
|
+
var setTree = /* @__PURE__ */ dual(3, (self, newRoot, newSize) => {
|
|
4849
|
+
if (self._editable) {
|
|
4850
|
+
;
|
|
4851
|
+
self._root = newRoot;
|
|
4852
|
+
self._size = newSize;
|
|
4853
|
+
return self;
|
|
4854
|
+
}
|
|
4855
|
+
return newRoot === self._root ? self : makeImpl(self._editable, self._edit, newRoot, newSize);
|
|
4856
|
+
});
|
|
4857
|
+
var keys2 = (self) => new HashMapIterator(self, (key) => key);
|
|
4858
|
+
var size = (self) => self._size;
|
|
4859
|
+
var beginMutation = (self) => makeImpl(true, self._edit + 1, self._root, self._size);
|
|
4860
|
+
var modifyAt = /* @__PURE__ */ dual(3, (self, key, f) => modifyHash(self, key, hash(key), f));
|
|
4861
|
+
var modifyHash = /* @__PURE__ */ dual(4, (self, key, hash2, f) => {
|
|
4862
|
+
const size4 = {
|
|
4863
|
+
value: self._size
|
|
4864
|
+
};
|
|
4865
|
+
const newRoot = self._root.modify(self._editable ? self._edit : NaN, 0, f, hash2, key, size4);
|
|
4866
|
+
return pipe(self, setTree(newRoot, size4.value));
|
|
4867
|
+
});
|
|
4868
|
+
var forEach = /* @__PURE__ */ dual(2, (self, f) => reduce2(self, void 0, (_, value, key) => f(value, key)));
|
|
4869
|
+
var reduce2 = /* @__PURE__ */ dual(3, (self, zero2, f) => {
|
|
4870
|
+
const root = self._root;
|
|
4871
|
+
if (root._tag === "LeafNode") {
|
|
4872
|
+
return isSome2(root.value) ? f(zero2, root.value.value, root.key) : zero2;
|
|
4873
|
+
}
|
|
4874
|
+
if (root._tag === "EmptyNode") {
|
|
4875
|
+
return zero2;
|
|
4876
|
+
}
|
|
4877
|
+
const toVisit = [root.children];
|
|
4878
|
+
let children;
|
|
4879
|
+
while (children = toVisit.pop()) {
|
|
4880
|
+
for (let i = 0, len = children.length; i < len; ) {
|
|
4881
|
+
const child = children[i++];
|
|
4882
|
+
if (child && !isEmptyNode(child)) {
|
|
4883
|
+
if (child._tag === "LeafNode") {
|
|
4884
|
+
if (isSome2(child.value)) {
|
|
4885
|
+
zero2 = f(zero2, child.value.value, child.key);
|
|
4886
|
+
}
|
|
4887
|
+
} else {
|
|
4888
|
+
toVisit.push(child.children);
|
|
4889
|
+
}
|
|
4890
|
+
}
|
|
4891
|
+
}
|
|
4892
|
+
}
|
|
4893
|
+
return zero2;
|
|
4894
|
+
});
|
|
4895
|
+
|
|
4896
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/hashSet.js
|
|
4897
|
+
var HashSetSymbolKey = "effect/HashSet";
|
|
4898
|
+
var HashSetTypeId = /* @__PURE__ */ Symbol.for(HashSetSymbolKey);
|
|
4899
|
+
var HashSetProto = {
|
|
4900
|
+
[HashSetTypeId]: HashSetTypeId,
|
|
4901
|
+
[Symbol.iterator]() {
|
|
4902
|
+
return keys2(this._keyMap);
|
|
4903
|
+
},
|
|
4904
|
+
[symbol]() {
|
|
4905
|
+
return cached(this, combine(hash(this._keyMap))(hash(HashSetSymbolKey)));
|
|
4906
|
+
},
|
|
4907
|
+
[symbol2](that) {
|
|
4908
|
+
if (isHashSet(that)) {
|
|
4909
|
+
return size(this._keyMap) === size(that._keyMap) && equals(this._keyMap, that._keyMap);
|
|
4910
|
+
}
|
|
4911
|
+
return false;
|
|
4912
|
+
},
|
|
4913
|
+
toString() {
|
|
4914
|
+
return format(this.toJSON());
|
|
4915
|
+
},
|
|
4916
|
+
toJSON() {
|
|
4917
|
+
return {
|
|
4918
|
+
_id: "HashSet",
|
|
4919
|
+
values: Array.from(this).map(toJSON)
|
|
4920
|
+
};
|
|
4921
|
+
},
|
|
4922
|
+
[NodeInspectSymbol]() {
|
|
4923
|
+
return this.toJSON();
|
|
4924
|
+
},
|
|
4925
|
+
pipe() {
|
|
4926
|
+
return pipeArguments(this, arguments);
|
|
4927
|
+
}
|
|
4928
|
+
};
|
|
4929
|
+
var makeImpl2 = (keyMap) => {
|
|
4930
|
+
const set2 = Object.create(HashSetProto);
|
|
4931
|
+
set2._keyMap = keyMap;
|
|
4932
|
+
return set2;
|
|
4933
|
+
};
|
|
4934
|
+
var isHashSet = (u) => hasProperty(u, HashSetTypeId);
|
|
4935
|
+
var _empty3 = /* @__PURE__ */ makeImpl2(/* @__PURE__ */ empty3());
|
|
4936
|
+
var empty4 = () => _empty3;
|
|
4937
|
+
var size2 = (self) => size(self._keyMap);
|
|
4938
|
+
var beginMutation2 = (self) => makeImpl2(beginMutation(self._keyMap));
|
|
4939
|
+
var endMutation = (self) => {
|
|
4940
|
+
;
|
|
4941
|
+
self._keyMap._editable = false;
|
|
4942
|
+
return self;
|
|
4943
|
+
};
|
|
4944
|
+
var mutate = /* @__PURE__ */ dual(2, (self, f) => {
|
|
4945
|
+
const transient = beginMutation2(self);
|
|
4946
|
+
f(transient);
|
|
4947
|
+
return endMutation(transient);
|
|
4948
|
+
});
|
|
4949
|
+
var add = /* @__PURE__ */ dual(2, (self, value) => self._keyMap._editable ? (set(value, true)(self._keyMap), self) : makeImpl2(set(value, true)(self._keyMap)));
|
|
4950
|
+
var union2 = /* @__PURE__ */ dual(2, (self, that) => mutate(empty4(), (set2) => {
|
|
4951
|
+
forEach2(self, (value) => add(set2, value));
|
|
4952
|
+
for (const value of that) {
|
|
4953
|
+
add(set2, value);
|
|
4954
|
+
}
|
|
4955
|
+
}));
|
|
4956
|
+
var forEach2 = /* @__PURE__ */ dual(2, (self, f) => forEach(self._keyMap, (_, k) => f(k)));
|
|
4957
|
+
|
|
4958
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/HashSet.js
|
|
4959
|
+
var empty5 = empty4;
|
|
4960
|
+
var size3 = size2;
|
|
4961
|
+
var add2 = add;
|
|
4962
|
+
var union3 = union2;
|
|
4963
|
+
|
|
4964
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/data.js
|
|
4965
|
+
var ArrayProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(Array.prototype), {
|
|
4966
|
+
[symbol]() {
|
|
4967
|
+
return cached(this, array2(this));
|
|
4968
|
+
},
|
|
4969
|
+
[symbol2](that) {
|
|
4970
|
+
if (Array.isArray(that) && this.length === that.length) {
|
|
4971
|
+
return this.every((v, i) => equals(v, that[i]));
|
|
4972
|
+
} else {
|
|
4973
|
+
return false;
|
|
4974
|
+
}
|
|
4975
|
+
}
|
|
4976
|
+
});
|
|
4977
|
+
var Structural = /* @__PURE__ */ (function() {
|
|
4978
|
+
function Structural2(args2) {
|
|
4979
|
+
if (args2) {
|
|
4980
|
+
Object.assign(this, args2);
|
|
4981
|
+
}
|
|
4982
|
+
}
|
|
4983
|
+
Structural2.prototype = StructuralPrototype;
|
|
4984
|
+
return Structural2;
|
|
4985
|
+
})();
|
|
4986
|
+
|
|
4987
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/opCodes/cause.js
|
|
4988
|
+
var OP_DIE = "Die";
|
|
4989
|
+
var OP_EMPTY = "Empty";
|
|
4990
|
+
var OP_FAIL = "Fail";
|
|
4991
|
+
var OP_INTERRUPT = "Interrupt";
|
|
4992
|
+
var OP_PARALLEL = "Parallel";
|
|
4993
|
+
var OP_SEQUENTIAL = "Sequential";
|
|
4994
|
+
|
|
4995
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/cause.js
|
|
4996
|
+
var CauseSymbolKey = "effect/Cause";
|
|
4997
|
+
var CauseTypeId = /* @__PURE__ */ Symbol.for(CauseSymbolKey);
|
|
4998
|
+
var variance = {
|
|
4999
|
+
/* c8 ignore next */
|
|
5000
|
+
_E: (_) => _
|
|
5001
|
+
};
|
|
5002
|
+
var proto = {
|
|
5003
|
+
[CauseTypeId]: variance,
|
|
5004
|
+
[symbol]() {
|
|
5005
|
+
return pipe(hash(CauseSymbolKey), combine(hash(flattenCause(this))), cached(this));
|
|
5006
|
+
},
|
|
5007
|
+
[symbol2](that) {
|
|
5008
|
+
return isCause(that) && causeEquals(this, that);
|
|
5009
|
+
},
|
|
5010
|
+
pipe() {
|
|
5011
|
+
return pipeArguments(this, arguments);
|
|
5012
|
+
},
|
|
5013
|
+
toJSON() {
|
|
5014
|
+
switch (this._tag) {
|
|
5015
|
+
case "Empty":
|
|
5016
|
+
return {
|
|
5017
|
+
_id: "Cause",
|
|
5018
|
+
_tag: this._tag
|
|
5019
|
+
};
|
|
5020
|
+
case "Die":
|
|
5021
|
+
return {
|
|
5022
|
+
_id: "Cause",
|
|
5023
|
+
_tag: this._tag,
|
|
5024
|
+
defect: toJSON(this.defect)
|
|
5025
|
+
};
|
|
5026
|
+
case "Interrupt":
|
|
5027
|
+
return {
|
|
5028
|
+
_id: "Cause",
|
|
5029
|
+
_tag: this._tag,
|
|
5030
|
+
fiberId: this.fiberId.toJSON()
|
|
5031
|
+
};
|
|
5032
|
+
case "Fail":
|
|
5033
|
+
return {
|
|
5034
|
+
_id: "Cause",
|
|
5035
|
+
_tag: this._tag,
|
|
5036
|
+
failure: toJSON(this.error)
|
|
5037
|
+
};
|
|
5038
|
+
case "Sequential":
|
|
5039
|
+
case "Parallel":
|
|
5040
|
+
return {
|
|
5041
|
+
_id: "Cause",
|
|
5042
|
+
_tag: this._tag,
|
|
5043
|
+
left: toJSON(this.left),
|
|
5044
|
+
right: toJSON(this.right)
|
|
5045
|
+
};
|
|
5046
|
+
}
|
|
5047
|
+
},
|
|
5048
|
+
toString() {
|
|
5049
|
+
return pretty(this);
|
|
5050
|
+
},
|
|
5051
|
+
[NodeInspectSymbol]() {
|
|
5052
|
+
return this.toJSON();
|
|
5053
|
+
}
|
|
5054
|
+
};
|
|
5055
|
+
var fail2 = (error) => {
|
|
5056
|
+
const o = Object.create(proto);
|
|
5057
|
+
o._tag = OP_FAIL;
|
|
5058
|
+
o.error = error;
|
|
5059
|
+
return o;
|
|
5060
|
+
};
|
|
5061
|
+
var parallel = (left3, right3) => {
|
|
5062
|
+
const o = Object.create(proto);
|
|
5063
|
+
o._tag = OP_PARALLEL;
|
|
5064
|
+
o.left = left3;
|
|
5065
|
+
o.right = right3;
|
|
5066
|
+
return o;
|
|
5067
|
+
};
|
|
5068
|
+
var sequential = (left3, right3) => {
|
|
5069
|
+
const o = Object.create(proto);
|
|
5070
|
+
o._tag = OP_SEQUENTIAL;
|
|
5071
|
+
o.left = left3;
|
|
5072
|
+
o.right = right3;
|
|
5073
|
+
return o;
|
|
5074
|
+
};
|
|
5075
|
+
var isCause = (u) => hasProperty(u, CauseTypeId);
|
|
5076
|
+
var isInterruptedOnly = (self) => reduceWithContext(void 0, IsInterruptedOnlyCauseReducer)(self);
|
|
5077
|
+
var causeEquals = (left3, right3) => {
|
|
5078
|
+
let leftStack = of(left3);
|
|
5079
|
+
let rightStack = of(right3);
|
|
5080
|
+
while (isNonEmpty(leftStack) && isNonEmpty(rightStack)) {
|
|
5081
|
+
const [leftParallel, leftSequential] = pipe(headNonEmpty2(leftStack), reduce4([empty5(), empty2()], ([parallel2, sequential2], cause) => {
|
|
5082
|
+
const [par, seq] = evaluateCause(cause);
|
|
5083
|
+
return some2([pipe(parallel2, union3(par)), pipe(sequential2, appendAll2(seq))]);
|
|
5084
|
+
}));
|
|
5085
|
+
const [rightParallel, rightSequential] = pipe(headNonEmpty2(rightStack), reduce4([empty5(), empty2()], ([parallel2, sequential2], cause) => {
|
|
5086
|
+
const [par, seq] = evaluateCause(cause);
|
|
5087
|
+
return some2([pipe(parallel2, union3(par)), pipe(sequential2, appendAll2(seq))]);
|
|
5088
|
+
}));
|
|
5089
|
+
if (!equals(leftParallel, rightParallel)) {
|
|
5090
|
+
return false;
|
|
5091
|
+
}
|
|
5092
|
+
leftStack = leftSequential;
|
|
5093
|
+
rightStack = rightSequential;
|
|
5094
|
+
}
|
|
5095
|
+
return true;
|
|
5096
|
+
};
|
|
5097
|
+
var flattenCause = (cause) => {
|
|
5098
|
+
return flattenCauseLoop(of(cause), empty2());
|
|
5099
|
+
};
|
|
5100
|
+
var flattenCauseLoop = (causes, flattened) => {
|
|
5101
|
+
while (1) {
|
|
5102
|
+
const [parallel2, sequential2] = pipe(causes, reduce([empty5(), empty2()], ([parallel3, sequential3], cause) => {
|
|
5103
|
+
const [par, seq] = evaluateCause(cause);
|
|
5104
|
+
return [pipe(parallel3, union3(par)), pipe(sequential3, appendAll2(seq))];
|
|
5105
|
+
}));
|
|
5106
|
+
const updated = size3(parallel2) > 0 ? pipe(flattened, prepend(parallel2)) : flattened;
|
|
5107
|
+
if (isEmpty(sequential2)) {
|
|
5108
|
+
return reverse2(updated);
|
|
5109
|
+
}
|
|
5110
|
+
causes = sequential2;
|
|
5111
|
+
flattened = updated;
|
|
5112
|
+
}
|
|
5113
|
+
throw new Error(getBugErrorMessage("Cause.flattenCauseLoop"));
|
|
5114
|
+
};
|
|
5115
|
+
var evaluateCause = (self) => {
|
|
5116
|
+
let cause = self;
|
|
5117
|
+
const stack = [];
|
|
5118
|
+
let _parallel = empty5();
|
|
5119
|
+
let _sequential = empty2();
|
|
5120
|
+
while (cause !== void 0) {
|
|
5121
|
+
switch (cause._tag) {
|
|
5122
|
+
case OP_EMPTY: {
|
|
5123
|
+
if (stack.length === 0) {
|
|
5124
|
+
return [_parallel, _sequential];
|
|
5125
|
+
}
|
|
5126
|
+
cause = stack.pop();
|
|
5127
|
+
break;
|
|
5128
|
+
}
|
|
5129
|
+
case OP_FAIL: {
|
|
5130
|
+
_parallel = add2(_parallel, make4(cause._tag, cause.error));
|
|
5131
|
+
if (stack.length === 0) {
|
|
5132
|
+
return [_parallel, _sequential];
|
|
5133
|
+
}
|
|
5134
|
+
cause = stack.pop();
|
|
5135
|
+
break;
|
|
5136
|
+
}
|
|
5137
|
+
case OP_DIE: {
|
|
5138
|
+
_parallel = add2(_parallel, make4(cause._tag, cause.defect));
|
|
5139
|
+
if (stack.length === 0) {
|
|
5140
|
+
return [_parallel, _sequential];
|
|
5141
|
+
}
|
|
5142
|
+
cause = stack.pop();
|
|
5143
|
+
break;
|
|
5144
|
+
}
|
|
5145
|
+
case OP_INTERRUPT: {
|
|
5146
|
+
_parallel = add2(_parallel, make4(cause._tag, cause.fiberId));
|
|
5147
|
+
if (stack.length === 0) {
|
|
5148
|
+
return [_parallel, _sequential];
|
|
5149
|
+
}
|
|
5150
|
+
cause = stack.pop();
|
|
5151
|
+
break;
|
|
5152
|
+
}
|
|
5153
|
+
case OP_SEQUENTIAL: {
|
|
5154
|
+
switch (cause.left._tag) {
|
|
5155
|
+
case OP_EMPTY: {
|
|
5156
|
+
cause = cause.right;
|
|
5157
|
+
break;
|
|
5158
|
+
}
|
|
5159
|
+
case OP_SEQUENTIAL: {
|
|
5160
|
+
cause = sequential(cause.left.left, sequential(cause.left.right, cause.right));
|
|
5161
|
+
break;
|
|
5162
|
+
}
|
|
5163
|
+
case OP_PARALLEL: {
|
|
5164
|
+
cause = parallel(sequential(cause.left.left, cause.right), sequential(cause.left.right, cause.right));
|
|
5165
|
+
break;
|
|
5166
|
+
}
|
|
5167
|
+
default: {
|
|
5168
|
+
_sequential = prepend(_sequential, cause.right);
|
|
5169
|
+
cause = cause.left;
|
|
5170
|
+
break;
|
|
5171
|
+
}
|
|
5172
|
+
}
|
|
5173
|
+
break;
|
|
5174
|
+
}
|
|
5175
|
+
case OP_PARALLEL: {
|
|
5176
|
+
stack.push(cause.right);
|
|
5177
|
+
cause = cause.left;
|
|
5178
|
+
break;
|
|
5179
|
+
}
|
|
5180
|
+
}
|
|
5181
|
+
}
|
|
5182
|
+
throw new Error(getBugErrorMessage("Cause.evaluateCauseLoop"));
|
|
5183
|
+
};
|
|
5184
|
+
var IsInterruptedOnlyCauseReducer = {
|
|
5185
|
+
emptyCase: constTrue,
|
|
5186
|
+
failCase: constFalse,
|
|
5187
|
+
dieCase: constFalse,
|
|
5188
|
+
interruptCase: constTrue,
|
|
5189
|
+
sequentialCase: (_, left3, right3) => left3 && right3,
|
|
5190
|
+
parallelCase: (_, left3, right3) => left3 && right3
|
|
5191
|
+
};
|
|
5192
|
+
var OP_SEQUENTIAL_CASE = "SequentialCase";
|
|
5193
|
+
var OP_PARALLEL_CASE = "ParallelCase";
|
|
5194
|
+
var reduce4 = /* @__PURE__ */ dual(3, (self, zero2, pf) => {
|
|
5195
|
+
let accumulator = zero2;
|
|
5196
|
+
let cause = self;
|
|
5197
|
+
const causes = [];
|
|
5198
|
+
while (cause !== void 0) {
|
|
5199
|
+
const option2 = pf(accumulator, cause);
|
|
5200
|
+
accumulator = isSome2(option2) ? option2.value : accumulator;
|
|
5201
|
+
switch (cause._tag) {
|
|
5202
|
+
case OP_SEQUENTIAL: {
|
|
5203
|
+
causes.push(cause.right);
|
|
5204
|
+
cause = cause.left;
|
|
5205
|
+
break;
|
|
5206
|
+
}
|
|
5207
|
+
case OP_PARALLEL: {
|
|
5208
|
+
causes.push(cause.right);
|
|
5209
|
+
cause = cause.left;
|
|
5210
|
+
break;
|
|
5211
|
+
}
|
|
5212
|
+
default: {
|
|
5213
|
+
cause = void 0;
|
|
5214
|
+
break;
|
|
5215
|
+
}
|
|
5216
|
+
}
|
|
5217
|
+
if (cause === void 0 && causes.length > 0) {
|
|
5218
|
+
cause = causes.pop();
|
|
5219
|
+
}
|
|
5220
|
+
}
|
|
5221
|
+
return accumulator;
|
|
5222
|
+
});
|
|
5223
|
+
var reduceWithContext = /* @__PURE__ */ dual(3, (self, context, reducer) => {
|
|
5224
|
+
const input = [self];
|
|
5225
|
+
const output = [];
|
|
5226
|
+
while (input.length > 0) {
|
|
5227
|
+
const cause = input.pop();
|
|
5228
|
+
switch (cause._tag) {
|
|
5229
|
+
case OP_EMPTY: {
|
|
5230
|
+
output.push(right2(reducer.emptyCase(context)));
|
|
5231
|
+
break;
|
|
5232
|
+
}
|
|
5233
|
+
case OP_FAIL: {
|
|
5234
|
+
output.push(right2(reducer.failCase(context, cause.error)));
|
|
5235
|
+
break;
|
|
5236
|
+
}
|
|
5237
|
+
case OP_DIE: {
|
|
5238
|
+
output.push(right2(reducer.dieCase(context, cause.defect)));
|
|
5239
|
+
break;
|
|
5240
|
+
}
|
|
5241
|
+
case OP_INTERRUPT: {
|
|
5242
|
+
output.push(right2(reducer.interruptCase(context, cause.fiberId)));
|
|
5243
|
+
break;
|
|
5244
|
+
}
|
|
5245
|
+
case OP_SEQUENTIAL: {
|
|
5246
|
+
input.push(cause.right);
|
|
5247
|
+
input.push(cause.left);
|
|
5248
|
+
output.push(left2({
|
|
5249
|
+
_tag: OP_SEQUENTIAL_CASE
|
|
5250
|
+
}));
|
|
5251
|
+
break;
|
|
5252
|
+
}
|
|
5253
|
+
case OP_PARALLEL: {
|
|
5254
|
+
input.push(cause.right);
|
|
5255
|
+
input.push(cause.left);
|
|
5256
|
+
output.push(left2({
|
|
5257
|
+
_tag: OP_PARALLEL_CASE
|
|
5258
|
+
}));
|
|
5259
|
+
break;
|
|
5260
|
+
}
|
|
5261
|
+
}
|
|
5262
|
+
}
|
|
5263
|
+
const accumulator = [];
|
|
5264
|
+
while (output.length > 0) {
|
|
5265
|
+
const either = output.pop();
|
|
5266
|
+
switch (either._tag) {
|
|
5267
|
+
case "Left": {
|
|
5268
|
+
switch (either.left._tag) {
|
|
5269
|
+
case OP_SEQUENTIAL_CASE: {
|
|
5270
|
+
const left3 = accumulator.pop();
|
|
5271
|
+
const right3 = accumulator.pop();
|
|
5272
|
+
const value = reducer.sequentialCase(context, left3, right3);
|
|
5273
|
+
accumulator.push(value);
|
|
5274
|
+
break;
|
|
5275
|
+
}
|
|
5276
|
+
case OP_PARALLEL_CASE: {
|
|
5277
|
+
const left3 = accumulator.pop();
|
|
5278
|
+
const right3 = accumulator.pop();
|
|
5279
|
+
const value = reducer.parallelCase(context, left3, right3);
|
|
5280
|
+
accumulator.push(value);
|
|
5281
|
+
break;
|
|
5282
|
+
}
|
|
5283
|
+
}
|
|
5284
|
+
break;
|
|
5285
|
+
}
|
|
5286
|
+
case "Right": {
|
|
5287
|
+
accumulator.push(either.right);
|
|
5288
|
+
break;
|
|
5289
|
+
}
|
|
5290
|
+
}
|
|
5291
|
+
}
|
|
5292
|
+
if (accumulator.length === 0) {
|
|
5293
|
+
throw new Error("BUG: Cause.reduceWithContext - please report an issue at https://github.com/Effect-TS/effect/issues");
|
|
5294
|
+
}
|
|
5295
|
+
return accumulator.pop();
|
|
5296
|
+
});
|
|
5297
|
+
var pretty = (cause, options) => {
|
|
5298
|
+
if (isInterruptedOnly(cause)) {
|
|
5299
|
+
return "All fibers interrupted without errors.";
|
|
5300
|
+
}
|
|
5301
|
+
return prettyErrors(cause).map(function(e) {
|
|
5302
|
+
if (options?.renderErrorCause !== true || e.cause === void 0) {
|
|
5303
|
+
return e.stack;
|
|
5304
|
+
}
|
|
5305
|
+
return `${e.stack} {
|
|
5306
|
+
${renderErrorCause(e.cause, " ")}
|
|
5307
|
+
}`;
|
|
5308
|
+
}).join("\n");
|
|
5309
|
+
};
|
|
5310
|
+
var renderErrorCause = (cause, prefix) => {
|
|
5311
|
+
const lines = cause.stack.split("\n");
|
|
5312
|
+
let stack = `${prefix}[cause]: ${lines[0]}`;
|
|
5313
|
+
for (let i = 1, len = lines.length; i < len; i++) {
|
|
5314
|
+
stack += `
|
|
5315
|
+
${prefix}${lines[i]}`;
|
|
5316
|
+
}
|
|
5317
|
+
if (cause.cause) {
|
|
5318
|
+
stack += ` {
|
|
5319
|
+
${renderErrorCause(cause.cause, `${prefix} `)}
|
|
5320
|
+
${prefix}}`;
|
|
5321
|
+
}
|
|
5322
|
+
return stack;
|
|
5323
|
+
};
|
|
5324
|
+
var PrettyError = class _PrettyError extends globalThis.Error {
|
|
5325
|
+
span = void 0;
|
|
5326
|
+
constructor(originalError) {
|
|
5327
|
+
const originalErrorIsObject = typeof originalError === "object" && originalError !== null;
|
|
5328
|
+
const prevLimit = Error.stackTraceLimit;
|
|
5329
|
+
Error.stackTraceLimit = 1;
|
|
5330
|
+
super(prettyErrorMessage(originalError), originalErrorIsObject && "cause" in originalError && typeof originalError.cause !== "undefined" ? {
|
|
5331
|
+
cause: new _PrettyError(originalError.cause)
|
|
5332
|
+
} : void 0);
|
|
5333
|
+
if (this.message === "") {
|
|
5334
|
+
this.message = "An error has occurred";
|
|
5335
|
+
}
|
|
5336
|
+
Error.stackTraceLimit = prevLimit;
|
|
5337
|
+
this.name = originalError instanceof Error ? originalError.name : "Error";
|
|
5338
|
+
if (originalErrorIsObject) {
|
|
5339
|
+
if (spanSymbol in originalError) {
|
|
5340
|
+
this.span = originalError[spanSymbol];
|
|
5341
|
+
}
|
|
5342
|
+
Object.keys(originalError).forEach((key) => {
|
|
5343
|
+
if (!(key in this)) {
|
|
5344
|
+
this[key] = originalError[key];
|
|
5345
|
+
}
|
|
5346
|
+
});
|
|
5347
|
+
}
|
|
5348
|
+
this.stack = prettyErrorStack(`${this.name}: ${this.message}`, originalError instanceof Error && originalError.stack ? originalError.stack : "", this.span);
|
|
5349
|
+
}
|
|
5350
|
+
};
|
|
5351
|
+
var prettyErrorMessage = (u) => {
|
|
5352
|
+
if (typeof u === "string") {
|
|
5353
|
+
return u;
|
|
5354
|
+
}
|
|
5355
|
+
if (typeof u === "object" && u !== null && u instanceof Error) {
|
|
5356
|
+
return u.message;
|
|
5357
|
+
}
|
|
5358
|
+
try {
|
|
5359
|
+
if (hasProperty(u, "toString") && isFunction2(u["toString"]) && u["toString"] !== Object.prototype.toString && u["toString"] !== globalThis.Array.prototype.toString) {
|
|
5360
|
+
return u["toString"]();
|
|
5361
|
+
}
|
|
5362
|
+
} catch {
|
|
5363
|
+
}
|
|
5364
|
+
return stringifyCircular(u);
|
|
5365
|
+
};
|
|
5366
|
+
var locationRegex = /\((.*)\)/g;
|
|
5367
|
+
var spanToTrace = /* @__PURE__ */ globalValue("effect/Tracer/spanToTrace", () => /* @__PURE__ */ new WeakMap());
|
|
5368
|
+
var prettyErrorStack = (message, stack, span) => {
|
|
5369
|
+
const out = [message];
|
|
5370
|
+
const lines = stack.startsWith(message) ? stack.slice(message.length).split("\n") : stack.split("\n");
|
|
5371
|
+
for (let i = 1; i < lines.length; i++) {
|
|
5372
|
+
if (lines[i].includes(" at new BaseEffectError") || lines[i].includes(" at new YieldableError")) {
|
|
5373
|
+
i++;
|
|
5374
|
+
continue;
|
|
5375
|
+
}
|
|
5376
|
+
if (lines[i].includes("Generator.next")) {
|
|
5377
|
+
break;
|
|
5378
|
+
}
|
|
5379
|
+
if (lines[i].includes("effect_internal_function")) {
|
|
5380
|
+
break;
|
|
5381
|
+
}
|
|
5382
|
+
out.push(lines[i].replace(/at .*effect_instruction_i.*\((.*)\)/, "at $1").replace(/EffectPrimitive\.\w+/, "<anonymous>"));
|
|
5383
|
+
}
|
|
5384
|
+
if (span) {
|
|
5385
|
+
let current = span;
|
|
5386
|
+
let i = 0;
|
|
5387
|
+
while (current && current._tag === "Span" && i < 10) {
|
|
5388
|
+
const stackFn = spanToTrace.get(current);
|
|
5389
|
+
if (typeof stackFn === "function") {
|
|
5390
|
+
const stack2 = stackFn();
|
|
5391
|
+
if (typeof stack2 === "string") {
|
|
5392
|
+
const locationMatchAll = stack2.matchAll(locationRegex);
|
|
5393
|
+
let match3 = false;
|
|
5394
|
+
for (const [, location] of locationMatchAll) {
|
|
5395
|
+
match3 = true;
|
|
5396
|
+
out.push(` at ${current.name} (${location})`);
|
|
5397
|
+
}
|
|
5398
|
+
if (!match3) {
|
|
5399
|
+
out.push(` at ${current.name} (${stack2.replace(/^at /, "")})`);
|
|
5400
|
+
}
|
|
5401
|
+
} else {
|
|
5402
|
+
out.push(` at ${current.name}`);
|
|
5403
|
+
}
|
|
5404
|
+
} else {
|
|
5405
|
+
out.push(` at ${current.name}`);
|
|
5406
|
+
}
|
|
5407
|
+
current = getOrUndefined(current.parent);
|
|
5408
|
+
i++;
|
|
5409
|
+
}
|
|
5410
|
+
}
|
|
5411
|
+
return out.join("\n");
|
|
5412
|
+
};
|
|
5413
|
+
var spanSymbol = /* @__PURE__ */ Symbol.for("effect/SpanAnnotation");
|
|
5414
|
+
var prettyErrors = (cause) => reduceWithContext(cause, void 0, {
|
|
5415
|
+
emptyCase: () => [],
|
|
5416
|
+
dieCase: (_, unknownError) => {
|
|
5417
|
+
return [new PrettyError(unknownError)];
|
|
5418
|
+
},
|
|
5419
|
+
failCase: (_, error) => {
|
|
5420
|
+
return [new PrettyError(error)];
|
|
5421
|
+
},
|
|
5422
|
+
interruptCase: () => [],
|
|
5423
|
+
parallelCase: (_, l, r) => [...l, ...r],
|
|
5424
|
+
sequentialCase: (_, l, r) => [...l, ...r]
|
|
5425
|
+
});
|
|
5426
|
+
|
|
5427
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/singleShotGen.js
|
|
5428
|
+
var SingleShotGen3 = class _SingleShotGen {
|
|
5429
|
+
self;
|
|
5430
|
+
called = false;
|
|
5431
|
+
constructor(self) {
|
|
5432
|
+
this.self = self;
|
|
5433
|
+
}
|
|
5434
|
+
next(a) {
|
|
5435
|
+
return this.called ? {
|
|
5436
|
+
value: a,
|
|
5437
|
+
done: true
|
|
5438
|
+
} : (this.called = true, {
|
|
5439
|
+
value: this.self,
|
|
5440
|
+
done: false
|
|
5441
|
+
});
|
|
5442
|
+
}
|
|
5443
|
+
return(a) {
|
|
5444
|
+
return {
|
|
5445
|
+
value: a,
|
|
5446
|
+
done: true
|
|
5447
|
+
};
|
|
5448
|
+
}
|
|
5449
|
+
throw(e) {
|
|
5450
|
+
throw e;
|
|
5451
|
+
}
|
|
5452
|
+
[Symbol.iterator]() {
|
|
5453
|
+
return new _SingleShotGen(this.self);
|
|
5454
|
+
}
|
|
5455
|
+
};
|
|
5456
|
+
|
|
5457
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/core.js
|
|
5458
|
+
var EffectTypeId2 = /* @__PURE__ */ Symbol.for("effect/Effect");
|
|
5459
|
+
var EffectPrimitive = class {
|
|
5460
|
+
_op;
|
|
5461
|
+
effect_instruction_i0 = void 0;
|
|
5462
|
+
effect_instruction_i1 = void 0;
|
|
5463
|
+
effect_instruction_i2 = void 0;
|
|
5464
|
+
trace = void 0;
|
|
5465
|
+
[EffectTypeId2] = effectVariance;
|
|
5466
|
+
constructor(_op) {
|
|
5467
|
+
this._op = _op;
|
|
5468
|
+
}
|
|
5469
|
+
[symbol2](that) {
|
|
5470
|
+
return this === that;
|
|
5471
|
+
}
|
|
5472
|
+
[symbol]() {
|
|
5473
|
+
return cached(this, random(this));
|
|
5474
|
+
}
|
|
5475
|
+
pipe() {
|
|
5476
|
+
return pipeArguments(this, arguments);
|
|
5477
|
+
}
|
|
5478
|
+
toJSON() {
|
|
5479
|
+
return {
|
|
5480
|
+
_id: "Effect",
|
|
5481
|
+
_op: this._op,
|
|
5482
|
+
effect_instruction_i0: toJSON(this.effect_instruction_i0),
|
|
5483
|
+
effect_instruction_i1: toJSON(this.effect_instruction_i1),
|
|
5484
|
+
effect_instruction_i2: toJSON(this.effect_instruction_i2)
|
|
5485
|
+
};
|
|
5486
|
+
}
|
|
5487
|
+
toString() {
|
|
5488
|
+
return format(this.toJSON());
|
|
5489
|
+
}
|
|
5490
|
+
[NodeInspectSymbol]() {
|
|
5491
|
+
return this.toJSON();
|
|
5492
|
+
}
|
|
5493
|
+
[Symbol.iterator]() {
|
|
5494
|
+
return new SingleShotGen3(new YieldWrap(this));
|
|
5495
|
+
}
|
|
5496
|
+
};
|
|
5497
|
+
var EffectPrimitiveFailure = class {
|
|
5498
|
+
_op;
|
|
5499
|
+
effect_instruction_i0 = void 0;
|
|
5500
|
+
effect_instruction_i1 = void 0;
|
|
5501
|
+
effect_instruction_i2 = void 0;
|
|
5502
|
+
trace = void 0;
|
|
5503
|
+
[EffectTypeId2] = effectVariance;
|
|
5504
|
+
constructor(_op) {
|
|
5505
|
+
this._op = _op;
|
|
5506
|
+
this._tag = _op;
|
|
5507
|
+
}
|
|
5508
|
+
[symbol2](that) {
|
|
5509
|
+
return exitIsExit(that) && that._op === "Failure" && // @ts-expect-error
|
|
5510
|
+
equals(this.effect_instruction_i0, that.effect_instruction_i0);
|
|
5511
|
+
}
|
|
5512
|
+
[symbol]() {
|
|
5513
|
+
return pipe(
|
|
5514
|
+
// @ts-expect-error
|
|
5515
|
+
string(this._tag),
|
|
5516
|
+
// @ts-expect-error
|
|
5517
|
+
combine(hash(this.effect_instruction_i0)),
|
|
5518
|
+
cached(this)
|
|
5519
|
+
);
|
|
5520
|
+
}
|
|
5521
|
+
get cause() {
|
|
5522
|
+
return this.effect_instruction_i0;
|
|
5523
|
+
}
|
|
5524
|
+
pipe() {
|
|
5525
|
+
return pipeArguments(this, arguments);
|
|
5526
|
+
}
|
|
5527
|
+
toJSON() {
|
|
5528
|
+
return {
|
|
5529
|
+
_id: "Exit",
|
|
5530
|
+
_tag: this._op,
|
|
5531
|
+
cause: this.cause.toJSON()
|
|
5532
|
+
};
|
|
5533
|
+
}
|
|
5534
|
+
toString() {
|
|
5535
|
+
return format(this.toJSON());
|
|
5536
|
+
}
|
|
5537
|
+
[NodeInspectSymbol]() {
|
|
5538
|
+
return this.toJSON();
|
|
5539
|
+
}
|
|
5540
|
+
[Symbol.iterator]() {
|
|
5541
|
+
return new SingleShotGen3(new YieldWrap(this));
|
|
5542
|
+
}
|
|
5543
|
+
};
|
|
5544
|
+
var EffectPrimitiveSuccess = class {
|
|
5545
|
+
_op;
|
|
5546
|
+
effect_instruction_i0 = void 0;
|
|
5547
|
+
effect_instruction_i1 = void 0;
|
|
5548
|
+
effect_instruction_i2 = void 0;
|
|
5549
|
+
trace = void 0;
|
|
5550
|
+
[EffectTypeId2] = effectVariance;
|
|
5551
|
+
constructor(_op) {
|
|
5552
|
+
this._op = _op;
|
|
5553
|
+
this._tag = _op;
|
|
5554
|
+
}
|
|
5555
|
+
[symbol2](that) {
|
|
5556
|
+
return exitIsExit(that) && that._op === "Success" && // @ts-expect-error
|
|
5557
|
+
equals(this.effect_instruction_i0, that.effect_instruction_i0);
|
|
5558
|
+
}
|
|
5559
|
+
[symbol]() {
|
|
5560
|
+
return pipe(
|
|
5561
|
+
// @ts-expect-error
|
|
5562
|
+
string(this._tag),
|
|
5563
|
+
// @ts-expect-error
|
|
5564
|
+
combine(hash(this.effect_instruction_i0)),
|
|
5565
|
+
cached(this)
|
|
5566
|
+
);
|
|
5567
|
+
}
|
|
5568
|
+
get value() {
|
|
5569
|
+
return this.effect_instruction_i0;
|
|
5570
|
+
}
|
|
5571
|
+
pipe() {
|
|
5572
|
+
return pipeArguments(this, arguments);
|
|
5573
|
+
}
|
|
5574
|
+
toJSON() {
|
|
5575
|
+
return {
|
|
5576
|
+
_id: "Exit",
|
|
5577
|
+
_tag: this._op,
|
|
5578
|
+
value: toJSON(this.value)
|
|
5579
|
+
};
|
|
5580
|
+
}
|
|
5581
|
+
toString() {
|
|
5582
|
+
return format(this.toJSON());
|
|
5583
|
+
}
|
|
5584
|
+
[NodeInspectSymbol]() {
|
|
5585
|
+
return this.toJSON();
|
|
5586
|
+
}
|
|
5587
|
+
[Symbol.iterator]() {
|
|
5588
|
+
return new SingleShotGen3(new YieldWrap(this));
|
|
5589
|
+
}
|
|
5590
|
+
};
|
|
5591
|
+
var isEffect = (u) => hasProperty(u, EffectTypeId2);
|
|
5592
|
+
var withFiberRuntime = (withRuntime) => {
|
|
5593
|
+
const effect = new EffectPrimitive(OP_WITH_RUNTIME);
|
|
5594
|
+
effect.effect_instruction_i0 = withRuntime;
|
|
5595
|
+
return effect;
|
|
5596
|
+
};
|
|
5597
|
+
var originalSymbol = /* @__PURE__ */ Symbol.for("effect/OriginalAnnotation");
|
|
5598
|
+
var capture = (obj, span) => {
|
|
5599
|
+
if (isSome2(span)) {
|
|
5600
|
+
return new Proxy(obj, {
|
|
5601
|
+
has(target, p) {
|
|
5602
|
+
return p === spanSymbol || p === originalSymbol || p in target;
|
|
5603
|
+
},
|
|
5604
|
+
get(target, p) {
|
|
5605
|
+
if (p === spanSymbol) {
|
|
5606
|
+
return span.value;
|
|
5607
|
+
}
|
|
5608
|
+
if (p === originalSymbol) {
|
|
5609
|
+
return obj;
|
|
5610
|
+
}
|
|
5611
|
+
return target[p];
|
|
5612
|
+
}
|
|
5613
|
+
});
|
|
5614
|
+
}
|
|
5615
|
+
return obj;
|
|
5616
|
+
};
|
|
5617
|
+
var fail3 = (error) => isObject(error) && !(spanSymbol in error) ? withFiberRuntime((fiber) => failCause(fail2(capture(error, currentSpanFromFiber(fiber))))) : failCause(fail2(error));
|
|
5618
|
+
var failCause = (cause) => {
|
|
5619
|
+
const effect = new EffectPrimitiveFailure(OP_FAILURE);
|
|
5620
|
+
effect.effect_instruction_i0 = cause;
|
|
5621
|
+
return effect;
|
|
5622
|
+
};
|
|
5623
|
+
var logLevelAll = {
|
|
5624
|
+
_tag: "All",
|
|
5625
|
+
syslog: 0,
|
|
5626
|
+
label: "ALL",
|
|
5627
|
+
ordinal: Number.MIN_SAFE_INTEGER,
|
|
5628
|
+
pipe() {
|
|
5629
|
+
return pipeArguments(this, arguments);
|
|
5630
|
+
}
|
|
5631
|
+
};
|
|
5632
|
+
var logLevelNone = {
|
|
5633
|
+
_tag: "None",
|
|
5634
|
+
syslog: 7,
|
|
5635
|
+
label: "OFF",
|
|
5636
|
+
ordinal: Number.MAX_SAFE_INTEGER,
|
|
5637
|
+
pipe() {
|
|
5638
|
+
return pipeArguments(this, arguments);
|
|
5639
|
+
}
|
|
5640
|
+
};
|
|
5641
|
+
var RequestResolverSymbolKey = "effect/RequestResolver";
|
|
5642
|
+
var RequestResolverTypeId = /* @__PURE__ */ Symbol.for(RequestResolverSymbolKey);
|
|
5643
|
+
var requestResolverVariance = {
|
|
5644
|
+
/* c8 ignore next */
|
|
5645
|
+
_A: (_) => _,
|
|
5646
|
+
/* c8 ignore next */
|
|
5647
|
+
_R: (_) => _
|
|
5648
|
+
};
|
|
5649
|
+
var RequestResolverImpl = class _RequestResolverImpl {
|
|
5650
|
+
runAll;
|
|
5651
|
+
target;
|
|
5652
|
+
[RequestResolverTypeId] = requestResolverVariance;
|
|
5653
|
+
constructor(runAll, target) {
|
|
5654
|
+
this.runAll = runAll;
|
|
5655
|
+
this.target = target;
|
|
5656
|
+
}
|
|
5657
|
+
[symbol]() {
|
|
5658
|
+
return cached(this, this.target ? hash(this.target) : random(this));
|
|
5659
|
+
}
|
|
5660
|
+
[symbol2](that) {
|
|
5661
|
+
return this.target ? isRequestResolver(that) && equals(this.target, that.target) : this === that;
|
|
5662
|
+
}
|
|
5663
|
+
identified(...ids) {
|
|
5664
|
+
return new _RequestResolverImpl(this.runAll, fromIterable2(ids));
|
|
5665
|
+
}
|
|
5666
|
+
pipe() {
|
|
5667
|
+
return pipeArguments(this, arguments);
|
|
5668
|
+
}
|
|
5669
|
+
};
|
|
5670
|
+
var isRequestResolver = (u) => hasProperty(u, RequestResolverTypeId);
|
|
5671
|
+
var YieldableError = /* @__PURE__ */ (function() {
|
|
5672
|
+
class YieldableError2 extends globalThis.Error {
|
|
5673
|
+
commit() {
|
|
5674
|
+
return fail3(this);
|
|
5675
|
+
}
|
|
5676
|
+
toJSON() {
|
|
5677
|
+
const obj = {
|
|
5678
|
+
...this
|
|
5679
|
+
};
|
|
5680
|
+
if (this.message) obj.message = this.message;
|
|
5681
|
+
if (this.cause) obj.cause = this.cause;
|
|
5682
|
+
return obj;
|
|
5683
|
+
}
|
|
5684
|
+
[NodeInspectSymbol]() {
|
|
5685
|
+
if (this.toString !== globalThis.Error.prototype.toString) {
|
|
5686
|
+
return this.stack ? `${this.toString()}
|
|
5687
|
+
${this.stack.split("\n").slice(1).join("\n")}` : this.toString();
|
|
5688
|
+
} else if ("Bun" in globalThis) {
|
|
5689
|
+
return pretty(fail2(this), {
|
|
5690
|
+
renderErrorCause: true
|
|
5691
|
+
});
|
|
5692
|
+
}
|
|
5693
|
+
return this;
|
|
5694
|
+
}
|
|
5695
|
+
}
|
|
5696
|
+
Object.assign(YieldableError2.prototype, StructuralCommitPrototype);
|
|
5697
|
+
return YieldableError2;
|
|
5698
|
+
})();
|
|
5699
|
+
var makeException = (proto2, tag) => {
|
|
5700
|
+
class Base extends YieldableError {
|
|
5701
|
+
_tag = tag;
|
|
5702
|
+
}
|
|
5703
|
+
Object.assign(Base.prototype, proto2);
|
|
5704
|
+
Base.prototype.name = tag;
|
|
5705
|
+
return Base;
|
|
5706
|
+
};
|
|
5707
|
+
var RuntimeExceptionTypeId = /* @__PURE__ */ Symbol.for("effect/Cause/errors/RuntimeException");
|
|
5708
|
+
var RuntimeException = /* @__PURE__ */ makeException({
|
|
5709
|
+
[RuntimeExceptionTypeId]: RuntimeExceptionTypeId
|
|
5710
|
+
}, "RuntimeException");
|
|
5711
|
+
var InterruptedExceptionTypeId = /* @__PURE__ */ Symbol.for("effect/Cause/errors/InterruptedException");
|
|
5712
|
+
var InterruptedException = /* @__PURE__ */ makeException({
|
|
5713
|
+
[InterruptedExceptionTypeId]: InterruptedExceptionTypeId
|
|
5714
|
+
}, "InterruptedException");
|
|
5715
|
+
var IllegalArgumentExceptionTypeId = /* @__PURE__ */ Symbol.for("effect/Cause/errors/IllegalArgument");
|
|
5716
|
+
var IllegalArgumentException = /* @__PURE__ */ makeException({
|
|
5717
|
+
[IllegalArgumentExceptionTypeId]: IllegalArgumentExceptionTypeId
|
|
5718
|
+
}, "IllegalArgumentException");
|
|
5719
|
+
var NoSuchElementExceptionTypeId = /* @__PURE__ */ Symbol.for("effect/Cause/errors/NoSuchElement");
|
|
5720
|
+
var NoSuchElementException = /* @__PURE__ */ makeException({
|
|
5721
|
+
[NoSuchElementExceptionTypeId]: NoSuchElementExceptionTypeId
|
|
5722
|
+
}, "NoSuchElementException");
|
|
5723
|
+
var InvalidPubSubCapacityExceptionTypeId = /* @__PURE__ */ Symbol.for("effect/Cause/errors/InvalidPubSubCapacityException");
|
|
5724
|
+
var InvalidPubSubCapacityException = /* @__PURE__ */ makeException({
|
|
5725
|
+
[InvalidPubSubCapacityExceptionTypeId]: InvalidPubSubCapacityExceptionTypeId
|
|
5726
|
+
}, "InvalidPubSubCapacityException");
|
|
5727
|
+
var ExceededCapacityExceptionTypeId = /* @__PURE__ */ Symbol.for("effect/Cause/errors/ExceededCapacityException");
|
|
5728
|
+
var ExceededCapacityException = /* @__PURE__ */ makeException({
|
|
5729
|
+
[ExceededCapacityExceptionTypeId]: ExceededCapacityExceptionTypeId
|
|
5730
|
+
}, "ExceededCapacityException");
|
|
5731
|
+
var TimeoutExceptionTypeId = /* @__PURE__ */ Symbol.for("effect/Cause/errors/Timeout");
|
|
5732
|
+
var TimeoutException = /* @__PURE__ */ makeException({
|
|
5733
|
+
[TimeoutExceptionTypeId]: TimeoutExceptionTypeId
|
|
5734
|
+
}, "TimeoutException");
|
|
5735
|
+
var exitIsExit = (u) => isEffect(u) && "_tag" in u && (u._tag === "Success" || u._tag === "Failure");
|
|
5736
|
+
var currentSpanFromFiber = (fiber) => {
|
|
5737
|
+
const span = fiber.currentSpan;
|
|
5738
|
+
return span !== void 0 && span._tag === "Span" ? some2(span) : none2();
|
|
5739
|
+
};
|
|
5740
|
+
|
|
5741
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/Data.js
|
|
5742
|
+
var Class2 = Structural;
|
|
5743
|
+
var Error2 = /* @__PURE__ */ (function() {
|
|
5744
|
+
const plainArgsSymbol = /* @__PURE__ */ Symbol.for("effect/Data/Error/plainArgs");
|
|
5745
|
+
const O = {
|
|
5746
|
+
BaseEffectError: class extends YieldableError {
|
|
5747
|
+
constructor(args2) {
|
|
5748
|
+
super(args2?.message, args2?.cause ? {
|
|
5749
|
+
cause: args2.cause
|
|
5750
|
+
} : void 0);
|
|
5751
|
+
if (args2) {
|
|
5752
|
+
Object.assign(this, args2);
|
|
5753
|
+
Object.defineProperty(this, plainArgsSymbol, {
|
|
5754
|
+
value: args2,
|
|
5755
|
+
enumerable: false
|
|
5756
|
+
});
|
|
5757
|
+
}
|
|
5758
|
+
}
|
|
5759
|
+
toJSON() {
|
|
5760
|
+
return {
|
|
5761
|
+
...this[plainArgsSymbol],
|
|
5762
|
+
...this
|
|
5763
|
+
};
|
|
5764
|
+
}
|
|
5765
|
+
}
|
|
5766
|
+
};
|
|
5767
|
+
return O.BaseEffectError;
|
|
5768
|
+
})();
|
|
5769
|
+
var TaggedError = (tag) => {
|
|
5770
|
+
const O = {
|
|
5771
|
+
BaseEffectError: class extends Error2 {
|
|
5772
|
+
_tag = tag;
|
|
5773
|
+
}
|
|
5774
|
+
};
|
|
5775
|
+
O.BaseEffectError.prototype.name = tag;
|
|
5776
|
+
return O.BaseEffectError;
|
|
5777
|
+
};
|
|
5778
|
+
|
|
5779
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/encoding/common.js
|
|
5780
|
+
var encoder = /* @__PURE__ */ new TextEncoder();
|
|
5781
|
+
|
|
5782
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/encoding/base64.js
|
|
5783
|
+
var encode = (bytes) => {
|
|
5784
|
+
const length = bytes.length;
|
|
5785
|
+
let result = "";
|
|
5786
|
+
let i;
|
|
5787
|
+
for (i = 2; i < length; i += 3) {
|
|
5788
|
+
result += base64abc[bytes[i - 2] >> 2];
|
|
5789
|
+
result += base64abc[(bytes[i - 2] & 3) << 4 | bytes[i - 1] >> 4];
|
|
5790
|
+
result += base64abc[(bytes[i - 1] & 15) << 2 | bytes[i] >> 6];
|
|
5791
|
+
result += base64abc[bytes[i] & 63];
|
|
5792
|
+
}
|
|
5793
|
+
if (i === length + 1) {
|
|
5794
|
+
result += base64abc[bytes[i - 2] >> 2];
|
|
5795
|
+
result += base64abc[(bytes[i - 2] & 3) << 4];
|
|
5796
|
+
result += "==";
|
|
5797
|
+
}
|
|
5798
|
+
if (i === length) {
|
|
5799
|
+
result += base64abc[bytes[i - 2] >> 2];
|
|
5800
|
+
result += base64abc[(bytes[i - 2] & 3) << 4 | bytes[i - 1] >> 4];
|
|
5801
|
+
result += base64abc[(bytes[i - 1] & 15) << 2];
|
|
5802
|
+
result += "=";
|
|
5803
|
+
}
|
|
5804
|
+
return result;
|
|
5805
|
+
};
|
|
5806
|
+
var base64abc = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "+", "/"];
|
|
5807
|
+
|
|
5808
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/encoding/base64Url.js
|
|
5809
|
+
var encode2 = (data) => encode(data).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
5810
|
+
|
|
5811
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/Encoding.js
|
|
5812
|
+
var encodeBase64Url = (input) => typeof input === "string" ? encode2(encoder.encode(input)) : encode2(input);
|
|
5813
|
+
|
|
5814
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/Graph.js
|
|
5815
|
+
var TypeId4 = "~effect/Graph";
|
|
5816
|
+
var Edge = class extends Class2 {
|
|
5817
|
+
};
|
|
5818
|
+
var ProtoGraph = {
|
|
5819
|
+
[TypeId4]: TypeId4,
|
|
5820
|
+
[Symbol.iterator]() {
|
|
5821
|
+
return this.nodes[Symbol.iterator]();
|
|
5822
|
+
},
|
|
5823
|
+
[NodeInspectSymbol]() {
|
|
5824
|
+
return this.toJSON();
|
|
5825
|
+
},
|
|
5826
|
+
[symbol2](that) {
|
|
5827
|
+
if (isGraph(that)) {
|
|
5828
|
+
if (this.nodes.size !== that.nodes.size || this.edges.size !== that.edges.size || this.type !== that.type) {
|
|
5829
|
+
return false;
|
|
5830
|
+
}
|
|
5831
|
+
for (const [nodeIndex, nodeData] of this.nodes) {
|
|
5832
|
+
if (!that.nodes.has(nodeIndex)) {
|
|
5833
|
+
return false;
|
|
5834
|
+
}
|
|
5835
|
+
const otherNodeData = that.nodes.get(nodeIndex);
|
|
5836
|
+
if (!equals(nodeData, otherNodeData)) {
|
|
5837
|
+
return false;
|
|
5838
|
+
}
|
|
5839
|
+
}
|
|
5840
|
+
for (const [edgeIndex, edgeData] of this.edges) {
|
|
5841
|
+
if (!that.edges.has(edgeIndex)) {
|
|
5842
|
+
return false;
|
|
5843
|
+
}
|
|
5844
|
+
const otherEdge = that.edges.get(edgeIndex);
|
|
5845
|
+
if (!equals(edgeData, otherEdge)) {
|
|
5846
|
+
return false;
|
|
5847
|
+
}
|
|
5848
|
+
}
|
|
5849
|
+
return true;
|
|
5850
|
+
}
|
|
5851
|
+
return false;
|
|
5852
|
+
},
|
|
5853
|
+
[symbol]() {
|
|
5854
|
+
let hash2 = string("Graph");
|
|
5855
|
+
hash2 = hash2 ^ string(this.type);
|
|
5856
|
+
hash2 = hash2 ^ number(this.nodes.size);
|
|
5857
|
+
hash2 = hash2 ^ number(this.edges.size);
|
|
5858
|
+
for (const [nodeIndex, nodeData] of this.nodes) {
|
|
5859
|
+
hash2 = hash2 ^ hash(nodeIndex) + hash(nodeData);
|
|
5860
|
+
}
|
|
5861
|
+
for (const [edgeIndex, edgeData] of this.edges) {
|
|
5862
|
+
hash2 = hash2 ^ hash(edgeIndex) + hash(edgeData);
|
|
5863
|
+
}
|
|
5864
|
+
return hash2;
|
|
5865
|
+
},
|
|
5866
|
+
toJSON() {
|
|
5867
|
+
return {
|
|
5868
|
+
_id: "Graph",
|
|
5869
|
+
nodeCount: this.nodes.size,
|
|
5870
|
+
edgeCount: this.edges.size,
|
|
5871
|
+
type: this.type
|
|
5872
|
+
};
|
|
5873
|
+
},
|
|
5874
|
+
toString() {
|
|
5875
|
+
return format(this);
|
|
5876
|
+
},
|
|
5877
|
+
pipe() {
|
|
5878
|
+
return pipeArguments(this, arguments);
|
|
5879
|
+
}
|
|
5880
|
+
};
|
|
5881
|
+
var GraphError = class extends (/* @__PURE__ */ TaggedError("GraphError")) {
|
|
5882
|
+
};
|
|
5883
|
+
var missingNode = (node) => new GraphError({
|
|
5884
|
+
message: `Node ${node} does not exist`
|
|
5885
|
+
});
|
|
5886
|
+
var isGraph = (u) => typeof u === "object" && u !== null && TypeId4 in u;
|
|
5887
|
+
var directed = (mutate3) => {
|
|
5888
|
+
const graph = Object.create(ProtoGraph);
|
|
5889
|
+
graph.type = "directed";
|
|
5890
|
+
graph.nodes = /* @__PURE__ */ new Map();
|
|
5891
|
+
graph.edges = /* @__PURE__ */ new Map();
|
|
5892
|
+
graph.adjacency = /* @__PURE__ */ new Map();
|
|
5893
|
+
graph.reverseAdjacency = /* @__PURE__ */ new Map();
|
|
5894
|
+
graph.nextNodeIndex = 0;
|
|
5895
|
+
graph.nextEdgeIndex = 0;
|
|
5896
|
+
graph.isAcyclic = some2(true);
|
|
5897
|
+
graph.mutable = false;
|
|
5898
|
+
if (mutate3) {
|
|
5899
|
+
const mutable = beginMutation3(graph);
|
|
5900
|
+
mutate3(mutable);
|
|
5901
|
+
return endMutation2(mutable);
|
|
5902
|
+
}
|
|
5903
|
+
return graph;
|
|
5904
|
+
};
|
|
5905
|
+
var beginMutation3 = (graph) => {
|
|
5906
|
+
const adjacency = /* @__PURE__ */ new Map();
|
|
5907
|
+
const reverseAdjacency = /* @__PURE__ */ new Map();
|
|
5908
|
+
for (const [nodeIndex, edges2] of graph.adjacency) {
|
|
5909
|
+
adjacency.set(nodeIndex, [...edges2]);
|
|
5910
|
+
}
|
|
5911
|
+
for (const [nodeIndex, edges2] of graph.reverseAdjacency) {
|
|
5912
|
+
reverseAdjacency.set(nodeIndex, [...edges2]);
|
|
5913
|
+
}
|
|
5914
|
+
const mutable = Object.create(ProtoGraph);
|
|
5915
|
+
mutable.type = graph.type;
|
|
5916
|
+
mutable.nodes = new Map(graph.nodes);
|
|
5917
|
+
mutable.edges = new Map(graph.edges);
|
|
5918
|
+
mutable.adjacency = adjacency;
|
|
5919
|
+
mutable.reverseAdjacency = reverseAdjacency;
|
|
5920
|
+
mutable.nextNodeIndex = graph.nextNodeIndex;
|
|
5921
|
+
mutable.nextEdgeIndex = graph.nextEdgeIndex;
|
|
5922
|
+
mutable.isAcyclic = graph.isAcyclic;
|
|
5923
|
+
mutable.mutable = true;
|
|
5924
|
+
return mutable;
|
|
5925
|
+
};
|
|
5926
|
+
var endMutation2 = (mutable) => {
|
|
5927
|
+
const graph = Object.create(ProtoGraph);
|
|
5928
|
+
graph.type = mutable.type;
|
|
5929
|
+
graph.nodes = new Map(mutable.nodes);
|
|
5930
|
+
graph.edges = new Map(mutable.edges);
|
|
5931
|
+
graph.adjacency = mutable.adjacency;
|
|
5932
|
+
graph.reverseAdjacency = mutable.reverseAdjacency;
|
|
5933
|
+
graph.nextNodeIndex = mutable.nextNodeIndex;
|
|
5934
|
+
graph.nextEdgeIndex = mutable.nextEdgeIndex;
|
|
5935
|
+
graph.isAcyclic = mutable.isAcyclic;
|
|
5936
|
+
graph.mutable = false;
|
|
5937
|
+
return graph;
|
|
5938
|
+
};
|
|
5939
|
+
var mutate2 = /* @__PURE__ */ dual(2, (graph, f) => {
|
|
5940
|
+
const mutable = beginMutation3(graph);
|
|
5941
|
+
f(mutable);
|
|
5942
|
+
return endMutation2(mutable);
|
|
5943
|
+
});
|
|
5944
|
+
var addNode = (mutable, data) => {
|
|
5945
|
+
const nodeIndex = mutable.nextNodeIndex;
|
|
5946
|
+
mutable.nodes.set(nodeIndex, data);
|
|
5947
|
+
mutable.adjacency.set(nodeIndex, []);
|
|
5948
|
+
mutable.reverseAdjacency.set(nodeIndex, []);
|
|
5949
|
+
mutable.nextNodeIndex = mutable.nextNodeIndex + 1;
|
|
5950
|
+
return nodeIndex;
|
|
5951
|
+
};
|
|
5952
|
+
var getNode = (graph, nodeIndex) => graph.nodes.has(nodeIndex) ? some2(graph.nodes.get(nodeIndex)) : none2();
|
|
5953
|
+
var hasNode = (graph, nodeIndex) => graph.nodes.has(nodeIndex);
|
|
5954
|
+
var nodeCount = (graph) => graph.nodes.size;
|
|
5955
|
+
var reverse3 = (mutable) => {
|
|
5956
|
+
for (const [index, edgeData] of mutable.edges) {
|
|
5957
|
+
mutable.edges.set(index, {
|
|
5958
|
+
source: edgeData.target,
|
|
5959
|
+
target: edgeData.source,
|
|
5960
|
+
data: edgeData.data
|
|
5961
|
+
});
|
|
5962
|
+
}
|
|
5963
|
+
mutable.adjacency.clear();
|
|
5964
|
+
mutable.reverseAdjacency.clear();
|
|
5965
|
+
for (const [edgeIndex, edgeData] of mutable.edges) {
|
|
5966
|
+
const sourceEdges = mutable.adjacency.get(edgeData.source) || [];
|
|
5967
|
+
sourceEdges.push(edgeIndex);
|
|
5968
|
+
mutable.adjacency.set(edgeData.source, sourceEdges);
|
|
5969
|
+
const targetEdges = mutable.reverseAdjacency.get(edgeData.target) || [];
|
|
5970
|
+
targetEdges.push(edgeIndex);
|
|
5971
|
+
mutable.reverseAdjacency.set(edgeData.target, targetEdges);
|
|
5972
|
+
}
|
|
5973
|
+
mutable.isAcyclic = none2();
|
|
5974
|
+
};
|
|
5975
|
+
var invalidateCycleFlagOnRemoval = (mutable) => {
|
|
5976
|
+
if (isSome2(mutable.isAcyclic) && mutable.isAcyclic.value === false) {
|
|
5977
|
+
mutable.isAcyclic = none2();
|
|
5978
|
+
}
|
|
5979
|
+
};
|
|
5980
|
+
var invalidateCycleFlagOnAddition = (mutable) => {
|
|
5981
|
+
if (isSome2(mutable.isAcyclic) && mutable.isAcyclic.value === true) {
|
|
5982
|
+
mutable.isAcyclic = none2();
|
|
5983
|
+
}
|
|
5984
|
+
};
|
|
5985
|
+
var addEdge = (mutable, source, target, data) => {
|
|
5986
|
+
if (!mutable.nodes.has(source)) {
|
|
5987
|
+
throw missingNode(source);
|
|
5988
|
+
}
|
|
5989
|
+
if (!mutable.nodes.has(target)) {
|
|
5990
|
+
throw missingNode(target);
|
|
5991
|
+
}
|
|
5992
|
+
const edgeIndex = mutable.nextEdgeIndex;
|
|
5993
|
+
const edgeData = new Edge({
|
|
5994
|
+
source,
|
|
5995
|
+
target,
|
|
5996
|
+
data
|
|
5997
|
+
});
|
|
5998
|
+
mutable.edges.set(edgeIndex, edgeData);
|
|
5999
|
+
const sourceAdjacency = mutable.adjacency.get(source);
|
|
6000
|
+
if (sourceAdjacency !== void 0) {
|
|
6001
|
+
sourceAdjacency.push(edgeIndex);
|
|
6002
|
+
}
|
|
6003
|
+
const targetReverseAdjacency = mutable.reverseAdjacency.get(target);
|
|
6004
|
+
if (targetReverseAdjacency !== void 0) {
|
|
6005
|
+
targetReverseAdjacency.push(edgeIndex);
|
|
6006
|
+
}
|
|
6007
|
+
if (mutable.type === "undirected") {
|
|
6008
|
+
const targetAdjacency = mutable.adjacency.get(target);
|
|
6009
|
+
if (targetAdjacency !== void 0) {
|
|
6010
|
+
targetAdjacency.push(edgeIndex);
|
|
6011
|
+
}
|
|
6012
|
+
const sourceReverseAdjacency = mutable.reverseAdjacency.get(source);
|
|
6013
|
+
if (sourceReverseAdjacency !== void 0) {
|
|
6014
|
+
sourceReverseAdjacency.push(edgeIndex);
|
|
6015
|
+
}
|
|
6016
|
+
}
|
|
6017
|
+
mutable.nextEdgeIndex = mutable.nextEdgeIndex + 1;
|
|
6018
|
+
invalidateCycleFlagOnAddition(mutable);
|
|
6019
|
+
return edgeIndex;
|
|
6020
|
+
};
|
|
6021
|
+
var removeNode = (mutable, nodeIndex) => {
|
|
6022
|
+
if (!mutable.nodes.has(nodeIndex)) {
|
|
6023
|
+
return;
|
|
6024
|
+
}
|
|
6025
|
+
const edgesToRemove = [];
|
|
6026
|
+
const outgoingEdges = mutable.adjacency.get(nodeIndex);
|
|
6027
|
+
if (outgoingEdges !== void 0) {
|
|
6028
|
+
for (const edge of outgoingEdges) {
|
|
6029
|
+
edgesToRemove.push(edge);
|
|
6030
|
+
}
|
|
6031
|
+
}
|
|
6032
|
+
const incomingEdges = mutable.reverseAdjacency.get(nodeIndex);
|
|
6033
|
+
if (incomingEdges !== void 0) {
|
|
6034
|
+
for (const edge of incomingEdges) {
|
|
6035
|
+
edgesToRemove.push(edge);
|
|
6036
|
+
}
|
|
6037
|
+
}
|
|
6038
|
+
for (const edgeIndex of edgesToRemove) {
|
|
6039
|
+
removeEdgeInternal(mutable, edgeIndex);
|
|
6040
|
+
}
|
|
6041
|
+
mutable.nodes.delete(nodeIndex);
|
|
6042
|
+
mutable.adjacency.delete(nodeIndex);
|
|
6043
|
+
mutable.reverseAdjacency.delete(nodeIndex);
|
|
6044
|
+
invalidateCycleFlagOnRemoval(mutable);
|
|
6045
|
+
};
|
|
6046
|
+
var removeEdgeInternal = (mutable, edgeIndex) => {
|
|
6047
|
+
const edge = mutable.edges.get(edgeIndex);
|
|
6048
|
+
if (edge === void 0) {
|
|
6049
|
+
return false;
|
|
6050
|
+
}
|
|
6051
|
+
const {
|
|
6052
|
+
source,
|
|
6053
|
+
target
|
|
6054
|
+
} = edge;
|
|
6055
|
+
const sourceAdjacency = mutable.adjacency.get(source);
|
|
6056
|
+
if (sourceAdjacency !== void 0) {
|
|
6057
|
+
const index = sourceAdjacency.indexOf(edgeIndex);
|
|
6058
|
+
if (index !== -1) {
|
|
6059
|
+
sourceAdjacency.splice(index, 1);
|
|
6060
|
+
}
|
|
6061
|
+
}
|
|
6062
|
+
const targetReverseAdjacency = mutable.reverseAdjacency.get(target);
|
|
6063
|
+
if (targetReverseAdjacency !== void 0) {
|
|
6064
|
+
const index = targetReverseAdjacency.indexOf(edgeIndex);
|
|
6065
|
+
if (index !== -1) {
|
|
6066
|
+
targetReverseAdjacency.splice(index, 1);
|
|
6067
|
+
}
|
|
6068
|
+
}
|
|
6069
|
+
if (mutable.type === "undirected") {
|
|
6070
|
+
const targetAdjacency = mutable.adjacency.get(target);
|
|
6071
|
+
if (targetAdjacency !== void 0) {
|
|
6072
|
+
const index = targetAdjacency.indexOf(edgeIndex);
|
|
6073
|
+
if (index !== -1) {
|
|
6074
|
+
targetAdjacency.splice(index, 1);
|
|
6075
|
+
}
|
|
6076
|
+
}
|
|
6077
|
+
const sourceReverseAdjacency = mutable.reverseAdjacency.get(source);
|
|
6078
|
+
if (sourceReverseAdjacency !== void 0) {
|
|
6079
|
+
const index = sourceReverseAdjacency.indexOf(edgeIndex);
|
|
6080
|
+
if (index !== -1) {
|
|
6081
|
+
sourceReverseAdjacency.splice(index, 1);
|
|
6082
|
+
}
|
|
6083
|
+
}
|
|
6084
|
+
}
|
|
6085
|
+
mutable.edges.delete(edgeIndex);
|
|
6086
|
+
return true;
|
|
6087
|
+
};
|
|
6088
|
+
var neighborsDirected = (graph, nodeIndex, direction) => {
|
|
6089
|
+
const adjacencyMap = direction === "incoming" ? graph.reverseAdjacency : graph.adjacency;
|
|
6090
|
+
const adjacencyList = adjacencyMap.get(nodeIndex);
|
|
6091
|
+
if (adjacencyList === void 0) {
|
|
6092
|
+
return [];
|
|
6093
|
+
}
|
|
6094
|
+
const result = [];
|
|
6095
|
+
for (const edgeIndex of adjacencyList) {
|
|
6096
|
+
const edge = graph.edges.get(edgeIndex);
|
|
6097
|
+
if (edge !== void 0) {
|
|
6098
|
+
const neighborNode = direction === "incoming" ? edge.source : edge.target;
|
|
6099
|
+
result.push(neighborNode);
|
|
6100
|
+
}
|
|
6101
|
+
}
|
|
6102
|
+
return result;
|
|
6103
|
+
};
|
|
6104
|
+
var escapeMermaidLabel = (label) => {
|
|
6105
|
+
return label.replace(/#/g, "#35;").replace(/"/g, "#quot;").replace(/</g, "#lt;").replace(/>/g, "#gt;").replace(/&/g, "#amp;").replace(/\[/g, "#91;").replace(/\]/g, "#93;").replace(/\{/g, "#123;").replace(/\}/g, "#125;").replace(/\(/g, "#40;").replace(/\)/g, "#41;").replace(/\|/g, "#124;").replace(/\\/g, "#92;").replace(/\n/g, "<br/>");
|
|
6106
|
+
};
|
|
6107
|
+
var formatMermaidNode = (nodeId, label, shape) => {
|
|
6108
|
+
switch (shape) {
|
|
6109
|
+
case "rectangle":
|
|
6110
|
+
return `${nodeId}["${label}"]`;
|
|
6111
|
+
case "rounded":
|
|
6112
|
+
return `${nodeId}("${label}")`;
|
|
6113
|
+
case "circle":
|
|
6114
|
+
return `${nodeId}(("${label}"))`;
|
|
6115
|
+
case "diamond":
|
|
6116
|
+
return `${nodeId}{"${label}"}`;
|
|
6117
|
+
case "hexagon":
|
|
6118
|
+
return `${nodeId}{{"${label}"}}`;
|
|
6119
|
+
case "stadium":
|
|
6120
|
+
return `${nodeId}(["${label}"])`;
|
|
6121
|
+
case "subroutine":
|
|
6122
|
+
return `${nodeId}[["${label}"]]`;
|
|
6123
|
+
case "cylindrical":
|
|
6124
|
+
return `${nodeId}[("${label}")]`;
|
|
6125
|
+
}
|
|
6126
|
+
};
|
|
6127
|
+
var toMermaid = (graph, options) => {
|
|
6128
|
+
const {
|
|
6129
|
+
diagramType,
|
|
6130
|
+
direction = "TD",
|
|
6131
|
+
edgeLabel = (data) => String(data),
|
|
6132
|
+
nodeLabel = (data) => String(data),
|
|
6133
|
+
nodeShape = () => "rectangle"
|
|
6134
|
+
} = options ?? {};
|
|
6135
|
+
const finalDiagramType = diagramType ?? (graph.type === "directed" ? "flowchart" : "graph");
|
|
6136
|
+
const lines = [];
|
|
6137
|
+
lines.push(`${finalDiagramType} ${direction}`);
|
|
6138
|
+
for (const [nodeIndex, nodeData] of graph.nodes) {
|
|
6139
|
+
const nodeId = String(nodeIndex);
|
|
6140
|
+
const label = escapeMermaidLabel(nodeLabel(nodeData));
|
|
6141
|
+
const shape = nodeShape(nodeData);
|
|
6142
|
+
const formattedNode = formatMermaidNode(nodeId, label, shape);
|
|
6143
|
+
lines.push(` ${formattedNode}`);
|
|
6144
|
+
}
|
|
6145
|
+
const edgeOperator = finalDiagramType === "flowchart" ? "-->" : "---";
|
|
6146
|
+
for (const [, edgeData] of graph.edges) {
|
|
6147
|
+
const sourceId = String(edgeData.source);
|
|
6148
|
+
const targetId = String(edgeData.target);
|
|
6149
|
+
const label = escapeMermaidLabel(edgeLabel(edgeData.data));
|
|
6150
|
+
if (label) {
|
|
6151
|
+
lines.push(` ${sourceId} ${edgeOperator}|"${label}"| ${targetId}`);
|
|
6152
|
+
} else {
|
|
6153
|
+
lines.push(` ${sourceId} ${edgeOperator} ${targetId}`);
|
|
6154
|
+
}
|
|
6155
|
+
}
|
|
6156
|
+
return lines.join("\n");
|
|
6157
|
+
};
|
|
6158
|
+
var Walker = class {
|
|
6159
|
+
// @ts-ignore
|
|
6160
|
+
[Symbol.iterator];
|
|
6161
|
+
/**
|
|
6162
|
+
* Visits each element and maps it to a value using the provided function.
|
|
6163
|
+
*
|
|
6164
|
+
* Takes a function that receives the index and data,
|
|
6165
|
+
* and returns an iterable of the mapped values. Skips elements that
|
|
6166
|
+
* no longer exist in the graph.
|
|
6167
|
+
*
|
|
6168
|
+
* @example
|
|
6169
|
+
* ```ts
|
|
6170
|
+
* import { Graph } from "effect"
|
|
6171
|
+
*
|
|
6172
|
+
* const graph = Graph.directed<string, number>((mutable) => {
|
|
6173
|
+
* const a = Graph.addNode(mutable, "A")
|
|
6174
|
+
* const b = Graph.addNode(mutable, "B")
|
|
6175
|
+
* Graph.addEdge(mutable, a, b, 1)
|
|
6176
|
+
* })
|
|
6177
|
+
*
|
|
6178
|
+
* const dfs = Graph.dfs(graph, { start: [0] })
|
|
6179
|
+
*
|
|
6180
|
+
* // Map to just the node data
|
|
6181
|
+
* const values = Array.from(dfs.visit((index, data) => data))
|
|
6182
|
+
* console.log(values) // ["A", "B"]
|
|
6183
|
+
*
|
|
6184
|
+
* // Map to custom objects
|
|
6185
|
+
* const custom = Array.from(dfs.visit((index, data) => ({ id: index, name: data })))
|
|
6186
|
+
* console.log(custom) // [{ id: 0, name: "A" }, { id: 1, name: "B" }]
|
|
6187
|
+
* ```
|
|
6188
|
+
*
|
|
6189
|
+
* @since 3.18.0
|
|
6190
|
+
* @category iterators
|
|
6191
|
+
*/
|
|
6192
|
+
visit;
|
|
6193
|
+
constructor(visit) {
|
|
6194
|
+
this.visit = visit;
|
|
6195
|
+
this[Symbol.iterator] = visit((index, data) => [index, data])[Symbol.iterator];
|
|
6196
|
+
}
|
|
6197
|
+
};
|
|
6198
|
+
var indices = (walker) => walker.visit((index, _) => index);
|
|
6199
|
+
var values2 = (walker) => walker.visit((_, data) => data);
|
|
6200
|
+
var entries = (walker) => walker.visit((index, data) => [index, data]);
|
|
6201
|
+
var dfsPostOrder = (graph, config = {}) => {
|
|
6202
|
+
const start = config.start ?? [];
|
|
6203
|
+
const direction = config.direction ?? "outgoing";
|
|
6204
|
+
for (const nodeIndex of start) {
|
|
6205
|
+
if (!hasNode(graph, nodeIndex)) {
|
|
6206
|
+
throw missingNode(nodeIndex);
|
|
6207
|
+
}
|
|
6208
|
+
}
|
|
6209
|
+
return new Walker((f) => ({
|
|
6210
|
+
[Symbol.iterator]: () => {
|
|
6211
|
+
const stack = [];
|
|
6212
|
+
const discovered = /* @__PURE__ */ new Set();
|
|
6213
|
+
const finished = /* @__PURE__ */ new Set();
|
|
6214
|
+
for (let i = start.length - 1; i >= 0; i--) {
|
|
6215
|
+
stack.push({
|
|
6216
|
+
node: start[i],
|
|
6217
|
+
visitedChildren: false
|
|
6218
|
+
});
|
|
6219
|
+
}
|
|
6220
|
+
const nextMapped = () => {
|
|
6221
|
+
while (stack.length > 0) {
|
|
6222
|
+
const current = stack[stack.length - 1];
|
|
6223
|
+
if (!discovered.has(current.node)) {
|
|
6224
|
+
discovered.add(current.node);
|
|
6225
|
+
current.visitedChildren = false;
|
|
6226
|
+
}
|
|
6227
|
+
if (!current.visitedChildren) {
|
|
6228
|
+
current.visitedChildren = true;
|
|
6229
|
+
const neighbors = neighborsDirected(graph, current.node, direction);
|
|
6230
|
+
for (let i = neighbors.length - 1; i >= 0; i--) {
|
|
6231
|
+
const neighbor = neighbors[i];
|
|
6232
|
+
if (!discovered.has(neighbor) && !finished.has(neighbor)) {
|
|
6233
|
+
stack.push({
|
|
6234
|
+
node: neighbor,
|
|
6235
|
+
visitedChildren: false
|
|
6236
|
+
});
|
|
6237
|
+
}
|
|
6238
|
+
}
|
|
6239
|
+
} else {
|
|
6240
|
+
const nodeToEmit = stack.pop().node;
|
|
6241
|
+
if (!finished.has(nodeToEmit)) {
|
|
6242
|
+
finished.add(nodeToEmit);
|
|
6243
|
+
const nodeData = getNode(graph, nodeToEmit);
|
|
6244
|
+
if (isSome2(nodeData)) {
|
|
6245
|
+
return {
|
|
6246
|
+
done: false,
|
|
6247
|
+
value: f(nodeToEmit, nodeData.value)
|
|
6248
|
+
};
|
|
6249
|
+
}
|
|
6250
|
+
return nextMapped();
|
|
6251
|
+
}
|
|
6252
|
+
}
|
|
6253
|
+
}
|
|
6254
|
+
return {
|
|
6255
|
+
done: true,
|
|
6256
|
+
value: void 0
|
|
6257
|
+
};
|
|
6258
|
+
};
|
|
6259
|
+
return {
|
|
6260
|
+
next: nextMapped
|
|
6261
|
+
};
|
|
6262
|
+
}
|
|
6263
|
+
}));
|
|
6264
|
+
};
|
|
6265
|
+
var nodes = (graph) => new Walker((f) => ({
|
|
6266
|
+
[Symbol.iterator]() {
|
|
6267
|
+
const nodeMap = graph.nodes;
|
|
6268
|
+
const iterator = nodeMap.entries();
|
|
6269
|
+
return {
|
|
6270
|
+
next() {
|
|
6271
|
+
const result = iterator.next();
|
|
6272
|
+
if (result.done) {
|
|
6273
|
+
return {
|
|
6274
|
+
done: true,
|
|
6275
|
+
value: void 0
|
|
6276
|
+
};
|
|
6277
|
+
}
|
|
6278
|
+
const [nodeIndex, nodeData] = result.value;
|
|
6279
|
+
return {
|
|
6280
|
+
done: false,
|
|
6281
|
+
value: f(nodeIndex, nodeData)
|
|
6282
|
+
};
|
|
6283
|
+
}
|
|
6284
|
+
};
|
|
6285
|
+
}
|
|
6286
|
+
}));
|
|
6287
|
+
var edges = (graph) => new Walker((f) => ({
|
|
6288
|
+
[Symbol.iterator]() {
|
|
6289
|
+
const edgeMap = graph.edges;
|
|
6290
|
+
const iterator = edgeMap.entries();
|
|
6291
|
+
return {
|
|
6292
|
+
next() {
|
|
6293
|
+
const result = iterator.next();
|
|
6294
|
+
if (result.done) {
|
|
6295
|
+
return {
|
|
6296
|
+
done: true,
|
|
6297
|
+
value: void 0
|
|
6298
|
+
};
|
|
6299
|
+
}
|
|
6300
|
+
const [edgeIndex, edgeData] = result.value;
|
|
6301
|
+
return {
|
|
6302
|
+
done: false,
|
|
6303
|
+
value: f(edgeIndex, edgeData)
|
|
6304
|
+
};
|
|
6305
|
+
}
|
|
6306
|
+
};
|
|
4070
6307
|
}
|
|
4071
|
-
|
|
6308
|
+
}));
|
|
6309
|
+
var externals = (graph, config = {}) => {
|
|
6310
|
+
const direction = config.direction ?? "outgoing";
|
|
6311
|
+
return new Walker((f) => ({
|
|
6312
|
+
[Symbol.iterator]: () => {
|
|
6313
|
+
const nodeMap = graph.nodes;
|
|
6314
|
+
const adjacencyMap = direction === "incoming" ? graph.reverseAdjacency : graph.adjacency;
|
|
6315
|
+
const nodeIterator = nodeMap.entries();
|
|
6316
|
+
const nextMapped = () => {
|
|
6317
|
+
let current = nodeIterator.next();
|
|
6318
|
+
while (!current.done) {
|
|
6319
|
+
const [nodeIndex, nodeData] = current.value;
|
|
6320
|
+
const adjacencyList = adjacencyMap.get(nodeIndex);
|
|
6321
|
+
if (adjacencyList === void 0 || adjacencyList.length === 0) {
|
|
6322
|
+
return {
|
|
6323
|
+
done: false,
|
|
6324
|
+
value: f(nodeIndex, nodeData)
|
|
6325
|
+
};
|
|
6326
|
+
}
|
|
6327
|
+
current = nodeIterator.next();
|
|
6328
|
+
}
|
|
6329
|
+
return {
|
|
6330
|
+
done: true,
|
|
6331
|
+
value: void 0
|
|
6332
|
+
};
|
|
6333
|
+
};
|
|
6334
|
+
return {
|
|
6335
|
+
next: nextMapped
|
|
6336
|
+
};
|
|
6337
|
+
}
|
|
6338
|
+
}));
|
|
4072
6339
|
};
|
|
4073
|
-
var base64abc = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "+", "/"];
|
|
4074
|
-
|
|
4075
|
-
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/internal/encoding/base64Url.js
|
|
4076
|
-
var encode2 = (data) => encode(data).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
4077
|
-
|
|
4078
|
-
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Encoding.js
|
|
4079
|
-
var encodeBase64Url = (input) => typeof input === "string" ? encode2(encoder.encode(input)) : encode2(input);
|
|
4080
6340
|
|
|
4081
6341
|
// src/diagnostics/classSelfMismatch.ts
|
|
4082
6342
|
var classSelfMismatch = createDiagnostic({
|
|
@@ -4368,8 +6628,8 @@ var effectInVoidSuccess = createDiagnostic({
|
|
|
4368
6628
|
}
|
|
4369
6629
|
return yield* fail(typeParserIssue("expectedEffect success is not void"));
|
|
4370
6630
|
});
|
|
4371
|
-
const
|
|
4372
|
-
for (const [node, expectedType, valueNode, realType] of
|
|
6631
|
+
const entries2 = typeCheckerUtils.expectedAndRealType(sourceFile);
|
|
6632
|
+
for (const [node, expectedType, valueNode, realType] of entries2) {
|
|
4373
6633
|
if (expectedType !== realType) {
|
|
4374
6634
|
yield* pipe(
|
|
4375
6635
|
checkForEffectInVoid(
|
|
@@ -4789,8 +7049,8 @@ var missingEffectContext = createDiagnostic({
|
|
|
4789
7049
|
)
|
|
4790
7050
|
);
|
|
4791
7051
|
const sortTypes = sort(typeCheckerUtils.deterministicTypeOrder);
|
|
4792
|
-
const
|
|
4793
|
-
for (const [node, expectedType, valueNode, realType] of
|
|
7052
|
+
const entries2 = getEffectLspPatchSourceFileMetadata(sourceFile)?.relationErrors || typeCheckerUtils.expectedAndRealType(sourceFile);
|
|
7053
|
+
for (const [node, expectedType, valueNode, realType] of entries2) {
|
|
4794
7054
|
if (expectedType !== realType) {
|
|
4795
7055
|
yield* pipe(
|
|
4796
7056
|
checkForMissingContextTypes(
|
|
@@ -4855,8 +7115,8 @@ var missingEffectError = createDiagnostic({
|
|
|
4855
7115
|
)
|
|
4856
7116
|
);
|
|
4857
7117
|
const sortTypes = sort(typeCheckerUtils.deterministicTypeOrder);
|
|
4858
|
-
const
|
|
4859
|
-
for (const [node, expectedType, valueNode, realType] of
|
|
7118
|
+
const entries2 = getEffectLspPatchSourceFileMetadata(sourceFile)?.relationErrors || typeCheckerUtils.expectedAndRealType(sourceFile);
|
|
7119
|
+
for (const [node, expectedType, valueNode, realType] of entries2) {
|
|
4860
7120
|
if (expectedType !== realType) {
|
|
4861
7121
|
yield* pipe(
|
|
4862
7122
|
checkForMissingErrorTypes(
|
|
@@ -5620,9 +7880,9 @@ var scopeInLayerEffect = createDiagnostic({
|
|
|
5620
7880
|
return { methodIdentifier };
|
|
5621
7881
|
}
|
|
5622
7882
|
const reportIfLayerRequireScope = (type, node, methodIdentifier) => {
|
|
5623
|
-
const
|
|
7883
|
+
const entries2 = typeCheckerUtils.unrollUnionMembers(type);
|
|
5624
7884
|
return pipe(
|
|
5625
|
-
firstSuccessOf(
|
|
7885
|
+
firstSuccessOf(entries2.map((type2) => typeParser.scopeType(type2, node))),
|
|
5626
7886
|
map5(
|
|
5627
7887
|
() => report({
|
|
5628
7888
|
location: node,
|
|
@@ -5703,29 +7963,29 @@ var strictBooleanExpressions = createDiagnostic({
|
|
|
5703
7963
|
while (nodeToVisit.length > 0) {
|
|
5704
7964
|
const node = nodeToVisit.shift();
|
|
5705
7965
|
ts.forEachChild(node, appendNodeToVisit);
|
|
5706
|
-
const
|
|
7966
|
+
const nodes2 = [];
|
|
5707
7967
|
if (ts.isIfStatement(node)) {
|
|
5708
7968
|
conditionChecks.set(node, true);
|
|
5709
|
-
|
|
7969
|
+
nodes2.push(node.expression);
|
|
5710
7970
|
} else if (ts.isWhileStatement(node)) {
|
|
5711
7971
|
conditionChecks.set(node, true);
|
|
5712
|
-
|
|
7972
|
+
nodes2.push(node.expression);
|
|
5713
7973
|
} else if (ts.isConditionalExpression(node)) {
|
|
5714
7974
|
conditionChecks.set(node, true);
|
|
5715
|
-
|
|
7975
|
+
nodes2.push(node.condition);
|
|
5716
7976
|
} else if (ts.isPrefixUnaryExpression(node) && node.operator === ts.SyntaxKind.ExclamationToken) {
|
|
5717
7977
|
conditionChecks.set(node, true);
|
|
5718
|
-
|
|
7978
|
+
nodes2.push(node.operand);
|
|
5719
7979
|
} else if (ts.isBinaryExpression(node) && node.operatorToken.kind === ts.SyntaxKind.BarBarToken) {
|
|
5720
7980
|
if (conditionChecks.has(node.parent)) conditionChecks.set(node, true);
|
|
5721
|
-
|
|
5722
|
-
|
|
7981
|
+
nodes2.push(node.left);
|
|
7982
|
+
nodes2.push(node.right);
|
|
5723
7983
|
} else if (ts.isBinaryExpression(node) && node.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken) {
|
|
5724
7984
|
if (conditionChecks.has(node.parent)) conditionChecks.set(node, true);
|
|
5725
|
-
|
|
5726
|
-
|
|
7985
|
+
nodes2.push(node.left);
|
|
7986
|
+
nodes2.push(node.right);
|
|
5727
7987
|
}
|
|
5728
|
-
for (const nodeToCheck of
|
|
7988
|
+
for (const nodeToCheck of nodes2) {
|
|
5729
7989
|
if (!nodeToCheck) continue;
|
|
5730
7990
|
if (!conditionChecks.has(nodeToCheck.parent)) continue;
|
|
5731
7991
|
const nodeType = typeChecker.getTypeAtLocation(nodeToCheck);
|
|
@@ -5769,7 +8029,7 @@ var tryCatchInEffectGen = createDiagnostic({
|
|
|
5769
8029
|
while (nodeToVisit.length > 0) {
|
|
5770
8030
|
const node = nodeToVisit.shift();
|
|
5771
8031
|
ts.forEachChild(node, appendNodeToVisit);
|
|
5772
|
-
if (ts.isTryStatement(node)) {
|
|
8032
|
+
if (ts.isTryStatement(node) && node.catchClause) {
|
|
5773
8033
|
const generatorOrRegularFunction = ts.findAncestor(
|
|
5774
8034
|
node,
|
|
5775
8035
|
(_) => ts.isFunctionExpression(_) || ts.isFunctionDeclaration(_) || ts.isMethodDeclaration(_) || ts.isArrowFunction(_) || ts.isGetAccessor(_) || ts.isFunctionLike(_)
|
|
@@ -6050,9 +8310,9 @@ var effectDiagnosticsComment = createCompletion({
|
|
|
6050
8310
|
apply: fn("effectDiagnosticsComment")(function* (sourceFile, position) {
|
|
6051
8311
|
const ts = yield* service(TypeScriptApi);
|
|
6052
8312
|
const sourceText = sourceFile.text;
|
|
6053
|
-
const
|
|
6054
|
-
if (
|
|
6055
|
-
const lastIndex =
|
|
8313
|
+
const match3 = /(\/\/|\/\*(?:\*?))\s*(@)\s*$/id.exec(sourceText.substring(0, position));
|
|
8314
|
+
if (match3 && match3.indices) {
|
|
8315
|
+
const lastIndex = match3.indices[2][0];
|
|
6056
8316
|
const replacementSpan = {
|
|
6057
8317
|
start: lastIndex,
|
|
6058
8318
|
length: Math.max(0, position - lastIndex)
|
|
@@ -6083,9 +8343,9 @@ var effectJsdocComment = createCompletion({
|
|
|
6083
8343
|
apply: fn("effectJsdocComment")(function* (sourceFile, position) {
|
|
6084
8344
|
const ts = yield* service(TypeScriptApi);
|
|
6085
8345
|
const sourceText = sourceFile.text;
|
|
6086
|
-
const
|
|
6087
|
-
if (
|
|
6088
|
-
const lastIndex =
|
|
8346
|
+
const match3 = /(\/\/|\/\*(?:\*?))\s*(@)\s*$/id.exec(sourceText.substring(0, position));
|
|
8347
|
+
if (match3 && match3.indices) {
|
|
8348
|
+
const lastIndex = match3.indices[2][0];
|
|
6089
8349
|
const replacementSpan = {
|
|
6090
8350
|
start: lastIndex,
|
|
6091
8351
|
length: Math.max(0, position - lastIndex)
|
|
@@ -8080,10 +10340,10 @@ var putShortMSB = (s, b) => {
|
|
|
8080
10340
|
s.pending_buf[s.pending++] = b >>> 8 & 255;
|
|
8081
10341
|
s.pending_buf[s.pending++] = b & 255;
|
|
8082
10342
|
};
|
|
8083
|
-
var read_buf = (strm, buf, start,
|
|
10343
|
+
var read_buf = (strm, buf, start, size4) => {
|
|
8084
10344
|
let len = strm.avail_in;
|
|
8085
|
-
if (len >
|
|
8086
|
-
len =
|
|
10345
|
+
if (len > size4) {
|
|
10346
|
+
len = size4;
|
|
8087
10347
|
}
|
|
8088
10348
|
if (len === 0) {
|
|
8089
10349
|
return 0;
|
|
@@ -8102,7 +10362,7 @@ var read_buf = (strm, buf, start, size) => {
|
|
|
8102
10362
|
var longest_match = (s, cur_match) => {
|
|
8103
10363
|
let chain_length = s.max_chain_length;
|
|
8104
10364
|
let scan = s.strstart;
|
|
8105
|
-
let
|
|
10365
|
+
let match3;
|
|
8106
10366
|
let len;
|
|
8107
10367
|
let best_len = s.prev_length;
|
|
8108
10368
|
let nice_match = s.nice_match;
|
|
@@ -8120,14 +10380,14 @@ var longest_match = (s, cur_match) => {
|
|
|
8120
10380
|
nice_match = s.lookahead;
|
|
8121
10381
|
}
|
|
8122
10382
|
do {
|
|
8123
|
-
|
|
8124
|
-
if (_win[
|
|
10383
|
+
match3 = cur_match;
|
|
10384
|
+
if (_win[match3 + best_len] !== scan_end || _win[match3 + best_len - 1] !== scan_end1 || _win[match3] !== _win[scan] || _win[++match3] !== _win[scan + 1]) {
|
|
8125
10385
|
continue;
|
|
8126
10386
|
}
|
|
8127
10387
|
scan += 2;
|
|
8128
|
-
|
|
10388
|
+
match3++;
|
|
8129
10389
|
do {
|
|
8130
|
-
} while (_win[++scan] === _win[++
|
|
10390
|
+
} while (_win[++scan] === _win[++match3] && _win[++scan] === _win[++match3] && _win[++scan] === _win[++match3] && _win[++scan] === _win[++match3] && _win[++scan] === _win[++match3] && _win[++scan] === _win[++match3] && _win[++scan] === _win[++match3] && _win[++scan] === _win[++match3] && scan < strend);
|
|
8131
10391
|
len = MAX_MATCH - (strend - scan);
|
|
8132
10392
|
scan = strend - MAX_MATCH;
|
|
8133
10393
|
if (len > best_len) {
|
|
@@ -8705,11 +10965,11 @@ var deflateReset = (strm) => {
|
|
|
8705
10965
|
}
|
|
8706
10966
|
return ret;
|
|
8707
10967
|
};
|
|
8708
|
-
var deflateSetHeader = (strm,
|
|
10968
|
+
var deflateSetHeader = (strm, head3) => {
|
|
8709
10969
|
if (deflateStateCheck(strm) || strm.state.wrap !== 2) {
|
|
8710
10970
|
return Z_STREAM_ERROR$2;
|
|
8711
10971
|
}
|
|
8712
|
-
strm.state.gzhead =
|
|
10972
|
+
strm.state.gzhead = head3;
|
|
8713
10973
|
return Z_OK$3;
|
|
8714
10974
|
};
|
|
8715
10975
|
var deflateInit2 = (strm, level, method, windowBits, memLevel, strategy) => {
|
|
@@ -8863,20 +11123,20 @@ var deflate$2 = (strm, flush) => {
|
|
|
8863
11123
|
let beg = s.pending;
|
|
8864
11124
|
let left3 = (s.gzhead.extra.length & 65535) - s.gzindex;
|
|
8865
11125
|
while (s.pending + left3 > s.pending_buf_size) {
|
|
8866
|
-
let
|
|
8867
|
-
s.pending_buf.set(s.gzhead.extra.subarray(s.gzindex, s.gzindex +
|
|
11126
|
+
let copy2 = s.pending_buf_size - s.pending;
|
|
11127
|
+
s.pending_buf.set(s.gzhead.extra.subarray(s.gzindex, s.gzindex + copy2), s.pending);
|
|
8868
11128
|
s.pending = s.pending_buf_size;
|
|
8869
11129
|
if (s.gzhead.hcrc && s.pending > beg) {
|
|
8870
11130
|
strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg);
|
|
8871
11131
|
}
|
|
8872
|
-
s.gzindex +=
|
|
11132
|
+
s.gzindex += copy2;
|
|
8873
11133
|
flush_pending(strm);
|
|
8874
11134
|
if (s.pending !== 0) {
|
|
8875
11135
|
s.last_flush = -1;
|
|
8876
11136
|
return Z_OK$3;
|
|
8877
11137
|
}
|
|
8878
11138
|
beg = 0;
|
|
8879
|
-
left3 -=
|
|
11139
|
+
left3 -= copy2;
|
|
8880
11140
|
}
|
|
8881
11141
|
let gzhead_extra = new Uint8Array(s.gzhead.extra);
|
|
8882
11142
|
s.pending_buf.set(gzhead_extra.subarray(s.gzindex, s.gzindex + left3), s.pending);
|
|
@@ -9828,7 +12088,7 @@ var inflate_table = (type, lens, lens_index, codes, table, table_index, work, op
|
|
|
9828
12088
|
let mask;
|
|
9829
12089
|
let next;
|
|
9830
12090
|
let base = null;
|
|
9831
|
-
let
|
|
12091
|
+
let match3;
|
|
9832
12092
|
const count = new Uint16Array(MAXBITS + 1);
|
|
9833
12093
|
const offs = new Uint16Array(MAXBITS + 1);
|
|
9834
12094
|
let extra = null;
|
|
@@ -9884,15 +12144,15 @@ var inflate_table = (type, lens, lens_index, codes, table, table_index, work, op
|
|
|
9884
12144
|
}
|
|
9885
12145
|
if (type === CODES$1) {
|
|
9886
12146
|
base = extra = work;
|
|
9887
|
-
|
|
12147
|
+
match3 = 20;
|
|
9888
12148
|
} else if (type === LENS$1) {
|
|
9889
12149
|
base = lbase;
|
|
9890
12150
|
extra = lext;
|
|
9891
|
-
|
|
12151
|
+
match3 = 257;
|
|
9892
12152
|
} else {
|
|
9893
12153
|
base = dbase;
|
|
9894
12154
|
extra = dext;
|
|
9895
|
-
|
|
12155
|
+
match3 = 0;
|
|
9896
12156
|
}
|
|
9897
12157
|
huff = 0;
|
|
9898
12158
|
sym = 0;
|
|
@@ -9908,12 +12168,12 @@ var inflate_table = (type, lens, lens_index, codes, table, table_index, work, op
|
|
|
9908
12168
|
}
|
|
9909
12169
|
for (; ; ) {
|
|
9910
12170
|
here_bits = len - drop;
|
|
9911
|
-
if (work[sym] + 1 <
|
|
12171
|
+
if (work[sym] + 1 < match3) {
|
|
9912
12172
|
here_op = 0;
|
|
9913
12173
|
here_val = work[sym];
|
|
9914
|
-
} else if (work[sym] >=
|
|
9915
|
-
here_op = extra[work[sym] -
|
|
9916
|
-
here_val = base[work[sym] -
|
|
12174
|
+
} else if (work[sym] >= match3) {
|
|
12175
|
+
here_op = extra[work[sym] - match3];
|
|
12176
|
+
here_val = base[work[sym] - match3];
|
|
9917
12177
|
} else {
|
|
9918
12178
|
here_op = 32 + 64;
|
|
9919
12179
|
here_val = 0;
|
|
@@ -10185,7 +12445,7 @@ var fixedtables = (state) => {
|
|
|
10185
12445
|
state.distcode = distfix;
|
|
10186
12446
|
state.distbits = 5;
|
|
10187
12447
|
};
|
|
10188
|
-
var updatewindow = (strm, src, end,
|
|
12448
|
+
var updatewindow = (strm, src, end, copy2) => {
|
|
10189
12449
|
let dist;
|
|
10190
12450
|
const state = strm.state;
|
|
10191
12451
|
if (state.window === null) {
|
|
@@ -10194,20 +12454,20 @@ var updatewindow = (strm, src, end, copy) => {
|
|
|
10194
12454
|
state.whave = 0;
|
|
10195
12455
|
state.window = new Uint8Array(state.wsize);
|
|
10196
12456
|
}
|
|
10197
|
-
if (
|
|
12457
|
+
if (copy2 >= state.wsize) {
|
|
10198
12458
|
state.window.set(src.subarray(end - state.wsize, end), 0);
|
|
10199
12459
|
state.wnext = 0;
|
|
10200
12460
|
state.whave = state.wsize;
|
|
10201
12461
|
} else {
|
|
10202
12462
|
dist = state.wsize - state.wnext;
|
|
10203
|
-
if (dist >
|
|
10204
|
-
dist =
|
|
10205
|
-
}
|
|
10206
|
-
state.window.set(src.subarray(end -
|
|
10207
|
-
|
|
10208
|
-
if (
|
|
10209
|
-
state.window.set(src.subarray(end -
|
|
10210
|
-
state.wnext =
|
|
12463
|
+
if (dist > copy2) {
|
|
12464
|
+
dist = copy2;
|
|
12465
|
+
}
|
|
12466
|
+
state.window.set(src.subarray(end - copy2, end - copy2 + dist), state.wnext);
|
|
12467
|
+
copy2 -= dist;
|
|
12468
|
+
if (copy2) {
|
|
12469
|
+
state.window.set(src.subarray(end - copy2, end), 0);
|
|
12470
|
+
state.wnext = copy2;
|
|
10211
12471
|
state.whave = state.wsize;
|
|
10212
12472
|
} else {
|
|
10213
12473
|
state.wnext += dist;
|
|
@@ -10230,7 +12490,7 @@ var inflate$2 = (strm, flush) => {
|
|
|
10230
12490
|
let hold;
|
|
10231
12491
|
let bits;
|
|
10232
12492
|
let _in, _out;
|
|
10233
|
-
let
|
|
12493
|
+
let copy2;
|
|
10234
12494
|
let from;
|
|
10235
12495
|
let from_source;
|
|
10236
12496
|
let here = 0;
|
|
@@ -10429,11 +12689,11 @@ var inflate$2 = (strm, flush) => {
|
|
|
10429
12689
|
/* falls through */
|
|
10430
12690
|
case EXTRA:
|
|
10431
12691
|
if (state.flags & 1024) {
|
|
10432
|
-
|
|
10433
|
-
if (
|
|
10434
|
-
|
|
12692
|
+
copy2 = state.length;
|
|
12693
|
+
if (copy2 > have) {
|
|
12694
|
+
copy2 = have;
|
|
10435
12695
|
}
|
|
10436
|
-
if (
|
|
12696
|
+
if (copy2) {
|
|
10437
12697
|
if (state.head) {
|
|
10438
12698
|
len = state.head.extra_len - state.length;
|
|
10439
12699
|
if (!state.head.extra) {
|
|
@@ -10444,18 +12704,18 @@ var inflate$2 = (strm, flush) => {
|
|
|
10444
12704
|
next,
|
|
10445
12705
|
// extra field is limited to 65536 bytes
|
|
10446
12706
|
// - no need for additional size check
|
|
10447
|
-
next +
|
|
12707
|
+
next + copy2
|
|
10448
12708
|
),
|
|
10449
12709
|
/*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/
|
|
10450
12710
|
len
|
|
10451
12711
|
);
|
|
10452
12712
|
}
|
|
10453
12713
|
if (state.flags & 512 && state.wrap & 4) {
|
|
10454
|
-
state.check = crc32_1(state.check, input,
|
|
12714
|
+
state.check = crc32_1(state.check, input, copy2, next);
|
|
10455
12715
|
}
|
|
10456
|
-
have -=
|
|
10457
|
-
next +=
|
|
10458
|
-
state.length -=
|
|
12716
|
+
have -= copy2;
|
|
12717
|
+
next += copy2;
|
|
12718
|
+
state.length -= copy2;
|
|
10459
12719
|
}
|
|
10460
12720
|
if (state.length) {
|
|
10461
12721
|
break inf_leave;
|
|
@@ -10469,18 +12729,18 @@ var inflate$2 = (strm, flush) => {
|
|
|
10469
12729
|
if (have === 0) {
|
|
10470
12730
|
break inf_leave;
|
|
10471
12731
|
}
|
|
10472
|
-
|
|
12732
|
+
copy2 = 0;
|
|
10473
12733
|
do {
|
|
10474
|
-
len = input[next +
|
|
12734
|
+
len = input[next + copy2++];
|
|
10475
12735
|
if (state.head && len && state.length < 65536) {
|
|
10476
12736
|
state.head.name += String.fromCharCode(len);
|
|
10477
12737
|
}
|
|
10478
|
-
} while (len &&
|
|
12738
|
+
} while (len && copy2 < have);
|
|
10479
12739
|
if (state.flags & 512 && state.wrap & 4) {
|
|
10480
|
-
state.check = crc32_1(state.check, input,
|
|
12740
|
+
state.check = crc32_1(state.check, input, copy2, next);
|
|
10481
12741
|
}
|
|
10482
|
-
have -=
|
|
10483
|
-
next +=
|
|
12742
|
+
have -= copy2;
|
|
12743
|
+
next += copy2;
|
|
10484
12744
|
if (len) {
|
|
10485
12745
|
break inf_leave;
|
|
10486
12746
|
}
|
|
@@ -10495,18 +12755,18 @@ var inflate$2 = (strm, flush) => {
|
|
|
10495
12755
|
if (have === 0) {
|
|
10496
12756
|
break inf_leave;
|
|
10497
12757
|
}
|
|
10498
|
-
|
|
12758
|
+
copy2 = 0;
|
|
10499
12759
|
do {
|
|
10500
|
-
len = input[next +
|
|
12760
|
+
len = input[next + copy2++];
|
|
10501
12761
|
if (state.head && len && state.length < 65536) {
|
|
10502
12762
|
state.head.comment += String.fromCharCode(len);
|
|
10503
12763
|
}
|
|
10504
|
-
} while (len &&
|
|
12764
|
+
} while (len && copy2 < have);
|
|
10505
12765
|
if (state.flags & 512 && state.wrap & 4) {
|
|
10506
|
-
state.check = crc32_1(state.check, input,
|
|
12766
|
+
state.check = crc32_1(state.check, input, copy2, next);
|
|
10507
12767
|
}
|
|
10508
|
-
have -=
|
|
10509
|
-
next +=
|
|
12768
|
+
have -= copy2;
|
|
12769
|
+
next += copy2;
|
|
10510
12770
|
if (len) {
|
|
10511
12771
|
break inf_leave;
|
|
10512
12772
|
}
|
|
@@ -10641,23 +12901,23 @@ var inflate$2 = (strm, flush) => {
|
|
|
10641
12901
|
state.mode = COPY;
|
|
10642
12902
|
/* falls through */
|
|
10643
12903
|
case COPY:
|
|
10644
|
-
|
|
10645
|
-
if (
|
|
10646
|
-
if (
|
|
10647
|
-
|
|
12904
|
+
copy2 = state.length;
|
|
12905
|
+
if (copy2) {
|
|
12906
|
+
if (copy2 > have) {
|
|
12907
|
+
copy2 = have;
|
|
10648
12908
|
}
|
|
10649
|
-
if (
|
|
10650
|
-
|
|
12909
|
+
if (copy2 > left3) {
|
|
12910
|
+
copy2 = left3;
|
|
10651
12911
|
}
|
|
10652
|
-
if (
|
|
12912
|
+
if (copy2 === 0) {
|
|
10653
12913
|
break inf_leave;
|
|
10654
12914
|
}
|
|
10655
|
-
output.set(input.subarray(next, next +
|
|
10656
|
-
have -=
|
|
10657
|
-
next +=
|
|
10658
|
-
left3 -=
|
|
10659
|
-
put +=
|
|
10660
|
-
state.length -=
|
|
12915
|
+
output.set(input.subarray(next, next + copy2), put);
|
|
12916
|
+
have -= copy2;
|
|
12917
|
+
next += copy2;
|
|
12918
|
+
left3 -= copy2;
|
|
12919
|
+
put += copy2;
|
|
12920
|
+
state.length -= copy2;
|
|
10661
12921
|
break;
|
|
10662
12922
|
}
|
|
10663
12923
|
state.mode = TYPE;
|
|
@@ -10758,7 +13018,7 @@ var inflate$2 = (strm, flush) => {
|
|
|
10758
13018
|
break;
|
|
10759
13019
|
}
|
|
10760
13020
|
len = state.lens[state.have - 1];
|
|
10761
|
-
|
|
13021
|
+
copy2 = 3 + (hold & 3);
|
|
10762
13022
|
hold >>>= 2;
|
|
10763
13023
|
bits -= 2;
|
|
10764
13024
|
} else if (here_val === 17) {
|
|
@@ -10774,7 +13034,7 @@ var inflate$2 = (strm, flush) => {
|
|
|
10774
13034
|
hold >>>= here_bits;
|
|
10775
13035
|
bits -= here_bits;
|
|
10776
13036
|
len = 0;
|
|
10777
|
-
|
|
13037
|
+
copy2 = 3 + (hold & 7);
|
|
10778
13038
|
hold >>>= 3;
|
|
10779
13039
|
bits -= 3;
|
|
10780
13040
|
} else {
|
|
@@ -10790,16 +13050,16 @@ var inflate$2 = (strm, flush) => {
|
|
|
10790
13050
|
hold >>>= here_bits;
|
|
10791
13051
|
bits -= here_bits;
|
|
10792
13052
|
len = 0;
|
|
10793
|
-
|
|
13053
|
+
copy2 = 11 + (hold & 127);
|
|
10794
13054
|
hold >>>= 7;
|
|
10795
13055
|
bits -= 7;
|
|
10796
13056
|
}
|
|
10797
|
-
if (state.have +
|
|
13057
|
+
if (state.have + copy2 > state.nlen + state.ndist) {
|
|
10798
13058
|
strm.msg = "invalid bit length repeat";
|
|
10799
13059
|
state.mode = BAD;
|
|
10800
13060
|
break;
|
|
10801
13061
|
}
|
|
10802
|
-
while (
|
|
13062
|
+
while (copy2--) {
|
|
10803
13063
|
state.lens[state.have++] = len;
|
|
10804
13064
|
}
|
|
10805
13065
|
}
|
|
@@ -11018,39 +13278,39 @@ var inflate$2 = (strm, flush) => {
|
|
|
11018
13278
|
if (left3 === 0) {
|
|
11019
13279
|
break inf_leave;
|
|
11020
13280
|
}
|
|
11021
|
-
|
|
11022
|
-
if (state.offset >
|
|
11023
|
-
|
|
11024
|
-
if (
|
|
13281
|
+
copy2 = _out - left3;
|
|
13282
|
+
if (state.offset > copy2) {
|
|
13283
|
+
copy2 = state.offset - copy2;
|
|
13284
|
+
if (copy2 > state.whave) {
|
|
11025
13285
|
if (state.sane) {
|
|
11026
13286
|
strm.msg = "invalid distance too far back";
|
|
11027
13287
|
state.mode = BAD;
|
|
11028
13288
|
break;
|
|
11029
13289
|
}
|
|
11030
13290
|
}
|
|
11031
|
-
if (
|
|
11032
|
-
|
|
11033
|
-
from = state.wsize -
|
|
13291
|
+
if (copy2 > state.wnext) {
|
|
13292
|
+
copy2 -= state.wnext;
|
|
13293
|
+
from = state.wsize - copy2;
|
|
11034
13294
|
} else {
|
|
11035
|
-
from = state.wnext -
|
|
13295
|
+
from = state.wnext - copy2;
|
|
11036
13296
|
}
|
|
11037
|
-
if (
|
|
11038
|
-
|
|
13297
|
+
if (copy2 > state.length) {
|
|
13298
|
+
copy2 = state.length;
|
|
11039
13299
|
}
|
|
11040
13300
|
from_source = state.window;
|
|
11041
13301
|
} else {
|
|
11042
13302
|
from_source = output;
|
|
11043
13303
|
from = put - state.offset;
|
|
11044
|
-
|
|
13304
|
+
copy2 = state.length;
|
|
11045
13305
|
}
|
|
11046
|
-
if (
|
|
11047
|
-
|
|
13306
|
+
if (copy2 > left3) {
|
|
13307
|
+
copy2 = left3;
|
|
11048
13308
|
}
|
|
11049
|
-
left3 -=
|
|
11050
|
-
state.length -=
|
|
13309
|
+
left3 -= copy2;
|
|
13310
|
+
state.length -= copy2;
|
|
11051
13311
|
do {
|
|
11052
13312
|
output[put++] = from_source[from++];
|
|
11053
|
-
} while (--
|
|
13313
|
+
} while (--copy2);
|
|
11054
13314
|
if (state.length === 0) {
|
|
11055
13315
|
state.mode = LEN;
|
|
11056
13316
|
}
|
|
@@ -11160,7 +13420,7 @@ var inflateEnd = (strm) => {
|
|
|
11160
13420
|
strm.state = null;
|
|
11161
13421
|
return Z_OK$1;
|
|
11162
13422
|
};
|
|
11163
|
-
var inflateGetHeader = (strm,
|
|
13423
|
+
var inflateGetHeader = (strm, head3) => {
|
|
11164
13424
|
if (inflateStateCheck(strm)) {
|
|
11165
13425
|
return Z_STREAM_ERROR$1;
|
|
11166
13426
|
}
|
|
@@ -11168,8 +13428,8 @@ var inflateGetHeader = (strm, head2) => {
|
|
|
11168
13428
|
if ((state.wrap & 2) === 0) {
|
|
11169
13429
|
return Z_STREAM_ERROR$1;
|
|
11170
13430
|
}
|
|
11171
|
-
state.head =
|
|
11172
|
-
|
|
13431
|
+
state.head = head3;
|
|
13432
|
+
head3.done = false;
|
|
11173
13433
|
return Z_OK$1;
|
|
11174
13434
|
};
|
|
11175
13435
|
var inflateSetDictionary = (strm, dictionary) => {
|
|
@@ -11407,7 +13667,7 @@ var { Deflate, deflate, deflateRaw, gzip } = deflate_1$1;
|
|
|
11407
13667
|
var { Inflate, inflate, inflateRaw, ungzip } = inflate_1$1;
|
|
11408
13668
|
var deflate_1 = deflate;
|
|
11409
13669
|
|
|
11410
|
-
// src/
|
|
13670
|
+
// src/core/LayerGraph.ts
|
|
11411
13671
|
var UnableToProduceLayerGraphError = class {
|
|
11412
13672
|
constructor(message, node) {
|
|
11413
13673
|
this.message = message;
|
|
@@ -11415,250 +13675,419 @@ var UnableToProduceLayerGraphError = class {
|
|
|
11415
13675
|
}
|
|
11416
13676
|
_tag = "@effect/language-service/UnableToProduceLayerGraphError";
|
|
11417
13677
|
};
|
|
11418
|
-
var
|
|
11419
|
-
|
|
11420
|
-
|
|
11421
|
-
|
|
11422
|
-
|
|
11423
|
-
|
|
11424
|
-
|
|
11425
|
-
|
|
11426
|
-
|
|
11427
|
-
|
|
11428
|
-
|
|
11429
|
-
|
|
11430
|
-
|
|
11431
|
-
|
|
11432
|
-
|
|
11433
|
-
|
|
11434
|
-
|
|
11435
|
-
|
|
11436
|
-
|
|
11437
|
-
|
|
11438
|
-
|
|
11439
|
-
|
|
11440
|
-
|
|
11441
|
-
|
|
11442
|
-
|
|
11443
|
-
|
|
11444
|
-
|
|
11445
|
-
|
|
11446
|
-
|
|
11447
|
-
|
|
11448
|
-
|
|
13678
|
+
var extractLayerGraph = fn("extractLayerGraph")(function* (node, opts) {
|
|
13679
|
+
const ts = yield* service(TypeScriptApi);
|
|
13680
|
+
const typeChecker = yield* service(TypeCheckerApi);
|
|
13681
|
+
const typeParser = yield* service(TypeParser);
|
|
13682
|
+
const typeCheckerUtils = yield* service(TypeCheckerUtils);
|
|
13683
|
+
const tsUtils = yield* service(TypeScriptUtils);
|
|
13684
|
+
const sourceFile = tsUtils.getSourceFileOfNode(node);
|
|
13685
|
+
const layerModuleName = tsUtils.findImportedModuleIdentifierByPackageAndNameOrBarrel(sourceFile, "effect", "Layer") || "Layer";
|
|
13686
|
+
const visitedNodes = /* @__PURE__ */ new WeakSet();
|
|
13687
|
+
const nodeInPipeContext = /* @__PURE__ */ new WeakSet();
|
|
13688
|
+
const nodeToGraph = /* @__PURE__ */ new WeakMap();
|
|
13689
|
+
const nodeToVisit = [node];
|
|
13690
|
+
const appendNodeToVisit = (node2) => {
|
|
13691
|
+
nodeToVisit.push(node2);
|
|
13692
|
+
return void 0;
|
|
13693
|
+
};
|
|
13694
|
+
const mutableGraph = beginMutation3(directed());
|
|
13695
|
+
const extractNodeInfo = fn("extractNodeInfo")(function* (node2) {
|
|
13696
|
+
let provides = [];
|
|
13697
|
+
let requires = [];
|
|
13698
|
+
let layerType = void 0;
|
|
13699
|
+
let layerTypes = void 0;
|
|
13700
|
+
if (nodeInPipeContext.has(node2)) {
|
|
13701
|
+
if (ts.isExpression(node2)) {
|
|
13702
|
+
const contextualType = typeChecker.getContextualType(node2);
|
|
13703
|
+
if (contextualType) {
|
|
13704
|
+
const callSignatures = typeChecker.getSignaturesOfType(contextualType, ts.SignatureKind.Call);
|
|
13705
|
+
if (callSignatures.length === 1) {
|
|
13706
|
+
layerType = typeChecker.getReturnTypeOfSignature(callSignatures[0]);
|
|
13707
|
+
}
|
|
13708
|
+
}
|
|
11449
13709
|
}
|
|
11450
|
-
|
|
13710
|
+
} else {
|
|
13711
|
+
layerType = typeChecker.getTypeAtLocation(node2);
|
|
11451
13712
|
}
|
|
11452
|
-
if (
|
|
11453
|
-
|
|
11454
|
-
|
|
11455
|
-
|
|
11456
|
-
|
|
11457
|
-
|
|
13713
|
+
if (layerType) {
|
|
13714
|
+
layerTypes = yield* pipe(typeParser.layerType(layerType, node2), orElse2(() => void_));
|
|
13715
|
+
}
|
|
13716
|
+
if (!layerTypes) layerType = void 0;
|
|
13717
|
+
if (layerTypes) {
|
|
13718
|
+
provides = typeCheckerUtils.unrollUnionMembers(layerTypes.ROut).filter((_) => !(_.flags & ts.TypeFlags.Never));
|
|
13719
|
+
requires = typeCheckerUtils.unrollUnionMembers(layerTypes.RIn).filter((_) => !(_.flags & ts.TypeFlags.Never));
|
|
13720
|
+
}
|
|
13721
|
+
return { node: node2, layerType, layerTypes, provides, requires };
|
|
13722
|
+
});
|
|
13723
|
+
const addNode2 = fn("addNode")(function* (node2, nodeInfo) {
|
|
13724
|
+
const graphNode = addNode(mutableGraph, nodeInfo ? nodeInfo : yield* extractNodeInfo(node2));
|
|
13725
|
+
nodeToGraph.set(node2, graphNode);
|
|
13726
|
+
return graphNode;
|
|
13727
|
+
});
|
|
13728
|
+
while (nodeToVisit.length > 0) {
|
|
13729
|
+
const node2 = nodeToVisit.pop();
|
|
13730
|
+
const pipeArgs = yield* pipe(typeParser.pipeCall(node2), orElse2(() => void_));
|
|
13731
|
+
if (pipeArgs) {
|
|
13732
|
+
if (!visitedNodes.has(node2)) {
|
|
13733
|
+
appendNodeToVisit(node2);
|
|
13734
|
+
appendNodeToVisit(pipeArgs.subject);
|
|
13735
|
+
pipeArgs.args.forEach(appendNodeToVisit);
|
|
13736
|
+
pipeArgs.args.forEach((_) => nodeInPipeContext.add(_));
|
|
13737
|
+
visitedNodes.add(node2);
|
|
13738
|
+
} else {
|
|
13739
|
+
const childNodes = [pipeArgs.subject, ...pipeArgs.args].map((_) => nodeToGraph.get(_)).filter(
|
|
13740
|
+
isNumber
|
|
13741
|
+
).filter(
|
|
13742
|
+
(_) => hasNode(mutableGraph, _)
|
|
11458
13743
|
);
|
|
11459
|
-
if (
|
|
11460
|
-
|
|
11461
|
-
|
|
11462
|
-
|
|
11463
|
-
|
|
11464
|
-
|
|
11465
|
-
|
|
11466
|
-
|
|
11467
|
-
|
|
11468
|
-
|
|
11469
|
-
|
|
11470
|
-
|
|
11471
|
-
|
|
11472
|
-
|
|
11473
|
-
argNodes.value,
|
|
11474
|
-
outTypes,
|
|
11475
|
-
inTypes
|
|
11476
|
-
);
|
|
13744
|
+
if (childNodes.length === pipeArgs.args.length + 1) {
|
|
13745
|
+
let lastNode = null;
|
|
13746
|
+
for (const childNode of childNodes) {
|
|
13747
|
+
if (lastNode !== null) addEdge(mutableGraph, childNode, lastNode, { relationship: "pipe" });
|
|
13748
|
+
lastNode = childNode;
|
|
13749
|
+
}
|
|
13750
|
+
if (lastNode !== null) {
|
|
13751
|
+
const graphNode = yield* addNode2(node2);
|
|
13752
|
+
addEdge(mutableGraph, graphNode, lastNode, { relationship: "pipe" });
|
|
13753
|
+
}
|
|
13754
|
+
} else {
|
|
13755
|
+
childNodes.forEach((_) => removeNode(mutableGraph, _));
|
|
13756
|
+
const nodeInfo = yield* extractNodeInfo(node2);
|
|
13757
|
+
if (nodeInfo.layerTypes) yield* addNode2(node2, nodeInfo);
|
|
11477
13758
|
}
|
|
11478
13759
|
}
|
|
13760
|
+
continue;
|
|
11479
13761
|
}
|
|
11480
|
-
if (
|
|
11481
|
-
|
|
11482
|
-
if (
|
|
11483
|
-
const
|
|
11484
|
-
if (
|
|
11485
|
-
|
|
11486
|
-
|
|
11487
|
-
|
|
11488
|
-
|
|
11489
|
-
|
|
11490
|
-
|
|
11491
|
-
|
|
11492
|
-
|
|
11493
|
-
)
|
|
11494
|
-
|
|
11495
|
-
|
|
11496
|
-
|
|
11497
|
-
|
|
13762
|
+
if (ts.isCallExpression(node2)) {
|
|
13763
|
+
let shouldExplode = !opts.explodeOnlyLayerCalls;
|
|
13764
|
+
if (opts.explodeOnlyLayerCalls) {
|
|
13765
|
+
const isLayerCall = ts.isPropertyAccessExpression(node2.expression) && ts.isIdentifier(node2.expression.expression) && ts.idText(node2.expression.expression) === layerModuleName;
|
|
13766
|
+
if (isLayerCall) shouldExplode = true;
|
|
13767
|
+
}
|
|
13768
|
+
if (shouldExplode) {
|
|
13769
|
+
if (!visitedNodes.has(node2)) {
|
|
13770
|
+
appendNodeToVisit(node2);
|
|
13771
|
+
node2.arguments.forEach(appendNodeToVisit);
|
|
13772
|
+
visitedNodes.add(node2);
|
|
13773
|
+
} else {
|
|
13774
|
+
const childNodes = node2.arguments.map((_) => nodeToGraph.get(_)).filter(isNumber).filter(
|
|
13775
|
+
(_) => hasNode(mutableGraph, _)
|
|
13776
|
+
);
|
|
13777
|
+
if (childNodes.length === node2.arguments.length) {
|
|
13778
|
+
const graphNode = yield* addNode2(node2);
|
|
13779
|
+
childNodes.forEach(
|
|
13780
|
+
(_, argumentIndex) => addEdge(mutableGraph, graphNode, _, { relationship: "call", argumentIndex })
|
|
11498
13781
|
);
|
|
11499
|
-
|
|
11500
|
-
|
|
11501
|
-
|
|
11502
|
-
|
|
11503
|
-
if (isSome2(argNodes) && argNodes.value.length === node.arguments.length) {
|
|
11504
|
-
return new GraphNodeCompoundTransform(
|
|
11505
|
-
ctx.nextId(),
|
|
11506
|
-
node,
|
|
11507
|
-
[pipedInGraphNode, ...argNodes.value],
|
|
11508
|
-
outTypes,
|
|
11509
|
-
inTypes
|
|
11510
|
-
);
|
|
11511
|
-
}
|
|
11512
|
-
}
|
|
11513
|
-
const argNode = yield* option(processLayerGraphNode(ctx, node, void 0));
|
|
11514
|
-
if (isSome2(argNode)) {
|
|
11515
|
-
return new GraphNodeCompoundTransform(
|
|
11516
|
-
ctx.nextId(),
|
|
11517
|
-
node,
|
|
11518
|
-
[pipedInGraphNode, argNode.value],
|
|
11519
|
-
outTypes,
|
|
11520
|
-
inTypes
|
|
11521
|
-
);
|
|
11522
|
-
} else {
|
|
11523
|
-
return new GraphNodeCompoundTransform(
|
|
11524
|
-
ctx.nextId(),
|
|
11525
|
-
node,
|
|
11526
|
-
[pipedInGraphNode],
|
|
11527
|
-
outTypes,
|
|
11528
|
-
inTypes
|
|
11529
|
-
);
|
|
11530
|
-
}
|
|
13782
|
+
} else {
|
|
13783
|
+
childNodes.forEach((_) => removeNode(mutableGraph, _));
|
|
13784
|
+
const nodeInfo = yield* extractNodeInfo(node2);
|
|
13785
|
+
if (nodeInfo.layerTypes) yield* addNode2(node2, nodeInfo);
|
|
11531
13786
|
}
|
|
11532
13787
|
}
|
|
13788
|
+
continue;
|
|
11533
13789
|
}
|
|
11534
13790
|
}
|
|
11535
|
-
if (ts.
|
|
11536
|
-
|
|
11537
|
-
|
|
11538
|
-
|
|
11539
|
-
|
|
11540
|
-
|
|
11541
|
-
|
|
11542
|
-
|
|
11543
|
-
);
|
|
11544
|
-
const { allIndexes: inTypes } = yield* typeCheckerUtils.appendToUniqueTypesMap(
|
|
11545
|
-
ctx.services,
|
|
11546
|
-
maybeLayer.value.RIn,
|
|
11547
|
-
excludeNever
|
|
13791
|
+
if (opts.arrayLiteralAsMerge && ts.isArrayLiteralExpression(node2)) {
|
|
13792
|
+
if (!visitedNodes.has(node2)) {
|
|
13793
|
+
appendNodeToVisit(node2);
|
|
13794
|
+
node2.elements.forEach(appendNodeToVisit);
|
|
13795
|
+
visitedNodes.add(node2);
|
|
13796
|
+
} else {
|
|
13797
|
+
const childNodes = node2.elements.map((_) => nodeToGraph.get(_)).filter(isNumber).filter(
|
|
13798
|
+
(_) => hasNode(mutableGraph, _)
|
|
11548
13799
|
);
|
|
11549
|
-
|
|
13800
|
+
if (childNodes.length > 0) {
|
|
13801
|
+
const graphNode = yield* addNode2(node2);
|
|
13802
|
+
childNodes.forEach(
|
|
13803
|
+
(_, index) => addEdge(mutableGraph, graphNode, _, { relationship: "arrayLiteral", index })
|
|
13804
|
+
);
|
|
13805
|
+
}
|
|
11550
13806
|
}
|
|
13807
|
+
continue;
|
|
11551
13808
|
}
|
|
11552
|
-
|
|
11553
|
-
|
|
11554
|
-
|
|
11555
|
-
|
|
11556
|
-
|
|
11557
|
-
switch (graph._tag) {
|
|
11558
|
-
case "GraphNodeLeaf":
|
|
11559
|
-
return graph[kind].indexOf(key) > -1 ? [graph] : [];
|
|
11560
|
-
case "GraphNodeCompoundTransform": {
|
|
11561
|
-
if (graph[kind].indexOf(key) > -1) {
|
|
11562
|
-
let result = [];
|
|
11563
|
-
for (const child of graph.args) {
|
|
11564
|
-
result = result.concat(findInnermostGraphEdge(child, kind, key));
|
|
11565
|
-
}
|
|
11566
|
-
if (result.length > 0) return result;
|
|
11567
|
-
return [graph];
|
|
13809
|
+
if (ts.isExpression(node2)) {
|
|
13810
|
+
const nodeInfo = yield* extractNodeInfo(node2);
|
|
13811
|
+
if (nodeInfo.layerTypes) {
|
|
13812
|
+
yield* addNode2(node2, nodeInfo);
|
|
13813
|
+
continue;
|
|
11568
13814
|
}
|
|
11569
|
-
return [];
|
|
11570
13815
|
}
|
|
13816
|
+
return yield* fail(new UnableToProduceLayerGraphError("Unable to produce layer graph for node", node2));
|
|
11571
13817
|
}
|
|
11572
|
-
|
|
11573
|
-
|
|
11574
|
-
|
|
11575
|
-
|
|
11576
|
-
|
|
11577
|
-
|
|
11578
|
-
|
|
11579
|
-
|
|
13818
|
+
return endMutation2(mutableGraph);
|
|
13819
|
+
});
|
|
13820
|
+
var formatLayerGraph = fn("formatLayerGraph")(function* (layerGraph) {
|
|
13821
|
+
const tsUtils = yield* service(TypeScriptUtils);
|
|
13822
|
+
return toMermaid(layerGraph, {
|
|
13823
|
+
edgeLabel: (edge) => JSON.stringify(edge),
|
|
13824
|
+
nodeLabel: (graphNode) => {
|
|
13825
|
+
const sourceFile = tsUtils.getSourceFileOfNode(graphNode.node);
|
|
13826
|
+
return sourceFile.text.substring(graphNode.node.pos, graphNode.node.end).trim();
|
|
13827
|
+
}
|
|
13828
|
+
});
|
|
13829
|
+
});
|
|
13830
|
+
var formatNestedLayerGraph = fn("formatNestedLayerGraph")(function* (layerGraph) {
|
|
13831
|
+
const tsUtils = yield* service(TypeScriptUtils);
|
|
13832
|
+
const typeChecker = yield* service(TypeCheckerApi);
|
|
13833
|
+
const ts = yield* service(TypeScriptApi);
|
|
13834
|
+
const mermaidSafe = (value) => value.replace(/\n/g, " ").replace(
|
|
13835
|
+
/\s+/g,
|
|
13836
|
+
" "
|
|
13837
|
+
).substring(0, 50).replace(/"/g, "#quot;").replace(/</mg, "#lt;").replace(/>/mg, "#gt;").trim();
|
|
13838
|
+
const typeNameCache = /* @__PURE__ */ new Map();
|
|
13839
|
+
const typeName = (type) => {
|
|
13840
|
+
if (typeNameCache.has(type)) return typeNameCache.get(type);
|
|
13841
|
+
const name = typeChecker.typeToString(type, void 0, ts.TypeFormatFlags.NoTruncation);
|
|
13842
|
+
typeNameCache.set(type, name);
|
|
13843
|
+
return name;
|
|
13844
|
+
};
|
|
13845
|
+
let result = [];
|
|
13846
|
+
for (const [graphNodeIndex, graphNode] of entries(nodes(layerGraph))) {
|
|
11580
13847
|
let subgraphDefs = [];
|
|
11581
|
-
|
|
11582
|
-
const
|
|
11583
|
-
for (
|
|
11584
|
-
|
|
11585
|
-
const typeString = typeChecker.typeToString(type, void 0, ts.TypeFormatFlags.NoTruncation);
|
|
11586
|
-
subgraphsIn.push("subgraph " + graph.id + "_rin_" + serviceId + ' ["`' + escapeMermaid(typeString) + '`"]');
|
|
11587
|
-
subgraphsIn.push("end");
|
|
11588
|
-
}
|
|
11589
|
-
const subgraphsOut = [];
|
|
11590
|
-
for (const serviceId of graph.rout) {
|
|
11591
|
-
const type = ctxL.services.get(serviceId);
|
|
11592
|
-
const typeString = typeChecker.typeToString(type, void 0, ts.TypeFormatFlags.NoTruncation);
|
|
11593
|
-
subgraphsOut.push("subgraph " + graph.id + "_rout_" + serviceId + ' ["`' + escapeMermaid(typeString) + '`"]');
|
|
11594
|
-
subgraphsOut.push("end");
|
|
11595
|
-
}
|
|
11596
|
-
const sourceFile = graph.node.getSourceFile();
|
|
11597
|
-
const nodePosition = graph.node.getStart(sourceFile, false);
|
|
11598
|
-
const { character, line } = ts.getLineAndCharacterOfPosition(sourceFile, nodePosition);
|
|
11599
|
-
if (subgraphsIn.length > 0) {
|
|
11600
|
-
subgraphDefs = [
|
|
11601
|
-
...subgraphDefs,
|
|
11602
|
-
"subgraph " + graph.id + "_rin [Requires]",
|
|
11603
|
-
...subgraphsIn,
|
|
11604
|
-
"end",
|
|
11605
|
-
"style " + graph.id + "_rin stroke:none"
|
|
11606
|
-
];
|
|
13848
|
+
for (const kind of ["requires", "provides"]) {
|
|
13849
|
+
const typesMermaidNodes = [];
|
|
13850
|
+
for (let i = 0; i < graphNode[kind].length; i++) {
|
|
13851
|
+
typesMermaidNodes.push(`${graphNodeIndex}_${kind}_${i}["${mermaidSafe(typeName(graphNode[kind][i]))}"]`);
|
|
11607
13852
|
}
|
|
11608
|
-
if (
|
|
13853
|
+
if (typesMermaidNodes.length > 0) {
|
|
11609
13854
|
subgraphDefs = [
|
|
11610
13855
|
...subgraphDefs,
|
|
11611
|
-
|
|
11612
|
-
...
|
|
11613
|
-
|
|
11614
|
-
|
|
13856
|
+
`subgraph ${graphNodeIndex}_${kind} [${kind === "provides" ? "Provides" : "Requires"}]`,
|
|
13857
|
+
...typesMermaidNodes.map((_) => ` ${_}`),
|
|
13858
|
+
`end`,
|
|
13859
|
+
`style ${graphNodeIndex}_${kind} stroke:none`
|
|
11615
13860
|
];
|
|
11616
13861
|
}
|
|
11617
|
-
|
|
11618
|
-
|
|
11619
|
-
|
|
11620
|
-
|
|
11621
|
-
|
|
11622
|
-
|
|
11623
|
-
|
|
11624
|
-
|
|
11625
|
-
|
|
11626
|
-
|
|
11627
|
-
|
|
11628
|
-
|
|
11629
|
-
|
|
11630
|
-
|
|
11631
|
-
|
|
11632
|
-
|
|
11633
|
-
|
|
11634
|
-
|
|
11635
|
-
|
|
11636
|
-
|
|
11637
|
-
|
|
11638
|
-
|
|
11639
|
-
|
|
11640
|
-
|
|
11641
|
-
|
|
13862
|
+
}
|
|
13863
|
+
subgraphDefs = [
|
|
13864
|
+
`subgraph ${graphNodeIndex}_wrap[" "]`,
|
|
13865
|
+
...subgraphDefs.map((_) => ` ${_}`),
|
|
13866
|
+
`end`,
|
|
13867
|
+
`style ${graphNodeIndex}_wrap fill:transparent`,
|
|
13868
|
+
`style ${graphNodeIndex}_wrap stroke:none`
|
|
13869
|
+
];
|
|
13870
|
+
const sourceFile = tsUtils.getSourceFileOfNode(graphNode.node);
|
|
13871
|
+
const nodePosition = graphNode.node.getStart(sourceFile, false);
|
|
13872
|
+
const { character, line } = ts.getLineAndCharacterOfPosition(sourceFile, nodePosition);
|
|
13873
|
+
const nodeText = sourceFile.text.substring(graphNode.node.pos, graphNode.node.end).trim();
|
|
13874
|
+
result = [
|
|
13875
|
+
...result,
|
|
13876
|
+
`subgraph ${graphNodeIndex} ["\`${mermaidSafe(nodeText)}<br/>_at ln ${line + 1} col ${character}_\`"]`,
|
|
13877
|
+
...subgraphDefs.map((_) => ` ${_}`),
|
|
13878
|
+
`end`,
|
|
13879
|
+
`style ${graphNodeIndex} fill:transparent`
|
|
13880
|
+
];
|
|
13881
|
+
}
|
|
13882
|
+
for (const edgeInfo of values2(edges(layerGraph))) {
|
|
13883
|
+
const sourceData = layerGraph.nodes.get(edgeInfo.source);
|
|
13884
|
+
const targetData = layerGraph.nodes.get(edgeInfo.target);
|
|
13885
|
+
let connected = false;
|
|
13886
|
+
for (const kind of ["requires", "provides"]) {
|
|
13887
|
+
for (let i = 0; i < sourceData[kind].length; i++) {
|
|
13888
|
+
const targetIdx = targetData[kind].indexOf(sourceData[kind][i]);
|
|
13889
|
+
if (targetIdx > -1) {
|
|
13890
|
+
result.push(`${edgeInfo.source}_${kind}_${i} -.-> ${edgeInfo.target}_${kind}_${targetIdx}`);
|
|
13891
|
+
connected = true;
|
|
11642
13892
|
}
|
|
11643
|
-
|
|
11644
|
-
|
|
11645
|
-
|
|
11646
|
-
|
|
11647
|
-
|
|
11648
|
-
|
|
11649
|
-
|
|
13893
|
+
}
|
|
13894
|
+
}
|
|
13895
|
+
if (!connected) {
|
|
13896
|
+
result.push(`${edgeInfo.source} -.-x ${edgeInfo.target}`);
|
|
13897
|
+
}
|
|
13898
|
+
}
|
|
13899
|
+
return [
|
|
13900
|
+
`flowchart TB`,
|
|
13901
|
+
...result.map((_) => ` ${_}`)
|
|
13902
|
+
].join("\n");
|
|
13903
|
+
});
|
|
13904
|
+
var extractOutlineGraph = fn("extractOutlineGraph")(function* (layerGraph) {
|
|
13905
|
+
const typeChecker = yield* service(TypeCheckerApi);
|
|
13906
|
+
const mutableGraph = beginMutation3(directed());
|
|
13907
|
+
const providers = /* @__PURE__ */ new WeakMap();
|
|
13908
|
+
const knownSymbols = /* @__PURE__ */ new WeakSet();
|
|
13909
|
+
const leafNodes = values2(externals(layerGraph, { direction: "outgoing" }));
|
|
13910
|
+
const dedupedLeafNodes = [];
|
|
13911
|
+
for (const leafNode of leafNodes) {
|
|
13912
|
+
const symbol3 = typeChecker.getSymbolAtLocation(leafNode.node);
|
|
13913
|
+
if (!symbol3) {
|
|
13914
|
+
dedupedLeafNodes.push(leafNode);
|
|
13915
|
+
} else if (symbol3 && !knownSymbols.has(symbol3)) {
|
|
13916
|
+
dedupedLeafNodes.push(leafNode);
|
|
13917
|
+
knownSymbols.add(symbol3);
|
|
13918
|
+
}
|
|
13919
|
+
}
|
|
13920
|
+
for (const leafNode of dedupedLeafNodes) {
|
|
13921
|
+
const nodeIndex = addNode(mutableGraph, {
|
|
13922
|
+
node: leafNode.node,
|
|
13923
|
+
requires: leafNode.requires,
|
|
13924
|
+
provides: leafNode.provides
|
|
13925
|
+
});
|
|
13926
|
+
for (const providedType of leafNode.provides) {
|
|
13927
|
+
if (leafNode.requires.indexOf(providedType) > -1) continue;
|
|
13928
|
+
const previousProviders = providers.get(providedType) || [];
|
|
13929
|
+
providers.set(providedType, [...previousProviders, nodeIndex]);
|
|
13930
|
+
}
|
|
13931
|
+
}
|
|
13932
|
+
for (const [nodeIndex, nodeInfo] of entries(nodes(mutableGraph))) {
|
|
13933
|
+
for (const requiredType of nodeInfo.requires) {
|
|
13934
|
+
for (const providerNodeIndex of providers.get(requiredType) || []) {
|
|
13935
|
+
addEdge(mutableGraph, nodeIndex, providerNodeIndex, {});
|
|
13936
|
+
}
|
|
13937
|
+
}
|
|
13938
|
+
}
|
|
13939
|
+
return endMutation2(mutableGraph);
|
|
13940
|
+
});
|
|
13941
|
+
var formatLayerOutlineGraph = fn("formatLayerOutlineGraph")(
|
|
13942
|
+
function* (layerOutlineGraph) {
|
|
13943
|
+
const tsUtils = yield* service(TypeScriptUtils);
|
|
13944
|
+
return toMermaid(layerOutlineGraph, {
|
|
13945
|
+
edgeLabel: () => "",
|
|
13946
|
+
nodeLabel: (graphNode) => {
|
|
13947
|
+
const sourceFile = tsUtils.getSourceFileOfNode(graphNode.node);
|
|
13948
|
+
return sourceFile.text.substring(graphNode.node.pos, graphNode.node.end).trim();
|
|
13949
|
+
}
|
|
13950
|
+
});
|
|
13951
|
+
}
|
|
13952
|
+
);
|
|
13953
|
+
var convertOutlineGraphToLayerMagic = fn("convertOutlineGraphToLayerMagic")(
|
|
13954
|
+
function* (outlineGraph, targetOutput) {
|
|
13955
|
+
const typeCheckerUtils = yield* service(TypeCheckerUtils);
|
|
13956
|
+
const ts = yield* service(TypeScriptApi);
|
|
13957
|
+
const result = [];
|
|
13958
|
+
const missingOutputTypes = new Set(typeCheckerUtils.unrollUnionMembers(targetOutput));
|
|
13959
|
+
const currentRequiredTypes = /* @__PURE__ */ new Set();
|
|
13960
|
+
const reversedGraph = mutate2(outlineGraph, reverse3);
|
|
13961
|
+
const rootIndexes = fromIterable(indices(externals(reversedGraph, { direction: "incoming" })));
|
|
13962
|
+
const allNodes = fromIterable(values2(dfsPostOrder(reversedGraph, { start: rootIndexes })));
|
|
13963
|
+
for (const nodeInfo of allNodes) {
|
|
13964
|
+
if (!ts.isExpression(nodeInfo.node)) continue;
|
|
13965
|
+
const reallyProvidedTypes = nodeInfo.provides.filter((_) => nodeInfo.requires.indexOf(_) === -1);
|
|
13966
|
+
const shouldMerge = reallyProvidedTypes.some((_) => missingOutputTypes.has(_));
|
|
13967
|
+
if (shouldMerge) {
|
|
13968
|
+
reallyProvidedTypes.forEach((_) => missingOutputTypes.delete(_));
|
|
13969
|
+
}
|
|
13970
|
+
nodeInfo.provides.forEach((_) => currentRequiredTypes.delete(_));
|
|
13971
|
+
nodeInfo.requires.forEach((_) => currentRequiredTypes.add(_));
|
|
13972
|
+
result.push({
|
|
13973
|
+
merges: shouldMerge,
|
|
13974
|
+
provides: true,
|
|
13975
|
+
layerExpression: nodeInfo.node
|
|
13976
|
+
});
|
|
13977
|
+
}
|
|
13978
|
+
return {
|
|
13979
|
+
layerMagicNodes: result,
|
|
13980
|
+
missingOutputTypes
|
|
13981
|
+
};
|
|
13982
|
+
}
|
|
13983
|
+
);
|
|
13984
|
+
var walkLeavesMatching = (graph, predicate, config = {}) => {
|
|
13985
|
+
const start = config.start ?? [];
|
|
13986
|
+
const direction = config.direction ?? "outgoing";
|
|
13987
|
+
return new Walker((f) => ({
|
|
13988
|
+
[Symbol.iterator]: () => {
|
|
13989
|
+
let queue = [...start];
|
|
13990
|
+
const discovered = /* @__PURE__ */ new Set();
|
|
13991
|
+
const nextMapped = () => {
|
|
13992
|
+
while (queue.length > 0) {
|
|
13993
|
+
const current = queue.shift();
|
|
13994
|
+
if (discovered.has(current)) continue;
|
|
13995
|
+
discovered.add(current);
|
|
13996
|
+
const neighbors = neighborsDirected(graph, current, direction);
|
|
13997
|
+
const neighborsMatching = [];
|
|
13998
|
+
for (const neighbor of neighbors) {
|
|
13999
|
+
const neighborNode = getNode(graph, neighbor);
|
|
14000
|
+
if (isSome2(neighborNode) && predicate(neighborNode.value)) {
|
|
14001
|
+
neighborsMatching.push(neighbor);
|
|
14002
|
+
}
|
|
11650
14003
|
}
|
|
11651
|
-
|
|
11652
|
-
|
|
11653
|
-
|
|
11654
|
-
|
|
14004
|
+
if (neighborsMatching.length > 0) {
|
|
14005
|
+
queue = [...queue, ...neighborsMatching];
|
|
14006
|
+
} else {
|
|
14007
|
+
const nodeData = getNode(graph, current);
|
|
14008
|
+
if (isSome2(nodeData) && predicate(nodeData.value)) {
|
|
14009
|
+
return { done: false, value: f(current, nodeData.value) };
|
|
14010
|
+
}
|
|
11655
14011
|
}
|
|
11656
14012
|
}
|
|
11657
|
-
return
|
|
14013
|
+
return { done: true, value: void 0 };
|
|
14014
|
+
};
|
|
14015
|
+
return { next: nextMapped };
|
|
14016
|
+
}
|
|
14017
|
+
}));
|
|
14018
|
+
};
|
|
14019
|
+
var extractProvidersAndRequirers = fn("extractProvidersAndRequirers")(
|
|
14020
|
+
function* (layerGraph) {
|
|
14021
|
+
const typeCheckerUtils = yield* service(TypeCheckerUtils);
|
|
14022
|
+
const rootWalker = externals(layerGraph, { direction: "outgoing" });
|
|
14023
|
+
const rootNodes = fromIterable(values2(rootWalker));
|
|
14024
|
+
const rootNodeIndexes = fromIterable(indices(rootWalker));
|
|
14025
|
+
const result = [];
|
|
14026
|
+
const walkTypes = (rootTypes, kind) => {
|
|
14027
|
+
const sortedTypes = pipe(fromIterable(rootTypes), sort(typeCheckerUtils.deterministicTypeOrder));
|
|
14028
|
+
for (const layerType of sortedTypes) {
|
|
14029
|
+
const tsNodes = [];
|
|
14030
|
+
for (const layerNode of values2(
|
|
14031
|
+
walkLeavesMatching(
|
|
14032
|
+
layerGraph,
|
|
14033
|
+
(_) => (kind === "provided" ? _.provides : _.requires).indexOf(layerType) > -1,
|
|
14034
|
+
{ start: rootNodeIndexes }
|
|
14035
|
+
)
|
|
14036
|
+
)) {
|
|
14037
|
+
tsNodes.push(layerNode.node);
|
|
14038
|
+
}
|
|
14039
|
+
result.push({
|
|
14040
|
+
kind,
|
|
14041
|
+
type: layerType,
|
|
14042
|
+
nodes: tsNodes
|
|
14043
|
+
});
|
|
14044
|
+
}
|
|
14045
|
+
};
|
|
14046
|
+
walkTypes(new Set(rootNodes.flatMap((_) => _.provides)), "provided");
|
|
14047
|
+
walkTypes(new Set(rootNodes.flatMap((_) => _.requires)), "required");
|
|
14048
|
+
return result;
|
|
14049
|
+
}
|
|
14050
|
+
);
|
|
14051
|
+
var formatLayerProvidersAndRequirersInfo = fn("formatLayerProvidersAndRequirersInfo")(
|
|
14052
|
+
function* (info) {
|
|
14053
|
+
const typeChecker = yield* service(TypeCheckerApi);
|
|
14054
|
+
const ts = yield* service(TypeScriptApi);
|
|
14055
|
+
const tsUtils = yield* service(TypeScriptUtils);
|
|
14056
|
+
if (info.length === 0) return "";
|
|
14057
|
+
const textualExplanation = [];
|
|
14058
|
+
const appendInfo = (infoNode) => {
|
|
14059
|
+
const typeString = typeChecker.typeToString(
|
|
14060
|
+
infoNode.type,
|
|
14061
|
+
void 0,
|
|
14062
|
+
ts.TypeFormatFlags.NoTruncation
|
|
14063
|
+
);
|
|
14064
|
+
const positions = infoNode.nodes.map((_) => {
|
|
14065
|
+
const sourceFile = tsUtils.getSourceFileOfNode(_);
|
|
14066
|
+
const nodePosition = ts.getTokenPosOfNode(_, sourceFile);
|
|
14067
|
+
const { character, line } = ts.getLineAndCharacterOfPosition(sourceFile, nodePosition);
|
|
14068
|
+
const nodeText = sourceFile.text.substring(_.pos, _.end).trim().replace(/\n/g, " ").substr(0, 50);
|
|
14069
|
+
return `ln ${line + 1} col ${character} by \`${nodeText}\``;
|
|
14070
|
+
});
|
|
14071
|
+
textualExplanation.push(`- ${typeString} ${infoNode.kind} at ${positions.join(", ")}`);
|
|
14072
|
+
};
|
|
14073
|
+
const providedItems = info.filter((_) => _.kind === "provided");
|
|
14074
|
+
const requiredItems = info.filter((_) => _.kind === "required");
|
|
14075
|
+
if (providedItems.length > 0) {
|
|
14076
|
+
for (const item of providedItems) {
|
|
14077
|
+
appendInfo(item);
|
|
11658
14078
|
}
|
|
14079
|
+
if (textualExplanation.length > 0 && requiredItems.length > 0) textualExplanation.push("");
|
|
11659
14080
|
}
|
|
11660
|
-
|
|
11661
|
-
|
|
14081
|
+
if (requiredItems.length > 0) {
|
|
14082
|
+
for (const item of requiredItems) {
|
|
14083
|
+
appendInfo(item);
|
|
14084
|
+
}
|
|
14085
|
+
}
|
|
14086
|
+
return "/**\n" + textualExplanation.map((l) => " * " + l).join("\n") + "\n */";
|
|
14087
|
+
}
|
|
14088
|
+
);
|
|
14089
|
+
|
|
14090
|
+
// src/quickinfo/layerInfo.ts
|
|
11662
14091
|
function generateMarmaidUri(code) {
|
|
11663
14092
|
return gen(function* () {
|
|
11664
14093
|
const state = JSON.stringify({ code });
|
|
@@ -11690,61 +14119,32 @@ function getAdjustedNode(sourceFile, position) {
|
|
|
11690
14119
|
return { node, layerNode };
|
|
11691
14120
|
});
|
|
11692
14121
|
}
|
|
11693
|
-
function parseLayerGraph(
|
|
14122
|
+
function parseLayerGraph(layerNode) {
|
|
11694
14123
|
return gen(function* () {
|
|
11695
|
-
const
|
|
11696
|
-
|
|
11697
|
-
|
|
11698
|
-
|
|
11699
|
-
|
|
11700
|
-
|
|
11701
|
-
|
|
11702
|
-
|
|
11703
|
-
const
|
|
11704
|
-
|
|
11705
|
-
|
|
11706
|
-
};
|
|
11707
|
-
const mermaidLines = yield* processNodeMermaid(rootNode, ctx, graphCtx);
|
|
11708
|
-
const mermaidCode = "flowchart TB\n" + mermaidLines.join("\n");
|
|
11709
|
-
const textualExplanation = [];
|
|
11710
|
-
const appendInfo = (providesNode, type, kindText) => {
|
|
11711
|
-
const typeString = typeChecker.typeToString(
|
|
11712
|
-
type,
|
|
11713
|
-
void 0,
|
|
11714
|
-
ts.TypeFormatFlags.NoTruncation
|
|
11715
|
-
);
|
|
11716
|
-
const positions = providesNode.map((_) => {
|
|
11717
|
-
const nodePosition = _.node.getStart(sourceFile, false);
|
|
11718
|
-
const { character, line } = ts.getLineAndCharacterOfPosition(sourceFile, nodePosition);
|
|
11719
|
-
const nodeText = _.node.getText().trim().replace(/\n/g, " ").substr(0, 50);
|
|
11720
|
-
return "ln " + (line + 1) + " col " + character + " by `" + nodeText + "`";
|
|
11721
|
-
});
|
|
11722
|
-
textualExplanation.push("- " + typeString + " " + kindText + " at " + positions.join(", "));
|
|
11723
|
-
};
|
|
11724
|
-
for (const providesKey of rootNode.rout) {
|
|
11725
|
-
const providesNode = findInnermostGraphEdge(rootNode, "rout", providesKey);
|
|
11726
|
-
appendInfo(providesNode, graphCtx.services.get(providesKey), "provided");
|
|
11727
|
-
}
|
|
11728
|
-
if (textualExplanation.length > 0) textualExplanation.push("");
|
|
11729
|
-
for (const requiresKey of rootNode.rin) {
|
|
11730
|
-
const requiresNode = findInnermostGraphEdge(rootNode, "rin", requiresKey);
|
|
11731
|
-
appendInfo(requiresNode, graphCtx.services.get(requiresKey), "required");
|
|
11732
|
-
}
|
|
11733
|
-
return { mermaidCode, textualExplanation };
|
|
14124
|
+
const layerGraph = yield* extractLayerGraph(layerNode, {
|
|
14125
|
+
arrayLiteralAsMerge: false,
|
|
14126
|
+
explodeOnlyLayerCalls: false
|
|
14127
|
+
});
|
|
14128
|
+
const nestedGraphMermaid = yield* formatNestedLayerGraph(layerGraph);
|
|
14129
|
+
const outlineGraph = yield* extractOutlineGraph(layerGraph);
|
|
14130
|
+
const outlineGraphMermaid = yield* formatLayerOutlineGraph(outlineGraph);
|
|
14131
|
+
const providersAndRequirers = yield* extractProvidersAndRequirers(layerGraph);
|
|
14132
|
+
const providersAndRequirersTextualExplanation = yield* formatLayerProvidersAndRequirersInfo(
|
|
14133
|
+
providersAndRequirers
|
|
14134
|
+
);
|
|
14135
|
+
return { nestedGraphMermaid, outlineGraphMermaid, providersAndRequirersTextualExplanation };
|
|
11734
14136
|
});
|
|
11735
14137
|
}
|
|
11736
14138
|
function effectApiGetLayerGraph(sourceFile, line, character) {
|
|
11737
|
-
return
|
|
11738
|
-
|
|
11739
|
-
|
|
11740
|
-
|
|
11741
|
-
|
|
11742
|
-
|
|
11743
|
-
|
|
11744
|
-
|
|
11745
|
-
|
|
11746
|
-
})
|
|
11747
|
-
);
|
|
14139
|
+
return gen(function* () {
|
|
14140
|
+
const ts = yield* service(TypeScriptApi);
|
|
14141
|
+
const position = ts.getPositionOfLineAndCharacter(sourceFile, line, character);
|
|
14142
|
+
const maybeNodes = yield* getAdjustedNode(sourceFile, position);
|
|
14143
|
+
if (!maybeNodes) return yield* fail(new UnableToProduceLayerGraphError("No node found"));
|
|
14144
|
+
const { layerNode, node } = maybeNodes;
|
|
14145
|
+
const { nestedGraphMermaid } = yield* parseLayerGraph(layerNode);
|
|
14146
|
+
return { start: node.pos, end: node.end, mermaidCode: nestedGraphMermaid };
|
|
14147
|
+
});
|
|
11748
14148
|
}
|
|
11749
14149
|
function layerInfo(sourceFile, position, quickInfo2) {
|
|
11750
14150
|
return pipe(
|
|
@@ -11755,35 +14155,36 @@ function layerInfo(sourceFile, position, quickInfo2) {
|
|
|
11755
14155
|
if (!maybeNodes) return quickInfo2;
|
|
11756
14156
|
const { layerNode, node } = maybeNodes;
|
|
11757
14157
|
const layerInfoDisplayParts = yield* pipe(
|
|
11758
|
-
parseLayerGraph(
|
|
14158
|
+
parseLayerGraph(layerNode),
|
|
11759
14159
|
flatMap2(
|
|
11760
|
-
({
|
|
14160
|
+
({ nestedGraphMermaid, outlineGraphMermaid, providersAndRequirersTextualExplanation }) => gen(function* () {
|
|
11761
14161
|
const linkParts = [];
|
|
11762
14162
|
if (!options.noExternal) {
|
|
11763
|
-
const mermaidUri = yield* generateMarmaidUri(
|
|
14163
|
+
const mermaidUri = yield* generateMarmaidUri(nestedGraphMermaid);
|
|
14164
|
+
const outlineMermaidUri = yield* generateMarmaidUri(outlineGraphMermaid);
|
|
11764
14165
|
linkParts.push({ kind: "space", text: "\n" });
|
|
11765
14166
|
linkParts.push({ kind: "link", text: "{@link " });
|
|
11766
14167
|
linkParts.push({ kind: "linkText", text: mermaidUri + " Show full Layer graph" });
|
|
11767
14168
|
linkParts.push({ kind: "link", text: "}" });
|
|
14169
|
+
linkParts.push({ kind: "text", text: " - " });
|
|
14170
|
+
linkParts.push({ kind: "link", text: "{@link " });
|
|
14171
|
+
linkParts.push({ kind: "linkText", text: outlineMermaidUri + " Show Layer outline" });
|
|
14172
|
+
linkParts.push({ kind: "link", text: "}" });
|
|
11768
14173
|
linkParts.push({ kind: "space", text: "\n" });
|
|
11769
14174
|
}
|
|
11770
|
-
if (
|
|
14175
|
+
if (providersAndRequirersTextualExplanation.length === 0) return linkParts;
|
|
11771
14176
|
return [
|
|
11772
14177
|
{
|
|
11773
14178
|
kind: "text",
|
|
11774
|
-
text: "```\n
|
|
14179
|
+
text: "```\n" + providersAndRequirersTextualExplanation + "\n```\n"
|
|
11775
14180
|
},
|
|
11776
14181
|
...linkParts
|
|
11777
14182
|
];
|
|
11778
14183
|
})
|
|
11779
14184
|
),
|
|
11780
|
-
orElse2(
|
|
11781
|
-
(e) => succeed([{
|
|
11782
|
-
kind: "text",
|
|
11783
|
-
text: "```\n/** layer graph not created: " + e.message + " */\n```\n"
|
|
11784
|
-
}])
|
|
11785
|
-
)
|
|
14185
|
+
orElse2(() => succeed([]))
|
|
11786
14186
|
);
|
|
14187
|
+
if (layerInfoDisplayParts.length === 0) return quickInfo2;
|
|
11787
14188
|
if (!quickInfo2) {
|
|
11788
14189
|
const start = ts.getTokenPosOfNode(node, sourceFile);
|
|
11789
14190
|
const end = node.end;
|
|
@@ -12299,71 +14700,6 @@ var functionToArrow = createRefactor({
|
|
|
12299
14700
|
});
|
|
12300
14701
|
|
|
12301
14702
|
// src/refactors/layerMagic.ts
|
|
12302
|
-
function sortDependencies(nodes) {
|
|
12303
|
-
const result = [];
|
|
12304
|
-
const visited = /* @__PURE__ */ new Set();
|
|
12305
|
-
const visiting = /* @__PURE__ */ new Set();
|
|
12306
|
-
const cycles = [];
|
|
12307
|
-
const providesMap = /* @__PURE__ */ new Map();
|
|
12308
|
-
Object.entries(nodes).forEach(([nodeId, node]) => {
|
|
12309
|
-
node.provides.forEach((service2) => {
|
|
12310
|
-
if (!providesMap.has(service2)) {
|
|
12311
|
-
providesMap.set(service2, []);
|
|
12312
|
-
}
|
|
12313
|
-
providesMap.get(service2).push(nodeId);
|
|
12314
|
-
});
|
|
12315
|
-
});
|
|
12316
|
-
providesMap.forEach((nodeIds) => {
|
|
12317
|
-
nodeIds.sort((a, b) => {
|
|
12318
|
-
const nodeA = nodes[a];
|
|
12319
|
-
const nodeB = nodes[b];
|
|
12320
|
-
return nodeA.requires.length - nodeB.requires.length;
|
|
12321
|
-
});
|
|
12322
|
-
});
|
|
12323
|
-
const visit = (nodeId, path) => {
|
|
12324
|
-
if (visited.has(nodeId)) {
|
|
12325
|
-
return;
|
|
12326
|
-
}
|
|
12327
|
-
if (visiting.has(nodeId)) {
|
|
12328
|
-
const cycleStart = path.indexOf(nodeId);
|
|
12329
|
-
const cycle = path.slice(cycleStart).concat([nodeId]);
|
|
12330
|
-
const cycleServices = cycle.map((id) => {
|
|
12331
|
-
const node2 = nodes[id];
|
|
12332
|
-
return `${node2.provides.join(", ")} (requires: ${node2.requires.join(", ")})`;
|
|
12333
|
-
});
|
|
12334
|
-
cycles.push(cycleServices);
|
|
12335
|
-
return;
|
|
12336
|
-
}
|
|
12337
|
-
visiting.add(nodeId);
|
|
12338
|
-
const currentPath = [...path, nodeId];
|
|
12339
|
-
const dependencies = /* @__PURE__ */ new Set();
|
|
12340
|
-
const node = nodes[nodeId];
|
|
12341
|
-
node.requires.forEach((requiredService) => {
|
|
12342
|
-
const providers = providesMap.get(requiredService) || [];
|
|
12343
|
-
providers.forEach((providerId) => {
|
|
12344
|
-
if (providerId !== nodeId) {
|
|
12345
|
-
dependencies.add(providerId);
|
|
12346
|
-
}
|
|
12347
|
-
});
|
|
12348
|
-
});
|
|
12349
|
-
dependencies.forEach((depId) => {
|
|
12350
|
-
visit(depId, currentPath);
|
|
12351
|
-
});
|
|
12352
|
-
visiting.delete(nodeId);
|
|
12353
|
-
visited.add(nodeId);
|
|
12354
|
-
result.push(node);
|
|
12355
|
-
};
|
|
12356
|
-
Object.keys(nodes).forEach((nodeId) => {
|
|
12357
|
-
if (!visited.has(nodeId)) {
|
|
12358
|
-
visit(nodeId, []);
|
|
12359
|
-
}
|
|
12360
|
-
});
|
|
12361
|
-
return {
|
|
12362
|
-
sorted: result,
|
|
12363
|
-
cycles,
|
|
12364
|
-
hasCycles: cycles.length > 0
|
|
12365
|
-
};
|
|
12366
|
-
}
|
|
12367
14703
|
var layerMagic = createRefactor({
|
|
12368
14704
|
name: "layerMagic",
|
|
12369
14705
|
description: "Layer Magic",
|
|
@@ -12378,71 +14714,22 @@ var layerMagic = createRefactor({
|
|
|
12378
14714
|
"effect",
|
|
12379
14715
|
"Layer"
|
|
12380
14716
|
) || "Layer";
|
|
12381
|
-
const extractArrayLiteral = (node) => {
|
|
12382
|
-
if (ts.isArrayLiteralExpression(node)) {
|
|
12383
|
-
return pipe(
|
|
12384
|
-
all(...node.elements.map((element) => extractLayers(element, false))),
|
|
12385
|
-
map5(flatten)
|
|
12386
|
-
);
|
|
12387
|
-
}
|
|
12388
|
-
return TypeParserIssue.issue;
|
|
12389
|
-
};
|
|
12390
|
-
const extractLayerExpression = (node) => {
|
|
12391
|
-
if (ts.isExpression(node)) {
|
|
12392
|
-
return pipe(
|
|
12393
|
-
typeParser.layerType(typeChecker.getTypeAtLocation(node), node),
|
|
12394
|
-
map5((_) => [{ node, ..._ }])
|
|
12395
|
-
);
|
|
12396
|
-
}
|
|
12397
|
-
return TypeParserIssue.issue;
|
|
12398
|
-
};
|
|
12399
|
-
const extractLayerApi = (node) => {
|
|
12400
|
-
if (ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression) && ts.isIdentifier(node.expression.expression) && ts.idText(node.expression.expression) === layerIdentifier && ts.isIdentifier(node.expression.name) && ["provide", "provideMerge", "merge", "mergeAll"].map((_) => _.toLowerCase()).indexOf(
|
|
12401
|
-
ts.idText(node.expression.name).toLowerCase()
|
|
12402
|
-
) > -1) {
|
|
12403
|
-
return pipe(
|
|
12404
|
-
all(...node.arguments.map((element) => extractLayers(element, false))),
|
|
12405
|
-
map5(flatten)
|
|
12406
|
-
);
|
|
12407
|
-
}
|
|
12408
|
-
return TypeParserIssue.issue;
|
|
12409
|
-
};
|
|
12410
|
-
const extractPipeSequencing = (node) => {
|
|
12411
|
-
return pipe(
|
|
12412
|
-
typeParser.pipeCall(node),
|
|
12413
|
-
flatMap2((_) => {
|
|
12414
|
-
return all(...[_.subject, ..._.args].map((element) => extractLayers(element, true)));
|
|
12415
|
-
}),
|
|
12416
|
-
map5(flatten)
|
|
12417
|
-
);
|
|
12418
|
-
};
|
|
12419
|
-
const extractLayers = cachedBy(
|
|
12420
|
-
fn("layerMagic.apply.extractLayerArray")(function* (node, _inPipeContext) {
|
|
12421
|
-
return yield* pipe(
|
|
12422
|
-
extractArrayLiteral(node),
|
|
12423
|
-
orElse2(() => extractLayerApi(node)),
|
|
12424
|
-
_inPipeContext ? (x) => x : orElse2(() => extractPipeSequencing(node)),
|
|
12425
|
-
orElse2(() => extractLayerExpression(node))
|
|
12426
|
-
);
|
|
12427
|
-
}),
|
|
12428
|
-
"layerMagic.apply.extractLayerArray",
|
|
12429
|
-
(node) => node
|
|
12430
|
-
);
|
|
12431
14717
|
const adjustedNode = (node) => {
|
|
12432
|
-
if (ts.
|
|
12433
|
-
return
|
|
12434
|
-
}
|
|
12435
|
-
if (ts.isIdentifier(node) && ts.isPropertyDeclaration(node.parent) && node.parent.initializer) {
|
|
12436
|
-
return adjustedNode(node.parent.initializer);
|
|
14718
|
+
if (node.parent && (ts.isVariableDeclaration(node.parent) || ts.isPropertyDeclaration(node.parent)) && ts.isIdentifier(node) && node.parent.initializer && node.parent.name === node) {
|
|
14719
|
+
return node.parent.initializer;
|
|
12437
14720
|
}
|
|
12438
14721
|
return node;
|
|
12439
14722
|
};
|
|
12440
14723
|
const computeAsAnyAsLayerRefactor = (node) => {
|
|
12441
14724
|
const atLocation = adjustedNode(node);
|
|
12442
14725
|
return pipe(
|
|
12443
|
-
|
|
14726
|
+
extractLayerGraph(atLocation, {
|
|
14727
|
+
arrayLiteralAsMerge: true,
|
|
14728
|
+
explodeOnlyLayerCalls: true
|
|
14729
|
+
}),
|
|
14730
|
+
flatMap2(extractOutlineGraph),
|
|
12444
14731
|
flatMap2(
|
|
12445
|
-
(extractedLayer) => extractedLayer
|
|
14732
|
+
(extractedLayer) => nodeCount(extractedLayer) <= 1 ? TypeParserIssue.issue : succeed(extractedLayer)
|
|
12446
14733
|
),
|
|
12447
14734
|
map5((extractedLayers) => ({
|
|
12448
14735
|
kind: "refactor.rewrite.effect.layerMagicPrepare",
|
|
@@ -12450,21 +14737,27 @@ var layerMagic = createRefactor({
|
|
|
12450
14737
|
apply: pipe(
|
|
12451
14738
|
gen(function* () {
|
|
12452
14739
|
const changeTracker = yield* service(ChangeTracker);
|
|
12453
|
-
const
|
|
12454
|
-
for (const layer of extractedLayers) {
|
|
12455
|
-
|
|
12456
|
-
memory,
|
|
12457
|
-
layer.ROut,
|
|
12458
|
-
(_) => succeed((_.flags & ts.TypeFlags.Never) !== 0)
|
|
12459
|
-
);
|
|
14740
|
+
const layerOutputTypes = /* @__PURE__ */ new Set();
|
|
14741
|
+
for (const layer of values2(nodes(extractedLayers))) {
|
|
14742
|
+
layer.provides.forEach((_) => layerOutputTypes.add(_));
|
|
12460
14743
|
}
|
|
14744
|
+
const layerNodes = pipe(
|
|
14745
|
+
values2(nodes(extractedLayers)),
|
|
14746
|
+
fromIterable,
|
|
14747
|
+
map4((_) => _.node),
|
|
14748
|
+
filter(ts.isExpression),
|
|
14749
|
+
sort(mapInput(
|
|
14750
|
+
number2,
|
|
14751
|
+
(_) => _.pos
|
|
14752
|
+
))
|
|
14753
|
+
);
|
|
12461
14754
|
const previouslyProvided = yield* pipe(
|
|
12462
14755
|
typeParser.layerType(typeChecker.getTypeAtLocation(atLocation), atLocation),
|
|
12463
14756
|
map5((_) => _.ROut),
|
|
12464
14757
|
option
|
|
12465
14758
|
);
|
|
12466
14759
|
const [existingBefore, newlyIntroduced] = pipe(
|
|
12467
|
-
fromIterable(
|
|
14760
|
+
fromIterable(layerOutputTypes),
|
|
12468
14761
|
sort(typeCheckerUtils.deterministicTypeOrder),
|
|
12469
14762
|
partition(
|
|
12470
14763
|
(_) => isNone2(previouslyProvided) || typeChecker.isTypeAssignableTo(_, previouslyProvided.value)
|
|
@@ -12489,7 +14782,7 @@ var layerMagic = createRefactor({
|
|
|
12489
14782
|
);
|
|
12490
14783
|
const newDeclaration = ts.factory.createAsExpression(
|
|
12491
14784
|
ts.factory.createAsExpression(
|
|
12492
|
-
ts.factory.createArrayLiteralExpression(
|
|
14785
|
+
ts.factory.createArrayLiteralExpression(layerNodes),
|
|
12493
14786
|
ts.factory.createTypeReferenceNode("any")
|
|
12494
14787
|
),
|
|
12495
14788
|
ts.factory.createTypeReferenceNode(
|
|
@@ -12511,8 +14804,9 @@ var layerMagic = createRefactor({
|
|
|
12511
14804
|
if (ts.isAsExpression(node) && ts.isTypeReferenceNode(node.type)) {
|
|
12512
14805
|
const expression = node.expression;
|
|
12513
14806
|
if (ts.isAsExpression(expression) && expression.type.kind === ts.SyntaxKind.AnyKeyword) {
|
|
14807
|
+
const type = typeChecker.getTypeAtLocation(node.type);
|
|
12514
14808
|
return pipe(
|
|
12515
|
-
typeParser.layerType(
|
|
14809
|
+
typeParser.layerType(type, node.type),
|
|
12516
14810
|
map5((_) => ({ node, ..._, castedStructure: expression.expression }))
|
|
12517
14811
|
);
|
|
12518
14812
|
}
|
|
@@ -12525,80 +14819,49 @@ var layerMagic = createRefactor({
|
|
|
12525
14819
|
parseAsAnyAsLayer(atLocation),
|
|
12526
14820
|
flatMap2(
|
|
12527
14821
|
(_targetLayer) => pipe(
|
|
12528
|
-
|
|
12529
|
-
|
|
14822
|
+
extractLayerGraph(_targetLayer.castedStructure, {
|
|
14823
|
+
arrayLiteralAsMerge: true,
|
|
14824
|
+
explodeOnlyLayerCalls: true
|
|
14825
|
+
}),
|
|
14826
|
+
flatMap2(extractOutlineGraph),
|
|
12530
14827
|
flatMap2(
|
|
12531
|
-
(extractedLayer) => extractedLayer
|
|
14828
|
+
(extractedLayer) => nodeCount(extractedLayer) <= 1 ? TypeParserIssue.issue : succeed(extractedLayer)
|
|
12532
14829
|
),
|
|
12533
14830
|
map5((extractedLayers) => ({
|
|
12534
14831
|
kind: "refactor.rewrite.effect.layerMagicBuild",
|
|
12535
14832
|
description: "Compose layers automatically with target output services",
|
|
12536
14833
|
apply: gen(function* () {
|
|
12537
14834
|
const changeTracker = yield* service(ChangeTracker);
|
|
12538
|
-
const
|
|
12539
|
-
|
|
12540
|
-
|
|
12541
|
-
|
|
12542
|
-
|
|
14835
|
+
const { layerMagicNodes, missingOutputTypes } = yield* pipe(
|
|
14836
|
+
convertOutlineGraphToLayerMagic(
|
|
14837
|
+
extractedLayers,
|
|
14838
|
+
_targetLayer.ROut
|
|
14839
|
+
),
|
|
14840
|
+
provideService(TypeCheckerApi, typeChecker),
|
|
14841
|
+
provideService(TypeCheckerUtils, typeCheckerUtils),
|
|
14842
|
+
provideService(TypeScriptApi, ts)
|
|
12543
14843
|
);
|
|
12544
|
-
const nodes = {};
|
|
12545
|
-
for (let i = 0; i < extractedLayers.length; i++) {
|
|
12546
|
-
const layer = extractedLayers[i];
|
|
12547
|
-
const { allIndexes: providedIndexes } = yield* typeCheckerUtils.appendToUniqueTypesMap(
|
|
12548
|
-
memory,
|
|
12549
|
-
layer.ROut,
|
|
12550
|
-
(_) => succeed((_.flags & ts.TypeFlags.Never) !== 0)
|
|
12551
|
-
);
|
|
12552
|
-
const { allIndexes: requiredIndexes } = yield* typeCheckerUtils.appendToUniqueTypesMap(
|
|
12553
|
-
memory,
|
|
12554
|
-
layer.RIn,
|
|
12555
|
-
(_) => succeed((_.flags & ts.TypeFlags.Never) !== 0)
|
|
12556
|
-
);
|
|
12557
|
-
nodes[`node_${i}`] = {
|
|
12558
|
-
provides: providedIndexes.filter((_) => requiredIndexes.indexOf(_) === -1),
|
|
12559
|
-
// only provide indexes that are not required
|
|
12560
|
-
requires: requiredIndexes,
|
|
12561
|
-
node: layer.node
|
|
12562
|
-
};
|
|
12563
|
-
}
|
|
12564
|
-
const sortResult = sortDependencies(nodes);
|
|
12565
|
-
const sortedNodes = sortResult.sorted.reverse();
|
|
12566
|
-
const missingOutput = new Set(outputIndexes);
|
|
12567
|
-
const missingInternal = /* @__PURE__ */ new Set();
|
|
12568
|
-
const outputEntry = [];
|
|
12569
|
-
for (let i = 0; i < sortedNodes.length; i++) {
|
|
12570
|
-
const graphNode = sortedNodes[i];
|
|
12571
|
-
const mergeOutput = graphNode.provides.filter((_) => missingOutput.has(_));
|
|
12572
|
-
const provideInternal = graphNode.provides.filter((_) => missingInternal.has(_));
|
|
12573
|
-
graphNode.requires.forEach((_) => missingInternal.add(_));
|
|
12574
|
-
mergeOutput.forEach((_) => missingOutput.delete(_));
|
|
12575
|
-
outputEntry.push({
|
|
12576
|
-
merges: mergeOutput.length > 0,
|
|
12577
|
-
provides: provideInternal.length > 0,
|
|
12578
|
-
node: graphNode.node
|
|
12579
|
-
});
|
|
12580
|
-
}
|
|
12581
14844
|
const newDeclaration = ts.factory.createCallExpression(
|
|
12582
14845
|
ts.factory.createPropertyAccessExpression(
|
|
12583
|
-
|
|
14846
|
+
layerMagicNodes[0].layerExpression,
|
|
12584
14847
|
"pipe"
|
|
12585
14848
|
),
|
|
12586
14849
|
[],
|
|
12587
|
-
|
|
14850
|
+
layerMagicNodes.slice(1).map(
|
|
12588
14851
|
(_) => ts.factory.createCallExpression(
|
|
12589
14852
|
ts.factory.createPropertyAccessExpression(
|
|
12590
14853
|
ts.factory.createIdentifier(layerIdentifier),
|
|
12591
14854
|
_.merges && _.provides ? "provideMerge" : _.merges ? "merge" : "provide"
|
|
12592
14855
|
),
|
|
12593
14856
|
[],
|
|
12594
|
-
[_.
|
|
14857
|
+
[_.layerExpression]
|
|
12595
14858
|
)
|
|
12596
14859
|
)
|
|
12597
14860
|
);
|
|
12598
|
-
const newDeclarationWithComment =
|
|
14861
|
+
const newDeclarationWithComment = missingOutputTypes.size > 0 ? ts.addSyntheticTrailingComment(
|
|
12599
14862
|
newDeclaration,
|
|
12600
14863
|
ts.SyntaxKind.MultiLineCommentTrivia,
|
|
12601
|
-
" Unable to find " + fromIterable(
|
|
14864
|
+
" Unable to find " + fromIterable(missingOutputTypes.values()).map(
|
|
12602
14865
|
(_) => typeChecker.typeToString(_, void 0, ts.TypeFormatFlags.NoTruncation)
|
|
12603
14866
|
).join(", ") + " in the provided layers. ",
|
|
12604
14867
|
false
|