@effect/language-service 0.27.2 → 0.28.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/README.md +1 -0
- package/cli.js +48 -2
- package/cli.js.map +1 -1
- package/index.js +871 -360
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/transform.js +48 -2
- package/transform.js.map +1 -1
package/package.json
CHANGED
package/transform.js
CHANGED
|
@@ -1158,13 +1158,17 @@ function parsePackageContentNameAndVersionFromScope(v) {
|
|
|
1158
1158
|
...hasProperty(packageJsonContent, "peerDependencies") && isObject(packageJsonContent.peerDependencies) ? packageJsonContent.peerDependencies : {},
|
|
1159
1159
|
...hasProperty(packageJsonContent, "devDependencies") && isObject(packageJsonContent.devDependencies) ? packageJsonContent.devDependencies : {}
|
|
1160
1160
|
});
|
|
1161
|
+
const exportsKeys = Object.keys(
|
|
1162
|
+
hasProperty(packageJsonContent, "exports") && isObject(packageJsonContent.exports) ? packageJsonContent.exports : {}
|
|
1163
|
+
);
|
|
1161
1164
|
return {
|
|
1162
1165
|
name: name.toLowerCase(),
|
|
1163
1166
|
version: version.toLowerCase(),
|
|
1164
1167
|
hasEffectInPeerDependencies,
|
|
1165
1168
|
contents: packageJsonContent,
|
|
1166
1169
|
packageDirectory: packageJsonScope.packageDirectory,
|
|
1167
|
-
referencedPackages
|
|
1170
|
+
referencedPackages,
|
|
1171
|
+
exportsKeys
|
|
1168
1172
|
};
|
|
1169
1173
|
}
|
|
1170
1174
|
var resolveModulePattern = fn("resolveModulePattern")(
|
|
@@ -2538,6 +2542,47 @@ function make2(ts, typeChecker) {
|
|
|
2538
2542
|
"TypeParser.scopeType",
|
|
2539
2543
|
(type) => type
|
|
2540
2544
|
);
|
|
2545
|
+
const promiseLike = cachedBy(
|
|
2546
|
+
function(type, atLocation) {
|
|
2547
|
+
const thenProperty = type.getProperty("then");
|
|
2548
|
+
if (!thenProperty) return typeParserIssue("not a promise - missing then property", type, atLocation);
|
|
2549
|
+
const thenType = typeChecker.getTypeOfSymbolAtLocation(thenProperty, atLocation);
|
|
2550
|
+
if (!thenType) return typeParserIssue("not a promise - missing then property", type, atLocation);
|
|
2551
|
+
for (const callSignature of thenType.getCallSignatures()) {
|
|
2552
|
+
const parameter = callSignature.parameters[0];
|
|
2553
|
+
if (!parameter) continue;
|
|
2554
|
+
const parameterType = callSignature.getTypeParameterAtPosition(0);
|
|
2555
|
+
if (!parameterType) continue;
|
|
2556
|
+
let callbackCallSignatures = [];
|
|
2557
|
+
let toTest = [parameterType];
|
|
2558
|
+
while (toTest.length > 0) {
|
|
2559
|
+
const type2 = toTest.shift();
|
|
2560
|
+
if (!type2) continue;
|
|
2561
|
+
const callSignatures = type2.getCallSignatures();
|
|
2562
|
+
callbackCallSignatures = callbackCallSignatures.concat(callSignatures);
|
|
2563
|
+
if (type2.isUnion()) {
|
|
2564
|
+
toTest = toTest.concat(type2.types);
|
|
2565
|
+
}
|
|
2566
|
+
}
|
|
2567
|
+
for (const callableType of callbackCallSignatures) {
|
|
2568
|
+
const callbackParameter = callableType.parameters[0];
|
|
2569
|
+
if (!callbackParameter) {
|
|
2570
|
+
continue;
|
|
2571
|
+
}
|
|
2572
|
+
const callbackParameterType = callableType.getTypeParameterAtPosition(0);
|
|
2573
|
+
if (!callbackParameterType) {
|
|
2574
|
+
continue;
|
|
2575
|
+
}
|
|
2576
|
+
return succeed({
|
|
2577
|
+
type: callbackParameterType
|
|
2578
|
+
});
|
|
2579
|
+
}
|
|
2580
|
+
}
|
|
2581
|
+
return typeParserIssue("not a promise", type, atLocation);
|
|
2582
|
+
},
|
|
2583
|
+
"TypeParser.promiseLike",
|
|
2584
|
+
(type) => type
|
|
2585
|
+
);
|
|
2541
2586
|
return {
|
|
2542
2587
|
effectType,
|
|
2543
2588
|
strictEffectType,
|
|
@@ -2553,7 +2598,8 @@ function make2(ts, typeChecker) {
|
|
|
2553
2598
|
contextTag,
|
|
2554
2599
|
pipeableType,
|
|
2555
2600
|
pipeCall,
|
|
2556
|
-
scopeType
|
|
2601
|
+
scopeType,
|
|
2602
|
+
promiseLike
|
|
2557
2603
|
};
|
|
2558
2604
|
}
|
|
2559
2605
|
|