@tscircuit/cli 0.1.1194 → 0.1.1195

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
@@ -95346,18 +95346,18 @@ globstar while`, file, fr3, pattern, pr3, swallowee);
95346
95346
  abs = abs.replace(/\\/g, "/");
95347
95347
  return abs;
95348
95348
  }
95349
- function isIgnored(self2, path47) {
95349
+ function isIgnored(self2, path48) {
95350
95350
  if (!self2.ignore.length)
95351
95351
  return false;
95352
95352
  return self2.ignore.some(function(item) {
95353
- return item.matcher.match(path47) || !!(item.gmatcher && item.gmatcher.match(path47));
95353
+ return item.matcher.match(path48) || !!(item.gmatcher && item.gmatcher.match(path48));
95354
95354
  });
95355
95355
  }
95356
- function childrenIgnored(self2, path47) {
95356
+ function childrenIgnored(self2, path48) {
95357
95357
  if (!self2.ignore.length)
95358
95358
  return false;
95359
95359
  return self2.ignore.some(function(item) {
95360
- return !!(item.gmatcher && item.gmatcher.match(path47));
95360
+ return !!(item.gmatcher && item.gmatcher.match(path48));
95361
95361
  });
95362
95362
  }
95363
95363
  }
@@ -99964,7 +99964,7 @@ var import_perfect_cli = __toESM2(require_dist2(), 1);
99964
99964
  // lib/getVersion.ts
99965
99965
  import { createRequire as createRequire2 } from "node:module";
99966
99966
  // package.json
99967
- var version = "0.1.1193";
99967
+ var version = "0.1.1194";
99968
99968
  var package_default = {
99969
99969
  name: "@tscircuit/cli",
99970
99970
  version,
@@ -239559,6 +239559,7 @@ react/cjs/react-jsx-runtime.development.js:
239559
239559
  */
239560
239560
 
239561
239561
  // cli/check/routing-difficulty/register.ts
239562
+ import path42 from "node:path";
239562
239563
  var checkRoutingDifficulty = async (file) => {
239563
239564
  const resolvedInputFilePath = await resolveCheckInputFilePath(file);
239564
239565
  const circuitJson = await getCircuitJsonForCheck({
@@ -239570,7 +239571,11 @@ var checkRoutingDifficulty = async (file) => {
239570
239571
  allowPrebuiltCircuitJson: true
239571
239572
  });
239572
239573
  const analysis = await analyzeRouting(circuitJson);
239573
- return analysis.getString();
239574
+ const result = analysis.getString();
239575
+ if (!result) {
239576
+ return `No congested regions in ${path42.basename(resolvedInputFilePath)}`;
239577
+ }
239578
+ return result;
239574
239579
  };
239575
239580
  var registerCheckRoutingDifficulty = (program2) => {
239576
239581
  program2.commands.find((c3) => c3.name() === "check").command("routing-difficulty").description("Analyze routing difficulty").argument("[file]", "Path to the entry file").action(async (file) => {
@@ -239593,25 +239598,25 @@ var registerCheckRouting = (program2) => {
239593
239598
 
239594
239599
  // cli/clone/register.ts
239595
239600
  import * as fs43 from "node:fs";
239596
- import * as path44 from "node:path";
239601
+ import * as path45 from "node:path";
239597
239602
 
239598
239603
  // cli/clone/clone-bug-report.ts
239599
239604
  var import_jszip3 = __toESM2(require_lib4(), 1);
239600
239605
  var import_prompts4 = __toESM2(require_prompts3(), 1);
239601
239606
  import * as fs42 from "node:fs";
239602
- import * as path43 from "node:path";
239607
+ import * as path44 from "node:path";
239603
239608
 
239604
239609
  // cli/clone/handle-existing-directory.ts
239605
239610
  var import_prompts3 = __toESM2(require_prompts3(), 1);
239606
239611
  import * as fs41 from "node:fs";
239607
- import * as path42 from "node:path";
239612
+ import * as path43 from "node:path";
239608
239613
  var handleExistingDirectory = async (dirPath) => {
239609
239614
  if (!fs41.existsSync(dirPath))
239610
239615
  return;
239611
239616
  const response = await import_prompts3.default({
239612
239617
  type: "select",
239613
239618
  name: "action",
239614
- message: `Directory "${path42.basename(dirPath)}" already exists. What would you like to do?`,
239619
+ message: `Directory "${path43.basename(dirPath)}" already exists. What would you like to do?`,
239615
239620
  choices: [
239616
239621
  { title: "Merge files into existing directory", value: "merge" },
239617
239622
  {
@@ -239652,12 +239657,12 @@ var getCommonDirectoryPrefix = (paths) => {
239652
239657
  return commonSegments.join("/");
239653
239658
  };
239654
239659
  var sanitizeRelativePath = (relativePath) => {
239655
- const normalizedPath = path43.normalize(relativePath);
239660
+ const normalizedPath = path44.normalize(relativePath);
239656
239661
  if (!normalizedPath)
239657
239662
  return null;
239658
- if (path43.isAbsolute(normalizedPath))
239663
+ if (path44.isAbsolute(normalizedPath))
239659
239664
  return null;
239660
- const segments = normalizedPath.split(path43.sep);
239665
+ const segments = normalizedPath.split(path44.sep);
239661
239666
  if (segments.some((segment2) => segment2 === ".." || segment2 === "")) {
239662
239667
  return null;
239663
239668
  }
@@ -239672,7 +239677,7 @@ var cloneBugReport = async ({
239672
239677
  console.error("Bug report ID must not be empty.");
239673
239678
  process.exit(1);
239674
239679
  }
239675
- let dirPath = path43.resolve(`bug-report-${trimmedBugReportId}`);
239680
+ let dirPath = path44.resolve(`bug-report-${trimmedBugReportId}`);
239676
239681
  await handleExistingDirectory(dirPath);
239677
239682
  const ky3 = getRegistryApiKy();
239678
239683
  let zipBuffer;
@@ -239702,25 +239707,25 @@ var cloneBugReport = async ({
239702
239707
  console.warn(`Skipping potentially unsafe path: ${fileName}`);
239703
239708
  continue;
239704
239709
  }
239705
- const fullPath = path43.join(dirPath, sanitizedRelativePath);
239706
- fs42.mkdirSync(path43.dirname(fullPath), { recursive: true });
239710
+ const fullPath = path44.join(dirPath, sanitizedRelativePath);
239711
+ fs42.mkdirSync(path44.dirname(fullPath), { recursive: true });
239707
239712
  const fileContent = await entry.async("nodebuffer");
239708
239713
  fs42.writeFileSync(fullPath, fileContent);
239709
239714
  }
239710
- const packageJsonPath = path43.join(dirPath, "package.json");
239715
+ const packageJsonPath = path44.join(dirPath, "package.json");
239711
239716
  if (fs42.existsSync(packageJsonPath)) {
239712
239717
  try {
239713
239718
  const packageJson = JSON.parse(fs42.readFileSync(packageJsonPath, "utf-8"));
239714
239719
  const packageName = packageJson?.name;
239715
239720
  if (typeof packageName === "string" && packageName.trim()) {
239716
239721
  const sanitizedName = packageName.replace(/[^a-zA-Z0-9]/g, "_");
239717
- const suggestedDirPath = path43.resolve(`${sanitizedName}_${trimmedBugReportId.slice(7)}`);
239722
+ const suggestedDirPath = path44.resolve(`${sanitizedName}_${trimmedBugReportId.slice(7)}`);
239718
239723
  if (suggestedDirPath !== dirPath) {
239719
239724
  const response = await import_prompts4.default({
239720
239725
  type: "confirm",
239721
239726
  name: "rename",
239722
239727
  initial: true,
239723
- message: `Rename the directory to "${path43.basename(suggestedDirPath)}"?`
239728
+ message: `Rename the directory to "${path44.basename(suggestedDirPath)}"?`
239724
239729
  });
239725
239730
  if (response.rename) {
239726
239731
  await handleExistingDirectory(suggestedDirPath);
@@ -239733,9 +239738,9 @@ var cloneBugReport = async ({
239733
239738
  console.warn("Unable to read package name for renaming:", error);
239734
239739
  }
239735
239740
  }
239736
- fs42.writeFileSync(path43.join(dirPath, ".npmrc"), "@tsci:registry=https://npm.tscircuit.com");
239741
+ fs42.writeFileSync(path44.join(dirPath, ".npmrc"), "@tsci:registry=https://npm.tscircuit.com");
239737
239742
  generateTsConfig(dirPath);
239738
- const relativeDirPath = path43.relative(originalCwd, dirPath);
239743
+ const relativeDirPath = path44.relative(originalCwd, dirPath);
239739
239744
  console.log(kleur_default.green(`
239740
239745
  Successfully cloned bug report to:`));
239741
239746
  console.log(` ${dirPath}/
@@ -239774,7 +239779,7 @@ var registerClone = (program2) => {
239774
239779
  const [, author, packageName] = match;
239775
239780
  console.log(`Cloning ${author}/${packageName}...`);
239776
239781
  const userSettingToIncludeAuthor = options.includeAuthor || cliConfig.get("alwaysCloneWithAuthorName");
239777
- const dirPath = userSettingToIncludeAuthor ? path44.resolve(`${author}.${packageName}`) : path44.resolve(packageName);
239782
+ const dirPath = userSettingToIncludeAuthor ? path45.resolve(`${author}.${packageName}`) : path45.resolve(packageName);
239778
239783
  await handleExistingDirectory(dirPath);
239779
239784
  const ky3 = getRegistryApiKy();
239780
239785
  let packageFileList = {
@@ -239800,8 +239805,8 @@ var registerClone = (program2) => {
239800
239805
  const filePath = fileInfo.file_path.replace(/^\/+/, "");
239801
239806
  if (!filePath)
239802
239807
  continue;
239803
- const fullPath = path44.join(dirPath, filePath);
239804
- fs43.mkdirSync(path44.dirname(fullPath), { recursive: true });
239808
+ const fullPath = path45.join(dirPath, filePath);
239809
+ fs43.mkdirSync(path45.dirname(fullPath), { recursive: true });
239805
239810
  try {
239806
239811
  const fileContent = await ky3.get("package_files/get", {
239807
239812
  searchParams: {
@@ -239827,10 +239832,10 @@ var registerClone = (program2) => {
239827
239832
  console.warn(`Skipping ${filePath} due to error:`, error instanceof Error ? error.message : error);
239828
239833
  }
239829
239834
  }
239830
- fs43.writeFileSync(path44.join(dirPath, ".npmrc"), "@tsci:registry=https://npm.tscircuit.com");
239835
+ fs43.writeFileSync(path45.join(dirPath, ".npmrc"), "@tsci:registry=https://npm.tscircuit.com");
239831
239836
  generateTsConfig(dirPath);
239832
239837
  await setupTsciProject(dirPath);
239833
- const relativeDirPath = path44.relative(originalCwd, dirPath);
239838
+ const relativeDirPath = path45.relative(originalCwd, dirPath);
239834
239839
  console.log(kleur_default.green(`
239835
239840
  Successfully cloned to:`));
239836
239841
  console.log(` ${dirPath}/
@@ -239898,7 +239903,7 @@ var registerConfigSet = (program2) => {
239898
239903
 
239899
239904
  // cli/convert/register.ts
239900
239905
  import fs44 from "node:fs/promises";
239901
- import path45 from "node:path";
239906
+ import path46 from "node:path";
239902
239907
  import { parseKicadModToCircuitJson } from "kicad-component-converter";
239903
239908
 
239904
239909
  // node_modules/@tscircuit/mm/dist/index.js
@@ -240019,14 +240024,14 @@ var convertCircuitJsonToTscircuit = (circuitJson, opts) => {
240019
240024
  var registerConvert = (program2) => {
240020
240025
  program2.command("convert").description("Convert a .kicad_mod footprint to a tscircuit component").argument("<file>", "Path to the .kicad_mod file").option("-o, --output <path>", "Output TSX file path").option("-n, --name <component>", "Component name for export").action(async (file, options) => {
240021
240026
  try {
240022
- const inputPath = path45.resolve(file);
240027
+ const inputPath = path46.resolve(file);
240023
240028
  const modContent = await fs44.readFile(inputPath, "utf-8");
240024
240029
  const circuitJson = await parseKicadModToCircuitJson(modContent);
240025
- const componentName = options.name ?? path45.basename(inputPath, ".kicad_mod");
240030
+ const componentName = options.name ?? path46.basename(inputPath, ".kicad_mod");
240026
240031
  const tsx = convertCircuitJsonToTscircuit(circuitJson, {
240027
240032
  componentName
240028
240033
  });
240029
- const outputPath = options.output ? path45.resolve(options.output) : path45.join(path45.dirname(inputPath), `${componentName}.tsx`);
240034
+ const outputPath = options.output ? path46.resolve(options.output) : path46.join(path46.dirname(inputPath), `${componentName}.tsx`);
240030
240035
  await fs44.writeFile(outputPath, tsx);
240031
240036
  console.log(kleur_default.green(`Converted ${outputPath}`));
240032
240037
  } catch (error) {
@@ -240039,11 +240044,11 @@ var registerConvert = (program2) => {
240039
240044
  // cli/dev/register.ts
240040
240045
  import * as fs51 from "node:fs";
240041
240046
  import * as net from "node:net";
240042
- import * as path53 from "node:path";
240047
+ import * as path54 from "node:path";
240043
240048
 
240044
240049
  // cli/dev/DevServer.ts
240045
240050
  import fs49 from "node:fs";
240046
- import path51 from "node:path";
240051
+ import path52 from "node:path";
240047
240052
 
240048
240053
  // node_modules/chokidar/esm/index.js
240049
240054
  import { stat as statcb } from "fs";
@@ -240122,7 +240127,7 @@ class ReaddirpStream extends Readable {
240122
240127
  this._directoryFilter = normalizeFilter(opts.directoryFilter);
240123
240128
  const statMethod = opts.lstat ? lstat : stat;
240124
240129
  if (wantBigintFsStats) {
240125
- this._stat = (path46) => statMethod(path46, { bigint: true });
240130
+ this._stat = (path47) => statMethod(path47, { bigint: true });
240126
240131
  } else {
240127
240132
  this._stat = statMethod;
240128
240133
  }
@@ -240147,8 +240152,8 @@ class ReaddirpStream extends Readable {
240147
240152
  const par = this.parent;
240148
240153
  const fil = par && par.files;
240149
240154
  if (fil && fil.length > 0) {
240150
- const { path: path46, depth } = par;
240151
- const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path46));
240155
+ const { path: path47, depth } = par;
240156
+ const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path47));
240152
240157
  const awaited = await Promise.all(slice);
240153
240158
  for (const entry of awaited) {
240154
240159
  if (!entry)
@@ -240188,20 +240193,20 @@ class ReaddirpStream extends Readable {
240188
240193
  this.reading = false;
240189
240194
  }
240190
240195
  }
240191
- async _exploreDir(path46, depth) {
240196
+ async _exploreDir(path47, depth) {
240192
240197
  let files;
240193
240198
  try {
240194
- files = await readdir(path46, this._rdOptions);
240199
+ files = await readdir(path47, this._rdOptions);
240195
240200
  } catch (error) {
240196
240201
  this._onError(error);
240197
240202
  }
240198
- return { files, depth, path: path46 };
240203
+ return { files, depth, path: path47 };
240199
240204
  }
240200
- async _formatEntry(dirent, path46) {
240205
+ async _formatEntry(dirent, path47) {
240201
240206
  let entry;
240202
240207
  const basename4 = this._isDirent ? dirent.name : dirent;
240203
240208
  try {
240204
- const fullPath = presolve(pjoin(path46, basename4));
240209
+ const fullPath = presolve(pjoin(path47, basename4));
240205
240210
  entry = { path: prelative(this._root, fullPath), fullPath, basename: basename4 };
240206
240211
  entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
240207
240212
  } catch (err) {
@@ -240599,16 +240604,16 @@ var delFromSet = (main, prop, item) => {
240599
240604
  };
240600
240605
  var isEmptySet = (val) => val instanceof Set ? val.size === 0 : !val;
240601
240606
  var FsWatchInstances = new Map;
240602
- function createFsWatchInstance(path46, options, listener, errHandler, emitRaw) {
240607
+ function createFsWatchInstance(path47, options, listener, errHandler, emitRaw) {
240603
240608
  const handleEvent = (rawEvent, evPath) => {
240604
- listener(path46);
240605
- emitRaw(rawEvent, evPath, { watchedPath: path46 });
240606
- if (evPath && path46 !== evPath) {
240607
- fsWatchBroadcast(sysPath.resolve(path46, evPath), KEY_LISTENERS, sysPath.join(path46, evPath));
240609
+ listener(path47);
240610
+ emitRaw(rawEvent, evPath, { watchedPath: path47 });
240611
+ if (evPath && path47 !== evPath) {
240612
+ fsWatchBroadcast(sysPath.resolve(path47, evPath), KEY_LISTENERS, sysPath.join(path47, evPath));
240608
240613
  }
240609
240614
  };
240610
240615
  try {
240611
- return fs_watch(path46, {
240616
+ return fs_watch(path47, {
240612
240617
  persistent: options.persistent
240613
240618
  }, handleEvent);
240614
240619
  } catch (error) {
@@ -240624,12 +240629,12 @@ var fsWatchBroadcast = (fullPath, listenerType, val1, val2, val3) => {
240624
240629
  listener(val1, val2, val3);
240625
240630
  });
240626
240631
  };
240627
- var setFsWatchListener = (path46, fullPath, options, handlers) => {
240632
+ var setFsWatchListener = (path47, fullPath, options, handlers) => {
240628
240633
  const { listener, errHandler, rawEmitter } = handlers;
240629
240634
  let cont = FsWatchInstances.get(fullPath);
240630
240635
  let watcher;
240631
240636
  if (!options.persistent) {
240632
- watcher = createFsWatchInstance(path46, options, listener, errHandler, rawEmitter);
240637
+ watcher = createFsWatchInstance(path47, options, listener, errHandler, rawEmitter);
240633
240638
  if (!watcher)
240634
240639
  return;
240635
240640
  return watcher.close.bind(watcher);
@@ -240639,7 +240644,7 @@ var setFsWatchListener = (path46, fullPath, options, handlers) => {
240639
240644
  addAndConvert(cont, KEY_ERR, errHandler);
240640
240645
  addAndConvert(cont, KEY_RAW, rawEmitter);
240641
240646
  } else {
240642
- watcher = createFsWatchInstance(path46, options, fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS), errHandler, fsWatchBroadcast.bind(null, fullPath, KEY_RAW));
240647
+ watcher = createFsWatchInstance(path47, options, fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS), errHandler, fsWatchBroadcast.bind(null, fullPath, KEY_RAW));
240643
240648
  if (!watcher)
240644
240649
  return;
240645
240650
  watcher.on(EV.ERROR, async (error) => {
@@ -240648,7 +240653,7 @@ var setFsWatchListener = (path46, fullPath, options, handlers) => {
240648
240653
  cont.watcherUnusable = true;
240649
240654
  if (isWindows && error.code === "EPERM") {
240650
240655
  try {
240651
- const fd3 = await open(path46, "r");
240656
+ const fd3 = await open(path47, "r");
240652
240657
  await fd3.close();
240653
240658
  broadcastErr(error);
240654
240659
  } catch (err) {}
@@ -240678,7 +240683,7 @@ var setFsWatchListener = (path46, fullPath, options, handlers) => {
240678
240683
  };
240679
240684
  };
240680
240685
  var FsWatchFileInstances = new Map;
240681
- var setFsWatchFileListener = (path46, fullPath, options, handlers) => {
240686
+ var setFsWatchFileListener = (path47, fullPath, options, handlers) => {
240682
240687
  const { listener, rawEmitter } = handlers;
240683
240688
  let cont = FsWatchFileInstances.get(fullPath);
240684
240689
  const copts = cont && cont.options;
@@ -240700,7 +240705,7 @@ var setFsWatchFileListener = (path46, fullPath, options, handlers) => {
240700
240705
  });
240701
240706
  const currmtime = curr.mtimeMs;
240702
240707
  if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) {
240703
- foreach(cont.listeners, (listener2) => listener2(path46, curr));
240708
+ foreach(cont.listeners, (listener2) => listener2(path47, curr));
240704
240709
  }
240705
240710
  })
240706
240711
  };
@@ -240723,13 +240728,13 @@ class NodeFsHandler {
240723
240728
  this.fsw = fsW;
240724
240729
  this._boundHandleError = (error) => fsW._handleError(error);
240725
240730
  }
240726
- _watchWithNodeFs(path46, listener) {
240731
+ _watchWithNodeFs(path47, listener) {
240727
240732
  const opts = this.fsw.options;
240728
- const directory = sysPath.dirname(path46);
240729
- const basename5 = sysPath.basename(path46);
240733
+ const directory = sysPath.dirname(path47);
240734
+ const basename5 = sysPath.basename(path47);
240730
240735
  const parent = this.fsw._getWatchedDir(directory);
240731
240736
  parent.add(basename5);
240732
- const absolutePath = sysPath.resolve(path46);
240737
+ const absolutePath = sysPath.resolve(path47);
240733
240738
  const options = {
240734
240739
  persistent: opts.persistent
240735
240740
  };
@@ -240739,12 +240744,12 @@ class NodeFsHandler {
240739
240744
  if (opts.usePolling) {
240740
240745
  const enableBin = opts.interval !== opts.binaryInterval;
240741
240746
  options.interval = enableBin && isBinaryPath(basename5) ? opts.binaryInterval : opts.interval;
240742
- closer = setFsWatchFileListener(path46, absolutePath, options, {
240747
+ closer = setFsWatchFileListener(path47, absolutePath, options, {
240743
240748
  listener,
240744
240749
  rawEmitter: this.fsw._emitRaw
240745
240750
  });
240746
240751
  } else {
240747
- closer = setFsWatchListener(path46, absolutePath, options, {
240752
+ closer = setFsWatchListener(path47, absolutePath, options, {
240748
240753
  listener,
240749
240754
  errHandler: this._boundHandleError,
240750
240755
  rawEmitter: this.fsw._emitRaw
@@ -240762,7 +240767,7 @@ class NodeFsHandler {
240762
240767
  let prevStats = stats;
240763
240768
  if (parent.has(basename5))
240764
240769
  return;
240765
- const listener = async (path46, newStats) => {
240770
+ const listener = async (path47, newStats) => {
240766
240771
  if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file, 5))
240767
240772
  return;
240768
240773
  if (!newStats || newStats.mtimeMs === 0) {
@@ -240776,11 +240781,11 @@ class NodeFsHandler {
240776
240781
  this.fsw._emit(EV.CHANGE, file, newStats2);
240777
240782
  }
240778
240783
  if ((isMacos || isLinux) && prevStats.ino !== newStats2.ino) {
240779
- this.fsw._closeFile(path46);
240784
+ this.fsw._closeFile(path47);
240780
240785
  prevStats = newStats2;
240781
240786
  const closer2 = this._watchWithNodeFs(file, listener);
240782
240787
  if (closer2)
240783
- this.fsw._addPathCloser(path46, closer2);
240788
+ this.fsw._addPathCloser(path47, closer2);
240784
240789
  } else {
240785
240790
  prevStats = newStats2;
240786
240791
  }
@@ -240804,7 +240809,7 @@ class NodeFsHandler {
240804
240809
  }
240805
240810
  return closer;
240806
240811
  }
240807
- async _handleSymlink(entry, directory, path46, item) {
240812
+ async _handleSymlink(entry, directory, path47, item) {
240808
240813
  if (this.fsw.closed) {
240809
240814
  return;
240810
240815
  }
@@ -240814,7 +240819,7 @@ class NodeFsHandler {
240814
240819
  this.fsw._incrReadyCount();
240815
240820
  let linkPath;
240816
240821
  try {
240817
- linkPath = await fsrealpath(path46);
240822
+ linkPath = await fsrealpath(path47);
240818
240823
  } catch (e4) {
240819
240824
  this.fsw._emitReady();
240820
240825
  return true;
@@ -240824,12 +240829,12 @@ class NodeFsHandler {
240824
240829
  if (dir.has(item)) {
240825
240830
  if (this.fsw._symlinkPaths.get(full) !== linkPath) {
240826
240831
  this.fsw._symlinkPaths.set(full, linkPath);
240827
- this.fsw._emit(EV.CHANGE, path46, entry.stats);
240832
+ this.fsw._emit(EV.CHANGE, path47, entry.stats);
240828
240833
  }
240829
240834
  } else {
240830
240835
  dir.add(item);
240831
240836
  this.fsw._symlinkPaths.set(full, linkPath);
240832
- this.fsw._emit(EV.ADD, path46, entry.stats);
240837
+ this.fsw._emit(EV.ADD, path47, entry.stats);
240833
240838
  }
240834
240839
  this.fsw._emitReady();
240835
240840
  return true;
@@ -240858,9 +240863,9 @@ class NodeFsHandler {
240858
240863
  return;
240859
240864
  }
240860
240865
  const item = entry.path;
240861
- let path46 = sysPath.join(directory, item);
240866
+ let path47 = sysPath.join(directory, item);
240862
240867
  current2.add(item);
240863
- if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path46, item)) {
240868
+ if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path47, item)) {
240864
240869
  return;
240865
240870
  }
240866
240871
  if (this.fsw.closed) {
@@ -240869,8 +240874,8 @@ class NodeFsHandler {
240869
240874
  }
240870
240875
  if (item === target || !target && !previous.has(item)) {
240871
240876
  this.fsw._incrReadyCount();
240872
- path46 = sysPath.join(dir, sysPath.relative(dir, path46));
240873
- this._addToNodeFs(path46, initialAdd, wh3, depth + 1);
240877
+ path47 = sysPath.join(dir, sysPath.relative(dir, path47));
240878
+ this._addToNodeFs(path47, initialAdd, wh3, depth + 1);
240874
240879
  }
240875
240880
  }).on(EV.ERROR, this._boundHandleError);
240876
240881
  return new Promise((resolve7, reject) => {
@@ -240919,13 +240924,13 @@ class NodeFsHandler {
240919
240924
  }
240920
240925
  return closer;
240921
240926
  }
240922
- async _addToNodeFs(path46, initialAdd, priorWh, depth, target) {
240927
+ async _addToNodeFs(path47, initialAdd, priorWh, depth, target) {
240923
240928
  const ready = this.fsw._emitReady;
240924
- if (this.fsw._isIgnored(path46) || this.fsw.closed) {
240929
+ if (this.fsw._isIgnored(path47) || this.fsw.closed) {
240925
240930
  ready();
240926
240931
  return false;
240927
240932
  }
240928
- const wh3 = this.fsw._getWatchHelpers(path46);
240933
+ const wh3 = this.fsw._getWatchHelpers(path47);
240929
240934
  if (priorWh) {
240930
240935
  wh3.filterPath = (entry) => priorWh.filterPath(entry);
240931
240936
  wh3.filterDir = (entry) => priorWh.filterDir(entry);
@@ -240941,8 +240946,8 @@ class NodeFsHandler {
240941
240946
  const follow = this.fsw.options.followSymlinks;
240942
240947
  let closer;
240943
240948
  if (stats.isDirectory()) {
240944
- const absPath = sysPath.resolve(path46);
240945
- const targetPath = follow ? await fsrealpath(path46) : path46;
240949
+ const absPath = sysPath.resolve(path47);
240950
+ const targetPath = follow ? await fsrealpath(path47) : path47;
240946
240951
  if (this.fsw.closed)
240947
240952
  return;
240948
240953
  closer = await this._handleDir(wh3.watchPath, stats, initialAdd, depth, target, wh3, targetPath);
@@ -240952,29 +240957,29 @@ class NodeFsHandler {
240952
240957
  this.fsw._symlinkPaths.set(absPath, targetPath);
240953
240958
  }
240954
240959
  } else if (stats.isSymbolicLink()) {
240955
- const targetPath = follow ? await fsrealpath(path46) : path46;
240960
+ const targetPath = follow ? await fsrealpath(path47) : path47;
240956
240961
  if (this.fsw.closed)
240957
240962
  return;
240958
240963
  const parent = sysPath.dirname(wh3.watchPath);
240959
240964
  this.fsw._getWatchedDir(parent).add(wh3.watchPath);
240960
240965
  this.fsw._emit(EV.ADD, wh3.watchPath, stats);
240961
- closer = await this._handleDir(parent, stats, initialAdd, depth, path46, wh3, targetPath);
240966
+ closer = await this._handleDir(parent, stats, initialAdd, depth, path47, wh3, targetPath);
240962
240967
  if (this.fsw.closed)
240963
240968
  return;
240964
240969
  if (targetPath !== undefined) {
240965
- this.fsw._symlinkPaths.set(sysPath.resolve(path46), targetPath);
240970
+ this.fsw._symlinkPaths.set(sysPath.resolve(path47), targetPath);
240966
240971
  }
240967
240972
  } else {
240968
240973
  closer = this._handleFile(wh3.watchPath, stats, initialAdd);
240969
240974
  }
240970
240975
  ready();
240971
240976
  if (closer)
240972
- this.fsw._addPathCloser(path46, closer);
240977
+ this.fsw._addPathCloser(path47, closer);
240973
240978
  return false;
240974
240979
  } catch (error) {
240975
240980
  if (this.fsw._handleError(error)) {
240976
240981
  ready();
240977
- return path46;
240982
+ return path47;
240978
240983
  }
240979
240984
  }
240980
240985
  }
@@ -241017,26 +241022,26 @@ function createPattern(matcher) {
241017
241022
  }
241018
241023
  return () => false;
241019
241024
  }
241020
- function normalizePath(path46) {
241021
- if (typeof path46 !== "string")
241025
+ function normalizePath(path47) {
241026
+ if (typeof path47 !== "string")
241022
241027
  throw new Error("string expected");
241023
- path46 = sysPath2.normalize(path46);
241024
- path46 = path46.replace(/\\/g, "/");
241028
+ path47 = sysPath2.normalize(path47);
241029
+ path47 = path47.replace(/\\/g, "/");
241025
241030
  let prepend2 = false;
241026
- if (path46.startsWith("//"))
241031
+ if (path47.startsWith("//"))
241027
241032
  prepend2 = true;
241028
241033
  const DOUBLE_SLASH_RE2 = /\/\//;
241029
- while (path46.match(DOUBLE_SLASH_RE2))
241030
- path46 = path46.replace(DOUBLE_SLASH_RE2, "/");
241034
+ while (path47.match(DOUBLE_SLASH_RE2))
241035
+ path47 = path47.replace(DOUBLE_SLASH_RE2, "/");
241031
241036
  if (prepend2)
241032
- path46 = "/" + path46;
241033
- return path46;
241037
+ path47 = "/" + path47;
241038
+ return path47;
241034
241039
  }
241035
241040
  function matchPatterns(patterns, testString, stats) {
241036
- const path46 = normalizePath(testString);
241041
+ const path47 = normalizePath(testString);
241037
241042
  for (let index = 0;index < patterns.length; index++) {
241038
241043
  const pattern = patterns[index];
241039
- if (pattern(path46, stats)) {
241044
+ if (pattern(path47, stats)) {
241040
241045
  return true;
241041
241046
  }
241042
241047
  }
@@ -241076,19 +241081,19 @@ var toUnix = (string) => {
241076
241081
  }
241077
241082
  return str;
241078
241083
  };
241079
- var normalizePathToUnix = (path46) => toUnix(sysPath2.normalize(toUnix(path46)));
241080
- var normalizeIgnored = (cwd = "") => (path46) => {
241081
- if (typeof path46 === "string") {
241082
- return normalizePathToUnix(sysPath2.isAbsolute(path46) ? path46 : sysPath2.join(cwd, path46));
241084
+ var normalizePathToUnix = (path47) => toUnix(sysPath2.normalize(toUnix(path47)));
241085
+ var normalizeIgnored = (cwd = "") => (path47) => {
241086
+ if (typeof path47 === "string") {
241087
+ return normalizePathToUnix(sysPath2.isAbsolute(path47) ? path47 : sysPath2.join(cwd, path47));
241083
241088
  } else {
241084
- return path46;
241089
+ return path47;
241085
241090
  }
241086
241091
  };
241087
- var getAbsolutePath = (path46, cwd) => {
241088
- if (sysPath2.isAbsolute(path46)) {
241089
- return path46;
241092
+ var getAbsolutePath = (path47, cwd) => {
241093
+ if (sysPath2.isAbsolute(path47)) {
241094
+ return path47;
241090
241095
  }
241091
- return sysPath2.join(cwd, path46);
241096
+ return sysPath2.join(cwd, path47);
241092
241097
  };
241093
241098
  var EMPTY_SET = Object.freeze(new Set);
241094
241099
 
@@ -241145,10 +241150,10 @@ var STAT_METHOD_F = "stat";
241145
241150
  var STAT_METHOD_L = "lstat";
241146
241151
 
241147
241152
  class WatchHelper {
241148
- constructor(path46, follow, fsw) {
241153
+ constructor(path47, follow, fsw) {
241149
241154
  this.fsw = fsw;
241150
- const watchPath = path46;
241151
- this.path = path46 = path46.replace(REPLACER_RE, "");
241155
+ const watchPath = path47;
241156
+ this.path = path47 = path47.replace(REPLACER_RE, "");
241152
241157
  this.watchPath = watchPath;
241153
241158
  this.fullWatchPath = sysPath2.resolve(watchPath);
241154
241159
  this.dirParts = [];
@@ -241261,20 +241266,20 @@ class FSWatcher extends EventEmitter {
241261
241266
  this._closePromise = undefined;
241262
241267
  let paths = unifyPaths(paths_);
241263
241268
  if (cwd) {
241264
- paths = paths.map((path46) => {
241265
- const absPath = getAbsolutePath(path46, cwd);
241269
+ paths = paths.map((path47) => {
241270
+ const absPath = getAbsolutePath(path47, cwd);
241266
241271
  return absPath;
241267
241272
  });
241268
241273
  }
241269
- paths.forEach((path46) => {
241270
- this._removeIgnoredPath(path46);
241274
+ paths.forEach((path47) => {
241275
+ this._removeIgnoredPath(path47);
241271
241276
  });
241272
241277
  this._userIgnored = undefined;
241273
241278
  if (!this._readyCount)
241274
241279
  this._readyCount = 0;
241275
241280
  this._readyCount += paths.length;
241276
- Promise.all(paths.map(async (path46) => {
241277
- const res2 = await this._nodeFsHandler._addToNodeFs(path46, !_internal, undefined, 0, _origAdd);
241281
+ Promise.all(paths.map(async (path47) => {
241282
+ const res2 = await this._nodeFsHandler._addToNodeFs(path47, !_internal, undefined, 0, _origAdd);
241278
241283
  if (res2)
241279
241284
  this._emitReady();
241280
241285
  return res2;
@@ -241293,17 +241298,17 @@ class FSWatcher extends EventEmitter {
241293
241298
  return this;
241294
241299
  const paths = unifyPaths(paths_);
241295
241300
  const { cwd } = this.options;
241296
- paths.forEach((path46) => {
241297
- if (!sysPath2.isAbsolute(path46) && !this._closers.has(path46)) {
241301
+ paths.forEach((path47) => {
241302
+ if (!sysPath2.isAbsolute(path47) && !this._closers.has(path47)) {
241298
241303
  if (cwd)
241299
- path46 = sysPath2.join(cwd, path46);
241300
- path46 = sysPath2.resolve(path46);
241304
+ path47 = sysPath2.join(cwd, path47);
241305
+ path47 = sysPath2.resolve(path47);
241301
241306
  }
241302
- this._closePath(path46);
241303
- this._addIgnoredPath(path46);
241304
- if (this._watched.has(path46)) {
241307
+ this._closePath(path47);
241308
+ this._addIgnoredPath(path47);
241309
+ if (this._watched.has(path47)) {
241305
241310
  this._addIgnoredPath({
241306
- path: path46,
241311
+ path: path47,
241307
241312
  recursive: true
241308
241313
  });
241309
241314
  }
@@ -241352,38 +241357,38 @@ class FSWatcher extends EventEmitter {
241352
241357
  if (event !== EVENTS.ERROR)
241353
241358
  this.emit(EVENTS.ALL, ...args);
241354
241359
  }
241355
- async _emit(event, path46, stats) {
241360
+ async _emit(event, path47, stats) {
241356
241361
  if (this.closed)
241357
241362
  return;
241358
241363
  const opts = this.options;
241359
241364
  if (isWindows)
241360
- path46 = sysPath2.normalize(path46);
241365
+ path47 = sysPath2.normalize(path47);
241361
241366
  if (opts.cwd)
241362
- path46 = sysPath2.relative(opts.cwd, path46);
241363
- const args = [event, path46];
241367
+ path47 = sysPath2.relative(opts.cwd, path47);
241368
+ const args = [event, path47];
241364
241369
  if (stats != null)
241365
241370
  args.push(stats);
241366
241371
  const awf = opts.awaitWriteFinish;
241367
241372
  let pw;
241368
- if (awf && (pw = this._pendingWrites.get(path46))) {
241373
+ if (awf && (pw = this._pendingWrites.get(path47))) {
241369
241374
  pw.lastChange = new Date;
241370
241375
  return this;
241371
241376
  }
241372
241377
  if (opts.atomic) {
241373
241378
  if (event === EVENTS.UNLINK) {
241374
- this._pendingUnlinks.set(path46, args);
241379
+ this._pendingUnlinks.set(path47, args);
241375
241380
  setTimeout(() => {
241376
- this._pendingUnlinks.forEach((entry, path47) => {
241381
+ this._pendingUnlinks.forEach((entry, path48) => {
241377
241382
  this.emit(...entry);
241378
241383
  this.emit(EVENTS.ALL, ...entry);
241379
- this._pendingUnlinks.delete(path47);
241384
+ this._pendingUnlinks.delete(path48);
241380
241385
  });
241381
241386
  }, typeof opts.atomic === "number" ? opts.atomic : 100);
241382
241387
  return this;
241383
241388
  }
241384
- if (event === EVENTS.ADD && this._pendingUnlinks.has(path46)) {
241389
+ if (event === EVENTS.ADD && this._pendingUnlinks.has(path47)) {
241385
241390
  event = args[0] = EVENTS.CHANGE;
241386
- this._pendingUnlinks.delete(path46);
241391
+ this._pendingUnlinks.delete(path47);
241387
241392
  }
241388
241393
  }
241389
241394
  if (awf && (event === EVENTS.ADD || event === EVENTS.CHANGE) && this._readyEmitted) {
@@ -241401,16 +241406,16 @@ class FSWatcher extends EventEmitter {
241401
241406
  this.emitWithAll(event, args);
241402
241407
  }
241403
241408
  };
241404
- this._awaitWriteFinish(path46, awf.stabilityThreshold, event, awfEmit);
241409
+ this._awaitWriteFinish(path47, awf.stabilityThreshold, event, awfEmit);
241405
241410
  return this;
241406
241411
  }
241407
241412
  if (event === EVENTS.CHANGE) {
241408
- const isThrottled = !this._throttle(EVENTS.CHANGE, path46, 50);
241413
+ const isThrottled = !this._throttle(EVENTS.CHANGE, path47, 50);
241409
241414
  if (isThrottled)
241410
241415
  return this;
241411
241416
  }
241412
241417
  if (opts.alwaysStat && stats === undefined && (event === EVENTS.ADD || event === EVENTS.ADD_DIR || event === EVENTS.CHANGE)) {
241413
- const fullPath = opts.cwd ? sysPath2.join(opts.cwd, path46) : path46;
241418
+ const fullPath = opts.cwd ? sysPath2.join(opts.cwd, path47) : path47;
241414
241419
  let stats2;
241415
241420
  try {
241416
241421
  stats2 = await stat3(fullPath);
@@ -241429,23 +241434,23 @@ class FSWatcher extends EventEmitter {
241429
241434
  }
241430
241435
  return error || this.closed;
241431
241436
  }
241432
- _throttle(actionType, path46, timeout2) {
241437
+ _throttle(actionType, path47, timeout2) {
241433
241438
  if (!this._throttled.has(actionType)) {
241434
241439
  this._throttled.set(actionType, new Map);
241435
241440
  }
241436
241441
  const action = this._throttled.get(actionType);
241437
241442
  if (!action)
241438
241443
  throw new Error("invalid throttle");
241439
- const actionPath = action.get(path46);
241444
+ const actionPath = action.get(path47);
241440
241445
  if (actionPath) {
241441
241446
  actionPath.count++;
241442
241447
  return false;
241443
241448
  }
241444
241449
  let timeoutObject;
241445
241450
  const clear = () => {
241446
- const item = action.get(path46);
241451
+ const item = action.get(path47);
241447
241452
  const count = item ? item.count : 0;
241448
- action.delete(path46);
241453
+ action.delete(path47);
241449
241454
  clearTimeout(timeoutObject);
241450
241455
  if (item)
241451
241456
  clearTimeout(item.timeoutObject);
@@ -241453,50 +241458,50 @@ class FSWatcher extends EventEmitter {
241453
241458
  };
241454
241459
  timeoutObject = setTimeout(clear, timeout2);
241455
241460
  const thr = { timeoutObject, clear, count: 0 };
241456
- action.set(path46, thr);
241461
+ action.set(path47, thr);
241457
241462
  return thr;
241458
241463
  }
241459
241464
  _incrReadyCount() {
241460
241465
  return this._readyCount++;
241461
241466
  }
241462
- _awaitWriteFinish(path46, threshold, event, awfEmit) {
241467
+ _awaitWriteFinish(path47, threshold, event, awfEmit) {
241463
241468
  const awf = this.options.awaitWriteFinish;
241464
241469
  if (typeof awf !== "object")
241465
241470
  return;
241466
241471
  const pollInterval = awf.pollInterval;
241467
241472
  let timeoutHandler;
241468
- let fullPath = path46;
241469
- if (this.options.cwd && !sysPath2.isAbsolute(path46)) {
241470
- fullPath = sysPath2.join(this.options.cwd, path46);
241473
+ let fullPath = path47;
241474
+ if (this.options.cwd && !sysPath2.isAbsolute(path47)) {
241475
+ fullPath = sysPath2.join(this.options.cwd, path47);
241471
241476
  }
241472
241477
  const now = new Date;
241473
241478
  const writes = this._pendingWrites;
241474
241479
  function awaitWriteFinishFn(prevStat) {
241475
241480
  statcb(fullPath, (err, curStat) => {
241476
- if (err || !writes.has(path46)) {
241481
+ if (err || !writes.has(path47)) {
241477
241482
  if (err && err.code !== "ENOENT")
241478
241483
  awfEmit(err);
241479
241484
  return;
241480
241485
  }
241481
241486
  const now2 = Number(new Date);
241482
241487
  if (prevStat && curStat.size !== prevStat.size) {
241483
- writes.get(path46).lastChange = now2;
241488
+ writes.get(path47).lastChange = now2;
241484
241489
  }
241485
- const pw = writes.get(path46);
241490
+ const pw = writes.get(path47);
241486
241491
  const df3 = now2 - pw.lastChange;
241487
241492
  if (df3 >= threshold) {
241488
- writes.delete(path46);
241493
+ writes.delete(path47);
241489
241494
  awfEmit(undefined, curStat);
241490
241495
  } else {
241491
241496
  timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval, curStat);
241492
241497
  }
241493
241498
  });
241494
241499
  }
241495
- if (!writes.has(path46)) {
241496
- writes.set(path46, {
241500
+ if (!writes.has(path47)) {
241501
+ writes.set(path47, {
241497
241502
  lastChange: now,
241498
241503
  cancelWait: () => {
241499
- writes.delete(path46);
241504
+ writes.delete(path47);
241500
241505
  clearTimeout(timeoutHandler);
241501
241506
  return event;
241502
241507
  }
@@ -241504,8 +241509,8 @@ class FSWatcher extends EventEmitter {
241504
241509
  timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval);
241505
241510
  }
241506
241511
  }
241507
- _isIgnored(path46, stats) {
241508
- if (this.options.atomic && DOT_RE.test(path46))
241512
+ _isIgnored(path47, stats) {
241513
+ if (this.options.atomic && DOT_RE.test(path47))
241509
241514
  return true;
241510
241515
  if (!this._userIgnored) {
241511
241516
  const { cwd } = this.options;
@@ -241515,13 +241520,13 @@ class FSWatcher extends EventEmitter {
241515
241520
  const list = [...ignoredPaths.map(normalizeIgnored(cwd)), ...ignored];
241516
241521
  this._userIgnored = anymatch(list, undefined);
241517
241522
  }
241518
- return this._userIgnored(path46, stats);
241523
+ return this._userIgnored(path47, stats);
241519
241524
  }
241520
- _isntIgnored(path46, stat4) {
241521
- return !this._isIgnored(path46, stat4);
241525
+ _isntIgnored(path47, stat4) {
241526
+ return !this._isIgnored(path47, stat4);
241522
241527
  }
241523
- _getWatchHelpers(path46) {
241524
- return new WatchHelper(path46, this.options.followSymlinks, this);
241528
+ _getWatchHelpers(path47) {
241529
+ return new WatchHelper(path47, this.options.followSymlinks, this);
241525
241530
  }
241526
241531
  _getWatchedDir(directory) {
241527
241532
  const dir = sysPath2.resolve(directory);
@@ -241535,57 +241540,57 @@ class FSWatcher extends EventEmitter {
241535
241540
  return Boolean(Number(stats.mode) & 256);
241536
241541
  }
241537
241542
  _remove(directory, item, isDirectory2) {
241538
- const path46 = sysPath2.join(directory, item);
241539
- const fullPath = sysPath2.resolve(path46);
241540
- isDirectory2 = isDirectory2 != null ? isDirectory2 : this._watched.has(path46) || this._watched.has(fullPath);
241541
- if (!this._throttle("remove", path46, 100))
241543
+ const path47 = sysPath2.join(directory, item);
241544
+ const fullPath = sysPath2.resolve(path47);
241545
+ isDirectory2 = isDirectory2 != null ? isDirectory2 : this._watched.has(path47) || this._watched.has(fullPath);
241546
+ if (!this._throttle("remove", path47, 100))
241542
241547
  return;
241543
241548
  if (!isDirectory2 && this._watched.size === 1) {
241544
241549
  this.add(directory, item, true);
241545
241550
  }
241546
- const wp3 = this._getWatchedDir(path46);
241551
+ const wp3 = this._getWatchedDir(path47);
241547
241552
  const nestedDirectoryChildren = wp3.getChildren();
241548
- nestedDirectoryChildren.forEach((nested) => this._remove(path46, nested));
241553
+ nestedDirectoryChildren.forEach((nested) => this._remove(path47, nested));
241549
241554
  const parent = this._getWatchedDir(directory);
241550
241555
  const wasTracked = parent.has(item);
241551
241556
  parent.remove(item);
241552
241557
  if (this._symlinkPaths.has(fullPath)) {
241553
241558
  this._symlinkPaths.delete(fullPath);
241554
241559
  }
241555
- let relPath = path46;
241560
+ let relPath = path47;
241556
241561
  if (this.options.cwd)
241557
- relPath = sysPath2.relative(this.options.cwd, path46);
241562
+ relPath = sysPath2.relative(this.options.cwd, path47);
241558
241563
  if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
241559
241564
  const event = this._pendingWrites.get(relPath).cancelWait();
241560
241565
  if (event === EVENTS.ADD)
241561
241566
  return;
241562
241567
  }
241563
- this._watched.delete(path46);
241568
+ this._watched.delete(path47);
241564
241569
  this._watched.delete(fullPath);
241565
241570
  const eventName = isDirectory2 ? EVENTS.UNLINK_DIR : EVENTS.UNLINK;
241566
- if (wasTracked && !this._isIgnored(path46))
241567
- this._emit(eventName, path46);
241568
- this._closePath(path46);
241571
+ if (wasTracked && !this._isIgnored(path47))
241572
+ this._emit(eventName, path47);
241573
+ this._closePath(path47);
241569
241574
  }
241570
- _closePath(path46) {
241571
- this._closeFile(path46);
241572
- const dir = sysPath2.dirname(path46);
241573
- this._getWatchedDir(dir).remove(sysPath2.basename(path46));
241575
+ _closePath(path47) {
241576
+ this._closeFile(path47);
241577
+ const dir = sysPath2.dirname(path47);
241578
+ this._getWatchedDir(dir).remove(sysPath2.basename(path47));
241574
241579
  }
241575
- _closeFile(path46) {
241576
- const closers = this._closers.get(path46);
241580
+ _closeFile(path47) {
241581
+ const closers = this._closers.get(path47);
241577
241582
  if (!closers)
241578
241583
  return;
241579
241584
  closers.forEach((closer) => closer());
241580
- this._closers.delete(path46);
241585
+ this._closers.delete(path47);
241581
241586
  }
241582
- _addPathCloser(path46, closer) {
241587
+ _addPathCloser(path47, closer) {
241583
241588
  if (!closer)
241584
241589
  return;
241585
- let list = this._closers.get(path46);
241590
+ let list = this._closers.get(path47);
241586
241591
  if (!list) {
241587
241592
  list = [];
241588
- this._closers.set(path46, list);
241593
+ this._closers.set(path47, list);
241589
241594
  }
241590
241595
  list.push(closer);
241591
241596
  }
@@ -241618,10 +241623,10 @@ import Debug3 from "debug";
241618
241623
 
241619
241624
  // lib/dependency-analysis/getNodeModuleDependencies.ts
241620
241625
  import * as ts3 from "typescript";
241621
- import * as path46 from "path";
241626
+ import * as path47 from "path";
241622
241627
  import * as fs45 from "fs";
241623
241628
  function getAllDependencyPackages(projectDir) {
241624
- const packageJsonPath = path46.join(projectDir, "package.json");
241629
+ const packageJsonPath = path47.join(projectDir, "package.json");
241625
241630
  const allPackages = new Set;
241626
241631
  if (!fs45.existsSync(packageJsonPath)) {
241627
241632
  return allPackages;
@@ -241642,7 +241647,7 @@ function getAllDependencyPackages(projectDir) {
241642
241647
  return allPackages;
241643
241648
  }
241644
241649
  function getNodeModuleImports(filePath) {
241645
- const absolutePath = path46.resolve(filePath);
241650
+ const absolutePath = path47.resolve(filePath);
241646
241651
  if (!fs45.existsSync(absolutePath)) {
241647
241652
  return [];
241648
241653
  }
@@ -241696,17 +241701,17 @@ function resolveNodeModuleImport({
241696
241701
  }) {
241697
241702
  const packageName = getPackageNameFromImport(importPath);
241698
241703
  const searchPaths = [
241699
- path46.join(projectDir, "node_modules", packageName)
241704
+ path47.join(projectDir, "node_modules", packageName)
241700
241705
  ];
241701
241706
  if (searchFromDir) {
241702
- let currentDir = path46.dirname(searchFromDir);
241703
- const projectDirNormalized = path46.normalize(projectDir);
241707
+ let currentDir = path47.dirname(searchFromDir);
241708
+ const projectDirNormalized = path47.normalize(projectDir);
241704
241709
  while (currentDir.startsWith(projectDirNormalized)) {
241705
- const candidatePath = path46.join(currentDir, "node_modules", packageName);
241710
+ const candidatePath = path47.join(currentDir, "node_modules", packageName);
241706
241711
  if (!searchPaths.includes(candidatePath)) {
241707
241712
  searchPaths.push(candidatePath);
241708
241713
  }
241709
- const parentDir = path46.dirname(currentDir);
241714
+ const parentDir = path47.dirname(currentDir);
241710
241715
  if (parentDir === currentDir)
241711
241716
  break;
241712
241717
  currentDir = parentDir;
@@ -241722,22 +241727,22 @@ function resolveNodeModuleImport({
241722
241727
  if (!packageDir) {
241723
241728
  return [];
241724
241729
  }
241725
- const packageJsonPath = path46.join(packageDir, "package.json");
241730
+ const packageJsonPath = path47.join(packageDir, "package.json");
241726
241731
  const hasPackageJson = fs45.existsSync(packageJsonPath);
241727
241732
  const packageJson = hasPackageJson ? JSON.parse(fs45.readFileSync(packageJsonPath, "utf-8")) : null;
241728
241733
  const resolvedFiles = [];
241729
241734
  if (importPath !== packageName) {
241730
241735
  const subpath = importPath.slice(packageName.length + 1);
241731
241736
  const possiblePaths = [
241732
- path46.join(packageDir, subpath),
241733
- path46.join(packageDir, `${subpath}.js`),
241734
- path46.join(packageDir, `${subpath}.mjs`),
241735
- path46.join(packageDir, `${subpath}.ts`),
241736
- path46.join(packageDir, `${subpath}.tsx`),
241737
- path46.join(packageDir, subpath, "index.js"),
241738
- path46.join(packageDir, subpath, "index.mjs"),
241739
- path46.join(packageDir, subpath, "index.ts"),
241740
- path46.join(packageDir, subpath, "index.tsx")
241737
+ path47.join(packageDir, subpath),
241738
+ path47.join(packageDir, `${subpath}.js`),
241739
+ path47.join(packageDir, `${subpath}.mjs`),
241740
+ path47.join(packageDir, `${subpath}.ts`),
241741
+ path47.join(packageDir, `${subpath}.tsx`),
241742
+ path47.join(packageDir, subpath, "index.js"),
241743
+ path47.join(packageDir, subpath, "index.mjs"),
241744
+ path47.join(packageDir, subpath, "index.ts"),
241745
+ path47.join(packageDir, subpath, "index.tsx")
241741
241746
  ];
241742
241747
  for (const p3 of possiblePaths) {
241743
241748
  if (fs45.existsSync(p3) && fs45.statSync(p3).isFile()) {
@@ -241772,22 +241777,22 @@ function resolveNodeModuleImport({
241772
241777
  resolveExportValue(packageJson.exports?.["."]?.require)
241773
241778
  ].filter((entry) => typeof entry === "string");
241774
241779
  for (const entry of entryPoints) {
241775
- const entryPath = path46.join(packageDir, entry);
241780
+ const entryPath = path47.join(packageDir, entry);
241776
241781
  if (fs45.existsSync(entryPath) && fs45.statSync(entryPath).isFile()) {
241777
241782
  resolvedFiles.push(entryPath);
241778
241783
  }
241779
241784
  }
241780
241785
  if (resolvedFiles.length === 0) {
241781
241786
  const fallbackPaths = [
241782
- path46.join(packageDir, "index.js"),
241783
- path46.join(packageDir, "index.mjs"),
241784
- path46.join(packageDir, "index.ts"),
241785
- path46.join(packageDir, "index.tsx"),
241786
- path46.join(packageDir, "dist", "index.js"),
241787
- path46.join(packageDir, "dist", "index.mjs"),
241788
- path46.join(packageDir, "lib", "index.js"),
241789
- path46.join(packageDir, "src", "index.ts"),
241790
- path46.join(packageDir, "src", "index.tsx")
241787
+ path47.join(packageDir, "index.js"),
241788
+ path47.join(packageDir, "index.mjs"),
241789
+ path47.join(packageDir, "index.ts"),
241790
+ path47.join(packageDir, "index.tsx"),
241791
+ path47.join(packageDir, "dist", "index.js"),
241792
+ path47.join(packageDir, "dist", "index.mjs"),
241793
+ path47.join(packageDir, "lib", "index.js"),
241794
+ path47.join(packageDir, "src", "index.ts"),
241795
+ path47.join(packageDir, "src", "index.tsx")
241791
241796
  ];
241792
241797
  for (const p3 of fallbackPaths) {
241793
241798
  if (fs45.existsSync(p3) && fs45.statSync(p3).isFile()) {
@@ -241828,8 +241833,8 @@ function collectAllNodeModuleDependencies(entryFilePath, projectDir, maxDepth =
241828
241833
  }
241829
241834
  }
241830
241835
  function getLocalDependencies(filePath) {
241831
- const absolutePath = path46.resolve(filePath);
241832
- const baseDir = path46.dirname(absolutePath);
241836
+ const absolutePath = path47.resolve(filePath);
241837
+ const baseDir = path47.dirname(absolutePath);
241833
241838
  if (!fs45.existsSync(absolutePath)) {
241834
241839
  return [];
241835
241840
  }
@@ -241855,7 +241860,7 @@ function collectAllNodeModuleDependencies(entryFilePath, projectDir, maxDepth =
241855
241860
  }
241856
241861
  function resolveLocalImport(importPath, baseDir) {
241857
241862
  const extensions = [".tsx", ".ts", ".jsx", ".js", ".mjs"];
241858
- const resolvedPath = path46.resolve(baseDir, importPath);
241863
+ const resolvedPath = path47.resolve(baseDir, importPath);
241859
241864
  if (fs45.existsSync(resolvedPath) && fs45.statSync(resolvedPath).isFile()) {
241860
241865
  return resolvedPath;
241861
241866
  }
@@ -241867,7 +241872,7 @@ function collectAllNodeModuleDependencies(entryFilePath, projectDir, maxDepth =
241867
241872
  }
241868
241873
  if (fs45.existsSync(resolvedPath) && fs45.statSync(resolvedPath).isDirectory()) {
241869
241874
  for (const ext of extensions) {
241870
- const indexPath = path46.join(resolvedPath, `index${ext}`);
241875
+ const indexPath = path47.join(resolvedPath, `index${ext}`);
241871
241876
  if (fs45.existsSync(indexPath)) {
241872
241877
  return indexPath;
241873
241878
  }
@@ -241893,11 +241898,11 @@ var EXCLUDED_PACKAGE_DIRECTORIES = new Set([
241893
241898
  function collectLocalPackageFiles(packageDir) {
241894
241899
  const buildDirs = ["dist", "build"];
241895
241900
  for (const dirName of buildDirs) {
241896
- const dirPath = path46.join(packageDir, dirName);
241901
+ const dirPath = path47.join(packageDir, dirName);
241897
241902
  if (fs45.existsSync(dirPath)) {
241898
241903
  const files = walkDirectory(dirPath, new Set);
241899
241904
  if (files.length > 0) {
241900
- const packageJsonPath = path46.join(packageDir, "package.json");
241905
+ const packageJsonPath = path47.join(packageDir, "package.json");
241901
241906
  if (fs45.existsSync(packageJsonPath)) {
241902
241907
  files.push(packageJsonPath);
241903
241908
  }
@@ -241913,7 +241918,7 @@ function walkDirectory(dir, excludedDirs) {
241913
241918
  return files;
241914
241919
  const entries = fs45.readdirSync(dir, { withFileTypes: true });
241915
241920
  for (const entry of entries) {
241916
- const fullPath = path46.join(dir, entry.name);
241921
+ const fullPath = path47.join(dir, entry.name);
241917
241922
  if (entry.isDirectory()) {
241918
241923
  if (excludedDirs.has(entry.name)) {
241919
241924
  continue;
@@ -241974,10 +241979,10 @@ function getAllNodeModuleFilePaths(entryFilePath, projectDir) {
241974
241979
  processedPackages.add(packageName);
241975
241980
  if (resolvedFiles.length > 0) {
241976
241981
  const firstResolvedFile = resolvedFiles[0];
241977
- let packageDir = path46.dirname(firstResolvedFile);
241982
+ let packageDir = path47.dirname(firstResolvedFile);
241978
241983
  let hasPackageJson = false;
241979
241984
  while (packageDir.includes("node_modules")) {
241980
- const packageJsonPath = path46.join(packageDir, "package.json");
241985
+ const packageJsonPath = path47.join(packageDir, "package.json");
241981
241986
  if (fs45.existsSync(packageJsonPath)) {
241982
241987
  try {
241983
241988
  const pkgJson = JSON.parse(fs45.readFileSync(packageJsonPath, "utf-8"));
@@ -241988,10 +241993,10 @@ function getAllNodeModuleFilePaths(entryFilePath, projectDir) {
241988
241993
  } catch {}
241989
241994
  }
241990
241995
  const expectedPackagePath = packageName.startsWith("@") ? `node_modules/${packageName}` : `node_modules/${packageName}`;
241991
- if (packageDir.endsWith(expectedPackagePath) || packageDir.endsWith(expectedPackagePath.replace(/\//g, path46.sep))) {
241996
+ if (packageDir.endsWith(expectedPackagePath) || packageDir.endsWith(expectedPackagePath.replace(/\//g, path47.sep))) {
241992
241997
  break;
241993
241998
  }
241994
- const parentDir = path46.dirname(packageDir);
241999
+ const parentDir = path47.dirname(packageDir);
241995
242000
  if (parentDir === packageDir)
241996
242001
  break;
241997
242002
  packageDir = parentDir;
@@ -242765,10 +242770,10 @@ var databaseSchema = z7.object({
242765
242770
  files: z7.array(fileSchema).default([]),
242766
242771
  events: z7.array(eventSchema).default([])
242767
242772
  });
242768
- function normalizePath2(path47) {
242769
- if (!path47 || path47 === "/")
242773
+ function normalizePath2(path48) {
242774
+ if (!path48 || path48 === "/")
242770
242775
  return "";
242771
- let normalized = path47.replace(/\\+/g, "/").replace(/\/\/+/, "/");
242776
+ let normalized = path48.replace(/\\+/g, "/").replace(/\/\/+/, "/");
242772
242777
  if (normalized.startsWith("/")) {
242773
242778
  normalized = normalized.slice(1);
242774
242779
  }
@@ -243626,13 +243631,13 @@ var getIndex = async (mainComponentPath, fileServerApiBaseUrl) => {
243626
243631
 
243627
243632
  // lib/server/kicad-pcm-proxy.ts
243628
243633
  import * as fs46 from "node:fs";
243629
- import * as path47 from "node:path";
243634
+ import * as path48 from "node:path";
243630
243635
  var getSourceFilesChecksum = (projectDir) => {
243631
243636
  const sourceFiles = globbySync(["**/*.tsx", "**/*.ts", "**/*.json", "!node_modules/**", "!dist/**"], { cwd: projectDir });
243632
243637
  let checksum = "";
243633
243638
  for (const file of sourceFiles) {
243634
243639
  try {
243635
- const stat4 = fs46.statSync(path47.join(projectDir, file));
243640
+ const stat4 = fs46.statSync(path48.join(projectDir, file));
243636
243641
  checksum += `${file}:${stat4.mtimeMs};`;
243637
243642
  } catch {}
243638
243643
  }
@@ -243652,9 +243657,9 @@ var createKicadPcmProxy = ({
243652
243657
  };
243653
243658
  const handleRequest = async (url2, res2) => {
243654
243659
  const requestedFile = url2.pathname.replace(/^\/pcm\/?/, "") || "repository.json";
243655
- const distDir = path47.join(projectDir, "dist");
243656
- const pcmDir = path47.join(distDir, "pcm");
243657
- const filePath = path47.join(pcmDir, requestedFile);
243660
+ const distDir = path48.join(projectDir, "dist");
243661
+ const pcmDir = path48.join(distDir, "pcm");
243662
+ const filePath = path48.join(pcmDir, requestedFile);
243658
243663
  const currentChecksum = getSourceFilesChecksum(projectDir);
243659
243664
  const needsRebuild = currentChecksum !== pcmState.lastFileChecksum;
243660
243665
  if (needsRebuild) {
@@ -243704,7 +243709,7 @@ Rebuilding KiCad PCM assets...`));
243704
243709
  res2.end(`PCM file not found: ${requestedFile}`);
243705
243710
  return;
243706
243711
  }
243707
- const ext = path47.extname(filePath).toLowerCase();
243712
+ const ext = path48.extname(filePath).toLowerCase();
243708
243713
  let contentType = "application/octet-stream";
243709
243714
  if (ext === ".json") {
243710
243715
  contentType = "application/json";
@@ -243836,7 +243841,7 @@ var createHttpServer = async ({
243836
243841
  // lib/shared/push-snippet.ts
243837
243842
  var import_semver3 = __toESM2(require_semver2(), 1);
243838
243843
  import * as fs48 from "node:fs";
243839
- import * as path50 from "node:path";
243844
+ import * as path51 from "node:path";
243840
243845
  import Debug2 from "debug";
243841
243846
 
243842
243847
  // lib/utils/validate-package-name.ts
@@ -243854,7 +243859,7 @@ var validatePackageName = (name) => {
243854
243859
  };
243855
243860
 
243856
243861
  // cli/dev/get-package-file-paths.ts
243857
- import * as path48 from "node:path";
243862
+ import * as path49 from "node:path";
243858
243863
  var getPackageFilePaths = (projectDir, ignored = []) => {
243859
243864
  const ignorePatterns = [
243860
243865
  ...DEFAULT_IGNORED_PATTERNS,
@@ -243865,7 +243870,7 @@ var getPackageFilePaths = (projectDir, ignored = []) => {
243865
243870
  ignore: ignorePatterns
243866
243871
  });
243867
243872
  fileNames.sort();
243868
- return fileNames.map((fileName) => path48.join(projectDir, fileName));
243873
+ return fileNames.map((fileName) => path49.join(projectDir, fileName));
243869
243874
  };
243870
243875
 
243871
243876
  // lib/utils/check-org-access.ts
@@ -243881,7 +243886,7 @@ var checkOrgAccess = async (ky3, orgTscircuitHandle) => {
243881
243886
  };
243882
243887
 
243883
243888
  // lib/shared/is-binary-file.ts
243884
- import * as path49 from "node:path";
243889
+ import * as path50 from "node:path";
243885
243890
  var BINARY_FILE_EXTENSIONS = new Set([
243886
243891
  ".glb",
243887
243892
  ".gltf",
@@ -243897,7 +243902,7 @@ var BINARY_FILE_EXTENSIONS = new Set([
243897
243902
  ".tar"
243898
243903
  ]);
243899
243904
  var isBinaryFile = (filePath) => {
243900
- const ext = path49.extname(filePath).toLowerCase();
243905
+ const ext = path50.extname(filePath).toLowerCase();
243901
243906
  return BINARY_FILE_EXTENSIONS.has(ext);
243902
243907
  };
243903
243908
 
@@ -243923,7 +243928,7 @@ var debug11 = Debug2("tsci:push-snippet");
243923
243928
  var getArchivePayload = async (filePaths, projectDir, packageNameWithVersion) => {
243924
243929
  const zip = new import_jszip4.default;
243925
243930
  for (const fullFilePath of filePaths) {
243926
- const relativeFilePath = path50.relative(projectDir, fullFilePath);
243931
+ const relativeFilePath = path51.relative(projectDir, fullFilePath);
243927
243932
  zip.file(relativeFilePath, fs48.readFileSync(fullFilePath));
243928
243933
  }
243929
243934
  const archive = await zip.generateAsync({
@@ -243962,10 +243967,10 @@ var pushSnippet = async ({
243962
243967
  return onExit(1);
243963
243968
  }
243964
243969
  const packageJsonPath = [
243965
- path50.resolve(path50.join(path50.dirname(snippetFilePath), "package.json")),
243966
- path50.resolve(path50.join(process.cwd(), "package.json"))
243967
- ].find((path51) => fs48.existsSync(path51));
243968
- const projectDir = packageJsonPath ? path50.dirname(packageJsonPath) : path50.dirname(snippetFilePath);
243970
+ path51.resolve(path51.join(path51.dirname(snippetFilePath), "package.json")),
243971
+ path51.resolve(path51.join(process.cwd(), "package.json"))
243972
+ ].find((path52) => fs48.existsSync(path52));
243973
+ const projectDir = packageJsonPath ? path51.dirname(packageJsonPath) : path51.dirname(snippetFilePath);
243969
243974
  if (!packageJsonPath) {
243970
243975
  onError("No package.json found, try running 'tsci init' to bootstrap the project");
243971
243976
  return onExit(1);
@@ -244159,7 +244164,7 @@ var pushSnippet = async ({
244159
244164
  json: archivePayload
244160
244165
  });
244161
244166
  for (const fullFilePath of filePaths) {
244162
- const relativeFilePath = path50.relative(projectDir, fullFilePath);
244167
+ const relativeFilePath = path51.relative(projectDir, fullFilePath);
244163
244168
  uploadResults.succeeded.push(relativeFilePath);
244164
244169
  }
244165
244170
  log(kleur_default.gray(`\uD83D\uDCE6 Uploaded archive with ${filePaths.length} files`));
@@ -244169,7 +244174,7 @@ var pushSnippet = async ({
244169
244174
  }
244170
244175
  if (uploadResults.succeeded.length === 0) {
244171
244176
  for (const fullFilePath of filePaths) {
244172
- const relativeFilePath = path50.relative(projectDir, fullFilePath);
244177
+ const relativeFilePath = path51.relative(projectDir, fullFilePath);
244173
244178
  const fileBuffer = fs48.readFileSync(fullFilePath);
244174
244179
  const isBinary = isBinaryFile(relativeFilePath) || hasBinaryContent(fileBuffer);
244175
244180
  const payload = {
@@ -244259,7 +244264,7 @@ class DevServer {
244259
244264
  }) {
244260
244265
  this.port = port;
244261
244266
  this.componentFilePath = componentFilePath;
244262
- this.projectDir = projectDir ?? path51.dirname(componentFilePath);
244267
+ this.projectDir = projectDir ?? path52.dirname(componentFilePath);
244263
244268
  this.kicadPcm = kicadPcm ?? false;
244264
244269
  const projectConfig2 = loadProjectConfig(this.projectDir);
244265
244270
  this.ignoredFiles = projectConfig2?.ignoredFiles ?? [];
@@ -244270,7 +244275,7 @@ class DevServer {
244270
244275
  async start() {
244271
244276
  const { server } = await createHttpServer({
244272
244277
  port: this.port,
244273
- defaultMainComponentPath: path51.relative(this.projectDir, this.componentFilePath),
244278
+ defaultMainComponentPath: path52.relative(this.projectDir, this.componentFilePath),
244274
244279
  kicadPcm: this.kicadPcm,
244275
244280
  projectDir: this.projectDir,
244276
244281
  entryFile: this.componentFilePath
@@ -244286,7 +244291,7 @@ class DevServer {
244286
244291
  this.filesystemWatcher = watch(this.projectDir, {
244287
244292
  persistent: true,
244288
244293
  ignoreInitial: true,
244289
- ignored: (p3) => shouldIgnorePath(path51.relative(this.projectDir, p3), this.ignoredFiles)
244294
+ ignored: (p3) => shouldIgnorePath(path52.relative(this.projectDir, p3), this.ignoredFiles)
244290
244295
  });
244291
244296
  this.filesystemWatcher.on("change", (filePath) => this.handleFileChangedOnFilesystem(filePath));
244292
244297
  this.filesystemWatcher.on("add", (filePath) => this.handleFileChangedOnFilesystem(filePath));
@@ -244301,8 +244306,8 @@ class DevServer {
244301
244306
  const { file } = await this.fsKy.get("api/files/get", {
244302
244307
  searchParams: { file_path: ev.file_path }
244303
244308
  }).json();
244304
- const fullPath = path51.join(this.projectDir, ev.file_path);
244305
- const dirPath = path51.dirname(fullPath);
244309
+ const fullPath = path52.join(this.projectDir, ev.file_path);
244310
+ const dirPath = path52.dirname(fullPath);
244306
244311
  if (!fs49.existsSync(dirPath)) {
244307
244312
  fs49.mkdirSync(dirPath, { recursive: true });
244308
244313
  }
@@ -244314,14 +244319,14 @@ class DevServer {
244314
244319
  }
244315
244320
  }
244316
244321
  async handleFileDeletedEventFromServer(ev) {
244317
- const fullPath = path51.join(this.projectDir, ev.file_path);
244322
+ const fullPath = path52.join(this.projectDir, ev.file_path);
244318
244323
  if (fs49.existsSync(fullPath)) {
244319
244324
  debug13(`Deleting file ${ev.file_path} from filesystem`);
244320
244325
  fs49.unlinkSync(fullPath);
244321
244326
  }
244322
244327
  }
244323
244328
  async handleFileChangedOnFilesystem(absoluteFilePath) {
244324
- const relativeFilePath = path51.relative(this.projectDir, absoluteFilePath);
244329
+ const relativeFilePath = path52.relative(this.projectDir, absoluteFilePath);
244325
244330
  if (relativeFilePath.includes("manual-edits.json"))
244326
244331
  return;
244327
244332
  if (shouldIgnorePath(relativeFilePath, this.ignoredFiles))
@@ -244336,14 +244341,14 @@ class DevServer {
244336
244341
  await this.checkAndUploadNewNodeModules(absoluteFilePath);
244337
244342
  }
244338
244343
  async checkAndUploadNewNodeModules(filePath) {
244339
- const ext = path51.extname(filePath).toLowerCase();
244344
+ const ext = path52.extname(filePath).toLowerCase();
244340
244345
  const isSourceFile = [".ts", ".tsx", ".js", ".jsx", ".mjs"].includes(ext);
244341
244346
  if (!isSourceFile)
244342
244347
  return;
244343
244348
  try {
244344
244349
  const nodeModuleFiles = getAllNodeModuleFilePaths(filePath, this.projectDir);
244345
244350
  const newFiles = nodeModuleFiles.filter((file) => {
244346
- const relativePath = path51.relative(this.projectDir, file);
244351
+ const relativePath = path52.relative(this.projectDir, file);
244347
244352
  return !this.uploadedNodeModules.has(relativePath);
244348
244353
  });
244349
244354
  if (newFiles.length === 0)
@@ -244356,7 +244361,7 @@ class DevServer {
244356
244361
  }
244357
244362
  }
244358
244363
  async handleFileRemovedFromFilesystem(absoluteFilePath) {
244359
- const relativeFilePath = path51.relative(this.projectDir, absoluteFilePath);
244364
+ const relativeFilePath = path52.relative(this.projectDir, absoluteFilePath);
244360
244365
  if (shouldIgnorePath(relativeFilePath, this.ignoredFiles))
244361
244366
  return;
244362
244367
  if (!relativeFilePath || relativeFilePath.trim() === "") {
@@ -244394,8 +244399,8 @@ class DevServer {
244394
244399
  debug13(`Successfully deleted file ${relativeFilePath} from server`);
244395
244400
  }
244396
244401
  async handleFileRename(oldPath, newPath) {
244397
- const oldRelativePath = path51.relative(this.projectDir, oldPath);
244398
- const newRelativePath = path51.relative(this.projectDir, newPath);
244402
+ const oldRelativePath = path52.relative(this.projectDir, oldPath);
244403
+ const newRelativePath = path52.relative(this.projectDir, newPath);
244399
244404
  if (shouldIgnorePath(oldRelativePath, this.ignoredFiles) || shouldIgnorePath(newRelativePath, this.ignoredFiles))
244400
244405
  return;
244401
244406
  await this.handleFileRemovedFromFilesystem(oldPath);
@@ -244413,7 +244418,7 @@ class DevServer {
244413
244418
  });
244414
244419
  const filePaths = getPackageFilePaths(this.projectDir, this.ignoredFiles);
244415
244420
  for (const filePath of filePaths) {
244416
- const relativeFilePath = path51.relative(this.projectDir, filePath);
244421
+ const relativeFilePath = path52.relative(this.projectDir, filePath);
244417
244422
  const filePayload = this.createFileUploadPayload(filePath, relativeFilePath);
244418
244423
  await this.postFileUpsert({
244419
244424
  filePath: relativeFilePath,
@@ -244445,7 +244450,7 @@ class DevServer {
244445
244450
  }
244446
244451
  async uploadNodeModuleFiles(files) {
244447
244452
  for (const nodeModuleFile of files) {
244448
- const relativeFilePath = path51.relative(this.projectDir, nodeModuleFile);
244453
+ const relativeFilePath = path52.relative(this.projectDir, nodeModuleFile);
244449
244454
  this.uploadedNodeModules.add(relativeFilePath);
244450
244455
  const filePayload = this.createFileUploadPayload(nodeModuleFile, relativeFilePath);
244451
244456
  await this.postFileUpsert({
@@ -244490,7 +244495,7 @@ class DevServer {
244490
244495
  formData.set("file_path", filePath);
244491
244496
  formData.set("initiator", initiator);
244492
244497
  const binaryBytes = Uint8Array.from(binaryContent);
244493
- formData.set("binary_file", new Blob([binaryBytes]), path51.basename(filePath));
244498
+ formData.set("binary_file", new Blob([binaryBytes]), path52.basename(filePath));
244494
244499
  const response = await fetch(`http://localhost:${this.port}/api/files/upsert-multipart`, {
244495
244500
  method: "POST",
244496
244501
  body: formData
@@ -244530,7 +244535,7 @@ class DevServer {
244530
244535
  await this.filesystemWatcher?.close();
244531
244536
  }
244532
244537
  createFileUploadPayload(absoluteFilePath, relativeFilePath) {
244533
- const ext = path51.extname(relativeFilePath).toLowerCase();
244538
+ const ext = path52.extname(relativeFilePath).toLowerCase();
244534
244539
  if (BINARY_FILE_EXTENSIONS2.has(ext)) {
244535
244540
  const fileBuffer = fs49.readFileSync(absoluteFilePath);
244536
244541
  return { binary_content: fileBuffer };
@@ -244566,7 +244571,7 @@ class DevServer {
244566
244571
 
244567
244572
  // cli/dev/resolve-dev-target.ts
244568
244573
  import * as fs50 from "node:fs";
244569
- import * as path52 from "node:path";
244574
+ import * as path53 from "node:path";
244570
244575
  var findSelectableFiles = (projectDir) => {
244571
244576
  const boardFiles = findBoardFiles({ projectDir }).filter((file) => fs50.existsSync(file)).sort();
244572
244577
  if (boardFiles.length > 0) {
@@ -244576,7 +244581,7 @@ var findSelectableFiles = (projectDir) => {
244576
244581
  cwd: projectDir,
244577
244582
  ignore: DEFAULT_IGNORED_PATTERNS
244578
244583
  });
244579
- return files.map((file) => path52.resolve(projectDir, file)).filter((file) => fs50.existsSync(file)).sort();
244584
+ return files.map((file) => path53.resolve(projectDir, file)).filter((file) => fs50.existsSync(file)).sort();
244580
244585
  };
244581
244586
  var isValidDevFile = (filePath) => {
244582
244587
  return filePath.endsWith(".tsx") || filePath.endsWith(".ts") || filePath.endsWith(".circuit.json");
@@ -244584,7 +244589,7 @@ var isValidDevFile = (filePath) => {
244584
244589
  var resolveDevTarget = async (file) => {
244585
244590
  let projectDir = process.cwd();
244586
244591
  if (file) {
244587
- const resolvedPath = path52.resolve(file);
244592
+ const resolvedPath = path53.resolve(file);
244588
244593
  if (fs50.existsSync(resolvedPath) && fs50.statSync(resolvedPath).isDirectory()) {
244589
244594
  projectDir = resolvedPath;
244590
244595
  const availableFiles2 = findSelectableFiles(projectDir);
@@ -244592,7 +244597,7 @@ var resolveDevTarget = async (file) => {
244592
244597
  console.log(`No .tsx, .ts, or .circuit.json files found in ${projectDir}. Run 'tsci init' to bootstrap a basic project.`);
244593
244598
  return null;
244594
244599
  }
244595
- console.log("Selected file:", path52.relative(projectDir, availableFiles2[0]));
244600
+ console.log("Selected file:", path53.relative(projectDir, availableFiles2[0]));
244596
244601
  return { absolutePath: availableFiles2[0], projectDir };
244597
244602
  }
244598
244603
  if (!fs50.existsSync(resolvedPath)) {
@@ -244615,7 +244620,7 @@ var resolveDevTarget = async (file) => {
244615
244620
  console.log("No .tsx, .ts, or .circuit.json files found in the project. Run 'tsci init' to bootstrap a basic project.");
244616
244621
  return null;
244617
244622
  }
244618
- console.log("Selected file:", path52.relative(projectDir, availableFiles[0]));
244623
+ console.log("Selected file:", path53.relative(projectDir, availableFiles[0]));
244619
244624
  return { absolutePath: availableFiles[0], projectDir };
244620
244625
  };
244621
244626
 
@@ -244631,7 +244636,7 @@ var isPortAvailable = (port) => {
244631
244636
  });
244632
244637
  };
244633
244638
  var warnIfTsconfigMissingTscircuitType = (projectDir) => {
244634
- const tsconfigPath = path53.join(projectDir, "tsconfig.json");
244639
+ const tsconfigPath = path54.join(projectDir, "tsconfig.json");
244635
244640
  if (!fs51.existsSync(tsconfigPath)) {
244636
244641
  return;
244637
244642
  }
@@ -244668,7 +244673,7 @@ var registerDev = (program2) => {
244668
244673
 
244669
244674
  ${kleur_default.green(`@tscircuit/cli@${getVersion()}`)} ${kleur_default.gray("ready in")} ${kleur_default.white(`${Math.round(timeToStart)}ms`)}`);
244670
244675
  console.log(`
244671
- ${kleur_default.bold("➜ Local:")} ${kleur_default.underline(kleur_default.cyan(`http://localhost:${port}`))}${server.componentFilePath ? kleur_default.underline(kleur_default.cyan(`/#file=${encodeURIComponent(path53.relative(process.cwd(), server.componentFilePath).replaceAll("\\", "/"))}`)) : ""}
244676
+ ${kleur_default.bold("➜ Local:")} ${kleur_default.underline(kleur_default.cyan(`http://localhost:${port}`))}${server.componentFilePath ? kleur_default.underline(kleur_default.cyan(`/#file=${encodeURIComponent(path54.relative(process.cwd(), server.componentFilePath).replaceAll("\\", "/"))}`)) : ""}
244672
244677
 
244673
244678
  `);
244674
244679
  console.log(kleur_default.gray(`Watching ${kleur_default.underline(server.projectDir.split("/").slice(-2).join("/"))} for changes...`));
@@ -244698,13 +244703,13 @@ var checkLoggedIn = () => {
244698
244703
  import { spawnSync } from "node:child_process";
244699
244704
  import fs52 from "node:fs";
244700
244705
  import os7 from "node:os";
244701
- import path54 from "node:path";
244706
+ import path55 from "node:path";
244702
244707
  var hasBunInstalled = () => {
244703
244708
  const result = spawnSync("bun", ["--version"], { stdio: "ignore" });
244704
244709
  return result.status === 0;
244705
244710
  };
244706
244711
  var createTempProject = (tempDir) => {
244707
- const packageJsonPath = path54.join(tempDir, "package.json");
244712
+ const packageJsonPath = path55.join(tempDir, "package.json");
244708
244713
  const packageJson = {
244709
244714
  name: "tsci-doctor-check",
244710
244715
  version: "0.0.0",
@@ -244724,7 +244729,7 @@ var checkGlobalNpmrcRegistry = async () => {
244724
244729
  details: "Bun is required to verify registry settings. Install Bun and rerun `tsci doctor`."
244725
244730
  };
244726
244731
  }
244727
- const tempDir = fs52.mkdtempSync(path54.join(os7.tmpdir(), "tsci-doctor-"));
244732
+ const tempDir = fs52.mkdtempSync(path55.join(os7.tmpdir(), "tsci-doctor-"));
244728
244733
  try {
244729
244734
  createTempProject(tempDir);
244730
244735
  const result = spawnSync("bun", ["install"], {
@@ -244796,7 +244801,7 @@ var registerDoctor = (program2) => {
244796
244801
 
244797
244802
  // lib/shared/export-snippet.ts
244798
244803
  import fs53 from "node:fs";
244799
- import path55 from "node:path";
244804
+ import path56 from "node:path";
244800
244805
  import { promisify as promisify3 } from "node:util";
244801
244806
  import { convertCircuitJsonToGltf as convertCircuitJsonToGltf4 } from "circuit-json-to-gltf";
244802
244807
  import {
@@ -245763,9 +245768,9 @@ var stringifyDsnJson = (dsnJson) => {
245763
245768
  const stringifyCoordinates = (coordinates) => {
245764
245769
  return coordinates.join(" ");
245765
245770
  };
245766
- const stringifyPath = (path55, level) => {
245771
+ const stringifyPath = (path56, level) => {
245767
245772
  const padding = indent.repeat(level);
245768
- return `${padding}(path ${path55.layer} ${path55.width} ${stringifyCoordinates(path55.coordinates)})`;
245773
+ return `${padding}(path ${path56.layer} ${path56.width} ${stringifyCoordinates(path56.coordinates)})`;
245769
245774
  };
245770
245775
  result += `(pcb ${dsnJson.filename ? dsnJson.filename : "./converted_dsn.dsn"}
245771
245776
  `;
@@ -249631,11 +249636,11 @@ var convertSoupToGerberCommands = (soup, opts = {}) => {
249631
249636
  continue;
249632
249637
  }
249633
249638
  const letterPaths = lineAlphabet2[char] || [];
249634
- for (const path55 of letterPaths) {
249635
- const x12 = anchoredX + path55.x1 * fontSize;
249636
- const y12 = anchoredY + path55.y1 * fontSize;
249637
- const x23 = anchoredX + path55.x2 * fontSize;
249638
- const y23 = anchoredY + path55.y2 * fontSize;
249639
+ for (const path56 of letterPaths) {
249640
+ const x12 = anchoredX + path56.x1 * fontSize;
249641
+ const y12 = anchoredY + path56.y1 * fontSize;
249642
+ const x23 = anchoredX + path56.x2 * fontSize;
249643
+ const y23 = anchoredY + path56.y2 * fontSize;
249639
249644
  const p12 = applyTransform2({ x: x12, y: y12 });
249640
249645
  const p23 = applyTransform2({ x: x23, y: y23 });
249641
249646
  gerber.add("move_operation", { x: p12.x, y: mfy(p12.y) });
@@ -250402,10 +250407,10 @@ var exportSnippet = async ({
250402
250407
  onError(`Invalid format: ${format}`);
250403
250408
  return onExit(1);
250404
250409
  }
250405
- const projectDir = path55.dirname(filePath);
250406
- const outputBaseName = path55.basename(filePath).replace(/\.[^.]+$/, "");
250410
+ const projectDir = path56.dirname(filePath);
250411
+ const outputBaseName = path56.basename(filePath).replace(/\.[^.]+$/, "");
250407
250412
  const outputFileName = `${outputBaseName}${OUTPUT_EXTENSIONS[format]}`;
250408
- const outputDestination = path55.join(projectDir, outputPath ?? outputFileName);
250413
+ const outputDestination = path56.join(projectDir, outputPath ?? outputFileName);
250409
250414
  if (format === "kicad-library") {
250410
250415
  try {
250411
250416
  const result = await convertToKicadLibrary({
@@ -250513,7 +250518,7 @@ var exportSnippet = async ({
250513
250518
  zip.file(`${outputBaseName}.kicad_pro`, proConverter.getOutputString());
250514
250519
  const platformFetch2 = platformConfig2?.platformFetch ?? globalThis.fetch;
250515
250520
  for (const modelPath of pcbConverter.getModel3dSourcePaths()) {
250516
- const fileName = path55.basename(modelPath);
250521
+ const fileName = path56.basename(modelPath);
250517
250522
  const isRemote = modelPath.startsWith("http://") || modelPath.startsWith("https://");
250518
250523
  const shapesDir = isRemote ? "tscircuit_builtin.3dshapes" : `${outputBaseName}.3dshapes`;
250519
250524
  const zipPath = `3dmodels/${shapesDir}/${fileName}`;
@@ -250528,7 +250533,7 @@ var exportSnippet = async ({
250528
250533
  console.warn(`Failed to fetch 3D model from ${modelPath}`);
250529
250534
  }
250530
250535
  } else {
250531
- const resolvedPath = path55.resolve(projectDir, modelPath);
250536
+ const resolvedPath = path56.resolve(projectDir, modelPath);
250532
250537
  if (fs53.existsSync(resolvedPath)) {
250533
250538
  zip.file(zipPath, await fs53.promises.readFile(resolvedPath));
250534
250539
  }
@@ -250704,11 +250709,11 @@ var getSpiceWithPaddedSim = (circuitJson, options) => {
250704
250709
 
250705
250710
  // lib/eecircuit-engine/run-simulation.ts
250706
250711
  import { promises as fs54, existsSync as existsSync13 } from "node:fs";
250707
- import path56 from "node:path";
250712
+ import path57 from "node:path";
250708
250713
  import os8 from "node:os";
250709
250714
  var sim = null;
250710
250715
  var fetchSimulation = async () => {
250711
- const tempFilePath = path56.join(os8.tmpdir(), "eecircuit-engine-1.5.2.mjs");
250716
+ const tempFilePath = path57.join(os8.tmpdir(), "eecircuit-engine-1.5.2.mjs");
250712
250717
  if (!existsSync13(tempFilePath)) {
250713
250718
  const url2 = "https://cdn.jsdelivr.net/npm/eecircuit-engine@1.5.2/+esm";
250714
250719
  const response = await fetch(url2);
@@ -250805,7 +250810,7 @@ var resultToCsv = (result) => {
250805
250810
  };
250806
250811
 
250807
250812
  // cli/export/register.ts
250808
- import path57 from "node:path";
250813
+ import path58 from "node:path";
250809
250814
  import { promises as fs55 } from "node:fs";
250810
250815
  var registerExport = (program2) => {
250811
250816
  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) => {
@@ -250818,7 +250823,7 @@ var registerExport = (program2) => {
250818
250823
  });
250819
250824
  if (circuitJson) {
250820
250825
  const spiceString = getSpiceWithPaddedSim(circuitJson);
250821
- const outputSpicePath = options.output ?? path57.join(path57.dirname(file), `${path57.basename(file, path57.extname(file))}.spice.cir`);
250826
+ const outputSpicePath = options.output ?? path58.join(path58.dirname(file), `${path58.basename(file, path58.extname(file))}.spice.cir`);
250822
250827
  await fs55.writeFile(outputSpicePath, spiceString);
250823
250828
  const { result } = await runSimulation(spiceString);
250824
250829
  const csvContent = resultToCsv(result);
@@ -251545,8 +251550,8 @@ function getErrorMap2() {
251545
251550
  return overrideErrorMap2;
251546
251551
  }
251547
251552
  var makeIssue2 = (params2) => {
251548
- const { data, path: path58, errorMaps, issueData } = params2;
251549
- const fullPath = [...path58, ...issueData.path || []];
251553
+ const { data, path: path59, errorMaps, issueData } = params2;
251554
+ const fullPath = [...path59, ...issueData.path || []];
251550
251555
  const fullIssue = {
251551
251556
  ...issueData,
251552
251557
  path: fullPath
@@ -251654,11 +251659,11 @@ var errorUtil2;
251654
251659
  errorUtil22.toString = (message) => typeof message === "string" ? message : message?.message;
251655
251660
  })(errorUtil2 || (errorUtil2 = {}));
251656
251661
  var ParseInputLazyPath2 = class {
251657
- constructor(parent, value, path58, key) {
251662
+ constructor(parent, value, path59, key) {
251658
251663
  this._cachedPath = [];
251659
251664
  this.parent = parent;
251660
251665
  this.data = value;
251661
- this._path = path58;
251666
+ this._path = path59;
251662
251667
  this._key = key;
251663
251668
  }
251664
251669
  get path() {
@@ -259316,15 +259321,15 @@ function generateArcFromSweep(startX, startY, endX, endY, radius, largeArcFlag,
259316
259321
  }
259317
259322
  }
259318
259323
  const numPoints = Math.max(2, Math.ceil(Math.abs(endAngle - startAngle) * radius));
259319
- const path58 = [];
259324
+ const path59 = [];
259320
259325
  for (let i2 = 0;i2 <= numPoints; i2++) {
259321
259326
  const t17 = i2 / numPoints;
259322
259327
  const angle2 = startAngle + t17 * (endAngle - startAngle);
259323
259328
  const x3 = centerX + radius * Math.cos(angle2);
259324
259329
  const y4 = centerY + radius * Math.sin(angle2);
259325
- path58.push({ x: x3, y: y4 });
259330
+ path59.push({ x: x3, y: y4 });
259326
259331
  }
259327
- return path58;
259332
+ return path59;
259328
259333
  }
259329
259334
  var mil10ToMm = (value) => value * 10 * 0.0254;
259330
259335
  var normalizePinLabels = (inputPinLabels) => {
@@ -260296,7 +260301,7 @@ var parsePin = (pinString) => {
260296
260301
  const colorMatch = pinString.match(/#[0-9A-F]{6}/);
260297
260302
  const labelColor = colorMatch ? colorMatch[0] : "";
260298
260303
  const pathMatch = pinString.match(/\^\^([^~]+)/);
260299
- const path58 = pathMatch ? pathMatch[1] : "";
260304
+ const path59 = pathMatch ? pathMatch[1] : "";
260300
260305
  const arrowMatch = pinString.match(/\^\^0~(.+)$/);
260301
260306
  const arrow = arrowMatch ? arrowMatch[1] : "";
260302
260307
  const r4 = Number.parseFloat(rotation22);
@@ -260310,7 +260315,7 @@ var parsePin = (pinString) => {
260310
260315
  rotation: Number.isNaN(r4) ? 0 : r4,
260311
260316
  label,
260312
260317
  labelColor,
260313
- path: path58,
260318
+ path: path59,
260314
260319
  arrow
260315
260320
  };
260316
260321
  };
@@ -267136,14 +267141,14 @@ function normalizeManufacturerPartNumber2(partNumber) {
267136
267141
 
267137
267142
  // lib/import/import-component-from-jlcpcb.ts
267138
267143
  import fs56 from "node:fs/promises";
267139
- import path58 from "node:path";
267144
+ import path59 from "node:path";
267140
267145
  var importComponentFromJlcpcb = async (jlcpcbPartNumber, projectDir = process.cwd(), options = {}) => {
267141
267146
  const rawEasy = await fetchEasyEDAComponent(jlcpcbPartNumber);
267142
267147
  const betterEasy = EasyEdaJsonSchema2.parse(rawEasy);
267143
267148
  const rawPn = betterEasy.dataStr.head.c_para["Manufacturer Part"];
267144
267149
  const componentName = rawPn ? normalizeManufacturerPartNumber2(rawPn) : jlcpcbPartNumber;
267145
267150
  let tsx = await convertRawEasyToTsx({ rawEasy });
267146
- const componentDir = options.download ? path58.join(projectDir, "imports", componentName) : path58.join(projectDir, "imports");
267151
+ const componentDir = options.download ? path59.join(projectDir, "imports", componentName) : path59.join(projectDir, "imports");
267147
267152
  await fs56.mkdir(componentDir, { recursive: true });
267148
267153
  if (options.download) {
267149
267154
  const platformConfig2 = getCompletePlatformConfig();
@@ -267155,7 +267160,7 @@ var importComponentFromJlcpcb = async (jlcpcbPartNumber, projectDir = process.cw
267155
267160
  if (cadComponent?.model_step_url) {
267156
267161
  const stepFileName = `${componentName}.step`;
267157
267162
  const stepResp = await platformFetch2(cadComponent.model_step_url);
267158
- await fs56.writeFile(path58.join(componentDir, stepFileName), Buffer.from(await stepResp.arrayBuffer()));
267163
+ await fs56.writeFile(path59.join(componentDir, stepFileName), Buffer.from(await stepResp.arrayBuffer()));
267159
267164
  tsx = `import stepPath from "./${stepFileName}"
267160
267165
  ` + tsx;
267161
267166
  tsx = tsx.replace(`"${cadComponent.model_step_url}"`, "stepPath");
@@ -267163,13 +267168,13 @@ var importComponentFromJlcpcb = async (jlcpcbPartNumber, projectDir = process.cw
267163
267168
  if (cadComponent?.model_obj_url) {
267164
267169
  const objFileName = `${componentName}.obj`;
267165
267170
  const objResp = await platformFetch2(cadComponent.model_obj_url);
267166
- await fs56.writeFile(path58.join(componentDir, objFileName), Buffer.from(await objResp.arrayBuffer()));
267171
+ await fs56.writeFile(path59.join(componentDir, objFileName), Buffer.from(await objResp.arrayBuffer()));
267167
267172
  tsx = `import objPath from "./${objFileName}"
267168
267173
  ` + tsx;
267169
267174
  tsx = tsx.replace(`"${cadComponent.model_obj_url}"`, "objPath");
267170
267175
  }
267171
267176
  }
267172
- const filePath = path58.join(componentDir, `${componentName}.tsx`);
267177
+ const filePath = path59.join(componentDir, `${componentName}.tsx`);
267173
267178
  await fs56.writeFile(filePath, tsx);
267174
267179
  return { filePath };
267175
267180
  };
@@ -268618,12 +268623,12 @@ var registerImport = (program2) => {
268618
268623
 
268619
268624
  // cli/init/register.ts
268620
268625
  import * as fs58 from "node:fs";
268621
- import * as path61 from "node:path";
268626
+ import * as path62 from "node:path";
268622
268627
 
268623
268628
  // lib/shared/generate-gitignore-file.ts
268624
- import path59 from "node:path";
268629
+ import path60 from "node:path";
268625
268630
  var generateGitIgnoreFile = (dir) => {
268626
- const gitignorePath = path59.join(dir, ".gitignore");
268631
+ const gitignorePath = path60.join(dir, ".gitignore");
268627
268632
  const gitignoreContent = `# Dependencies
268628
268633
  node_modules/
268629
268634
 
@@ -268659,7 +268664,7 @@ yarn-error.log*
268659
268664
 
268660
268665
  // lib/shared/setup-tscircuit-skill.ts
268661
268666
  import * as fs57 from "node:fs";
268662
- import * as path60 from "node:path";
268667
+ import * as path61 from "node:path";
268663
268668
  var SKILL_REPO_API_URL = "https://api.github.com/repos/tscircuit/skill/contents";
268664
268669
  var SKILL_INSTALL_PATHS = [
268665
268670
  ".claude/skills/tscircuit",
@@ -268682,7 +268687,7 @@ async function fetchFileContent(downloadUrl) {
268682
268687
  async function downloadDirectory(apiUrl, targetDir) {
268683
268688
  const contents = await fetchGitHubContents(apiUrl);
268684
268689
  for (const item of contents) {
268685
- const targetPath = path60.join(targetDir, item.name);
268690
+ const targetPath = path61.join(targetDir, item.name);
268686
268691
  if (item.type === "dir") {
268687
268692
  fs57.mkdirSync(targetPath, { recursive: true });
268688
268693
  await downloadDirectory(`${apiUrl}/${item.name}`, targetPath);
@@ -268699,7 +268704,7 @@ async function downloadSkillRepo(targetDir) {
268699
268704
  if (item.name === ".git" || item.name === ".github") {
268700
268705
  continue;
268701
268706
  }
268702
- const targetPath = path60.join(targetDir, item.name);
268707
+ const targetPath = path61.join(targetDir, item.name);
268703
268708
  if (item.type === "dir") {
268704
268709
  fs57.mkdirSync(targetPath, { recursive: true });
268705
268710
  await downloadDirectory(`${SKILL_REPO_API_URL}/${item.name}`, targetPath);
@@ -268710,7 +268715,7 @@ async function downloadSkillRepo(targetDir) {
268710
268715
  }
268711
268716
  }
268712
268717
  async function setupTscircuitSkill(projectDir, skipPrompt = false) {
268713
- const missingSkillPaths = SKILL_INSTALL_PATHS.filter((skillPath) => !fs57.existsSync(path60.join(projectDir, skillPath, "SKILL.md")));
268718
+ const missingSkillPaths = SKILL_INSTALL_PATHS.filter((skillPath) => !fs57.existsSync(path61.join(projectDir, skillPath, "SKILL.md")));
268714
268719
  if (missingSkillPaths.length === 0) {
268715
268720
  console.log("TSCircuit AI skills already exist, skipping...");
268716
268721
  return true;
@@ -268730,7 +268735,7 @@ async function setupTscircuitSkill(projectDir, skipPrompt = false) {
268730
268735
  console.info("Setting up tscircuit AI skills...");
268731
268736
  try {
268732
268737
  for (const skillPath of missingSkillPaths) {
268733
- const targetDir = path60.join(projectDir, skillPath);
268738
+ const targetDir = path61.join(projectDir, skillPath);
268734
268739
  await downloadSkillRepo(targetDir);
268735
268740
  console.info(`tscircuit skill installed at ${skillPath}`);
268736
268741
  }
@@ -268834,7 +268839,7 @@ var registerInit = (program3) => {
268834
268839
  }
268835
268840
  }
268836
268841
  }
268837
- const projectDir = directory ? path61.resolve(process.cwd(), directory) : process.cwd();
268842
+ const projectDir = directory ? path62.resolve(process.cwd(), directory) : process.cwd();
268838
268843
  let tsciHandle = null;
268839
268844
  const token = getSessionToken();
268840
268845
  if (token) {
@@ -268845,7 +268850,7 @@ var registerInit = (program3) => {
268845
268850
  }
268846
268851
  } catch {}
268847
268852
  }
268848
- const dirName = path61.basename(projectDir);
268853
+ const dirName = path62.basename(projectDir);
268849
268854
  let defaultPackageName = dirName;
268850
268855
  if (tsciHandle) {
268851
268856
  defaultPackageName = `@tsci/${tsciHandle}.${dirName}`;
@@ -268864,7 +268869,7 @@ var registerInit = (program3) => {
268864
268869
  }
268865
268870
  }
268866
268871
  fs58.mkdirSync(projectDir, { recursive: true });
268867
- writeFileIfNotExists(path61.join(projectDir, "index.circuit.tsx"), `
268872
+ writeFileIfNotExists(path62.join(projectDir, "index.circuit.tsx"), `
268868
268873
  export default () => (
268869
268874
  <board>
268870
268875
  <resistor resistance="1k" footprint="0402" name="R1" />
@@ -268876,7 +268881,7 @@ export default () => (
268876
268881
  if (saveProjectConfig(null, projectDir)) {
268877
268882
  console.log("Created tscircuit.config.json with schema");
268878
268883
  }
268879
- writeFileIfNotExists(path61.join(projectDir, ".npmrc"), `
268884
+ writeFileIfNotExists(path62.join(projectDir, ".npmrc"), `
268880
268885
  @tsci:registry=https://npm.tscircuit.com
268881
268886
  `);
268882
268887
  console.log("Generating package.json");
@@ -269008,9 +269013,9 @@ var registerRegistryPackagesCreate = (program3) => {
269008
269013
 
269009
269014
  // cli/registry/packages/update/register.ts
269010
269015
  import fs59 from "node:fs";
269011
- import path62 from "node:path";
269016
+ import path63 from "node:path";
269012
269017
  var getCurrentDirectoryPackageName = () => {
269013
- const packageJsonPath = path62.join(process.cwd(), "package.json");
269018
+ const packageJsonPath = path63.join(process.cwd(), "package.json");
269014
269019
  if (!fs59.existsSync(packageJsonPath))
269015
269020
  return;
269016
269021
  try {
@@ -269150,14 +269155,14 @@ class KeyStore {
269150
269155
  }
269151
269156
  }
269152
269157
  function createKey(key) {
269153
- let path63 = null;
269158
+ let path64 = null;
269154
269159
  let id2 = null;
269155
269160
  let src = null;
269156
269161
  let weight = 1;
269157
269162
  let getFn = null;
269158
269163
  if (isString2(key) || isArray(key)) {
269159
269164
  src = key;
269160
- path63 = createKeyPath(key);
269165
+ path64 = createKeyPath(key);
269161
269166
  id2 = createKeyId(key);
269162
269167
  } else {
269163
269168
  if (!hasOwn.call(key, "name")) {
@@ -269171,11 +269176,11 @@ function createKey(key) {
269171
269176
  throw new Error(INVALID_KEY_WEIGHT_VALUE(name));
269172
269177
  }
269173
269178
  }
269174
- path63 = createKeyPath(name);
269179
+ path64 = createKeyPath(name);
269175
269180
  id2 = createKeyId(name);
269176
269181
  getFn = key.getFn;
269177
269182
  }
269178
- return { path: path63, id: id2, weight, src, getFn };
269183
+ return { path: path64, id: id2, weight, src, getFn };
269179
269184
  }
269180
269185
  function createKeyPath(key) {
269181
269186
  return isArray(key) ? key : key.split(".");
@@ -269183,34 +269188,34 @@ function createKeyPath(key) {
269183
269188
  function createKeyId(key) {
269184
269189
  return isArray(key) ? key.join(".") : key;
269185
269190
  }
269186
- function get(obj, path63) {
269191
+ function get(obj, path64) {
269187
269192
  let list = [];
269188
269193
  let arr = false;
269189
- const deepGet = (obj2, path64, index) => {
269194
+ const deepGet = (obj2, path65, index) => {
269190
269195
  if (!isDefined(obj2)) {
269191
269196
  return;
269192
269197
  }
269193
- if (!path64[index]) {
269198
+ if (!path65[index]) {
269194
269199
  list.push(obj2);
269195
269200
  } else {
269196
- let key = path64[index];
269201
+ let key = path65[index];
269197
269202
  const value = obj2[key];
269198
269203
  if (!isDefined(value)) {
269199
269204
  return;
269200
269205
  }
269201
- if (index === path64.length - 1 && (isString2(value) || isNumber2(value) || isBoolean(value))) {
269206
+ if (index === path65.length - 1 && (isString2(value) || isNumber2(value) || isBoolean(value))) {
269202
269207
  list.push(toString2(value));
269203
269208
  } else if (isArray(value)) {
269204
269209
  arr = true;
269205
269210
  for (let i2 = 0, len = value.length;i2 < len; i2 += 1) {
269206
- deepGet(value[i2], path64, index + 1);
269211
+ deepGet(value[i2], path65, index + 1);
269207
269212
  }
269208
- } else if (path64.length) {
269209
- deepGet(value, path64, index + 1);
269213
+ } else if (path65.length) {
269214
+ deepGet(value, path65, index + 1);
269210
269215
  }
269211
269216
  }
269212
269217
  };
269213
- deepGet(obj, isString2(path63) ? path63.split(".") : path63, 0);
269218
+ deepGet(obj, isString2(path64) ? path64.split(".") : path64, 0);
269214
269219
  return arr ? list : list[0];
269215
269220
  }
269216
269221
  var MatchOptions = {
@@ -270406,9 +270411,9 @@ var registerSearch = (program3) => {
270406
270411
  }
270407
270412
  if (opts.json) {
270408
270413
  const unifiedResults = [
270409
- ...kicadResults.map((path63) => ({
270414
+ ...kicadResults.map((path64) => ({
270410
270415
  source: "kicad",
270411
- path: path63
270416
+ path: path64
270412
270417
  })),
270413
270418
  ...results.packages.map((pkg) => ({
270414
270419
  source: "tscircuit",
@@ -270436,8 +270441,8 @@ var registerSearch = (program3) => {
270436
270441
  }
270437
270442
  if (kicadResults.length) {
270438
270443
  console.log(kleur_default.bold().underline(`Found ${kicadResults.length} footprint(s) from KiCad:`));
270439
- kicadResults.forEach((path63, idx) => {
270440
- console.log(`${(idx + 1).toString().padStart(2, " ")}. kicad:${path63.replace(".kicad_mod", "").replace(".pretty", "")}`);
270444
+ kicadResults.forEach((path64, idx) => {
270445
+ console.log(`${(idx + 1).toString().padStart(2, " ")}. kicad:${path64.replace(".kicad_mod", "").replace(".pretty", "")}`);
270441
270446
  });
270442
270447
  }
270443
270448
  if (results.packages.length) {
@@ -270462,20 +270467,20 @@ var registerSearch = (program3) => {
270462
270467
 
270463
270468
  // lib/shared/setup-github-actions.ts
270464
270469
  import fs60 from "node:fs";
270465
- import path63 from "node:path";
270470
+ import path64 from "node:path";
270466
270471
  var setupGithubActions = (projectDir = process.cwd()) => {
270467
270472
  const findGitRoot = (startDir) => {
270468
- let dir = path63.resolve(startDir);
270469
- while (dir !== path63.parse(dir).root) {
270470
- if (fs60.existsSync(path63.join(dir, ".git"))) {
270473
+ let dir = path64.resolve(startDir);
270474
+ while (dir !== path64.parse(dir).root) {
270475
+ if (fs60.existsSync(path64.join(dir, ".git"))) {
270471
270476
  return dir;
270472
270477
  }
270473
- dir = path63.dirname(dir);
270478
+ dir = path64.dirname(dir);
270474
270479
  }
270475
270480
  return null;
270476
270481
  };
270477
270482
  const gitRoot = findGitRoot(projectDir) ?? projectDir;
270478
- const workflowsDir = path63.join(gitRoot, ".github", "workflows");
270483
+ const workflowsDir = path64.join(gitRoot, ".github", "workflows");
270479
270484
  fs60.mkdirSync(workflowsDir, { recursive: true });
270480
270485
  const buildWorkflow = `name: tscircuit Build
270481
270486
 
@@ -270515,8 +270520,8 @@ jobs:
270515
270520
  - run: bun install
270516
270521
  - run: bunx tsci snapshot
270517
270522
  `;
270518
- writeFileIfNotExists(path63.join(workflowsDir, "tscircuit-build.yml"), buildWorkflow);
270519
- writeFileIfNotExists(path63.join(workflowsDir, "tscircuit-snapshot.yml"), snapshotWorkflow);
270523
+ writeFileIfNotExists(path64.join(workflowsDir, "tscircuit-build.yml"), buildWorkflow);
270524
+ writeFileIfNotExists(path64.join(workflowsDir, "tscircuit-snapshot.yml"), snapshotWorkflow);
270520
270525
  };
270521
270526
 
270522
270527
  // cli/setup/register.ts
@@ -270684,21 +270689,21 @@ function applyCameraPreset(preset, cam) {
270684
270689
 
270685
270690
  // lib/shared/snapshot-project.ts
270686
270691
  import fs64 from "node:fs";
270687
- import path66 from "node:path";
270692
+ import path67 from "node:path";
270688
270693
 
270689
270694
  // cli/snapshot/worker-pool.ts
270690
270695
  import fs61 from "node:fs";
270691
- import path64 from "node:path";
270696
+ import path65 from "node:path";
270692
270697
  var getWorkerEntrypointPath2 = () => {
270693
- const tsPath = path64.join(import.meta.dir, "snapshot.worker.ts");
270698
+ const tsPath = path65.join(import.meta.dir, "snapshot.worker.ts");
270694
270699
  if (fs61.existsSync(tsPath)) {
270695
270700
  return tsPath;
270696
270701
  }
270697
- const jsBundledPath = path64.join(import.meta.dir, "snapshot", "snapshot.worker.js");
270702
+ const jsBundledPath = path65.join(import.meta.dir, "snapshot", "snapshot.worker.js");
270698
270703
  if (fs61.existsSync(jsBundledPath)) {
270699
270704
  return jsBundledPath;
270700
270705
  }
270701
- return path64.join(import.meta.dir, "snapshot.worker.js");
270706
+ return path65.join(import.meta.dir, "snapshot.worker.js");
270702
270707
  };
270703
270708
  var snapshotFilesWithWorkerPool = async (options) => {
270704
270709
  const cancellationError = new Error("Snapshot cancelled due to file failure");
@@ -270767,7 +270772,7 @@ var snapshotFilesWithWorkerPool = async (options) => {
270767
270772
 
270768
270773
  // lib/shared/process-snapshot-file.ts
270769
270774
  import fs63 from "node:fs";
270770
- import path65 from "node:path";
270775
+ import path66 from "node:path";
270771
270776
  import {
270772
270777
  convertCircuitJsonToGltf as convertCircuitJsonToGltf5,
270773
270778
  getBestCameraPosition
@@ -273508,7 +273513,7 @@ var processSnapshotFile = async ({
273508
273513
  createDiff: createDiff2,
273509
273514
  cameraPreset
273510
273515
  }) => {
273511
- const relativeFilePath = path65.relative(projectDir, file);
273516
+ const relativeFilePath = path66.relative(projectDir, file);
273512
273517
  const successPaths = [];
273513
273518
  const warningMessages = [];
273514
273519
  const mismatches = [];
@@ -273589,11 +273594,11 @@ var processSnapshotFile = async ({
273589
273594
  } catch (error) {
273590
273595
  const errorMessage = error instanceof Error ? error.message : String(error);
273591
273596
  if (errorMessage.includes("No pcb_board found in circuit JSON")) {
273592
- const fileDir = path65.dirname(file);
273593
- const relativeDir = path65.relative(projectDir, fileDir);
273594
- const snapDir2 = snapshotsDirName ? path65.join(projectDir, snapshotsDirName, relativeDir) : path65.join(fileDir, "__snapshots__");
273595
- const base2 = path65.basename(file).replace(/\.[^.]+$/, "");
273596
- const snap3dPath = path65.join(snapDir2, `${base2}-3d.snap.png`);
273597
+ const fileDir = path66.dirname(file);
273598
+ const relativeDir = path66.relative(projectDir, fileDir);
273599
+ const snapDir2 = snapshotsDirName ? path66.join(projectDir, snapshotsDirName, relativeDir) : path66.join(fileDir, "__snapshots__");
273600
+ const base2 = path66.basename(file).replace(/\.[^.]+$/, "");
273601
+ const snap3dPath = path66.join(snapDir2, `${base2}-3d.snap.png`);
273597
273602
  const existing3dSnapshot = fs63.existsSync(snap3dPath);
273598
273603
  if (existing3dSnapshot) {
273599
273604
  return {
@@ -273605,7 +273610,7 @@ var processSnapshotFile = async ({
273605
273610
  errorMessage: kleur_default.red(`
273606
273611
  ❌ Failed to generate 3D snapshot for ${relativeFilePath}:
273607
273612
  `) + kleur_default.red(` No pcb_board found in circuit JSON
273608
- `) + kleur_default.red(` Existing snapshot: ${path65.relative(projectDir, snap3dPath)}
273613
+ `) + kleur_default.red(` Existing snapshot: ${path66.relative(projectDir, snap3dPath)}
273609
273614
  `)
273610
273615
  };
273611
273616
  }
@@ -273626,9 +273631,9 @@ var processSnapshotFile = async ({
273626
273631
  }
273627
273632
  }
273628
273633
  }
273629
- const snapDir = snapshotsDirName ? path65.join(projectDir, snapshotsDirName, path65.relative(projectDir, path65.dirname(file))) : path65.join(path65.dirname(file), "__snapshots__");
273634
+ const snapDir = snapshotsDirName ? path66.join(projectDir, snapshotsDirName, path66.relative(projectDir, path66.dirname(file))) : path66.join(path66.dirname(file), "__snapshots__");
273630
273635
  fs63.mkdirSync(snapDir, { recursive: true });
273631
- const base = path65.basename(file).replace(/\.[^.]+$/, "");
273636
+ const base = path66.basename(file).replace(/\.[^.]+$/, "");
273632
273637
  const snapshots = [];
273633
273638
  if (pcbOnly || !schematicOnly) {
273634
273639
  snapshots.push({ type: "pcb", content: pcbSvg, isBinary: false });
@@ -273642,13 +273647,13 @@ var processSnapshotFile = async ({
273642
273647
  for (const snapshot of snapshots) {
273643
273648
  const { type } = snapshot;
273644
273649
  const is3d = type === "3d";
273645
- const snapPath = path65.join(snapDir, `${base}-${type}.snap.${is3d ? "png" : "svg"}`);
273650
+ const snapPath = path66.join(snapDir, `${base}-${type}.snap.${is3d ? "png" : "svg"}`);
273646
273651
  const existing = fs63.existsSync(snapPath);
273647
273652
  const newContentBuffer = snapshot.isBinary ? snapshot.content : Buffer.from(snapshot.content, "utf8");
273648
273653
  const newContentForFile = snapshot.content;
273649
273654
  if (!existing) {
273650
273655
  fs63.writeFileSync(snapPath, newContentForFile);
273651
- successPaths.push(path65.relative(projectDir, snapPath));
273656
+ successPaths.push(path66.relative(projectDir, snapPath));
273652
273657
  didUpdate = true;
273653
273658
  continue;
273654
273659
  }
@@ -273664,16 +273669,16 @@ var processSnapshotFile = async ({
273664
273669
  }
273665
273670
  if (update) {
273666
273671
  if (!forceUpdate && equal2) {
273667
- successPaths.push(path65.relative(projectDir, snapPath));
273672
+ successPaths.push(path66.relative(projectDir, snapPath));
273668
273673
  } else {
273669
273674
  fs63.writeFileSync(snapPath, newContentForFile);
273670
- successPaths.push(path65.relative(projectDir, snapPath));
273675
+ successPaths.push(path66.relative(projectDir, snapPath));
273671
273676
  didUpdate = true;
273672
273677
  }
273673
273678
  } else if (!equal2) {
273674
273679
  mismatches.push(diffPath ? `${snapPath} (diff: ${diffPath})` : snapPath);
273675
273680
  } else {
273676
- successPaths.push(path65.relative(projectDir, snapPath));
273681
+ successPaths.push(path66.relative(projectDir, snapPath));
273677
273682
  }
273678
273683
  }
273679
273684
  return {
@@ -273717,7 +273722,7 @@ var snapshotProject = async ({
273717
273722
  ...DEFAULT_IGNORED_PATTERNS,
273718
273723
  ...ignored.map(normalizeIgnorePattern)
273719
273724
  ];
273720
- const resolvedPaths = filePaths.map((f2) => path66.resolve(projectDir, f2));
273725
+ const resolvedPaths = filePaths.map((f2) => path67.resolve(projectDir, f2));
273721
273726
  const explicitDirectoryTarget = resolvedPaths.find((resolvedPath) => {
273722
273727
  if (!fs64.existsSync(resolvedPath)) {
273723
273728
  return false;
@@ -273731,7 +273736,7 @@ var snapshotProject = async ({
273731
273736
  });
273732
273737
  if (boardFiles.length === 0) {
273733
273738
  if (explicitDirectoryTarget) {
273734
- const relativeDirectory = path66.relative(projectDir, explicitDirectoryTarget) || ".";
273739
+ const relativeDirectory = path67.relative(projectDir, explicitDirectoryTarget) || ".";
273735
273740
  const includeBoardFilePatterns = getBoardFilePatterns(projectDir);
273736
273741
  const patternSourceMessage = hasConfiguredIncludeBoardFiles(projectDir) ? "Searched using tscircuit.config.json includeBoardFiles" : "Searched using default includeBoardFiles";
273737
273742
  onError([
@@ -273868,7 +273873,7 @@ var registerSnapshot = (program3) => {
273868
273873
  };
273869
273874
 
273870
273875
  // cli/transpile/register.ts
273871
- import path67 from "node:path";
273876
+ import path68 from "node:path";
273872
273877
  var registerTranspile = (program3) => {
273873
273878
  program3.command("transpile").description("Transpile TypeScript/TSX to JavaScript (ESM, CommonJS, and type declarations)").argument("[file]", "Path to the entry file").action(async (file) => {
273874
273879
  try {
@@ -273876,7 +273881,7 @@ var registerTranspile = (program3) => {
273876
273881
  fileOrDir: file,
273877
273882
  includeBoardFiles: false
273878
273883
  });
273879
- const distDir = path67.join(projectDir, "dist");
273884
+ const distDir = path68.join(projectDir, "dist");
273880
273885
  validateMainInDist(projectDir, distDir);
273881
273886
  console.log("Transpiling entry file...");
273882
273887
  const entryFile = mainEntrypoint || circuitFiles[0];
@@ -273914,12 +273919,12 @@ function registerUpgradeCommand(program3) {
273914
273919
  }
273915
273920
 
273916
273921
  // lib/shared/update-package.ts
273917
- import * as path68 from "node:path";
273922
+ import * as path69 from "node:path";
273918
273923
  import * as fs65 from "node:fs";
273919
273924
  async function updatePackage(packageSpec, projectDir = process.cwd()) {
273920
273925
  const packageManager = getPackageManager();
273921
273926
  if (!packageSpec) {
273922
- const pkgJsonPath = path68.join(projectDir, "package.json");
273927
+ const pkgJsonPath = path69.join(projectDir, "package.json");
273923
273928
  if (!fs65.existsSync(pkgJsonPath)) {
273924
273929
  console.log(kleur_default.yellow("No package.json found. Cannot update all packages."));
273925
273930
  return;