@tscircuit/cli 0.1.1797 → 0.1.1798

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.
@@ -5608,8 +5608,8 @@ var require_utils = __commonJS((exports, module) => {
5608
5608
  }
5609
5609
  return ind;
5610
5610
  }
5611
- function removeDotSegments(path12) {
5612
- let input = path12;
5611
+ function removeDotSegments(path13) {
5612
+ let input = path13;
5613
5613
  const output = [];
5614
5614
  let nextSlash = -1;
5615
5615
  let len = 0;
@@ -5852,8 +5852,8 @@ var require_schemes = __commonJS((exports, module) => {
5852
5852
  wsComponent.secure = undefined;
5853
5853
  }
5854
5854
  if (wsComponent.resourceName) {
5855
- const [path12, query] = wsComponent.resourceName.split("?");
5856
- wsComponent.path = path12 && path12 !== "/" ? path12 : undefined;
5855
+ const [path13, query] = wsComponent.resourceName.split("?");
5856
+ wsComponent.path = path13 && path13 !== "/" ? path13 : undefined;
5857
5857
  wsComponent.query = query;
5858
5858
  wsComponent.resourceName = undefined;
5859
5859
  }
@@ -9791,12 +9791,12 @@ var require_dist2 = __commonJS((exports, module) => {
9791
9791
  throw new Error(`Unknown format "${name}"`);
9792
9792
  return f;
9793
9793
  };
9794
- function addFormats(ajv, list, fs9, exportName) {
9794
+ function addFormats(ajv, list, fs10, exportName) {
9795
9795
  var _a;
9796
9796
  var _b;
9797
9797
  (_a = (_b = ajv.opts.code).formats) !== null && _a !== undefined || (_b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`);
9798
9798
  for (const f of list)
9799
- ajv.addFormat(f, fs9[f]);
9799
+ ajv.addFormat(f, fs10[f]);
9800
9800
  }
9801
9801
  module.exports = exports = formatsPlugin;
9802
9802
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -11651,8 +11651,8 @@ var require_semver2 = __commonJS((exports, module) => {
11651
11651
  import { parentPort } from "node:worker_threads";
11652
11652
 
11653
11653
  // cli/build/worker-build-handlers.ts
11654
- import fs13 from "node:fs";
11655
- import path17 from "node:path";
11654
+ import fs14 from "node:fs";
11655
+ import path18 from "node:path";
11656
11656
 
11657
11657
  // lib/project-config/index.ts
11658
11658
  import * as fs from "node:fs";
@@ -11863,8 +11863,8 @@ function analyzeCircuitJson(circuitJson) {
11863
11863
  }
11864
11864
 
11865
11865
  // lib/shared/generate-circuit-json.tsx
11866
- import fs6 from "node:fs";
11867
- import path6 from "node:path";
11866
+ import fs7 from "node:fs";
11867
+ import path7 from "node:path";
11868
11868
  import { pathToFileURL as pathToFileURL2 } from "node:url";
11869
11869
  import Debug from "debug";
11870
11870
 
@@ -12799,6 +12799,120 @@ var readCurrentCircuitJsonBuild = ({
12799
12799
  }
12800
12800
  };
12801
12801
 
12802
+ // lib/shared/solver-diagnostics.ts
12803
+ import fs6 from "node:fs";
12804
+ import path6 from "node:path";
12805
+ var escapeJsonPointerSegment = (segment) => segment.replaceAll("~", "~0").replaceAll("/", "~1");
12806
+ var cloneAsJson = (value, ancestors = new WeakMap, path7 = "#") => {
12807
+ if (value === undefined)
12808
+ return { value_type: "undefined" };
12809
+ if (typeof value === "bigint") {
12810
+ return { value_type: "bigint", value: value.toString() };
12811
+ }
12812
+ if (typeof value === "number" && !Number.isFinite(value)) {
12813
+ return { value_type: "number", value: value.toString() };
12814
+ }
12815
+ if (typeof value === "number" && Object.is(value, -0)) {
12816
+ return { value_type: "number", value: "-0" };
12817
+ }
12818
+ if (typeof value === "symbol") {
12819
+ return { value_type: "symbol", value: value.description ?? null };
12820
+ }
12821
+ if (typeof value === "function") {
12822
+ return {
12823
+ value_type: "function",
12824
+ name: value.name || null,
12825
+ source: value.toString()
12826
+ };
12827
+ }
12828
+ if (value === null || typeof value !== "object")
12829
+ return value;
12830
+ const ancestorPath = ancestors.get(value);
12831
+ if (ancestorPath) {
12832
+ return { value_type: "circular_reference", path: ancestorPath };
12833
+ }
12834
+ ancestors.set(value, path7);
12835
+ try {
12836
+ if (Array.isArray(value)) {
12837
+ return value.map((item, index) => cloneAsJson(item, ancestors, `${path7}/${index}`));
12838
+ }
12839
+ if (value instanceof Date) {
12840
+ return { value_type: "date", value: value.toISOString() };
12841
+ }
12842
+ if (value instanceof RegExp) {
12843
+ return {
12844
+ value_type: "regexp",
12845
+ source: value.source,
12846
+ flags: value.flags
12847
+ };
12848
+ }
12849
+ if (value instanceof Map) {
12850
+ return {
12851
+ value_type: "map",
12852
+ entries: Array.from(value.entries(), ([key, item], index) => [
12853
+ cloneAsJson(key, ancestors, `${path7}/entries/${index}/0`),
12854
+ cloneAsJson(item, ancestors, `${path7}/entries/${index}/1`)
12855
+ ])
12856
+ };
12857
+ }
12858
+ if (value instanceof Set) {
12859
+ return {
12860
+ value_type: "set",
12861
+ values: Array.from(value.values(), (item, index) => cloneAsJson(item, ancestors, `${path7}/values/${index}`))
12862
+ };
12863
+ }
12864
+ if (value instanceof Error) {
12865
+ return {
12866
+ value_type: "error",
12867
+ name: value.name,
12868
+ message: value.message,
12869
+ stack: value.stack
12870
+ };
12871
+ }
12872
+ const clonedObject = {};
12873
+ for (const [key, item] of Object.entries(value)) {
12874
+ clonedObject[key] = cloneAsJson(item, ancestors, `${path7}/${escapeJsonPointerSegment(key)}`);
12875
+ }
12876
+ return clonedObject;
12877
+ } finally {
12878
+ ancestors.delete(value);
12879
+ }
12880
+ };
12881
+
12882
+ class SolverDiagnostics {
12883
+ options;
12884
+ solverInvocations = [];
12885
+ constructor(options) {
12886
+ this.options = options;
12887
+ }
12888
+ attachToRootCircuit(rootCircuit) {
12889
+ if (!this.options.enabled)
12890
+ return;
12891
+ rootCircuit.on?.("solver:started", (rawEvent) => {
12892
+ const event = rawEvent;
12893
+ const constructorArgs = Array.isArray(event.solverConstructorArgs) ? event.solverConstructorArgs : [event.solverParams];
12894
+ this.solverInvocations.push({
12895
+ sequence: this.solverInvocations.length,
12896
+ solver_name: typeof event.solverName === "string" ? event.solverName : "unknown_solver",
12897
+ component_name: typeof event.componentName === "string" ? event.componentName : null,
12898
+ constructor_args: cloneAsJson(constructorArgs)
12899
+ });
12900
+ });
12901
+ }
12902
+ finalize() {
12903
+ if (!this.options.enabled)
12904
+ return;
12905
+ fs6.mkdirSync(path6.dirname(this.options.outputPath), { recursive: true });
12906
+ fs6.writeFileSync(this.options.outputPath, `${JSON.stringify({
12907
+ format: "tscircuit_solver_debug_v1",
12908
+ entrypoint: this.options.entrypoint,
12909
+ solvers: this.solverInvocations
12910
+ }, null, 2)}
12911
+ `);
12912
+ this.options.log?.(`Solver inputs written to ${this.options.outputPath}`);
12913
+ }
12914
+ }
12915
+
12802
12916
  // lib/shared/generate-circuit-json.tsx
12803
12917
  import { jsxDEV } from "react/jsx-dev-runtime";
12804
12918
  var debug = Debug("tsci:generate-circuit-json");
@@ -12826,6 +12940,7 @@ async function generateCircuitJson({
12826
12940
  injectedProps,
12827
12941
  onAsyncEffectStatus,
12828
12942
  autorouterDiagnostics: autorouterDiagnosticsOptions,
12943
+ solverDiagnostics: solverDiagnosticsOptions,
12829
12944
  sourceFilesystemMd5Hash
12830
12945
  }) {
12831
12946
  debug(`Generating circuit JSON for ${filePath}`);
@@ -12839,12 +12954,14 @@ async function generateCircuitJson({
12839
12954
  });
12840
12955
  const autorouterDiagnostics = new AutorouterDiagnostics(autorouterDiagnosticsOptions);
12841
12956
  autorouterDiagnostics.attachToRootCircuit(runner);
12842
- const absoluteFilePath = path6.isAbsolute(filePath) ? filePath : path6.resolve(process.cwd(), filePath);
12843
- const projectDir = path6.dirname(absoluteFilePath);
12957
+ const solverDiagnostics = solverDiagnosticsOptions ? new SolverDiagnostics(solverDiagnosticsOptions) : null;
12958
+ solverDiagnostics?.attachToRootCircuit(runner);
12959
+ const absoluteFilePath = path7.isAbsolute(filePath) ? filePath : path7.resolve(process.cwd(), filePath);
12960
+ const projectDir = path7.dirname(absoluteFilePath);
12844
12961
  const resolvedOutputDir = outputDir ?? projectDir;
12845
- const relativeComponentPath = path6.relative(projectDir, absoluteFilePath);
12846
- const baseFileName = outputFileName || path6.basename(absoluteFilePath).replace(/\.[^.]+$/, "");
12847
- const outputPath = path6.join(resolvedOutputDir, `${baseFileName}.circuit.json`);
12962
+ const relativeComponentPath = path7.relative(projectDir, absoluteFilePath);
12963
+ const baseFileName = outputFileName || path7.basename(absoluteFilePath).replace(/\.[^.]+$/, "");
12964
+ const outputPath = path7.join(resolvedOutputDir, `${baseFileName}.circuit.json`);
12848
12965
  debug(`Project directory: ${projectDir}`);
12849
12966
  debug(`Relative component path: ${relativeComponentPath}`);
12850
12967
  debug(`Output path: ${outputPath}`);
@@ -12864,7 +12981,7 @@ async function generateCircuitJson({
12864
12981
  return false;
12865
12982
  if (normalizedFilePath.match(/^\.[^/]/))
12866
12983
  return false;
12867
- if (!ALLOWED_FILE_EXTENSIONS.includes(path6.extname(normalizedFilePath)))
12984
+ if (!ALLOWED_FILE_EXTENSIONS.includes(path7.extname(normalizedFilePath)))
12868
12985
  return false;
12869
12986
  return true;
12870
12987
  },
@@ -12896,11 +13013,12 @@ async function generateCircuitJson({
12896
13013
  runner.render();
12897
13014
  }
12898
13015
  runner.emit("renderComplete");
13016
+ solverDiagnostics?.finalize();
12899
13017
  const circuitJson = addSourceFilesystemHash(await runner.getCircuitJson(), currentSourceFilesystemMd5Hash);
12900
13018
  await autorouterDiagnostics.finalize(circuitJson);
12901
13019
  if (saveToFile) {
12902
13020
  debug(`Saving circuit JSON to ${outputPath}`);
12903
- fs6.writeFileSync(outputPath, JSON.stringify(circuitJson, null, 2));
13021
+ fs7.writeFileSync(outputPath, JSON.stringify(circuitJson, null, 2));
12904
13022
  }
12905
13023
  return {
12906
13024
  circuitJson,
@@ -12911,28 +13029,28 @@ async function generateCircuitJson({
12911
13029
 
12912
13030
  // lib/shared/get-platform-config-with-cli-defaults.ts
12913
13031
  import { createHash as createHash2 } from "node:crypto";
12914
- import fs7 from "node:fs";
12915
- import path7 from "node:path";
13032
+ import fs8 from "node:fs";
13033
+ import path8 from "node:path";
12916
13034
  import { getPlatformConfig } from "@tscircuit/eval/platform-config";
12917
- function createLocalCacheEngine(cacheDir = path7.join(process.cwd(), ".tscircuit", "cache")) {
13035
+ function createLocalCacheEngine(cacheDir = path8.join(process.cwd(), ".tscircuit", "cache")) {
12918
13036
  return {
12919
13037
  getItem: (key) => {
12920
13038
  try {
12921
13039
  const hash = createHash2("md5").update(key).digest("hex");
12922
13040
  const keyWithSafeCharacters = key.replace(/[^a-zA-Z0-9]/g, "_");
12923
- const filePath = path7.join(cacheDir, `${keyWithSafeCharacters.slice(keyWithSafeCharacters.length - 10, keyWithSafeCharacters.length)}-${hash}.json`);
12924
- return fs7.readFileSync(filePath, "utf-8");
13041
+ const filePath = path8.join(cacheDir, `${keyWithSafeCharacters.slice(keyWithSafeCharacters.length - 10, keyWithSafeCharacters.length)}-${hash}.json`);
13042
+ return fs8.readFileSync(filePath, "utf-8");
12925
13043
  } catch {
12926
13044
  return null;
12927
13045
  }
12928
13046
  },
12929
13047
  setItem: (key, value) => {
12930
13048
  try {
12931
- fs7.mkdirSync(cacheDir, { recursive: true });
13049
+ fs8.mkdirSync(cacheDir, { recursive: true });
12932
13050
  const hash = createHash2("md5").update(key).digest("hex");
12933
13051
  const keyWithSafeCharacters = key.replace(/[^a-zA-Z0-9]/g, "_");
12934
- const filePath = path7.join(cacheDir, `${keyWithSafeCharacters.slice(keyWithSafeCharacters.length - 10, keyWithSafeCharacters.length)}-${hash}.json`);
12935
- fs7.writeFileSync(filePath, value);
13052
+ const filePath = path8.join(cacheDir, `${keyWithSafeCharacters.slice(keyWithSafeCharacters.length - 10, keyWithSafeCharacters.length)}-${hash}.json`);
13053
+ fs8.writeFileSync(filePath, value);
12936
13054
  } catch {}
12937
13055
  }
12938
13056
  };
@@ -12948,15 +13066,15 @@ function getPlatformConfigWithCliDefaults(userConfig) {
12948
13066
  loadFromUrl: async (url) => {
12949
13067
  let fetchUrl = url;
12950
13068
  if (url.startsWith("./") || url.startsWith("../")) {
12951
- const absolutePath = path7.resolve(process.cwd(), url);
13069
+ const absolutePath = path8.resolve(process.cwd(), url);
12952
13070
  fetchUrl = `file://${absolutePath}`;
12953
13071
  } else if (url.startsWith("/")) {
12954
- if (fs7.existsSync(url)) {
13072
+ if (fs8.existsSync(url)) {
12955
13073
  fetchUrl = `file://${url}`;
12956
13074
  } else {
12957
13075
  const relativePath = `.${url}`;
12958
- const absolutePath = path7.resolve(process.cwd(), relativePath);
12959
- if (fs7.existsSync(absolutePath)) {
13076
+ const absolutePath = path8.resolve(process.cwd(), relativePath);
13077
+ if (fs8.existsSync(absolutePath)) {
12960
13078
  fetchUrl = `file://${absolutePath}`;
12961
13079
  } else {
12962
13080
  fetchUrl = `file://${url}`;
@@ -13187,8 +13305,8 @@ var resolveImageFormatSelection = (options) => {
13187
13305
  };
13188
13306
 
13189
13307
  // cli/build/worker-output-generators.ts
13190
- import fs12 from "node:fs";
13191
- import path16 from "node:path";
13308
+ import fs13 from "node:fs";
13309
+ import path17 from "node:path";
13192
13310
 
13193
13311
  // node_modules/circuit-json-to-3d-png/dist/index.js
13194
13312
  function normalizeDir(dir) {
@@ -15671,7 +15789,7 @@ import {
15671
15789
  // lib/shared/load-local-step-model-fs-map.ts
15672
15790
  import { existsSync as existsSync2 } from "node:fs";
15673
15791
  import { readFile } from "node:fs/promises";
15674
- import path8 from "node:path";
15792
+ import path9 from "node:path";
15675
15793
  var isRemoteUrl = (value) => /^https?:\/\//i.test(value);
15676
15794
  async function loadLocalStepModelFsMap(circuitJson) {
15677
15795
  const fsMap = {};
@@ -15683,7 +15801,7 @@ async function loadLocalStepModelFsMap(circuitJson) {
15683
15801
  continue;
15684
15802
  if (isRemoteUrl(modelUrl) || fsMap[modelUrl])
15685
15803
  continue;
15686
- const localPath = path8.resolve(process.cwd(), modelUrl);
15804
+ const localPath = path9.resolve(process.cwd(), modelUrl);
15687
15805
  if (!existsSync2(localPath))
15688
15806
  continue;
15689
15807
  fsMap[modelUrl] = await readFile(localPath, "utf-8");
@@ -15759,8 +15877,8 @@ var getSimulationSvgAssetsFromCircuitJson = (circuitJson) => {
15759
15877
  // node_modules/conf/dist/source/index.js
15760
15878
  import { isDeepStrictEqual } from "node:util";
15761
15879
  import process7 from "node:process";
15762
- import fs9 from "node:fs";
15763
- import path12 from "node:path";
15880
+ import fs10 from "node:fs";
15881
+ import path13 from "node:path";
15764
15882
  import crypto from "node:crypto";
15765
15883
  import assert from "node:assert";
15766
15884
 
@@ -15775,12 +15893,12 @@ var disallowedKeys = new Set([
15775
15893
  "constructor"
15776
15894
  ]);
15777
15895
  var digits = new Set("0123456789");
15778
- function getPathSegments(path9) {
15896
+ function getPathSegments(path10) {
15779
15897
  const parts = [];
15780
15898
  let currentSegment = "";
15781
15899
  let currentPart = "start";
15782
15900
  let isIgnoring = false;
15783
- for (const character of path9) {
15901
+ for (const character of path10) {
15784
15902
  switch (character) {
15785
15903
  case "\\": {
15786
15904
  if (currentPart === "index") {
@@ -15902,11 +16020,11 @@ function assertNotStringIndex(object, key) {
15902
16020
  throw new Error("Cannot use string index");
15903
16021
  }
15904
16022
  }
15905
- function getProperty(object, path9, value) {
15906
- if (!isObject(object) || typeof path9 !== "string") {
16023
+ function getProperty(object, path10, value) {
16024
+ if (!isObject(object) || typeof path10 !== "string") {
15907
16025
  return value === undefined ? object : value;
15908
16026
  }
15909
- const pathArray = getPathSegments(path9);
16027
+ const pathArray = getPathSegments(path10);
15910
16028
  if (pathArray.length === 0) {
15911
16029
  return value;
15912
16030
  }
@@ -15926,12 +16044,12 @@ function getProperty(object, path9, value) {
15926
16044
  }
15927
16045
  return object === undefined ? value : object;
15928
16046
  }
15929
- function setProperty(object, path9, value) {
15930
- if (!isObject(object) || typeof path9 !== "string") {
16047
+ function setProperty(object, path10, value) {
16048
+ if (!isObject(object) || typeof path10 !== "string") {
15931
16049
  return object;
15932
16050
  }
15933
16051
  const root = object;
15934
- const pathArray = getPathSegments(path9);
16052
+ const pathArray = getPathSegments(path10);
15935
16053
  for (let index = 0;index < pathArray.length; index++) {
15936
16054
  const key = pathArray[index];
15937
16055
  assertNotStringIndex(object, key);
@@ -15944,11 +16062,11 @@ function setProperty(object, path9, value) {
15944
16062
  }
15945
16063
  return root;
15946
16064
  }
15947
- function deleteProperty(object, path9) {
15948
- if (!isObject(object) || typeof path9 !== "string") {
16065
+ function deleteProperty(object, path10) {
16066
+ if (!isObject(object) || typeof path10 !== "string") {
15949
16067
  return false;
15950
16068
  }
15951
- const pathArray = getPathSegments(path9);
16069
+ const pathArray = getPathSegments(path10);
15952
16070
  for (let index = 0;index < pathArray.length; index++) {
15953
16071
  const key = pathArray[index];
15954
16072
  assertNotStringIndex(object, key);
@@ -15962,11 +16080,11 @@ function deleteProperty(object, path9) {
15962
16080
  }
15963
16081
  }
15964
16082
  }
15965
- function hasProperty(object, path9) {
15966
- if (!isObject(object) || typeof path9 !== "string") {
16083
+ function hasProperty(object, path10) {
16084
+ if (!isObject(object) || typeof path10 !== "string") {
15967
16085
  return false;
15968
16086
  }
15969
- const pathArray = getPathSegments(path9);
16087
+ const pathArray = getPathSegments(path10);
15970
16088
  if (pathArray.length === 0) {
15971
16089
  return false;
15972
16090
  }
@@ -15980,41 +16098,41 @@ function hasProperty(object, path9) {
15980
16098
  }
15981
16099
 
15982
16100
  // node_modules/env-paths/index.js
15983
- import path9 from "node:path";
16101
+ import path10 from "node:path";
15984
16102
  import os from "node:os";
15985
16103
  import process2 from "node:process";
15986
16104
  var homedir = os.homedir();
15987
16105
  var tmpdir = os.tmpdir();
15988
16106
  var { env } = process2;
15989
16107
  var macos = (name) => {
15990
- const library = path9.join(homedir, "Library");
16108
+ const library = path10.join(homedir, "Library");
15991
16109
  return {
15992
- data: path9.join(library, "Application Support", name),
15993
- config: path9.join(library, "Preferences", name),
15994
- cache: path9.join(library, "Caches", name),
15995
- log: path9.join(library, "Logs", name),
15996
- temp: path9.join(tmpdir, name)
16110
+ data: path10.join(library, "Application Support", name),
16111
+ config: path10.join(library, "Preferences", name),
16112
+ cache: path10.join(library, "Caches", name),
16113
+ log: path10.join(library, "Logs", name),
16114
+ temp: path10.join(tmpdir, name)
15997
16115
  };
15998
16116
  };
15999
16117
  var windows = (name) => {
16000
- const appData = env.APPDATA || path9.join(homedir, "AppData", "Roaming");
16001
- const localAppData = env.LOCALAPPDATA || path9.join(homedir, "AppData", "Local");
16118
+ const appData = env.APPDATA || path10.join(homedir, "AppData", "Roaming");
16119
+ const localAppData = env.LOCALAPPDATA || path10.join(homedir, "AppData", "Local");
16002
16120
  return {
16003
- data: path9.join(localAppData, name, "Data"),
16004
- config: path9.join(appData, name, "Config"),
16005
- cache: path9.join(localAppData, name, "Cache"),
16006
- log: path9.join(localAppData, name, "Log"),
16007
- temp: path9.join(tmpdir, name)
16121
+ data: path10.join(localAppData, name, "Data"),
16122
+ config: path10.join(appData, name, "Config"),
16123
+ cache: path10.join(localAppData, name, "Cache"),
16124
+ log: path10.join(localAppData, name, "Log"),
16125
+ temp: path10.join(tmpdir, name)
16008
16126
  };
16009
16127
  };
16010
16128
  var linux = (name) => {
16011
- const username = path9.basename(homedir);
16129
+ const username = path10.basename(homedir);
16012
16130
  return {
16013
- data: path9.join(env.XDG_DATA_HOME || path9.join(homedir, ".local", "share"), name),
16014
- config: path9.join(env.XDG_CONFIG_HOME || path9.join(homedir, ".config"), name),
16015
- cache: path9.join(env.XDG_CACHE_HOME || path9.join(homedir, ".cache"), name),
16016
- log: path9.join(env.XDG_STATE_HOME || path9.join(homedir, ".local", "state"), name),
16017
- temp: path9.join(tmpdir, username, name)
16131
+ data: path10.join(env.XDG_DATA_HOME || path10.join(homedir, ".local", "share"), name),
16132
+ config: path10.join(env.XDG_CONFIG_HOME || path10.join(homedir, ".config"), name),
16133
+ cache: path10.join(env.XDG_CACHE_HOME || path10.join(homedir, ".cache"), name),
16134
+ log: path10.join(env.XDG_STATE_HOME || path10.join(homedir, ".local", "state"), name),
16135
+ temp: path10.join(tmpdir, username, name)
16018
16136
  };
16019
16137
  };
16020
16138
  function envPaths(name, { suffix = "nodejs" } = {}) {
@@ -16034,10 +16152,10 @@ function envPaths(name, { suffix = "nodejs" } = {}) {
16034
16152
  }
16035
16153
 
16036
16154
  // node_modules/atomically/dist/index.js
16037
- import path11 from "node:path";
16155
+ import path12 from "node:path";
16038
16156
 
16039
16157
  // node_modules/stubborn-fs/dist/index.js
16040
- import fs8 from "node:fs";
16158
+ import fs9 from "node:fs";
16041
16159
  import { promisify } from "node:util";
16042
16160
 
16043
16161
  // node_modules/stubborn-utils/dist/attemptify_async.js
@@ -16167,41 +16285,41 @@ var RETRYIFY_OPTIONS = {
16167
16285
  // node_modules/stubborn-fs/dist/index.js
16168
16286
  var FS = {
16169
16287
  attempt: {
16170
- chmod: attemptify_async_default(promisify(fs8.chmod), ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
16171
- chown: attemptify_async_default(promisify(fs8.chown), ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
16172
- close: attemptify_async_default(promisify(fs8.close), ATTEMPTIFY_NOOP_OPTIONS),
16173
- fsync: attemptify_async_default(promisify(fs8.fsync), ATTEMPTIFY_NOOP_OPTIONS),
16174
- mkdir: attemptify_async_default(promisify(fs8.mkdir), ATTEMPTIFY_NOOP_OPTIONS),
16175
- realpath: attemptify_async_default(promisify(fs8.realpath), ATTEMPTIFY_NOOP_OPTIONS),
16176
- stat: attemptify_async_default(promisify(fs8.stat), ATTEMPTIFY_NOOP_OPTIONS),
16177
- unlink: attemptify_async_default(promisify(fs8.unlink), ATTEMPTIFY_NOOP_OPTIONS),
16178
- chmodSync: attemptify_sync_default(fs8.chmodSync, ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
16179
- chownSync: attemptify_sync_default(fs8.chownSync, ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
16180
- closeSync: attemptify_sync_default(fs8.closeSync, ATTEMPTIFY_NOOP_OPTIONS),
16181
- existsSync: attemptify_sync_default(fs8.existsSync, ATTEMPTIFY_NOOP_OPTIONS),
16182
- fsyncSync: attemptify_sync_default(fs8.fsync, ATTEMPTIFY_NOOP_OPTIONS),
16183
- mkdirSync: attemptify_sync_default(fs8.mkdirSync, ATTEMPTIFY_NOOP_OPTIONS),
16184
- realpathSync: attemptify_sync_default(fs8.realpathSync, ATTEMPTIFY_NOOP_OPTIONS),
16185
- statSync: attemptify_sync_default(fs8.statSync, ATTEMPTIFY_NOOP_OPTIONS),
16186
- unlinkSync: attemptify_sync_default(fs8.unlinkSync, ATTEMPTIFY_NOOP_OPTIONS)
16288
+ chmod: attemptify_async_default(promisify(fs9.chmod), ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
16289
+ chown: attemptify_async_default(promisify(fs9.chown), ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
16290
+ close: attemptify_async_default(promisify(fs9.close), ATTEMPTIFY_NOOP_OPTIONS),
16291
+ fsync: attemptify_async_default(promisify(fs9.fsync), ATTEMPTIFY_NOOP_OPTIONS),
16292
+ mkdir: attemptify_async_default(promisify(fs9.mkdir), ATTEMPTIFY_NOOP_OPTIONS),
16293
+ realpath: attemptify_async_default(promisify(fs9.realpath), ATTEMPTIFY_NOOP_OPTIONS),
16294
+ stat: attemptify_async_default(promisify(fs9.stat), ATTEMPTIFY_NOOP_OPTIONS),
16295
+ unlink: attemptify_async_default(promisify(fs9.unlink), ATTEMPTIFY_NOOP_OPTIONS),
16296
+ chmodSync: attemptify_sync_default(fs9.chmodSync, ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
16297
+ chownSync: attemptify_sync_default(fs9.chownSync, ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
16298
+ closeSync: attemptify_sync_default(fs9.closeSync, ATTEMPTIFY_NOOP_OPTIONS),
16299
+ existsSync: attemptify_sync_default(fs9.existsSync, ATTEMPTIFY_NOOP_OPTIONS),
16300
+ fsyncSync: attemptify_sync_default(fs9.fsync, ATTEMPTIFY_NOOP_OPTIONS),
16301
+ mkdirSync: attemptify_sync_default(fs9.mkdirSync, ATTEMPTIFY_NOOP_OPTIONS),
16302
+ realpathSync: attemptify_sync_default(fs9.realpathSync, ATTEMPTIFY_NOOP_OPTIONS),
16303
+ statSync: attemptify_sync_default(fs9.statSync, ATTEMPTIFY_NOOP_OPTIONS),
16304
+ unlinkSync: attemptify_sync_default(fs9.unlinkSync, ATTEMPTIFY_NOOP_OPTIONS)
16187
16305
  },
16188
16306
  retry: {
16189
- close: retryify_async_default(promisify(fs8.close), RETRYIFY_OPTIONS),
16190
- fsync: retryify_async_default(promisify(fs8.fsync), RETRYIFY_OPTIONS),
16191
- open: retryify_async_default(promisify(fs8.open), RETRYIFY_OPTIONS),
16192
- readFile: retryify_async_default(promisify(fs8.readFile), RETRYIFY_OPTIONS),
16193
- rename: retryify_async_default(promisify(fs8.rename), RETRYIFY_OPTIONS),
16194
- stat: retryify_async_default(promisify(fs8.stat), RETRYIFY_OPTIONS),
16195
- write: retryify_async_default(promisify(fs8.write), RETRYIFY_OPTIONS),
16196
- writeFile: retryify_async_default(promisify(fs8.writeFile), RETRYIFY_OPTIONS),
16197
- closeSync: retryify_sync_default(fs8.closeSync, RETRYIFY_OPTIONS),
16198
- fsyncSync: retryify_sync_default(fs8.fsyncSync, RETRYIFY_OPTIONS),
16199
- openSync: retryify_sync_default(fs8.openSync, RETRYIFY_OPTIONS),
16200
- readFileSync: retryify_sync_default(fs8.readFileSync, RETRYIFY_OPTIONS),
16201
- renameSync: retryify_sync_default(fs8.renameSync, RETRYIFY_OPTIONS),
16202
- statSync: retryify_sync_default(fs8.statSync, RETRYIFY_OPTIONS),
16203
- writeSync: retryify_sync_default(fs8.writeSync, RETRYIFY_OPTIONS),
16204
- writeFileSync: retryify_sync_default(fs8.writeFileSync, RETRYIFY_OPTIONS)
16307
+ close: retryify_async_default(promisify(fs9.close), RETRYIFY_OPTIONS),
16308
+ fsync: retryify_async_default(promisify(fs9.fsync), RETRYIFY_OPTIONS),
16309
+ open: retryify_async_default(promisify(fs9.open), RETRYIFY_OPTIONS),
16310
+ readFile: retryify_async_default(promisify(fs9.readFile), RETRYIFY_OPTIONS),
16311
+ rename: retryify_async_default(promisify(fs9.rename), RETRYIFY_OPTIONS),
16312
+ stat: retryify_async_default(promisify(fs9.stat), RETRYIFY_OPTIONS),
16313
+ write: retryify_async_default(promisify(fs9.write), RETRYIFY_OPTIONS),
16314
+ writeFile: retryify_async_default(promisify(fs9.writeFile), RETRYIFY_OPTIONS),
16315
+ closeSync: retryify_sync_default(fs9.closeSync, RETRYIFY_OPTIONS),
16316
+ fsyncSync: retryify_sync_default(fs9.fsyncSync, RETRYIFY_OPTIONS),
16317
+ openSync: retryify_sync_default(fs9.openSync, RETRYIFY_OPTIONS),
16318
+ readFileSync: retryify_sync_default(fs9.readFileSync, RETRYIFY_OPTIONS),
16319
+ renameSync: retryify_sync_default(fs9.renameSync, RETRYIFY_OPTIONS),
16320
+ statSync: retryify_sync_default(fs9.statSync, RETRYIFY_OPTIONS),
16321
+ writeSync: retryify_sync_default(fs9.writeSync, RETRYIFY_OPTIONS),
16322
+ writeFileSync: retryify_sync_default(fs9.writeFileSync, RETRYIFY_OPTIONS)
16205
16323
  }
16206
16324
  };
16207
16325
  var dist_default = FS;
@@ -16231,7 +16349,7 @@ var isUndefined = (value) => {
16231
16349
  };
16232
16350
 
16233
16351
  // node_modules/atomically/dist/utils/temp.js
16234
- import path10 from "node:path";
16352
+ import path11 from "node:path";
16235
16353
 
16236
16354
  // node_modules/when-exit/dist/node/interceptor.js
16237
16355
  import process6 from "node:process";
@@ -16331,7 +16449,7 @@ var Temp = {
16331
16449
  }
16332
16450
  },
16333
16451
  truncate: (filePath) => {
16334
- const basename = path10.basename(filePath);
16452
+ const basename = path11.basename(filePath);
16335
16453
  if (basename.length <= LIMIT_BASENAME_LENGTH)
16336
16454
  return filePath;
16337
16455
  const truncable = /^(\.?)(.*?)((?:\.[^.]+)?(?:\.tmp-\d{10}[a-f0-9]{6})?)$/.exec(basename);
@@ -16373,7 +16491,7 @@ function writeFileSync2(filePath, data, options = DEFAULT_WRITE_OPTIONS) {
16373
16491
  }
16374
16492
  }
16375
16493
  if (!filePathExists) {
16376
- const parentPath = path11.dirname(filePath);
16494
+ const parentPath = path12.dirname(filePath);
16377
16495
  dist_default.attempt.mkdirSync(parentPath, {
16378
16496
  mode: DEFAULT_FOLDER_MODE,
16379
16497
  recursive: true
@@ -16689,7 +16807,7 @@ class Conf {
16689
16807
  this.events = new EventTarget;
16690
16808
  this.#encryptionKey = options.encryptionKey;
16691
16809
  const fileExtension = options.fileExtension ? `.${options.fileExtension}` : "";
16692
- this.path = path12.resolve(options.cwd, `${options.configName ?? "config"}${fileExtension}`);
16810
+ this.path = path13.resolve(options.cwd, `${options.configName ?? "config"}${fileExtension}`);
16693
16811
  const fileStore = this.store;
16694
16812
  const store = Object.assign(createPlainObject(), options.defaults, fileStore);
16695
16813
  if (options.migrations) {
@@ -16792,7 +16910,7 @@ class Conf {
16792
16910
  }
16793
16911
  get store() {
16794
16912
  try {
16795
- const data = fs9.readFileSync(this.path, this.#encryptionKey ? null : "utf8");
16913
+ const data = fs10.readFileSync(this.path, this.#encryptionKey ? null : "utf8");
16796
16914
  const dataString = this._encryptData(data);
16797
16915
  const deserializedData = this._deserialize(dataString);
16798
16916
  this._validate(deserializedData);
@@ -16863,7 +16981,7 @@ class Conf {
16863
16981
  throw new Error("Config schema violation: " + errors.join("; "));
16864
16982
  }
16865
16983
  _ensureDirectory() {
16866
- fs9.mkdirSync(path12.dirname(this.path), { recursive: true });
16984
+ fs10.mkdirSync(path13.dirname(this.path), { recursive: true });
16867
16985
  }
16868
16986
  _write(value) {
16869
16987
  let data = this._serialize(value);
@@ -16874,13 +16992,13 @@ class Conf {
16874
16992
  data = concatUint8Arrays([initializationVector, stringToUint8Array(":"), cipher.update(stringToUint8Array(data)), cipher.final()]);
16875
16993
  }
16876
16994
  if (process7.env.SNAP) {
16877
- fs9.writeFileSync(this.path, data, { mode: this.#options.configFileMode });
16995
+ fs10.writeFileSync(this.path, data, { mode: this.#options.configFileMode });
16878
16996
  } else {
16879
16997
  try {
16880
16998
  writeFileSync2(this.path, data, { mode: this.#options.configFileMode });
16881
16999
  } catch (error) {
16882
17000
  if (error?.code === "EXDEV") {
16883
- fs9.writeFileSync(this.path, data, { mode: this.#options.configFileMode });
17001
+ fs10.writeFileSync(this.path, data, { mode: this.#options.configFileMode });
16884
17002
  return;
16885
17003
  }
16886
17004
  throw error;
@@ -16889,15 +17007,15 @@ class Conf {
16889
17007
  }
16890
17008
  _watch() {
16891
17009
  this._ensureDirectory();
16892
- if (!fs9.existsSync(this.path)) {
17010
+ if (!fs10.existsSync(this.path)) {
16893
17011
  this._write(createPlainObject());
16894
17012
  }
16895
17013
  if (process7.platform === "win32") {
16896
- fs9.watch(this.path, { persistent: false }, debounce_fn_default(() => {
17014
+ fs10.watch(this.path, { persistent: false }, debounce_fn_default(() => {
16897
17015
  this.events.dispatchEvent(new Event("change"));
16898
17016
  }, { wait: 100 }));
16899
17017
  } else {
16900
- fs9.watchFile(this.path, { persistent: false }, debounce_fn_default(() => {
17018
+ fs10.watchFile(this.path, { persistent: false }, debounce_fn_default(() => {
16901
17019
  this.events.dispatchEvent(new Event("change"));
16902
17020
  }, { wait: 5000 }));
16903
17021
  }
@@ -17033,14 +17151,14 @@ function jwtDecode(token, options) {
17033
17151
  }
17034
17152
 
17035
17153
  // lib/cli-config/index.ts
17036
- import fs11 from "node:fs";
17154
+ import fs12 from "node:fs";
17037
17155
  import os3 from "node:os";
17038
- import path14 from "node:path";
17156
+ import path15 from "node:path";
17039
17157
 
17040
17158
  // lib/shared/handle-registry-auth-error.ts
17041
- import fs10 from "node:fs";
17159
+ import fs11 from "node:fs";
17042
17160
  import os2 from "node:os";
17043
- import path13 from "node:path";
17161
+ import path14 from "node:path";
17044
17162
  var AUTH_TOKEN_REGEX = /^\/\/npm\.tscircuit\.com\/:_authToken=(.+)$/m;
17045
17163
  function isUnauthorizedError(error) {
17046
17164
  const output = [
@@ -17061,9 +17179,9 @@ function isUnauthorizedError(error) {
17061
17179
  return /\b(401|E401)\b/i.test(output) || /unauthorized/i.test(output);
17062
17180
  }
17063
17181
  function hasTsciAuthToken(npmrcPath) {
17064
- if (!fs10.existsSync(npmrcPath))
17182
+ if (!fs11.existsSync(npmrcPath))
17065
17183
  return false;
17066
- const content = fs10.readFileSync(npmrcPath, "utf-8");
17184
+ const content = fs11.readFileSync(npmrcPath, "utf-8");
17067
17185
  return AUTH_TOKEN_REGEX.test(content);
17068
17186
  }
17069
17187
  function handleRegistryAuthError({
@@ -17073,8 +17191,8 @@ function handleRegistryAuthError({
17073
17191
  if (!isUnauthorizedError(error))
17074
17192
  return;
17075
17193
  const npmrcPaths = [
17076
- path13.join(projectDir, ".npmrc"),
17077
- path13.join(os2.homedir(), ".npmrc")
17194
+ path14.join(projectDir, ".npmrc"),
17195
+ path14.join(os2.homedir(), ".npmrc")
17078
17196
  ];
17079
17197
  const hasToken = npmrcPaths.some(hasTsciAuthToken);
17080
17198
  if (hasToken) {
@@ -17097,13 +17215,13 @@ var getSessionToken = () => {
17097
17215
  };
17098
17216
  var getSessionTokenFromNpmrc = () => {
17099
17217
  const npmrcPaths = [
17100
- path14.join(process.cwd(), ".npmrc"),
17101
- path14.join(os3.homedir(), ".npmrc")
17218
+ path15.join(process.cwd(), ".npmrc"),
17219
+ path15.join(os3.homedir(), ".npmrc")
17102
17220
  ];
17103
17221
  for (const npmrcPath of npmrcPaths) {
17104
- if (!fs11.existsSync(npmrcPath))
17222
+ if (!fs12.existsSync(npmrcPath))
17105
17223
  continue;
17106
- const content = fs11.readFileSync(npmrcPath, "utf-8");
17224
+ const content = fs12.readFileSync(npmrcPath, "utf-8");
17107
17225
  const match = content.match(AUTH_TOKEN_REGEX);
17108
17226
  if (match?.[1]) {
17109
17227
  return match[1].trim();
@@ -17141,7 +17259,7 @@ var getCircuitJsonToGltfOptions = ({
17141
17259
  };
17142
17260
 
17143
17261
  // cli/build/convert-model-urls-to-file-urls.ts
17144
- import path15 from "node:path";
17262
+ import path16 from "node:path";
17145
17263
  import { pathToFileURL as pathToFileURL3 } from "node:url";
17146
17264
  var convertModelUrlsToFileUrls = (circuitJson) => {
17147
17265
  const modelUrlKeys2 = [
@@ -17168,7 +17286,7 @@ var convertModelUrlsToFileUrls = (circuitJson) => {
17168
17286
  if (value.startsWith("/") || value.match(/^[a-zA-Z]:\\/)) {
17169
17287
  updated[key] = pathToFileURL3(value).href;
17170
17288
  } else if (value.startsWith(".")) {
17171
- updated[key] = pathToFileURL3(path15.resolve(process.cwd(), value)).href;
17289
+ updated[key] = pathToFileURL3(path16.resolve(process.cwd(), value)).href;
17172
17290
  }
17173
17291
  }
17174
17292
  }
@@ -17209,12 +17327,12 @@ var writeSimulationSvgAssetsFromCircuitJson = (circuitJson, outputDir, imageForm
17209
17327
  for (const simulationSvgAsset of simulationSvgAssets) {
17210
17328
  if (imageFormats.simulationSvgs) {
17211
17329
  const fileName = hasMultipleSimulations ? `simulation-${simulationSvgAsset.fileNameSuffix}.svg` : "simulation.svg";
17212
- fs12.writeFileSync(path16.join(outputDir, fileName), simulationSvgAsset.simulationSvg, "utf-8");
17330
+ fs13.writeFileSync(path17.join(outputDir, fileName), simulationSvgAsset.simulationSvg, "utf-8");
17213
17331
  simulationFileNames.push(fileName);
17214
17332
  }
17215
17333
  if (imageFormats.simulationSchematicSvgs) {
17216
17334
  const fileName = hasMultipleSimulations ? `simulation-schematic-${simulationSvgAsset.fileNameSuffix}.svg` : "simulation-schematic.svg";
17217
- fs12.writeFileSync(path16.join(outputDir, fileName), simulationSvgAsset.schematicSimulationSvg, "utf-8");
17335
+ fs13.writeFileSync(path17.join(outputDir, fileName), simulationSvgAsset.schematicSimulationSvg, "utf-8");
17218
17336
  schematicSimulationFileNames.push(fileName);
17219
17337
  }
17220
17338
  }
@@ -17224,8 +17342,8 @@ var writeGlbFromCircuitJson = async (circuitJson, glbOutputPath) => {
17224
17342
  const circuitJsonWithFileUrls = convertModelUrlsToFileUrls(circuitJson);
17225
17343
  const glbBuffer = await convertCircuitJsonToGltf(circuitJsonWithFileUrls, getCircuitJsonToGltfOptions({ format: "glb" }));
17226
17344
  const glbData = normalizeToUint8Array2(glbBuffer);
17227
- fs12.mkdirSync(path16.dirname(glbOutputPath), { recursive: true });
17228
- fs12.writeFileSync(glbOutputPath, Buffer.from(glbData));
17345
+ fs13.mkdirSync(path17.dirname(glbOutputPath), { recursive: true });
17346
+ fs13.writeFileSync(glbOutputPath, Buffer.from(glbData));
17229
17347
  };
17230
17348
  var writeStepFromCircuitJson = async (circuitJson, stepOutputPath) => {
17231
17349
  const stepContent = await circuitJsonToStep(circuitJson, {
@@ -17233,38 +17351,38 @@ var writeStepFromCircuitJson = async (circuitJson, stepOutputPath) => {
17233
17351
  includeExternalMeshes: true,
17234
17352
  fsMap: await loadLocalStepModelFsMap(circuitJson)
17235
17353
  });
17236
- fs12.mkdirSync(path16.dirname(stepOutputPath), { recursive: true });
17237
- fs12.writeFileSync(stepOutputPath, stepContent);
17354
+ fs13.mkdirSync(path17.dirname(stepOutputPath), { recursive: true });
17355
+ fs13.writeFileSync(stepOutputPath, stepContent);
17238
17356
  };
17239
17357
  var writeImageAssetsFromCircuitJson = async (circuitJson, options) => {
17240
17358
  const { outputDir, imageFormats, pcbSnapshotSettings } = options;
17241
- fs12.mkdirSync(outputDir, { recursive: true });
17359
+ fs13.mkdirSync(outputDir, { recursive: true });
17242
17360
  if (imageFormats.pcbSvgs) {
17243
17361
  const pcbSvg = convertCircuitJsonToPcbSvg2(circuitJson, pcbSnapshotSettings);
17244
- fs12.writeFileSync(path16.join(outputDir, "pcb.svg"), pcbSvg, "utf-8");
17362
+ fs13.writeFileSync(path17.join(outputDir, "pcb.svg"), pcbSvg, "utf-8");
17245
17363
  }
17246
17364
  if (imageFormats.pcbPngs) {
17247
17365
  const pcbSvg = convertCircuitJsonToPcbSvg2(circuitJson, pcbSnapshotSettings);
17248
- fs12.writeFileSync(path16.join(outputDir, "pcb.png"), await convertSvgToPngBuffer(pcbSvg));
17366
+ fs13.writeFileSync(path17.join(outputDir, "pcb.png"), await convertSvgToPngBuffer(pcbSvg));
17249
17367
  }
17250
17368
  if (imageFormats.schematicSvgs) {
17251
17369
  const schematicSvg = convertCircuitJsonToSchematicSvg(circuitJson);
17252
- fs12.writeFileSync(path16.join(outputDir, "schematic.svg"), schematicSvg, "utf-8");
17370
+ fs13.writeFileSync(path17.join(outputDir, "schematic.svg"), schematicSvg, "utf-8");
17253
17371
  }
17254
17372
  if (imageFormats.schematicPngs) {
17255
17373
  const schematicSvg = convertCircuitJsonToSchematicSvg(circuitJson);
17256
- fs12.writeFileSync(path16.join(outputDir, "schematic.png"), await convertSvgToPngBuffer(schematicSvg));
17374
+ fs13.writeFileSync(path17.join(outputDir, "schematic.png"), await convertSvgToPngBuffer(schematicSvg));
17257
17375
  }
17258
17376
  writeSimulationSvgAssetsFromCircuitJson(circuitJson, outputDir, imageFormats);
17259
17377
  if (imageFormats.threeDPngs) {
17260
17378
  const pngBuffer = await renderCircuitJsonTo3dPng(circuitJson);
17261
- fs12.writeFileSync(path16.join(outputDir, "3d.png"), Buffer.from(pngBuffer));
17379
+ fs13.writeFileSync(path17.join(outputDir, "3d.png"), Buffer.from(pngBuffer));
17262
17380
  }
17263
17381
  };
17264
17382
 
17265
17383
  // cli/build/worker-build-handlers.ts
17266
17384
  var loadCircuitJsonFromInputFile = (filePath) => {
17267
- const parsed = JSON.parse(fs13.readFileSync(filePath, "utf-8"));
17385
+ const parsed = JSON.parse(fs14.readFileSync(filePath, "utf-8"));
17268
17386
  return Array.isArray(parsed) ? parsed : [];
17269
17387
  };
17270
17388
  var handleBuildFile = async (filePath, outputPath, glbOutputPath, stepOutputPath, previewOutputDir, projectDir, options, workerLog, workerStatus) => {
@@ -17273,7 +17391,7 @@ var handleBuildFile = async (filePath, outputPath, glbOutputPath, stepOutputPath
17273
17391
  const startedAt = options?.profile ? performance.now() : 0;
17274
17392
  try {
17275
17393
  process.chdir(projectDir);
17276
- workerLog(`Generating circuit JSON for ${path17.relative(projectDir, filePath)}...`);
17394
+ workerLog(`Generating circuit JSON for ${path18.relative(projectDir, filePath)}...`);
17277
17395
  await registerStaticAssetLoaders();
17278
17396
  const projectConfig = await loadRuntimeProjectConfig(projectDir);
17279
17397
  const platformConfig = mergePlatformConfigs(projectConfig?.platformConfig, options?.platformConfig);
@@ -17288,13 +17406,17 @@ var handleBuildFile = async (filePath, outputPath, glbOutputPath, stepOutputPath
17288
17406
  ...options.autorouterDiagnostics,
17289
17407
  log: (message) => workerLog(message)
17290
17408
  } : undefined,
17409
+ solverDiagnostics: options?.solverDiagnostics ? {
17410
+ ...options.solverDiagnostics,
17411
+ log: (message) => workerLog(message)
17412
+ } : undefined,
17291
17413
  onAsyncEffectStatus: (asyncEffectName) => {
17292
17414
  workerStatus(`waiting on ${asyncEffectName}…`);
17293
17415
  }
17294
17416
  })).circuitJson;
17295
- fs13.mkdirSync(path17.dirname(outputPath), { recursive: true });
17296
- fs13.writeFileSync(outputPath, JSON.stringify(circuitJson, null, 2));
17297
- workerLog(`Circuit JSON written to ${path17.relative(projectDir, outputPath)}`);
17417
+ fs14.mkdirSync(path18.dirname(outputPath), { recursive: true });
17418
+ fs14.writeFileSync(outputPath, JSON.stringify(circuitJson, null, 2));
17419
+ workerLog(`Circuit JSON written to ${path18.relative(projectDir, outputPath)}`);
17298
17420
  const diagnostics = analyzeCircuitJson(circuitJson);
17299
17421
  const filteredDiagnostics = filterDiagnosticsByDrcCategory({
17300
17422
  errors: diagnostics.errors,
@@ -17324,7 +17446,7 @@ var handleBuildFile = async (filePath, outputPath, glbOutputPath, stepOutputPath
17324
17446
  let previewError;
17325
17447
  if (glbOutputPath) {
17326
17448
  try {
17327
- workerLog(`Converting ${path17.relative(projectDir, outputPath)} to GLB in same worker...`);
17449
+ workerLog(`Converting ${path18.relative(projectDir, outputPath)} to GLB in same worker...`);
17328
17450
  await writeGlbFromCircuitJson(circuitJson, glbOutputPath);
17329
17451
  glbOk = true;
17330
17452
  } catch (err) {
@@ -17335,7 +17457,7 @@ var handleBuildFile = async (filePath, outputPath, glbOutputPath, stepOutputPath
17335
17457
  }
17336
17458
  if (stepOutputPath) {
17337
17459
  try {
17338
- workerLog(`Converting ${path17.relative(projectDir, outputPath)} to STEP in same worker...`);
17460
+ workerLog(`Converting ${path18.relative(projectDir, outputPath)} to STEP in same worker...`);
17339
17461
  await writeStepFromCircuitJson(circuitJson, stepOutputPath);
17340
17462
  stepOk = true;
17341
17463
  } catch (err) {
@@ -17346,8 +17468,8 @@ var handleBuildFile = async (filePath, outputPath, glbOutputPath, stepOutputPath
17346
17468
  }
17347
17469
  if (options?.generatePreviewAssets) {
17348
17470
  try {
17349
- const resolvedPreviewOutputDir = previewOutputDir ?? path17.dirname(outputPath);
17350
- workerLog(`Generating preview assets for ${path17.relative(projectDir, resolvedPreviewOutputDir)} in same worker...`);
17471
+ const resolvedPreviewOutputDir = previewOutputDir ?? path18.dirname(outputPath);
17472
+ workerLog(`Generating preview assets for ${path18.relative(projectDir, resolvedPreviewOutputDir)} in same worker...`);
17351
17473
  await writeImageAssetsFromCircuitJson(circuitJson, {
17352
17474
  outputDir: resolvedPreviewOutputDir,
17353
17475
  imageFormats: options?.imageFormats ?? DEFAULT_IMAGE_FORMAT_SELECTION,