@tscircuit/cli 0.1.2178 → 0.1.2180

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.
@@ -12492,8 +12492,8 @@ var require_semver2 = __commonJS(function(exports, module) {
12492
12492
  import { parentPort } from "node:worker_threads";
12493
12493
 
12494
12494
  // cli/build/worker-build-handlers.ts
12495
- import fs14 from "node:fs";
12496
- import path18 from "node:path";
12495
+ import fs15 from "node:fs";
12496
+ import path19 from "node:path";
12497
12497
 
12498
12498
  // lib/project-config/index.ts
12499
12499
  import * as fs from "node:fs";
@@ -12727,8 +12727,8 @@ function formatCircuitJsonDiagnostics({
12727
12727
  }
12728
12728
 
12729
12729
  // lib/shared/generate-circuit-json.tsx
12730
- import fs7 from "node:fs";
12731
- import path7 from "node:path";
12730
+ import fs8 from "node:fs";
12731
+ import path8 from "node:path";
12732
12732
  import { pathToFileURL as pathToFileURL2 } from "node:url";
12733
12733
  import Debug from "debug";
12734
12734
 
@@ -13479,14 +13479,55 @@ class AutorouterDiagnostics {
13479
13479
  }
13480
13480
  }
13481
13481
 
13482
- // lib/shared/importFromUserLand.ts
13483
- import { createRequire as createRequire2 } from "node:module";
13482
+ // lib/shared/autorouting-artifacts.ts
13484
13483
  import fs3 from "node:fs";
13485
13484
  import path3 from "node:path";
13485
+ import { createHash } from "node:crypto";
13486
+ function attachAutoroutingArtifacts(root, filePath, projectDir = process.cwd()) {
13487
+ const entryPath = path3.relative(projectDir, path3.resolve(projectDir, filePath));
13488
+ const entryKey = `${path3.basename(filePath).replace(/[^a-zA-Z0-9_-]/g, "-")}-${createHash("sha256").update(entryPath).digest("hex").slice(0, 10)}`;
13489
+ const directory = path3.resolve(projectDir, ".tscircuit", "autorouting-artifacts", entryKey);
13490
+ let warnedUnsupportedVersion = false;
13491
+ root.on("autorouting:end", (event) => {
13492
+ try {
13493
+ if (event.pcbTracePathsUnavailableReason) {
13494
+ throw new Error(event.pcbTracePathsUnavailableReason);
13495
+ }
13496
+ if (event.pcbTracePaths === undefined || event._actualRoutingPhaseOrderIndex === undefined) {
13497
+ if (!warnedUnsupportedVersion) {
13498
+ console.warn("Autorouting paths were not provided by this router. Use local routing and update your project's tscircuit package to save replayable JSON.");
13499
+ warnedUnsupportedVersion = true;
13500
+ }
13501
+ return;
13502
+ }
13503
+ if (event.pcbTracePaths.length === 0)
13504
+ return;
13505
+ const phase = event.routingPhaseIndex ?? "default";
13506
+ const order = event._actualRoutingPhaseOrderIndex;
13507
+ const safeSubcircuit = event.subcircuit_id.replace(/[^a-zA-Z0-9_-]/g, "-");
13508
+ const stage = event.phaseStageIndex === undefined ? "" : `-stage-${event.phaseStageIndex}`;
13509
+ const outputPath = path3.join(directory, `${safeSubcircuit}-phase-${phase}-order-${order}${stage}.pcb-trace-paths.json`);
13510
+ const contents = `${JSON.stringify(event.pcbTracePaths, null, 2)}
13511
+ `;
13512
+ fs3.mkdirSync(directory, { recursive: true });
13513
+ if (!fs3.existsSync(outputPath) || fs3.readFileSync(outputPath, "utf8") !== contents) {
13514
+ fs3.writeFileSync(outputPath, contents);
13515
+ }
13516
+ console.log(`Saved autorouting paths to ${path3.relative(projectDir, outputPath)} (import this JSON into <autoroutingphase pcbTracePaths={...} />).`);
13517
+ } catch (error) {
13518
+ console.warn(`Could not save autorouting paths for ${event.subcircuit_id}: ${error instanceof Error ? error.message : String(error)}`);
13519
+ }
13520
+ });
13521
+ }
13522
+
13523
+ // lib/shared/importFromUserLand.ts
13524
+ import { createRequire as createRequire2 } from "node:module";
13525
+ import fs4 from "node:fs";
13526
+ import path4 from "node:path";
13486
13527
  async function importFromUserLand(moduleName, projectDir = process.cwd()) {
13487
- const userModulePath = path3.join(projectDir, "node_modules", moduleName);
13488
- if (fs3.existsSync(userModulePath)) {
13489
- const userRequire = createRequire2(path3.join(projectDir, "noop.js"));
13528
+ const userModulePath = path4.join(projectDir, "node_modules", moduleName);
13529
+ if (fs4.existsSync(userModulePath)) {
13530
+ const userRequire = createRequire2(path4.join(projectDir, "noop.js"));
13490
13531
  try {
13491
13532
  const resolvedUserPath = userRequire.resolve(moduleName);
13492
13533
  return await import(resolvedUserPath);
@@ -13509,8 +13550,8 @@ async function importFromUserLand(moduleName, projectDir = process.cwd()) {
13509
13550
  }
13510
13551
 
13511
13552
  // lib/shared/register-static-asset-loaders.ts
13512
- import fs4 from "node:fs";
13513
- import path4 from "node:path";
13553
+ import fs5 from "node:fs";
13554
+ import path5 from "node:path";
13514
13555
  var STATIC_ASSET_EXTENSIONS = [
13515
13556
  ".glb",
13516
13557
  ".gltf",
@@ -13537,15 +13578,15 @@ var TEXT_STATIC_ASSET_EXTENSIONS = new Set([
13537
13578
  ".kicad_sym"
13538
13579
  ]);
13539
13580
  var readFileContentForStaticLoader = (filePath) => {
13540
- const ext = path4.extname(filePath).toLowerCase();
13581
+ const ext = path5.extname(filePath).toLowerCase();
13541
13582
  if (TEXT_STATIC_ASSET_EXTENSIONS.has(ext)) {
13542
- return fs4.readFileSync(filePath, "utf-8");
13583
+ return fs5.readFileSync(filePath, "utf-8");
13543
13584
  }
13544
- const buffer = fs4.readFileSync(filePath);
13585
+ const buffer = fs5.readFileSync(filePath);
13545
13586
  return buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength);
13546
13587
  };
13547
13588
  var getStaticFileLoader = (filePath) => {
13548
- const extWithDot = path4.extname(filePath).toLowerCase();
13589
+ const extWithDot = path5.extname(filePath).toLowerCase();
13549
13590
  const ext = extWithDot.replace(/^\./, "");
13550
13591
  return activePlatformConfig?.staticFileLoaderMap?.[ext] ?? activePlatformConfig?.staticFileLoaderMap?.[extWithDot];
13551
13592
  };
@@ -13559,12 +13600,12 @@ var normalizeStaticFileLoaderResult = (result) => {
13559
13600
  };
13560
13601
  };
13561
13602
  var getBaseUrlFromTsConfig = (projectDir) => {
13562
- const tsconfigPath = path4.join(projectDir, "tsconfig.json");
13603
+ const tsconfigPath = path5.join(projectDir, "tsconfig.json");
13563
13604
  try {
13564
- if (!fs4.existsSync(tsconfigPath)) {
13605
+ if (!fs5.existsSync(tsconfigPath)) {
13565
13606
  return null;
13566
13607
  }
13567
- const tsconfigContent = fs4.readFileSync(tsconfigPath, "utf-8");
13608
+ const tsconfigContent = fs5.readFileSync(tsconfigPath, "utf-8");
13568
13609
  const tsconfig = JSON.parse(tsconfigContent);
13569
13610
  if (tsconfig.compilerOptions?.baseUrl) {
13570
13611
  return tsconfig.compilerOptions.baseUrl;
@@ -13591,8 +13632,8 @@ var registerStaticAssetLoaders = (platformConfig, projectDir = process.cwd()) =>
13591
13632
  loader: "object"
13592
13633
  };
13593
13634
  }
13594
- const baseDir = baseUrl ? path4.resolve(projectDir, baseUrl) : projectDir;
13595
- const relativePath = path4.relative(baseDir, args.path).split(path4.sep).join("/");
13635
+ const baseDir = baseUrl ? path5.resolve(projectDir, baseUrl) : projectDir;
13636
+ const relativePath = path5.relative(baseDir, args.path).split(path5.sep).join("/");
13596
13637
  const pathStr = `./${relativePath}`;
13597
13638
  return {
13598
13639
  exports: {
@@ -13608,9 +13649,9 @@ var registerStaticAssetLoaders = (platformConfig, projectDir = process.cwd()) =>
13608
13649
  };
13609
13650
 
13610
13651
  // lib/shared/circuit-json-build-cache.ts
13611
- import fs5 from "node:fs";
13612
- import path5 from "node:path";
13613
- import { createHash } from "node:crypto";
13652
+ import fs6 from "node:fs";
13653
+ import path6 from "node:path";
13654
+ import { createHash as createHash2 } from "node:crypto";
13614
13655
  var SOURCE_FILE_EXTENSIONS = new Set([
13615
13656
  ".tsx",
13616
13657
  ".ts",
@@ -13633,43 +13674,43 @@ var IGNORED_DIRECTORY_NAMES = new Set([
13633
13674
  ".git"
13634
13675
  ]);
13635
13676
  var isPathInside = (childPath, parentPath) => {
13636
- const relative = path5.relative(parentPath, childPath);
13637
- return relative === "" || !relative.startsWith("..") && !path5.isAbsolute(relative);
13677
+ const relative = path6.relative(parentPath, childPath);
13678
+ return relative === "" || !relative.startsWith("..") && !path6.isAbsolute(relative);
13638
13679
  };
13639
13680
  var findCircuitProjectDir = (filePath) => {
13640
- const absoluteFilePath = path5.resolve(filePath);
13641
- let currentDir = path5.dirname(absoluteFilePath);
13681
+ const absoluteFilePath = path6.resolve(filePath);
13682
+ let currentDir = path6.dirname(absoluteFilePath);
13642
13683
  while (true) {
13643
- if (fs5.existsSync(path5.join(currentDir, "package.json"))) {
13684
+ if (fs6.existsSync(path6.join(currentDir, "package.json"))) {
13644
13685
  return currentDir;
13645
13686
  }
13646
- const parentDir = path5.dirname(currentDir);
13687
+ const parentDir = path6.dirname(currentDir);
13647
13688
  if (parentDir === currentDir)
13648
13689
  break;
13649
13690
  currentDir = parentDir;
13650
13691
  }
13651
- const cwd = path5.resolve(process.cwd());
13652
- return isPathInside(absoluteFilePath, cwd) ? cwd : path5.dirname(absoluteFilePath);
13692
+ const cwd = path6.resolve(process.cwd());
13693
+ return isPathInside(absoluteFilePath, cwd) ? cwd : path6.dirname(absoluteFilePath);
13653
13694
  };
13654
13695
  var getCircuitJsonOutputDirName = (relativePath) => {
13655
13696
  const normalizedRelativePath = relativePath.toLowerCase().replaceAll("\\", "/");
13656
13697
  if (normalizedRelativePath === "circuit.json" || normalizedRelativePath.endsWith("/circuit.json")) {
13657
- return path5.dirname(relativePath);
13698
+ return path6.dirname(relativePath);
13658
13699
  }
13659
13700
  return relativePath.replace(/(\.board|\.circuit)?\.tsx$/, "").replace(/\.circuit\.json$/, "");
13660
13701
  };
13661
13702
  var getCircuitJsonBuildOutputPath = (filePath) => {
13662
- const absoluteFilePath = path5.resolve(filePath);
13703
+ const absoluteFilePath = path6.resolve(filePath);
13663
13704
  const projectDir = findCircuitProjectDir(absoluteFilePath);
13664
- const relativePath = path5.relative(projectDir, absoluteFilePath);
13665
- return path5.join(projectDir, "dist", getCircuitJsonOutputDirName(relativePath), "circuit.json");
13705
+ const relativePath = path6.relative(projectDir, absoluteFilePath);
13706
+ return path6.join(projectDir, "dist", getCircuitJsonOutputDirName(relativePath), "circuit.json");
13666
13707
  };
13667
13708
  var getSourceFilePaths = (projectDir) => {
13668
13709
  const sourceFilePaths = [];
13669
13710
  const visit = (directoryPath) => {
13670
- const entries = fs5.readdirSync(directoryPath, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name));
13711
+ const entries = fs6.readdirSync(directoryPath, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name));
13671
13712
  for (const entry of entries) {
13672
- const entryPath = path5.join(directoryPath, entry.name);
13713
+ const entryPath = path6.join(directoryPath, entry.name);
13673
13714
  if (entry.isDirectory()) {
13674
13715
  if (IGNORED_DIRECTORY_NAMES.has(entry.name) || entry.name.startsWith(".")) {
13675
13716
  continue;
@@ -13677,7 +13718,7 @@ var getSourceFilePaths = (projectDir) => {
13677
13718
  visit(entryPath);
13678
13719
  continue;
13679
13720
  }
13680
- if (!entry.isFile() || entry.name.endsWith(".circuit.json") || !SOURCE_FILE_EXTENSIONS.has(path5.extname(entry.name).toLowerCase())) {
13721
+ if (!entry.isFile() || entry.name.endsWith(".circuit.json") || !SOURCE_FILE_EXTENSIONS.has(path6.extname(entry.name).toLowerCase())) {
13681
13722
  continue;
13682
13723
  }
13683
13724
  sourceFilePaths.push(entryPath);
@@ -13688,10 +13729,10 @@ var getSourceFilePaths = (projectDir) => {
13688
13729
  };
13689
13730
  var getSourceFilesystemMd5Hash = (filePath) => {
13690
13731
  const projectDir = findCircuitProjectDir(filePath);
13691
- const hash = createHash("md5");
13732
+ const hash = createHash2("md5");
13692
13733
  for (const sourceFilePath of getSourceFilePaths(projectDir)) {
13693
- const relativePath = path5.relative(projectDir, sourceFilePath).split(path5.sep).join("/");
13694
- const content = fs5.readFileSync(sourceFilePath);
13734
+ const relativePath = path6.relative(projectDir, sourceFilePath).split(path6.sep).join("/");
13735
+ const content = fs6.readFileSync(sourceFilePath);
13695
13736
  hash.update(`${Buffer.byteLength(relativePath)}:`);
13696
13737
  hash.update(relativePath);
13697
13738
  hash.update(`${content.byteLength}:`);
@@ -13726,7 +13767,7 @@ var readCurrentCircuitJsonBuild = ({
13726
13767
  }) => {
13727
13768
  const outputPath = getCircuitJsonBuildOutputPath(filePath);
13728
13769
  try {
13729
- const parsed = JSON.parse(fs5.readFileSync(outputPath, "utf-8"));
13770
+ const parsed = JSON.parse(fs6.readFileSync(outputPath, "utf-8"));
13730
13771
  if (!Array.isArray(parsed))
13731
13772
  return null;
13732
13773
  const hasCurrentFilesystemHash = parsed.some((element) => element?.type === "source_project_metadata" && element.source_filesystem_md5_hash === sourceFilesystemMd5Hash);
@@ -13740,8 +13781,8 @@ var readCurrentCircuitJsonBuild = ({
13740
13781
  };
13741
13782
 
13742
13783
  // lib/shared/solver-diagnostics.ts
13743
- import fs6 from "node:fs";
13744
- import path6 from "node:path";
13784
+ import fs7 from "node:fs";
13785
+ import path7 from "node:path";
13745
13786
  var escapeJsonPointerSegment = (segment) => segment.replaceAll("~", "~0").replaceAll("/", "~1");
13746
13787
  var cloneAsJson = (value, ancestors = new WeakMap, path = "#") => {
13747
13788
  if (value === undefined)
@@ -13842,8 +13883,8 @@ class SolverDiagnostics {
13842
13883
  finalize() {
13843
13884
  if (!this.options.enabled)
13844
13885
  return;
13845
- fs6.mkdirSync(path6.dirname(this.options.outputPath), { recursive: true });
13846
- fs6.writeFileSync(this.options.outputPath, `${JSON.stringify({
13886
+ fs7.mkdirSync(path7.dirname(this.options.outputPath), { recursive: true });
13887
+ fs7.writeFileSync(this.options.outputPath, `${JSON.stringify({
13847
13888
  format: "tscircuit_solver_debug_v1",
13848
13889
  entrypoint: this.options.entrypoint,
13849
13890
  solvers: this.solverInvocations
@@ -13886,7 +13927,7 @@ async function generateCircuitJson({
13886
13927
  }) {
13887
13928
  debug(`Generating circuit JSON for ${filePath}`);
13888
13929
  const currentSourceFilesystemMd5Hash = sourceFilesystemMd5Hash ?? getSourceFilesystemMd5Hash(filePath);
13889
- const projectRootDir = path7.resolve(projectDirOption ?? process.cwd());
13930
+ const projectRootDir = path8.resolve(projectDirOption ?? process.cwd());
13890
13931
  const React = await importFromUserLand("react", projectRootDir);
13891
13932
  globalThis.React = React;
13892
13933
  registerStaticAssetLoaders(platformConfig, projectRootDir);
@@ -13898,12 +13939,13 @@ async function generateCircuitJson({
13898
13939
  autorouterDiagnostics.attachToRootCircuit(runner);
13899
13940
  const solverDiagnostics = solverDiagnosticsOptions ? new SolverDiagnostics(solverDiagnosticsOptions) : null;
13900
13941
  solverDiagnostics?.attachToRootCircuit(runner);
13901
- const absoluteFilePath = path7.isAbsolute(filePath) ? filePath : path7.resolve(projectRootDir, filePath);
13902
- const sourceDir = path7.dirname(absoluteFilePath);
13942
+ attachAutoroutingArtifacts(runner, filePath, projectRootDir);
13943
+ const absoluteFilePath = path8.isAbsolute(filePath) ? filePath : path8.resolve(projectRootDir, filePath);
13944
+ const sourceDir = path8.dirname(absoluteFilePath);
13903
13945
  const resolvedOutputDir = outputDir ?? sourceDir;
13904
- const relativeComponentPath = path7.relative(sourceDir, absoluteFilePath);
13905
- const baseFileName = outputFileName || path7.basename(absoluteFilePath).replace(/\.[^.]+$/, "");
13906
- const outputPath = path7.join(resolvedOutputDir, `${baseFileName}.circuit.json`);
13946
+ const relativeComponentPath = path8.relative(sourceDir, absoluteFilePath);
13947
+ const baseFileName = outputFileName || path8.basename(absoluteFilePath).replace(/\.[^.]+$/, "");
13948
+ const outputPath = path8.join(resolvedOutputDir, `${baseFileName}.circuit.json`);
13907
13949
  debug(`Project directory: ${sourceDir}`);
13908
13950
  debug(`Relative component path: ${relativeComponentPath}`);
13909
13951
  debug(`Output path: ${outputPath}`);
@@ -13923,7 +13965,7 @@ async function generateCircuitJson({
13923
13965
  return false;
13924
13966
  if (normalizedFilePath.match(/^\.[^/]/))
13925
13967
  return false;
13926
- if (!ALLOWED_FILE_EXTENSIONS.includes(path7.extname(normalizedFilePath)))
13968
+ if (!ALLOWED_FILE_EXTENSIONS.includes(path8.extname(normalizedFilePath)))
13927
13969
  return false;
13928
13970
  return true;
13929
13971
  },
@@ -13960,7 +14002,7 @@ async function generateCircuitJson({
13960
14002
  await autorouterDiagnostics.finalize(circuitJson);
13961
14003
  if (saveToFile) {
13962
14004
  debug(`Saving circuit JSON to ${outputPath}`);
13963
- fs7.writeFileSync(outputPath, JSON.stringify(circuitJson, null, 2));
14005
+ fs8.writeFileSync(outputPath, JSON.stringify(circuitJson, null, 2));
13964
14006
  }
13965
14007
  return {
13966
14008
  circuitJson,
@@ -13970,9 +14012,9 @@ async function generateCircuitJson({
13970
14012
  }
13971
14013
 
13972
14014
  // lib/shared/get-platform-config-with-cli-defaults.ts
13973
- import { createHash as createHash2 } from "node:crypto";
13974
- import fs8 from "node:fs";
13975
- import path8 from "node:path";
14015
+ import { createHash as createHash3 } from "node:crypto";
14016
+ import fs9 from "node:fs";
14017
+ import path9 from "node:path";
13976
14018
  import { getPlatformConfig } from "@tscircuit/eval/platform-config";
13977
14019
 
13978
14020
  // lib/shared/platform-config-utils.ts
@@ -14010,25 +14052,25 @@ var mergePlatformConfigs = (...configs) => {
14010
14052
  };
14011
14053
 
14012
14054
  // lib/shared/get-platform-config-with-cli-defaults.ts
14013
- function createLocalCacheEngine(cacheDir = path8.join(process.cwd(), ".tscircuit", "cache")) {
14055
+ function createLocalCacheEngine(cacheDir = path9.join(process.cwd(), ".tscircuit", "cache")) {
14014
14056
  return {
14015
14057
  getItem: (key) => {
14016
14058
  try {
14017
- const hash = createHash2("md5").update(key).digest("hex");
14059
+ const hash = createHash3("md5").update(key).digest("hex");
14018
14060
  const keyWithSafeCharacters = key.replace(/[^a-zA-Z0-9]/g, "_");
14019
- const filePath = path8.join(cacheDir, `${keyWithSafeCharacters.slice(keyWithSafeCharacters.length - 10, keyWithSafeCharacters.length)}-${hash}.json`);
14020
- return fs8.readFileSync(filePath, "utf-8");
14061
+ const filePath = path9.join(cacheDir, `${keyWithSafeCharacters.slice(keyWithSafeCharacters.length - 10, keyWithSafeCharacters.length)}-${hash}.json`);
14062
+ return fs9.readFileSync(filePath, "utf-8");
14021
14063
  } catch {
14022
14064
  return null;
14023
14065
  }
14024
14066
  },
14025
14067
  setItem: (key, value) => {
14026
14068
  try {
14027
- fs8.mkdirSync(cacheDir, { recursive: true });
14028
- const hash = createHash2("md5").update(key).digest("hex");
14069
+ fs9.mkdirSync(cacheDir, { recursive: true });
14070
+ const hash = createHash3("md5").update(key).digest("hex");
14029
14071
  const keyWithSafeCharacters = key.replace(/[^a-zA-Z0-9]/g, "_");
14030
- const filePath = path8.join(cacheDir, `${keyWithSafeCharacters.slice(keyWithSafeCharacters.length - 10, keyWithSafeCharacters.length)}-${hash}.json`);
14031
- fs8.writeFileSync(filePath, value);
14072
+ const filePath = path9.join(cacheDir, `${keyWithSafeCharacters.slice(keyWithSafeCharacters.length - 10, keyWithSafeCharacters.length)}-${hash}.json`);
14073
+ fs9.writeFileSync(filePath, value);
14032
14074
  } catch {}
14033
14075
  }
14034
14076
  };
@@ -14036,7 +14078,7 @@ function createLocalCacheEngine(cacheDir = path8.join(process.cwd(), ".tscircuit
14036
14078
  function getPlatformConfigWithCliDefaults(userConfig, options) {
14037
14079
  const projectDir = options?.projectDir ?? process.cwd();
14038
14080
  const basePlatformConfig = getPlatformConfig();
14039
- const cacheDir = path8.join(projectDir, ".tscircuit", "cache");
14081
+ const cacheDir = path9.join(projectDir, ".tscircuit", "cache");
14040
14082
  const defaultConfig = {
14041
14083
  ...basePlatformConfig,
14042
14084
  localCacheEngine: createLocalCacheEngine(cacheDir),
@@ -14046,15 +14088,15 @@ function getPlatformConfigWithCliDefaults(userConfig, options) {
14046
14088
  loadFromUrl: async (url) => {
14047
14089
  let fetchUrl = url;
14048
14090
  if (url.startsWith("./") || url.startsWith("../")) {
14049
- const absolutePath = path8.resolve(projectDir, url);
14091
+ const absolutePath = path9.resolve(projectDir, url);
14050
14092
  fetchUrl = `file://${absolutePath}`;
14051
14093
  } else if (url.startsWith("/")) {
14052
- if (fs8.existsSync(url)) {
14094
+ if (fs9.existsSync(url)) {
14053
14095
  fetchUrl = `file://${url}`;
14054
14096
  } else {
14055
14097
  const relativePath = `.${url}`;
14056
- const absolutePath = path8.resolve(projectDir, relativePath);
14057
- if (fs8.existsSync(absolutePath)) {
14098
+ const absolutePath = path9.resolve(projectDir, relativePath);
14099
+ if (fs9.existsSync(absolutePath)) {
14058
14100
  fetchUrl = `file://${absolutePath}`;
14059
14101
  } else {
14060
14102
  fetchUrl = `file://${url}`;
@@ -23882,8 +23924,8 @@ function convertCircuitJsonToPcbSvg3(elements, options = {}) {
23882
23924
  }
23883
23925
 
23884
23926
  // cli/build/worker-output-generators.ts
23885
- import fs13 from "node:fs";
23886
- import path17 from "node:path";
23927
+ import fs14 from "node:fs";
23928
+ import path18 from "node:path";
23887
23929
 
23888
23930
  // node_modules/circuit-json-to-3d-png/dist/index.js
23889
23931
  function normalizeDir(dir) {
@@ -26363,7 +26405,7 @@ import { convertCircuitJsonToSchematicSvg } from "circuit-to-svg";
26363
26405
  // lib/shared/load-local-step-model-fs-map.ts
26364
26406
  import { existsSync as existsSync2 } from "node:fs";
26365
26407
  import { readFile } from "node:fs/promises";
26366
- import path9 from "node:path";
26408
+ import path10 from "node:path";
26367
26409
  var isRemoteUrl = (value) => /^https?:\/\//i.test(value);
26368
26410
  async function loadLocalStepModelFsMap(circuitJson) {
26369
26411
  const fsMap = {};
@@ -26375,7 +26417,7 @@ async function loadLocalStepModelFsMap(circuitJson) {
26375
26417
  continue;
26376
26418
  if (isRemoteUrl(modelUrl) || fsMap[modelUrl])
26377
26419
  continue;
26378
- const localPath = path9.resolve(process.cwd(), modelUrl);
26420
+ const localPath = path10.resolve(process.cwd(), modelUrl);
26379
26421
  if (!existsSync2(localPath))
26380
26422
  continue;
26381
26423
  fsMap[modelUrl] = await readFile(localPath, "utf-8");
@@ -26451,8 +26493,8 @@ var getSimulationSvgAssetsFromCircuitJson = (circuitJson) => {
26451
26493
  // node_modules/conf/dist/source/index.js
26452
26494
  import { isDeepStrictEqual } from "node:util";
26453
26495
  import process7 from "node:process";
26454
- import fs10 from "node:fs";
26455
- import path13 from "node:path";
26496
+ import fs11 from "node:fs";
26497
+ import path14 from "node:path";
26456
26498
  import crypto from "node:crypto";
26457
26499
  import assert from "node:assert";
26458
26500
 
@@ -26672,41 +26714,41 @@ function hasProperty(object, path) {
26672
26714
  }
26673
26715
 
26674
26716
  // node_modules/env-paths/index.js
26675
- import path10 from "node:path";
26717
+ import path11 from "node:path";
26676
26718
  import os from "node:os";
26677
26719
  import process2 from "node:process";
26678
26720
  var homedir = os.homedir();
26679
26721
  var tmpdir = os.tmpdir();
26680
26722
  var { env } = process2;
26681
26723
  var macos = (name) => {
26682
- const library = path10.join(homedir, "Library");
26724
+ const library = path11.join(homedir, "Library");
26683
26725
  return {
26684
- data: path10.join(library, "Application Support", name),
26685
- config: path10.join(library, "Preferences", name),
26686
- cache: path10.join(library, "Caches", name),
26687
- log: path10.join(library, "Logs", name),
26688
- temp: path10.join(tmpdir, name)
26726
+ data: path11.join(library, "Application Support", name),
26727
+ config: path11.join(library, "Preferences", name),
26728
+ cache: path11.join(library, "Caches", name),
26729
+ log: path11.join(library, "Logs", name),
26730
+ temp: path11.join(tmpdir, name)
26689
26731
  };
26690
26732
  };
26691
26733
  var windows = (name) => {
26692
- const appData = env.APPDATA || path10.join(homedir, "AppData", "Roaming");
26693
- const localAppData = env.LOCALAPPDATA || path10.join(homedir, "AppData", "Local");
26734
+ const appData = env.APPDATA || path11.join(homedir, "AppData", "Roaming");
26735
+ const localAppData = env.LOCALAPPDATA || path11.join(homedir, "AppData", "Local");
26694
26736
  return {
26695
- data: path10.join(localAppData, name, "Data"),
26696
- config: path10.join(appData, name, "Config"),
26697
- cache: path10.join(localAppData, name, "Cache"),
26698
- log: path10.join(localAppData, name, "Log"),
26699
- temp: path10.join(tmpdir, name)
26737
+ data: path11.join(localAppData, name, "Data"),
26738
+ config: path11.join(appData, name, "Config"),
26739
+ cache: path11.join(localAppData, name, "Cache"),
26740
+ log: path11.join(localAppData, name, "Log"),
26741
+ temp: path11.join(tmpdir, name)
26700
26742
  };
26701
26743
  };
26702
26744
  var linux = (name) => {
26703
- const username = path10.basename(homedir);
26745
+ const username = path11.basename(homedir);
26704
26746
  return {
26705
- data: path10.join(env.XDG_DATA_HOME || path10.join(homedir, ".local", "share"), name),
26706
- config: path10.join(env.XDG_CONFIG_HOME || path10.join(homedir, ".config"), name),
26707
- cache: path10.join(env.XDG_CACHE_HOME || path10.join(homedir, ".cache"), name),
26708
- log: path10.join(env.XDG_STATE_HOME || path10.join(homedir, ".local", "state"), name),
26709
- temp: path10.join(tmpdir, username, name)
26747
+ data: path11.join(env.XDG_DATA_HOME || path11.join(homedir, ".local", "share"), name),
26748
+ config: path11.join(env.XDG_CONFIG_HOME || path11.join(homedir, ".config"), name),
26749
+ cache: path11.join(env.XDG_CACHE_HOME || path11.join(homedir, ".cache"), name),
26750
+ log: path11.join(env.XDG_STATE_HOME || path11.join(homedir, ".local", "state"), name),
26751
+ temp: path11.join(tmpdir, username, name)
26710
26752
  };
26711
26753
  };
26712
26754
  function envPaths(name, { suffix = "nodejs" } = {}) {
@@ -26726,10 +26768,10 @@ function envPaths(name, { suffix = "nodejs" } = {}) {
26726
26768
  }
26727
26769
 
26728
26770
  // node_modules/atomically/dist/index.js
26729
- import path12 from "node:path";
26771
+ import path13 from "node:path";
26730
26772
 
26731
26773
  // node_modules/stubborn-fs/dist/index.js
26732
- import fs9 from "node:fs";
26774
+ import fs10 from "node:fs";
26733
26775
  import { promisify } from "node:util";
26734
26776
 
26735
26777
  // node_modules/stubborn-utils/dist/attemptify_async.js
@@ -26859,41 +26901,41 @@ var RETRYIFY_OPTIONS = {
26859
26901
  // node_modules/stubborn-fs/dist/index.js
26860
26902
  var FS = {
26861
26903
  attempt: {
26862
- chmod: attemptify_async_default(promisify(fs9.chmod), ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
26863
- chown: attemptify_async_default(promisify(fs9.chown), ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
26864
- close: attemptify_async_default(promisify(fs9.close), ATTEMPTIFY_NOOP_OPTIONS),
26865
- fsync: attemptify_async_default(promisify(fs9.fsync), ATTEMPTIFY_NOOP_OPTIONS),
26866
- mkdir: attemptify_async_default(promisify(fs9.mkdir), ATTEMPTIFY_NOOP_OPTIONS),
26867
- realpath: attemptify_async_default(promisify(fs9.realpath), ATTEMPTIFY_NOOP_OPTIONS),
26868
- stat: attemptify_async_default(promisify(fs9.stat), ATTEMPTIFY_NOOP_OPTIONS),
26869
- unlink: attemptify_async_default(promisify(fs9.unlink), ATTEMPTIFY_NOOP_OPTIONS),
26870
- chmodSync: attemptify_sync_default(fs9.chmodSync, ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
26871
- chownSync: attemptify_sync_default(fs9.chownSync, ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
26872
- closeSync: attemptify_sync_default(fs9.closeSync, ATTEMPTIFY_NOOP_OPTIONS),
26873
- existsSync: attemptify_sync_default(fs9.existsSync, ATTEMPTIFY_NOOP_OPTIONS),
26874
- fsyncSync: attemptify_sync_default(fs9.fsync, ATTEMPTIFY_NOOP_OPTIONS),
26875
- mkdirSync: attemptify_sync_default(fs9.mkdirSync, ATTEMPTIFY_NOOP_OPTIONS),
26876
- realpathSync: attemptify_sync_default(fs9.realpathSync, ATTEMPTIFY_NOOP_OPTIONS),
26877
- statSync: attemptify_sync_default(fs9.statSync, ATTEMPTIFY_NOOP_OPTIONS),
26878
- unlinkSync: attemptify_sync_default(fs9.unlinkSync, ATTEMPTIFY_NOOP_OPTIONS)
26904
+ chmod: attemptify_async_default(promisify(fs10.chmod), ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
26905
+ chown: attemptify_async_default(promisify(fs10.chown), ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
26906
+ close: attemptify_async_default(promisify(fs10.close), ATTEMPTIFY_NOOP_OPTIONS),
26907
+ fsync: attemptify_async_default(promisify(fs10.fsync), ATTEMPTIFY_NOOP_OPTIONS),
26908
+ mkdir: attemptify_async_default(promisify(fs10.mkdir), ATTEMPTIFY_NOOP_OPTIONS),
26909
+ realpath: attemptify_async_default(promisify(fs10.realpath), ATTEMPTIFY_NOOP_OPTIONS),
26910
+ stat: attemptify_async_default(promisify(fs10.stat), ATTEMPTIFY_NOOP_OPTIONS),
26911
+ unlink: attemptify_async_default(promisify(fs10.unlink), ATTEMPTIFY_NOOP_OPTIONS),
26912
+ chmodSync: attemptify_sync_default(fs10.chmodSync, ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
26913
+ chownSync: attemptify_sync_default(fs10.chownSync, ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
26914
+ closeSync: attemptify_sync_default(fs10.closeSync, ATTEMPTIFY_NOOP_OPTIONS),
26915
+ existsSync: attemptify_sync_default(fs10.existsSync, ATTEMPTIFY_NOOP_OPTIONS),
26916
+ fsyncSync: attemptify_sync_default(fs10.fsync, ATTEMPTIFY_NOOP_OPTIONS),
26917
+ mkdirSync: attemptify_sync_default(fs10.mkdirSync, ATTEMPTIFY_NOOP_OPTIONS),
26918
+ realpathSync: attemptify_sync_default(fs10.realpathSync, ATTEMPTIFY_NOOP_OPTIONS),
26919
+ statSync: attemptify_sync_default(fs10.statSync, ATTEMPTIFY_NOOP_OPTIONS),
26920
+ unlinkSync: attemptify_sync_default(fs10.unlinkSync, ATTEMPTIFY_NOOP_OPTIONS)
26879
26921
  },
26880
26922
  retry: {
26881
- close: retryify_async_default(promisify(fs9.close), RETRYIFY_OPTIONS),
26882
- fsync: retryify_async_default(promisify(fs9.fsync), RETRYIFY_OPTIONS),
26883
- open: retryify_async_default(promisify(fs9.open), RETRYIFY_OPTIONS),
26884
- readFile: retryify_async_default(promisify(fs9.readFile), RETRYIFY_OPTIONS),
26885
- rename: retryify_async_default(promisify(fs9.rename), RETRYIFY_OPTIONS),
26886
- stat: retryify_async_default(promisify(fs9.stat), RETRYIFY_OPTIONS),
26887
- write: retryify_async_default(promisify(fs9.write), RETRYIFY_OPTIONS),
26888
- writeFile: retryify_async_default(promisify(fs9.writeFile), RETRYIFY_OPTIONS),
26889
- closeSync: retryify_sync_default(fs9.closeSync, RETRYIFY_OPTIONS),
26890
- fsyncSync: retryify_sync_default(fs9.fsyncSync, RETRYIFY_OPTIONS),
26891
- openSync: retryify_sync_default(fs9.openSync, RETRYIFY_OPTIONS),
26892
- readFileSync: retryify_sync_default(fs9.readFileSync, RETRYIFY_OPTIONS),
26893
- renameSync: retryify_sync_default(fs9.renameSync, RETRYIFY_OPTIONS),
26894
- statSync: retryify_sync_default(fs9.statSync, RETRYIFY_OPTIONS),
26895
- writeSync: retryify_sync_default(fs9.writeSync, RETRYIFY_OPTIONS),
26896
- writeFileSync: retryify_sync_default(fs9.writeFileSync, RETRYIFY_OPTIONS)
26923
+ close: retryify_async_default(promisify(fs10.close), RETRYIFY_OPTIONS),
26924
+ fsync: retryify_async_default(promisify(fs10.fsync), RETRYIFY_OPTIONS),
26925
+ open: retryify_async_default(promisify(fs10.open), RETRYIFY_OPTIONS),
26926
+ readFile: retryify_async_default(promisify(fs10.readFile), RETRYIFY_OPTIONS),
26927
+ rename: retryify_async_default(promisify(fs10.rename), RETRYIFY_OPTIONS),
26928
+ stat: retryify_async_default(promisify(fs10.stat), RETRYIFY_OPTIONS),
26929
+ write: retryify_async_default(promisify(fs10.write), RETRYIFY_OPTIONS),
26930
+ writeFile: retryify_async_default(promisify(fs10.writeFile), RETRYIFY_OPTIONS),
26931
+ closeSync: retryify_sync_default(fs10.closeSync, RETRYIFY_OPTIONS),
26932
+ fsyncSync: retryify_sync_default(fs10.fsyncSync, RETRYIFY_OPTIONS),
26933
+ openSync: retryify_sync_default(fs10.openSync, RETRYIFY_OPTIONS),
26934
+ readFileSync: retryify_sync_default(fs10.readFileSync, RETRYIFY_OPTIONS),
26935
+ renameSync: retryify_sync_default(fs10.renameSync, RETRYIFY_OPTIONS),
26936
+ statSync: retryify_sync_default(fs10.statSync, RETRYIFY_OPTIONS),
26937
+ writeSync: retryify_sync_default(fs10.writeSync, RETRYIFY_OPTIONS),
26938
+ writeFileSync: retryify_sync_default(fs10.writeFileSync, RETRYIFY_OPTIONS)
26897
26939
  }
26898
26940
  };
26899
26941
  var dist_default = FS;
@@ -26923,7 +26965,7 @@ var isUndefined = (value) => {
26923
26965
  };
26924
26966
 
26925
26967
  // node_modules/atomically/dist/utils/temp.js
26926
- import path11 from "node:path";
26968
+ import path12 from "node:path";
26927
26969
 
26928
26970
  // node_modules/when-exit/dist/node/interceptor.js
26929
26971
  import process6 from "node:process";
@@ -27023,7 +27065,7 @@ var Temp = {
27023
27065
  }
27024
27066
  },
27025
27067
  truncate: (filePath) => {
27026
- const basename = path11.basename(filePath);
27068
+ const basename = path12.basename(filePath);
27027
27069
  if (basename.length <= LIMIT_BASENAME_LENGTH)
27028
27070
  return filePath;
27029
27071
  const truncable = /^(\.?)(.*?)((?:\.[^.]+)?(?:\.tmp-\d{10}[a-f0-9]{6})?)$/.exec(basename);
@@ -27065,7 +27107,7 @@ function writeFileSync2(filePath, data, options = DEFAULT_WRITE_OPTIONS) {
27065
27107
  }
27066
27108
  }
27067
27109
  if (!filePathExists) {
27068
- const parentPath = path12.dirname(filePath);
27110
+ const parentPath = path13.dirname(filePath);
27069
27111
  dist_default.attempt.mkdirSync(parentPath, {
27070
27112
  mode: DEFAULT_FOLDER_MODE,
27071
27113
  recursive: true
@@ -27381,7 +27423,7 @@ class Conf {
27381
27423
  this.events = new EventTarget;
27382
27424
  this.#encryptionKey = options.encryptionKey;
27383
27425
  const fileExtension = options.fileExtension ? `.${options.fileExtension}` : "";
27384
- this.path = path13.resolve(options.cwd, `${options.configName ?? "config"}${fileExtension}`);
27426
+ this.path = path14.resolve(options.cwd, `${options.configName ?? "config"}${fileExtension}`);
27385
27427
  const fileStore = this.store;
27386
27428
  const store = Object.assign(createPlainObject(), options.defaults, fileStore);
27387
27429
  if (options.migrations) {
@@ -27484,7 +27526,7 @@ class Conf {
27484
27526
  }
27485
27527
  get store() {
27486
27528
  try {
27487
- const data = fs10.readFileSync(this.path, this.#encryptionKey ? null : "utf8");
27529
+ const data = fs11.readFileSync(this.path, this.#encryptionKey ? null : "utf8");
27488
27530
  const dataString = this._encryptData(data);
27489
27531
  const deserializedData = this._deserialize(dataString);
27490
27532
  this._validate(deserializedData);
@@ -27555,7 +27597,7 @@ class Conf {
27555
27597
  throw new Error("Config schema violation: " + errors.join("; "));
27556
27598
  }
27557
27599
  _ensureDirectory() {
27558
- fs10.mkdirSync(path13.dirname(this.path), { recursive: true });
27600
+ fs11.mkdirSync(path14.dirname(this.path), { recursive: true });
27559
27601
  }
27560
27602
  _write(value) {
27561
27603
  let data = this._serialize(value);
@@ -27566,13 +27608,13 @@ class Conf {
27566
27608
  data = concatUint8Arrays([initializationVector, stringToUint8Array(":"), cipher.update(stringToUint8Array(data)), cipher.final()]);
27567
27609
  }
27568
27610
  if (process7.env.SNAP) {
27569
- fs10.writeFileSync(this.path, data, { mode: this.#options.configFileMode });
27611
+ fs11.writeFileSync(this.path, data, { mode: this.#options.configFileMode });
27570
27612
  } else {
27571
27613
  try {
27572
27614
  writeFileSync2(this.path, data, { mode: this.#options.configFileMode });
27573
27615
  } catch (error) {
27574
27616
  if (error?.code === "EXDEV") {
27575
- fs10.writeFileSync(this.path, data, { mode: this.#options.configFileMode });
27617
+ fs11.writeFileSync(this.path, data, { mode: this.#options.configFileMode });
27576
27618
  return;
27577
27619
  }
27578
27620
  throw error;
@@ -27581,15 +27623,15 @@ class Conf {
27581
27623
  }
27582
27624
  _watch() {
27583
27625
  this._ensureDirectory();
27584
- if (!fs10.existsSync(this.path)) {
27626
+ if (!fs11.existsSync(this.path)) {
27585
27627
  this._write(createPlainObject());
27586
27628
  }
27587
27629
  if (process7.platform === "win32") {
27588
- fs10.watch(this.path, { persistent: false }, debounce_fn_default(() => {
27630
+ fs11.watch(this.path, { persistent: false }, debounce_fn_default(() => {
27589
27631
  this.events.dispatchEvent(new Event("change"));
27590
27632
  }, { wait: 100 }));
27591
27633
  } else {
27592
- fs10.watchFile(this.path, { persistent: false }, debounce_fn_default(() => {
27634
+ fs11.watchFile(this.path, { persistent: false }, debounce_fn_default(() => {
27593
27635
  this.events.dispatchEvent(new Event("change"));
27594
27636
  }, { wait: 5000 }));
27595
27637
  }
@@ -27725,14 +27767,14 @@ function jwtDecode(token, options) {
27725
27767
  }
27726
27768
 
27727
27769
  // lib/cli-config/index.ts
27728
- import fs12 from "node:fs";
27770
+ import fs13 from "node:fs";
27729
27771
  import os3 from "node:os";
27730
- import path15 from "node:path";
27772
+ import path16 from "node:path";
27731
27773
 
27732
27774
  // lib/shared/handle-registry-auth-error.ts
27733
- import fs11 from "node:fs";
27775
+ import fs12 from "node:fs";
27734
27776
  import os2 from "node:os";
27735
- import path14 from "node:path";
27777
+ import path15 from "node:path";
27736
27778
  var AUTH_TOKEN_REGEX = /^\/\/npm\.tscircuit\.com\/:_authToken=(.+)$/m;
27737
27779
  function isUnauthorizedError(error) {
27738
27780
  const output = [
@@ -27753,9 +27795,9 @@ function isUnauthorizedError(error) {
27753
27795
  return /\b(401|E401)\b/i.test(output) || /unauthorized/i.test(output);
27754
27796
  }
27755
27797
  function hasTsciAuthToken(npmrcPath) {
27756
- if (!fs11.existsSync(npmrcPath))
27798
+ if (!fs12.existsSync(npmrcPath))
27757
27799
  return false;
27758
- const content = fs11.readFileSync(npmrcPath, "utf-8");
27800
+ const content = fs12.readFileSync(npmrcPath, "utf-8");
27759
27801
  return AUTH_TOKEN_REGEX.test(content);
27760
27802
  }
27761
27803
  function handleRegistryAuthError({
@@ -27765,8 +27807,8 @@ function handleRegistryAuthError({
27765
27807
  if (!isUnauthorizedError(error))
27766
27808
  return;
27767
27809
  const npmrcPaths = [
27768
- path14.join(projectDir, ".npmrc"),
27769
- path14.join(os2.homedir(), ".npmrc")
27810
+ path15.join(projectDir, ".npmrc"),
27811
+ path15.join(os2.homedir(), ".npmrc")
27770
27812
  ];
27771
27813
  const hasToken = npmrcPaths.some(hasTsciAuthToken);
27772
27814
  if (hasToken) {
@@ -27789,13 +27831,13 @@ var getSessionToken = () => {
27789
27831
  };
27790
27832
  var getSessionTokenFromNpmrc = () => {
27791
27833
  const npmrcPaths = [
27792
- path15.join(process.cwd(), ".npmrc"),
27793
- path15.join(os3.homedir(), ".npmrc")
27834
+ path16.join(process.cwd(), ".npmrc"),
27835
+ path16.join(os3.homedir(), ".npmrc")
27794
27836
  ];
27795
27837
  for (const npmrcPath of npmrcPaths) {
27796
- if (!fs12.existsSync(npmrcPath))
27838
+ if (!fs13.existsSync(npmrcPath))
27797
27839
  continue;
27798
- const content = fs12.readFileSync(npmrcPath, "utf-8");
27840
+ const content = fs13.readFileSync(npmrcPath, "utf-8");
27799
27841
  const match = content.match(AUTH_TOKEN_REGEX);
27800
27842
  if (match?.[1]) {
27801
27843
  return match[1].trim();
@@ -27833,7 +27875,7 @@ var getCircuitJsonToGltfOptions = ({
27833
27875
  };
27834
27876
 
27835
27877
  // cli/build/convert-model-urls-to-file-urls.ts
27836
- import path16 from "node:path";
27878
+ import path17 from "node:path";
27837
27879
  import { pathToFileURL as pathToFileURL3 } from "node:url";
27838
27880
  var convertModelUrlsToFileUrls = (circuitJson) => {
27839
27881
  const modelUrlKeys = [
@@ -27860,7 +27902,7 @@ var convertModelUrlsToFileUrls = (circuitJson) => {
27860
27902
  if (value.startsWith("/") || value.match(/^[a-zA-Z]:\\/)) {
27861
27903
  updated[key] = pathToFileURL3(value).href;
27862
27904
  } else if (value.startsWith(".")) {
27863
- updated[key] = pathToFileURL3(path16.resolve(process.cwd(), value)).href;
27905
+ updated[key] = pathToFileURL3(path17.resolve(process.cwd(), value)).href;
27864
27906
  }
27865
27907
  }
27866
27908
  }
@@ -27901,12 +27943,12 @@ var writeSimulationSvgAssetsFromCircuitJson = (circuitJson, outputDir, imageForm
27901
27943
  for (const simulationSvgAsset of simulationSvgAssets) {
27902
27944
  if (imageFormats.simulationSvgs) {
27903
27945
  const fileName = hasMultipleSimulations ? `simulation-${simulationSvgAsset.fileNameSuffix}.svg` : "simulation.svg";
27904
- fs13.writeFileSync(path17.join(outputDir, fileName), simulationSvgAsset.simulationSvg, "utf-8");
27946
+ fs14.writeFileSync(path18.join(outputDir, fileName), simulationSvgAsset.simulationSvg, "utf-8");
27905
27947
  simulationFileNames.push(fileName);
27906
27948
  }
27907
27949
  if (imageFormats.simulationSchematicSvgs) {
27908
27950
  const fileName = hasMultipleSimulations ? `simulation-schematic-${simulationSvgAsset.fileNameSuffix}.svg` : "simulation-schematic.svg";
27909
- fs13.writeFileSync(path17.join(outputDir, fileName), simulationSvgAsset.schematicSimulationSvg, "utf-8");
27951
+ fs14.writeFileSync(path18.join(outputDir, fileName), simulationSvgAsset.schematicSimulationSvg, "utf-8");
27910
27952
  schematicSimulationFileNames.push(fileName);
27911
27953
  }
27912
27954
  }
@@ -27916,8 +27958,8 @@ var writeGlbFromCircuitJson = async (circuitJson, glbOutputPath) => {
27916
27958
  const circuitJsonWithFileUrls = convertModelUrlsToFileUrls(circuitJson);
27917
27959
  const glbBuffer = await convertCircuitJsonToGltf(circuitJsonWithFileUrls, getCircuitJsonToGltfOptions({ format: "glb" }));
27918
27960
  const glbData = normalizeToUint8Array2(glbBuffer);
27919
- fs13.mkdirSync(path17.dirname(glbOutputPath), { recursive: true });
27920
- fs13.writeFileSync(glbOutputPath, Buffer.from(glbData));
27961
+ fs14.mkdirSync(path18.dirname(glbOutputPath), { recursive: true });
27962
+ fs14.writeFileSync(glbOutputPath, Buffer.from(glbData));
27921
27963
  };
27922
27964
  var writeStepFromCircuitJson = async (circuitJson, stepOutputPath) => {
27923
27965
  const stepContent = await circuitJsonToStep(circuitJson, {
@@ -27925,38 +27967,38 @@ var writeStepFromCircuitJson = async (circuitJson, stepOutputPath) => {
27925
27967
  includeExternalMeshes: true,
27926
27968
  fsMap: await loadLocalStepModelFsMap(circuitJson)
27927
27969
  });
27928
- fs13.mkdirSync(path17.dirname(stepOutputPath), { recursive: true });
27929
- fs13.writeFileSync(stepOutputPath, stepContent);
27970
+ fs14.mkdirSync(path18.dirname(stepOutputPath), { recursive: true });
27971
+ fs14.writeFileSync(stepOutputPath, stepContent);
27930
27972
  };
27931
27973
  var writeImageAssetsFromCircuitJson = async (circuitJson, options) => {
27932
27974
  const { outputDir, imageFormats, pcbSnapshotSettings } = options;
27933
- fs13.mkdirSync(outputDir, { recursive: true });
27975
+ fs14.mkdirSync(outputDir, { recursive: true });
27934
27976
  if (imageFormats.pcbSvgs) {
27935
27977
  const pcbSvg = convertCircuitJsonToPcbSvg3(circuitJson, pcbSnapshotSettings);
27936
- fs13.writeFileSync(path17.join(outputDir, "pcb.svg"), pcbSvg, "utf-8");
27978
+ fs14.writeFileSync(path18.join(outputDir, "pcb.svg"), pcbSvg, "utf-8");
27937
27979
  }
27938
27980
  if (imageFormats.pcbPngs) {
27939
27981
  const pcbSvg = convertCircuitJsonToPcbSvg3(circuitJson, pcbSnapshotSettings);
27940
- fs13.writeFileSync(path17.join(outputDir, "pcb.png"), await convertSvgToPngBuffer(pcbSvg));
27982
+ fs14.writeFileSync(path18.join(outputDir, "pcb.png"), await convertSvgToPngBuffer(pcbSvg));
27941
27983
  }
27942
27984
  if (imageFormats.schematicSvgs) {
27943
27985
  const schematicSvg = convertCircuitJsonToSchematicSvg(circuitJson);
27944
- fs13.writeFileSync(path17.join(outputDir, "schematic.svg"), schematicSvg, "utf-8");
27986
+ fs14.writeFileSync(path18.join(outputDir, "schematic.svg"), schematicSvg, "utf-8");
27945
27987
  }
27946
27988
  if (imageFormats.schematicPngs) {
27947
27989
  const schematicSvg = convertCircuitJsonToSchematicSvg(circuitJson);
27948
- fs13.writeFileSync(path17.join(outputDir, "schematic.png"), await convertSvgToPngBuffer(schematicSvg));
27990
+ fs14.writeFileSync(path18.join(outputDir, "schematic.png"), await convertSvgToPngBuffer(schematicSvg));
27949
27991
  }
27950
27992
  writeSimulationSvgAssetsFromCircuitJson(circuitJson, outputDir, imageFormats);
27951
27993
  if (imageFormats.threeDPngs) {
27952
27994
  const pngBuffer = await renderCircuitJsonTo3dPng(circuitJson);
27953
- fs13.writeFileSync(path17.join(outputDir, "3d.png"), Buffer.from(pngBuffer));
27995
+ fs14.writeFileSync(path18.join(outputDir, "3d.png"), Buffer.from(pngBuffer));
27954
27996
  }
27955
27997
  };
27956
27998
 
27957
27999
  // cli/build/worker-build-handlers.ts
27958
28000
  var loadCircuitJsonFromInputFile = (filePath) => {
27959
- const parsed = JSON.parse(fs14.readFileSync(filePath, "utf-8"));
28001
+ const parsed = JSON.parse(fs15.readFileSync(filePath, "utf-8"));
27960
28002
  return Array.isArray(parsed) ? parsed : [];
27961
28003
  };
27962
28004
  var handleBuildFile = async (filePath, outputPath, glbOutputPath, stepOutputPath, previewOutputDir, projectDir, options, workerLog, workerStatus) => {
@@ -27964,7 +28006,7 @@ var handleBuildFile = async (filePath, outputPath, glbOutputPath, stepOutputPath
27964
28006
  const warnings = [];
27965
28007
  const startedAt = options?.profile ? performance.now() : 0;
27966
28008
  try {
27967
- workerLog(`Generating circuit JSON for ${path18.relative(projectDir, filePath)}...`);
28009
+ workerLog(`Generating circuit JSON for ${path19.relative(projectDir, filePath)}...`);
27968
28010
  await registerStaticAssetLoaders(undefined, projectDir);
27969
28011
  const projectConfig = await loadRuntimeProjectConfig(projectDir);
27970
28012
  const platformConfig = mergePlatformConfigs(projectConfig?.platformConfig, options?.platformConfig);
@@ -27988,9 +28030,9 @@ var handleBuildFile = async (filePath, outputPath, glbOutputPath, stepOutputPath
27988
28030
  workerStatus(`waiting on ${asyncEffectName}…`);
27989
28031
  }
27990
28032
  })).circuitJson;
27991
- fs14.mkdirSync(path18.dirname(outputPath), { recursive: true });
27992
- fs14.writeFileSync(outputPath, JSON.stringify(circuitJson, null, 2));
27993
- workerLog(`Circuit JSON written to ${path18.relative(projectDir, outputPath)}`);
28033
+ fs15.mkdirSync(path19.dirname(outputPath), { recursive: true });
28034
+ fs15.writeFileSync(outputPath, JSON.stringify(circuitJson, null, 2));
28035
+ workerLog(`Circuit JSON written to ${path19.relative(projectDir, outputPath)}`);
27994
28036
  const diagnostics = analyzeCircuitJson(circuitJson);
27995
28037
  const filteredDiagnostics = filterDiagnosticsByDrcCategory({
27996
28038
  errors: diagnostics.errors,
@@ -28020,7 +28062,7 @@ var handleBuildFile = async (filePath, outputPath, glbOutputPath, stepOutputPath
28020
28062
  let previewError;
28021
28063
  if (glbOutputPath) {
28022
28064
  try {
28023
- workerLog(`Converting ${path18.relative(projectDir, outputPath)} to GLB in same worker...`);
28065
+ workerLog(`Converting ${path19.relative(projectDir, outputPath)} to GLB in same worker...`);
28024
28066
  await writeGlbFromCircuitJson(circuitJson, glbOutputPath);
28025
28067
  glbOk = true;
28026
28068
  } catch (err) {
@@ -28031,7 +28073,7 @@ var handleBuildFile = async (filePath, outputPath, glbOutputPath, stepOutputPath
28031
28073
  }
28032
28074
  if (stepOutputPath) {
28033
28075
  try {
28034
- workerLog(`Converting ${path18.relative(projectDir, outputPath)} to STEP in same worker...`);
28076
+ workerLog(`Converting ${path19.relative(projectDir, outputPath)} to STEP in same worker...`);
28035
28077
  await writeStepFromCircuitJson(circuitJson, stepOutputPath);
28036
28078
  stepOk = true;
28037
28079
  } catch (err) {
@@ -28042,8 +28084,8 @@ var handleBuildFile = async (filePath, outputPath, glbOutputPath, stepOutputPath
28042
28084
  }
28043
28085
  if (options?.generatePreviewAssets) {
28044
28086
  try {
28045
- const resolvedPreviewOutputDir = previewOutputDir ?? path18.dirname(outputPath);
28046
- workerLog(`Generating preview assets for ${path18.relative(projectDir, resolvedPreviewOutputDir)} in same worker...`);
28087
+ const resolvedPreviewOutputDir = previewOutputDir ?? path19.dirname(outputPath);
28088
+ workerLog(`Generating preview assets for ${path19.relative(projectDir, resolvedPreviewOutputDir)} in same worker...`);
28047
28089
  await writeImageAssetsFromCircuitJson(circuitJson, {
28048
28090
  outputDir: resolvedPreviewOutputDir,
28049
28091
  imageFormats: options?.imageFormats ?? DEFAULT_IMAGE_FORMAT_SELECTION,