@effect/language-service 0.25.0 → 0.25.1
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/cli.js +1869 -273
- package/cli.js.map +1 -1
- package/index.js +49 -13
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/transform.js +42 -7
- package/transform.js.map +1 -1
package/package.json
CHANGED
package/transform.js
CHANGED
|
@@ -902,6 +902,7 @@ var NanoFiber = class {
|
|
|
902
902
|
_stack = [];
|
|
903
903
|
_yielded = void 0;
|
|
904
904
|
_services = {};
|
|
905
|
+
_cache = {};
|
|
905
906
|
runLoop(nano) {
|
|
906
907
|
let current = nano;
|
|
907
908
|
while (true) {
|
|
@@ -1052,8 +1053,32 @@ var service = (tag) => {
|
|
|
1052
1053
|
nano[args] = tag;
|
|
1053
1054
|
return nano;
|
|
1054
1055
|
};
|
|
1055
|
-
|
|
1056
|
-
|
|
1056
|
+
var CachedProto = {
|
|
1057
|
+
...PrimitiveProto,
|
|
1058
|
+
[evaluate](fiber) {
|
|
1059
|
+
const [fa, type, key] = this[args];
|
|
1060
|
+
const cache = fiber._cache[type] || /* @__PURE__ */ new WeakMap();
|
|
1061
|
+
fiber._cache[type] = cache;
|
|
1062
|
+
const cached2 = cache.get(key);
|
|
1063
|
+
if (cached2) return cached2;
|
|
1064
|
+
return match2(fa, {
|
|
1065
|
+
onSuccess: (_) => {
|
|
1066
|
+
cache.set(key, succeed(_));
|
|
1067
|
+
return succeed(_);
|
|
1068
|
+
},
|
|
1069
|
+
onFailure: (_) => {
|
|
1070
|
+
cache.set(key, fail(_));
|
|
1071
|
+
return fail(_);
|
|
1072
|
+
}
|
|
1073
|
+
});
|
|
1074
|
+
}
|
|
1075
|
+
};
|
|
1076
|
+
function cachedBy(fa, type, lookupKey) {
|
|
1077
|
+
return (...p) => {
|
|
1078
|
+
const nano = Object.create(CachedProto);
|
|
1079
|
+
nano[args] = [fa(...p), type, lookupKey(...p)];
|
|
1080
|
+
return nano;
|
|
1081
|
+
};
|
|
1057
1082
|
}
|
|
1058
1083
|
var option = (fa) => {
|
|
1059
1084
|
const nano = Object.create(MatchProto);
|
|
@@ -1630,8 +1655,7 @@ var unrollUnionMembers = (type) => {
|
|
|
1630
1655
|
var appendToUniqueTypesMap = fn(
|
|
1631
1656
|
"TypeCheckerApi.appendToUniqueTypesMap"
|
|
1632
1657
|
)(
|
|
1633
|
-
function* (memory, initialType,
|
|
1634
|
-
const ts = yield* service(TypeScriptApi);
|
|
1658
|
+
function* (memory, initialType, shouldExclude) {
|
|
1635
1659
|
const typeChecker = yield* service(TypeCheckerApi);
|
|
1636
1660
|
const newIndexes = /* @__PURE__ */ new Set();
|
|
1637
1661
|
const knownIndexes = /* @__PURE__ */ new Set();
|
|
@@ -1639,7 +1663,7 @@ var appendToUniqueTypesMap = fn(
|
|
|
1639
1663
|
while (toTest.length > 0) {
|
|
1640
1664
|
const type = toTest.pop();
|
|
1641
1665
|
if (!type) break;
|
|
1642
|
-
if (
|
|
1666
|
+
if (yield* shouldExclude(type)) {
|
|
1643
1667
|
continue;
|
|
1644
1668
|
}
|
|
1645
1669
|
if (type.isUnion()) {
|
|
@@ -2887,7 +2911,18 @@ var leakingRequirements = createDiagnostic({
|
|
|
2887
2911
|
);
|
|
2888
2912
|
if (effectContextType) {
|
|
2889
2913
|
effectMembers++;
|
|
2890
|
-
const { allIndexes } = yield* appendToUniqueTypesMap(
|
|
2914
|
+
const { allIndexes } = yield* appendToUniqueTypesMap(
|
|
2915
|
+
memory,
|
|
2916
|
+
effectContextType,
|
|
2917
|
+
(type) => {
|
|
2918
|
+
if (type.flags & ts.TypeFlags.Never) return succeed(true);
|
|
2919
|
+
return pipe(
|
|
2920
|
+
typeParser.scopeType(type, atLocation),
|
|
2921
|
+
map3(() => true),
|
|
2922
|
+
orElse2(() => succeed(false))
|
|
2923
|
+
);
|
|
2924
|
+
}
|
|
2925
|
+
);
|
|
2891
2926
|
if (!sharedRequirementsKeys) {
|
|
2892
2927
|
sharedRequirementsKeys = allIndexes;
|
|
2893
2928
|
} else {
|
|
@@ -3444,7 +3479,7 @@ Consider using "scoped" instead to get rid of the scope in the requirements.`,
|
|
|
3444
3479
|
var tryCatchInEffectGen = createDiagnostic({
|
|
3445
3480
|
name: "tryCatchInEffectGen",
|
|
3446
3481
|
code: 12,
|
|
3447
|
-
severity: "
|
|
3482
|
+
severity: "suggestion",
|
|
3448
3483
|
apply: fn("tryCatchInEffectGen.apply")(function* (sourceFile, report) {
|
|
3449
3484
|
const ts = yield* service(TypeScriptApi);
|
|
3450
3485
|
const typeParser = yield* service(TypeParser);
|