@effect/language-service 0.47.3 → 0.48.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 CHANGED
@@ -296,6 +296,10 @@ If the filename and the class identifier are the same, they won't be repeated, b
296
296
 
297
297
  The skipLeadingPath array can contain a set of prefixes to remove from the subpath part of the path. By default "src/" is removed for example.
298
298
 
299
+ ### Pattern: default-hashed
300
+
301
+ If you are concerned potentially showing service names in builds, this pattern is the same as default; but the string will be then hashed.
302
+
299
303
  ### Pattern: package-identifier
300
304
 
301
305
  This pattern uses the package name + identifier. This usually works great if you have a flat structure, with one file per service/error.
package/cli.js CHANGED
@@ -31206,7 +31206,7 @@ function parseKeyPatterns(patterns) {
31206
31206
  if (!isObject(entry)) continue;
31207
31207
  result.push({
31208
31208
  target: hasProperty(entry, "target") && isString(entry.target) && ["service", "error", "custom"].includes(entry.target.toLowerCase()) ? entry.target.toLowerCase() : "service",
31209
- pattern: hasProperty(entry, "pattern") && isString(entry.pattern) && ["package-identifier", "default"].includes(entry.pattern.toLowerCase()) ? entry.pattern.toLowerCase() : "default",
31209
+ pattern: hasProperty(entry, "pattern") && isString(entry.pattern) && ["package-identifier", "default", "default-hashed"].includes(entry.pattern.toLowerCase()) ? entry.pattern.toLowerCase() : "default",
31210
31210
  skipLeadingPath: hasProperty(entry, "skipLeadingPath") && isArray(entry.skipLeadingPath) && entry.skipLeadingPath.every(isString) ? entry.skipLeadingPath : ["src/"]
31211
31211
  });
31212
31212
  }
@@ -31814,17 +31814,21 @@ function makeTypeCheckerUtils(ts, typeChecker, tsUtils) {
31814
31814
  return result;
31815
31815
  };
31816
31816
  function typeToSimplifiedTypeNode(type2, enclosingNode, flags) {
31817
+ return typeToSimplifiedTypeNodeWorker(type2, enclosingNode, flags, 0);
31818
+ }
31819
+ function typeToSimplifiedTypeNodeWorker(type2, enclosingNode, flags, depth) {
31817
31820
  const fallbackStandard = () => {
31818
31821
  const typeNode = typeChecker.typeToTypeNode(type2, enclosingNode, flags);
31819
31822
  if (!typeNode) return void 0;
31820
31823
  return tsUtils.simplifyTypeNode(typeNode);
31821
31824
  };
31825
+ if (depth > 20) return fallbackStandard();
31822
31826
  const members = unrollUnionMembers(type2);
31823
- if (members.length > 1) {
31827
+ if (members.length > 1 && !(type2.flags & ts.TypeFlags.Boolean)) {
31824
31828
  const typeNodes = [];
31825
31829
  members.sort(deterministicTypeOrder);
31826
31830
  for (const member of members) {
31827
- const memberNode = typeToSimplifiedTypeNode(member, enclosingNode, flags);
31831
+ const memberNode = typeToSimplifiedTypeNodeWorker(member, enclosingNode, flags, depth + 1);
31828
31832
  if (!memberNode) return fallbackStandard();
31829
31833
  typeNodes.push(memberNode);
31830
31834
  }
@@ -31834,7 +31838,7 @@ function makeTypeCheckerUtils(ts, typeChecker, tsUtils) {
31834
31838
  const intersectionType = type2;
31835
31839
  const typeNodes = [];
31836
31840
  for (const member of intersectionType.types) {
31837
- const memberNode = typeToSimplifiedTypeNode(member, enclosingNode, flags);
31841
+ const memberNode = typeToSimplifiedTypeNodeWorker(member, enclosingNode, flags, depth + 1);
31838
31842
  if (!memberNode) return fallbackStandard();
31839
31843
  typeNodes.push(memberNode);
31840
31844
  }
@@ -31870,7 +31874,7 @@ function makeTypeCheckerUtils(ts, typeChecker, tsUtils) {
31870
31874
  if (signatures.length !== 1) return standard2;
31871
31875
  const returnType = typeChecker.getReturnTypeOfSignature(signatures[0]);
31872
31876
  if (!returnType) return standard2;
31873
- const returnTypeNode = typeToSimplifiedTypeNode(returnType, enclosingNode, flags);
31877
+ const returnTypeNode = typeToSimplifiedTypeNodeWorker(returnType, enclosingNode, flags, depth + 1);
31874
31878
  if (!returnTypeNode) return standard2;
31875
31879
  return tsUtils.simplifyTypeNode(ts.factory.updateFunctionTypeNode(
31876
31880
  standard2,
@@ -33069,7 +33073,8 @@ var makeKeyBuilder = fn2("KeyBuilder")(
33069
33073
  parts2 = parts2.map((part) => part.startsWith("/") ? part.slice(1) : part).map(
33070
33074
  (part) => part.endsWith("/") ? part.slice(0, -1) : part
33071
33075
  );
33072
- return parts2.filter((_) => String(_).trim().length > 0).join("/");
33076
+ const fullKey = parts2.filter((_) => String(_).trim().length > 0).join("/");
33077
+ return keyPattern.pattern === "default-hashed" ? cyrb53(fullKey) : fullKey;
33073
33078
  }
33074
33079
  }
33075
33080
  return {
@@ -35015,7 +35020,7 @@ var tryCatchInEffectGen = createDiagnostic({
35015
35020
  while (nodeToVisit.length > 0) {
35016
35021
  const node = nodeToVisit.shift();
35017
35022
  ts.forEachChild(node, appendNodeToVisit);
35018
- if (ts.isTryStatement(node)) {
35023
+ if (ts.isTryStatement(node) && node.catchClause) {
35019
35024
  const generatorOrRegularFunction = ts.findAncestor(
35020
35025
  node,
35021
35026
  (_) => ts.isFunctionExpression(_) || ts.isFunctionDeclaration(_) || ts.isMethodDeclaration(_) || ts.isArrowFunction(_) || ts.isGetAccessor(_) || ts.isFunctionLike(_)