@elaraai/tsserver-plugin-east 1.0.86 → 1.0.87

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.
Files changed (2) hide show
  1. package/dist/index.cjs +31 -4
  2. package/package.json +3 -3
package/dist/index.cjs CHANGED
@@ -1981,13 +1981,12 @@ var NAME21 = "no-dynamic-bind-path";
1981
1981
  var CODE21 = 990026;
1982
1982
  var KEY_ARG_INDEX = {
1983
1983
  Data: 0,
1984
- State: 1,
1985
- Navigation: 1
1984
+ State: 1
1986
1985
  };
1987
1986
  var noDynamicBindPath = {
1988
1987
  name: NAME21,
1989
1988
  code: CODE21,
1990
- description: "Data.bind / State.bind / Navigation.bind keys must be IR-build constants \u2014 an East-computed key can't be captured in the ui() manifest.",
1989
+ description: "Data.bind / State.bind keys must be IR-build constants \u2014 an East-computed key can't be captured in the ui() manifest.",
1991
1990
  check(node, ctx) {
1992
1991
  const t = ctx.ts;
1993
1992
  if (!t.isCallExpression(node))
@@ -2159,6 +2158,31 @@ function isValueConstructorCall(call, ctx) {
2159
2158
  const callee = call.expression;
2160
2159
  return t.isIdentifier(callee) && (callee.text === "variant" || callee.text === "some") && resolvesToEastImport(callee, ctx.checker, t);
2161
2160
  }
2161
+ function mentionsEastValueType(node, ctx, seen) {
2162
+ const t = ctx.ts;
2163
+ if (node.kind === t.SyntaxKind.AnyKeyword || node.kind === t.SyntaxKind.UnknownKeyword)
2164
+ return true;
2165
+ if (t.isTypeReferenceNode(node)) {
2166
+ const named = ctx.checker.getSymbolAtLocation(node.typeName);
2167
+ const symbol = named !== void 0 && (named.flags & t.SymbolFlags.Alias) !== 0 ? ctx.checker.getAliasedSymbol(named) : named;
2168
+ const declarations = symbol?.declarations ?? [];
2169
+ if (declarations.some((d) => declaredByEast(d) || t.isTypeParameterDeclaration(d)))
2170
+ return true;
2171
+ if (symbol !== void 0 && !seen.has(symbol)) {
2172
+ seen.add(symbol);
2173
+ if (declarations.some((d) => t.isTypeAliasDeclaration(d) && mentionsEastValueType(d.type, ctx, seen)))
2174
+ return true;
2175
+ }
2176
+ }
2177
+ return t.forEachChild(node, (child) => mentionsEastValueType(child, ctx, seen) ? true : void 0) === true;
2178
+ }
2179
+ function writtenInEastValues(signature, index, ctx) {
2180
+ const params = signature.getParameters();
2181
+ const declaration = params[Math.min(index, params.length - 1)]?.valueDeclaration;
2182
+ if (declaration === void 0 || !ctx.ts.isParameter(declaration) || declaration.type === void 0)
2183
+ return true;
2184
+ return mentionsEastValueType(declaration.type, ctx, /* @__PURE__ */ new Set());
2185
+ }
2162
2186
  function parameterTypeAt(signature, index, call, ctx) {
2163
2187
  const t = ctx.ts;
2164
2188
  const params = signature.getParameters();
@@ -2206,7 +2230,10 @@ function flowOf(e, ctx) {
2206
2230
  if (signature !== void 0 && declaration !== void 0 && declaredByEastPackage(declaration)) {
2207
2231
  const index = args.indexOf(node);
2208
2232
  const param = parameterTypeAt(signature, index, parent, ctx);
2209
- return param !== void 0 && isEastExprType(param) ? "program" : "value";
2233
+ if (param !== void 0 && isEastExprType(param))
2234
+ return "program";
2235
+ if (declaredByEast(declaration) || writtenInEastValues(signature, index, ctx))
2236
+ return "value";
2210
2237
  }
2211
2238
  return east ? "value" : "host";
2212
2239
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elaraai/tsserver-plugin-east",
3
- "version": "1.0.86",
3
+ "version": "1.0.87",
4
4
  "license": "AGPL-3.0-or-later",
5
5
  "description": "TypeScript language service plugin for East — East idiom diagnostics and localized East type-diff error messages as native editor squiggles.",
6
6
  "main": "dist/index.cjs",
@@ -32,8 +32,8 @@
32
32
  "devDependencies": {
33
33
  "esbuild": "^0.27.3",
34
34
  "typescript": "~5.9.2",
35
- "@elaraai/east": "1.0.86",
36
- "@elaraai/east-diagnostics": "1.0.86"
35
+ "@elaraai/east": "1.0.87",
36
+ "@elaraai/east-diagnostics": "1.0.87"
37
37
  },
38
38
  "scripts": {
39
39
  "build": "node scripts/build.mjs",