@tscircuit/cli 0.1.1649 → 0.1.1650

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(path11) {
5612
- let input = path11;
5611
+ function removeDotSegments(path12) {
5612
+ let input = path12;
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 [path11, query] = wsComponent.resourceName.split("?");
5856
- wsComponent.path = path11 && path11 !== "/" ? path11 : undefined;
5855
+ const [path12, query] = wsComponent.resourceName.split("?");
5856
+ wsComponent.path = path12 && path12 !== "/" ? path12 : 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, fs8, exportName) {
9794
+ function addFormats(ajv, list, fs9, 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, fs8[f]);
9799
+ ajv.addFormat(f, fs9[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 fs12 from "node:fs";
11655
- import path16 from "node:path";
11654
+ import fs13 from "node:fs";
11655
+ import path17 from "node:path";
11656
11656
 
11657
11657
  // lib/project-config/index.ts
11658
11658
  import * as fs from "node:fs";
@@ -11858,8 +11858,8 @@ function analyzeCircuitJson(circuitJson) {
11858
11858
  }
11859
11859
 
11860
11860
  // lib/shared/generate-circuit-json.tsx
11861
- import fs5 from "node:fs";
11862
- import path5 from "node:path";
11861
+ import fs6 from "node:fs";
11862
+ import path6 from "node:path";
11863
11863
  import { pathToFileURL as pathToFileURL2 } from "node:url";
11864
11864
  import Debug from "debug";
11865
11865
 
@@ -12626,6 +12626,137 @@ var registerStaticAssetLoaders = (platformConfig) => {
12626
12626
  }
12627
12627
  };
12628
12628
 
12629
+ // lib/shared/circuit-json-build-cache.ts
12630
+ import fs5 from "node:fs";
12631
+ import path5 from "node:path";
12632
+ import { createHash } from "node:crypto";
12633
+ var SOURCE_FILE_EXTENSIONS = new Set([
12634
+ ".tsx",
12635
+ ".ts",
12636
+ ".jsx",
12637
+ ".js",
12638
+ ".json",
12639
+ ".txt",
12640
+ ".md",
12641
+ ".obj",
12642
+ ".kicad_mod",
12643
+ ".kicad_pcb",
12644
+ ".kicad_pro",
12645
+ ".kicad_sch"
12646
+ ]);
12647
+ var IGNORED_DIRECTORY_NAMES = new Set([
12648
+ "node_modules",
12649
+ "dist",
12650
+ "build",
12651
+ ".git"
12652
+ ]);
12653
+ var isPathInside = (childPath, parentPath) => {
12654
+ const relative2 = path5.relative(parentPath, childPath);
12655
+ return relative2 === "" || !relative2.startsWith("..") && !path5.isAbsolute(relative2);
12656
+ };
12657
+ var findCircuitProjectDir = (filePath) => {
12658
+ const absoluteFilePath = path5.resolve(filePath);
12659
+ let currentDir = path5.dirname(absoluteFilePath);
12660
+ while (true) {
12661
+ if (fs5.existsSync(path5.join(currentDir, "package.json"))) {
12662
+ return currentDir;
12663
+ }
12664
+ const parentDir = path5.dirname(currentDir);
12665
+ if (parentDir === currentDir)
12666
+ break;
12667
+ currentDir = parentDir;
12668
+ }
12669
+ const cwd = path5.resolve(process.cwd());
12670
+ return isPathInside(absoluteFilePath, cwd) ? cwd : path5.dirname(absoluteFilePath);
12671
+ };
12672
+ var getCircuitJsonOutputDirName = (relativePath) => {
12673
+ const normalizedRelativePath = relativePath.toLowerCase().replaceAll("\\", "/");
12674
+ if (normalizedRelativePath === "circuit.json" || normalizedRelativePath.endsWith("/circuit.json")) {
12675
+ return path5.dirname(relativePath);
12676
+ }
12677
+ return relativePath.replace(/(\.board|\.circuit)?\.tsx$/, "").replace(/\.circuit\.json$/, "");
12678
+ };
12679
+ var getCircuitJsonBuildOutputPath = (filePath) => {
12680
+ const absoluteFilePath = path5.resolve(filePath);
12681
+ const projectDir = findCircuitProjectDir(absoluteFilePath);
12682
+ const relativePath = path5.relative(projectDir, absoluteFilePath);
12683
+ return path5.join(projectDir, "dist", getCircuitJsonOutputDirName(relativePath), "circuit.json");
12684
+ };
12685
+ var getSourceFilePaths = (projectDir) => {
12686
+ const sourceFilePaths = [];
12687
+ const visit = (directoryPath) => {
12688
+ const entries = fs5.readdirSync(directoryPath, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name));
12689
+ for (const entry of entries) {
12690
+ const entryPath = path5.join(directoryPath, entry.name);
12691
+ if (entry.isDirectory()) {
12692
+ if (IGNORED_DIRECTORY_NAMES.has(entry.name) || entry.name.startsWith(".")) {
12693
+ continue;
12694
+ }
12695
+ visit(entryPath);
12696
+ continue;
12697
+ }
12698
+ if (!entry.isFile() || entry.name.endsWith(".circuit.json") || !SOURCE_FILE_EXTENSIONS.has(path5.extname(entry.name).toLowerCase())) {
12699
+ continue;
12700
+ }
12701
+ sourceFilePaths.push(entryPath);
12702
+ }
12703
+ };
12704
+ visit(projectDir);
12705
+ return sourceFilePaths;
12706
+ };
12707
+ var getSourceFilesystemMd5Hash = (filePath) => {
12708
+ const projectDir = findCircuitProjectDir(filePath);
12709
+ const hash = createHash("md5");
12710
+ for (const sourceFilePath of getSourceFilePaths(projectDir)) {
12711
+ const relativePath = path5.relative(projectDir, sourceFilePath).split(path5.sep).join("/");
12712
+ const content = fs5.readFileSync(sourceFilePath);
12713
+ hash.update(`${Buffer.byteLength(relativePath)}:`);
12714
+ hash.update(relativePath);
12715
+ hash.update(`${content.byteLength}:`);
12716
+ hash.update(content);
12717
+ }
12718
+ return hash.digest("hex");
12719
+ };
12720
+ var addSourceFilesystemHash = (circuitJson, sourceFilesystemMd5Hash) => {
12721
+ let foundProjectMetadata = false;
12722
+ const circuitJsonWithHash = circuitJson.map((element) => {
12723
+ if (element.type !== "source_project_metadata")
12724
+ return element;
12725
+ foundProjectMetadata = true;
12726
+ const metadataWithHash = {
12727
+ ...element,
12728
+ source_filesystem_md5_hash: sourceFilesystemMd5Hash
12729
+ };
12730
+ return metadataWithHash;
12731
+ });
12732
+ if (!foundProjectMetadata) {
12733
+ const metadataWithHash = {
12734
+ type: "source_project_metadata",
12735
+ source_filesystem_md5_hash: sourceFilesystemMd5Hash
12736
+ };
12737
+ circuitJsonWithHash.push(metadataWithHash);
12738
+ }
12739
+ return circuitJsonWithHash;
12740
+ };
12741
+ var readCurrentCircuitJsonBuild = ({
12742
+ filePath,
12743
+ sourceFilesystemMd5Hash
12744
+ }) => {
12745
+ const outputPath = getCircuitJsonBuildOutputPath(filePath);
12746
+ try {
12747
+ const parsed = JSON.parse(fs5.readFileSync(outputPath, "utf-8"));
12748
+ if (!Array.isArray(parsed))
12749
+ return null;
12750
+ const hasCurrentFilesystemHash = parsed.some((element) => element?.type === "source_project_metadata" && element.source_filesystem_md5_hash === sourceFilesystemMd5Hash);
12751
+ return hasCurrentFilesystemHash ? {
12752
+ circuitJson: parsed,
12753
+ outputPath
12754
+ } : null;
12755
+ } catch {
12756
+ return null;
12757
+ }
12758
+ };
12759
+
12629
12760
  // lib/shared/generate-circuit-json.tsx
12630
12761
  import { jsxDEV } from "react/jsx-dev-runtime";
12631
12762
  var debug = Debug("tsci:generate-circuit-json");
@@ -12651,9 +12782,11 @@ async function generateCircuitJson({
12651
12782
  platformConfig,
12652
12783
  injectedProps,
12653
12784
  onAsyncEffectStatus,
12654
- autorouterDiagnostics: autorouterDiagnosticsOptions
12785
+ autorouterDiagnostics: autorouterDiagnosticsOptions,
12786
+ sourceFilesystemMd5Hash
12655
12787
  }) {
12656
12788
  debug(`Generating circuit JSON for ${filePath}`);
12789
+ const currentSourceFilesystemMd5Hash = sourceFilesystemMd5Hash ?? getSourceFilesystemMd5Hash(filePath);
12657
12790
  const React = await importFromUserLand("react");
12658
12791
  globalThis.React = React;
12659
12792
  registerStaticAssetLoaders(platformConfig);
@@ -12663,12 +12796,12 @@ async function generateCircuitJson({
12663
12796
  });
12664
12797
  const autorouterDiagnostics = new AutorouterDiagnostics(autorouterDiagnosticsOptions);
12665
12798
  autorouterDiagnostics.attachToRootCircuit(runner);
12666
- const absoluteFilePath = path5.isAbsolute(filePath) ? filePath : path5.resolve(process.cwd(), filePath);
12667
- const projectDir = path5.dirname(absoluteFilePath);
12799
+ const absoluteFilePath = path6.isAbsolute(filePath) ? filePath : path6.resolve(process.cwd(), filePath);
12800
+ const projectDir = path6.dirname(absoluteFilePath);
12668
12801
  const resolvedOutputDir = outputDir ?? projectDir;
12669
- const relativeComponentPath = path5.relative(projectDir, absoluteFilePath);
12670
- const baseFileName = outputFileName || path5.basename(absoluteFilePath).replace(/\.[^.]+$/, "");
12671
- const outputPath = path5.join(resolvedOutputDir, `${baseFileName}.circuit.json`);
12802
+ const relativeComponentPath = path6.relative(projectDir, absoluteFilePath);
12803
+ const baseFileName = outputFileName || path6.basename(absoluteFilePath).replace(/\.[^.]+$/, "");
12804
+ const outputPath = path6.join(resolvedOutputDir, `${baseFileName}.circuit.json`);
12672
12805
  debug(`Project directory: ${projectDir}`);
12673
12806
  debug(`Relative component path: ${relativeComponentPath}`);
12674
12807
  debug(`Output path: ${outputPath}`);
@@ -12688,7 +12821,7 @@ async function generateCircuitJson({
12688
12821
  return false;
12689
12822
  if (normalizedFilePath.match(/^\.[^/]/))
12690
12823
  return false;
12691
- if (!ALLOWED_FILE_EXTENSIONS.includes(path5.extname(normalizedFilePath)))
12824
+ if (!ALLOWED_FILE_EXTENSIONS.includes(path6.extname(normalizedFilePath)))
12692
12825
  return false;
12693
12826
  return true;
12694
12827
  },
@@ -12720,11 +12853,11 @@ async function generateCircuitJson({
12720
12853
  runner.render();
12721
12854
  }
12722
12855
  runner.emit("renderComplete");
12723
- const circuitJson = await runner.getCircuitJson();
12856
+ const circuitJson = addSourceFilesystemHash(await runner.getCircuitJson(), currentSourceFilesystemMd5Hash);
12724
12857
  await autorouterDiagnostics.finalize(circuitJson);
12725
12858
  if (saveToFile) {
12726
12859
  debug(`Saving circuit JSON to ${outputPath}`);
12727
- fs5.writeFileSync(outputPath, JSON.stringify(circuitJson, null, 2));
12860
+ fs6.writeFileSync(outputPath, JSON.stringify(circuitJson, null, 2));
12728
12861
  }
12729
12862
  return {
12730
12863
  circuitJson,
@@ -12734,29 +12867,29 @@ async function generateCircuitJson({
12734
12867
  }
12735
12868
 
12736
12869
  // lib/shared/get-platform-config-with-cli-defaults.ts
12737
- import { createHash } from "node:crypto";
12738
- import fs6 from "node:fs";
12739
- import path6 from "node:path";
12870
+ import { createHash as createHash2 } from "node:crypto";
12871
+ import fs7 from "node:fs";
12872
+ import path7 from "node:path";
12740
12873
  import { getPlatformConfig } from "@tscircuit/eval/platform-config";
12741
- function createLocalCacheEngine(cacheDir = path6.join(process.cwd(), ".tscircuit", "cache")) {
12874
+ function createLocalCacheEngine(cacheDir = path7.join(process.cwd(), ".tscircuit", "cache")) {
12742
12875
  return {
12743
12876
  getItem: (key) => {
12744
12877
  try {
12745
- const hash = createHash("md5").update(key).digest("hex");
12878
+ const hash = createHash2("md5").update(key).digest("hex");
12746
12879
  const keyWithSafeCharacters = key.replace(/[^a-zA-Z0-9]/g, "_");
12747
- const filePath = path6.join(cacheDir, `${keyWithSafeCharacters.slice(keyWithSafeCharacters.length - 10, keyWithSafeCharacters.length)}-${hash}.json`);
12748
- return fs6.readFileSync(filePath, "utf-8");
12880
+ const filePath = path7.join(cacheDir, `${keyWithSafeCharacters.slice(keyWithSafeCharacters.length - 10, keyWithSafeCharacters.length)}-${hash}.json`);
12881
+ return fs7.readFileSync(filePath, "utf-8");
12749
12882
  } catch {
12750
12883
  return null;
12751
12884
  }
12752
12885
  },
12753
12886
  setItem: (key, value) => {
12754
12887
  try {
12755
- fs6.mkdirSync(cacheDir, { recursive: true });
12756
- const hash = createHash("md5").update(key).digest("hex");
12888
+ fs7.mkdirSync(cacheDir, { recursive: true });
12889
+ const hash = createHash2("md5").update(key).digest("hex");
12757
12890
  const keyWithSafeCharacters = key.replace(/[^a-zA-Z0-9]/g, "_");
12758
- const filePath = path6.join(cacheDir, `${keyWithSafeCharacters.slice(keyWithSafeCharacters.length - 10, keyWithSafeCharacters.length)}-${hash}.json`);
12759
- fs6.writeFileSync(filePath, value);
12891
+ const filePath = path7.join(cacheDir, `${keyWithSafeCharacters.slice(keyWithSafeCharacters.length - 10, keyWithSafeCharacters.length)}-${hash}.json`);
12892
+ fs7.writeFileSync(filePath, value);
12760
12893
  } catch {}
12761
12894
  }
12762
12895
  };
@@ -12772,15 +12905,15 @@ function getPlatformConfigWithCliDefaults(userConfig) {
12772
12905
  loadFromUrl: async (url) => {
12773
12906
  let fetchUrl = url;
12774
12907
  if (url.startsWith("./") || url.startsWith("../")) {
12775
- const absolutePath = path6.resolve(process.cwd(), url);
12908
+ const absolutePath = path7.resolve(process.cwd(), url);
12776
12909
  fetchUrl = `file://${absolutePath}`;
12777
12910
  } else if (url.startsWith("/")) {
12778
- if (fs6.existsSync(url)) {
12911
+ if (fs7.existsSync(url)) {
12779
12912
  fetchUrl = `file://${url}`;
12780
12913
  } else {
12781
12914
  const relativePath = `.${url}`;
12782
- const absolutePath = path6.resolve(process.cwd(), relativePath);
12783
- if (fs6.existsSync(absolutePath)) {
12915
+ const absolutePath = path7.resolve(process.cwd(), relativePath);
12916
+ if (fs7.existsSync(absolutePath)) {
12784
12917
  fetchUrl = `file://${absolutePath}`;
12785
12918
  } else {
12786
12919
  fetchUrl = `file://${url}`;
@@ -13005,8 +13138,8 @@ var resolveImageFormatSelection = (options) => {
13005
13138
  };
13006
13139
 
13007
13140
  // cli/build/worker-output-generators.ts
13008
- import fs11 from "node:fs";
13009
- import path15 from "node:path";
13141
+ import fs12 from "node:fs";
13142
+ import path16 from "node:path";
13010
13143
 
13011
13144
  // node_modules/circuit-json-to-3d-png/dist/index.js
13012
13145
  function normalizeDir(dir) {
@@ -15489,7 +15622,7 @@ import {
15489
15622
  // lib/shared/load-local-step-model-fs-map.ts
15490
15623
  import { existsSync as existsSync2 } from "node:fs";
15491
15624
  import { readFile } from "node:fs/promises";
15492
- import path7 from "node:path";
15625
+ import path8 from "node:path";
15493
15626
  var isRemoteUrl = (value) => /^https?:\/\//i.test(value);
15494
15627
  async function loadLocalStepModelFsMap(circuitJson) {
15495
15628
  const fsMap = {};
@@ -15501,7 +15634,7 @@ async function loadLocalStepModelFsMap(circuitJson) {
15501
15634
  continue;
15502
15635
  if (isRemoteUrl(modelUrl) || fsMap[modelUrl])
15503
15636
  continue;
15504
- const localPath = path7.resolve(process.cwd(), modelUrl);
15637
+ const localPath = path8.resolve(process.cwd(), modelUrl);
15505
15638
  if (!existsSync2(localPath))
15506
15639
  continue;
15507
15640
  fsMap[modelUrl] = await readFile(localPath, "utf-8");
@@ -15551,8 +15684,8 @@ var getSimulationSvgAssetsFromCircuitJson = (circuitJson) => {
15551
15684
  // node_modules/conf/dist/source/index.js
15552
15685
  import { isDeepStrictEqual } from "node:util";
15553
15686
  import process7 from "node:process";
15554
- import fs8 from "node:fs";
15555
- import path11 from "node:path";
15687
+ import fs9 from "node:fs";
15688
+ import path12 from "node:path";
15556
15689
  import crypto from "node:crypto";
15557
15690
  import assert from "node:assert";
15558
15691
 
@@ -15567,12 +15700,12 @@ var disallowedKeys = new Set([
15567
15700
  "constructor"
15568
15701
  ]);
15569
15702
  var digits = new Set("0123456789");
15570
- function getPathSegments(path8) {
15703
+ function getPathSegments(path9) {
15571
15704
  const parts = [];
15572
15705
  let currentSegment = "";
15573
15706
  let currentPart = "start";
15574
15707
  let isIgnoring = false;
15575
- for (const character of path8) {
15708
+ for (const character of path9) {
15576
15709
  switch (character) {
15577
15710
  case "\\": {
15578
15711
  if (currentPart === "index") {
@@ -15694,11 +15827,11 @@ function assertNotStringIndex(object, key) {
15694
15827
  throw new Error("Cannot use string index");
15695
15828
  }
15696
15829
  }
15697
- function getProperty(object, path8, value) {
15698
- if (!isObject(object) || typeof path8 !== "string") {
15830
+ function getProperty(object, path9, value) {
15831
+ if (!isObject(object) || typeof path9 !== "string") {
15699
15832
  return value === undefined ? object : value;
15700
15833
  }
15701
- const pathArray = getPathSegments(path8);
15834
+ const pathArray = getPathSegments(path9);
15702
15835
  if (pathArray.length === 0) {
15703
15836
  return value;
15704
15837
  }
@@ -15718,12 +15851,12 @@ function getProperty(object, path8, value) {
15718
15851
  }
15719
15852
  return object === undefined ? value : object;
15720
15853
  }
15721
- function setProperty(object, path8, value) {
15722
- if (!isObject(object) || typeof path8 !== "string") {
15854
+ function setProperty(object, path9, value) {
15855
+ if (!isObject(object) || typeof path9 !== "string") {
15723
15856
  return object;
15724
15857
  }
15725
15858
  const root = object;
15726
- const pathArray = getPathSegments(path8);
15859
+ const pathArray = getPathSegments(path9);
15727
15860
  for (let index = 0;index < pathArray.length; index++) {
15728
15861
  const key = pathArray[index];
15729
15862
  assertNotStringIndex(object, key);
@@ -15736,11 +15869,11 @@ function setProperty(object, path8, value) {
15736
15869
  }
15737
15870
  return root;
15738
15871
  }
15739
- function deleteProperty(object, path8) {
15740
- if (!isObject(object) || typeof path8 !== "string") {
15872
+ function deleteProperty(object, path9) {
15873
+ if (!isObject(object) || typeof path9 !== "string") {
15741
15874
  return false;
15742
15875
  }
15743
- const pathArray = getPathSegments(path8);
15876
+ const pathArray = getPathSegments(path9);
15744
15877
  for (let index = 0;index < pathArray.length; index++) {
15745
15878
  const key = pathArray[index];
15746
15879
  assertNotStringIndex(object, key);
@@ -15754,11 +15887,11 @@ function deleteProperty(object, path8) {
15754
15887
  }
15755
15888
  }
15756
15889
  }
15757
- function hasProperty(object, path8) {
15758
- if (!isObject(object) || typeof path8 !== "string") {
15890
+ function hasProperty(object, path9) {
15891
+ if (!isObject(object) || typeof path9 !== "string") {
15759
15892
  return false;
15760
15893
  }
15761
- const pathArray = getPathSegments(path8);
15894
+ const pathArray = getPathSegments(path9);
15762
15895
  if (pathArray.length === 0) {
15763
15896
  return false;
15764
15897
  }
@@ -15772,41 +15905,41 @@ function hasProperty(object, path8) {
15772
15905
  }
15773
15906
 
15774
15907
  // node_modules/env-paths/index.js
15775
- import path8 from "node:path";
15908
+ import path9 from "node:path";
15776
15909
  import os from "node:os";
15777
15910
  import process2 from "node:process";
15778
15911
  var homedir = os.homedir();
15779
15912
  var tmpdir = os.tmpdir();
15780
15913
  var { env } = process2;
15781
15914
  var macos = (name) => {
15782
- const library = path8.join(homedir, "Library");
15915
+ const library = path9.join(homedir, "Library");
15783
15916
  return {
15784
- data: path8.join(library, "Application Support", name),
15785
- config: path8.join(library, "Preferences", name),
15786
- cache: path8.join(library, "Caches", name),
15787
- log: path8.join(library, "Logs", name),
15788
- temp: path8.join(tmpdir, name)
15917
+ data: path9.join(library, "Application Support", name),
15918
+ config: path9.join(library, "Preferences", name),
15919
+ cache: path9.join(library, "Caches", name),
15920
+ log: path9.join(library, "Logs", name),
15921
+ temp: path9.join(tmpdir, name)
15789
15922
  };
15790
15923
  };
15791
15924
  var windows = (name) => {
15792
- const appData = env.APPDATA || path8.join(homedir, "AppData", "Roaming");
15793
- const localAppData = env.LOCALAPPDATA || path8.join(homedir, "AppData", "Local");
15925
+ const appData = env.APPDATA || path9.join(homedir, "AppData", "Roaming");
15926
+ const localAppData = env.LOCALAPPDATA || path9.join(homedir, "AppData", "Local");
15794
15927
  return {
15795
- data: path8.join(localAppData, name, "Data"),
15796
- config: path8.join(appData, name, "Config"),
15797
- cache: path8.join(localAppData, name, "Cache"),
15798
- log: path8.join(localAppData, name, "Log"),
15799
- temp: path8.join(tmpdir, name)
15928
+ data: path9.join(localAppData, name, "Data"),
15929
+ config: path9.join(appData, name, "Config"),
15930
+ cache: path9.join(localAppData, name, "Cache"),
15931
+ log: path9.join(localAppData, name, "Log"),
15932
+ temp: path9.join(tmpdir, name)
15800
15933
  };
15801
15934
  };
15802
15935
  var linux = (name) => {
15803
- const username = path8.basename(homedir);
15936
+ const username = path9.basename(homedir);
15804
15937
  return {
15805
- data: path8.join(env.XDG_DATA_HOME || path8.join(homedir, ".local", "share"), name),
15806
- config: path8.join(env.XDG_CONFIG_HOME || path8.join(homedir, ".config"), name),
15807
- cache: path8.join(env.XDG_CACHE_HOME || path8.join(homedir, ".cache"), name),
15808
- log: path8.join(env.XDG_STATE_HOME || path8.join(homedir, ".local", "state"), name),
15809
- temp: path8.join(tmpdir, username, name)
15938
+ data: path9.join(env.XDG_DATA_HOME || path9.join(homedir, ".local", "share"), name),
15939
+ config: path9.join(env.XDG_CONFIG_HOME || path9.join(homedir, ".config"), name),
15940
+ cache: path9.join(env.XDG_CACHE_HOME || path9.join(homedir, ".cache"), name),
15941
+ log: path9.join(env.XDG_STATE_HOME || path9.join(homedir, ".local", "state"), name),
15942
+ temp: path9.join(tmpdir, username, name)
15810
15943
  };
15811
15944
  };
15812
15945
  function envPaths(name, { suffix = "nodejs" } = {}) {
@@ -15826,10 +15959,10 @@ function envPaths(name, { suffix = "nodejs" } = {}) {
15826
15959
  }
15827
15960
 
15828
15961
  // node_modules/atomically/dist/index.js
15829
- import path10 from "node:path";
15962
+ import path11 from "node:path";
15830
15963
 
15831
15964
  // node_modules/stubborn-fs/dist/index.js
15832
- import fs7 from "node:fs";
15965
+ import fs8 from "node:fs";
15833
15966
  import { promisify } from "node:util";
15834
15967
 
15835
15968
  // node_modules/stubborn-utils/dist/attemptify_async.js
@@ -15959,41 +16092,41 @@ var RETRYIFY_OPTIONS = {
15959
16092
  // node_modules/stubborn-fs/dist/index.js
15960
16093
  var FS = {
15961
16094
  attempt: {
15962
- chmod: attemptify_async_default(promisify(fs7.chmod), ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
15963
- chown: attemptify_async_default(promisify(fs7.chown), ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
15964
- close: attemptify_async_default(promisify(fs7.close), ATTEMPTIFY_NOOP_OPTIONS),
15965
- fsync: attemptify_async_default(promisify(fs7.fsync), ATTEMPTIFY_NOOP_OPTIONS),
15966
- mkdir: attemptify_async_default(promisify(fs7.mkdir), ATTEMPTIFY_NOOP_OPTIONS),
15967
- realpath: attemptify_async_default(promisify(fs7.realpath), ATTEMPTIFY_NOOP_OPTIONS),
15968
- stat: attemptify_async_default(promisify(fs7.stat), ATTEMPTIFY_NOOP_OPTIONS),
15969
- unlink: attemptify_async_default(promisify(fs7.unlink), ATTEMPTIFY_NOOP_OPTIONS),
15970
- chmodSync: attemptify_sync_default(fs7.chmodSync, ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
15971
- chownSync: attemptify_sync_default(fs7.chownSync, ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
15972
- closeSync: attemptify_sync_default(fs7.closeSync, ATTEMPTIFY_NOOP_OPTIONS),
15973
- existsSync: attemptify_sync_default(fs7.existsSync, ATTEMPTIFY_NOOP_OPTIONS),
15974
- fsyncSync: attemptify_sync_default(fs7.fsync, ATTEMPTIFY_NOOP_OPTIONS),
15975
- mkdirSync: attemptify_sync_default(fs7.mkdirSync, ATTEMPTIFY_NOOP_OPTIONS),
15976
- realpathSync: attemptify_sync_default(fs7.realpathSync, ATTEMPTIFY_NOOP_OPTIONS),
15977
- statSync: attemptify_sync_default(fs7.statSync, ATTEMPTIFY_NOOP_OPTIONS),
15978
- unlinkSync: attemptify_sync_default(fs7.unlinkSync, ATTEMPTIFY_NOOP_OPTIONS)
16095
+ chmod: attemptify_async_default(promisify(fs8.chmod), ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
16096
+ chown: attemptify_async_default(promisify(fs8.chown), ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
16097
+ close: attemptify_async_default(promisify(fs8.close), ATTEMPTIFY_NOOP_OPTIONS),
16098
+ fsync: attemptify_async_default(promisify(fs8.fsync), ATTEMPTIFY_NOOP_OPTIONS),
16099
+ mkdir: attemptify_async_default(promisify(fs8.mkdir), ATTEMPTIFY_NOOP_OPTIONS),
16100
+ realpath: attemptify_async_default(promisify(fs8.realpath), ATTEMPTIFY_NOOP_OPTIONS),
16101
+ stat: attemptify_async_default(promisify(fs8.stat), ATTEMPTIFY_NOOP_OPTIONS),
16102
+ unlink: attemptify_async_default(promisify(fs8.unlink), ATTEMPTIFY_NOOP_OPTIONS),
16103
+ chmodSync: attemptify_sync_default(fs8.chmodSync, ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
16104
+ chownSync: attemptify_sync_default(fs8.chownSync, ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
16105
+ closeSync: attemptify_sync_default(fs8.closeSync, ATTEMPTIFY_NOOP_OPTIONS),
16106
+ existsSync: attemptify_sync_default(fs8.existsSync, ATTEMPTIFY_NOOP_OPTIONS),
16107
+ fsyncSync: attemptify_sync_default(fs8.fsync, ATTEMPTIFY_NOOP_OPTIONS),
16108
+ mkdirSync: attemptify_sync_default(fs8.mkdirSync, ATTEMPTIFY_NOOP_OPTIONS),
16109
+ realpathSync: attemptify_sync_default(fs8.realpathSync, ATTEMPTIFY_NOOP_OPTIONS),
16110
+ statSync: attemptify_sync_default(fs8.statSync, ATTEMPTIFY_NOOP_OPTIONS),
16111
+ unlinkSync: attemptify_sync_default(fs8.unlinkSync, ATTEMPTIFY_NOOP_OPTIONS)
15979
16112
  },
15980
16113
  retry: {
15981
- close: retryify_async_default(promisify(fs7.close), RETRYIFY_OPTIONS),
15982
- fsync: retryify_async_default(promisify(fs7.fsync), RETRYIFY_OPTIONS),
15983
- open: retryify_async_default(promisify(fs7.open), RETRYIFY_OPTIONS),
15984
- readFile: retryify_async_default(promisify(fs7.readFile), RETRYIFY_OPTIONS),
15985
- rename: retryify_async_default(promisify(fs7.rename), RETRYIFY_OPTIONS),
15986
- stat: retryify_async_default(promisify(fs7.stat), RETRYIFY_OPTIONS),
15987
- write: retryify_async_default(promisify(fs7.write), RETRYIFY_OPTIONS),
15988
- writeFile: retryify_async_default(promisify(fs7.writeFile), RETRYIFY_OPTIONS),
15989
- closeSync: retryify_sync_default(fs7.closeSync, RETRYIFY_OPTIONS),
15990
- fsyncSync: retryify_sync_default(fs7.fsyncSync, RETRYIFY_OPTIONS),
15991
- openSync: retryify_sync_default(fs7.openSync, RETRYIFY_OPTIONS),
15992
- readFileSync: retryify_sync_default(fs7.readFileSync, RETRYIFY_OPTIONS),
15993
- renameSync: retryify_sync_default(fs7.renameSync, RETRYIFY_OPTIONS),
15994
- statSync: retryify_sync_default(fs7.statSync, RETRYIFY_OPTIONS),
15995
- writeSync: retryify_sync_default(fs7.writeSync, RETRYIFY_OPTIONS),
15996
- writeFileSync: retryify_sync_default(fs7.writeFileSync, RETRYIFY_OPTIONS)
16114
+ close: retryify_async_default(promisify(fs8.close), RETRYIFY_OPTIONS),
16115
+ fsync: retryify_async_default(promisify(fs8.fsync), RETRYIFY_OPTIONS),
16116
+ open: retryify_async_default(promisify(fs8.open), RETRYIFY_OPTIONS),
16117
+ readFile: retryify_async_default(promisify(fs8.readFile), RETRYIFY_OPTIONS),
16118
+ rename: retryify_async_default(promisify(fs8.rename), RETRYIFY_OPTIONS),
16119
+ stat: retryify_async_default(promisify(fs8.stat), RETRYIFY_OPTIONS),
16120
+ write: retryify_async_default(promisify(fs8.write), RETRYIFY_OPTIONS),
16121
+ writeFile: retryify_async_default(promisify(fs8.writeFile), RETRYIFY_OPTIONS),
16122
+ closeSync: retryify_sync_default(fs8.closeSync, RETRYIFY_OPTIONS),
16123
+ fsyncSync: retryify_sync_default(fs8.fsyncSync, RETRYIFY_OPTIONS),
16124
+ openSync: retryify_sync_default(fs8.openSync, RETRYIFY_OPTIONS),
16125
+ readFileSync: retryify_sync_default(fs8.readFileSync, RETRYIFY_OPTIONS),
16126
+ renameSync: retryify_sync_default(fs8.renameSync, RETRYIFY_OPTIONS),
16127
+ statSync: retryify_sync_default(fs8.statSync, RETRYIFY_OPTIONS),
16128
+ writeSync: retryify_sync_default(fs8.writeSync, RETRYIFY_OPTIONS),
16129
+ writeFileSync: retryify_sync_default(fs8.writeFileSync, RETRYIFY_OPTIONS)
15997
16130
  }
15998
16131
  };
15999
16132
  var dist_default = FS;
@@ -16023,7 +16156,7 @@ var isUndefined = (value) => {
16023
16156
  };
16024
16157
 
16025
16158
  // node_modules/atomically/dist/utils/temp.js
16026
- import path9 from "node:path";
16159
+ import path10 from "node:path";
16027
16160
 
16028
16161
  // node_modules/when-exit/dist/node/interceptor.js
16029
16162
  import process6 from "node:process";
@@ -16123,7 +16256,7 @@ var Temp = {
16123
16256
  }
16124
16257
  },
16125
16258
  truncate: (filePath) => {
16126
- const basename = path9.basename(filePath);
16259
+ const basename = path10.basename(filePath);
16127
16260
  if (basename.length <= LIMIT_BASENAME_LENGTH)
16128
16261
  return filePath;
16129
16262
  const truncable = /^(\.?)(.*?)((?:\.[^.]+)?(?:\.tmp-\d{10}[a-f0-9]{6})?)$/.exec(basename);
@@ -16165,7 +16298,7 @@ function writeFileSync2(filePath, data, options = DEFAULT_WRITE_OPTIONS) {
16165
16298
  }
16166
16299
  }
16167
16300
  if (!filePathExists) {
16168
- const parentPath = path10.dirname(filePath);
16301
+ const parentPath = path11.dirname(filePath);
16169
16302
  dist_default.attempt.mkdirSync(parentPath, {
16170
16303
  mode: DEFAULT_FOLDER_MODE,
16171
16304
  recursive: true
@@ -16481,7 +16614,7 @@ class Conf {
16481
16614
  this.events = new EventTarget;
16482
16615
  this.#encryptionKey = options.encryptionKey;
16483
16616
  const fileExtension = options.fileExtension ? `.${options.fileExtension}` : "";
16484
- this.path = path11.resolve(options.cwd, `${options.configName ?? "config"}${fileExtension}`);
16617
+ this.path = path12.resolve(options.cwd, `${options.configName ?? "config"}${fileExtension}`);
16485
16618
  const fileStore = this.store;
16486
16619
  const store = Object.assign(createPlainObject(), options.defaults, fileStore);
16487
16620
  if (options.migrations) {
@@ -16584,7 +16717,7 @@ class Conf {
16584
16717
  }
16585
16718
  get store() {
16586
16719
  try {
16587
- const data = fs8.readFileSync(this.path, this.#encryptionKey ? null : "utf8");
16720
+ const data = fs9.readFileSync(this.path, this.#encryptionKey ? null : "utf8");
16588
16721
  const dataString = this._encryptData(data);
16589
16722
  const deserializedData = this._deserialize(dataString);
16590
16723
  this._validate(deserializedData);
@@ -16655,7 +16788,7 @@ class Conf {
16655
16788
  throw new Error("Config schema violation: " + errors.join("; "));
16656
16789
  }
16657
16790
  _ensureDirectory() {
16658
- fs8.mkdirSync(path11.dirname(this.path), { recursive: true });
16791
+ fs9.mkdirSync(path12.dirname(this.path), { recursive: true });
16659
16792
  }
16660
16793
  _write(value) {
16661
16794
  let data = this._serialize(value);
@@ -16666,13 +16799,13 @@ class Conf {
16666
16799
  data = concatUint8Arrays([initializationVector, stringToUint8Array(":"), cipher.update(stringToUint8Array(data)), cipher.final()]);
16667
16800
  }
16668
16801
  if (process7.env.SNAP) {
16669
- fs8.writeFileSync(this.path, data, { mode: this.#options.configFileMode });
16802
+ fs9.writeFileSync(this.path, data, { mode: this.#options.configFileMode });
16670
16803
  } else {
16671
16804
  try {
16672
16805
  writeFileSync2(this.path, data, { mode: this.#options.configFileMode });
16673
16806
  } catch (error) {
16674
16807
  if (error?.code === "EXDEV") {
16675
- fs8.writeFileSync(this.path, data, { mode: this.#options.configFileMode });
16808
+ fs9.writeFileSync(this.path, data, { mode: this.#options.configFileMode });
16676
16809
  return;
16677
16810
  }
16678
16811
  throw error;
@@ -16681,15 +16814,15 @@ class Conf {
16681
16814
  }
16682
16815
  _watch() {
16683
16816
  this._ensureDirectory();
16684
- if (!fs8.existsSync(this.path)) {
16817
+ if (!fs9.existsSync(this.path)) {
16685
16818
  this._write(createPlainObject());
16686
16819
  }
16687
16820
  if (process7.platform === "win32") {
16688
- fs8.watch(this.path, { persistent: false }, debounce_fn_default(() => {
16821
+ fs9.watch(this.path, { persistent: false }, debounce_fn_default(() => {
16689
16822
  this.events.dispatchEvent(new Event("change"));
16690
16823
  }, { wait: 100 }));
16691
16824
  } else {
16692
- fs8.watchFile(this.path, { persistent: false }, debounce_fn_default(() => {
16825
+ fs9.watchFile(this.path, { persistent: false }, debounce_fn_default(() => {
16693
16826
  this.events.dispatchEvent(new Event("change"));
16694
16827
  }, { wait: 5000 }));
16695
16828
  }
@@ -16825,14 +16958,14 @@ function jwtDecode(token, options) {
16825
16958
  }
16826
16959
 
16827
16960
  // lib/cli-config/index.ts
16828
- import fs10 from "node:fs";
16961
+ import fs11 from "node:fs";
16829
16962
  import os3 from "node:os";
16830
- import path13 from "node:path";
16963
+ import path14 from "node:path";
16831
16964
 
16832
16965
  // lib/shared/handle-registry-auth-error.ts
16833
- import fs9 from "node:fs";
16966
+ import fs10 from "node:fs";
16834
16967
  import os2 from "node:os";
16835
- import path12 from "node:path";
16968
+ import path13 from "node:path";
16836
16969
  var AUTH_TOKEN_REGEX = /^\/\/npm\.tscircuit\.com\/:_authToken=(.+)$/m;
16837
16970
  function isUnauthorizedError(error) {
16838
16971
  const output = [
@@ -16853,9 +16986,9 @@ function isUnauthorizedError(error) {
16853
16986
  return /\b(401|E401)\b/i.test(output) || /unauthorized/i.test(output);
16854
16987
  }
16855
16988
  function hasTsciAuthToken(npmrcPath) {
16856
- if (!fs9.existsSync(npmrcPath))
16989
+ if (!fs10.existsSync(npmrcPath))
16857
16990
  return false;
16858
- const content = fs9.readFileSync(npmrcPath, "utf-8");
16991
+ const content = fs10.readFileSync(npmrcPath, "utf-8");
16859
16992
  return AUTH_TOKEN_REGEX.test(content);
16860
16993
  }
16861
16994
  function handleRegistryAuthError({
@@ -16865,8 +16998,8 @@ function handleRegistryAuthError({
16865
16998
  if (!isUnauthorizedError(error))
16866
16999
  return;
16867
17000
  const npmrcPaths = [
16868
- path12.join(projectDir, ".npmrc"),
16869
- path12.join(os2.homedir(), ".npmrc")
17001
+ path13.join(projectDir, ".npmrc"),
17002
+ path13.join(os2.homedir(), ".npmrc")
16870
17003
  ];
16871
17004
  const hasToken = npmrcPaths.some(hasTsciAuthToken);
16872
17005
  if (hasToken) {
@@ -16889,13 +17022,13 @@ var getSessionToken = () => {
16889
17022
  };
16890
17023
  var getSessionTokenFromNpmrc = () => {
16891
17024
  const npmrcPaths = [
16892
- path13.join(process.cwd(), ".npmrc"),
16893
- path13.join(os3.homedir(), ".npmrc")
17025
+ path14.join(process.cwd(), ".npmrc"),
17026
+ path14.join(os3.homedir(), ".npmrc")
16894
17027
  ];
16895
17028
  for (const npmrcPath of npmrcPaths) {
16896
- if (!fs10.existsSync(npmrcPath))
17029
+ if (!fs11.existsSync(npmrcPath))
16897
17030
  continue;
16898
- const content = fs10.readFileSync(npmrcPath, "utf-8");
17031
+ const content = fs11.readFileSync(npmrcPath, "utf-8");
16899
17032
  const match = content.match(AUTH_TOKEN_REGEX);
16900
17033
  if (match?.[1]) {
16901
17034
  return match[1].trim();
@@ -16933,7 +17066,7 @@ var getCircuitJsonToGltfOptions = ({
16933
17066
  };
16934
17067
 
16935
17068
  // cli/build/convert-model-urls-to-file-urls.ts
16936
- import path14 from "node:path";
17069
+ import path15 from "node:path";
16937
17070
  import { pathToFileURL as pathToFileURL3 } from "node:url";
16938
17071
  var convertModelUrlsToFileUrls = (circuitJson) => {
16939
17072
  const modelUrlKeys2 = [
@@ -16960,7 +17093,7 @@ var convertModelUrlsToFileUrls = (circuitJson) => {
16960
17093
  if (value.startsWith("/") || value.match(/^[a-zA-Z]:\\/)) {
16961
17094
  updated[key] = pathToFileURL3(value).href;
16962
17095
  } else if (value.startsWith(".")) {
16963
- updated[key] = pathToFileURL3(path14.resolve(process.cwd(), value)).href;
17096
+ updated[key] = pathToFileURL3(path15.resolve(process.cwd(), value)).href;
16964
17097
  }
16965
17098
  }
16966
17099
  }
@@ -16996,10 +17129,10 @@ var writeSimulationSvgAssetsFromCircuitJson = (circuitJson, outputDir, imageForm
16996
17129
  if (!simulationSvgAssets)
16997
17130
  return false;
16998
17131
  if (imageFormats.simulationSvgs) {
16999
- fs11.writeFileSync(path15.join(outputDir, "simulation.svg"), simulationSvgAssets.simulationSvg, "utf-8");
17132
+ fs12.writeFileSync(path16.join(outputDir, "simulation.svg"), simulationSvgAssets.simulationSvg, "utf-8");
17000
17133
  }
17001
17134
  if (imageFormats.simulationSchematicSvgs) {
17002
- fs11.writeFileSync(path15.join(outputDir, "simulation-schematic.svg"), simulationSvgAssets.schematicSimulationSvg, "utf-8");
17135
+ fs12.writeFileSync(path16.join(outputDir, "simulation-schematic.svg"), simulationSvgAssets.schematicSimulationSvg, "utf-8");
17003
17136
  }
17004
17137
  return true;
17005
17138
  };
@@ -17007,8 +17140,8 @@ var writeGlbFromCircuitJson = async (circuitJson, glbOutputPath) => {
17007
17140
  const circuitJsonWithFileUrls = convertModelUrlsToFileUrls(circuitJson);
17008
17141
  const glbBuffer = await convertCircuitJsonToGltf(circuitJsonWithFileUrls, getCircuitJsonToGltfOptions({ format: "glb" }));
17009
17142
  const glbData = normalizeToUint8Array2(glbBuffer);
17010
- fs11.mkdirSync(path15.dirname(glbOutputPath), { recursive: true });
17011
- fs11.writeFileSync(glbOutputPath, Buffer.from(glbData));
17143
+ fs12.mkdirSync(path16.dirname(glbOutputPath), { recursive: true });
17144
+ fs12.writeFileSync(glbOutputPath, Buffer.from(glbData));
17012
17145
  };
17013
17146
  var writeStepFromCircuitJson = async (circuitJson, stepOutputPath) => {
17014
17147
  const stepContent = await circuitJsonToStep(circuitJson, {
@@ -17016,34 +17149,34 @@ var writeStepFromCircuitJson = async (circuitJson, stepOutputPath) => {
17016
17149
  includeExternalMeshes: true,
17017
17150
  fsMap: await loadLocalStepModelFsMap(circuitJson)
17018
17151
  });
17019
- fs11.mkdirSync(path15.dirname(stepOutputPath), { recursive: true });
17020
- fs11.writeFileSync(stepOutputPath, stepContent);
17152
+ fs12.mkdirSync(path16.dirname(stepOutputPath), { recursive: true });
17153
+ fs12.writeFileSync(stepOutputPath, stepContent);
17021
17154
  };
17022
17155
  var writeImageAssetsFromCircuitJson = async (circuitJson, options) => {
17023
17156
  const { outputDir, imageFormats, pcbSnapshotSettings } = options;
17024
- fs11.mkdirSync(outputDir, { recursive: true });
17157
+ fs12.mkdirSync(outputDir, { recursive: true });
17025
17158
  if (imageFormats.pcbSvgs) {
17026
17159
  const pcbSvg = convertCircuitJsonToPcbSvg2(circuitJson, pcbSnapshotSettings);
17027
- fs11.writeFileSync(path15.join(outputDir, "pcb.svg"), pcbSvg, "utf-8");
17160
+ fs12.writeFileSync(path16.join(outputDir, "pcb.svg"), pcbSvg, "utf-8");
17028
17161
  }
17029
17162
  if (imageFormats.pcbPngs) {
17030
17163
  const pcbSvg = convertCircuitJsonToPcbSvg2(circuitJson, pcbSnapshotSettings);
17031
- fs11.writeFileSync(path15.join(outputDir, "pcb.png"), await convertSvgToPngBuffer(pcbSvg));
17164
+ fs12.writeFileSync(path16.join(outputDir, "pcb.png"), await convertSvgToPngBuffer(pcbSvg));
17032
17165
  }
17033
17166
  if (imageFormats.schematicSvgs) {
17034
17167
  const schematicSvg = convertCircuitJsonToSchematicSvg(circuitJson);
17035
- fs11.writeFileSync(path15.join(outputDir, "schematic.svg"), schematicSvg, "utf-8");
17168
+ fs12.writeFileSync(path16.join(outputDir, "schematic.svg"), schematicSvg, "utf-8");
17036
17169
  }
17037
17170
  writeSimulationSvgAssetsFromCircuitJson(circuitJson, outputDir, imageFormats);
17038
17171
  if (imageFormats.threeDPngs) {
17039
17172
  const pngBuffer = await renderCircuitJsonTo3dPng(circuitJson);
17040
- fs11.writeFileSync(path15.join(outputDir, "3d.png"), Buffer.from(pngBuffer));
17173
+ fs12.writeFileSync(path16.join(outputDir, "3d.png"), Buffer.from(pngBuffer));
17041
17174
  }
17042
17175
  };
17043
17176
 
17044
17177
  // cli/build/worker-build-handlers.ts
17045
17178
  var loadCircuitJsonFromInputFile = (filePath) => {
17046
- const parsed = JSON.parse(fs12.readFileSync(filePath, "utf-8"));
17179
+ const parsed = JSON.parse(fs13.readFileSync(filePath, "utf-8"));
17047
17180
  return Array.isArray(parsed) ? parsed : [];
17048
17181
  };
17049
17182
  var handleBuildFile = async (filePath, outputPath, glbOutputPath, stepOutputPath, previewOutputDir, projectDir, options, workerLog, workerStatus) => {
@@ -17052,7 +17185,7 @@ var handleBuildFile = async (filePath, outputPath, glbOutputPath, stepOutputPath
17052
17185
  const startedAt = options?.profile ? performance.now() : 0;
17053
17186
  try {
17054
17187
  process.chdir(projectDir);
17055
- workerLog(`Generating circuit JSON for ${path16.relative(projectDir, filePath)}...`);
17188
+ workerLog(`Generating circuit JSON for ${path17.relative(projectDir, filePath)}...`);
17056
17189
  await registerStaticAssetLoaders();
17057
17190
  const projectConfig = await loadRuntimeProjectConfig(projectDir);
17058
17191
  const platformConfig = mergePlatformConfigs(projectConfig?.platformConfig, options?.platformConfig);
@@ -17071,9 +17204,9 @@ var handleBuildFile = async (filePath, outputPath, glbOutputPath, stepOutputPath
17071
17204
  workerStatus(`waiting on ${asyncEffectName}…`);
17072
17205
  }
17073
17206
  })).circuitJson;
17074
- fs12.mkdirSync(path16.dirname(outputPath), { recursive: true });
17075
- fs12.writeFileSync(outputPath, JSON.stringify(circuitJson, null, 2));
17076
- workerLog(`Circuit JSON written to ${path16.relative(projectDir, outputPath)}`);
17207
+ fs13.mkdirSync(path17.dirname(outputPath), { recursive: true });
17208
+ fs13.writeFileSync(outputPath, JSON.stringify(circuitJson, null, 2));
17209
+ workerLog(`Circuit JSON written to ${path17.relative(projectDir, outputPath)}`);
17077
17210
  const diagnostics = analyzeCircuitJson(circuitJson);
17078
17211
  const filteredDiagnostics = filterDiagnosticsByDrcCategory({
17079
17212
  errors: diagnostics.errors,
@@ -17103,7 +17236,7 @@ var handleBuildFile = async (filePath, outputPath, glbOutputPath, stepOutputPath
17103
17236
  let previewError;
17104
17237
  if (glbOutputPath) {
17105
17238
  try {
17106
- workerLog(`Converting ${path16.relative(projectDir, outputPath)} to GLB in same worker...`);
17239
+ workerLog(`Converting ${path17.relative(projectDir, outputPath)} to GLB in same worker...`);
17107
17240
  await writeGlbFromCircuitJson(circuitJson, glbOutputPath);
17108
17241
  glbOk = true;
17109
17242
  } catch (err) {
@@ -17114,7 +17247,7 @@ var handleBuildFile = async (filePath, outputPath, glbOutputPath, stepOutputPath
17114
17247
  }
17115
17248
  if (stepOutputPath) {
17116
17249
  try {
17117
- workerLog(`Converting ${path16.relative(projectDir, outputPath)} to STEP in same worker...`);
17250
+ workerLog(`Converting ${path17.relative(projectDir, outputPath)} to STEP in same worker...`);
17118
17251
  await writeStepFromCircuitJson(circuitJson, stepOutputPath);
17119
17252
  stepOk = true;
17120
17253
  } catch (err) {
@@ -17125,8 +17258,8 @@ var handleBuildFile = async (filePath, outputPath, glbOutputPath, stepOutputPath
17125
17258
  }
17126
17259
  if (options?.generatePreviewAssets) {
17127
17260
  try {
17128
- const resolvedPreviewOutputDir = previewOutputDir ?? path16.dirname(outputPath);
17129
- workerLog(`Generating preview assets for ${path16.relative(projectDir, resolvedPreviewOutputDir)} in same worker...`);
17261
+ const resolvedPreviewOutputDir = previewOutputDir ?? path17.dirname(outputPath);
17262
+ workerLog(`Generating preview assets for ${path17.relative(projectDir, resolvedPreviewOutputDir)} in same worker...`);
17130
17263
  await writeImageAssetsFromCircuitJson(circuitJson, {
17131
17264
  outputDir: resolvedPreviewOutputDir,
17132
17265
  imageFormats: options?.imageFormats ?? DEFAULT_IMAGE_FORMAT_SELECTION,