@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 CHANGED
@@ -65,6 +65,7 @@ And you're done! You'll now be able to use a set of refactors and diagnostics th
65
65
  - Transform an async function definition, into an Effect by using Effect.gen.
66
66
  - Transform an async function definition, into an Effect by using Effect.gen, and generating a tagged error for each promise call.
67
67
  - Transform a function returning an Effect.gen into a Effect.fn
68
+ - Implement Service accessors in an `Effect.Service` or `Context.Tag` declaration
68
69
  - Function calls to pipe: Transform a set of function calls to a pipe() call.
69
70
  - Pipe to datafirst: Transform a pipe() call into a series of datafirst function calls (where available).
70
71
  - Toggle return type signature: With a single refactor, adds or removes type annotations from the definition.
package/cli.js CHANGED
@@ -30087,13 +30087,17 @@ function parsePackageContentNameAndVersionFromScope(v) {
30087
30087
  ...hasProperty(packageJsonContent, "peerDependencies") && isObject(packageJsonContent.peerDependencies) ? packageJsonContent.peerDependencies : {},
30088
30088
  ...hasProperty(packageJsonContent, "devDependencies") && isObject(packageJsonContent.devDependencies) ? packageJsonContent.devDependencies : {}
30089
30089
  });
30090
+ const exportsKeys = Object.keys(
30091
+ hasProperty(packageJsonContent, "exports") && isObject(packageJsonContent.exports) ? packageJsonContent.exports : {}
30092
+ );
30090
30093
  return {
30091
30094
  name: name.toLowerCase(),
30092
30095
  version: version.toLowerCase(),
30093
30096
  hasEffectInPeerDependencies,
30094
30097
  contents: packageJsonContent,
30095
30098
  packageDirectory: packageJsonScope.packageDirectory,
30096
- referencedPackages
30099
+ referencedPackages,
30100
+ exportsKeys
30097
30101
  };
30098
30102
  }
30099
30103
  var resolveModulePattern = fn("resolveModulePattern")(
@@ -31467,6 +31471,47 @@ function make62(ts2, typeChecker) {
31467
31471
  "TypeParser.scopeType",
31468
31472
  (type2) => type2
31469
31473
  );
31474
+ const promiseLike = cachedBy(
31475
+ function(type2, atLocation) {
31476
+ const thenProperty = type2.getProperty("then");
31477
+ if (!thenProperty) return typeParserIssue("not a promise - missing then property", type2, atLocation);
31478
+ const thenType = typeChecker.getTypeOfSymbolAtLocation(thenProperty, atLocation);
31479
+ if (!thenType) return typeParserIssue("not a promise - missing then property", type2, atLocation);
31480
+ for (const callSignature of thenType.getCallSignatures()) {
31481
+ const parameter = callSignature.parameters[0];
31482
+ if (!parameter) continue;
31483
+ const parameterType = callSignature.getTypeParameterAtPosition(0);
31484
+ if (!parameterType) continue;
31485
+ let callbackCallSignatures = [];
31486
+ let toTest = [parameterType];
31487
+ while (toTest.length > 0) {
31488
+ const type3 = toTest.shift();
31489
+ if (!type3) continue;
31490
+ const callSignatures = type3.getCallSignatures();
31491
+ callbackCallSignatures = callbackCallSignatures.concat(callSignatures);
31492
+ if (type3.isUnion()) {
31493
+ toTest = toTest.concat(type3.types);
31494
+ }
31495
+ }
31496
+ for (const callableType of callbackCallSignatures) {
31497
+ const callbackParameter = callableType.parameters[0];
31498
+ if (!callbackParameter) {
31499
+ continue;
31500
+ }
31501
+ const callbackParameterType = callableType.getTypeParameterAtPosition(0);
31502
+ if (!callbackParameterType) {
31503
+ continue;
31504
+ }
31505
+ return succeed17({
31506
+ type: callbackParameterType
31507
+ });
31508
+ }
31509
+ }
31510
+ return typeParserIssue("not a promise", type2, atLocation);
31511
+ },
31512
+ "TypeParser.promiseLike",
31513
+ (type2) => type2
31514
+ );
31470
31515
  return {
31471
31516
  effectType,
31472
31517
  strictEffectType,
@@ -31482,7 +31527,8 @@ function make62(ts2, typeChecker) {
31482
31527
  contextTag,
31483
31528
  pipeableType,
31484
31529
  pipeCall,
31485
- scopeType
31530
+ scopeType,
31531
+ promiseLike
31486
31532
  };
31487
31533
  }
31488
31534