@tscircuit/cli 0.1.972 → 0.1.973

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.
@@ -2762,6 +2762,7 @@ var workerLog = (...args) => {
2762
2762
  var handleBuildFile = async (filePath, outputPath, projectDir, options) => {
2763
2763
  const errors = [];
2764
2764
  const warnings = [];
2765
+ const startedAt = options?.profile ? performance.now() : 0;
2765
2766
  try {
2766
2767
  process.chdir(projectDir);
2767
2768
  workerLog(`Generating circuit JSON for ${path5.relative(projectDir, filePath)}...`);
@@ -2797,7 +2798,8 @@ var handleBuildFile = async (filePath, outputPath, projectDir, options) => {
2797
2798
  circuit_json_path: outputPath,
2798
2799
  ok: !hasErrors,
2799
2800
  errors,
2800
- warnings
2801
+ warnings,
2802
+ durationMs: options?.profile ? performance.now() - startedAt : undefined
2801
2803
  };
2802
2804
  } catch (err) {
2803
2805
  const errorMsg = err instanceof Error ? err.message : String(err);
@@ -2814,7 +2816,8 @@ var handleBuildFile = async (filePath, outputPath, projectDir, options) => {
2814
2816
  message: errorMsg
2815
2817
  },
2816
2818
  errors,
2817
- warnings
2819
+ warnings,
2820
+ durationMs: options?.profile ? performance.now() - startedAt : undefined
2818
2821
  };
2819
2822
  }
2820
2823
  };
package/dist/cli/main.js CHANGED
@@ -74395,7 +74395,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
74395
74395
  import { execSync as execSync2 } from "node:child_process";
74396
74396
  var import_semver2 = __toESM2(require_semver2(), 1);
74397
74397
  // package.json
74398
- var version = "0.1.969";
74398
+ var version = "0.1.971";
74399
74399
  var package_default = {
74400
74400
  name: "@tscircuit/cli",
74401
74401
  main: "dist/cli/main.js",
@@ -175747,7 +175747,8 @@ class WorkerPool {
175747
175747
  ok: completedMsg.ok,
175748
175748
  isFatalError: completedMsg.isFatalError,
175749
175749
  errors: completedMsg.errors,
175750
- warnings: completedMsg.warnings
175750
+ warnings: completedMsg.warnings,
175751
+ durationMs: completedMsg.durationMs
175751
175752
  });
175752
175753
  threadWorker.currentJob = null;
175753
175754
  threadWorker.busy = false;
@@ -175860,7 +175861,7 @@ async function buildFilesWithWorkerPool(options) {
175860
175861
  // cli/build/register.ts
175861
175862
  var normalizeRelativePath = (projectDir, targetPath) => path55.relative(projectDir, targetPath).split(path55.sep).join("/");
175862
175863
  var registerBuild = (program3) => {
175863
- 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("--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) => {
175864
+ 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) => {
175864
175865
  try {
175865
175866
  const resolvedRoot = path55.resolve(process.cwd());
175866
175867
  let projectDir;
@@ -175931,11 +175932,13 @@ var registerBuild = (program3) => {
175931
175932
  const staticFileReferences = [];
175932
175933
  const builtFiles = [];
175933
175934
  const kicadProjects = [];
175935
+ const profileEntries = [];
175934
175936
  const shouldGenerateKicadProject = resolvedOptions?.kicadProject || resolvedOptions?.kicadLibrary;
175935
175937
  const buildOptions = {
175936
175938
  ignoreErrors: resolvedOptions?.ignoreErrors,
175937
175939
  ignoreWarnings: resolvedOptions?.ignoreWarnings,
175938
- platformConfig: platformConfig2
175940
+ platformConfig: platformConfig2,
175941
+ profile: resolvedOptions?.profile
175939
175942
  };
175940
175943
  const processBuildResult = async (filePath, outputPath, buildOutcome) => {
175941
175944
  const relative10 = path55.relative(projectDir, filePath);
@@ -175987,7 +175990,13 @@ var registerBuild = (program3) => {
175987
175990
  console.log(`Building ${relative10}...`);
175988
175991
  const outputDirName = relative10.replace(/(\.board|\.circuit)?\.tsx$/, "");
175989
175992
  const outputPath = path55.join(distDir, outputDirName, "circuit.json");
175993
+ const startedAt = resolvedOptions?.profile ? performance.now() : 0;
175990
175994
  const buildOutcome = await buildFile(filePath, outputPath, projectDir, buildOptions);
175995
+ if (resolvedOptions?.profile) {
175996
+ const durationMs = performance.now() - startedAt;
175997
+ profileEntries.push({ filePath: relative10, durationMs });
175998
+ console.log(kleur_default.cyan(`[profile] ${relative10}: ${durationMs.toFixed(1)}ms`));
175999
+ }
175991
176000
  await processBuildResult(filePath, outputPath, buildOutcome);
175992
176001
  }
175993
176002
  };
@@ -176018,6 +176027,13 @@ var registerBuild = (program3) => {
176018
176027
  console.error(kleur_default.red(` ${error}`));
176019
176028
  }
176020
176029
  }
176030
+ if (resolvedOptions?.profile && typeof result.durationMs === "number") {
176031
+ profileEntries.push({
176032
+ filePath: relative10,
176033
+ durationMs: result.durationMs
176034
+ });
176035
+ console.log(kleur_default.cyan(`[profile] ${relative10}: ${result.durationMs.toFixed(1)}ms`));
176036
+ }
176021
176037
  await processBuildResult(result.filePath, result.outputPath, {
176022
176038
  ok: result.ok,
176023
176039
  isFatalError: result.isFatalError
@@ -176176,8 +176192,17 @@ var registerBuild = (program3) => {
176176
176192
  resolvedOptions?.kicadProject && "kicad-project",
176177
176193
  resolvedOptions?.kicadLibrary && "kicad-library",
176178
176194
  resolvedOptions?.kicadPcm && "kicad-pcm",
176179
- resolvedOptions?.previewGltf && "preview-gltf"
176195
+ resolvedOptions?.previewGltf && "preview-gltf",
176196
+ resolvedOptions?.profile && "profile"
176180
176197
  ].filter(Boolean);
176198
+ if (resolvedOptions?.profile && profileEntries.length > 0) {
176199
+ console.log("");
176200
+ console.log(kleur_default.bold("Profile Summary (slowest first)"));
176201
+ const sortedProfileEntries = [...profileEntries].sort((a3, b3) => b3.durationMs - a3.durationMs);
176202
+ for (const profileEntry of sortedProfileEntries) {
176203
+ console.log(` ${kleur_default.cyan(profileEntry.durationMs.toFixed(1) + "ms")} ${profileEntry.filePath}`);
176204
+ }
176205
+ }
176181
176206
  console.log("");
176182
176207
  console.log(kleur_default.bold("Build complete"));
176183
176208
  console.log(` Circuits ${kleur_default.green(`${successCount} passed`)}${failCount > 0 ? kleur_default.red(` ${failCount} failed`) : ""}`);
package/dist/lib/index.js CHANGED
@@ -60414,7 +60414,7 @@ var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
60414
60414
  }));
60415
60415
  };
60416
60416
  // package.json
60417
- var version = "0.1.969";
60417
+ var version = "0.1.971";
60418
60418
  var package_default = {
60419
60419
  name: "@tscircuit/cli",
60420
60420
  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.972",
8
+ "version": "0.1.973",
9
9
  "devDependencies": {
10
10
  "@babel/standalone": "^7.26.9",
11
11
  "@biomejs/biome": "^1.9.4",