@elaraai/east-codex-plugin 1.0.107 → 1.0.109

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.
@@ -190,7 +190,7 @@ var preferExplicitEastType = {
190
190
  };
191
191
 
192
192
  // ../east-diagnostics/dist/src/east-source.js
193
- import { existsSync } from "node:fs";
193
+ import { existsSync, readFileSync } from "node:fs";
194
194
  import { dirname, join, resolve } from "node:path";
195
195
  function importDeclarationOf(sym, t) {
196
196
  for (const d of sym?.declarations ?? []) {
@@ -314,6 +314,28 @@ function packageDirOf(p) {
314
314
  pkgDirCache.set(start, result);
315
315
  return result;
316
316
  }
317
+ var pkgNameCache = /* @__PURE__ */ new Map();
318
+ function packageNameOf(fileName) {
319
+ const dir = packageDirOf(fileName);
320
+ if (dir === void 0)
321
+ return void 0;
322
+ if (pkgNameCache.has(dir))
323
+ return pkgNameCache.get(dir);
324
+ let name;
325
+ try {
326
+ const manifest = JSON.parse(readFileSync(join(dir, "package.json"), "utf8"));
327
+ const declared = typeof manifest === "object" && manifest !== null ? manifest.name : void 0;
328
+ if (typeof declared === "string")
329
+ name = declared;
330
+ } catch {
331
+ name = void 0;
332
+ }
333
+ pkgNameCache.set(dir, name);
334
+ return name;
335
+ }
336
+ function inEastPackage(fileName) {
337
+ return packageNameOf(fileName)?.startsWith("@elaraai/") === true;
338
+ }
317
339
  function resolvesWithinOwnPackage(sourceFileName, specifierText) {
318
340
  try {
319
341
  const own = packageDirOf(sourceFileName);
@@ -1400,8 +1422,33 @@ function isEastCall(call, ctx) {
1400
1422
  return true;
1401
1423
  if (isConstantFoldCall(call, ctx))
1402
1424
  return true;
1425
+ if (t.isPropertyAccessExpression(f) && takesBlockBuilder(call, ctx) && isEastLibraryMember(f, ctx))
1426
+ return true;
1403
1427
  return false;
1404
1428
  }
1429
+ function takesBlockBuilder(call, ctx) {
1430
+ const signature = ctx.checker.getResolvedSignature(call);
1431
+ if (signature === void 0)
1432
+ return false;
1433
+ return call.arguments.some((arg, at) => {
1434
+ if (!isBlockBuilderType(ctx.checker.getTypeAtLocation(arg)))
1435
+ return false;
1436
+ const parameter = signature.parameters[at];
1437
+ return parameter !== void 0 && isBlockBuilderType(ctx.checker.getTypeOfSymbolAtLocation(parameter, call));
1438
+ });
1439
+ }
1440
+ function isEastLibraryMember(f, ctx) {
1441
+ const inEastDts = (sym) => (sym?.declarations ?? []).some((d) => {
1442
+ const sf = d.getSourceFile();
1443
+ return sf.isDeclarationFile && inEastPackage(sf.fileName);
1444
+ });
1445
+ if (inEastDts(ctx.checker.getSymbolAtLocation(f)))
1446
+ return true;
1447
+ const receiverType = ctx.checker.getTypeAtLocation(f.expression);
1448
+ if (inEastDts(receiverType.aliasSymbol ?? receiverType.symbol))
1449
+ return true;
1450
+ return rootBuiltByEastFactory(chainRootReceiver(f, ctx), ctx);
1451
+ }
1405
1452
  function isConstantFoldCall(call, ctx) {
1406
1453
  const t = ctx.ts;
1407
1454
  if ((ctx.checker.getTypeAtLocation(call).flags & t.TypeFlags.StringLike) === 0)
@@ -1427,8 +1474,9 @@ function isConstantFoldCall(call, ctx) {
1427
1474
  return constant;
1428
1475
  }
1429
1476
  function isLibDeclaredEastCall(call, f, ctx) {
1430
- if (!isEastExprType(ctx.checker.getTypeAtLocation(call)))
1431
- return false;
1477
+ return isEastExprType(ctx.checker.getTypeAtLocation(call)) && isLibDeclaredMember(f, ctx);
1478
+ }
1479
+ function isLibDeclaredMember(f, ctx) {
1432
1480
  const inPackageDts = (sym) => (sym?.declarations ?? []).some((d) => {
1433
1481
  const sf = d.getSourceFile();
1434
1482
  if (!sf.isDeclarationFile)
@@ -3219,7 +3267,7 @@ function runEastRules(tsModule, program, sourceFile, checker, options = {}, rule
3219
3267
 
3220
3268
  // ../east-diagnostics/dist/src/service.js
3221
3269
  import { createRequire as createRequire2 } from "node:module";
3222
- import { existsSync as existsSync2, readFileSync } from "node:fs";
3270
+ import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs";
3223
3271
  import { dirname as dirname2, join as join3, resolve as resolve2 } from "node:path";
3224
3272
 
3225
3273
  // ../east-diagnostics/dist/src/east-module.js
@@ -3676,7 +3724,7 @@ function createDiagnosticsService(options = {}) {
3676
3724
  return t.ScriptSnapshot.fromString(overlay);
3677
3725
  if (!existsSync2(path))
3678
3726
  return void 0;
3679
- return t.ScriptSnapshot.fromString(readFileSync(path, "utf-8"));
3727
+ return t.ScriptSnapshot.fromString(readFileSync2(path, "utf-8"));
3680
3728
  },
3681
3729
  getCurrentDirectory: () => projectDir,
3682
3730
  getCompilationSettings: () => parsed.options,
@@ -3780,7 +3828,7 @@ function createDiagnosticsService(options = {}) {
3780
3828
  }
3781
3829
 
3782
3830
  // ../east-diagnostics/dist/src/lsp.js
3783
- import { readFileSync as readFileSync2 } from "node:fs";
3831
+ import { readFileSync as readFileSync3 } from "node:fs";
3784
3832
  import { fileURLToPath } from "node:url";
3785
3833
 
3786
3834
  // ../east-diagnostics/dist/src/jsonrpc-stdio.js
@@ -3880,7 +3928,7 @@ function runEastLsp(options = {}) {
3880
3928
  function publish(path) {
3881
3929
  const content = open.get(path) ?? (() => {
3882
3930
  try {
3883
- return readFileSync2(path, "utf-8");
3931
+ return readFileSync3(path, "utf-8");
3884
3932
  } catch {
3885
3933
  return void 0;
3886
3934
  }
@@ -194,7 +194,7 @@ var preferExplicitEastType = {
194
194
  };
195
195
 
196
196
  // ../east-diagnostics/dist/src/east-source.js
197
- import { existsSync } from "node:fs";
197
+ import { existsSync, readFileSync } from "node:fs";
198
198
  import { dirname, join, resolve } from "node:path";
199
199
  function importDeclarationOf(sym, t) {
200
200
  for (const d of sym?.declarations ?? []) {
@@ -318,6 +318,28 @@ function packageDirOf(p) {
318
318
  pkgDirCache.set(start, result);
319
319
  return result;
320
320
  }
321
+ var pkgNameCache = /* @__PURE__ */ new Map();
322
+ function packageNameOf(fileName) {
323
+ const dir = packageDirOf(fileName);
324
+ if (dir === void 0)
325
+ return void 0;
326
+ if (pkgNameCache.has(dir))
327
+ return pkgNameCache.get(dir);
328
+ let name;
329
+ try {
330
+ const manifest = JSON.parse(readFileSync(join(dir, "package.json"), "utf8"));
331
+ const declared = typeof manifest === "object" && manifest !== null ? manifest.name : void 0;
332
+ if (typeof declared === "string")
333
+ name = declared;
334
+ } catch {
335
+ name = void 0;
336
+ }
337
+ pkgNameCache.set(dir, name);
338
+ return name;
339
+ }
340
+ function inEastPackage(fileName) {
341
+ return packageNameOf(fileName)?.startsWith("@elaraai/") === true;
342
+ }
321
343
  function resolvesWithinOwnPackage(sourceFileName, specifierText) {
322
344
  try {
323
345
  const own = packageDirOf(sourceFileName);
@@ -1404,8 +1426,33 @@ function isEastCall(call, ctx) {
1404
1426
  return true;
1405
1427
  if (isConstantFoldCall(call, ctx))
1406
1428
  return true;
1429
+ if (t.isPropertyAccessExpression(f) && takesBlockBuilder(call, ctx) && isEastLibraryMember(f, ctx))
1430
+ return true;
1407
1431
  return false;
1408
1432
  }
1433
+ function takesBlockBuilder(call, ctx) {
1434
+ const signature = ctx.checker.getResolvedSignature(call);
1435
+ if (signature === void 0)
1436
+ return false;
1437
+ return call.arguments.some((arg, at) => {
1438
+ if (!isBlockBuilderType(ctx.checker.getTypeAtLocation(arg)))
1439
+ return false;
1440
+ const parameter = signature.parameters[at];
1441
+ return parameter !== void 0 && isBlockBuilderType(ctx.checker.getTypeOfSymbolAtLocation(parameter, call));
1442
+ });
1443
+ }
1444
+ function isEastLibraryMember(f, ctx) {
1445
+ const inEastDts = (sym) => (sym?.declarations ?? []).some((d) => {
1446
+ const sf = d.getSourceFile();
1447
+ return sf.isDeclarationFile && inEastPackage(sf.fileName);
1448
+ });
1449
+ if (inEastDts(ctx.checker.getSymbolAtLocation(f)))
1450
+ return true;
1451
+ const receiverType = ctx.checker.getTypeAtLocation(f.expression);
1452
+ if (inEastDts(receiverType.aliasSymbol ?? receiverType.symbol))
1453
+ return true;
1454
+ return rootBuiltByEastFactory(chainRootReceiver(f, ctx), ctx);
1455
+ }
1409
1456
  function isConstantFoldCall(call, ctx) {
1410
1457
  const t = ctx.ts;
1411
1458
  if ((ctx.checker.getTypeAtLocation(call).flags & t.TypeFlags.StringLike) === 0)
@@ -1431,8 +1478,9 @@ function isConstantFoldCall(call, ctx) {
1431
1478
  return constant;
1432
1479
  }
1433
1480
  function isLibDeclaredEastCall(call, f, ctx) {
1434
- if (!isEastExprType(ctx.checker.getTypeAtLocation(call)))
1435
- return false;
1481
+ return isEastExprType(ctx.checker.getTypeAtLocation(call)) && isLibDeclaredMember(f, ctx);
1482
+ }
1483
+ function isLibDeclaredMember(f, ctx) {
1436
1484
  const inPackageDts = (sym) => (sym?.declarations ?? []).some((d) => {
1437
1485
  const sf = d.getSourceFile();
1438
1486
  if (!sf.isDeclarationFile)
@@ -3223,7 +3271,7 @@ function runEastRules(tsModule, program, sourceFile, checker, options = {}, rule
3223
3271
 
3224
3272
  // ../east-diagnostics/dist/src/service.js
3225
3273
  import { createRequire as createRequire2 } from "node:module";
3226
- import { existsSync as existsSync2, readFileSync } from "node:fs";
3274
+ import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs";
3227
3275
  import { dirname as dirname2, join as join3, resolve as resolve2 } from "node:path";
3228
3276
 
3229
3277
  // ../east-diagnostics/dist/src/east-module.js
@@ -3680,7 +3728,7 @@ function createDiagnosticsService(options = {}) {
3680
3728
  return t.ScriptSnapshot.fromString(overlay);
3681
3729
  if (!existsSync2(path))
3682
3730
  return void 0;
3683
- return t.ScriptSnapshot.fromString(readFileSync(path, "utf-8"));
3731
+ return t.ScriptSnapshot.fromString(readFileSync2(path, "utf-8"));
3684
3732
  },
3685
3733
  getCurrentDirectory: () => projectDir,
3686
3734
  getCompilationSettings: () => parsed.options,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "east-codex-plugin",
3
- "version": "1.0.107",
3
+ "version": "1.0.109",
4
4
  "description": "East programming language ecosystem - a statically typed, expression-based language for business logic, data processing, UI definitions, and durable execution",
5
5
  "author": {
6
6
  "name": "Elara AI",