@tscircuit/cli 0.1.1623 → 0.1.1625

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
@@ -90028,7 +90028,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);
90028
90028
  module2.exports = __toCommonJS2(src_exports);
90029
90029
  var import_glob_promise = __toESM4(require_lib5());
90030
90030
  var import_path2 = __toESM4(__require("path"));
90031
- var import_promises9 = __toESM4(__require("fs/promises"));
90031
+ var import_promises10 = __toESM4(__require("fs/promises"));
90032
90032
  var import_fs5 = __toESM4(__require("fs"));
90033
90033
  var import_path = __toESM4(__require("path"));
90034
90034
  var writeVfsToDirectory = async (opts) => {
@@ -90074,7 +90074,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);
90074
90074
  const filePaths = await getMatchingFilePaths(opts);
90075
90075
  const vfs = {};
90076
90076
  for (const filePath of filePaths) {
90077
- vfs[filePath] = await import_promises9.default.readFile(import_path2.default.resolve(dirPath, filePath));
90077
+ vfs[filePath] = await import_promises10.default.readFile(import_path2.default.resolve(dirPath, filePath));
90078
90078
  if (contentFormat === "string") {
90079
90079
  vfs[filePath] = vfs[filePath].toString();
90080
90080
  }
@@ -93628,7 +93628,7 @@ var import_perfect_cli = __toESM2(require_dist2(), 1);
93628
93628
  // lib/getVersion.ts
93629
93629
  import { createRequire as createRequire2 } from "node:module";
93630
93630
  // package.json
93631
- var version = "0.1.1622";
93631
+ var version = "0.1.1623";
93632
93632
  var package_default = {
93633
93633
  name: "@tscircuit/cli",
93634
93634
  version,
@@ -93640,6 +93640,7 @@ var package_default = {
93640
93640
  devDependencies: {
93641
93641
  "@babel/standalone": "^7.26.9",
93642
93642
  "@biomejs/biome": "^1.9.4",
93643
+ "@tscircuit/check-shorts": "https://jscdn.tscircuit.com/@tscircuit/check-shorts/0.0.4.tgz",
93643
93644
  "@tscircuit/circuit-json-placement-analysis": "^0.0.6",
93644
93645
  "@tscircuit/circuit-json-routing-analysis": "^0.0.5",
93645
93646
  "@tscircuit/circuit-json-schematic-placement-analysis": "github:tscircuit/circuit-json-schematic-placement-analysis#b6d5fe675adc26a2fc988aa081e6fb51e6bf696a",
@@ -93666,6 +93667,7 @@ var package_default = {
93666
93667
  "circuit-json": "^0.0.438",
93667
93668
  "circuit-json-to-3d-png": "^0.0.6",
93668
93669
  "circuit-json-to-bom-csv": "^0.0.7",
93670
+ "circuit-json-to-connectivity-map": "^0.0.25",
93669
93671
  "circuit-json-to-gerber": "^0.0.51",
93670
93672
  "circuit-json-to-kicad": "0.0.157",
93671
93673
  "circuit-json-to-pnp-csv": "^0.0.7",
@@ -93674,6 +93676,8 @@ var package_default = {
93674
93676
  "circuit-json-to-step": "^0.0.36",
93675
93677
  "circuit-json-to-tscircuit": "^0.0.40",
93676
93678
  "circuit-json-trace-length-analysis": "github:tscircuit/circuit-json-trace-length-analysis#2b44792a40df0ca83b6bfb6ac95ed5e35e7168b8",
93679
+ "circuit-to-canvas": "^0.0.111",
93680
+ "circuit-to-svg": "^0.0.378",
93677
93681
  commander: "^14.0.0",
93678
93682
  conf: "^13.1.0",
93679
93683
  configstore: "^7.0.0",
@@ -258579,6 +258583,126 @@ var registerCheckSchematicPlacement = (program2) => {
258579
258583
  });
258580
258584
  };
258581
258585
 
258586
+ // cli/check/shorts/register.ts
258587
+ import { mkdir, writeFile } from "node:fs/promises";
258588
+ import path46 from "node:path";
258589
+ var checkShortsPackageName = ["@tscircuit", "check-shorts"].join("/");
258590
+ var loadCheckShorts = async () => await import(checkShortsPackageName);
258591
+ var parsePixelsPerMm = (value) => {
258592
+ if (!value)
258593
+ return;
258594
+ const parsedValue = Number(value);
258595
+ if (!Number.isFinite(parsedValue) || parsedValue <= 0) {
258596
+ throw new Error("--pixels-per-mm must be a positive number");
258597
+ }
258598
+ return parsedValue;
258599
+ };
258600
+ var parseMode = (mode) => {
258601
+ if (!mode)
258602
+ return "gerber";
258603
+ if (mode === "pcb" || mode === "gerber")
258604
+ return mode;
258605
+ throw new Error("--mode must be either pcb or gerber");
258606
+ };
258607
+ var parseLayer = (layer) => {
258608
+ if (!layer)
258609
+ return "all";
258610
+ if (layer === "top" || layer === "bottom" || layer === "all")
258611
+ return layer;
258612
+ throw new Error("--layer must be top, bottom, or all");
258613
+ };
258614
+ var formatLabels = (labels) => labels.length > 0 ? labels.join(", ") : "(unknown)";
258615
+ var formatShort = (short, index) => {
258616
+ const center2 = `x=${short.center.x.toFixed(3)}mm y=${short.center.y.toFixed(3)}mm`;
258617
+ return [
258618
+ `${index + 1}. ${short.layer}/${short.mode} short at ${center2}`,
258619
+ ` ${formatLabels(short.firstOwnerLabels)} <-> ${formatLabels(short.secondOwnerLabels)}`,
258620
+ ` pixels=${short.pixelCount}`
258621
+ ].join(`
258622
+ `);
258623
+ };
258624
+ var getShortArtifactOutputPath = () => path46.resolve(process.cwd(), "checks", "check-shorts", "bitmap.png");
258625
+ var getShortPcbSnapshotOutputPath = () => path46.resolve(process.cwd(), "checks", "check-shorts", "pcb.svg");
258626
+ var checkShorts = async (file, options = {}) => {
258627
+ const resolvedInputFilePath = await resolveCheckInputFilePath(file);
258628
+ const mode = parseMode(options.mode);
258629
+ const layerOption = parseLayer(options.layer);
258630
+ const layers = layerOption === "all" ? ["top", "bottom"] : [layerOption];
258631
+ const pixelsPerMm = parsePixelsPerMm(options.pixelsPerMm);
258632
+ const circuitJson = await getCircuitJsonForCheck({
258633
+ filePath: resolvedInputFilePath,
258634
+ platformConfig: {
258635
+ pcbDisabled: false,
258636
+ routingDisabled: true
258637
+ },
258638
+ allowPrebuiltCircuitJson: true
258639
+ });
258640
+ const {
258641
+ appendBitmapLegend,
258642
+ createShortDebugSvg,
258643
+ encodeRgbaPng,
258644
+ renderBitmapShortDebug
258645
+ } = await loadCheckShorts();
258646
+ const debugRenders = await Promise.all(layers.map((layer) => renderBitmapShortDebug(circuitJson, {
258647
+ mode,
258648
+ layer,
258649
+ pixelsPerMm
258650
+ })));
258651
+ const shorts = debugRenders.flatMap((debugRender) => debugRender.shorts);
258652
+ const filename = path46.basename(resolvedInputFilePath);
258653
+ if (shorts.length === 0) {
258654
+ return {
258655
+ output: `No shorts detected in ${filename}`,
258656
+ shorts
258657
+ };
258658
+ }
258659
+ const debugRenderWithShorts = debugRenders.find((debugRender) => debugRender.shorts.length > 0) ?? debugRenders[0];
258660
+ const debugRenderWithLegend = appendBitmapLegend(debugRenderWithShorts);
258661
+ const artifacts = [
258662
+ {
258663
+ content: encodeRgbaPng(debugRenderWithLegend),
258664
+ contentType: "image/png",
258665
+ defaultOutputPath: getShortArtifactOutputPath()
258666
+ },
258667
+ {
258668
+ content: createShortDebugSvg(circuitJson, shorts),
258669
+ contentType: "image/svg+xml",
258670
+ defaultOutputPath: getShortPcbSnapshotOutputPath()
258671
+ }
258672
+ ];
258673
+ return {
258674
+ output: [
258675
+ `Detected ${shorts.length} short${shorts.length === 1 ? "" : "s"} in ${filename}`,
258676
+ ...shorts.map(formatShort)
258677
+ ].join(`
258678
+ `),
258679
+ shorts,
258680
+ artifacts
258681
+ };
258682
+ };
258683
+ var registerCheckShorts = (program2) => {
258684
+ program2.commands.find((c3) => c3.name() === "check").command("shorts").description("Detect unintended shorts between separate PCB copper groups").argument("[file]", "Path to the entry file or prebuilt circuit JSON").option("--mode <mode>", "Bitmap source to analyze: pcb or gerber", "gerber").option("--layer <layer>", "Layer to analyze: top, bottom, or all", "all").option("--pixels-per-mm <number>", "Bitmap resolution for short detection").action(async (file, options) => {
258685
+ try {
258686
+ const result = await checkShorts(file, options);
258687
+ console.log(result.output);
258688
+ if (result.artifacts) {
258689
+ for (const artifact of result.artifacts) {
258690
+ const outputPath = artifact.defaultOutputPath;
258691
+ await mkdir(path46.dirname(outputPath), { recursive: true });
258692
+ await writeFile(outputPath, artifact.content);
258693
+ console.log(`Short debug artifact written to ${outputPath}`);
258694
+ }
258695
+ }
258696
+ if (result.shorts.length > 0) {
258697
+ process.exit(1);
258698
+ }
258699
+ } catch (error2) {
258700
+ console.error(error2 instanceof Error ? error2.message : String(error2));
258701
+ process.exit(1);
258702
+ }
258703
+ });
258704
+ };
258705
+
258582
258706
  // cli/check/trace-length/register.ts
258583
258707
  var loadTraceLengthAnalyzer = async () => {
258584
258708
  const mod = await Promise.resolve().then(() => (init_lib(), exports_lib));
@@ -258614,25 +258738,25 @@ var registerCheckTraceLength = (program2) => {
258614
258738
 
258615
258739
  // cli/clone/register.ts
258616
258740
  import * as fs45 from "node:fs";
258617
- import * as path48 from "node:path";
258741
+ import * as path49 from "node:path";
258618
258742
 
258619
258743
  // cli/clone/clone-bug-report.ts
258620
258744
  var import_jszip3 = __toESM2(require_lib4(), 1);
258621
258745
  var import_prompts5 = __toESM2(require_prompts3(), 1);
258622
258746
  import * as fs44 from "node:fs";
258623
- import * as path47 from "node:path";
258747
+ import * as path48 from "node:path";
258624
258748
 
258625
258749
  // cli/clone/handle-existing-directory.ts
258626
258750
  var import_prompts4 = __toESM2(require_prompts3(), 1);
258627
258751
  import * as fs43 from "node:fs";
258628
- import * as path46 from "node:path";
258752
+ import * as path47 from "node:path";
258629
258753
  var handleExistingDirectory = async (dirPath) => {
258630
258754
  if (!fs43.existsSync(dirPath))
258631
258755
  return;
258632
258756
  const response = await import_prompts4.default({
258633
258757
  type: "select",
258634
258758
  name: "action",
258635
- message: `Directory "${path46.basename(dirPath)}" already exists. What would you like to do?`,
258759
+ message: `Directory "${path47.basename(dirPath)}" already exists. What would you like to do?`,
258636
258760
  choices: [
258637
258761
  { title: "Merge files into existing directory", value: "merge" },
258638
258762
  {
@@ -258673,12 +258797,12 @@ var getCommonDirectoryPrefix = (paths) => {
258673
258797
  return commonSegments.join("/");
258674
258798
  };
258675
258799
  var sanitizeRelativePath = (relativePath) => {
258676
- const normalizedPath = path47.normalize(relativePath);
258800
+ const normalizedPath = path48.normalize(relativePath);
258677
258801
  if (!normalizedPath)
258678
258802
  return null;
258679
- if (path47.isAbsolute(normalizedPath))
258803
+ if (path48.isAbsolute(normalizedPath))
258680
258804
  return null;
258681
- const segments = normalizedPath.split(path47.sep);
258805
+ const segments = normalizedPath.split(path48.sep);
258682
258806
  if (segments.some((segment2) => segment2 === ".." || segment2 === "")) {
258683
258807
  return null;
258684
258808
  }
@@ -258693,7 +258817,7 @@ var cloneBugReport = async ({
258693
258817
  console.error("Bug report ID must not be empty.");
258694
258818
  process.exit(1);
258695
258819
  }
258696
- let dirPath = path47.resolve(`bug-report-${trimmedBugReportId}`);
258820
+ let dirPath = path48.resolve(`bug-report-${trimmedBugReportId}`);
258697
258821
  await handleExistingDirectory(dirPath);
258698
258822
  const ky4 = getRegistryApiKy();
258699
258823
  let zipBuffer;
@@ -258723,25 +258847,25 @@ var cloneBugReport = async ({
258723
258847
  console.warn(`Skipping potentially unsafe path: ${fileName}`);
258724
258848
  continue;
258725
258849
  }
258726
- const fullPath = path47.join(dirPath, sanitizedRelativePath);
258727
- fs44.mkdirSync(path47.dirname(fullPath), { recursive: true });
258850
+ const fullPath = path48.join(dirPath, sanitizedRelativePath);
258851
+ fs44.mkdirSync(path48.dirname(fullPath), { recursive: true });
258728
258852
  const fileContent = await entry.async("nodebuffer");
258729
258853
  fs44.writeFileSync(fullPath, fileContent);
258730
258854
  }
258731
- const packageJsonPath = path47.join(dirPath, "package.json");
258855
+ const packageJsonPath = path48.join(dirPath, "package.json");
258732
258856
  if (fs44.existsSync(packageJsonPath)) {
258733
258857
  try {
258734
258858
  const packageJson = JSON.parse(fs44.readFileSync(packageJsonPath, "utf-8"));
258735
258859
  const packageName = packageJson?.name;
258736
258860
  if (typeof packageName === "string" && packageName.trim()) {
258737
258861
  const sanitizedName = packageName.replace(/[^a-zA-Z0-9]/g, "_");
258738
- const suggestedDirPath = path47.resolve(`${sanitizedName}_${trimmedBugReportId.slice(7)}`);
258862
+ const suggestedDirPath = path48.resolve(`${sanitizedName}_${trimmedBugReportId.slice(7)}`);
258739
258863
  if (suggestedDirPath !== dirPath) {
258740
258864
  const response = await import_prompts5.default({
258741
258865
  type: "confirm",
258742
258866
  name: "rename",
258743
258867
  initial: true,
258744
- message: `Rename the directory to "${path47.basename(suggestedDirPath)}"?`
258868
+ message: `Rename the directory to "${path48.basename(suggestedDirPath)}"?`
258745
258869
  });
258746
258870
  if (response.rename) {
258747
258871
  await handleExistingDirectory(suggestedDirPath);
@@ -258754,9 +258878,9 @@ var cloneBugReport = async ({
258754
258878
  console.warn("Unable to read package name for renaming:", error2);
258755
258879
  }
258756
258880
  }
258757
- fs44.writeFileSync(path47.join(dirPath, ".npmrc"), "@tsci:registry=https://npm.tscircuit.com");
258881
+ fs44.writeFileSync(path48.join(dirPath, ".npmrc"), "@tsci:registry=https://npm.tscircuit.com");
258758
258882
  generateTsConfig(dirPath);
258759
- const relativeDirPath = path47.relative(originalCwd, dirPath);
258883
+ const relativeDirPath = path48.relative(originalCwd, dirPath);
258760
258884
  console.log(kleur_default.green(`
258761
258885
  Successfully cloned bug report to:`));
258762
258886
  console.log(` ${dirPath}/
@@ -258795,7 +258919,7 @@ var registerClone = (program2) => {
258795
258919
  const [, author, packageName] = match;
258796
258920
  console.log(`Cloning ${author}/${packageName}...`);
258797
258921
  const userSettingToIncludeAuthor = options.includeAuthor || cliConfig.get("alwaysCloneWithAuthorName");
258798
- const dirPath = userSettingToIncludeAuthor ? path48.resolve(`${author}.${packageName}`) : path48.resolve(packageName);
258922
+ const dirPath = userSettingToIncludeAuthor ? path49.resolve(`${author}.${packageName}`) : path49.resolve(packageName);
258799
258923
  await handleExistingDirectory(dirPath);
258800
258924
  const ky4 = getRegistryApiKy();
258801
258925
  let packageFileList = {
@@ -258821,8 +258945,8 @@ var registerClone = (program2) => {
258821
258945
  const filePath = fileInfo.file_path.replace(/^\/+/, "");
258822
258946
  if (!filePath)
258823
258947
  continue;
258824
- const fullPath = path48.join(dirPath, filePath);
258825
- fs45.mkdirSync(path48.dirname(fullPath), { recursive: true });
258948
+ const fullPath = path49.join(dirPath, filePath);
258949
+ fs45.mkdirSync(path49.dirname(fullPath), { recursive: true });
258826
258950
  try {
258827
258951
  const fileContent = await ky4.get("package_files/get", {
258828
258952
  searchParams: {
@@ -258848,10 +258972,10 @@ var registerClone = (program2) => {
258848
258972
  console.warn(`Skipping ${filePath} due to error:`, error2 instanceof Error ? error2.message : error2);
258849
258973
  }
258850
258974
  }
258851
- fs45.writeFileSync(path48.join(dirPath, ".npmrc"), "@tsci:registry=https://npm.tscircuit.com");
258975
+ fs45.writeFileSync(path49.join(dirPath, ".npmrc"), "@tsci:registry=https://npm.tscircuit.com");
258852
258976
  generateTsConfig(dirPath);
258853
258977
  await setupTsciProject(dirPath);
258854
- const relativeDirPath = path48.relative(originalCwd, dirPath);
258978
+ const relativeDirPath = path49.relative(originalCwd, dirPath);
258855
258979
  console.log(kleur_default.green(`
258856
258980
  Successfully cloned to:`));
258857
258981
  console.log(` ${dirPath}/
@@ -258919,7 +259043,7 @@ var registerConfigSet = (program2) => {
258919
259043
 
258920
259044
  // cli/convert/register.ts
258921
259045
  import fs46 from "node:fs/promises";
258922
- import path49 from "node:path";
259046
+ import path50 from "node:path";
258923
259047
  import { KicadFootprintToCircuitJsonConverter } from "kicad-to-circuit-json";
258924
259048
 
258925
259049
  // node_modules/@tscircuit/mm/dist/index.js
@@ -259609,12 +259733,12 @@ var generateSymbolTsx = (circuitJson) => {
259609
259733
  const isDashed = rect.is_dashed ?? false;
259610
259734
  elementStrings.push(`<schematicrect schX={${center2.x}} schY={${center2.y}} width={${width}} height={${height}} rotation={${rotation11}} strokeWidth={${strokeWidth}} color="${color}" isFilled={${isFilled}} fillColor="${fillColor}" isDashed={${isDashed}} />`);
259611
259735
  }
259612
- for (const path49 of schematicPaths) {
259613
- const points = path49.points ?? [];
259614
- const fillColor = path49.fill_color ?? "red";
259615
- const isFilled = path49.is_filled ?? false;
259616
- const dashLength = path49.dash_length;
259617
- const dashGap = path49.dash_gap;
259736
+ for (const path50 of schematicPaths) {
259737
+ const points = path50.points ?? [];
259738
+ const fillColor = path50.fill_color ?? "red";
259739
+ const isFilled = path50.is_filled ?? false;
259740
+ const dashLength = path50.dash_length;
259741
+ const dashGap = path50.dash_gap;
259618
259742
  const attrs = [
259619
259743
  `points={${JSON.stringify(points)}}`,
259620
259744
  `strokeColor="${fillColor}"`,
@@ -259776,17 +259900,17 @@ var convertCircuitJsonToTscircuit = (circuitJson, opts) => {
259776
259900
  var registerConvert = (program2) => {
259777
259901
  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) => {
259778
259902
  try {
259779
- const inputPath = path49.resolve(file);
259903
+ const inputPath = path50.resolve(file);
259780
259904
  const modContent = await fs46.readFile(inputPath, "utf-8");
259781
259905
  const converter = new KicadFootprintToCircuitJsonConverter;
259782
- converter.addFile(path49.basename(inputPath), modContent);
259906
+ converter.addFile(path50.basename(inputPath), modContent);
259783
259907
  converter.runUntilFinished();
259784
259908
  const circuitJson = converter.getOutput();
259785
- const componentName = options.name ?? path49.basename(inputPath, ".kicad_mod");
259909
+ const componentName = options.name ?? path50.basename(inputPath, ".kicad_mod");
259786
259910
  const tsx = convertCircuitJsonToTscircuit(circuitJson, {
259787
259911
  componentName
259788
259912
  });
259789
- const outputPath = options.output ? path49.resolve(options.output) : path49.join(path49.dirname(inputPath), `${componentName}.tsx`);
259913
+ const outputPath = options.output ? path50.resolve(options.output) : path50.join(path50.dirname(inputPath), `${componentName}.tsx`);
259790
259914
  await fs46.writeFile(outputPath, tsx);
259791
259915
  console.log(kleur_default.green(`Converted ${outputPath}`));
259792
259916
  } catch (error2) {
@@ -259799,11 +259923,11 @@ var registerConvert = (program2) => {
259799
259923
  // cli/dev/register.ts
259800
259924
  import * as fs53 from "node:fs";
259801
259925
  import * as net from "node:net";
259802
- import * as path58 from "node:path";
259926
+ import * as path59 from "node:path";
259803
259927
 
259804
259928
  // cli/dev/resolve-dev-target.ts
259805
259929
  import * as fs47 from "node:fs";
259806
- import * as path50 from "node:path";
259930
+ import * as path51 from "node:path";
259807
259931
  var findSelectableFiles = (projectDir) => {
259808
259932
  const boardFiles = findBoardFiles({ projectDir }).filter((file) => fs47.existsSync(file)).sort();
259809
259933
  if (boardFiles.length > 0) {
@@ -259813,7 +259937,7 @@ var findSelectableFiles = (projectDir) => {
259813
259937
  cwd: projectDir,
259814
259938
  ignore: DEFAULT_IGNORED_PATTERNS
259815
259939
  });
259816
- return files.map((file) => path50.resolve(projectDir, file)).filter((file) => fs47.existsSync(file)).sort();
259940
+ return files.map((file) => path51.resolve(projectDir, file)).filter((file) => fs47.existsSync(file)).sort();
259817
259941
  };
259818
259942
  var isValidDevFile = (filePath) => {
259819
259943
  return filePath.endsWith(".tsx") || filePath.endsWith(".ts") || filePath.endsWith(".circuit.json");
@@ -259821,7 +259945,7 @@ var isValidDevFile = (filePath) => {
259821
259945
  var resolveDevTarget = async (file) => {
259822
259946
  let projectDir = process.cwd();
259823
259947
  if (file) {
259824
- const resolvedPath = path50.resolve(file);
259948
+ const resolvedPath = path51.resolve(file);
259825
259949
  if (fs47.existsSync(resolvedPath) && fs47.statSync(resolvedPath).isDirectory()) {
259826
259950
  projectDir = resolvedPath;
259827
259951
  const availableFiles2 = findSelectableFiles(projectDir);
@@ -259829,7 +259953,7 @@ var resolveDevTarget = async (file) => {
259829
259953
  console.log(`No .tsx, .ts, or .circuit.json files found in ${projectDir}. Run 'tsci init' to bootstrap a basic project.`);
259830
259954
  return null;
259831
259955
  }
259832
- console.log("Selected file:", path50.relative(projectDir, availableFiles2[0]));
259956
+ console.log("Selected file:", path51.relative(projectDir, availableFiles2[0]));
259833
259957
  return { absolutePath: availableFiles2[0], projectDir };
259834
259958
  }
259835
259959
  if (!fs47.existsSync(resolvedPath)) {
@@ -259852,13 +259976,13 @@ var resolveDevTarget = async (file) => {
259852
259976
  console.log("No .tsx, .ts, or .circuit.json files found in the project. Run 'tsci init' to bootstrap a basic project.");
259853
259977
  return null;
259854
259978
  }
259855
- console.log("Selected file:", path50.relative(projectDir, availableFiles[0]));
259979
+ console.log("Selected file:", path51.relative(projectDir, availableFiles[0]));
259856
259980
  return { absolutePath: availableFiles[0], projectDir };
259857
259981
  };
259858
259982
 
259859
259983
  // lib/dev/DevServer.ts
259860
259984
  import fs52 from "node:fs";
259861
- import path57 from "node:path";
259985
+ import path58 from "node:path";
259862
259986
 
259863
259987
  // node_modules/chokidar/esm/index.js
259864
259988
  import { stat as statcb } from "fs";
@@ -259937,7 +260061,7 @@ class ReaddirpStream extends Readable {
259937
260061
  this._directoryFilter = normalizeFilter(opts.directoryFilter);
259938
260062
  const statMethod = opts.lstat ? lstat : stat;
259939
260063
  if (wantBigintFsStats) {
259940
- this._stat = (path51) => statMethod(path51, { bigint: true });
260064
+ this._stat = (path52) => statMethod(path52, { bigint: true });
259941
260065
  } else {
259942
260066
  this._stat = statMethod;
259943
260067
  }
@@ -259962,8 +260086,8 @@ class ReaddirpStream extends Readable {
259962
260086
  const par = this.parent;
259963
260087
  const fil = par && par.files;
259964
260088
  if (fil && fil.length > 0) {
259965
- const { path: path51, depth } = par;
259966
- const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path51));
260089
+ const { path: path52, depth } = par;
260090
+ const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path52));
259967
260091
  const awaited = await Promise.all(slice);
259968
260092
  for (const entry of awaited) {
259969
260093
  if (!entry)
@@ -260003,20 +260127,20 @@ class ReaddirpStream extends Readable {
260003
260127
  this.reading = false;
260004
260128
  }
260005
260129
  }
260006
- async _exploreDir(path51, depth) {
260130
+ async _exploreDir(path52, depth) {
260007
260131
  let files;
260008
260132
  try {
260009
- files = await readdir(path51, this._rdOptions);
260133
+ files = await readdir(path52, this._rdOptions);
260010
260134
  } catch (error2) {
260011
260135
  this._onError(error2);
260012
260136
  }
260013
- return { files, depth, path: path51 };
260137
+ return { files, depth, path: path52 };
260014
260138
  }
260015
- async _formatEntry(dirent, path51) {
260139
+ async _formatEntry(dirent, path52) {
260016
260140
  let entry;
260017
260141
  const basename4 = this._isDirent ? dirent.name : dirent;
260018
260142
  try {
260019
- const fullPath = presolve(pjoin(path51, basename4));
260143
+ const fullPath = presolve(pjoin(path52, basename4));
260020
260144
  entry = { path: prelative(this._root, fullPath), fullPath, basename: basename4 };
260021
260145
  entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
260022
260146
  } catch (err) {
@@ -260414,16 +260538,16 @@ var delFromSet = (main, prop, item) => {
260414
260538
  };
260415
260539
  var isEmptySet = (val) => val instanceof Set ? val.size === 0 : !val;
260416
260540
  var FsWatchInstances = new Map;
260417
- function createFsWatchInstance(path51, options, listener, errHandler, emitRaw) {
260541
+ function createFsWatchInstance(path52, options, listener, errHandler, emitRaw) {
260418
260542
  const handleEvent = (rawEvent, evPath) => {
260419
- listener(path51);
260420
- emitRaw(rawEvent, evPath, { watchedPath: path51 });
260421
- if (evPath && path51 !== evPath) {
260422
- fsWatchBroadcast(sysPath.resolve(path51, evPath), KEY_LISTENERS, sysPath.join(path51, evPath));
260543
+ listener(path52);
260544
+ emitRaw(rawEvent, evPath, { watchedPath: path52 });
260545
+ if (evPath && path52 !== evPath) {
260546
+ fsWatchBroadcast(sysPath.resolve(path52, evPath), KEY_LISTENERS, sysPath.join(path52, evPath));
260423
260547
  }
260424
260548
  };
260425
260549
  try {
260426
- return fs_watch(path51, {
260550
+ return fs_watch(path52, {
260427
260551
  persistent: options.persistent
260428
260552
  }, handleEvent);
260429
260553
  } catch (error2) {
@@ -260439,12 +260563,12 @@ var fsWatchBroadcast = (fullPath, listenerType, val1, val2, val3) => {
260439
260563
  listener(val1, val2, val3);
260440
260564
  });
260441
260565
  };
260442
- var setFsWatchListener = (path51, fullPath, options, handlers) => {
260566
+ var setFsWatchListener = (path52, fullPath, options, handlers) => {
260443
260567
  const { listener, errHandler, rawEmitter } = handlers;
260444
260568
  let cont = FsWatchInstances.get(fullPath);
260445
260569
  let watcher;
260446
260570
  if (!options.persistent) {
260447
- watcher = createFsWatchInstance(path51, options, listener, errHandler, rawEmitter);
260571
+ watcher = createFsWatchInstance(path52, options, listener, errHandler, rawEmitter);
260448
260572
  if (!watcher)
260449
260573
  return;
260450
260574
  return watcher.close.bind(watcher);
@@ -260454,7 +260578,7 @@ var setFsWatchListener = (path51, fullPath, options, handlers) => {
260454
260578
  addAndConvert(cont, KEY_ERR, errHandler);
260455
260579
  addAndConvert(cont, KEY_RAW, rawEmitter);
260456
260580
  } else {
260457
- watcher = createFsWatchInstance(path51, options, fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS), errHandler, fsWatchBroadcast.bind(null, fullPath, KEY_RAW));
260581
+ watcher = createFsWatchInstance(path52, options, fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS), errHandler, fsWatchBroadcast.bind(null, fullPath, KEY_RAW));
260458
260582
  if (!watcher)
260459
260583
  return;
260460
260584
  watcher.on(EV.ERROR, async (error2) => {
@@ -260463,7 +260587,7 @@ var setFsWatchListener = (path51, fullPath, options, handlers) => {
260463
260587
  cont.watcherUnusable = true;
260464
260588
  if (isWindows && error2.code === "EPERM") {
260465
260589
  try {
260466
- const fd3 = await open(path51, "r");
260590
+ const fd3 = await open(path52, "r");
260467
260591
  await fd3.close();
260468
260592
  broadcastErr(error2);
260469
260593
  } catch (err) {}
@@ -260493,7 +260617,7 @@ var setFsWatchListener = (path51, fullPath, options, handlers) => {
260493
260617
  };
260494
260618
  };
260495
260619
  var FsWatchFileInstances = new Map;
260496
- var setFsWatchFileListener = (path51, fullPath, options, handlers) => {
260620
+ var setFsWatchFileListener = (path52, fullPath, options, handlers) => {
260497
260621
  const { listener, rawEmitter } = handlers;
260498
260622
  let cont = FsWatchFileInstances.get(fullPath);
260499
260623
  const copts = cont && cont.options;
@@ -260515,7 +260639,7 @@ var setFsWatchFileListener = (path51, fullPath, options, handlers) => {
260515
260639
  });
260516
260640
  const currmtime = curr.mtimeMs;
260517
260641
  if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) {
260518
- foreach(cont.listeners, (listener2) => listener2(path51, curr));
260642
+ foreach(cont.listeners, (listener2) => listener2(path52, curr));
260519
260643
  }
260520
260644
  })
260521
260645
  };
@@ -260538,13 +260662,13 @@ class NodeFsHandler {
260538
260662
  this.fsw = fsW;
260539
260663
  this._boundHandleError = (error2) => fsW._handleError(error2);
260540
260664
  }
260541
- _watchWithNodeFs(path51, listener) {
260665
+ _watchWithNodeFs(path52, listener) {
260542
260666
  const opts = this.fsw.options;
260543
- const directory = sysPath.dirname(path51);
260544
- const basename5 = sysPath.basename(path51);
260667
+ const directory = sysPath.dirname(path52);
260668
+ const basename5 = sysPath.basename(path52);
260545
260669
  const parent = this.fsw._getWatchedDir(directory);
260546
260670
  parent.add(basename5);
260547
- const absolutePath = sysPath.resolve(path51);
260671
+ const absolutePath = sysPath.resolve(path52);
260548
260672
  const options = {
260549
260673
  persistent: opts.persistent
260550
260674
  };
@@ -260554,12 +260678,12 @@ class NodeFsHandler {
260554
260678
  if (opts.usePolling) {
260555
260679
  const enableBin = opts.interval !== opts.binaryInterval;
260556
260680
  options.interval = enableBin && isBinaryPath(basename5) ? opts.binaryInterval : opts.interval;
260557
- closer = setFsWatchFileListener(path51, absolutePath, options, {
260681
+ closer = setFsWatchFileListener(path52, absolutePath, options, {
260558
260682
  listener,
260559
260683
  rawEmitter: this.fsw._emitRaw
260560
260684
  });
260561
260685
  } else {
260562
- closer = setFsWatchListener(path51, absolutePath, options, {
260686
+ closer = setFsWatchListener(path52, absolutePath, options, {
260563
260687
  listener,
260564
260688
  errHandler: this._boundHandleError,
260565
260689
  rawEmitter: this.fsw._emitRaw
@@ -260577,7 +260701,7 @@ class NodeFsHandler {
260577
260701
  let prevStats = stats;
260578
260702
  if (parent.has(basename5))
260579
260703
  return;
260580
- const listener = async (path51, newStats) => {
260704
+ const listener = async (path52, newStats) => {
260581
260705
  if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file, 5))
260582
260706
  return;
260583
260707
  if (!newStats || newStats.mtimeMs === 0) {
@@ -260591,11 +260715,11 @@ class NodeFsHandler {
260591
260715
  this.fsw._emit(EV.CHANGE, file, newStats2);
260592
260716
  }
260593
260717
  if ((isMacos || isLinux) && prevStats.ino !== newStats2.ino) {
260594
- this.fsw._closeFile(path51);
260718
+ this.fsw._closeFile(path52);
260595
260719
  prevStats = newStats2;
260596
260720
  const closer2 = this._watchWithNodeFs(file, listener);
260597
260721
  if (closer2)
260598
- this.fsw._addPathCloser(path51, closer2);
260722
+ this.fsw._addPathCloser(path52, closer2);
260599
260723
  } else {
260600
260724
  prevStats = newStats2;
260601
260725
  }
@@ -260619,7 +260743,7 @@ class NodeFsHandler {
260619
260743
  }
260620
260744
  return closer;
260621
260745
  }
260622
- async _handleSymlink(entry, directory, path51, item) {
260746
+ async _handleSymlink(entry, directory, path52, item) {
260623
260747
  if (this.fsw.closed) {
260624
260748
  return;
260625
260749
  }
@@ -260629,7 +260753,7 @@ class NodeFsHandler {
260629
260753
  this.fsw._incrReadyCount();
260630
260754
  let linkPath;
260631
260755
  try {
260632
- linkPath = await fsrealpath(path51);
260756
+ linkPath = await fsrealpath(path52);
260633
260757
  } catch (e4) {
260634
260758
  this.fsw._emitReady();
260635
260759
  return true;
@@ -260639,12 +260763,12 @@ class NodeFsHandler {
260639
260763
  if (dir.has(item)) {
260640
260764
  if (this.fsw._symlinkPaths.get(full) !== linkPath) {
260641
260765
  this.fsw._symlinkPaths.set(full, linkPath);
260642
- this.fsw._emit(EV.CHANGE, path51, entry.stats);
260766
+ this.fsw._emit(EV.CHANGE, path52, entry.stats);
260643
260767
  }
260644
260768
  } else {
260645
260769
  dir.add(item);
260646
260770
  this.fsw._symlinkPaths.set(full, linkPath);
260647
- this.fsw._emit(EV.ADD, path51, entry.stats);
260771
+ this.fsw._emit(EV.ADD, path52, entry.stats);
260648
260772
  }
260649
260773
  this.fsw._emitReady();
260650
260774
  return true;
@@ -260673,9 +260797,9 @@ class NodeFsHandler {
260673
260797
  return;
260674
260798
  }
260675
260799
  const item = entry.path;
260676
- let path51 = sysPath.join(directory, item);
260800
+ let path52 = sysPath.join(directory, item);
260677
260801
  current2.add(item);
260678
- if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path51, item)) {
260802
+ if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path52, item)) {
260679
260803
  return;
260680
260804
  }
260681
260805
  if (this.fsw.closed) {
@@ -260684,8 +260808,8 @@ class NodeFsHandler {
260684
260808
  }
260685
260809
  if (item === target || !target && !previous.has(item)) {
260686
260810
  this.fsw._incrReadyCount();
260687
- path51 = sysPath.join(dir, sysPath.relative(dir, path51));
260688
- this._addToNodeFs(path51, initialAdd, wh3, depth + 1);
260811
+ path52 = sysPath.join(dir, sysPath.relative(dir, path52));
260812
+ this._addToNodeFs(path52, initialAdd, wh3, depth + 1);
260689
260813
  }
260690
260814
  }).on(EV.ERROR, this._boundHandleError);
260691
260815
  return new Promise((resolve8, reject) => {
@@ -260734,13 +260858,13 @@ class NodeFsHandler {
260734
260858
  }
260735
260859
  return closer;
260736
260860
  }
260737
- async _addToNodeFs(path51, initialAdd, priorWh, depth, target) {
260861
+ async _addToNodeFs(path52, initialAdd, priorWh, depth, target) {
260738
260862
  const ready = this.fsw._emitReady;
260739
- if (this.fsw._isIgnored(path51) || this.fsw.closed) {
260863
+ if (this.fsw._isIgnored(path52) || this.fsw.closed) {
260740
260864
  ready();
260741
260865
  return false;
260742
260866
  }
260743
- const wh3 = this.fsw._getWatchHelpers(path51);
260867
+ const wh3 = this.fsw._getWatchHelpers(path52);
260744
260868
  if (priorWh) {
260745
260869
  wh3.filterPath = (entry) => priorWh.filterPath(entry);
260746
260870
  wh3.filterDir = (entry) => priorWh.filterDir(entry);
@@ -260756,8 +260880,8 @@ class NodeFsHandler {
260756
260880
  const follow = this.fsw.options.followSymlinks;
260757
260881
  let closer;
260758
260882
  if (stats.isDirectory()) {
260759
- const absPath = sysPath.resolve(path51);
260760
- const targetPath = follow ? await fsrealpath(path51) : path51;
260883
+ const absPath = sysPath.resolve(path52);
260884
+ const targetPath = follow ? await fsrealpath(path52) : path52;
260761
260885
  if (this.fsw.closed)
260762
260886
  return;
260763
260887
  closer = await this._handleDir(wh3.watchPath, stats, initialAdd, depth, target, wh3, targetPath);
@@ -260767,29 +260891,29 @@ class NodeFsHandler {
260767
260891
  this.fsw._symlinkPaths.set(absPath, targetPath);
260768
260892
  }
260769
260893
  } else if (stats.isSymbolicLink()) {
260770
- const targetPath = follow ? await fsrealpath(path51) : path51;
260894
+ const targetPath = follow ? await fsrealpath(path52) : path52;
260771
260895
  if (this.fsw.closed)
260772
260896
  return;
260773
260897
  const parent = sysPath.dirname(wh3.watchPath);
260774
260898
  this.fsw._getWatchedDir(parent).add(wh3.watchPath);
260775
260899
  this.fsw._emit(EV.ADD, wh3.watchPath, stats);
260776
- closer = await this._handleDir(parent, stats, initialAdd, depth, path51, wh3, targetPath);
260900
+ closer = await this._handleDir(parent, stats, initialAdd, depth, path52, wh3, targetPath);
260777
260901
  if (this.fsw.closed)
260778
260902
  return;
260779
260903
  if (targetPath !== undefined) {
260780
- this.fsw._symlinkPaths.set(sysPath.resolve(path51), targetPath);
260904
+ this.fsw._symlinkPaths.set(sysPath.resolve(path52), targetPath);
260781
260905
  }
260782
260906
  } else {
260783
260907
  closer = this._handleFile(wh3.watchPath, stats, initialAdd);
260784
260908
  }
260785
260909
  ready();
260786
260910
  if (closer)
260787
- this.fsw._addPathCloser(path51, closer);
260911
+ this.fsw._addPathCloser(path52, closer);
260788
260912
  return false;
260789
260913
  } catch (error2) {
260790
260914
  if (this.fsw._handleError(error2)) {
260791
260915
  ready();
260792
- return path51;
260916
+ return path52;
260793
260917
  }
260794
260918
  }
260795
260919
  }
@@ -260832,26 +260956,26 @@ function createPattern(matcher) {
260832
260956
  }
260833
260957
  return () => false;
260834
260958
  }
260835
- function normalizePath2(path51) {
260836
- if (typeof path51 !== "string")
260959
+ function normalizePath2(path52) {
260960
+ if (typeof path52 !== "string")
260837
260961
  throw new Error("string expected");
260838
- path51 = sysPath2.normalize(path51);
260839
- path51 = path51.replace(/\\/g, "/");
260962
+ path52 = sysPath2.normalize(path52);
260963
+ path52 = path52.replace(/\\/g, "/");
260840
260964
  let prepend2 = false;
260841
- if (path51.startsWith("//"))
260965
+ if (path52.startsWith("//"))
260842
260966
  prepend2 = true;
260843
260967
  const DOUBLE_SLASH_RE2 = /\/\//;
260844
- while (path51.match(DOUBLE_SLASH_RE2))
260845
- path51 = path51.replace(DOUBLE_SLASH_RE2, "/");
260968
+ while (path52.match(DOUBLE_SLASH_RE2))
260969
+ path52 = path52.replace(DOUBLE_SLASH_RE2, "/");
260846
260970
  if (prepend2)
260847
- path51 = "/" + path51;
260848
- return path51;
260971
+ path52 = "/" + path52;
260972
+ return path52;
260849
260973
  }
260850
260974
  function matchPatterns(patterns, testString, stats) {
260851
- const path51 = normalizePath2(testString);
260975
+ const path52 = normalizePath2(testString);
260852
260976
  for (let index = 0;index < patterns.length; index++) {
260853
260977
  const pattern = patterns[index];
260854
- if (pattern(path51, stats)) {
260978
+ if (pattern(path52, stats)) {
260855
260979
  return true;
260856
260980
  }
260857
260981
  }
@@ -260891,19 +261015,19 @@ var toUnix = (string) => {
260891
261015
  }
260892
261016
  return str;
260893
261017
  };
260894
- var normalizePathToUnix = (path51) => toUnix(sysPath2.normalize(toUnix(path51)));
260895
- var normalizeIgnored = (cwd = "") => (path51) => {
260896
- if (typeof path51 === "string") {
260897
- return normalizePathToUnix(sysPath2.isAbsolute(path51) ? path51 : sysPath2.join(cwd, path51));
261018
+ var normalizePathToUnix = (path52) => toUnix(sysPath2.normalize(toUnix(path52)));
261019
+ var normalizeIgnored = (cwd = "") => (path52) => {
261020
+ if (typeof path52 === "string") {
261021
+ return normalizePathToUnix(sysPath2.isAbsolute(path52) ? path52 : sysPath2.join(cwd, path52));
260898
261022
  } else {
260899
- return path51;
261023
+ return path52;
260900
261024
  }
260901
261025
  };
260902
- var getAbsolutePath = (path51, cwd) => {
260903
- if (sysPath2.isAbsolute(path51)) {
260904
- return path51;
261026
+ var getAbsolutePath = (path52, cwd) => {
261027
+ if (sysPath2.isAbsolute(path52)) {
261028
+ return path52;
260905
261029
  }
260906
- return sysPath2.join(cwd, path51);
261030
+ return sysPath2.join(cwd, path52);
260907
261031
  };
260908
261032
  var EMPTY_SET = Object.freeze(new Set);
260909
261033
 
@@ -260960,10 +261084,10 @@ var STAT_METHOD_F = "stat";
260960
261084
  var STAT_METHOD_L = "lstat";
260961
261085
 
260962
261086
  class WatchHelper {
260963
- constructor(path51, follow, fsw) {
261087
+ constructor(path52, follow, fsw) {
260964
261088
  this.fsw = fsw;
260965
- const watchPath = path51;
260966
- this.path = path51 = path51.replace(REPLACER_RE, "");
261089
+ const watchPath = path52;
261090
+ this.path = path52 = path52.replace(REPLACER_RE, "");
260967
261091
  this.watchPath = watchPath;
260968
261092
  this.fullWatchPath = sysPath2.resolve(watchPath);
260969
261093
  this.dirParts = [];
@@ -261076,20 +261200,20 @@ class FSWatcher extends EventEmitter {
261076
261200
  this._closePromise = undefined;
261077
261201
  let paths = unifyPaths(paths_);
261078
261202
  if (cwd) {
261079
- paths = paths.map((path51) => {
261080
- const absPath = getAbsolutePath(path51, cwd);
261203
+ paths = paths.map((path52) => {
261204
+ const absPath = getAbsolutePath(path52, cwd);
261081
261205
  return absPath;
261082
261206
  });
261083
261207
  }
261084
- paths.forEach((path51) => {
261085
- this._removeIgnoredPath(path51);
261208
+ paths.forEach((path52) => {
261209
+ this._removeIgnoredPath(path52);
261086
261210
  });
261087
261211
  this._userIgnored = undefined;
261088
261212
  if (!this._readyCount)
261089
261213
  this._readyCount = 0;
261090
261214
  this._readyCount += paths.length;
261091
- Promise.all(paths.map(async (path51) => {
261092
- const res2 = await this._nodeFsHandler._addToNodeFs(path51, !_internal, undefined, 0, _origAdd);
261215
+ Promise.all(paths.map(async (path52) => {
261216
+ const res2 = await this._nodeFsHandler._addToNodeFs(path52, !_internal, undefined, 0, _origAdd);
261093
261217
  if (res2)
261094
261218
  this._emitReady();
261095
261219
  return res2;
@@ -261108,17 +261232,17 @@ class FSWatcher extends EventEmitter {
261108
261232
  return this;
261109
261233
  const paths = unifyPaths(paths_);
261110
261234
  const { cwd } = this.options;
261111
- paths.forEach((path51) => {
261112
- if (!sysPath2.isAbsolute(path51) && !this._closers.has(path51)) {
261235
+ paths.forEach((path52) => {
261236
+ if (!sysPath2.isAbsolute(path52) && !this._closers.has(path52)) {
261113
261237
  if (cwd)
261114
- path51 = sysPath2.join(cwd, path51);
261115
- path51 = sysPath2.resolve(path51);
261238
+ path52 = sysPath2.join(cwd, path52);
261239
+ path52 = sysPath2.resolve(path52);
261116
261240
  }
261117
- this._closePath(path51);
261118
- this._addIgnoredPath(path51);
261119
- if (this._watched.has(path51)) {
261241
+ this._closePath(path52);
261242
+ this._addIgnoredPath(path52);
261243
+ if (this._watched.has(path52)) {
261120
261244
  this._addIgnoredPath({
261121
- path: path51,
261245
+ path: path52,
261122
261246
  recursive: true
261123
261247
  });
261124
261248
  }
@@ -261167,38 +261291,38 @@ class FSWatcher extends EventEmitter {
261167
261291
  if (event !== EVENTS.ERROR)
261168
261292
  this.emit(EVENTS.ALL, ...args);
261169
261293
  }
261170
- async _emit(event, path51, stats) {
261294
+ async _emit(event, path52, stats) {
261171
261295
  if (this.closed)
261172
261296
  return;
261173
261297
  const opts = this.options;
261174
261298
  if (isWindows)
261175
- path51 = sysPath2.normalize(path51);
261299
+ path52 = sysPath2.normalize(path52);
261176
261300
  if (opts.cwd)
261177
- path51 = sysPath2.relative(opts.cwd, path51);
261178
- const args = [event, path51];
261301
+ path52 = sysPath2.relative(opts.cwd, path52);
261302
+ const args = [event, path52];
261179
261303
  if (stats != null)
261180
261304
  args.push(stats);
261181
261305
  const awf = opts.awaitWriteFinish;
261182
261306
  let pw2;
261183
- if (awf && (pw2 = this._pendingWrites.get(path51))) {
261307
+ if (awf && (pw2 = this._pendingWrites.get(path52))) {
261184
261308
  pw2.lastChange = new Date;
261185
261309
  return this;
261186
261310
  }
261187
261311
  if (opts.atomic) {
261188
261312
  if (event === EVENTS.UNLINK) {
261189
- this._pendingUnlinks.set(path51, args);
261313
+ this._pendingUnlinks.set(path52, args);
261190
261314
  setTimeout(() => {
261191
- this._pendingUnlinks.forEach((entry, path52) => {
261315
+ this._pendingUnlinks.forEach((entry, path53) => {
261192
261316
  this.emit(...entry);
261193
261317
  this.emit(EVENTS.ALL, ...entry);
261194
- this._pendingUnlinks.delete(path52);
261318
+ this._pendingUnlinks.delete(path53);
261195
261319
  });
261196
261320
  }, typeof opts.atomic === "number" ? opts.atomic : 100);
261197
261321
  return this;
261198
261322
  }
261199
- if (event === EVENTS.ADD && this._pendingUnlinks.has(path51)) {
261323
+ if (event === EVENTS.ADD && this._pendingUnlinks.has(path52)) {
261200
261324
  event = args[0] = EVENTS.CHANGE;
261201
- this._pendingUnlinks.delete(path51);
261325
+ this._pendingUnlinks.delete(path52);
261202
261326
  }
261203
261327
  }
261204
261328
  if (awf && (event === EVENTS.ADD || event === EVENTS.CHANGE) && this._readyEmitted) {
@@ -261216,16 +261340,16 @@ class FSWatcher extends EventEmitter {
261216
261340
  this.emitWithAll(event, args);
261217
261341
  }
261218
261342
  };
261219
- this._awaitWriteFinish(path51, awf.stabilityThreshold, event, awfEmit);
261343
+ this._awaitWriteFinish(path52, awf.stabilityThreshold, event, awfEmit);
261220
261344
  return this;
261221
261345
  }
261222
261346
  if (event === EVENTS.CHANGE) {
261223
- const isThrottled = !this._throttle(EVENTS.CHANGE, path51, 50);
261347
+ const isThrottled = !this._throttle(EVENTS.CHANGE, path52, 50);
261224
261348
  if (isThrottled)
261225
261349
  return this;
261226
261350
  }
261227
261351
  if (opts.alwaysStat && stats === undefined && (event === EVENTS.ADD || event === EVENTS.ADD_DIR || event === EVENTS.CHANGE)) {
261228
- const fullPath = opts.cwd ? sysPath2.join(opts.cwd, path51) : path51;
261352
+ const fullPath = opts.cwd ? sysPath2.join(opts.cwd, path52) : path52;
261229
261353
  let stats2;
261230
261354
  try {
261231
261355
  stats2 = await stat3(fullPath);
@@ -261244,23 +261368,23 @@ class FSWatcher extends EventEmitter {
261244
261368
  }
261245
261369
  return error2 || this.closed;
261246
261370
  }
261247
- _throttle(actionType, path51, timeout2) {
261371
+ _throttle(actionType, path52, timeout2) {
261248
261372
  if (!this._throttled.has(actionType)) {
261249
261373
  this._throttled.set(actionType, new Map);
261250
261374
  }
261251
261375
  const action = this._throttled.get(actionType);
261252
261376
  if (!action)
261253
261377
  throw new Error("invalid throttle");
261254
- const actionPath = action.get(path51);
261378
+ const actionPath = action.get(path52);
261255
261379
  if (actionPath) {
261256
261380
  actionPath.count++;
261257
261381
  return false;
261258
261382
  }
261259
261383
  let timeoutObject;
261260
261384
  const clear = () => {
261261
- const item = action.get(path51);
261385
+ const item = action.get(path52);
261262
261386
  const count = item ? item.count : 0;
261263
- action.delete(path51);
261387
+ action.delete(path52);
261264
261388
  clearTimeout(timeoutObject);
261265
261389
  if (item)
261266
261390
  clearTimeout(item.timeoutObject);
@@ -261268,50 +261392,50 @@ class FSWatcher extends EventEmitter {
261268
261392
  };
261269
261393
  timeoutObject = setTimeout(clear, timeout2);
261270
261394
  const thr = { timeoutObject, clear, count: 0 };
261271
- action.set(path51, thr);
261395
+ action.set(path52, thr);
261272
261396
  return thr;
261273
261397
  }
261274
261398
  _incrReadyCount() {
261275
261399
  return this._readyCount++;
261276
261400
  }
261277
- _awaitWriteFinish(path51, threshold, event, awfEmit) {
261401
+ _awaitWriteFinish(path52, threshold, event, awfEmit) {
261278
261402
  const awf = this.options.awaitWriteFinish;
261279
261403
  if (typeof awf !== "object")
261280
261404
  return;
261281
261405
  const pollInterval = awf.pollInterval;
261282
261406
  let timeoutHandler;
261283
- let fullPath = path51;
261284
- if (this.options.cwd && !sysPath2.isAbsolute(path51)) {
261285
- fullPath = sysPath2.join(this.options.cwd, path51);
261407
+ let fullPath = path52;
261408
+ if (this.options.cwd && !sysPath2.isAbsolute(path52)) {
261409
+ fullPath = sysPath2.join(this.options.cwd, path52);
261286
261410
  }
261287
261411
  const now = new Date;
261288
261412
  const writes = this._pendingWrites;
261289
261413
  function awaitWriteFinishFn(prevStat) {
261290
261414
  statcb(fullPath, (err, curStat) => {
261291
- if (err || !writes.has(path51)) {
261415
+ if (err || !writes.has(path52)) {
261292
261416
  if (err && err.code !== "ENOENT")
261293
261417
  awfEmit(err);
261294
261418
  return;
261295
261419
  }
261296
261420
  const now2 = Number(new Date);
261297
261421
  if (prevStat && curStat.size !== prevStat.size) {
261298
- writes.get(path51).lastChange = now2;
261422
+ writes.get(path52).lastChange = now2;
261299
261423
  }
261300
- const pw2 = writes.get(path51);
261424
+ const pw2 = writes.get(path52);
261301
261425
  const df3 = now2 - pw2.lastChange;
261302
261426
  if (df3 >= threshold) {
261303
- writes.delete(path51);
261427
+ writes.delete(path52);
261304
261428
  awfEmit(undefined, curStat);
261305
261429
  } else {
261306
261430
  timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval, curStat);
261307
261431
  }
261308
261432
  });
261309
261433
  }
261310
- if (!writes.has(path51)) {
261311
- writes.set(path51, {
261434
+ if (!writes.has(path52)) {
261435
+ writes.set(path52, {
261312
261436
  lastChange: now,
261313
261437
  cancelWait: () => {
261314
- writes.delete(path51);
261438
+ writes.delete(path52);
261315
261439
  clearTimeout(timeoutHandler);
261316
261440
  return event;
261317
261441
  }
@@ -261319,8 +261443,8 @@ class FSWatcher extends EventEmitter {
261319
261443
  timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval);
261320
261444
  }
261321
261445
  }
261322
- _isIgnored(path51, stats) {
261323
- if (this.options.atomic && DOT_RE.test(path51))
261446
+ _isIgnored(path52, stats) {
261447
+ if (this.options.atomic && DOT_RE.test(path52))
261324
261448
  return true;
261325
261449
  if (!this._userIgnored) {
261326
261450
  const { cwd } = this.options;
@@ -261330,13 +261454,13 @@ class FSWatcher extends EventEmitter {
261330
261454
  const list = [...ignoredPaths.map(normalizeIgnored(cwd)), ...ignored];
261331
261455
  this._userIgnored = anymatch(list, undefined);
261332
261456
  }
261333
- return this._userIgnored(path51, stats);
261457
+ return this._userIgnored(path52, stats);
261334
261458
  }
261335
- _isntIgnored(path51, stat4) {
261336
- return !this._isIgnored(path51, stat4);
261459
+ _isntIgnored(path52, stat4) {
261460
+ return !this._isIgnored(path52, stat4);
261337
261461
  }
261338
- _getWatchHelpers(path51) {
261339
- return new WatchHelper(path51, this.options.followSymlinks, this);
261462
+ _getWatchHelpers(path52) {
261463
+ return new WatchHelper(path52, this.options.followSymlinks, this);
261340
261464
  }
261341
261465
  _getWatchedDir(directory) {
261342
261466
  const dir = sysPath2.resolve(directory);
@@ -261350,57 +261474,57 @@ class FSWatcher extends EventEmitter {
261350
261474
  return Boolean(Number(stats.mode) & 256);
261351
261475
  }
261352
261476
  _remove(directory, item, isDirectory2) {
261353
- const path51 = sysPath2.join(directory, item);
261354
- const fullPath = sysPath2.resolve(path51);
261355
- isDirectory2 = isDirectory2 != null ? isDirectory2 : this._watched.has(path51) || this._watched.has(fullPath);
261356
- if (!this._throttle("remove", path51, 100))
261477
+ const path52 = sysPath2.join(directory, item);
261478
+ const fullPath = sysPath2.resolve(path52);
261479
+ isDirectory2 = isDirectory2 != null ? isDirectory2 : this._watched.has(path52) || this._watched.has(fullPath);
261480
+ if (!this._throttle("remove", path52, 100))
261357
261481
  return;
261358
261482
  if (!isDirectory2 && this._watched.size === 1) {
261359
261483
  this.add(directory, item, true);
261360
261484
  }
261361
- const wp2 = this._getWatchedDir(path51);
261485
+ const wp2 = this._getWatchedDir(path52);
261362
261486
  const nestedDirectoryChildren = wp2.getChildren();
261363
- nestedDirectoryChildren.forEach((nested) => this._remove(path51, nested));
261487
+ nestedDirectoryChildren.forEach((nested) => this._remove(path52, nested));
261364
261488
  const parent = this._getWatchedDir(directory);
261365
261489
  const wasTracked = parent.has(item);
261366
261490
  parent.remove(item);
261367
261491
  if (this._symlinkPaths.has(fullPath)) {
261368
261492
  this._symlinkPaths.delete(fullPath);
261369
261493
  }
261370
- let relPath = path51;
261494
+ let relPath = path52;
261371
261495
  if (this.options.cwd)
261372
- relPath = sysPath2.relative(this.options.cwd, path51);
261496
+ relPath = sysPath2.relative(this.options.cwd, path52);
261373
261497
  if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
261374
261498
  const event = this._pendingWrites.get(relPath).cancelWait();
261375
261499
  if (event === EVENTS.ADD)
261376
261500
  return;
261377
261501
  }
261378
- this._watched.delete(path51);
261502
+ this._watched.delete(path52);
261379
261503
  this._watched.delete(fullPath);
261380
261504
  const eventName = isDirectory2 ? EVENTS.UNLINK_DIR : EVENTS.UNLINK;
261381
- if (wasTracked && !this._isIgnored(path51))
261382
- this._emit(eventName, path51);
261383
- this._closePath(path51);
261505
+ if (wasTracked && !this._isIgnored(path52))
261506
+ this._emit(eventName, path52);
261507
+ this._closePath(path52);
261384
261508
  }
261385
- _closePath(path51) {
261386
- this._closeFile(path51);
261387
- const dir = sysPath2.dirname(path51);
261388
- this._getWatchedDir(dir).remove(sysPath2.basename(path51));
261509
+ _closePath(path52) {
261510
+ this._closeFile(path52);
261511
+ const dir = sysPath2.dirname(path52);
261512
+ this._getWatchedDir(dir).remove(sysPath2.basename(path52));
261389
261513
  }
261390
- _closeFile(path51) {
261391
- const closers = this._closers.get(path51);
261514
+ _closeFile(path52) {
261515
+ const closers = this._closers.get(path52);
261392
261516
  if (!closers)
261393
261517
  return;
261394
261518
  closers.forEach((closer) => closer());
261395
- this._closers.delete(path51);
261519
+ this._closers.delete(path52);
261396
261520
  }
261397
- _addPathCloser(path51, closer) {
261521
+ _addPathCloser(path52, closer) {
261398
261522
  if (!closer)
261399
261523
  return;
261400
- let list = this._closers.get(path51);
261524
+ let list = this._closers.get(path52);
261401
261525
  if (!list) {
261402
261526
  list = [];
261403
- this._closers.set(path51, list);
261527
+ this._closers.set(path52, list);
261404
261528
  }
261405
261529
  list.push(closer);
261406
261530
  }
@@ -261433,10 +261557,10 @@ import Debug3 from "debug";
261433
261557
 
261434
261558
  // lib/dependency-analysis/getNodeModuleDependencies.ts
261435
261559
  import * as ts3 from "typescript";
261436
- import * as path51 from "path";
261560
+ import * as path52 from "path";
261437
261561
  import * as fs48 from "fs";
261438
261562
  function getAllDependencyPackages(projectDir) {
261439
- const packageJsonPath = path51.join(projectDir, "package.json");
261563
+ const packageJsonPath = path52.join(projectDir, "package.json");
261440
261564
  const allPackages = new Set;
261441
261565
  if (!fs48.existsSync(packageJsonPath)) {
261442
261566
  return allPackages;
@@ -261457,7 +261581,7 @@ function getAllDependencyPackages(projectDir) {
261457
261581
  return allPackages;
261458
261582
  }
261459
261583
  function getNodeModuleImports(filePath) {
261460
- const absolutePath = path51.resolve(filePath);
261584
+ const absolutePath = path52.resolve(filePath);
261461
261585
  if (!fs48.existsSync(absolutePath)) {
261462
261586
  return [];
261463
261587
  }
@@ -261511,17 +261635,17 @@ function resolveNodeModuleImport({
261511
261635
  }) {
261512
261636
  const packageName = getPackageNameFromImport(importPath);
261513
261637
  const searchPaths = [
261514
- path51.join(projectDir, "node_modules", packageName)
261638
+ path52.join(projectDir, "node_modules", packageName)
261515
261639
  ];
261516
261640
  if (searchFromDir) {
261517
- let currentDir = path51.dirname(searchFromDir);
261518
- const projectDirNormalized = path51.normalize(projectDir);
261641
+ let currentDir = path52.dirname(searchFromDir);
261642
+ const projectDirNormalized = path52.normalize(projectDir);
261519
261643
  while (currentDir.startsWith(projectDirNormalized)) {
261520
- const candidatePath = path51.join(currentDir, "node_modules", packageName);
261644
+ const candidatePath = path52.join(currentDir, "node_modules", packageName);
261521
261645
  if (!searchPaths.includes(candidatePath)) {
261522
261646
  searchPaths.push(candidatePath);
261523
261647
  }
261524
- const parentDir = path51.dirname(currentDir);
261648
+ const parentDir = path52.dirname(currentDir);
261525
261649
  if (parentDir === currentDir)
261526
261650
  break;
261527
261651
  currentDir = parentDir;
@@ -261537,22 +261661,22 @@ function resolveNodeModuleImport({
261537
261661
  if (!packageDir) {
261538
261662
  return [];
261539
261663
  }
261540
- const packageJsonPath = path51.join(packageDir, "package.json");
261664
+ const packageJsonPath = path52.join(packageDir, "package.json");
261541
261665
  const hasPackageJson = fs48.existsSync(packageJsonPath);
261542
261666
  const packageJson = hasPackageJson ? JSON.parse(fs48.readFileSync(packageJsonPath, "utf-8")) : null;
261543
261667
  const resolvedFiles = [];
261544
261668
  if (importPath !== packageName) {
261545
261669
  const subpath = importPath.slice(packageName.length + 1);
261546
261670
  const possiblePaths = [
261547
- path51.join(packageDir, subpath),
261548
- path51.join(packageDir, `${subpath}.js`),
261549
- path51.join(packageDir, `${subpath}.mjs`),
261550
- path51.join(packageDir, `${subpath}.ts`),
261551
- path51.join(packageDir, `${subpath}.tsx`),
261552
- path51.join(packageDir, subpath, "index.js"),
261553
- path51.join(packageDir, subpath, "index.mjs"),
261554
- path51.join(packageDir, subpath, "index.ts"),
261555
- path51.join(packageDir, subpath, "index.tsx")
261671
+ path52.join(packageDir, subpath),
261672
+ path52.join(packageDir, `${subpath}.js`),
261673
+ path52.join(packageDir, `${subpath}.mjs`),
261674
+ path52.join(packageDir, `${subpath}.ts`),
261675
+ path52.join(packageDir, `${subpath}.tsx`),
261676
+ path52.join(packageDir, subpath, "index.js"),
261677
+ path52.join(packageDir, subpath, "index.mjs"),
261678
+ path52.join(packageDir, subpath, "index.ts"),
261679
+ path52.join(packageDir, subpath, "index.tsx")
261556
261680
  ];
261557
261681
  for (const p3 of possiblePaths) {
261558
261682
  if (fs48.existsSync(p3) && fs48.statSync(p3).isFile()) {
@@ -261587,22 +261711,22 @@ function resolveNodeModuleImport({
261587
261711
  resolveExportValue(packageJson.exports?.["."]?.require)
261588
261712
  ].filter((entry) => typeof entry === "string");
261589
261713
  for (const entry of entryPoints) {
261590
- const entryPath = path51.join(packageDir, entry);
261714
+ const entryPath = path52.join(packageDir, entry);
261591
261715
  if (fs48.existsSync(entryPath) && fs48.statSync(entryPath).isFile()) {
261592
261716
  resolvedFiles.push(entryPath);
261593
261717
  }
261594
261718
  }
261595
261719
  if (resolvedFiles.length === 0) {
261596
261720
  const fallbackPaths = [
261597
- path51.join(packageDir, "index.js"),
261598
- path51.join(packageDir, "index.mjs"),
261599
- path51.join(packageDir, "index.ts"),
261600
- path51.join(packageDir, "index.tsx"),
261601
- path51.join(packageDir, "dist", "index.js"),
261602
- path51.join(packageDir, "dist", "index.mjs"),
261603
- path51.join(packageDir, "lib", "index.js"),
261604
- path51.join(packageDir, "src", "index.ts"),
261605
- path51.join(packageDir, "src", "index.tsx")
261721
+ path52.join(packageDir, "index.js"),
261722
+ path52.join(packageDir, "index.mjs"),
261723
+ path52.join(packageDir, "index.ts"),
261724
+ path52.join(packageDir, "index.tsx"),
261725
+ path52.join(packageDir, "dist", "index.js"),
261726
+ path52.join(packageDir, "dist", "index.mjs"),
261727
+ path52.join(packageDir, "lib", "index.js"),
261728
+ path52.join(packageDir, "src", "index.ts"),
261729
+ path52.join(packageDir, "src", "index.tsx")
261606
261730
  ];
261607
261731
  for (const p3 of fallbackPaths) {
261608
261732
  if (fs48.existsSync(p3) && fs48.statSync(p3).isFile()) {
@@ -261643,8 +261767,8 @@ function collectAllNodeModuleDependencies(entryFilePath, projectDir, maxDepth =
261643
261767
  }
261644
261768
  }
261645
261769
  function getLocalDependencies(filePath) {
261646
- const absolutePath = path51.resolve(filePath);
261647
- const baseDir = path51.dirname(absolutePath);
261770
+ const absolutePath = path52.resolve(filePath);
261771
+ const baseDir = path52.dirname(absolutePath);
261648
261772
  if (!fs48.existsSync(absolutePath)) {
261649
261773
  return [];
261650
261774
  }
@@ -261670,7 +261794,7 @@ function collectAllNodeModuleDependencies(entryFilePath, projectDir, maxDepth =
261670
261794
  }
261671
261795
  function resolveLocalImport(importPath, baseDir) {
261672
261796
  const extensions = [".tsx", ".ts", ".jsx", ".js", ".mjs"];
261673
- const resolvedPath = path51.resolve(baseDir, importPath);
261797
+ const resolvedPath = path52.resolve(baseDir, importPath);
261674
261798
  if (fs48.existsSync(resolvedPath) && fs48.statSync(resolvedPath).isFile()) {
261675
261799
  return resolvedPath;
261676
261800
  }
@@ -261682,7 +261806,7 @@ function collectAllNodeModuleDependencies(entryFilePath, projectDir, maxDepth =
261682
261806
  }
261683
261807
  if (fs48.existsSync(resolvedPath) && fs48.statSync(resolvedPath).isDirectory()) {
261684
261808
  for (const ext of extensions) {
261685
- const indexPath = path51.join(resolvedPath, `index${ext}`);
261809
+ const indexPath = path52.join(resolvedPath, `index${ext}`);
261686
261810
  if (fs48.existsSync(indexPath)) {
261687
261811
  return indexPath;
261688
261812
  }
@@ -261708,11 +261832,11 @@ var EXCLUDED_PACKAGE_DIRECTORIES = new Set([
261708
261832
  function collectLocalPackageFiles(packageDir) {
261709
261833
  const buildDirs = ["dist", "build"];
261710
261834
  for (const dirName of buildDirs) {
261711
- const dirPath = path51.join(packageDir, dirName);
261835
+ const dirPath = path52.join(packageDir, dirName);
261712
261836
  if (fs48.existsSync(dirPath)) {
261713
261837
  const files = walkDirectory(dirPath, new Set);
261714
261838
  if (files.length > 0) {
261715
- const packageJsonPath = path51.join(packageDir, "package.json");
261839
+ const packageJsonPath = path52.join(packageDir, "package.json");
261716
261840
  if (fs48.existsSync(packageJsonPath)) {
261717
261841
  files.push(packageJsonPath);
261718
261842
  }
@@ -261728,7 +261852,7 @@ function walkDirectory(dir, excludedDirs) {
261728
261852
  return files;
261729
261853
  const entries = fs48.readdirSync(dir, { withFileTypes: true });
261730
261854
  for (const entry of entries) {
261731
- const fullPath = path51.join(dir, entry.name);
261855
+ const fullPath = path52.join(dir, entry.name);
261732
261856
  if (entry.isDirectory()) {
261733
261857
  if (excludedDirs.has(entry.name)) {
261734
261858
  continue;
@@ -261789,10 +261913,10 @@ function getAllNodeModuleFilePaths(entryFilePath, projectDir) {
261789
261913
  processedPackages.add(packageName);
261790
261914
  if (resolvedFiles.length > 0) {
261791
261915
  const firstResolvedFile = resolvedFiles[0];
261792
- let packageDir = path51.dirname(firstResolvedFile);
261916
+ let packageDir = path52.dirname(firstResolvedFile);
261793
261917
  let hasPackageJson = false;
261794
261918
  while (packageDir.includes("node_modules")) {
261795
- const packageJsonPath = path51.join(packageDir, "package.json");
261919
+ const packageJsonPath = path52.join(packageDir, "package.json");
261796
261920
  if (fs48.existsSync(packageJsonPath)) {
261797
261921
  try {
261798
261922
  const pkgJson = JSON.parse(fs48.readFileSync(packageJsonPath, "utf-8"));
@@ -261803,10 +261927,10 @@ function getAllNodeModuleFilePaths(entryFilePath, projectDir) {
261803
261927
  } catch {}
261804
261928
  }
261805
261929
  const expectedPackagePath = packageName.startsWith("@") ? `node_modules/${packageName}` : `node_modules/${packageName}`;
261806
- if (packageDir.endsWith(expectedPackagePath) || packageDir.endsWith(expectedPackagePath.replace(/\//g, path51.sep))) {
261930
+ if (packageDir.endsWith(expectedPackagePath) || packageDir.endsWith(expectedPackagePath.replace(/\//g, path52.sep))) {
261807
261931
  break;
261808
261932
  }
261809
- const parentDir = path51.dirname(packageDir);
261933
+ const parentDir = path52.dirname(packageDir);
261810
261934
  if (parentDir === packageDir)
261811
261935
  break;
261812
261936
  packageDir = parentDir;
@@ -261880,7 +262004,7 @@ class EventsWatcher extends EventEmitter2 {
261880
262004
  import * as fs50 from "node:fs";
261881
262005
  import * as http from "node:http";
261882
262006
  import { createRequire as createRequire4 } from "node:module";
261883
- import * as path53 from "node:path";
262007
+ import * as path54 from "node:path";
261884
262008
 
261885
262009
  // node_modules/winterspec/dist/edge/transform-to-node.js
261886
262010
  var import_node_utils = __toESM2(require_dist5(), 1);
@@ -262582,10 +262706,10 @@ var databaseSchema = z7.object({
262582
262706
  files: z7.array(fileSchema).default([]),
262583
262707
  events: z7.array(eventSchema).default([])
262584
262708
  });
262585
- function normalizePath3(path52) {
262586
- if (!path52 || path52 === "/")
262709
+ function normalizePath3(path53) {
262710
+ if (!path53 || path53 === "/")
262587
262711
  return "";
262588
- let normalized = path52.replace(/\\+/g, "/").replace(/\/\/+/, "/");
262712
+ let normalized = path53.replace(/\\+/g, "/").replace(/\/\/+/, "/");
262589
262713
  if (normalized.startsWith("/")) {
262590
262714
  normalized = normalized.slice(1);
262591
262715
  }
@@ -263443,13 +263567,13 @@ var getIndex = async (mainComponentPath, fileServerApiBaseUrl) => {
263443
263567
 
263444
263568
  // lib/server/kicad-pcm-proxy.ts
263445
263569
  import * as fs49 from "node:fs";
263446
- import * as path52 from "node:path";
263570
+ import * as path53 from "node:path";
263447
263571
  var getSourceFilesChecksum = (projectDir) => {
263448
263572
  const sourceFiles = globbySync(["**/*.tsx", "**/*.ts", "**/*.json", "!node_modules/**", "!dist/**"], { cwd: projectDir });
263449
263573
  let checksum = "";
263450
263574
  for (const file of sourceFiles) {
263451
263575
  try {
263452
- const stat4 = fs49.statSync(path52.join(projectDir, file));
263576
+ const stat4 = fs49.statSync(path53.join(projectDir, file));
263453
263577
  checksum += `${file}:${stat4.mtimeMs};`;
263454
263578
  } catch {}
263455
263579
  }
@@ -263469,9 +263593,9 @@ var createKicadPcmProxy = ({
263469
263593
  };
263470
263594
  const handleRequest = async (url2, res2) => {
263471
263595
  const requestedFile = url2.pathname.replace(/^\/pcm\/?/, "") || "repository.json";
263472
- const distDir = path52.join(projectDir, "dist");
263473
- const pcmDir = path52.join(distDir, "pcm");
263474
- const filePath = path52.join(pcmDir, requestedFile);
263596
+ const distDir = path53.join(projectDir, "dist");
263597
+ const pcmDir = path53.join(distDir, "pcm");
263598
+ const filePath = path53.join(pcmDir, requestedFile);
263475
263599
  const currentChecksum = getSourceFilesChecksum(projectDir);
263476
263600
  const needsRebuild = currentChecksum !== pcmState.lastFileChecksum;
263477
263601
  if (needsRebuild) {
@@ -263521,7 +263645,7 @@ Rebuilding KiCad PCM assets...`));
263521
263645
  res2.end(`PCM file not found: ${requestedFile}`);
263522
263646
  return;
263523
263647
  }
263524
- const ext = path52.extname(filePath).toLowerCase();
263648
+ const ext = path53.extname(filePath).toLowerCase();
263525
263649
  let contentType = "application/octet-stream";
263526
263650
  if (ext === ".json") {
263527
263651
  contentType = "application/json";
@@ -263545,8 +263669,8 @@ var resolveLocalTscircuitStandalonePath = (projectDir) => {
263545
263669
  if (!projectDir)
263546
263670
  return;
263547
263671
  try {
263548
- const projectRequire = createRequire4(path53.join(projectDir, "package.json"));
263549
- const browserBundlePath = path53.join(path53.dirname(projectRequire.resolve("tscircuit/package.json")), "dist", "browser.min.js");
263672
+ const projectRequire = createRequire4(path54.join(projectDir, "package.json"));
263673
+ const browserBundlePath = path54.join(path54.dirname(projectRequire.resolve("tscircuit/package.json")), "dist", "browser.min.js");
263550
263674
  if (fs50.existsSync(browserBundlePath))
263551
263675
  return browserBundlePath;
263552
263676
  } catch {}
@@ -263686,7 +263810,7 @@ var createHttpServer = async ({
263686
263810
  // lib/shared/push-snippet.ts
263687
263811
  var import_semver6 = __toESM2(require_semver2(), 1);
263688
263812
  import * as fs51 from "node:fs";
263689
- import * as path56 from "node:path";
263813
+ import * as path57 from "node:path";
263690
263814
  import Debug2 from "debug";
263691
263815
 
263692
263816
  // lib/utils/validate-package-name.ts
@@ -263704,7 +263828,7 @@ var validatePackageName = (name) => {
263704
263828
  };
263705
263829
 
263706
263830
  // lib/dev/get-package-file-paths.ts
263707
- import * as path54 from "node:path";
263831
+ import * as path55 from "node:path";
263708
263832
  var getPackageFilePaths = (projectDir, ignored = []) => {
263709
263833
  const ignorePatterns = [
263710
263834
  ...DEFAULT_IGNORED_PATTERNS,
@@ -263715,7 +263839,7 @@ var getPackageFilePaths = (projectDir, ignored = []) => {
263715
263839
  ignore: ignorePatterns
263716
263840
  });
263717
263841
  fileNames.sort();
263718
- return fileNames.map((fileName) => path54.join(projectDir, fileName));
263842
+ return fileNames.map((fileName) => path55.join(projectDir, fileName));
263719
263843
  };
263720
263844
 
263721
263845
  // lib/utils/check-org-access.ts
@@ -263731,7 +263855,7 @@ var checkOrgAccess = async (ky4, orgTscircuitHandle) => {
263731
263855
  };
263732
263856
 
263733
263857
  // lib/shared/is-binary-file.ts
263734
- import * as path55 from "node:path";
263858
+ import * as path56 from "node:path";
263735
263859
  var BINARY_FILE_EXTENSIONS = new Set([
263736
263860
  ".glb",
263737
263861
  ".gltf",
@@ -263747,7 +263871,7 @@ var BINARY_FILE_EXTENSIONS = new Set([
263747
263871
  ".tar"
263748
263872
  ]);
263749
263873
  var isBinaryFile = (filePath) => {
263750
- const ext = path55.extname(filePath).toLowerCase();
263874
+ const ext = path56.extname(filePath).toLowerCase();
263751
263875
  return BINARY_FILE_EXTENSIONS.has(ext);
263752
263876
  };
263753
263877
 
@@ -263784,14 +263908,14 @@ var findPushProject = async ({
263784
263908
  return null;
263785
263909
  }
263786
263910
  const packageJsonPath2 = [
263787
- path56.resolve(path56.join(path56.dirname(snippetFilePath2), "package.json")),
263788
- path56.resolve(path56.join(process.cwd(), "package.json"))
263911
+ path57.resolve(path57.join(path57.dirname(snippetFilePath2), "package.json")),
263912
+ path57.resolve(path57.join(process.cwd(), "package.json"))
263789
263913
  ].find((candidatePath) => fs51.existsSync(candidatePath));
263790
- const projectDir2 = packageJsonPath2 ? path56.dirname(packageJsonPath2) : path56.dirname(snippetFilePath2);
263914
+ const projectDir2 = packageJsonPath2 ? path57.dirname(packageJsonPath2) : path57.dirname(snippetFilePath2);
263791
263915
  return { snippetFilePath: snippetFilePath2, packageJsonPath: packageJsonPath2, projectDir: projectDir2 };
263792
263916
  }
263793
263917
  const projectDir = process.cwd();
263794
- const packageJsonPath = path56.resolve(path56.join(projectDir, "package.json"));
263918
+ const packageJsonPath = path57.resolve(path57.join(projectDir, "package.json"));
263795
263919
  if (!fs51.existsSync(packageJsonPath)) {
263796
263920
  return { projectDir };
263797
263921
  }
@@ -263805,7 +263929,7 @@ var findPushProject = async ({
263805
263929
  var getArchivePayload = async (filePaths, projectDir, packageNameWithVersion) => {
263806
263930
  const zip = new import_jszip4.default;
263807
263931
  for (const fullFilePath of filePaths) {
263808
- const relativeFilePath = path56.relative(projectDir, fullFilePath);
263932
+ const relativeFilePath = path57.relative(projectDir, fullFilePath);
263809
263933
  zip.file(relativeFilePath, fs51.readFileSync(fullFilePath));
263810
263934
  }
263811
263935
  const archive = await zip.generateAsync({
@@ -264036,7 +264160,7 @@ var pushSnippet = async ({
264036
264160
  json: archivePayload
264037
264161
  });
264038
264162
  for (const fullFilePath of filePaths) {
264039
- const relativeFilePath = path56.relative(projectDir, fullFilePath);
264163
+ const relativeFilePath = path57.relative(projectDir, fullFilePath);
264040
264164
  uploadResults.succeeded.push(relativeFilePath);
264041
264165
  }
264042
264166
  log(kleur_default.gray(`\uD83D\uDCE6 Uploaded archive with ${filePaths.length} files`));
@@ -264046,7 +264170,7 @@ var pushSnippet = async ({
264046
264170
  }
264047
264171
  if (uploadResults.succeeded.length === 0) {
264048
264172
  for (const fullFilePath of filePaths) {
264049
- const relativeFilePath = path56.relative(projectDir, fullFilePath);
264173
+ const relativeFilePath = path57.relative(projectDir, fullFilePath);
264050
264174
  const fileBuffer = fs51.readFileSync(fullFilePath);
264051
264175
  const isBinary = isBinaryFile(relativeFilePath) || hasBinaryContent(fileBuffer);
264052
264176
  const payload = {
@@ -264137,7 +264261,7 @@ class DevServer {
264137
264261
  }) {
264138
264262
  this.port = port;
264139
264263
  this.componentFilePath = componentFilePath;
264140
- this.projectDir = projectDir ?? path57.dirname(componentFilePath);
264264
+ this.projectDir = projectDir ?? path58.dirname(componentFilePath);
264141
264265
  this.kicadPcm = kicadPcm ?? false;
264142
264266
  const projectConfig2 = loadProjectConfig(this.projectDir);
264143
264267
  this.ignoredFiles = projectConfig2?.ignoredFiles ?? [];
@@ -264148,7 +264272,7 @@ class DevServer {
264148
264272
  async start() {
264149
264273
  const { server } = await createHttpServer({
264150
264274
  port: this.port,
264151
- defaultMainComponentPath: path57.relative(this.projectDir, this.componentFilePath),
264275
+ defaultMainComponentPath: path58.relative(this.projectDir, this.componentFilePath),
264152
264276
  kicadPcm: this.kicadPcm,
264153
264277
  projectDir: this.projectDir,
264154
264278
  entryFile: this.componentFilePath
@@ -264164,7 +264288,7 @@ class DevServer {
264164
264288
  this.filesystemWatcher = watch(this.projectDir, {
264165
264289
  persistent: true,
264166
264290
  ignoreInitial: true,
264167
- ignored: (p3) => shouldIgnorePath(path57.relative(this.projectDir, p3), this.ignoredFiles)
264291
+ ignored: (p3) => shouldIgnorePath(path58.relative(this.projectDir, p3), this.ignoredFiles)
264168
264292
  });
264169
264293
  this.filesystemWatcher.on("change", (filePath) => this.handleFileChangedOnFilesystem(filePath));
264170
264294
  this.filesystemWatcher.on("add", (filePath) => this.handleFileChangedOnFilesystem(filePath));
@@ -264179,8 +264303,8 @@ class DevServer {
264179
264303
  const { file } = await this.fsKy.get("api/files/get", {
264180
264304
  searchParams: { file_path: ev2.file_path }
264181
264305
  }).json();
264182
- const fullPath = path57.join(this.projectDir, ev2.file_path);
264183
- const dirPath = path57.dirname(fullPath);
264306
+ const fullPath = path58.join(this.projectDir, ev2.file_path);
264307
+ const dirPath = path58.dirname(fullPath);
264184
264308
  if (!fs52.existsSync(dirPath)) {
264185
264309
  fs52.mkdirSync(dirPath, { recursive: true });
264186
264310
  }
@@ -264192,14 +264316,14 @@ class DevServer {
264192
264316
  }
264193
264317
  }
264194
264318
  async handleFileDeletedEventFromServer(ev2) {
264195
- const fullPath = path57.join(this.projectDir, ev2.file_path);
264319
+ const fullPath = path58.join(this.projectDir, ev2.file_path);
264196
264320
  if (fs52.existsSync(fullPath)) {
264197
264321
  debug13(`Deleting file ${ev2.file_path} from filesystem`);
264198
264322
  fs52.unlinkSync(fullPath);
264199
264323
  }
264200
264324
  }
264201
264325
  async handleFileChangedOnFilesystem(absoluteFilePath) {
264202
- const relativeFilePath = path57.relative(this.projectDir, absoluteFilePath);
264326
+ const relativeFilePath = path58.relative(this.projectDir, absoluteFilePath);
264203
264327
  if (relativeFilePath.includes("manual-edits.json"))
264204
264328
  return;
264205
264329
  if (shouldIgnorePath(relativeFilePath, this.ignoredFiles))
@@ -264214,14 +264338,14 @@ class DevServer {
264214
264338
  await this.checkAndUploadNewNodeModules(absoluteFilePath);
264215
264339
  }
264216
264340
  async checkAndUploadNewNodeModules(filePath) {
264217
- const ext = path57.extname(filePath).toLowerCase();
264341
+ const ext = path58.extname(filePath).toLowerCase();
264218
264342
  const isSourceFile = [".ts", ".tsx", ".js", ".jsx", ".mjs"].includes(ext);
264219
264343
  if (!isSourceFile)
264220
264344
  return;
264221
264345
  try {
264222
264346
  const nodeModuleFiles = getAllNodeModuleFilePaths(filePath, this.projectDir);
264223
264347
  const newFiles = nodeModuleFiles.filter((file) => {
264224
- const relativePath = path57.relative(this.projectDir, file);
264348
+ const relativePath = path58.relative(this.projectDir, file);
264225
264349
  return !this.uploadedNodeModules.has(relativePath);
264226
264350
  });
264227
264351
  if (newFiles.length === 0)
@@ -264234,7 +264358,7 @@ class DevServer {
264234
264358
  }
264235
264359
  }
264236
264360
  async handleFileRemovedFromFilesystem(absoluteFilePath) {
264237
- const relativeFilePath = path57.relative(this.projectDir, absoluteFilePath);
264361
+ const relativeFilePath = path58.relative(this.projectDir, absoluteFilePath);
264238
264362
  if (shouldIgnorePath(relativeFilePath, this.ignoredFiles))
264239
264363
  return;
264240
264364
  if (!relativeFilePath || relativeFilePath.trim() === "") {
@@ -264272,8 +264396,8 @@ class DevServer {
264272
264396
  debug13(`Successfully deleted file ${relativeFilePath} from server`);
264273
264397
  }
264274
264398
  async handleFileRename(oldPath, newPath) {
264275
- const oldRelativePath = path57.relative(this.projectDir, oldPath);
264276
- const newRelativePath = path57.relative(this.projectDir, newPath);
264399
+ const oldRelativePath = path58.relative(this.projectDir, oldPath);
264400
+ const newRelativePath = path58.relative(this.projectDir, newPath);
264277
264401
  if (shouldIgnorePath(oldRelativePath, this.ignoredFiles) || shouldIgnorePath(newRelativePath, this.ignoredFiles))
264278
264402
  return;
264279
264403
  await this.handleFileRemovedFromFilesystem(oldPath);
@@ -264291,7 +264415,7 @@ class DevServer {
264291
264415
  });
264292
264416
  const filePaths = getPackageFilePaths(this.projectDir, this.ignoredFiles);
264293
264417
  for (const filePath of filePaths) {
264294
- const relativeFilePath = path57.relative(this.projectDir, filePath);
264418
+ const relativeFilePath = path58.relative(this.projectDir, filePath);
264295
264419
  const filePayload = this.createFileUploadPayload(filePath, relativeFilePath);
264296
264420
  await this.postFileUpsert({
264297
264421
  filePath: relativeFilePath,
@@ -264323,7 +264447,7 @@ class DevServer {
264323
264447
  }
264324
264448
  async uploadNodeModuleFiles(files) {
264325
264449
  for (const nodeModuleFile of files) {
264326
- const relativeFilePath = path57.relative(this.projectDir, nodeModuleFile);
264450
+ const relativeFilePath = path58.relative(this.projectDir, nodeModuleFile);
264327
264451
  this.uploadedNodeModules.add(relativeFilePath);
264328
264452
  const filePayload = this.createFileUploadPayload(nodeModuleFile, relativeFilePath);
264329
264453
  await this.postFileUpsert({
@@ -264362,7 +264486,7 @@ class DevServer {
264362
264486
  getInitialNodeModuleDependencyEntryFiles() {
264363
264487
  const entryFiles = [this.componentFilePath];
264364
264488
  for (const configFileName of CONFIG_MODULE_FILENAMES2) {
264365
- const configPath = path57.join(this.projectDir, configFileName);
264489
+ const configPath = path58.join(this.projectDir, configFileName);
264366
264490
  if (fs52.existsSync(configPath)) {
264367
264491
  entryFiles.push(configPath);
264368
264492
  }
@@ -264378,7 +264502,7 @@ class DevServer {
264378
264502
  formData.set("file_path", filePath);
264379
264503
  formData.set("initiator", initiator);
264380
264504
  const binaryBytes = Uint8Array.from(binaryContent);
264381
- formData.set("binary_file", new Blob([binaryBytes]), path57.basename(filePath));
264505
+ formData.set("binary_file", new Blob([binaryBytes]), path58.basename(filePath));
264382
264506
  const response = await fetch(`http://localhost:${this.port}/api/files/upsert-multipart`, {
264383
264507
  method: "POST",
264384
264508
  body: formData
@@ -264418,7 +264542,7 @@ class DevServer {
264418
264542
  await this.filesystemWatcher?.close();
264419
264543
  }
264420
264544
  createFileUploadPayload(absoluteFilePath, relativeFilePath) {
264421
- const ext = path57.extname(relativeFilePath).toLowerCase();
264545
+ const ext = path58.extname(relativeFilePath).toLowerCase();
264422
264546
  if (BINARY_FILE_EXTENSIONS2.has(ext)) {
264423
264547
  const fileBuffer = fs52.readFileSync(absoluteFilePath);
264424
264548
  return { binary_content: fileBuffer };
@@ -264464,7 +264588,7 @@ var isPortAvailable = (port) => {
264464
264588
  });
264465
264589
  };
264466
264590
  var warnIfTsconfigMissingTscircuitType = (projectDir) => {
264467
- const tsconfigPath = path58.join(projectDir, "tsconfig.json");
264591
+ const tsconfigPath = path59.join(projectDir, "tsconfig.json");
264468
264592
  if (!fs53.existsSync(tsconfigPath)) {
264469
264593
  return;
264470
264594
  }
@@ -264501,7 +264625,7 @@ var registerDev = (program2) => {
264501
264625
 
264502
264626
  ${kleur_default.green(`@tscircuit/cli@${getVersion()}`)} ${kleur_default.gray("ready in")} ${kleur_default.white(`${Math.round(timeToStart)}ms`)}`);
264503
264627
  console.log(`
264504
- ${kleur_default.bold("➜ Local:")} ${kleur_default.underline(kleur_default.cyan(`http://localhost:${port}`))}${server.componentFilePath ? kleur_default.underline(kleur_default.cyan(`/#file=${encodeURIComponent(path58.relative(process.cwd(), server.componentFilePath).replaceAll("\\", "/"))}`)) : ""}
264628
+ ${kleur_default.bold("➜ Local:")} ${kleur_default.underline(kleur_default.cyan(`http://localhost:${port}`))}${server.componentFilePath ? kleur_default.underline(kleur_default.cyan(`/#file=${encodeURIComponent(path59.relative(process.cwd(), server.componentFilePath).replaceAll("\\", "/"))}`)) : ""}
264505
264629
 
264506
264630
  `);
264507
264631
  console.log(kleur_default.gray(`Watching ${kleur_default.underline(server.projectDir.split("/").slice(-2).join("/"))} for changes...`));
@@ -264531,13 +264655,13 @@ var checkLoggedIn = () => {
264531
264655
  import { spawnSync as spawnSync2 } from "node:child_process";
264532
264656
  import fs54 from "node:fs";
264533
264657
  import os7 from "node:os";
264534
- import path59 from "node:path";
264658
+ import path60 from "node:path";
264535
264659
  var hasBunInstalled = () => {
264536
264660
  const result = spawnSync2("bun", ["--version"], { stdio: "ignore" });
264537
264661
  return result.status === 0;
264538
264662
  };
264539
264663
  var createTempProject = (tempDir) => {
264540
- const packageJsonPath = path59.join(tempDir, "package.json");
264664
+ const packageJsonPath = path60.join(tempDir, "package.json");
264541
264665
  const packageJson = {
264542
264666
  name: "tsci-doctor-check",
264543
264667
  version: "0.0.0",
@@ -264557,7 +264681,7 @@ var checkGlobalNpmrcRegistry = async () => {
264557
264681
  details: "Bun is required to verify registry settings. Install Bun and rerun `tsci doctor`."
264558
264682
  };
264559
264683
  }
264560
- const tempDir = fs54.mkdtempSync(path59.join(os7.tmpdir(), "tsci-doctor-"));
264684
+ const tempDir = fs54.mkdtempSync(path60.join(os7.tmpdir(), "tsci-doctor-"));
264561
264685
  try {
264562
264686
  createTempProject(tempDir);
264563
264687
  const result = spawnSync2("bun", ["install"], {
@@ -264629,7 +264753,7 @@ var registerDoctor = (program2) => {
264629
264753
 
264630
264754
  // lib/shared/export-snippet.ts
264631
264755
  import fs55 from "node:fs";
264632
- import path60 from "node:path";
264756
+ import path61 from "node:path";
264633
264757
  import { promisify as promisify3 } from "node:util";
264634
264758
  import { convertCircuitJsonToGltf as convertCircuitJsonToGltf4 } from "circuit-json-to-gltf";
264635
264759
  import {
@@ -265762,9 +265886,9 @@ var stringifyDsnJson = (dsnJson) => {
265762
265886
  const stringifyCoordinates = (coordinates) => {
265763
265887
  return coordinates.join(" ");
265764
265888
  };
265765
- const stringifyPath = (path60, level) => {
265889
+ const stringifyPath = (path61, level) => {
265766
265890
  const padding = indent.repeat(level);
265767
- return `${padding}(path ${path60.layer} ${path60.width} ${stringifyCoordinates(path60.coordinates)})`;
265891
+ return `${padding}(path ${path61.layer} ${path61.width} ${stringifyCoordinates(path61.coordinates)})`;
265768
265892
  };
265769
265893
  result += `(pcb ${dsnJson.filename ? dsnJson.filename : "./converted_dsn.dsn"}
265770
265894
  `;
@@ -267443,11 +267567,11 @@ var convertSoupToGerberCommands = (soup, opts = {}) => {
267443
267567
  continue;
267444
267568
  }
267445
267569
  const letterPaths = lineAlphabet2[char] || [];
267446
- for (const path60 of letterPaths) {
267447
- const x12 = anchoredX + path60.x1 * fontSize;
267448
- const y12 = anchoredY + path60.y1 * fontSize;
267449
- const x22 = anchoredX + path60.x2 * fontSize;
267450
- const y22 = anchoredY + path60.y2 * fontSize;
267570
+ for (const path61 of letterPaths) {
267571
+ const x12 = anchoredX + path61.x1 * fontSize;
267572
+ const y12 = anchoredY + path61.y1 * fontSize;
267573
+ const x22 = anchoredX + path61.x2 * fontSize;
267574
+ const y22 = anchoredY + path61.y2 * fontSize;
267451
267575
  const p12 = applyTransform({ x: x12, y: y12 });
267452
267576
  const p23 = applyTransform({ x: x22, y: y22 });
267453
267577
  gerber.add("move_operation", { x: p12.x, y: mfy(p12.y) });
@@ -268212,7 +268336,7 @@ var exportSnippet = async ({
268212
268336
  outputPath,
268213
268337
  platformConfig: platformConfig2,
268214
268338
  pcbSnapshotSettings,
268215
- writeFile = true,
268339
+ writeFile: writeFile2 = true,
268216
268340
  onExit = (code) => process.exit(code),
268217
268341
  onError = (message) => console.error(message),
268218
268342
  onSuccess = (result) => console.log(result)
@@ -268221,10 +268345,10 @@ var exportSnippet = async ({
268221
268345
  onError(`Invalid format: ${format}`);
268222
268346
  return onExit(1);
268223
268347
  }
268224
- const projectDir = path60.dirname(filePath);
268225
- const outputBaseName = path60.basename(filePath).replace(/\.[^.]+$/, "");
268348
+ const projectDir = path61.dirname(filePath);
268349
+ const outputBaseName = path61.basename(filePath).replace(/\.[^.]+$/, "");
268226
268350
  const outputFileName = `${outputBaseName}${OUTPUT_EXTENSIONS[format]}`;
268227
- const outputDestination = path60.join(projectDir, outputPath ?? outputFileName);
268351
+ const outputDestination = path61.join(projectDir, outputPath ?? outputFileName);
268228
268352
  if (format === "kicad-library") {
268229
268353
  try {
268230
268354
  const result = await convertToKicadLibrary({
@@ -268232,7 +268356,7 @@ var exportSnippet = async ({
268232
268356
  libraryName: outputBaseName,
268233
268357
  outputDir: outputDestination
268234
268358
  });
268235
- if (writeFile) {
268359
+ if (writeFile2) {
268236
268360
  onSuccess({ outputDestination: result.outputDir, outputContent: "" });
268237
268361
  }
268238
268362
  return onExit(0);
@@ -268336,7 +268460,7 @@ var exportSnippet = async ({
268336
268460
  model3dSourcePaths: pcbConverter.getModel3dSourcePaths(),
268337
268461
  projectName: outputBaseName,
268338
268462
  fetch: platformConfig2?.platformFetch ?? globalThis.fetch,
268339
- readFile: (modelPath) => fs55.promises.readFile(path60.resolve(projectDir, modelPath)),
268463
+ readFile: (modelPath) => fs55.promises.readFile(path61.resolve(projectDir, modelPath)),
268340
268464
  onModelFile: ({ outputPath: outputPath2, content }) => {
268341
268465
  zip.file(outputPath2, content);
268342
268466
  },
@@ -268393,7 +268517,7 @@ var exportSnippet = async ({
268393
268517
  default:
268394
268518
  outputContent = JSON.stringify(circuitJson, null, 2);
268395
268519
  }
268396
- if (writeFile) {
268520
+ if (writeFile2) {
268397
268521
  await writeFileAsync(outputDestination, outputContent).catch((err) => {
268398
268522
  onError(`Error writing file: ${err}`);
268399
268523
  return onExit(1);
@@ -268518,11 +268642,11 @@ var getSpiceWithPaddedSim = (circuitJson, options) => {
268518
268642
 
268519
268643
  // lib/eecircuit-engine/run-simulation.ts
268520
268644
  import { promises as fs56, existsSync as existsSync15 } from "node:fs";
268521
- import path61 from "node:path";
268645
+ import path62 from "node:path";
268522
268646
  import os8 from "node:os";
268523
268647
  var sim = null;
268524
268648
  var fetchSimulation = async () => {
268525
- const tempFilePath = path61.join(os8.tmpdir(), `tscircuit-eecircuit-engine-1.7.4.mjs`);
268649
+ const tempFilePath = path62.join(os8.tmpdir(), `tscircuit-eecircuit-engine-1.7.4.mjs`);
268526
268650
  if (!existsSync15(tempFilePath)) {
268527
268651
  const url2 = `https://jscdn.tscircuit.com/@tscircuit/eecircuit-engine/1.7.4/dist/eecircuit-engine.mjs`;
268528
268652
  const response = await fetch(url2);
@@ -268619,7 +268743,7 @@ var resultToCsv = (result) => {
268619
268743
  };
268620
268744
 
268621
268745
  // cli/export/register.ts
268622
- import path62 from "node:path";
268746
+ import path63 from "node:path";
268623
268747
  import { promises as fs57 } from "node:fs";
268624
268748
  var registerExport = (program2) => {
268625
268749
  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) => {
@@ -268634,7 +268758,7 @@ var registerExport = (program2) => {
268634
268758
  });
268635
268759
  if (circuitJson) {
268636
268760
  const spiceString = getSpiceWithPaddedSim(circuitJson);
268637
- const outputSpicePath = options.output ?? path62.join(path62.dirname(file), `${path62.basename(file, path62.extname(file))}.spice.cir`);
268761
+ const outputSpicePath = options.output ?? path63.join(path63.dirname(file), `${path63.basename(file, path63.extname(file))}.spice.cir`);
268638
268762
  await fs57.writeFile(outputSpicePath, spiceString);
268639
268763
  const { result } = await runSimulation(spiceString);
268640
268764
  const csvContent = resultToCsv(result);
@@ -269361,8 +269485,8 @@ function getErrorMap2() {
269361
269485
  return overrideErrorMap2;
269362
269486
  }
269363
269487
  var makeIssue2 = (params2) => {
269364
- const { data, path: path63, errorMaps, issueData } = params2;
269365
- const fullPath = [...path63, ...issueData.path || []];
269488
+ const { data, path: path64, errorMaps, issueData } = params2;
269489
+ const fullPath = [...path64, ...issueData.path || []];
269366
269490
  const fullIssue = {
269367
269491
  ...issueData,
269368
269492
  path: fullPath
@@ -269470,11 +269594,11 @@ var errorUtil2;
269470
269594
  errorUtil22.toString = (message) => typeof message === "string" ? message : message?.message;
269471
269595
  })(errorUtil2 || (errorUtil2 = {}));
269472
269596
  var ParseInputLazyPath2 = class {
269473
- constructor(parent, value, path63, key) {
269597
+ constructor(parent, value, path64, key) {
269474
269598
  this._cachedPath = [];
269475
269599
  this.parent = parent;
269476
269600
  this.data = value;
269477
- this._path = path63;
269601
+ this._path = path64;
269478
269602
  this._key = key;
269479
269603
  }
269480
269604
  get path() {
@@ -277143,15 +277267,15 @@ function generateArcFromSweep(startX, startY, endX, endY, radius, largeArcFlag,
277143
277267
  }
277144
277268
  }
277145
277269
  const numPoints = Math.max(2, Math.ceil(Math.abs(endAngle - startAngle) * radius));
277146
- const path63 = [];
277270
+ const path64 = [];
277147
277271
  for (let i3 = 0;i3 <= numPoints; i3++) {
277148
277272
  const t50 = i3 / numPoints;
277149
277273
  const angle2 = startAngle + t50 * (endAngle - startAngle);
277150
277274
  const x4 = centerX + radius * Math.cos(angle2);
277151
277275
  const y4 = centerY + radius * Math.sin(angle2);
277152
- path63.push({ x: x4, y: y4 });
277276
+ path64.push({ x: x4, y: y4 });
277153
277277
  }
277154
- return path63;
277278
+ return path64;
277155
277279
  }
277156
277280
  var mil10ToMm = (value) => value * 10 * 0.0254;
277157
277281
  var getBoundsCenter = (bounds) => ({
@@ -278322,7 +278446,7 @@ var parsePin = (pinString) => {
278322
278446
  const colorMatch = pinString.match(/#[0-9A-F]{6}/);
278323
278447
  const labelColor = colorMatch ? colorMatch[0] : "";
278324
278448
  const pathMatch = pinString.match(/\^\^([^~]+)/);
278325
- const path63 = pathMatch ? pathMatch[1] : "";
278449
+ const path64 = pathMatch ? pathMatch[1] : "";
278326
278450
  const arrowMatch = pinString.match(/\^\^0~(.+)$/);
278327
278451
  const arrow = arrowMatch ? arrowMatch[1] : "";
278328
278452
  const r4 = Number.parseFloat(rotation23);
@@ -278336,7 +278460,7 @@ var parsePin = (pinString) => {
278336
278460
  rotation: Number.isNaN(r4) ? 0 : r4,
278337
278461
  label,
278338
278462
  labelColor,
278339
- path: path63,
278463
+ path: path64,
278340
278464
  arrow
278341
278465
  };
278342
278466
  };
@@ -283926,15 +284050,15 @@ function generateArcFromSweep2(startX, startY, endX, endY, radius, largeArcFlag,
283926
284050
  }
283927
284051
  }
283928
284052
  const numPoints = Math.max(2, Math.ceil(Math.abs(endAngle - startAngle) * radius));
283929
- const path63 = [];
284053
+ const path64 = [];
283930
284054
  for (let i3 = 0;i3 <= numPoints; i3++) {
283931
284055
  const t50 = i3 / numPoints;
283932
284056
  const angle2 = startAngle + t50 * (endAngle - startAngle);
283933
284057
  const x4 = centerX + radius * Math.cos(angle2);
283934
284058
  const y4 = centerY + radius * Math.sin(angle2);
283935
- path63.push({ x: x4, y: y4 });
284059
+ path64.push({ x: x4, y: y4 });
283936
284060
  }
283937
- return path63;
284061
+ return path64;
283938
284062
  }
283939
284063
  var mil10ToMm2 = (value) => value * 10 * 0.0254;
283940
284064
  var getBoundsCenter2 = (bounds) => ({
@@ -285091,7 +285215,7 @@ var parsePin2 = (pinString) => {
285091
285215
  const colorMatch = pinString.match(/#[0-9A-F]{6}/);
285092
285216
  const labelColor = colorMatch ? colorMatch[0] : "";
285093
285217
  const pathMatch = pinString.match(/\^\^([^~]+)/);
285094
- const path63 = pathMatch ? pathMatch[1] : "";
285218
+ const path64 = pathMatch ? pathMatch[1] : "";
285095
285219
  const arrowMatch = pinString.match(/\^\^0~(.+)$/);
285096
285220
  const arrow = arrowMatch ? arrowMatch[1] : "";
285097
285221
  const r4 = Number.parseFloat(rotation23);
@@ -285105,7 +285229,7 @@ var parsePin2 = (pinString) => {
285105
285229
  rotation: Number.isNaN(r4) ? 0 : r4,
285106
285230
  label,
285107
285231
  labelColor,
285108
- path: path63,
285232
+ path: path64,
285109
285233
  arrow
285110
285234
  };
285111
285235
  };
@@ -285428,14 +285552,14 @@ function normalizeManufacturerPartNumber2(partNumber) {
285428
285552
 
285429
285553
  // lib/import/import-component-from-jlcpcb.ts
285430
285554
  import fs58 from "node:fs/promises";
285431
- import path63 from "node:path";
285555
+ import path64 from "node:path";
285432
285556
  var importComponentFromJlcpcb = async (jlcpcbPartNumber, projectDir = process.cwd(), options = {}) => {
285433
285557
  const rawEasy = await fetchEasyEDAComponent(jlcpcbPartNumber);
285434
285558
  const betterEasy = EasyEdaJsonSchema2.parse(rawEasy);
285435
285559
  const rawPn = betterEasy.dataStr.head.c_para["Manufacturer Part"];
285436
285560
  const componentName = rawPn ? normalizeManufacturerPartNumber2(rawPn) : jlcpcbPartNumber;
285437
285561
  let tsx = await convertRawEasyToTsx({ rawEasy });
285438
- const componentDir = options.download ? path63.join(projectDir, "imports", componentName) : path63.join(projectDir, "imports");
285562
+ const componentDir = options.download ? path64.join(projectDir, "imports", componentName) : path64.join(projectDir, "imports");
285439
285563
  await fs58.mkdir(componentDir, { recursive: true });
285440
285564
  if (options.download) {
285441
285565
  const platformConfig2 = getPlatformConfigWithCliDefaults();
@@ -285447,7 +285571,7 @@ var importComponentFromJlcpcb = async (jlcpcbPartNumber, projectDir = process.cw
285447
285571
  if (cadComponent?.model_step_url) {
285448
285572
  const stepFileName = `${componentName}.step`;
285449
285573
  const stepResp = await platformFetch2(cadComponent.model_step_url);
285450
- await fs58.writeFile(path63.join(componentDir, stepFileName), Buffer.from(await stepResp.arrayBuffer()));
285574
+ await fs58.writeFile(path64.join(componentDir, stepFileName), Buffer.from(await stepResp.arrayBuffer()));
285451
285575
  tsx = `import stepPath from "./${stepFileName}"
285452
285576
  ` + tsx;
285453
285577
  tsx = tsx.replace(`"${cadComponent.model_step_url}"`, "stepPath");
@@ -285455,13 +285579,13 @@ var importComponentFromJlcpcb = async (jlcpcbPartNumber, projectDir = process.cw
285455
285579
  if (cadComponent?.model_obj_url) {
285456
285580
  const objFileName = `${componentName}.obj`;
285457
285581
  const objResp = await platformFetch2(cadComponent.model_obj_url);
285458
- await fs58.writeFile(path63.join(componentDir, objFileName), Buffer.from(await objResp.arrayBuffer()));
285582
+ await fs58.writeFile(path64.join(componentDir, objFileName), Buffer.from(await objResp.arrayBuffer()));
285459
285583
  tsx = `import objPath from "./${objFileName}"
285460
285584
  ` + tsx;
285461
285585
  tsx = tsx.replace(`"${cadComponent.model_obj_url}"`, "objPath");
285462
285586
  }
285463
285587
  }
285464
- const filePath = path63.join(componentDir, `${componentName}.tsx`);
285588
+ const filePath = path64.join(componentDir, `${componentName}.tsx`);
285465
285589
  await fs58.writeFile(filePath, tsx);
285466
285590
  return { filePath };
285467
285591
  };
@@ -286904,12 +287028,12 @@ var registerImport = (program2) => {
286904
287028
 
286905
287029
  // cli/init/register.ts
286906
287030
  import * as fs60 from "node:fs";
286907
- import * as path66 from "node:path";
287031
+ import * as path67 from "node:path";
286908
287032
 
286909
287033
  // lib/shared/generate-gitignore-file.ts
286910
- import path64 from "node:path";
287034
+ import path65 from "node:path";
286911
287035
  var generateGitIgnoreFile = (dir) => {
286912
- const gitignorePath = path64.join(dir, ".gitignore");
287036
+ const gitignorePath = path65.join(dir, ".gitignore");
286913
287037
  const gitignoreContent = `# Dependencies
286914
287038
  node_modules/
286915
287039
 
@@ -286945,7 +287069,7 @@ yarn-error.log*
286945
287069
 
286946
287070
  // lib/shared/setup-tscircuit-skill.ts
286947
287071
  import * as fs59 from "node:fs";
286948
- import * as path65 from "node:path";
287072
+ import * as path66 from "node:path";
286949
287073
  var SKILL_REPO_API_URL = "https://api.github.com/repos/tscircuit/skill/contents";
286950
287074
  var SKILL_INSTALL_PATHS = [
286951
287075
  ".claude/skills/tscircuit",
@@ -286968,7 +287092,7 @@ async function fetchFileContent(downloadUrl) {
286968
287092
  async function downloadDirectory(apiUrl, targetDir) {
286969
287093
  const contents = await fetchGitHubContents(apiUrl);
286970
287094
  for (const item of contents) {
286971
- const targetPath = path65.join(targetDir, item.name);
287095
+ const targetPath = path66.join(targetDir, item.name);
286972
287096
  if (item.type === "dir") {
286973
287097
  fs59.mkdirSync(targetPath, { recursive: true });
286974
287098
  await downloadDirectory(`${apiUrl}/${item.name}`, targetPath);
@@ -286985,7 +287109,7 @@ async function downloadSkillRepo(targetDir) {
286985
287109
  if (item.name === ".git" || item.name === ".github") {
286986
287110
  continue;
286987
287111
  }
286988
- const targetPath = path65.join(targetDir, item.name);
287112
+ const targetPath = path66.join(targetDir, item.name);
286989
287113
  if (item.type === "dir") {
286990
287114
  fs59.mkdirSync(targetPath, { recursive: true });
286991
287115
  await downloadDirectory(`${SKILL_REPO_API_URL}/${item.name}`, targetPath);
@@ -286996,7 +287120,7 @@ async function downloadSkillRepo(targetDir) {
286996
287120
  }
286997
287121
  }
286998
287122
  async function setupTscircuitSkill(projectDir, skipPrompt = false) {
286999
- const missingSkillPaths = SKILL_INSTALL_PATHS.filter((skillPath) => !fs59.existsSync(path65.join(projectDir, skillPath, "SKILL.md")));
287123
+ const missingSkillPaths = SKILL_INSTALL_PATHS.filter((skillPath) => !fs59.existsSync(path66.join(projectDir, skillPath, "SKILL.md")));
287000
287124
  if (missingSkillPaths.length === 0) {
287001
287125
  console.log("TSCircuit AI skills already exist, skipping...");
287002
287126
  return true;
@@ -287016,7 +287140,7 @@ async function setupTscircuitSkill(projectDir, skipPrompt = false) {
287016
287140
  console.info("Setting up tscircuit AI skills...");
287017
287141
  try {
287018
287142
  for (const skillPath of missingSkillPaths) {
287019
- const targetDir = path65.join(projectDir, skillPath);
287143
+ const targetDir = path66.join(projectDir, skillPath);
287020
287144
  await downloadSkillRepo(targetDir);
287021
287145
  console.info(`tscircuit skill installed at ${skillPath}`);
287022
287146
  }
@@ -287087,7 +287211,7 @@ var POSTHOG_HOST = "https://us.i.posthog.com";
287087
287211
  var TSCI_POSTHOG_PROJECT_API_KEY = "phc_htd8AQjSfVEsFCLQMAiUooG4Q0DKBCjqYuQglc9V3Wo";
287088
287212
  var POSTHOG_CAPTURE_PATH = "/capture";
287089
287213
  var isTruthy4 = (value) => value ? ["1", "true", "yes", "on"].includes(value.toLowerCase()) : false;
287090
- var joinUrl = (host, path66) => `${host.replace(/\/$/, "")}${path66}`;
287214
+ var joinUrl = (host, path67) => `${host.replace(/\/$/, "")}${path67}`;
287091
287215
  var getTelemetryConfigFromEnv = (env3 = process.env) => {
287092
287216
  if (isTruthy4(env3.TSCI_TELEMETRY_DISABLED)) {
287093
287217
  return { enabled: false };
@@ -287155,7 +287279,7 @@ var registerInit = (program3) => {
287155
287279
  }
287156
287280
  }
287157
287281
  }
287158
- const projectDir = directory ? path66.resolve(process.cwd(), directory) : process.cwd();
287282
+ const projectDir = directory ? path67.resolve(process.cwd(), directory) : process.cwd();
287159
287283
  let tsciHandle = null;
287160
287284
  const token = getSessionToken();
287161
287285
  if (token) {
@@ -287166,7 +287290,7 @@ var registerInit = (program3) => {
287166
287290
  }
287167
287291
  } catch {}
287168
287292
  }
287169
- const dirName = path66.basename(projectDir);
287293
+ const dirName = path67.basename(projectDir);
287170
287294
  let defaultPackageName = dirName;
287171
287295
  if (tsciHandle) {
287172
287296
  defaultPackageName = `@tsci/${tsciHandle}.${dirName}`;
@@ -287185,7 +287309,7 @@ var registerInit = (program3) => {
287185
287309
  }
287186
287310
  }
287187
287311
  fs60.mkdirSync(projectDir, { recursive: true });
287188
- writeFileIfNotExists(path66.join(projectDir, "index.circuit.tsx"), `
287312
+ writeFileIfNotExists(path67.join(projectDir, "index.circuit.tsx"), `
287189
287313
  export default () => (
287190
287314
  <board>
287191
287315
  <resistor resistance="1k" footprint="0402" name="R1" />
@@ -287197,7 +287321,7 @@ export default () => (
287197
287321
  if (saveProjectConfig(null, projectDir)) {
287198
287322
  console.log("Created tscircuit.config.json with schema");
287199
287323
  }
287200
- writeFileIfNotExists(path66.join(projectDir, ".npmrc"), `
287324
+ writeFileIfNotExists(path67.join(projectDir, ".npmrc"), `
287201
287325
  @tsci:registry=https://npm.tscircuit.com
287202
287326
  `);
287203
287327
  console.log("Generating package.json");
@@ -287336,9 +287460,9 @@ var registerRegistryPackagesCreate = (program3) => {
287336
287460
 
287337
287461
  // cli/registry/packages/update/register.ts
287338
287462
  import fs61 from "node:fs";
287339
- import path67 from "node:path";
287463
+ import path68 from "node:path";
287340
287464
  var getCurrentDirectoryPackageName = () => {
287341
- const packageJsonPath = path67.join(process.cwd(), "package.json");
287465
+ const packageJsonPath = path68.join(process.cwd(), "package.json");
287342
287466
  if (!fs61.existsSync(packageJsonPath))
287343
287467
  return;
287344
287468
  try {
@@ -287479,14 +287603,14 @@ var KeyStore = class {
287479
287603
  }
287480
287604
  };
287481
287605
  function createKey(key) {
287482
- let path68 = null;
287606
+ let path69 = null;
287483
287607
  let id2 = null;
287484
287608
  let src = null;
287485
287609
  let weight = 1;
287486
287610
  let getFn = null;
287487
287611
  if (isString2(key) || isArray(key)) {
287488
287612
  src = key;
287489
- path68 = createKeyPath(key);
287613
+ path69 = createKeyPath(key);
287490
287614
  id2 = createKeyId(key);
287491
287615
  } else {
287492
287616
  if (!hasOwn.call(key, "name"))
@@ -287498,12 +287622,12 @@ function createKey(key) {
287498
287622
  if (weight <= 0)
287499
287623
  throw new Error(INVALID_KEY_WEIGHT_VALUE(createKeyId(name)));
287500
287624
  }
287501
- path68 = createKeyPath(name);
287625
+ path69 = createKeyPath(name);
287502
287626
  id2 = createKeyId(name);
287503
287627
  getFn = key.getFn ?? null;
287504
287628
  }
287505
287629
  return {
287506
- path: path68,
287630
+ path: path69,
287507
287631
  id: id2,
287508
287632
  weight,
287509
287633
  src,
@@ -287516,22 +287640,22 @@ function createKeyPath(key) {
287516
287640
  function createKeyId(key) {
287517
287641
  return isArray(key) ? key.join(".") : key;
287518
287642
  }
287519
- function get(obj, path68) {
287643
+ function get(obj, path69) {
287520
287644
  const list = [];
287521
287645
  let arr = false;
287522
- const deepGet = (obj2, path69, index, arrayIndex) => {
287646
+ const deepGet = (obj2, path70, index, arrayIndex) => {
287523
287647
  if (!isDefined(obj2))
287524
287648
  return;
287525
- if (!path69[index])
287649
+ if (!path70[index])
287526
287650
  list.push(arrayIndex !== undefined ? {
287527
287651
  v: obj2,
287528
287652
  i: arrayIndex
287529
287653
  } : obj2);
287530
287654
  else {
287531
- const value = obj2[path69[index]];
287655
+ const value = obj2[path70[index]];
287532
287656
  if (!isDefined(value))
287533
287657
  return;
287534
- if (index === path69.length - 1 && (isString2(value) || isNumber2(value) || isBoolean(value) || typeof value === "bigint"))
287658
+ if (index === path70.length - 1 && (isString2(value) || isNumber2(value) || isBoolean(value) || typeof value === "bigint"))
287535
287659
  list.push(arrayIndex !== undefined ? {
287536
287660
  v: toString2(value),
287537
287661
  i: arrayIndex
@@ -287539,12 +287663,12 @@ function get(obj, path68) {
287539
287663
  else if (isArray(value)) {
287540
287664
  arr = true;
287541
287665
  for (let i3 = 0, len = value.length;i3 < len; i3 += 1)
287542
- deepGet(value[i3], path69, index + 1, i3);
287543
- } else if (path69.length)
287544
- deepGet(value, path69, index + 1, arrayIndex);
287666
+ deepGet(value[i3], path70, index + 1, i3);
287667
+ } else if (path70.length)
287668
+ deepGet(value, path70, index + 1, arrayIndex);
287545
287669
  }
287546
287670
  };
287547
- deepGet(obj, isString2(path68) ? path68.split(".") : path68, 0);
287671
+ deepGet(obj, isString2(path69) ? path69.split(".") : path69, 0);
287548
287672
  return arr ? list : list[0];
287549
287673
  }
287550
287674
  var MatchOptions = {
@@ -289122,9 +289246,9 @@ var registerSearch = (program3) => {
289122
289246
  }
289123
289247
  if (opts.json) {
289124
289248
  const unifiedResults = [
289125
- ...kicadResults.map((path68) => ({
289249
+ ...kicadResults.map((path69) => ({
289126
289250
  source: "kicad",
289127
- path: path68
289251
+ path: path69
289128
289252
  })),
289129
289253
  ...results.packages.map((pkg) => ({
289130
289254
  source: "tscircuit",
@@ -289152,8 +289276,8 @@ var registerSearch = (program3) => {
289152
289276
  }
289153
289277
  if (kicadResults.length) {
289154
289278
  console.log(kleur_default.bold().underline(`Found ${kicadResults.length} footprint(s) from KiCad:`));
289155
- kicadResults.forEach((path68, idx) => {
289156
- console.log(`${(idx + 1).toString().padStart(2, " ")}. kicad:${path68.replace(".kicad_mod", "").replace(".pretty", "")}`);
289279
+ kicadResults.forEach((path69, idx) => {
289280
+ console.log(`${(idx + 1).toString().padStart(2, " ")}. kicad:${path69.replace(".kicad_mod", "").replace(".pretty", "")}`);
289157
289281
  });
289158
289282
  }
289159
289283
  if (results.packages.length) {
@@ -289178,20 +289302,20 @@ var registerSearch = (program3) => {
289178
289302
 
289179
289303
  // lib/shared/setup-github-actions.ts
289180
289304
  import fs62 from "node:fs";
289181
- import path68 from "node:path";
289305
+ import path69 from "node:path";
289182
289306
  var setupGithubActions = (projectDir = process.cwd()) => {
289183
289307
  const findGitRoot = (startDir) => {
289184
- let dir = path68.resolve(startDir);
289185
- while (dir !== path68.parse(dir).root) {
289186
- if (fs62.existsSync(path68.join(dir, ".git"))) {
289308
+ let dir = path69.resolve(startDir);
289309
+ while (dir !== path69.parse(dir).root) {
289310
+ if (fs62.existsSync(path69.join(dir, ".git"))) {
289187
289311
  return dir;
289188
289312
  }
289189
- dir = path68.dirname(dir);
289313
+ dir = path69.dirname(dir);
289190
289314
  }
289191
289315
  return null;
289192
289316
  };
289193
289317
  const gitRoot = findGitRoot(projectDir) ?? projectDir;
289194
- const workflowsDir = path68.join(gitRoot, ".github", "workflows");
289318
+ const workflowsDir = path69.join(gitRoot, ".github", "workflows");
289195
289319
  fs62.mkdirSync(workflowsDir, { recursive: true });
289196
289320
  const buildWorkflow = `name: tscircuit Build
289197
289321
 
@@ -289231,8 +289355,8 @@ jobs:
289231
289355
  - run: bun install
289232
289356
  - run: bunx tsci snapshot
289233
289357
  `;
289234
- writeFileIfNotExists(path68.join(workflowsDir, "tscircuit-build.yml"), buildWorkflow);
289235
- writeFileIfNotExists(path68.join(workflowsDir, "tscircuit-snapshot.yml"), snapshotWorkflow);
289358
+ writeFileIfNotExists(path69.join(workflowsDir, "tscircuit-build.yml"), buildWorkflow);
289359
+ writeFileIfNotExists(path69.join(workflowsDir, "tscircuit-snapshot.yml"), snapshotWorkflow);
289236
289360
  };
289237
289361
 
289238
289362
  // cli/setup/register.ts
@@ -289347,21 +289471,21 @@ var registerSimulate = (program3) => {
289347
289471
 
289348
289472
  // lib/shared/snapshot-project.ts
289349
289473
  import fs66 from "node:fs";
289350
- import path71 from "node:path";
289474
+ import path72 from "node:path";
289351
289475
 
289352
289476
  // cli/snapshot/worker-pool.ts
289353
289477
  import fs63 from "node:fs";
289354
- import path69 from "node:path";
289478
+ import path70 from "node:path";
289355
289479
  var getWorkerEntrypointPath2 = () => {
289356
- const tsPath = path69.join(import.meta.dir, "snapshot.worker.ts");
289480
+ const tsPath = path70.join(import.meta.dir, "snapshot.worker.ts");
289357
289481
  if (fs63.existsSync(tsPath)) {
289358
289482
  return tsPath;
289359
289483
  }
289360
- const jsBundledPath = path69.join(import.meta.dir, "snapshot", "snapshot.worker.js");
289484
+ const jsBundledPath = path70.join(import.meta.dir, "snapshot", "snapshot.worker.js");
289361
289485
  if (fs63.existsSync(jsBundledPath)) {
289362
289486
  return jsBundledPath;
289363
289487
  }
289364
- return path69.join(import.meta.dir, "snapshot.worker.js");
289488
+ return path70.join(import.meta.dir, "snapshot.worker.js");
289365
289489
  };
289366
289490
  var snapshotFilesWithWorkerPool = async (options) => {
289367
289491
  const cancellationError = new Error("Snapshot cancelled due to file failure");
@@ -289432,7 +289556,7 @@ var snapshotFilesWithWorkerPool = async (options) => {
289432
289556
 
289433
289557
  // lib/shared/process-snapshot-file.ts
289434
289558
  import fs65 from "node:fs";
289435
- import path70 from "node:path";
289559
+ import path71 from "node:path";
289436
289560
  import {
289437
289561
  convertCircuitJsonToPcbSvg as convertCircuitJsonToPcbSvg5,
289438
289562
  convertCircuitJsonToSchematicSvg as convertCircuitJsonToSchematicSvg5
@@ -289481,7 +289605,7 @@ var processSnapshotFile = async ({
289481
289605
  cameraPreset,
289482
289606
  pcbLayer
289483
289607
  }) => {
289484
- const relativeFilePath = path70.relative(projectDir, file);
289608
+ const relativeFilePath = path71.relative(projectDir, file);
289485
289609
  const successPaths = [];
289486
289610
  const warningMessages = [];
289487
289611
  const mismatches = [];
@@ -289576,11 +289700,11 @@ var processSnapshotFile = async ({
289576
289700
  } catch (error2) {
289577
289701
  const errorMessage = error2 instanceof Error ? error2.message : String(error2);
289578
289702
  if (errorMessage.includes("No pcb_board found in circuit JSON")) {
289579
- const fileDir = path70.dirname(file);
289580
- const relativeDir = path70.relative(projectDir, fileDir);
289581
- const snapDir2 = snapshotsDirName ? path70.join(projectDir, snapshotsDirName, relativeDir) : path70.join(fileDir, "__snapshots__");
289582
- const base2 = path70.basename(file).replace(/\.[^.]+$/, "");
289583
- const snap3dPath = path70.join(snapDir2, `${base2}-3d.snap.png`);
289703
+ const fileDir = path71.dirname(file);
289704
+ const relativeDir = path71.relative(projectDir, fileDir);
289705
+ const snapDir2 = snapshotsDirName ? path71.join(projectDir, snapshotsDirName, relativeDir) : path71.join(fileDir, "__snapshots__");
289706
+ const base2 = path71.basename(file).replace(/\.[^.]+$/, "");
289707
+ const snap3dPath = path71.join(snapDir2, `${base2}-3d.snap.png`);
289584
289708
  const existing3dSnapshot = fs65.existsSync(snap3dPath);
289585
289709
  if (existing3dSnapshot) {
289586
289710
  return {
@@ -289592,7 +289716,7 @@ var processSnapshotFile = async ({
289592
289716
  errorMessage: kleur_default.red(`
289593
289717
  ❌ Failed to generate 3D snapshot for ${relativeFilePath}:
289594
289718
  `) + kleur_default.red(` No pcb_board found in circuit JSON
289595
- `) + kleur_default.red(` Existing snapshot: ${path70.relative(projectDir, snap3dPath)}
289719
+ `) + kleur_default.red(` Existing snapshot: ${path71.relative(projectDir, snap3dPath)}
289596
289720
  `)
289597
289721
  };
289598
289722
  }
@@ -289613,9 +289737,9 @@ var processSnapshotFile = async ({
289613
289737
  }
289614
289738
  }
289615
289739
  }
289616
- const snapDir = snapshotsDirName ? path70.join(projectDir, snapshotsDirName, path70.relative(projectDir, path70.dirname(file))) : path70.join(path70.dirname(file), "__snapshots__");
289740
+ const snapDir = snapshotsDirName ? path71.join(projectDir, snapshotsDirName, path71.relative(projectDir, path71.dirname(file))) : path71.join(path71.dirname(file), "__snapshots__");
289617
289741
  fs65.mkdirSync(snapDir, { recursive: true });
289618
- const base = path70.basename(file).replace(/\.[^.]+$/, "");
289742
+ const base = path71.basename(file).replace(/\.[^.]+$/, "");
289619
289743
  const snapshots = [];
289620
289744
  if (!simulationOnly && (pcbOnly || !schematicOnly)) {
289621
289745
  let pcbSnapshotType = "pcb";
@@ -289649,13 +289773,13 @@ var processSnapshotFile = async ({
289649
289773
  for (const snapshot of snapshots) {
289650
289774
  const { type } = snapshot;
289651
289775
  const is3d = type === "3d";
289652
- const snapPath = path70.join(snapDir, `${base}-${type}.snap.${is3d ? "png" : "svg"}`);
289776
+ const snapPath = path71.join(snapDir, `${base}-${type}.snap.${is3d ? "png" : "svg"}`);
289653
289777
  const existing = fs65.existsSync(snapPath);
289654
289778
  const newContentBuffer = snapshot.isBinary ? snapshot.content : Buffer.from(snapshot.content, "utf8");
289655
289779
  const newContentForFile = snapshot.content;
289656
289780
  if (!existing) {
289657
289781
  fs65.writeFileSync(snapPath, newContentForFile);
289658
- successPaths.push(path70.relative(projectDir, snapPath));
289782
+ successPaths.push(path71.relative(projectDir, snapPath));
289659
289783
  didUpdate = true;
289660
289784
  continue;
289661
289785
  }
@@ -289671,16 +289795,16 @@ var processSnapshotFile = async ({
289671
289795
  }
289672
289796
  if (update) {
289673
289797
  if (!forceUpdate && equal2) {
289674
- successPaths.push(path70.relative(projectDir, snapPath));
289798
+ successPaths.push(path71.relative(projectDir, snapPath));
289675
289799
  } else {
289676
289800
  fs65.writeFileSync(snapPath, newContentForFile);
289677
- successPaths.push(path70.relative(projectDir, snapPath));
289801
+ successPaths.push(path71.relative(projectDir, snapPath));
289678
289802
  didUpdate = true;
289679
289803
  }
289680
289804
  } else if (!equal2) {
289681
289805
  mismatches.push(diffPath ? `${snapPath} (diff: ${diffPath})` : snapPath);
289682
289806
  } else {
289683
- successPaths.push(path70.relative(projectDir, snapPath));
289807
+ successPaths.push(path71.relative(projectDir, snapPath));
289684
289808
  }
289685
289809
  }
289686
289810
  return {
@@ -289725,7 +289849,7 @@ var snapshotProject = async ({
289725
289849
  ...DEFAULT_IGNORED_PATTERNS,
289726
289850
  ...ignored.map(normalizeIgnorePattern)
289727
289851
  ];
289728
- const resolvedPaths = filePaths.map((f3) => path71.resolve(projectDir, f3));
289852
+ const resolvedPaths = filePaths.map((f3) => path72.resolve(projectDir, f3));
289729
289853
  const explicitDirectoryTarget = resolvedPaths.find((resolvedPath) => {
289730
289854
  if (!fs66.existsSync(resolvedPath)) {
289731
289855
  return false;
@@ -289739,7 +289863,7 @@ var snapshotProject = async ({
289739
289863
  });
289740
289864
  if (boardFiles.length === 0) {
289741
289865
  if (explicitDirectoryTarget) {
289742
- const relativeDirectory = path71.relative(projectDir, explicitDirectoryTarget) || ".";
289866
+ const relativeDirectory = path72.relative(projectDir, explicitDirectoryTarget) || ".";
289743
289867
  const runtimeIncludeBoardFilePatterns = projectConfig2?.includeBoardFiles?.filter((pattern) => pattern.trim()) ?? [];
289744
289868
  const includeBoardFilePatterns = runtimeIncludeBoardFilePatterns.length > 0 ? runtimeIncludeBoardFilePatterns : getBoardFilePatterns(projectDir);
289745
289869
  const patternSourceMessage = hasConfiguredIncludeBoardFiles(projectConfig2) ? "Searched using tscircuit.config.json includeBoardFiles" : "Searched using default includeBoardFiles";
@@ -289903,7 +290027,7 @@ var registerSnapshot = (program3) => {
289903
290027
  };
289904
290028
 
289905
290029
  // cli/transpile/register.ts
289906
- import path72 from "node:path";
290030
+ import path73 from "node:path";
289907
290031
  var registerTranspile = (program3) => {
289908
290032
  program3.command("transpile").description("Transpile TypeScript/TSX to JavaScript (ESM, CommonJS, and type declarations)").argument("[file]", "Path to the entry file").action(async (file) => {
289909
290033
  try {
@@ -289911,7 +290035,7 @@ var registerTranspile = (program3) => {
289911
290035
  fileOrDir: file,
289912
290036
  includeBoardFiles: false
289913
290037
  });
289914
- const distDir = path72.join(projectDir, "dist");
290038
+ const distDir = path73.join(projectDir, "dist");
289915
290039
  validateMainInDist(projectDir, distDir);
289916
290040
  console.log("Transpiling entry file...");
289917
290041
  const entryFile = mainEntrypoint || circuitFiles[0];
@@ -289949,12 +290073,12 @@ function registerUpgradeCommand(program3) {
289949
290073
  }
289950
290074
 
289951
290075
  // lib/shared/update-package.ts
289952
- import * as path73 from "node:path";
290076
+ import * as path74 from "node:path";
289953
290077
  import * as fs67 from "node:fs";
289954
290078
  async function updatePackage(packageSpec, projectDir = process.cwd()) {
289955
290079
  const packageManager = getPackageManager();
289956
290080
  if (!packageSpec) {
289957
- const pkgJsonPath = path73.join(projectDir, "package.json");
290081
+ const pkgJsonPath = path74.join(projectDir, "package.json");
289958
290082
  if (!fs67.existsSync(pkgJsonPath)) {
289959
290083
  console.log(kleur_default.yellow("No package.json found. Cannot update all packages."));
289960
290084
  return;
@@ -290042,6 +290166,7 @@ registerCheckPinSpecification(program2);
290042
290166
  registerCheckPlacement(program2);
290043
290167
  registerCheckRoutingDifficulty(program2);
290044
290168
  registerCheckSchematicPlacement(program2);
290169
+ registerCheckShorts(program2);
290045
290170
  registerCheckTraceLength(program2);
290046
290171
  registerRegistry(program2);
290047
290172
  registerRegistryPackages(program2);