@tscircuit/cli 0.1.1564 → 0.1.1566

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.
package/dist/cli/main.js CHANGED
@@ -93628,7 +93628,7 @@ var import_perfect_cli = __toESM2(require_dist2(), 1);
93628
93628
  // lib/getVersion.ts
93629
93629
  import { createRequire as createRequire2 } from "node:module";
93630
93630
  // package.json
93631
- var version = "0.1.1562";
93631
+ var version = "0.1.1565";
93632
93632
  var package_default = {
93633
93633
  name: "@tscircuit/cli",
93634
93634
  version,
@@ -259182,7 +259182,7 @@ var registerConvert = (program2) => {
259182
259182
  // cli/dev/register.ts
259183
259183
  import * as fs53 from "node:fs";
259184
259184
  import * as net from "node:net";
259185
- import * as path57 from "node:path";
259185
+ import * as path58 from "node:path";
259186
259186
 
259187
259187
  // cli/dev/resolve-dev-target.ts
259188
259188
  import * as fs47 from "node:fs";
@@ -259241,7 +259241,7 @@ var resolveDevTarget = async (file) => {
259241
259241
 
259242
259242
  // lib/dev/DevServer.ts
259243
259243
  import fs52 from "node:fs";
259244
- import path56 from "node:path";
259244
+ import path57 from "node:path";
259245
259245
 
259246
259246
  // node_modules/chokidar/esm/index.js
259247
259247
  import { stat as statcb } from "fs";
@@ -261262,6 +261262,8 @@ class EventsWatcher extends EventEmitter2 {
261262
261262
  // lib/server/createHttpServer.ts
261263
261263
  import * as fs50 from "node:fs";
261264
261264
  import * as http from "node:http";
261265
+ import { createRequire as createRequire4 } from "node:module";
261266
+ import * as path53 from "node:path";
261265
261267
 
261266
261268
  // node_modules/winterspec/dist/edge/transform-to-node.js
261267
261269
  var import_node_utils = __toESM2(require_dist5(), 1);
@@ -263023,6 +263025,17 @@ Rebuilding KiCad PCM assets...`));
263023
263025
  };
263024
263026
 
263025
263027
  // lib/server/createHttpServer.ts
263028
+ var resolveLocalTscircuitStandalonePath = (projectDir) => {
263029
+ if (!projectDir)
263030
+ return;
263031
+ try {
263032
+ const projectRequire = createRequire4(path53.join(projectDir, "package.json"));
263033
+ const browserBundlePath = path53.join(path53.dirname(projectRequire.resolve("tscircuit/package.json")), "dist", "browser.min.js");
263034
+ if (fs50.existsSync(browserBundlePath))
263035
+ return browserBundlePath;
263036
+ } catch {}
263037
+ return;
263038
+ };
263026
263039
  var createHttpServer = async ({
263027
263040
  port = 3020,
263028
263041
  defaultMainComponentPath,
@@ -263082,8 +263095,30 @@ var createHttpServer = async ({
263082
263095
  }
263083
263096
  }
263084
263097
  if (url2.pathname === "/standalone.min.js") {
263085
- const standaloneFilePath = process.env.RUNFRAME_STANDALONE_FILE_PATH;
263086
- if (!standaloneFilePath) {
263098
+ const explicitStandalonePath = process.env.RUNFRAME_STANDALONE_FILE_PATH;
263099
+ if (!explicitStandalonePath) {
263100
+ const localStandalonePath = resolveLocalTscircuitStandalonePath(projectDir);
263101
+ if (localStandalonePath) {
263102
+ try {
263103
+ const content = fs50.readFileSync(localStandalonePath, "utf8");
263104
+ res2.writeHead(200, {
263105
+ "Content-Type": "application/javascript; charset=utf-8"
263106
+ });
263107
+ res2.end(content);
263108
+ return;
263109
+ } catch {}
263110
+ }
263111
+ const globalStandalonePath = process.env.TSCIRCUIT_GLOBAL_STANDALONE_FILE_PATH;
263112
+ if (globalStandalonePath) {
263113
+ try {
263114
+ const content = fs50.readFileSync(globalStandalonePath, "utf8");
263115
+ res2.writeHead(200, {
263116
+ "Content-Type": "application/javascript; charset=utf-8"
263117
+ });
263118
+ res2.end(content);
263119
+ return;
263120
+ } catch {}
263121
+ }
263087
263122
  res2.writeHead(200, {
263088
263123
  "Content-Type": "application/javascript; charset=utf-8"
263089
263124
  });
@@ -263091,7 +263126,7 @@ var createHttpServer = async ({
263091
263126
  return;
263092
263127
  }
263093
263128
  try {
263094
- const content = fs50.readFileSync(standaloneFilePath, "utf8");
263129
+ const content = fs50.readFileSync(explicitStandalonePath, "utf8");
263095
263130
  res2.writeHead(200, {
263096
263131
  "Content-Type": "application/javascript; charset=utf-8"
263097
263132
  });
@@ -263135,7 +263170,7 @@ var createHttpServer = async ({
263135
263170
  // lib/shared/push-snippet.ts
263136
263171
  var import_semver3 = __toESM2(require_semver2(), 1);
263137
263172
  import * as fs51 from "node:fs";
263138
- import * as path55 from "node:path";
263173
+ import * as path56 from "node:path";
263139
263174
  import Debug2 from "debug";
263140
263175
 
263141
263176
  // lib/utils/validate-package-name.ts
@@ -263153,7 +263188,7 @@ var validatePackageName = (name) => {
263153
263188
  };
263154
263189
 
263155
263190
  // lib/dev/get-package-file-paths.ts
263156
- import * as path53 from "node:path";
263191
+ import * as path54 from "node:path";
263157
263192
  var getPackageFilePaths = (projectDir, ignored = []) => {
263158
263193
  const ignorePatterns = [
263159
263194
  ...DEFAULT_IGNORED_PATTERNS,
@@ -263164,7 +263199,7 @@ var getPackageFilePaths = (projectDir, ignored = []) => {
263164
263199
  ignore: ignorePatterns
263165
263200
  });
263166
263201
  fileNames.sort();
263167
- return fileNames.map((fileName) => path53.join(projectDir, fileName));
263202
+ return fileNames.map((fileName) => path54.join(projectDir, fileName));
263168
263203
  };
263169
263204
 
263170
263205
  // lib/utils/check-org-access.ts
@@ -263180,7 +263215,7 @@ var checkOrgAccess = async (ky4, orgTscircuitHandle) => {
263180
263215
  };
263181
263216
 
263182
263217
  // lib/shared/is-binary-file.ts
263183
- import * as path54 from "node:path";
263218
+ import * as path55 from "node:path";
263184
263219
  var BINARY_FILE_EXTENSIONS = new Set([
263185
263220
  ".glb",
263186
263221
  ".gltf",
@@ -263196,7 +263231,7 @@ var BINARY_FILE_EXTENSIONS = new Set([
263196
263231
  ".tar"
263197
263232
  ]);
263198
263233
  var isBinaryFile = (filePath) => {
263199
- const ext = path54.extname(filePath).toLowerCase();
263234
+ const ext = path55.extname(filePath).toLowerCase();
263200
263235
  return BINARY_FILE_EXTENSIONS.has(ext);
263201
263236
  };
263202
263237
 
@@ -263233,14 +263268,14 @@ var findPushProject = async ({
263233
263268
  return null;
263234
263269
  }
263235
263270
  const packageJsonPath2 = [
263236
- path55.resolve(path55.join(path55.dirname(snippetFilePath2), "package.json")),
263237
- path55.resolve(path55.join(process.cwd(), "package.json"))
263271
+ path56.resolve(path56.join(path56.dirname(snippetFilePath2), "package.json")),
263272
+ path56.resolve(path56.join(process.cwd(), "package.json"))
263238
263273
  ].find((candidatePath) => fs51.existsSync(candidatePath));
263239
- const projectDir2 = packageJsonPath2 ? path55.dirname(packageJsonPath2) : path55.dirname(snippetFilePath2);
263274
+ const projectDir2 = packageJsonPath2 ? path56.dirname(packageJsonPath2) : path56.dirname(snippetFilePath2);
263240
263275
  return { snippetFilePath: snippetFilePath2, packageJsonPath: packageJsonPath2, projectDir: projectDir2 };
263241
263276
  }
263242
263277
  const projectDir = process.cwd();
263243
- const packageJsonPath = path55.resolve(path55.join(projectDir, "package.json"));
263278
+ const packageJsonPath = path56.resolve(path56.join(projectDir, "package.json"));
263244
263279
  if (!fs51.existsSync(packageJsonPath)) {
263245
263280
  return { projectDir };
263246
263281
  }
@@ -263254,7 +263289,7 @@ var findPushProject = async ({
263254
263289
  var getArchivePayload = async (filePaths, projectDir, packageNameWithVersion) => {
263255
263290
  const zip = new import_jszip4.default;
263256
263291
  for (const fullFilePath of filePaths) {
263257
- const relativeFilePath = path55.relative(projectDir, fullFilePath);
263292
+ const relativeFilePath = path56.relative(projectDir, fullFilePath);
263258
263293
  zip.file(relativeFilePath, fs51.readFileSync(fullFilePath));
263259
263294
  }
263260
263295
  const archive = await zip.generateAsync({
@@ -263485,7 +263520,7 @@ var pushSnippet = async ({
263485
263520
  json: archivePayload
263486
263521
  });
263487
263522
  for (const fullFilePath of filePaths) {
263488
- const relativeFilePath = path55.relative(projectDir, fullFilePath);
263523
+ const relativeFilePath = path56.relative(projectDir, fullFilePath);
263489
263524
  uploadResults.succeeded.push(relativeFilePath);
263490
263525
  }
263491
263526
  log(kleur_default.gray(`\uD83D\uDCE6 Uploaded archive with ${filePaths.length} files`));
@@ -263495,7 +263530,7 @@ var pushSnippet = async ({
263495
263530
  }
263496
263531
  if (uploadResults.succeeded.length === 0) {
263497
263532
  for (const fullFilePath of filePaths) {
263498
- const relativeFilePath = path55.relative(projectDir, fullFilePath);
263533
+ const relativeFilePath = path56.relative(projectDir, fullFilePath);
263499
263534
  const fileBuffer = fs51.readFileSync(fullFilePath);
263500
263535
  const isBinary = isBinaryFile(relativeFilePath) || hasBinaryContent(fileBuffer);
263501
263536
  const payload = {
@@ -263586,7 +263621,7 @@ class DevServer {
263586
263621
  }) {
263587
263622
  this.port = port;
263588
263623
  this.componentFilePath = componentFilePath;
263589
- this.projectDir = projectDir ?? path56.dirname(componentFilePath);
263624
+ this.projectDir = projectDir ?? path57.dirname(componentFilePath);
263590
263625
  this.kicadPcm = kicadPcm ?? false;
263591
263626
  const projectConfig2 = loadProjectConfig(this.projectDir);
263592
263627
  this.ignoredFiles = projectConfig2?.ignoredFiles ?? [];
@@ -263597,7 +263632,7 @@ class DevServer {
263597
263632
  async start() {
263598
263633
  const { server } = await createHttpServer({
263599
263634
  port: this.port,
263600
- defaultMainComponentPath: path56.relative(this.projectDir, this.componentFilePath),
263635
+ defaultMainComponentPath: path57.relative(this.projectDir, this.componentFilePath),
263601
263636
  kicadPcm: this.kicadPcm,
263602
263637
  projectDir: this.projectDir,
263603
263638
  entryFile: this.componentFilePath
@@ -263613,7 +263648,7 @@ class DevServer {
263613
263648
  this.filesystemWatcher = watch(this.projectDir, {
263614
263649
  persistent: true,
263615
263650
  ignoreInitial: true,
263616
- ignored: (p3) => shouldIgnorePath(path56.relative(this.projectDir, p3), this.ignoredFiles)
263651
+ ignored: (p3) => shouldIgnorePath(path57.relative(this.projectDir, p3), this.ignoredFiles)
263617
263652
  });
263618
263653
  this.filesystemWatcher.on("change", (filePath) => this.handleFileChangedOnFilesystem(filePath));
263619
263654
  this.filesystemWatcher.on("add", (filePath) => this.handleFileChangedOnFilesystem(filePath));
@@ -263628,8 +263663,8 @@ class DevServer {
263628
263663
  const { file } = await this.fsKy.get("api/files/get", {
263629
263664
  searchParams: { file_path: ev2.file_path }
263630
263665
  }).json();
263631
- const fullPath = path56.join(this.projectDir, ev2.file_path);
263632
- const dirPath = path56.dirname(fullPath);
263666
+ const fullPath = path57.join(this.projectDir, ev2.file_path);
263667
+ const dirPath = path57.dirname(fullPath);
263633
263668
  if (!fs52.existsSync(dirPath)) {
263634
263669
  fs52.mkdirSync(dirPath, { recursive: true });
263635
263670
  }
@@ -263641,14 +263676,14 @@ class DevServer {
263641
263676
  }
263642
263677
  }
263643
263678
  async handleFileDeletedEventFromServer(ev2) {
263644
- const fullPath = path56.join(this.projectDir, ev2.file_path);
263679
+ const fullPath = path57.join(this.projectDir, ev2.file_path);
263645
263680
  if (fs52.existsSync(fullPath)) {
263646
263681
  debug13(`Deleting file ${ev2.file_path} from filesystem`);
263647
263682
  fs52.unlinkSync(fullPath);
263648
263683
  }
263649
263684
  }
263650
263685
  async handleFileChangedOnFilesystem(absoluteFilePath) {
263651
- const relativeFilePath = path56.relative(this.projectDir, absoluteFilePath);
263686
+ const relativeFilePath = path57.relative(this.projectDir, absoluteFilePath);
263652
263687
  if (relativeFilePath.includes("manual-edits.json"))
263653
263688
  return;
263654
263689
  if (shouldIgnorePath(relativeFilePath, this.ignoredFiles))
@@ -263663,14 +263698,14 @@ class DevServer {
263663
263698
  await this.checkAndUploadNewNodeModules(absoluteFilePath);
263664
263699
  }
263665
263700
  async checkAndUploadNewNodeModules(filePath) {
263666
- const ext = path56.extname(filePath).toLowerCase();
263701
+ const ext = path57.extname(filePath).toLowerCase();
263667
263702
  const isSourceFile = [".ts", ".tsx", ".js", ".jsx", ".mjs"].includes(ext);
263668
263703
  if (!isSourceFile)
263669
263704
  return;
263670
263705
  try {
263671
263706
  const nodeModuleFiles = getAllNodeModuleFilePaths(filePath, this.projectDir);
263672
263707
  const newFiles = nodeModuleFiles.filter((file) => {
263673
- const relativePath = path56.relative(this.projectDir, file);
263708
+ const relativePath = path57.relative(this.projectDir, file);
263674
263709
  return !this.uploadedNodeModules.has(relativePath);
263675
263710
  });
263676
263711
  if (newFiles.length === 0)
@@ -263683,7 +263718,7 @@ class DevServer {
263683
263718
  }
263684
263719
  }
263685
263720
  async handleFileRemovedFromFilesystem(absoluteFilePath) {
263686
- const relativeFilePath = path56.relative(this.projectDir, absoluteFilePath);
263721
+ const relativeFilePath = path57.relative(this.projectDir, absoluteFilePath);
263687
263722
  if (shouldIgnorePath(relativeFilePath, this.ignoredFiles))
263688
263723
  return;
263689
263724
  if (!relativeFilePath || relativeFilePath.trim() === "") {
@@ -263721,8 +263756,8 @@ class DevServer {
263721
263756
  debug13(`Successfully deleted file ${relativeFilePath} from server`);
263722
263757
  }
263723
263758
  async handleFileRename(oldPath, newPath) {
263724
- const oldRelativePath = path56.relative(this.projectDir, oldPath);
263725
- const newRelativePath = path56.relative(this.projectDir, newPath);
263759
+ const oldRelativePath = path57.relative(this.projectDir, oldPath);
263760
+ const newRelativePath = path57.relative(this.projectDir, newPath);
263726
263761
  if (shouldIgnorePath(oldRelativePath, this.ignoredFiles) || shouldIgnorePath(newRelativePath, this.ignoredFiles))
263727
263762
  return;
263728
263763
  await this.handleFileRemovedFromFilesystem(oldPath);
@@ -263740,7 +263775,7 @@ class DevServer {
263740
263775
  });
263741
263776
  const filePaths = getPackageFilePaths(this.projectDir, this.ignoredFiles);
263742
263777
  for (const filePath of filePaths) {
263743
- const relativeFilePath = path56.relative(this.projectDir, filePath);
263778
+ const relativeFilePath = path57.relative(this.projectDir, filePath);
263744
263779
  const filePayload = this.createFileUploadPayload(filePath, relativeFilePath);
263745
263780
  await this.postFileUpsert({
263746
263781
  filePath: relativeFilePath,
@@ -263772,7 +263807,7 @@ class DevServer {
263772
263807
  }
263773
263808
  async uploadNodeModuleFiles(files) {
263774
263809
  for (const nodeModuleFile of files) {
263775
- const relativeFilePath = path56.relative(this.projectDir, nodeModuleFile);
263810
+ const relativeFilePath = path57.relative(this.projectDir, nodeModuleFile);
263776
263811
  this.uploadedNodeModules.add(relativeFilePath);
263777
263812
  const filePayload = this.createFileUploadPayload(nodeModuleFile, relativeFilePath);
263778
263813
  await this.postFileUpsert({
@@ -263811,7 +263846,7 @@ class DevServer {
263811
263846
  getInitialNodeModuleDependencyEntryFiles() {
263812
263847
  const entryFiles = [this.componentFilePath];
263813
263848
  for (const configFileName of CONFIG_MODULE_FILENAMES2) {
263814
- const configPath = path56.join(this.projectDir, configFileName);
263849
+ const configPath = path57.join(this.projectDir, configFileName);
263815
263850
  if (fs52.existsSync(configPath)) {
263816
263851
  entryFiles.push(configPath);
263817
263852
  }
@@ -263827,7 +263862,7 @@ class DevServer {
263827
263862
  formData.set("file_path", filePath);
263828
263863
  formData.set("initiator", initiator);
263829
263864
  const binaryBytes = Uint8Array.from(binaryContent);
263830
- formData.set("binary_file", new Blob([binaryBytes]), path56.basename(filePath));
263865
+ formData.set("binary_file", new Blob([binaryBytes]), path57.basename(filePath));
263831
263866
  const response = await fetch(`http://localhost:${this.port}/api/files/upsert-multipart`, {
263832
263867
  method: "POST",
263833
263868
  body: formData
@@ -263867,7 +263902,7 @@ class DevServer {
263867
263902
  await this.filesystemWatcher?.close();
263868
263903
  }
263869
263904
  createFileUploadPayload(absoluteFilePath, relativeFilePath) {
263870
- const ext = path56.extname(relativeFilePath).toLowerCase();
263905
+ const ext = path57.extname(relativeFilePath).toLowerCase();
263871
263906
  if (BINARY_FILE_EXTENSIONS2.has(ext)) {
263872
263907
  const fileBuffer = fs52.readFileSync(absoluteFilePath);
263873
263908
  return { binary_content: fileBuffer };
@@ -263913,7 +263948,7 @@ var isPortAvailable = (port) => {
263913
263948
  });
263914
263949
  };
263915
263950
  var warnIfTsconfigMissingTscircuitType = (projectDir) => {
263916
- const tsconfigPath = path57.join(projectDir, "tsconfig.json");
263951
+ const tsconfigPath = path58.join(projectDir, "tsconfig.json");
263917
263952
  if (!fs53.existsSync(tsconfigPath)) {
263918
263953
  return;
263919
263954
  }
@@ -263950,7 +263985,7 @@ var registerDev = (program2) => {
263950
263985
 
263951
263986
  ${kleur_default.green(`@tscircuit/cli@${getVersion()}`)} ${kleur_default.gray("ready in")} ${kleur_default.white(`${Math.round(timeToStart)}ms`)}`);
263952
263987
  console.log(`
263953
- ${kleur_default.bold("➜ Local:")} ${kleur_default.underline(kleur_default.cyan(`http://localhost:${port}`))}${server.componentFilePath ? kleur_default.underline(kleur_default.cyan(`/#file=${encodeURIComponent(path57.relative(process.cwd(), server.componentFilePath).replaceAll("\\", "/"))}`)) : ""}
263988
+ ${kleur_default.bold("➜ Local:")} ${kleur_default.underline(kleur_default.cyan(`http://localhost:${port}`))}${server.componentFilePath ? kleur_default.underline(kleur_default.cyan(`/#file=${encodeURIComponent(path58.relative(process.cwd(), server.componentFilePath).replaceAll("\\", "/"))}`)) : ""}
263954
263989
 
263955
263990
  `);
263956
263991
  console.log(kleur_default.gray(`Watching ${kleur_default.underline(server.projectDir.split("/").slice(-2).join("/"))} for changes...`));
@@ -263980,13 +264015,13 @@ var checkLoggedIn = () => {
263980
264015
  import { spawnSync } from "node:child_process";
263981
264016
  import fs54 from "node:fs";
263982
264017
  import os7 from "node:os";
263983
- import path58 from "node:path";
264018
+ import path59 from "node:path";
263984
264019
  var hasBunInstalled = () => {
263985
264020
  const result = spawnSync("bun", ["--version"], { stdio: "ignore" });
263986
264021
  return result.status === 0;
263987
264022
  };
263988
264023
  var createTempProject = (tempDir) => {
263989
- const packageJsonPath = path58.join(tempDir, "package.json");
264024
+ const packageJsonPath = path59.join(tempDir, "package.json");
263990
264025
  const packageJson = {
263991
264026
  name: "tsci-doctor-check",
263992
264027
  version: "0.0.0",
@@ -264006,7 +264041,7 @@ var checkGlobalNpmrcRegistry = async () => {
264006
264041
  details: "Bun is required to verify registry settings. Install Bun and rerun `tsci doctor`."
264007
264042
  };
264008
264043
  }
264009
- const tempDir = fs54.mkdtempSync(path58.join(os7.tmpdir(), "tsci-doctor-"));
264044
+ const tempDir = fs54.mkdtempSync(path59.join(os7.tmpdir(), "tsci-doctor-"));
264010
264045
  try {
264011
264046
  createTempProject(tempDir);
264012
264047
  const result = spawnSync("bun", ["install"], {
@@ -264078,7 +264113,7 @@ var registerDoctor = (program2) => {
264078
264113
 
264079
264114
  // lib/shared/export-snippet.ts
264080
264115
  import fs55 from "node:fs";
264081
- import path59 from "node:path";
264116
+ import path60 from "node:path";
264082
264117
  import { promisify as promisify3 } from "node:util";
264083
264118
  import { convertCircuitJsonToGltf as convertCircuitJsonToGltf4 } from "circuit-json-to-gltf";
264084
264119
  import {
@@ -265211,9 +265246,9 @@ var stringifyDsnJson = (dsnJson) => {
265211
265246
  const stringifyCoordinates = (coordinates) => {
265212
265247
  return coordinates.join(" ");
265213
265248
  };
265214
- const stringifyPath = (path59, level) => {
265249
+ const stringifyPath = (path60, level) => {
265215
265250
  const padding = indent.repeat(level);
265216
- return `${padding}(path ${path59.layer} ${path59.width} ${stringifyCoordinates(path59.coordinates)})`;
265251
+ return `${padding}(path ${path60.layer} ${path60.width} ${stringifyCoordinates(path60.coordinates)})`;
265217
265252
  };
265218
265253
  result += `(pcb ${dsnJson.filename ? dsnJson.filename : "./converted_dsn.dsn"}
265219
265254
  `;
@@ -266892,11 +266927,11 @@ var convertSoupToGerberCommands = (soup, opts = {}) => {
266892
266927
  continue;
266893
266928
  }
266894
266929
  const letterPaths = lineAlphabet2[char] || [];
266895
- for (const path59 of letterPaths) {
266896
- const x12 = anchoredX + path59.x1 * fontSize;
266897
- const y12 = anchoredY + path59.y1 * fontSize;
266898
- const x22 = anchoredX + path59.x2 * fontSize;
266899
- const y22 = anchoredY + path59.y2 * fontSize;
266930
+ for (const path60 of letterPaths) {
266931
+ const x12 = anchoredX + path60.x1 * fontSize;
266932
+ const y12 = anchoredY + path60.y1 * fontSize;
266933
+ const x22 = anchoredX + path60.x2 * fontSize;
266934
+ const y22 = anchoredY + path60.y2 * fontSize;
266900
266935
  const p12 = applyTransform({ x: x12, y: y12 });
266901
266936
  const p23 = applyTransform({ x: x22, y: y22 });
266902
266937
  gerber.add("move_operation", { x: p12.x, y: mfy(p12.y) });
@@ -267670,10 +267705,10 @@ var exportSnippet = async ({
267670
267705
  onError(`Invalid format: ${format}`);
267671
267706
  return onExit(1);
267672
267707
  }
267673
- const projectDir = path59.dirname(filePath);
267674
- const outputBaseName = path59.basename(filePath).replace(/\.[^.]+$/, "");
267708
+ const projectDir = path60.dirname(filePath);
267709
+ const outputBaseName = path60.basename(filePath).replace(/\.[^.]+$/, "");
267675
267710
  const outputFileName = `${outputBaseName}${OUTPUT_EXTENSIONS[format]}`;
267676
- const outputDestination = path59.join(projectDir, outputPath ?? outputFileName);
267711
+ const outputDestination = path60.join(projectDir, outputPath ?? outputFileName);
267677
267712
  if (format === "kicad-library") {
267678
267713
  try {
267679
267714
  const result = await convertToKicadLibrary({
@@ -267785,7 +267820,7 @@ var exportSnippet = async ({
267785
267820
  model3dSourcePaths: pcbConverter.getModel3dSourcePaths(),
267786
267821
  projectName: outputBaseName,
267787
267822
  fetch: platformConfig2?.platformFetch ?? globalThis.fetch,
267788
- readFile: (modelPath) => fs55.promises.readFile(path59.resolve(projectDir, modelPath)),
267823
+ readFile: (modelPath) => fs55.promises.readFile(path60.resolve(projectDir, modelPath)),
267789
267824
  onModelFile: ({ outputPath: outputPath2, content }) => {
267790
267825
  zip.file(outputPath2, content);
267791
267826
  },
@@ -267966,13 +268001,13 @@ var getSpiceWithPaddedSim = (circuitJson, options) => {
267966
268001
  };
267967
268002
 
267968
268003
  // lib/eecircuit-engine/run-simulation.ts
267969
- import { promises as fs56, existsSync as existsSync14 } from "node:fs";
267970
- import path60 from "node:path";
268004
+ import { promises as fs56, existsSync as existsSync15 } from "node:fs";
268005
+ import path61 from "node:path";
267971
268006
  import os8 from "node:os";
267972
268007
  var sim = null;
267973
268008
  var fetchSimulation = async () => {
267974
- const tempFilePath = path60.join(os8.tmpdir(), `tscircuit-eecircuit-engine-1.7.4.mjs`);
267975
- if (!existsSync14(tempFilePath)) {
268009
+ const tempFilePath = path61.join(os8.tmpdir(), `tscircuit-eecircuit-engine-1.7.4.mjs`);
268010
+ if (!existsSync15(tempFilePath)) {
267976
268011
  const url2 = `https://jscdn.tscircuit.com/@tscircuit/eecircuit-engine/1.7.4/dist/eecircuit-engine.mjs`;
267977
268012
  const response = await fetch(url2);
267978
268013
  if (!response.ok) {
@@ -268068,7 +268103,7 @@ var resultToCsv = (result) => {
268068
268103
  };
268069
268104
 
268070
268105
  // cli/export/register.ts
268071
- import path61 from "node:path";
268106
+ import path62 from "node:path";
268072
268107
  import { promises as fs57 } from "node:fs";
268073
268108
  var registerExport = (program2) => {
268074
268109
  program2.command("export").description("Export tscircuit code to various formats").argument("<file>", "Path to the package file").option("-f, --format <format>", `Output format (${ALLOWED_EXPORT_FORMATS.join(", ")})`).option("-o, --output <path>", "Output file path").option("--disable-parts-engine", "Disable the parts engine").option("--show-courtyards", "Show courtyard outlines in PCB SVG output").action(async (file, options) => {
@@ -268083,7 +268118,7 @@ var registerExport = (program2) => {
268083
268118
  });
268084
268119
  if (circuitJson) {
268085
268120
  const spiceString = getSpiceWithPaddedSim(circuitJson);
268086
- const outputSpicePath = options.output ?? path61.join(path61.dirname(file), `${path61.basename(file, path61.extname(file))}.spice.cir`);
268121
+ const outputSpicePath = options.output ?? path62.join(path62.dirname(file), `${path62.basename(file, path62.extname(file))}.spice.cir`);
268087
268122
  await fs57.writeFile(outputSpicePath, spiceString);
268088
268123
  const { result } = await runSimulation(spiceString);
268089
268124
  const csvContent = resultToCsv(result);
@@ -268810,8 +268845,8 @@ function getErrorMap2() {
268810
268845
  return overrideErrorMap2;
268811
268846
  }
268812
268847
  var makeIssue2 = (params2) => {
268813
- const { data, path: path62, errorMaps, issueData } = params2;
268814
- const fullPath = [...path62, ...issueData.path || []];
268848
+ const { data, path: path63, errorMaps, issueData } = params2;
268849
+ const fullPath = [...path63, ...issueData.path || []];
268815
268850
  const fullIssue = {
268816
268851
  ...issueData,
268817
268852
  path: fullPath
@@ -268919,11 +268954,11 @@ var errorUtil2;
268919
268954
  errorUtil22.toString = (message) => typeof message === "string" ? message : message?.message;
268920
268955
  })(errorUtil2 || (errorUtil2 = {}));
268921
268956
  var ParseInputLazyPath2 = class {
268922
- constructor(parent, value, path62, key) {
268957
+ constructor(parent, value, path63, key) {
268923
268958
  this._cachedPath = [];
268924
268959
  this.parent = parent;
268925
268960
  this.data = value;
268926
- this._path = path62;
268961
+ this._path = path63;
268927
268962
  this._key = key;
268928
268963
  }
268929
268964
  get path() {
@@ -276592,15 +276627,15 @@ function generateArcFromSweep(startX, startY, endX, endY, radius, largeArcFlag,
276592
276627
  }
276593
276628
  }
276594
276629
  const numPoints = Math.max(2, Math.ceil(Math.abs(endAngle - startAngle) * radius));
276595
- const path62 = [];
276630
+ const path63 = [];
276596
276631
  for (let i3 = 0;i3 <= numPoints; i3++) {
276597
276632
  const t50 = i3 / numPoints;
276598
276633
  const angle2 = startAngle + t50 * (endAngle - startAngle);
276599
276634
  const x4 = centerX + radius * Math.cos(angle2);
276600
276635
  const y4 = centerY + radius * Math.sin(angle2);
276601
- path62.push({ x: x4, y: y4 });
276636
+ path63.push({ x: x4, y: y4 });
276602
276637
  }
276603
- return path62;
276638
+ return path63;
276604
276639
  }
276605
276640
  var mil10ToMm = (value) => value * 10 * 0.0254;
276606
276641
  var getBoundsCenter = (bounds) => ({
@@ -277771,7 +277806,7 @@ var parsePin = (pinString) => {
277771
277806
  const colorMatch = pinString.match(/#[0-9A-F]{6}/);
277772
277807
  const labelColor = colorMatch ? colorMatch[0] : "";
277773
277808
  const pathMatch = pinString.match(/\^\^([^~]+)/);
277774
- const path62 = pathMatch ? pathMatch[1] : "";
277809
+ const path63 = pathMatch ? pathMatch[1] : "";
277775
277810
  const arrowMatch = pinString.match(/\^\^0~(.+)$/);
277776
277811
  const arrow = arrowMatch ? arrowMatch[1] : "";
277777
277812
  const r4 = Number.parseFloat(rotation23);
@@ -277785,7 +277820,7 @@ var parsePin = (pinString) => {
277785
277820
  rotation: Number.isNaN(r4) ? 0 : r4,
277786
277821
  label,
277787
277822
  labelColor,
277788
- path: path62,
277823
+ path: path63,
277789
277824
  arrow
277790
277825
  };
277791
277826
  };
@@ -283375,15 +283410,15 @@ function generateArcFromSweep2(startX, startY, endX, endY, radius, largeArcFlag,
283375
283410
  }
283376
283411
  }
283377
283412
  const numPoints = Math.max(2, Math.ceil(Math.abs(endAngle - startAngle) * radius));
283378
- const path62 = [];
283413
+ const path63 = [];
283379
283414
  for (let i3 = 0;i3 <= numPoints; i3++) {
283380
283415
  const t50 = i3 / numPoints;
283381
283416
  const angle2 = startAngle + t50 * (endAngle - startAngle);
283382
283417
  const x4 = centerX + radius * Math.cos(angle2);
283383
283418
  const y4 = centerY + radius * Math.sin(angle2);
283384
- path62.push({ x: x4, y: y4 });
283419
+ path63.push({ x: x4, y: y4 });
283385
283420
  }
283386
- return path62;
283421
+ return path63;
283387
283422
  }
283388
283423
  var mil10ToMm2 = (value) => value * 10 * 0.0254;
283389
283424
  var getBoundsCenter2 = (bounds) => ({
@@ -284540,7 +284575,7 @@ var parsePin2 = (pinString) => {
284540
284575
  const colorMatch = pinString.match(/#[0-9A-F]{6}/);
284541
284576
  const labelColor = colorMatch ? colorMatch[0] : "";
284542
284577
  const pathMatch = pinString.match(/\^\^([^~]+)/);
284543
- const path62 = pathMatch ? pathMatch[1] : "";
284578
+ const path63 = pathMatch ? pathMatch[1] : "";
284544
284579
  const arrowMatch = pinString.match(/\^\^0~(.+)$/);
284545
284580
  const arrow = arrowMatch ? arrowMatch[1] : "";
284546
284581
  const r4 = Number.parseFloat(rotation23);
@@ -284554,7 +284589,7 @@ var parsePin2 = (pinString) => {
284554
284589
  rotation: Number.isNaN(r4) ? 0 : r4,
284555
284590
  label,
284556
284591
  labelColor,
284557
- path: path62,
284592
+ path: path63,
284558
284593
  arrow
284559
284594
  };
284560
284595
  };
@@ -284877,14 +284912,14 @@ function normalizeManufacturerPartNumber2(partNumber) {
284877
284912
 
284878
284913
  // lib/import/import-component-from-jlcpcb.ts
284879
284914
  import fs58 from "node:fs/promises";
284880
- import path62 from "node:path";
284915
+ import path63 from "node:path";
284881
284916
  var importComponentFromJlcpcb = async (jlcpcbPartNumber, projectDir = process.cwd(), options = {}) => {
284882
284917
  const rawEasy = await fetchEasyEDAComponent(jlcpcbPartNumber);
284883
284918
  const betterEasy = EasyEdaJsonSchema2.parse(rawEasy);
284884
284919
  const rawPn = betterEasy.dataStr.head.c_para["Manufacturer Part"];
284885
284920
  const componentName = rawPn ? normalizeManufacturerPartNumber2(rawPn) : jlcpcbPartNumber;
284886
284921
  let tsx = await convertRawEasyToTsx({ rawEasy });
284887
- const componentDir = options.download ? path62.join(projectDir, "imports", componentName) : path62.join(projectDir, "imports");
284922
+ const componentDir = options.download ? path63.join(projectDir, "imports", componentName) : path63.join(projectDir, "imports");
284888
284923
  await fs58.mkdir(componentDir, { recursive: true });
284889
284924
  if (options.download) {
284890
284925
  const platformConfig2 = getPlatformConfigWithCliDefaults();
@@ -284896,7 +284931,7 @@ var importComponentFromJlcpcb = async (jlcpcbPartNumber, projectDir = process.cw
284896
284931
  if (cadComponent?.model_step_url) {
284897
284932
  const stepFileName = `${componentName}.step`;
284898
284933
  const stepResp = await platformFetch2(cadComponent.model_step_url);
284899
- await fs58.writeFile(path62.join(componentDir, stepFileName), Buffer.from(await stepResp.arrayBuffer()));
284934
+ await fs58.writeFile(path63.join(componentDir, stepFileName), Buffer.from(await stepResp.arrayBuffer()));
284900
284935
  tsx = `import stepPath from "./${stepFileName}"
284901
284936
  ` + tsx;
284902
284937
  tsx = tsx.replace(`"${cadComponent.model_step_url}"`, "stepPath");
@@ -284904,13 +284939,13 @@ var importComponentFromJlcpcb = async (jlcpcbPartNumber, projectDir = process.cw
284904
284939
  if (cadComponent?.model_obj_url) {
284905
284940
  const objFileName = `${componentName}.obj`;
284906
284941
  const objResp = await platformFetch2(cadComponent.model_obj_url);
284907
- await fs58.writeFile(path62.join(componentDir, objFileName), Buffer.from(await objResp.arrayBuffer()));
284942
+ await fs58.writeFile(path63.join(componentDir, objFileName), Buffer.from(await objResp.arrayBuffer()));
284908
284943
  tsx = `import objPath from "./${objFileName}"
284909
284944
  ` + tsx;
284910
284945
  tsx = tsx.replace(`"${cadComponent.model_obj_url}"`, "objPath");
284911
284946
  }
284912
284947
  }
284913
- const filePath = path62.join(componentDir, `${componentName}.tsx`);
284948
+ const filePath = path63.join(componentDir, `${componentName}.tsx`);
284914
284949
  await fs58.writeFile(filePath, tsx);
284915
284950
  return { filePath };
284916
284951
  };
@@ -286353,12 +286388,12 @@ var registerImport = (program2) => {
286353
286388
 
286354
286389
  // cli/init/register.ts
286355
286390
  import * as fs60 from "node:fs";
286356
- import * as path65 from "node:path";
286391
+ import * as path66 from "node:path";
286357
286392
 
286358
286393
  // lib/shared/generate-gitignore-file.ts
286359
- import path63 from "node:path";
286394
+ import path64 from "node:path";
286360
286395
  var generateGitIgnoreFile = (dir) => {
286361
- const gitignorePath = path63.join(dir, ".gitignore");
286396
+ const gitignorePath = path64.join(dir, ".gitignore");
286362
286397
  const gitignoreContent = `# Dependencies
286363
286398
  node_modules/
286364
286399
 
@@ -286394,7 +286429,7 @@ yarn-error.log*
286394
286429
 
286395
286430
  // lib/shared/setup-tscircuit-skill.ts
286396
286431
  import * as fs59 from "node:fs";
286397
- import * as path64 from "node:path";
286432
+ import * as path65 from "node:path";
286398
286433
  var SKILL_REPO_API_URL = "https://api.github.com/repos/tscircuit/skill/contents";
286399
286434
  var SKILL_INSTALL_PATHS = [
286400
286435
  ".claude/skills/tscircuit",
@@ -286417,7 +286452,7 @@ async function fetchFileContent(downloadUrl) {
286417
286452
  async function downloadDirectory(apiUrl, targetDir) {
286418
286453
  const contents = await fetchGitHubContents(apiUrl);
286419
286454
  for (const item of contents) {
286420
- const targetPath = path64.join(targetDir, item.name);
286455
+ const targetPath = path65.join(targetDir, item.name);
286421
286456
  if (item.type === "dir") {
286422
286457
  fs59.mkdirSync(targetPath, { recursive: true });
286423
286458
  await downloadDirectory(`${apiUrl}/${item.name}`, targetPath);
@@ -286434,7 +286469,7 @@ async function downloadSkillRepo(targetDir) {
286434
286469
  if (item.name === ".git" || item.name === ".github") {
286435
286470
  continue;
286436
286471
  }
286437
- const targetPath = path64.join(targetDir, item.name);
286472
+ const targetPath = path65.join(targetDir, item.name);
286438
286473
  if (item.type === "dir") {
286439
286474
  fs59.mkdirSync(targetPath, { recursive: true });
286440
286475
  await downloadDirectory(`${SKILL_REPO_API_URL}/${item.name}`, targetPath);
@@ -286445,7 +286480,7 @@ async function downloadSkillRepo(targetDir) {
286445
286480
  }
286446
286481
  }
286447
286482
  async function setupTscircuitSkill(projectDir, skipPrompt = false) {
286448
- const missingSkillPaths = SKILL_INSTALL_PATHS.filter((skillPath) => !fs59.existsSync(path64.join(projectDir, skillPath, "SKILL.md")));
286483
+ const missingSkillPaths = SKILL_INSTALL_PATHS.filter((skillPath) => !fs59.existsSync(path65.join(projectDir, skillPath, "SKILL.md")));
286449
286484
  if (missingSkillPaths.length === 0) {
286450
286485
  console.log("TSCircuit AI skills already exist, skipping...");
286451
286486
  return true;
@@ -286465,7 +286500,7 @@ async function setupTscircuitSkill(projectDir, skipPrompt = false) {
286465
286500
  console.info("Setting up tscircuit AI skills...");
286466
286501
  try {
286467
286502
  for (const skillPath of missingSkillPaths) {
286468
- const targetDir = path64.join(projectDir, skillPath);
286503
+ const targetDir = path65.join(projectDir, skillPath);
286469
286504
  await downloadSkillRepo(targetDir);
286470
286505
  console.info(`tscircuit skill installed at ${skillPath}`);
286471
286506
  }
@@ -286550,7 +286585,7 @@ var POSTHOG_HOST = "https://us.i.posthog.com";
286550
286585
  var TSCI_POSTHOG_PROJECT_API_KEY = "phc_htd8AQjSfVEsFCLQMAiUooG4Q0DKBCjqYuQglc9V3Wo";
286551
286586
  var POSTHOG_CAPTURE_PATH = "/capture";
286552
286587
  var isTruthy4 = (value) => value ? ["1", "true", "yes", "on"].includes(value.toLowerCase()) : false;
286553
- var joinUrl = (host, path65) => `${host.replace(/\/$/, "")}${path65}`;
286588
+ var joinUrl = (host, path66) => `${host.replace(/\/$/, "")}${path66}`;
286554
286589
  var getTelemetryConfigFromEnv = (env3 = process.env) => {
286555
286590
  if (isTruthy4(env3.TSCI_TELEMETRY_DISABLED)) {
286556
286591
  return { enabled: false };
@@ -286618,7 +286653,7 @@ var registerInit = (program3) => {
286618
286653
  }
286619
286654
  }
286620
286655
  }
286621
- const projectDir = directory ? path65.resolve(process.cwd(), directory) : process.cwd();
286656
+ const projectDir = directory ? path66.resolve(process.cwd(), directory) : process.cwd();
286622
286657
  let tsciHandle = null;
286623
286658
  const token = getSessionToken();
286624
286659
  if (token) {
@@ -286629,7 +286664,7 @@ var registerInit = (program3) => {
286629
286664
  }
286630
286665
  } catch {}
286631
286666
  }
286632
- const dirName = path65.basename(projectDir);
286667
+ const dirName = path66.basename(projectDir);
286633
286668
  let defaultPackageName = dirName;
286634
286669
  if (tsciHandle) {
286635
286670
  defaultPackageName = `@tsci/${tsciHandle}.${dirName}`;
@@ -286648,7 +286683,7 @@ var registerInit = (program3) => {
286648
286683
  }
286649
286684
  }
286650
286685
  fs60.mkdirSync(projectDir, { recursive: true });
286651
- writeFileIfNotExists(path65.join(projectDir, "index.circuit.tsx"), `
286686
+ writeFileIfNotExists(path66.join(projectDir, "index.circuit.tsx"), `
286652
286687
  export default () => (
286653
286688
  <board>
286654
286689
  <resistor resistance="1k" footprint="0402" name="R1" />
@@ -286660,7 +286695,7 @@ export default () => (
286660
286695
  if (saveProjectConfig(null, projectDir)) {
286661
286696
  console.log("Created tscircuit.config.json with schema");
286662
286697
  }
286663
- writeFileIfNotExists(path65.join(projectDir, ".npmrc"), `
286698
+ writeFileIfNotExists(path66.join(projectDir, ".npmrc"), `
286664
286699
  @tsci:registry=https://npm.tscircuit.com
286665
286700
  `);
286666
286701
  console.log("Generating package.json");
@@ -286799,9 +286834,9 @@ var registerRegistryPackagesCreate = (program3) => {
286799
286834
 
286800
286835
  // cli/registry/packages/update/register.ts
286801
286836
  import fs61 from "node:fs";
286802
- import path66 from "node:path";
286837
+ import path67 from "node:path";
286803
286838
  var getCurrentDirectoryPackageName = () => {
286804
- const packageJsonPath = path66.join(process.cwd(), "package.json");
286839
+ const packageJsonPath = path67.join(process.cwd(), "package.json");
286805
286840
  if (!fs61.existsSync(packageJsonPath))
286806
286841
  return;
286807
286842
  try {
@@ -286942,14 +286977,14 @@ var KeyStore = class {
286942
286977
  }
286943
286978
  };
286944
286979
  function createKey(key) {
286945
- let path67 = null;
286980
+ let path68 = null;
286946
286981
  let id2 = null;
286947
286982
  let src = null;
286948
286983
  let weight = 1;
286949
286984
  let getFn = null;
286950
286985
  if (isString2(key) || isArray(key)) {
286951
286986
  src = key;
286952
- path67 = createKeyPath(key);
286987
+ path68 = createKeyPath(key);
286953
286988
  id2 = createKeyId(key);
286954
286989
  } else {
286955
286990
  if (!hasOwn.call(key, "name"))
@@ -286961,12 +286996,12 @@ function createKey(key) {
286961
286996
  if (weight <= 0)
286962
286997
  throw new Error(INVALID_KEY_WEIGHT_VALUE(createKeyId(name)));
286963
286998
  }
286964
- path67 = createKeyPath(name);
286999
+ path68 = createKeyPath(name);
286965
287000
  id2 = createKeyId(name);
286966
287001
  getFn = key.getFn ?? null;
286967
287002
  }
286968
287003
  return {
286969
- path: path67,
287004
+ path: path68,
286970
287005
  id: id2,
286971
287006
  weight,
286972
287007
  src,
@@ -286979,22 +287014,22 @@ function createKeyPath(key) {
286979
287014
  function createKeyId(key) {
286980
287015
  return isArray(key) ? key.join(".") : key;
286981
287016
  }
286982
- function get(obj, path67) {
287017
+ function get(obj, path68) {
286983
287018
  const list = [];
286984
287019
  let arr = false;
286985
- const deepGet = (obj2, path68, index, arrayIndex) => {
287020
+ const deepGet = (obj2, path69, index, arrayIndex) => {
286986
287021
  if (!isDefined(obj2))
286987
287022
  return;
286988
- if (!path68[index])
287023
+ if (!path69[index])
286989
287024
  list.push(arrayIndex !== undefined ? {
286990
287025
  v: obj2,
286991
287026
  i: arrayIndex
286992
287027
  } : obj2);
286993
287028
  else {
286994
- const value = obj2[path68[index]];
287029
+ const value = obj2[path69[index]];
286995
287030
  if (!isDefined(value))
286996
287031
  return;
286997
- if (index === path68.length - 1 && (isString2(value) || isNumber2(value) || isBoolean(value) || typeof value === "bigint"))
287032
+ if (index === path69.length - 1 && (isString2(value) || isNumber2(value) || isBoolean(value) || typeof value === "bigint"))
286998
287033
  list.push(arrayIndex !== undefined ? {
286999
287034
  v: toString2(value),
287000
287035
  i: arrayIndex
@@ -287002,12 +287037,12 @@ function get(obj, path67) {
287002
287037
  else if (isArray(value)) {
287003
287038
  arr = true;
287004
287039
  for (let i3 = 0, len = value.length;i3 < len; i3 += 1)
287005
- deepGet(value[i3], path68, index + 1, i3);
287006
- } else if (path68.length)
287007
- deepGet(value, path68, index + 1, arrayIndex);
287040
+ deepGet(value[i3], path69, index + 1, i3);
287041
+ } else if (path69.length)
287042
+ deepGet(value, path69, index + 1, arrayIndex);
287008
287043
  }
287009
287044
  };
287010
- deepGet(obj, isString2(path67) ? path67.split(".") : path67, 0);
287045
+ deepGet(obj, isString2(path68) ? path68.split(".") : path68, 0);
287011
287046
  return arr ? list : list[0];
287012
287047
  }
287013
287048
  var MatchOptions = {
@@ -288683,8 +288718,8 @@ function createBridgeHeaders(partnerToken, accept) {
288683
288718
  }
288684
288719
  return headers;
288685
288720
  }
288686
- function buildRequestUrl(baseUrl, path67) {
288687
- return `${normalizeBaseUrl(baseUrl)}${path67}`;
288721
+ function buildRequestUrl(baseUrl, path68) {
288722
+ return `${normalizeBaseUrl(baseUrl)}${path68}`;
288688
288723
  }
288689
288724
  function logRequest(logger, url2) {
288690
288725
  if (!logger)
@@ -288718,8 +288753,8 @@ function createBridgeHeaders2(partnerToken, accept) {
288718
288753
  }
288719
288754
  return headers;
288720
288755
  }
288721
- function buildRequestUrl2(baseUrl, path67) {
288722
- return `${normalizeBaseUrl(baseUrl)}${path67}`;
288756
+ function buildRequestUrl2(baseUrl, path68) {
288757
+ return `${normalizeBaseUrl(baseUrl)}${path68}`;
288723
288758
  }
288724
288759
  function logRequest2(logger, url2) {
288725
288760
  if (!logger)
@@ -288767,11 +288802,11 @@ function createUltraLibrarianBridgeClient(options = {}) {
288767
288802
  return {
288768
288803
  baseUrl,
288769
288804
  async searchParts(request) {
288770
- const path67 = buildSearchPath(request);
288805
+ const path68 = buildSearchPath(request);
288771
288806
  const rawPayload = await requestJson({
288772
288807
  fetchImpl,
288773
288808
  baseUrl,
288774
- path: path67,
288809
+ path: path68,
288775
288810
  partnerToken,
288776
288811
  logger
288777
288812
  });
@@ -288781,11 +288816,11 @@ function createUltraLibrarianBridgeClient(options = {}) {
288781
288816
  };
288782
288817
  },
288783
288818
  async downloadKicadArchive(request) {
288784
- const path67 = buildKicadExportPath(request);
288819
+ const path68 = buildKicadExportPath(request);
288785
288820
  return await requestArchive({
288786
288821
  fetchImpl,
288787
288822
  baseUrl,
288788
- path: path67,
288823
+ path: path68,
288789
288824
  partnerToken,
288790
288825
  logger
288791
288826
  });
@@ -288896,9 +288931,9 @@ var registerSearch = (program3) => {
288896
288931
  }
288897
288932
  if (opts.json) {
288898
288933
  const unifiedResults = [
288899
- ...kicadResults.map((path67) => ({
288934
+ ...kicadResults.map((path68) => ({
288900
288935
  source: "kicad",
288901
- path: path67
288936
+ path: path68
288902
288937
  })),
288903
288938
  ...results.packages.map((pkg) => ({
288904
288939
  source: "tscircuit",
@@ -288931,8 +288966,8 @@ var registerSearch = (program3) => {
288931
288966
  }
288932
288967
  if (kicadResults.length) {
288933
288968
  console.log(kleur_default.bold().underline(`Found ${kicadResults.length} footprint(s) from KiCad:`));
288934
- kicadResults.forEach((path67, idx) => {
288935
- console.log(`${(idx + 1).toString().padStart(2, " ")}. kicad:${path67.replace(".kicad_mod", "").replace(".pretty", "")}`);
288969
+ kicadResults.forEach((path68, idx) => {
288970
+ console.log(`${(idx + 1).toString().padStart(2, " ")}. kicad:${path68.replace(".kicad_mod", "").replace(".pretty", "")}`);
288936
288971
  });
288937
288972
  }
288938
288973
  if (results.packages.length) {
@@ -288970,20 +289005,20 @@ var registerSearch = (program3) => {
288970
289005
 
288971
289006
  // lib/shared/setup-github-actions.ts
288972
289007
  import fs62 from "node:fs";
288973
- import path67 from "node:path";
289008
+ import path68 from "node:path";
288974
289009
  var setupGithubActions = (projectDir = process.cwd()) => {
288975
289010
  const findGitRoot = (startDir) => {
288976
- let dir = path67.resolve(startDir);
288977
- while (dir !== path67.parse(dir).root) {
288978
- if (fs62.existsSync(path67.join(dir, ".git"))) {
289011
+ let dir = path68.resolve(startDir);
289012
+ while (dir !== path68.parse(dir).root) {
289013
+ if (fs62.existsSync(path68.join(dir, ".git"))) {
288979
289014
  return dir;
288980
289015
  }
288981
- dir = path67.dirname(dir);
289016
+ dir = path68.dirname(dir);
288982
289017
  }
288983
289018
  return null;
288984
289019
  };
288985
289020
  const gitRoot = findGitRoot(projectDir) ?? projectDir;
288986
- const workflowsDir = path67.join(gitRoot, ".github", "workflows");
289021
+ const workflowsDir = path68.join(gitRoot, ".github", "workflows");
288987
289022
  fs62.mkdirSync(workflowsDir, { recursive: true });
288988
289023
  const buildWorkflow = `name: tscircuit Build
288989
289024
 
@@ -289023,8 +289058,8 @@ jobs:
289023
289058
  - run: bun install
289024
289059
  - run: bunx tsci snapshot
289025
289060
  `;
289026
- writeFileIfNotExists(path67.join(workflowsDir, "tscircuit-build.yml"), buildWorkflow);
289027
- writeFileIfNotExists(path67.join(workflowsDir, "tscircuit-snapshot.yml"), snapshotWorkflow);
289061
+ writeFileIfNotExists(path68.join(workflowsDir, "tscircuit-build.yml"), buildWorkflow);
289062
+ writeFileIfNotExists(path68.join(workflowsDir, "tscircuit-snapshot.yml"), snapshotWorkflow);
289028
289063
  };
289029
289064
 
289030
289065
  // cli/setup/register.ts
@@ -289139,21 +289174,21 @@ var registerSimulate = (program3) => {
289139
289174
 
289140
289175
  // lib/shared/snapshot-project.ts
289141
289176
  import fs66 from "node:fs";
289142
- import path70 from "node:path";
289177
+ import path71 from "node:path";
289143
289178
 
289144
289179
  // cli/snapshot/worker-pool.ts
289145
289180
  import fs63 from "node:fs";
289146
- import path68 from "node:path";
289181
+ import path69 from "node:path";
289147
289182
  var getWorkerEntrypointPath2 = () => {
289148
- const tsPath = path68.join(import.meta.dir, "snapshot.worker.ts");
289183
+ const tsPath = path69.join(import.meta.dir, "snapshot.worker.ts");
289149
289184
  if (fs63.existsSync(tsPath)) {
289150
289185
  return tsPath;
289151
289186
  }
289152
- const jsBundledPath = path68.join(import.meta.dir, "snapshot", "snapshot.worker.js");
289187
+ const jsBundledPath = path69.join(import.meta.dir, "snapshot", "snapshot.worker.js");
289153
289188
  if (fs63.existsSync(jsBundledPath)) {
289154
289189
  return jsBundledPath;
289155
289190
  }
289156
- return path68.join(import.meta.dir, "snapshot.worker.js");
289191
+ return path69.join(import.meta.dir, "snapshot.worker.js");
289157
289192
  };
289158
289193
  var snapshotFilesWithWorkerPool = async (options) => {
289159
289194
  const cancellationError = new Error("Snapshot cancelled due to file failure");
@@ -289224,7 +289259,7 @@ var snapshotFilesWithWorkerPool = async (options) => {
289224
289259
 
289225
289260
  // lib/shared/process-snapshot-file.ts
289226
289261
  import fs65 from "node:fs";
289227
- import path69 from "node:path";
289262
+ import path70 from "node:path";
289228
289263
  import {
289229
289264
  convertCircuitJsonToPcbSvg as convertCircuitJsonToPcbSvg5,
289230
289265
  convertCircuitJsonToSchematicSvg as convertCircuitJsonToSchematicSvg5
@@ -289273,7 +289308,7 @@ var processSnapshotFile = async ({
289273
289308
  cameraPreset,
289274
289309
  pcbLayer
289275
289310
  }) => {
289276
- const relativeFilePath = path69.relative(projectDir, file);
289311
+ const relativeFilePath = path70.relative(projectDir, file);
289277
289312
  const successPaths = [];
289278
289313
  const warningMessages = [];
289279
289314
  const mismatches = [];
@@ -289368,11 +289403,11 @@ var processSnapshotFile = async ({
289368
289403
  } catch (error2) {
289369
289404
  const errorMessage = error2 instanceof Error ? error2.message : String(error2);
289370
289405
  if (errorMessage.includes("No pcb_board found in circuit JSON")) {
289371
- const fileDir = path69.dirname(file);
289372
- const relativeDir = path69.relative(projectDir, fileDir);
289373
- const snapDir2 = snapshotsDirName ? path69.join(projectDir, snapshotsDirName, relativeDir) : path69.join(fileDir, "__snapshots__");
289374
- const base2 = path69.basename(file).replace(/\.[^.]+$/, "");
289375
- const snap3dPath = path69.join(snapDir2, `${base2}-3d.snap.png`);
289406
+ const fileDir = path70.dirname(file);
289407
+ const relativeDir = path70.relative(projectDir, fileDir);
289408
+ const snapDir2 = snapshotsDirName ? path70.join(projectDir, snapshotsDirName, relativeDir) : path70.join(fileDir, "__snapshots__");
289409
+ const base2 = path70.basename(file).replace(/\.[^.]+$/, "");
289410
+ const snap3dPath = path70.join(snapDir2, `${base2}-3d.snap.png`);
289376
289411
  const existing3dSnapshot = fs65.existsSync(snap3dPath);
289377
289412
  if (existing3dSnapshot) {
289378
289413
  return {
@@ -289384,7 +289419,7 @@ var processSnapshotFile = async ({
289384
289419
  errorMessage: kleur_default.red(`
289385
289420
  ❌ Failed to generate 3D snapshot for ${relativeFilePath}:
289386
289421
  `) + kleur_default.red(` No pcb_board found in circuit JSON
289387
- `) + kleur_default.red(` Existing snapshot: ${path69.relative(projectDir, snap3dPath)}
289422
+ `) + kleur_default.red(` Existing snapshot: ${path70.relative(projectDir, snap3dPath)}
289388
289423
  `)
289389
289424
  };
289390
289425
  }
@@ -289405,9 +289440,9 @@ var processSnapshotFile = async ({
289405
289440
  }
289406
289441
  }
289407
289442
  }
289408
- const snapDir = snapshotsDirName ? path69.join(projectDir, snapshotsDirName, path69.relative(projectDir, path69.dirname(file))) : path69.join(path69.dirname(file), "__snapshots__");
289443
+ const snapDir = snapshotsDirName ? path70.join(projectDir, snapshotsDirName, path70.relative(projectDir, path70.dirname(file))) : path70.join(path70.dirname(file), "__snapshots__");
289409
289444
  fs65.mkdirSync(snapDir, { recursive: true });
289410
- const base = path69.basename(file).replace(/\.[^.]+$/, "");
289445
+ const base = path70.basename(file).replace(/\.[^.]+$/, "");
289411
289446
  const snapshots = [];
289412
289447
  if (!simulationOnly && (pcbOnly || !schematicOnly)) {
289413
289448
  let pcbSnapshotType = "pcb";
@@ -289441,13 +289476,13 @@ var processSnapshotFile = async ({
289441
289476
  for (const snapshot of snapshots) {
289442
289477
  const { type } = snapshot;
289443
289478
  const is3d = type === "3d";
289444
- const snapPath = path69.join(snapDir, `${base}-${type}.snap.${is3d ? "png" : "svg"}`);
289479
+ const snapPath = path70.join(snapDir, `${base}-${type}.snap.${is3d ? "png" : "svg"}`);
289445
289480
  const existing = fs65.existsSync(snapPath);
289446
289481
  const newContentBuffer = snapshot.isBinary ? snapshot.content : Buffer.from(snapshot.content, "utf8");
289447
289482
  const newContentForFile = snapshot.content;
289448
289483
  if (!existing) {
289449
289484
  fs65.writeFileSync(snapPath, newContentForFile);
289450
- successPaths.push(path69.relative(projectDir, snapPath));
289485
+ successPaths.push(path70.relative(projectDir, snapPath));
289451
289486
  didUpdate = true;
289452
289487
  continue;
289453
289488
  }
@@ -289463,16 +289498,16 @@ var processSnapshotFile = async ({
289463
289498
  }
289464
289499
  if (update) {
289465
289500
  if (!forceUpdate && equal2) {
289466
- successPaths.push(path69.relative(projectDir, snapPath));
289501
+ successPaths.push(path70.relative(projectDir, snapPath));
289467
289502
  } else {
289468
289503
  fs65.writeFileSync(snapPath, newContentForFile);
289469
- successPaths.push(path69.relative(projectDir, snapPath));
289504
+ successPaths.push(path70.relative(projectDir, snapPath));
289470
289505
  didUpdate = true;
289471
289506
  }
289472
289507
  } else if (!equal2) {
289473
289508
  mismatches.push(diffPath ? `${snapPath} (diff: ${diffPath})` : snapPath);
289474
289509
  } else {
289475
- successPaths.push(path69.relative(projectDir, snapPath));
289510
+ successPaths.push(path70.relative(projectDir, snapPath));
289476
289511
  }
289477
289512
  }
289478
289513
  return {
@@ -289517,7 +289552,7 @@ var snapshotProject = async ({
289517
289552
  ...DEFAULT_IGNORED_PATTERNS,
289518
289553
  ...ignored.map(normalizeIgnorePattern)
289519
289554
  ];
289520
- const resolvedPaths = filePaths.map((f3) => path70.resolve(projectDir, f3));
289555
+ const resolvedPaths = filePaths.map((f3) => path71.resolve(projectDir, f3));
289521
289556
  const explicitDirectoryTarget = resolvedPaths.find((resolvedPath) => {
289522
289557
  if (!fs66.existsSync(resolvedPath)) {
289523
289558
  return false;
@@ -289531,7 +289566,7 @@ var snapshotProject = async ({
289531
289566
  });
289532
289567
  if (boardFiles.length === 0) {
289533
289568
  if (explicitDirectoryTarget) {
289534
- const relativeDirectory = path70.relative(projectDir, explicitDirectoryTarget) || ".";
289569
+ const relativeDirectory = path71.relative(projectDir, explicitDirectoryTarget) || ".";
289535
289570
  const runtimeIncludeBoardFilePatterns = projectConfig2?.includeBoardFiles?.filter((pattern) => pattern.trim()) ?? [];
289536
289571
  const includeBoardFilePatterns = runtimeIncludeBoardFilePatterns.length > 0 ? runtimeIncludeBoardFilePatterns : getBoardFilePatterns(projectDir);
289537
289572
  const patternSourceMessage = hasConfiguredIncludeBoardFiles(projectConfig2) ? "Searched using tscircuit.config.json includeBoardFiles" : "Searched using default includeBoardFiles";
@@ -289695,7 +289730,7 @@ var registerSnapshot = (program3) => {
289695
289730
  };
289696
289731
 
289697
289732
  // cli/transpile/register.ts
289698
- import path71 from "node:path";
289733
+ import path72 from "node:path";
289699
289734
  var registerTranspile = (program3) => {
289700
289735
  program3.command("transpile").description("Transpile TypeScript/TSX to JavaScript (ESM, CommonJS, and type declarations)").argument("[file]", "Path to the entry file").action(async (file) => {
289701
289736
  try {
@@ -289703,7 +289738,7 @@ var registerTranspile = (program3) => {
289703
289738
  fileOrDir: file,
289704
289739
  includeBoardFiles: false
289705
289740
  });
289706
- const distDir = path71.join(projectDir, "dist");
289741
+ const distDir = path72.join(projectDir, "dist");
289707
289742
  validateMainInDist(projectDir, distDir);
289708
289743
  console.log("Transpiling entry file...");
289709
289744
  const entryFile = mainEntrypoint || circuitFiles[0];
@@ -289741,12 +289776,12 @@ function registerUpgradeCommand(program3) {
289741
289776
  }
289742
289777
 
289743
289778
  // lib/shared/update-package.ts
289744
- import * as path72 from "node:path";
289779
+ import * as path73 from "node:path";
289745
289780
  import * as fs67 from "node:fs";
289746
289781
  async function updatePackage(packageSpec, projectDir = process.cwd()) {
289747
289782
  const packageManager = getPackageManager();
289748
289783
  if (!packageSpec) {
289749
- const pkgJsonPath = path72.join(projectDir, "package.json");
289784
+ const pkgJsonPath = path73.join(projectDir, "package.json");
289750
289785
  if (!fs67.existsSync(pkgJsonPath)) {
289751
289786
  console.log(kleur_default.yellow("No package.json found. Cannot update all packages."));
289752
289787
  return;