()
| 265 | } |
| 266 | |
| 267 | async function runCheck() { |
| 268 | const file = resolve(positional[0] ?? "frame.js"); |
| 269 | const handle = flag("user") ?? process.env.WORLD_USER; |
| 270 | const asJson = !!flag("json"); |
| 271 | const fileRealm = REALMS.includes(basename(file, extname(file))) |
| 272 | ? basename(file, extname(file)) |
| 273 | : null; |
| 274 | |
| 275 | const loaded = await loadModule(file); |
| 276 | if (loaded.error) { |
| 277 | const report = { |
| 278 | ok: false, |
| 279 | realm: fileRealm ?? flag("realm") ?? "frame", |
| 280 | niche: flag("district") ?? null, |
| 281 | family: flag("family") ?? "unknown", |
| 282 | level: null, |
| 283 | errors: [String(loaded.error.message || loaded.error).split("\n")[0]], |
| 284 | warnings: [], |
| 285 | }; |
| 286 | printReport(report, { json: asJson, file }); |
| 287 | process.exit(1); |
| 288 | } |
| 289 | |
| 290 | if (fileRealm) { |
| 291 | const family = |
| 292 | flag("family") ?? |
| 293 | FAMILY_KINDS.find((kind) => typeof loaded.module[kind] === "function"); |
| 294 | if (!family || typeof loaded.module[family] !== "function") { |
| 295 | die( |
| 296 | `${file} does not export ${family ?? "a known family"}. Available: ${FAMILY_KINDS.join(", ")}` |
| 297 | ); |
| 298 | } |
| 299 | const report = runRealmBuilder(loaded.module[family], { |
| 300 | realm: fileRealm, |
| 301 | family, |
| 302 | source: loaded.source, |
| 303 | }); |
| 304 | printReport(report, { json: asJson, file }); |
| 305 | process.exit(report.ok ? 0 : 1); |
| 306 | } |
| 307 | |
| 308 | let ctx; |
| 309 | if (handle) { |
| 310 | const t = await resolveTarget(handle, { |
| 311 | district: flag("district"), |
| 312 | family: flag("family"), |
| 313 | }); |
| 314 | ctx = { realm: t.realm, niche: t.niche, family: t.family, level: t.level }; |
| 315 | } else { |
| 316 | /* Offline: the district still has to be named, because realm decides which |
| 317 | colours exist and level decides how much room there is. */ |
| 318 | ctx = { |
| 319 | realm: flag("realm") ?? "frame", |
| 320 | niche: flag("district") ?? "js_ts", |
| 321 | family: flag("family") ?? "house", |
| 322 | level: Number(flag("level") ?? 8), |
| 323 | }; |
| 324 | } |
nothing calls this directly
no test coverage detected