@tscircuit/cli 0.1.145 → 0.1.147

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.
Files changed (2) hide show
  1. package/dist/main.js +84 -24
  2. package/package.json +6 -4
package/dist/main.js CHANGED
@@ -442424,7 +442424,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
442424
442424
  import { execSync as execSync2 } from "node:child_process";
442425
442425
  var import_semver2 = __toESM2(require_semver2(), 1);
442426
442426
  // package.json
442427
- var version = "0.1.144";
442427
+ var version = "0.1.146";
442428
442428
  var package_default = {
442429
442429
  name: "@tscircuit/cli",
442430
442430
  version,
@@ -442433,14 +442433,14 @@ var package_default = {
442433
442433
  "@babel/standalone": "^7.26.9",
442434
442434
  "@biomejs/biome": "^1.9.4",
442435
442435
  "@tscircuit/circuit-json-util": "^0.0.47",
442436
+ "@tscircuit/eval": "^0.0.238",
442436
442437
  "@tscircuit/fake-snippets": "^0.0.87",
442437
442438
  "@tscircuit/file-server": "^0.0.24",
442438
442439
  "@tscircuit/math-utils": "^0.0.18",
442439
- "@tscircuit/props": "^0.0.237",
442440
+ "@tscircuit/props": "^0.0.242",
442440
442441
  "@tscircuit/runframe": "^0.0.614",
442441
442442
  "@tscircuit/schematic-match-adapt": "^0.0.22",
442442
442443
  "@tscircuit/simple-3d-svg": "^0.0.10",
442443
- tscircuit: "^0.0.505",
442444
442444
  "@types/bun": "^1.2.2",
442445
442445
  "@types/configstore": "^6.0.2",
442446
442446
  "@types/debug": "^4.1.12",
@@ -442473,11 +442473,13 @@ var package_default = {
442473
442473
  redaxios: "^0.5.1",
442474
442474
  semver: "^7.6.3",
442475
442475
  tempy: "^3.1.0",
442476
+ tscircuit: "^0.0.505",
442476
442477
  "typed-ky": "^0.0.4"
442477
442478
  },
442478
442479
  peerDependencies: {
442479
442480
  typescript: "^5.0.0",
442480
- tscircuit: "*"
442481
+ tscircuit: "*",
442482
+ "@tscircuit/props": "*"
442481
442483
  },
442482
442484
  bin: {
442483
442485
  tsci: "./dist/main.js"
@@ -467841,6 +467843,7 @@ init_dist3();
467841
467843
  init_lib();
467842
467844
  init_lib();
467843
467845
  init_lib();
467846
+ init_lib();
467844
467847
  init_dist3();
467845
467848
  init_lib();
467846
467849
  init_dist3();
@@ -467869,6 +467872,7 @@ init_lib();
467869
467872
  init_dist3();
467870
467873
  init_lib();
467871
467874
  init_lib();
467875
+ init_lib();
467872
467876
  init_dist3();
467873
467877
  init_lib();
467874
467878
  init_lib();
@@ -467876,7 +467880,6 @@ init_dist3();
467876
467880
  init_lib();
467877
467881
  init_dist3();
467878
467882
  init_lib();
467879
- init_lib();
467880
467883
  init_dist3();
467881
467884
  init_lib();
467882
467885
  init_dist3();
@@ -467920,6 +467923,7 @@ init_lib();
467920
467923
  init_dist3();
467921
467924
  init_lib();
467922
467925
  init_dist3();
467926
+ init_lib();
467923
467927
  init_dist3();
467924
467928
  init_lib();
467925
467929
  init_lib();
@@ -468043,6 +468047,19 @@ var lrPolarPins = [
468043
468047
  "neg"
468044
468048
  ];
468045
468049
  var distanceOrMultiplier = distance3.or(z.enum(["2x", "3x", "4x"]));
468050
+ var schematicOrientation = z.enum([
468051
+ "vertical",
468052
+ "horizontal",
468053
+ "pos_top",
468054
+ "pos_bottom",
468055
+ "pos_left",
468056
+ "pos_right",
468057
+ "neg_top",
468058
+ "neg_bottom",
468059
+ "neg_left",
468060
+ "neg_right"
468061
+ ]).describe("horizontal means pins go 1->2 rightward and vertical means pins go 1->2 downward (generally, positive on top)");
468062
+ expectTypesMatch3(true);
468046
468063
  var explicitPinSideDefinition = z.object({
468047
468064
  pins: z.array(z.union([z.number(), z.string()])),
468048
468065
  direction: z.union([
@@ -468211,6 +468228,7 @@ var autorouterProp = z.union([
468211
468228
  var baseGroupProps = commonLayoutProps.extend({
468212
468229
  name: z.string().optional(),
468213
468230
  children: z.any().optional(),
468231
+ schTitle: z.string().optional(),
468214
468232
  key: z.any().optional(),
468215
468233
  ...layoutConfig.shape,
468216
468234
  pcbWidth: length2.optional(),
@@ -468292,6 +468310,10 @@ var chipProps = commonComponentProps.extend({
468292
468310
  connections: connectionsProp.optional()
468293
468311
  });
468294
468312
  expectTypesMatch3(true);
468313
+ var connectionTarget2 = z.string().or(z.array(z.string()).readonly()).or(z.array(z.string()));
468314
+ var createConnectionsProp = (labels) => {
468315
+ return z.record(z.enum(labels), connectionTarget2);
468316
+ };
468295
468317
  var jumperProps = commonComponentProps.extend({
468296
468318
  manufacturerPartNumber: z.string().optional(),
468297
468319
  pinLabels: z.record(z.number().or(z.string()), z.string().or(z.array(z.string()))).optional(),
@@ -468302,7 +468324,8 @@ var jumperProps = commonComponentProps.extend({
468302
468324
  schDirection: z.enum(["left", "right"]).optional(),
468303
468325
  schPortArrangement: schematicPortArrangement.optional(),
468304
468326
  pinCount: z.union([z.literal(2), z.literal(3)]).optional(),
468305
- internallyConnectedPins: z.array(z.array(z.string())).optional()
468327
+ internallyConnectedPins: z.array(z.array(z.string())).optional(),
468328
+ connections: z.custom().pipe(z.record(z.string(), connectionTarget2)).optional()
468306
468329
  });
468307
468330
  expectTypesMatch3(true);
468308
468331
  var solderjumperProps = jumperProps.extend({
@@ -468326,6 +468349,7 @@ var fuseProps = commonComponentProps.extend({
468326
468349
  currentRating: z.union([z.number(), z.string()]),
468327
468350
  voltageRating: z.union([z.number(), z.string()]).optional(),
468328
468351
  schShowRatings: z.boolean().optional(),
468352
+ schOrientation: schematicOrientation.optional(),
468329
468353
  connections: z.record(z.string(), z.union([
468330
468354
  z.string(),
468331
468355
  z.array(z.string()).readonly(),
@@ -468340,6 +468364,7 @@ var distanceHiddenUndefined = z.custom().transform((a) => {
468340
468364
  var platedHoleProps = z.discriminatedUnion("shape", [
468341
468365
  pcbLayoutProps.omit({ pcbRotation: true, layer: true }).extend({
468342
468366
  name: z.string().optional(),
468367
+ connectsTo: z.string().or(z.array(z.string())).optional(),
468343
468368
  shape: z.literal("circle"),
468344
468369
  holeDiameter: distance3,
468345
468370
  outerDiameter: distance3,
@@ -468347,6 +468372,7 @@ var platedHoleProps = z.discriminatedUnion("shape", [
468347
468372
  }),
468348
468373
  pcbLayoutProps.omit({ pcbRotation: true, layer: true }).extend({
468349
468374
  name: z.string().optional(),
468375
+ connectsTo: z.string().or(z.array(z.string())).optional(),
468350
468376
  shape: z.literal("oval"),
468351
468377
  outerWidth: distance3,
468352
468378
  outerHeight: distance3,
@@ -468358,6 +468384,7 @@ var platedHoleProps = z.discriminatedUnion("shape", [
468358
468384
  }),
468359
468385
  pcbLayoutProps.omit({ pcbRotation: true, layer: true }).extend({
468360
468386
  name: z.string().optional(),
468387
+ connectsTo: z.string().or(z.array(z.string())).optional(),
468361
468388
  shape: z.literal("pill"),
468362
468389
  outerWidth: distance3,
468363
468390
  outerHeight: distance3,
@@ -468369,6 +468396,7 @@ var platedHoleProps = z.discriminatedUnion("shape", [
468369
468396
  }),
468370
468397
  pcbLayoutProps.omit({ pcbRotation: true, layer: true }).extend({
468371
468398
  name: z.string().optional(),
468399
+ connectsTo: z.string().or(z.array(z.string())).optional(),
468372
468400
  shape: z.literal("circular_hole_with_rect_pad"),
468373
468401
  holeDiameter: distance3,
468374
468402
  rectPadWidth: distance3,
@@ -468379,6 +468407,7 @@ var platedHoleProps = z.discriminatedUnion("shape", [
468379
468407
  }),
468380
468408
  pcbLayoutProps.omit({ pcbRotation: true, layer: true }).extend({
468381
468409
  name: z.string().optional(),
468410
+ connectsTo: z.string().or(z.array(z.string())).optional(),
468382
468411
  shape: z.literal("pill_hole_with_rect_pad"),
468383
468412
  holeShape: z.literal("pill"),
468384
468413
  padShape: z.literal("rect"),
@@ -468398,10 +468427,6 @@ var platedHoleProps = z.discriminatedUnion("shape", [
468398
468427
  return a;
468399
468428
  });
468400
468429
  expectTypesMatch3(true);
468401
- var connectionTarget2 = z.string().or(z.array(z.string()).readonly()).or(z.array(z.string()));
468402
- var createConnectionsProp = (labels) => {
468403
- return z.record(z.enum(labels), connectionTarget2);
468404
- };
468405
468430
  var resistorPinLabels = ["pin1", "pin2", "pos", "neg"];
468406
468431
  var resistorProps = commonComponentProps.extend({
468407
468432
  resistance: resistance2,
@@ -468409,6 +468434,7 @@ var resistorProps = commonComponentProps.extend({
468409
468434
  pullupTo: z.string().optional(),
468410
468435
  pulldownFor: z.string().optional(),
468411
468436
  pulldownTo: z.string().optional(),
468437
+ schOrientation: schematicOrientation.optional(),
468412
468438
  connections: createConnectionsProp(resistorPinLabels).optional()
468413
468439
  });
468414
468440
  var resistorPins = lrPins;
@@ -468421,7 +468447,8 @@ expectTypesMatch3(true);
468421
468447
  var crystalProps = commonComponentProps.extend({
468422
468448
  frequency: frequency2,
468423
468449
  loadCapacitance: capacitance2,
468424
- pinVariant: z.enum(["two_pin", "four_pin"]).optional()
468450
+ pinVariant: z.enum(["two_pin", "four_pin"]).optional(),
468451
+ schOrientation: schematicOrientation.optional()
468425
468452
  });
468426
468453
  expectTypesMatch3(true);
468427
468454
  var resonatorProps = commonComponentProps.extend({
@@ -468461,6 +468488,7 @@ var capacitorProps = commonComponentProps.extend({
468461
468488
  bypassFor: z.string().optional(),
468462
468489
  bypassTo: z.string().optional(),
468463
468490
  maxDecouplingTraceLength: z.number().optional(),
468491
+ schOrientation: schematicOrientation.optional(),
468464
468492
  connections: createConnectionsProp(capacitorPinLabels).optional()
468465
468493
  });
468466
468494
  var capacitorPins = lrPolarPins;
@@ -468546,6 +468574,7 @@ var cutoutProps = z.discriminatedUnion("shape", [
468546
468574
  polygonCutoutProps
468547
468575
  ]);
468548
468576
  var rectSmtPadProps = pcbLayoutProps.omit({ pcbRotation: true }).extend({
468577
+ name: z.string().optional(),
468549
468578
  shape: z.literal("rect"),
468550
468579
  width: distance3,
468551
468580
  height: distance3,
@@ -468553,6 +468582,7 @@ var rectSmtPadProps = pcbLayoutProps.omit({ pcbRotation: true }).extend({
468553
468582
  });
468554
468583
  expectTypesMatch3(true);
468555
468584
  var rotatedRectSmtPadProps = pcbLayoutProps.omit({ pcbRotation: true }).extend({
468585
+ name: z.string().optional(),
468556
468586
  shape: z.literal("rotated_rect"),
468557
468587
  width: distance3,
468558
468588
  height: distance3,
@@ -468561,12 +468591,14 @@ var rotatedRectSmtPadProps = pcbLayoutProps.omit({ pcbRotation: true }).extend({
468561
468591
  });
468562
468592
  expectTypesMatch3(true);
468563
468593
  var circleSmtPadProps = pcbLayoutProps.omit({ pcbRotation: true }).extend({
468594
+ name: z.string().optional(),
468564
468595
  shape: z.literal("circle"),
468565
468596
  radius: distance3,
468566
468597
  portHints: portHints.optional()
468567
468598
  });
468568
468599
  expectTypesMatch3(true);
468569
468600
  var pillSmtPadProps = pcbLayoutProps.omit({ pcbRotation: true }).extend({
468601
+ name: z.string().optional(),
468570
468602
  shape: z.literal("pill"),
468571
468603
  width: distance3,
468572
468604
  height: distance3,
@@ -468575,6 +468607,7 @@ var pillSmtPadProps = pcbLayoutProps.omit({ pcbRotation: true }).extend({
468575
468607
  });
468576
468608
  expectTypesMatch3(true);
468577
468609
  var polygonSmtPadProps = pcbLayoutProps.omit({ pcbRotation: true }).extend({
468610
+ name: z.string().optional(),
468578
468611
  shape: z.literal("polygon"),
468579
468612
  points: z.array(point4),
468580
468613
  portHints: portHints.optional()
@@ -468651,7 +468684,8 @@ var capacity = z.number().or(z.string().endsWith("mAh")).transform((v) => {
468651
468684
  return v;
468652
468685
  }).describe("Battery capacity in mAh");
468653
468686
  var batteryProps = commonComponentProps.extend({
468654
- capacity: capacity.optional()
468687
+ capacity: capacity.optional(),
468688
+ schOrientation: schematicOrientation.optional()
468655
468689
  });
468656
468690
  expectTypesMatch3(true);
468657
468691
  var pinHeaderProps = commonComponentProps.extend({
@@ -468706,7 +468740,8 @@ var mosfetProps = commonComponentProps.extend({
468706
468740
  expectTypesMatch3(true);
468707
468741
  var inductorProps = commonComponentProps.extend({
468708
468742
  inductance: inductance2,
468709
- maxCurrentRating: z.union([z.string(), z.number()]).optional()
468743
+ maxCurrentRating: z.union([z.string(), z.number()]).optional(),
468744
+ schOrientation: schematicOrientation.optional()
468710
468745
  });
468711
468746
  expectTypesMatch3(true);
468712
468747
  var diodeConnectionKeys = z.enum([
@@ -468727,7 +468762,8 @@ var diodeProps = commonComponentProps.extend({
468727
468762
  schottky: z.boolean().optional(),
468728
468763
  zener: z.boolean().optional(),
468729
468764
  photo: z.boolean().optional(),
468730
- tvs: z.boolean().optional()
468765
+ tvs: z.boolean().optional(),
468766
+ schOrientation: schematicOrientation.optional()
468731
468767
  }).superRefine((data, ctx) => {
468732
468768
  const enabledFlags = [
468733
468769
  data.standard,
@@ -468791,7 +468827,8 @@ expectTypesMatch3(true);
468791
468827
  var ledProps = commonComponentProps.extend({
468792
468828
  color: z.string().optional(),
468793
468829
  wavelength: z.string().optional(),
468794
- schDisplayValue: z.string().optional()
468830
+ schDisplayValue: z.string().optional(),
468831
+ schOrientation: schematicOrientation.optional()
468795
468832
  });
468796
468833
  var ledPins = lrPolarPins;
468797
468834
  var switchProps = commonComponentProps.extend({
@@ -468847,11 +468884,14 @@ var pcbTraceProps = z.object({
468847
468884
  route: z.array(route_hint_point2)
468848
468885
  });
468849
468886
  var viaProps = commonLayoutProps.extend({
468887
+ name: z.string().optional(),
468850
468888
  fromLayer: layer_ref2,
468851
468889
  toLayer: layer_ref2,
468852
468890
  holeDiameter: distance3,
468853
- outerDiameter: distance3
468891
+ outerDiameter: distance3,
468892
+ connectsTo: z.string().or(z.array(z.string())).optional()
468854
468893
  });
468894
+ expectTypesMatch3(true);
468855
468895
  var testpointProps = commonComponentProps.extend({
468856
468896
  footprintVariant: z.enum(["pad", "through_hole"]).optional(),
468857
468897
  padShape: z.enum(["rect", "circle"]).optional().default("circle"),
@@ -502038,7 +502078,7 @@ var setupDefaultEntrypointIfNeeded = (opts) => {
502038
502078
  }
502039
502079
  };
502040
502080
  var CircuitRunner = class {
502041
- constructor() {
502081
+ constructor(configuration = {}) {
502042
502082
  this._executionContext = null;
502043
502083
  this._circuitRunnerConfiguration = {
502044
502084
  snippetsApiBaseUrl: "https://registry-api.tscircuit.com",
@@ -502046,6 +502086,7 @@ var CircuitRunner = class {
502046
502086
  verbose: false
502047
502087
  };
502048
502088
  this._eventListeners = {};
502089
+ Object.assign(this._circuitRunnerConfiguration, configuration);
502049
502090
  }
502050
502091
  async executeWithFsMap(ogOpts) {
502051
502092
  const opts = { ...ogOpts };
@@ -502058,7 +502099,8 @@ var CircuitRunner = class {
502058
502099
  }
502059
502100
  setupDefaultEntrypointIfNeeded(opts);
502060
502101
  this._executionContext = createExecutionContext(this._circuitRunnerConfiguration, {
502061
- name: opts.name
502102
+ name: opts.name,
502103
+ platform: this._circuitRunnerConfiguration.platform
502062
502104
  });
502063
502105
  this._bindEventListeners(this._executionContext.circuit);
502064
502106
  this._executionContext.fsMap = normalizeFsMap(opts.fsMap);
@@ -502073,7 +502115,10 @@ var CircuitRunner = class {
502073
502115
  if (this._circuitRunnerConfiguration.verbose) {
502074
502116
  console.log("[CircuitRunner] execute called with code length:", code.length);
502075
502117
  }
502076
- this._executionContext = createExecutionContext(this._circuitRunnerConfiguration, opts);
502118
+ this._executionContext = createExecutionContext(this._circuitRunnerConfiguration, {
502119
+ ...opts,
502120
+ platform: this._circuitRunnerConfiguration.platform
502121
+ });
502077
502122
  this._bindEventListeners(this._executionContext.circuit);
502078
502123
  this._executionContext.fsMap["entrypoint.tsx"] = code;
502079
502124
  globalThis.__tscircuit_circuit = this._executionContext.circuit;
@@ -502116,6 +502161,9 @@ var CircuitRunner = class {
502116
502161
  async setSnippetsApiBaseUrl(baseUrl) {
502117
502162
  this._circuitRunnerConfiguration.snippetsApiBaseUrl = baseUrl;
502118
502163
  }
502164
+ async setPlatformConfig(platform) {
502165
+ this._circuitRunnerConfiguration.platform = platform;
502166
+ }
502119
502167
  _bindEventListeners(circuit2) {
502120
502168
  for (const event in this._eventListeners) {
502121
502169
  for (const listener of this._eventListeners[event]) {
@@ -502145,10 +502193,13 @@ async function generateCircuitJson({
502145
502193
  filePath,
502146
502194
  outputDir,
502147
502195
  outputFileName,
502148
- saveToFile = false
502196
+ saveToFile = false,
502197
+ platformConfig: platformConfig2
502149
502198
  }) {
502150
502199
  debug14(`Generating circuit JSON for ${filePath}`);
502151
- const runner = new CircuitRunner;
502200
+ const runner = new CircuitRunner({
502201
+ platform: platformConfig2
502202
+ });
502152
502203
  const projectDir = path21.dirname(filePath);
502153
502204
  const resolvedOutputDir = outputDir || projectDir;
502154
502205
  const relativeComponentPath = relative6(projectDir, filePath);
@@ -502498,7 +502549,10 @@ function analyzeCircuitJson(circuitJson) {
502498
502549
  // cli/build/build-file.ts
502499
502550
  var buildFile = async (input, output, projectDir, options) => {
502500
502551
  try {
502501
- const result = await generateCircuitJson({ filePath: input });
502552
+ const result = await generateCircuitJson({
502553
+ filePath: input,
502554
+ platformConfig: options?.platformConfig
502555
+ });
502502
502556
  fs23.mkdirSync(path23.dirname(output), { recursive: true });
502503
502557
  fs23.writeFileSync(output, JSON.stringify(result.circuitJson, null, 2));
502504
502558
  console.log(`Circuit JSON written to ${path23.relative(projectDir, output)}`);
@@ -502573,14 +502627,20 @@ async function getBuildEntrypoints({
502573
502627
 
502574
502628
  // cli/build/register.ts
502575
502629
  var registerBuild = (program3) => {
502576
- program3.command("build").description("Run tscircuit eval and output circuit json").argument("[file]", "Path to the entry file").option("--ignore-errors", "Do not exit with code 1 on errors").option("--ignore-warnings", "Do not log warnings").action(async (file, options) => {
502630
+ program3.command("build").description("Run tscircuit eval and output circuit json").argument("[file]", "Path to the entry file").option("--ignore-errors", "Do not exit with code 1 on errors").option("--ignore-warnings", "Do not log warnings").option("--disable-pcb", "Disable PCB outputs").action(async (file, options) => {
502577
502631
  const { projectDir, mainEntrypoint, circuitFiles } = await getBuildEntrypoints({ fileOrDir: file });
502632
+ const platformConfig2 = {
502633
+ pcbDisabled: options?.disablePcb
502634
+ };
502578
502635
  const distDir = path25.join(projectDir, "dist");
502579
502636
  fs25.mkdirSync(distDir, { recursive: true });
502580
502637
  let hasErrors = false;
502581
502638
  if (mainEntrypoint) {
502582
502639
  const outputPath = path25.join(distDir, "circuit.json");
502583
- const ok = await buildFile(mainEntrypoint, outputPath, projectDir, options);
502640
+ const ok = await buildFile(mainEntrypoint, outputPath, projectDir, {
502641
+ ...options,
502642
+ platformConfig: platformConfig2
502643
+ });
502584
502644
  if (!ok)
502585
502645
  hasErrors = true;
502586
502646
  }
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.145",
3
+ "version": "0.1.147",
4
4
  "main": "dist/main.js",
5
5
  "devDependencies": {
6
6
  "@babel/standalone": "^7.26.9",
7
7
  "@biomejs/biome": "^1.9.4",
8
8
  "@tscircuit/circuit-json-util": "^0.0.47",
9
+ "@tscircuit/eval": "^0.0.238",
9
10
  "@tscircuit/fake-snippets": "^0.0.87",
10
11
  "@tscircuit/file-server": "^0.0.24",
11
12
  "@tscircuit/math-utils": "^0.0.18",
12
- "@tscircuit/props": "^0.0.237",
13
+ "@tscircuit/props": "^0.0.242",
13
14
  "@tscircuit/runframe": "^0.0.614",
14
15
  "@tscircuit/schematic-match-adapt": "^0.0.22",
15
16
  "@tscircuit/simple-3d-svg": "^0.0.10",
16
- "tscircuit": "^0.0.505",
17
17
  "@types/bun": "^1.2.2",
18
18
  "@types/configstore": "^6.0.2",
19
19
  "@types/debug": "^4.1.12",
@@ -46,11 +46,13 @@
46
46
  "redaxios": "^0.5.1",
47
47
  "semver": "^7.6.3",
48
48
  "tempy": "^3.1.0",
49
+ "tscircuit": "^0.0.505",
49
50
  "typed-ky": "^0.0.4"
50
51
  },
51
52
  "peerDependencies": {
52
53
  "typescript": "^5.0.0",
53
- "tscircuit": "*"
54
+ "tscircuit": "*",
55
+ "@tscircuit/props": "*"
54
56
  },
55
57
  "bin": {
56
58
  "tsci": "./dist/main.js"