@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/index.js
CHANGED
|
@@ -903,6 +903,7 @@ var NanoFiber = class {
|
|
|
903
903
|
_stack = [];
|
|
904
904
|
_yielded = void 0;
|
|
905
905
|
_services = {};
|
|
906
|
+
_cache = {};
|
|
906
907
|
runLoop(nano) {
|
|
907
908
|
let current = nano;
|
|
908
909
|
while (true) {
|
|
@@ -1053,8 +1054,32 @@ var service = (tag) => {
|
|
|
1053
1054
|
nano[args] = tag;
|
|
1054
1055
|
return nano;
|
|
1055
1056
|
};
|
|
1056
|
-
|
|
1057
|
-
|
|
1057
|
+
var CachedProto = {
|
|
1058
|
+
...PrimitiveProto,
|
|
1059
|
+
[evaluate](fiber) {
|
|
1060
|
+
const [fa, type, key] = this[args];
|
|
1061
|
+
const cache = fiber._cache[type] || /* @__PURE__ */ new WeakMap();
|
|
1062
|
+
fiber._cache[type] = cache;
|
|
1063
|
+
const cached2 = cache.get(key);
|
|
1064
|
+
if (cached2) return cached2;
|
|
1065
|
+
return match2(fa, {
|
|
1066
|
+
onSuccess: (_) => {
|
|
1067
|
+
cache.set(key, succeed(_));
|
|
1068
|
+
return succeed(_);
|
|
1069
|
+
},
|
|
1070
|
+
onFailure: (_) => {
|
|
1071
|
+
cache.set(key, fail(_));
|
|
1072
|
+
return fail(_);
|
|
1073
|
+
}
|
|
1074
|
+
});
|
|
1075
|
+
}
|
|
1076
|
+
};
|
|
1077
|
+
function cachedBy(fa, type, lookupKey) {
|
|
1078
|
+
return (...p) => {
|
|
1079
|
+
const nano = Object.create(CachedProto);
|
|
1080
|
+
nano[args] = [fa(...p), type, lookupKey(...p)];
|
|
1081
|
+
return nano;
|
|
1082
|
+
};
|
|
1058
1083
|
}
|
|
1059
1084
|
var option = (fa) => {
|
|
1060
1085
|
const nano = Object.create(MatchProto);
|
|
@@ -2018,8 +2043,7 @@ var unrollUnionMembers = (type) => {
|
|
|
2018
2043
|
var appendToUniqueTypesMap = fn(
|
|
2019
2044
|
"TypeCheckerApi.appendToUniqueTypesMap"
|
|
2020
2045
|
)(
|
|
2021
|
-
function* (memory, initialType,
|
|
2022
|
-
const ts = yield* service(TypeScriptApi);
|
|
2046
|
+
function* (memory, initialType, shouldExclude) {
|
|
2023
2047
|
const typeChecker = yield* service(TypeCheckerApi);
|
|
2024
2048
|
const newIndexes = /* @__PURE__ */ new Set();
|
|
2025
2049
|
const knownIndexes = /* @__PURE__ */ new Set();
|
|
@@ -2027,7 +2051,7 @@ var appendToUniqueTypesMap = fn(
|
|
|
2027
2051
|
while (toTest.length > 0) {
|
|
2028
2052
|
const type = toTest.pop();
|
|
2029
2053
|
if (!type) break;
|
|
2030
|
-
if (
|
|
2054
|
+
if (yield* shouldExclude(type)) {
|
|
2031
2055
|
continue;
|
|
2032
2056
|
}
|
|
2033
2057
|
if (type.isUnion()) {
|
|
@@ -3014,7 +3038,18 @@ var leakingRequirements = createDiagnostic({
|
|
|
3014
3038
|
);
|
|
3015
3039
|
if (effectContextType) {
|
|
3016
3040
|
effectMembers++;
|
|
3017
|
-
const { allIndexes } = yield* appendToUniqueTypesMap(
|
|
3041
|
+
const { allIndexes } = yield* appendToUniqueTypesMap(
|
|
3042
|
+
memory,
|
|
3043
|
+
effectContextType,
|
|
3044
|
+
(type) => {
|
|
3045
|
+
if (type.flags & ts.TypeFlags.Never) return succeed(true);
|
|
3046
|
+
return pipe(
|
|
3047
|
+
typeParser.scopeType(type, atLocation),
|
|
3048
|
+
map4(() => true),
|
|
3049
|
+
orElse2(() => succeed(false))
|
|
3050
|
+
);
|
|
3051
|
+
}
|
|
3052
|
+
);
|
|
3018
3053
|
if (!sharedRequirementsKeys) {
|
|
3019
3054
|
sharedRequirementsKeys = allIndexes;
|
|
3020
3055
|
} else {
|
|
@@ -3571,7 +3606,7 @@ Consider using "scoped" instead to get rid of the scope in the requirements.`,
|
|
|
3571
3606
|
var tryCatchInEffectGen = createDiagnostic({
|
|
3572
3607
|
name: "tryCatchInEffectGen",
|
|
3573
3608
|
code: 12,
|
|
3574
|
-
severity: "
|
|
3609
|
+
severity: "suggestion",
|
|
3575
3610
|
apply: fn("tryCatchInEffectGen.apply")(function* (sourceFile, report) {
|
|
3576
3611
|
const ts = yield* service(TypeScriptApi);
|
|
3577
3612
|
const typeParser = yield* service(TypeParser);
|
|
@@ -8796,6 +8831,7 @@ function processLayerGraphNode(ctx, node, pipedInGraphNode) {
|
|
|
8796
8831
|
const ts = yield* service(TypeScriptApi);
|
|
8797
8832
|
const typeChecker = yield* service(TypeCheckerApi);
|
|
8798
8833
|
const typeParser = yield* service(TypeParser);
|
|
8834
|
+
const excludeNever = (type) => succeed((type.flags & ts.TypeFlags.Never) !== 0);
|
|
8799
8835
|
const maybePipe = yield* option(typeParser.pipeCall(node));
|
|
8800
8836
|
if (isSome2(maybePipe)) {
|
|
8801
8837
|
let graphNode = yield* processLayerGraphNode(ctx, maybePipe.value.subject, void 0);
|
|
@@ -8815,12 +8851,12 @@ function processLayerGraphNode(ctx, node, pipedInGraphNode) {
|
|
|
8815
8851
|
const { allIndexes: outTypes } = yield* appendToUniqueTypesMap(
|
|
8816
8852
|
ctx.services,
|
|
8817
8853
|
maybeLayer.value.ROut,
|
|
8818
|
-
|
|
8854
|
+
excludeNever
|
|
8819
8855
|
);
|
|
8820
8856
|
const { allIndexes: inTypes } = yield* appendToUniqueTypesMap(
|
|
8821
8857
|
ctx.services,
|
|
8822
8858
|
maybeLayer.value.RIn,
|
|
8823
|
-
|
|
8859
|
+
excludeNever
|
|
8824
8860
|
);
|
|
8825
8861
|
return new GraphNodeCompoundTransform(
|
|
8826
8862
|
ctx.nextId(),
|
|
@@ -8844,12 +8880,12 @@ function processLayerGraphNode(ctx, node, pipedInGraphNode) {
|
|
|
8844
8880
|
const { allIndexes: outTypes } = yield* appendToUniqueTypesMap(
|
|
8845
8881
|
ctx.services,
|
|
8846
8882
|
maybeLayer.value.ROut,
|
|
8847
|
-
|
|
8883
|
+
excludeNever
|
|
8848
8884
|
);
|
|
8849
8885
|
const { allIndexes: inTypes } = yield* appendToUniqueTypesMap(
|
|
8850
8886
|
ctx.services,
|
|
8851
8887
|
maybeLayer.value.RIn,
|
|
8852
|
-
|
|
8888
|
+
excludeNever
|
|
8853
8889
|
);
|
|
8854
8890
|
if (ts.isCallExpression(node)) {
|
|
8855
8891
|
const argNodes = yield* option(
|
|
@@ -8894,12 +8930,12 @@ function processLayerGraphNode(ctx, node, pipedInGraphNode) {
|
|
|
8894
8930
|
const { allIndexes: outTypes } = yield* appendToUniqueTypesMap(
|
|
8895
8931
|
ctx.services,
|
|
8896
8932
|
maybeLayer.value.ROut,
|
|
8897
|
-
|
|
8933
|
+
excludeNever
|
|
8898
8934
|
);
|
|
8899
8935
|
const { allIndexes: inTypes } = yield* appendToUniqueTypesMap(
|
|
8900
8936
|
ctx.services,
|
|
8901
8937
|
maybeLayer.value.RIn,
|
|
8902
|
-
|
|
8938
|
+
excludeNever
|
|
8903
8939
|
);
|
|
8904
8940
|
return new GraphNodeLeaf(ctx.nextId(), node, outTypes, inTypes);
|
|
8905
8941
|
}
|