@tscircuit/cli 0.1.990 → 0.1.992

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.
@@ -2481,10 +2481,32 @@ export default {
2481
2481
  });
2482
2482
 
2483
2483
  // cli/build/build-worker-entrypoint.ts
2484
- import path5 from "node:path";
2485
2484
  import fs5 from "node:fs";
2485
+ import path5 from "node:path";
2486
2486
  import { parentPort } from "node:worker_threads";
2487
2487
 
2488
+ // lib/shared/circuit-json-diagnostics.ts
2489
+ function analyzeCircuitJson(circuitJson) {
2490
+ const errors = [];
2491
+ const warnings = [];
2492
+ for (const item of circuitJson) {
2493
+ if (!item || typeof item !== "object")
2494
+ continue;
2495
+ const t = item.type;
2496
+ if (typeof t === "string") {
2497
+ if (t.endsWith("_error"))
2498
+ errors.push(item);
2499
+ else if (t.endsWith("_warning"))
2500
+ warnings.push(item);
2501
+ }
2502
+ if ("error_type" in item)
2503
+ errors.push(item);
2504
+ if ("warning_type" in item)
2505
+ warnings.push(item);
2506
+ }
2507
+ return { errors, warnings };
2508
+ }
2509
+
2488
2510
  // lib/shared/generate-circuit-json.tsx
2489
2511
  var import_make_vfs = __toESM(require_dist(), 1);
2490
2512
  import path2 from "node:path";
@@ -2614,28 +2636,6 @@ async function generateCircuitJson({
2614
2636
  };
2615
2637
  }
2616
2638
 
2617
- // lib/shared/circuit-json-diagnostics.ts
2618
- function analyzeCircuitJson(circuitJson) {
2619
- const errors = [];
2620
- const warnings = [];
2621
- for (const item of circuitJson) {
2622
- if (!item || typeof item !== "object")
2623
- continue;
2624
- const t = item.type;
2625
- if (typeof t === "string") {
2626
- if (t.endsWith("_error"))
2627
- errors.push(item);
2628
- else if (t.endsWith("_warning"))
2629
- warnings.push(item);
2630
- }
2631
- if ("error_type" in item)
2632
- errors.push(item);
2633
- if ("warning_type" in item)
2634
- warnings.push(item);
2635
- }
2636
- return { errors, warnings };
2637
- }
2638
-
2639
2639
  // lib/shared/get-complete-platform-config.ts
2640
2640
  import { getPlatformConfig } from "@tscircuit/eval/platform-config";
2641
2641
  import { createHash } from "node:crypto";
@@ -2786,7 +2786,14 @@ var handleBuildFile = async (filePath, outputPath, projectDir, options) => {
2786
2786
  workerLog(`Generating circuit JSON for ${path5.relative(projectDir, filePath)}...`);
2787
2787
  await registerStaticAssetLoaders();
2788
2788
  const completePlatformConfig = getCompletePlatformConfig(options?.platformConfig);
2789
- const result = await generateCircuitJson({
2789
+ const normalizedInputPath = filePath.toLowerCase().replaceAll("\\", "/");
2790
+ const isPrebuiltCircuitJson = normalizedInputPath.endsWith(".circuit.json") || normalizedInputPath.endsWith("/circuit.json");
2791
+ const result = isPrebuiltCircuitJson ? {
2792
+ circuitJson: (() => {
2793
+ const parsed = JSON.parse(fs5.readFileSync(filePath, "utf-8"));
2794
+ return Array.isArray(parsed) ? parsed : [];
2795
+ })()
2796
+ } : await generateCircuitJson({
2790
2797
  filePath,
2791
2798
  platformConfig: completePlatformConfig
2792
2799
  });