@tscircuit/cli 0.1.1141 → 0.1.1143

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
@@ -124180,7 +124180,7 @@ var import_perfect_cli = __toESM2(require_dist2(), 1);
124180
124180
  // lib/getVersion.ts
124181
124181
  import { createRequire as createRequire2 } from "node:module";
124182
124182
  // package.json
124183
- var version = "0.1.1140";
124183
+ var version = "0.1.1142";
124184
124184
  var package_default = {
124185
124185
  name: "@tscircuit/cli",
124186
124186
  version,
@@ -124211,7 +124211,7 @@ var package_default = {
124211
124211
  "bun-match-svg": "^0.0.12",
124212
124212
  chokidar: "4.0.1",
124213
124213
  "circuit-json": "^0.0.403",
124214
- "circuit-json-to-kicad": "^0.0.85",
124214
+ "circuit-json-to-kicad": "^0.0.86",
124215
124215
  "circuit-json-to-readable-netlist": "^0.0.15",
124216
124216
  "circuit-json-to-spice": "^0.0.10",
124217
124217
  "circuit-json-to-tscircuit": "^0.0.9",
@@ -129857,7 +129857,8 @@ var KICAD_FP_GENERATOR = "pcbnew";
129857
129857
  var KICAD_FP_GENERATOR_VERSION = "8.0";
129858
129858
  function getBasename(filePath) {
129859
129859
  const parts = filePath.split(/[/\\]/);
129860
- return parts[parts.length - 1] || filePath;
129860
+ const base = parts[parts.length - 1] || filePath;
129861
+ return base.split("?")[0] || base;
129861
129862
  }
129862
129863
  var ExtractFootprintsStage = class extends ConverterStage {
129863
129864
  classifyFootprints() {
@@ -130038,7 +130039,9 @@ var ExtractFootprintsStage = class extends ConverterStage {
130038
130039
  for (const model of models) {
130039
130040
  if (model.path) {
130040
130041
  const modelFilename = getBasename(model.path);
130041
- const newPath = `../../3dmodels/${fpLibraryName}.3dshapes/${modelFilename}`;
130042
+ const isRemote = model.path.startsWith("http://modelcdn.tscircuit.com") || model.path.startsWith("https://modelcdn.tscircuit.com");
130043
+ const shapesFolder = isRemote ? "tscircuit_builtin" : fpLibraryName;
130044
+ const newPath = `../../3dmodels/${shapesFolder}.3dshapes/${modelFilename}`;
130042
130045
  const newModel = new FootprintModel(newPath);
130043
130046
  if (model.offset)
130044
130047
  newModel.offset = model.offset;
@@ -130047,7 +130050,7 @@ var ExtractFootprintsStage = class extends ConverterStage {
130047
130050
  if (model.rotate)
130048
130051
  newModel.rotate = model.rotate;
130049
130052
  updatedModels.push(newModel);
130050
- modelFiles.push(model.path);
130053
+ modelFiles.push(model.path.split("?")[0] ?? model.path);
130051
130054
  }
130052
130055
  }
130053
130056
  if (updatedModels.length === 0) {
@@ -130876,7 +130879,8 @@ var AddFootprintsStage = class extends ConverterStage {
130876
130879
  if (!model.path)
130877
130880
  return model;
130878
130881
  const filename = getBasename(model.path);
130879
- const folderName = this.ctx.projectName ?? filename.replace(/\.[^.]+$/, "");
130882
+ const isRemote = model.path.startsWith("http://modelcdn.tscircuit.com") || model.path.startsWith("https://modelcdn.tscircuit.com");
130883
+ const folderName = isRemote ? "tscircuit_builtin" : this.ctx.projectName ?? filename.replace(/\.[^.]+$/, "");
130880
130884
  const newModel = new FootprintModel4(`${KICAD_3D_BASE}/${folderName}.3dshapes/${filename}`);
130881
130885
  if (model.offset)
130882
130886
  newModel.offset = model.offset;
@@ -130884,8 +130888,9 @@ var AddFootprintsStage = class extends ConverterStage {
130884
130888
  newModel.scale = model.scale;
130885
130889
  if (model.rotate)
130886
130890
  newModel.rotate = model.rotate;
130887
- if (!this.ctx.pcbModel3dSourcePaths?.includes(model.path)) {
130888
- this.ctx.pcbModel3dSourcePaths?.push(model.path);
130891
+ const sourcePath = model.path?.split("?")[0];
130892
+ if (sourcePath && !this.ctx.pcbModel3dSourcePaths?.includes(sourcePath)) {
130893
+ this.ctx.pcbModel3dSourcePaths?.push(sourcePath);
130889
130894
  }
130890
130895
  return newModel;
130891
130896
  });
@@ -131732,10 +131737,12 @@ function renameKicadFootprint(params2) {
131732
131737
  const usesProjectPath = currentPath.includes("${KIPRJMOD}/") || /3dmodels[\\/]/.test(currentPath);
131733
131738
  if (usesProjectPath) {
131734
131739
  const filename = currentPath.split(/[\\/]/).pop() ?? "";
131740
+ const isBuiltinPath = currentPath.includes("tscircuit_builtin.3dshapes");
131741
+ const targetFolder = isBuiltinPath ? "tscircuit_builtin" : kicadLibraryName;
131735
131742
  if (isPcm && kicadPcmPackageId) {
131736
- model.path = `${KICAD_3RD_PARTY_PLACEHOLDER}/3dmodels/${kicadPcmPackageId}/${kicadLibraryName}.3dshapes/${filename}`;
131743
+ model.path = `${KICAD_3RD_PARTY_PLACEHOLDER}/3dmodels/${kicadPcmPackageId}/${targetFolder}.3dshapes/${filename}`;
131737
131744
  } else {
131738
- model.path = `../../3dmodels/${kicadLibraryName}.3dshapes/${filename}`;
131745
+ model.path = `../../3dmodels/${targetFolder}.3dshapes/${filename}`;
131739
131746
  }
131740
131747
  }
131741
131748
  }
package/dist/lib/index.js CHANGED
@@ -60445,7 +60445,7 @@ var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
60445
60445
  }));
60446
60446
  };
60447
60447
  // package.json
60448
- var version = "0.1.1140";
60448
+ var version = "0.1.1142";
60449
60449
  var package_default = {
60450
60450
  name: "@tscircuit/cli",
60451
60451
  version,
@@ -60476,7 +60476,7 @@ var package_default = {
60476
60476
  "bun-match-svg": "^0.0.12",
60477
60477
  chokidar: "4.0.1",
60478
60478
  "circuit-json": "^0.0.403",
60479
- "circuit-json-to-kicad": "^0.0.85",
60479
+ "circuit-json-to-kicad": "^0.0.86",
60480
60480
  "circuit-json-to-readable-netlist": "^0.0.15",
60481
60481
  "circuit-json-to-spice": "^0.0.10",
60482
60482
  "circuit-json-to-tscircuit": "^0.0.9",
@@ -64839,7 +64839,8 @@ var KICAD_FP_GENERATOR = "pcbnew";
64839
64839
  var KICAD_FP_GENERATOR_VERSION = "8.0";
64840
64840
  function getBasename(filePath) {
64841
64841
  const parts = filePath.split(/[/\\]/);
64842
- return parts[parts.length - 1] || filePath;
64842
+ const base = parts[parts.length - 1] || filePath;
64843
+ return base.split("?")[0] || base;
64843
64844
  }
64844
64845
  var ExtractFootprintsStage = class extends ConverterStage {
64845
64846
  classifyFootprints() {
@@ -65020,7 +65021,9 @@ var ExtractFootprintsStage = class extends ConverterStage {
65020
65021
  for (const model of models) {
65021
65022
  if (model.path) {
65022
65023
  const modelFilename = getBasename(model.path);
65023
- const newPath = `../../3dmodels/${fpLibraryName}.3dshapes/${modelFilename}`;
65024
+ const isRemote = model.path.startsWith("http://modelcdn.tscircuit.com") || model.path.startsWith("https://modelcdn.tscircuit.com");
65025
+ const shapesFolder = isRemote ? "tscircuit_builtin" : fpLibraryName;
65026
+ const newPath = `../../3dmodels/${shapesFolder}.3dshapes/${modelFilename}`;
65024
65027
  const newModel = new FootprintModel(newPath);
65025
65028
  if (model.offset)
65026
65029
  newModel.offset = model.offset;
@@ -65029,7 +65032,7 @@ var ExtractFootprintsStage = class extends ConverterStage {
65029
65032
  if (model.rotate)
65030
65033
  newModel.rotate = model.rotate;
65031
65034
  updatedModels.push(newModel);
65032
- modelFiles.push(model.path);
65035
+ modelFiles.push(model.path.split("?")[0] ?? model.path);
65033
65036
  }
65034
65037
  }
65035
65038
  if (updatedModels.length === 0) {
@@ -65858,7 +65861,8 @@ var AddFootprintsStage = class extends ConverterStage {
65858
65861
  if (!model.path)
65859
65862
  return model;
65860
65863
  const filename = getBasename(model.path);
65861
- const folderName = this.ctx.projectName ?? filename.replace(/\.[^.]+$/, "");
65864
+ const isRemote = model.path.startsWith("http://modelcdn.tscircuit.com") || model.path.startsWith("https://modelcdn.tscircuit.com");
65865
+ const folderName = isRemote ? "tscircuit_builtin" : this.ctx.projectName ?? filename.replace(/\.[^.]+$/, "");
65862
65866
  const newModel = new FootprintModel4(`${KICAD_3D_BASE}/${folderName}.3dshapes/${filename}`);
65863
65867
  if (model.offset)
65864
65868
  newModel.offset = model.offset;
@@ -65866,8 +65870,9 @@ var AddFootprintsStage = class extends ConverterStage {
65866
65870
  newModel.scale = model.scale;
65867
65871
  if (model.rotate)
65868
65872
  newModel.rotate = model.rotate;
65869
- if (!this.ctx.pcbModel3dSourcePaths?.includes(model.path)) {
65870
- this.ctx.pcbModel3dSourcePaths?.push(model.path);
65873
+ const sourcePath = model.path?.split("?")[0];
65874
+ if (sourcePath && !this.ctx.pcbModel3dSourcePaths?.includes(sourcePath)) {
65875
+ this.ctx.pcbModel3dSourcePaths?.push(sourcePath);
65871
65876
  }
65872
65877
  return newModel;
65873
65878
  });
@@ -66714,10 +66719,12 @@ function renameKicadFootprint(params2) {
66714
66719
  const usesProjectPath = currentPath.includes("${KIPRJMOD}/") || /3dmodels[\\/]/.test(currentPath);
66715
66720
  if (usesProjectPath) {
66716
66721
  const filename = currentPath.split(/[\\/]/).pop() ?? "";
66722
+ const isBuiltinPath = currentPath.includes("tscircuit_builtin.3dshapes");
66723
+ const targetFolder = isBuiltinPath ? "tscircuit_builtin" : kicadLibraryName;
66717
66724
  if (isPcm && kicadPcmPackageId) {
66718
- model.path = `${KICAD_3RD_PARTY_PLACEHOLDER}/3dmodels/${kicadPcmPackageId}/${kicadLibraryName}.3dshapes/${filename}`;
66725
+ model.path = `${KICAD_3RD_PARTY_PLACEHOLDER}/3dmodels/${kicadPcmPackageId}/${targetFolder}.3dshapes/${filename}`;
66719
66726
  } else {
66720
- model.path = `../../3dmodels/${kicadLibraryName}.3dshapes/${filename}`;
66727
+ model.path = `../../3dmodels/${targetFolder}.3dshapes/${filename}`;
66721
66728
  }
66722
66729
  }
66723
66730
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.1141",
3
+ "version": "0.1.1143",
4
4
  "main": "dist/cli/main.js",
5
5
  "exports": {
6
6
  ".": "./dist/cli/main.js",
@@ -28,7 +28,7 @@
28
28
  "bun-match-svg": "^0.0.12",
29
29
  "chokidar": "4.0.1",
30
30
  "circuit-json": "^0.0.403",
31
- "circuit-json-to-kicad": "^0.0.85",
31
+ "circuit-json-to-kicad": "^0.0.86",
32
32
  "circuit-json-to-readable-netlist": "^0.0.15",
33
33
  "circuit-json-to-spice": "^0.0.10",
34
34
  "circuit-json-to-tscircuit": "^0.0.9",