@tscircuit/cli 0.1.989 → 0.1.991

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
  });
package/dist/cli/main.js CHANGED
@@ -74413,7 +74413,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
74413
74413
  import { execSync as execSync2 } from "node:child_process";
74414
74414
  var import_semver2 = __toESM2(require_semver2(), 1);
74415
74415
  // package.json
74416
- var version = "0.1.988";
74416
+ var version = "0.1.990";
74417
74417
  var package_default = {
74418
74418
  name: "@tscircuit/cli",
74419
74419
  main: "dist/cli/main.js",
@@ -174892,7 +174892,8 @@ function analyzeCircuitJson(circuitJson) {
174892
174892
  var buildFile = async (input, output, projectDir, options) => {
174893
174893
  try {
174894
174894
  console.log("Generating circuit JSON...");
174895
- const isPrebuiltCircuitJson = input.toLowerCase().endsWith(".circuit.json");
174895
+ const normalizedInputPath = input.toLowerCase().replaceAll("\\", "/");
174896
+ const isPrebuiltCircuitJson = normalizedInputPath.endsWith(".circuit.json") || normalizedInputPath.endsWith("/circuit.json");
174896
174897
  let circuitJson = [];
174897
174898
  if (isPrebuiltCircuitJson) {
174898
174899
  const parsed = JSON.parse(fs45.readFileSync(input, "utf-8"));
@@ -175258,17 +175259,6 @@ var buildPreviewImages = async ({
175258
175259
  });
175259
175260
  };
175260
175261
 
175261
- // cli/build/utils/exit-build.ts
175262
- var exitBuild = (code, reason) => {
175263
- const message = `Build exiting with code ${code}: ${reason}`;
175264
- if (code === 0) {
175265
- console.log(kleur_default.dim(message));
175266
- } else {
175267
- console.error(kleur_default.yellow(message));
175268
- }
175269
- process.exit(code);
175270
- };
175271
-
175272
175262
  // cli/build/generate-kicad-project.ts
175273
175263
  import fs49 from "node:fs";
175274
175264
  import path50 from "node:path";
@@ -175799,6 +175789,17 @@ var transpileFile = async ({
175799
175789
  }
175800
175790
  };
175801
175791
 
175792
+ // cli/build/utils/exit-build.ts
175793
+ var exitBuild = (code, reason) => {
175794
+ const message = `Build exiting with code ${code}: ${reason}`;
175795
+ if (code === 0) {
175796
+ console.log(kleur_default.dim(message));
175797
+ } else {
175798
+ console.error(kleur_default.yellow(message));
175799
+ }
175800
+ process.exit(code);
175801
+ };
175802
+
175802
175803
  // cli/build/worker-pool.ts
175803
175804
  import fs53 from "node:fs";
175804
175805
  import path54 from "node:path";
@@ -175970,8 +175971,9 @@ class WorkerPool {
175970
175971
  }
175971
175972
  async function buildFilesWithWorkerPool(options) {
175972
175973
  const cancellationError = new Error("Build cancelled due fatal error");
175974
+ const poolConcurrency = Math.max(1, Math.min(options.concurrency, options.files.length));
175973
175975
  const pool = new WorkerPool({
175974
- concurrency: options.concurrency,
175976
+ concurrency: poolConcurrency,
175975
175977
  onLog: options.onLog,
175976
175978
  stopOnFatal: options.stopOnFatal,
175977
175979
  cancellationError
@@ -175999,13 +176001,21 @@ async function buildFilesWithWorkerPool(options) {
175999
176001
  throw settledResult.reason;
176000
176002
  }
176001
176003
  }
176002
- await pool.terminate();
176004
+ if (typeof Bun === "undefined") {
176005
+ await pool.terminate();
176006
+ }
176003
176007
  return results;
176004
176008
  }
176005
176009
 
176006
176010
  // cli/build/register.ts
176007
176011
  var normalizeRelativePath = (projectDir, targetPath) => path55.relative(projectDir, targetPath).split(path55.sep).join("/");
176008
- var getOutputDirName = (relativePath) => relativePath.replace(/(\.board|\.circuit)?\.tsx$/, "").replace(/\.circuit\.json$/, "");
176012
+ var getOutputDirName = (relativePath) => {
176013
+ const normalizedRelativePath = relativePath.toLowerCase().replaceAll("\\", "/");
176014
+ if (normalizedRelativePath === "circuit.json" || normalizedRelativePath.endsWith("/circuit.json")) {
176015
+ return path55.dirname(relativePath);
176016
+ }
176017
+ return relativePath.replace(/(\.board|\.circuit)?\.tsx$/, "").replace(/\.circuit\.json$/, "");
176018
+ };
176009
176019
  var registerBuild = (program3) => {
176010
176020
  program3.command("build").description("Run tscircuit eval and output circuit json").argument("[file]", "Path to the entry file").option("--ci", "Run install and optional prebuild/build commands (or default CI build)").option("--ignore-errors", "Do not exit with code 1 on errors").option("--ignore-warnings", "Do not log warnings").option("--ignore-config", "Ignore options from tscircuit.config.json").option("--disable-pcb", "Disable PCB outputs").option("--disable-parts-engine", "Disable the parts engine").option("--site", "Generate a static site in the dist directory").option("--transpile", "Transpile the entry file to JavaScript").option("--preview-images", "Generate preview images in the dist directory").option("--all-images", "Generate preview images for every successful build output").option("--kicad-project", "Generate KiCad project directories for each successful build output").option("--kicad-library", "Generate KiCad library in dist/kicad-library").option("--kicad-library-name <name>", "Specify the name of the KiCad library").option("--preview-gltf", "Generate a GLTF file from the preview entrypoint").option("--glbs", "Generate GLB 3D model files for every successful build").option("--profile", "Log per-circuit circuit.json generation time during build").option("--kicad-pcm", "Generate KiCad PCM (Plugin and Content Manager) assets in dist/pcm").option("--use-cdn-javascript", "Use CDN-hosted JavaScript instead of bundled standalone file for --site").option("--concurrency <number>", "Number of files to build in parallel (default: 1)", "1").action(async (file, options) => {
176011
176021
  try {
package/dist/lib/index.js CHANGED
@@ -60432,7 +60432,7 @@ var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
60432
60432
  }));
60433
60433
  };
60434
60434
  // package.json
60435
- var version = "0.1.988";
60435
+ var version = "0.1.990";
60436
60436
  var package_default = {
60437
60437
  name: "@tscircuit/cli",
60438
60438
  main: "dist/cli/main.js",
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  ".": "./dist/cli/main.js",
6
6
  "./lib": "./dist/lib/index.js"
7
7
  },
8
- "version": "0.1.989",
8
+ "version": "0.1.991",
9
9
  "devDependencies": {
10
10
  "@babel/standalone": "^7.26.9",
11
11
  "@biomejs/biome": "^1.9.4",