@elaraai/tsserver-plugin-east 1.0.75 → 1.0.77

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 +25 -3
  2. package/package.json +3 -3
package/dist/index.cjs CHANGED
@@ -228,6 +228,13 @@ function resolvesToEastImport(id, checker, t) {
228
228
  const imp = importDeclarationOf(checker.getSymbolAtLocation(id), t);
229
229
  return imp !== void 0 && t.isStringLiteral(imp.moduleSpecifier) && imp.moduleSpecifier.text.startsWith("@elaraai/");
230
230
  }
231
+ function importedNameOf(id, checker, t) {
232
+ for (const d of checker.getSymbolAtLocation(id)?.declarations ?? []) {
233
+ if (t.isImportSpecifier(d))
234
+ return (d.propertyName ?? d.name).text;
235
+ }
236
+ return void 0;
237
+ }
231
238
  var importsCache = /* @__PURE__ */ new WeakMap();
232
239
  function importsEastPackage(sf, t) {
233
240
  const cached = importsCache.get(sf);
@@ -1117,17 +1124,32 @@ function isHostFilled(sym, ctx) {
1117
1124
  visit(ctx.sourceFile);
1118
1125
  return filled;
1119
1126
  }
1127
+ function inlineSeed(sourceArg, ctx) {
1128
+ const t = ctx.ts;
1129
+ if (!t.isCallExpression(sourceArg))
1130
+ return void 0;
1131
+ const callee = sourceArg.expression;
1132
+ if (!t.isIdentifier(callee) || importedNameOf(callee, ctx.checker, t) !== "variant" || !resolvesToEastImport(callee, ctx.checker, t))
1133
+ return void 0;
1134
+ const [tag, payload] = sourceArg.arguments;
1135
+ if (tag === void 0 || !t.isStringLiteralLike(tag) || tag.text !== "value")
1136
+ return void 0;
1137
+ return payload;
1138
+ }
1120
1139
  var noCompileTimeSeedData = {
1121
1140
  name: NAME14,
1122
1141
  code: CODE14,
1123
- description: "Flag host-computed data passed as the seed (3rd arg) of e3.input \u2014 the default must be a small authored constant; load real data at runtime.",
1142
+ description: "Flag host-computed data passed as the inline seed (variant('value', \u2026)) of e3.input \u2014 it must be a small authored constant; load real data from a file source or at runtime.",
1124
1143
  check(node, ctx) {
1125
1144
  const t = ctx.ts;
1126
1145
  if (!t.isCallExpression(node) || !isE3InputCall(node, ctx))
1127
1146
  return;
1128
1147
  if (insideBlockScope(node, ctx))
1129
1148
  return;
1130
- const seedArg = node.arguments[2];
1149
+ const sourceArg = node.arguments[2];
1150
+ if (sourceArg === void 0)
1151
+ return;
1152
+ const seedArg = inlineSeed(sourceArg, ctx);
1131
1153
  if (seedArg === void 0)
1132
1154
  return;
1133
1155
  let expr = seedArg;
@@ -1149,7 +1171,7 @@ var noCompileTimeSeedData = {
1149
1171
  const nameArg = node.arguments[0];
1150
1172
  const name = nameArg !== void 0 && t.isStringLiteralLike(nameArg) ? nameArg.text : "\u2026";
1151
1173
  const reason = hostFilled ? "this seed is an authored-empty collection then filled in place by host code (a `for`-loop / `.set(...)`)" : "this seed is assembled by host calls (`num(...)`, `BigInt(...)`, parsed config) at module-evaluation time";
1152
- fire2(ctx, seedArg, `Host-computed data passed as the \`e3.input("${name}", \u2026)\` seed bakes a build-time snapshot into the deployed program \u2014 ${reason}. The default (3rd arg) must be a small AUTHORED CONSTANT (a literal, an empty/literal Map/Set/array/struct, or an East value \`variant\`/\`some\`/\`none\`/\`East.value\`) or omitted. Load real/bulk data at RUNTIME: put the bytes in a \`BlobType\` input and parse with \`blob.decodeCsv(...)\` inside an \`e3.task\`, read files in a task via a platform \`FileSystem.readFile\`, or use \`e3.record(...)\` + \`e3.mutation\` for set-once root state.`);
1174
+ fire2(ctx, seedArg, `Host-computed data passed as the \`e3.input("${name}", \u2026)\` seed bakes a build-time snapshot into the deployed program \u2014 ${reason}. An inline \`variant('value', \u2026)\` seed must be a small AUTHORED CONSTANT (a literal, an empty/literal Map/Set/array/struct, or an East value \`variant\`/\`some\`/\`none\`/\`East.value\`), or the source omitted. Keep real/bulk data out of the package: deliver it as a beast2 file and declare \`variant('file', path)\` (adopted by hash at deploy), put the bytes in a \`BlobType\` input and parse with \`blob.decodeCsv(...)\` inside an \`e3.task\`, read files in a task via a platform \`FileSystem.readFile\`, or use \`e3.record(...)\` + \`e3.mutation\` for set-once root state.`);
1153
1175
  }
1154
1176
  };
1155
1177
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elaraai/tsserver-plugin-east",
3
- "version": "1.0.75",
3
+ "version": "1.0.77",
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.75",
36
- "@elaraai/east-diagnostics": "1.0.75"
35
+ "@elaraai/east": "1.0.77",
36
+ "@elaraai/east-diagnostics": "1.0.77"
37
37
  },
38
38
  "scripts": {
39
39
  "build": "node scripts/build.mjs",