@tscircuit/cli 0.1.1103 → 0.1.1104

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/README.md CHANGED
@@ -74,6 +74,10 @@ The `build` command also accepts the following options:
74
74
 
75
75
  - `--ignore-errors` - continue build even if circuit JSON contains errors
76
76
  - `--ignore-warnings` - suppress warning output
77
+ - `--ignore-netlist-drc` - suppress netlist DRC diagnostics
78
+ - `--ignore-pin-specification-drc` - suppress pin-specification DRC diagnostics
79
+ - `--ignore-placement-drc` - suppress placement DRC diagnostics
80
+ - `--ignore-routing-drc` - suppress routing DRC diagnostics
77
81
 
78
82
  ## Development
79
83
 
@@ -7023,6 +7023,7 @@ var require_limitLength = __commonJS((exports) => {
7023
7023
  var require_pattern = __commonJS((exports) => {
7024
7024
  Object.defineProperty(exports, "__esModule", { value: true });
7025
7025
  var code_1 = require_code2();
7026
+ var util_1 = require_util();
7026
7027
  var codegen_1 = require_codegen();
7027
7028
  var error = {
7028
7029
  message: ({ schemaCode }) => (0, codegen_1.str)`must match pattern "${schemaCode}"`,
@@ -7035,10 +7036,18 @@ var require_pattern = __commonJS((exports) => {
7035
7036
  $data: true,
7036
7037
  error,
7037
7038
  code(cxt) {
7038
- const { data, $data, schema, schemaCode, it } = cxt;
7039
+ const { gen, data, $data, schema, schemaCode, it } = cxt;
7039
7040
  const u = it.opts.unicodeRegExp ? "u" : "";
7040
- const regExp = $data ? (0, codegen_1._)`(new RegExp(${schemaCode}, ${u}))` : (0, code_1.usePattern)(cxt, schema);
7041
- cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`);
7041
+ if ($data) {
7042
+ const { regExp } = it.opts.code;
7043
+ const regExpCode = regExp.code === "new RegExp" ? (0, codegen_1._)`new RegExp` : (0, util_1.useFunc)(gen, regExp);
7044
+ const valid = gen.let("valid");
7045
+ gen.try(() => gen.assign(valid, (0, codegen_1._)`${regExpCode}(${schemaCode}, ${u}).test(${data})`), () => gen.assign(valid, false));
7046
+ cxt.fail$data((0, codegen_1._)`!${valid}`);
7047
+ } else {
7048
+ const regExp = (0, code_1.usePattern)(cxt, schema);
7049
+ cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`);
7050
+ }
7042
7051
  }
7043
7052
  };
7044
7053
  exports.default = def;
@@ -11777,6 +11786,144 @@ var registerStaticAssetLoaders = () => {
11777
11786
  }
11778
11787
  };
11779
11788
 
11789
+ // cli/build/drc-diagnostic-filter.ts
11790
+ import {
11791
+ categorizeErrorOrWarning
11792
+ } from "@tscircuit/circuit-json-util";
11793
+ var EMPTY_IGNORE_COUNTS = () => ({
11794
+ netlist: 0,
11795
+ pin_specification: 0,
11796
+ placement: 0,
11797
+ routing: 0,
11798
+ unknown: 0
11799
+ });
11800
+ var normalizeCategory = (category) => category === "netlist" || category === "pin_specification" || category === "placement" || category === "routing" ? category : "unknown";
11801
+ var categorizeIssue = (issue) => normalizeCategory(categorizeErrorOrWarning(issue));
11802
+ var shouldIgnoreCategory = (category, ignoreOptions) => {
11803
+ switch (category) {
11804
+ case "netlist":
11805
+ return Boolean(ignoreOptions?.ignoreNetlistDrc);
11806
+ case "pin_specification":
11807
+ return Boolean(ignoreOptions?.ignorePinSpecificationDrc);
11808
+ case "placement":
11809
+ return Boolean(ignoreOptions?.ignorePlacementDrc);
11810
+ case "routing":
11811
+ return Boolean(ignoreOptions?.ignoreRoutingDrc);
11812
+ default:
11813
+ return false;
11814
+ }
11815
+ };
11816
+ var filterIssues = ({
11817
+ issues,
11818
+ ignoreOptions,
11819
+ ignoredByCategory
11820
+ }) => {
11821
+ const kept = [];
11822
+ for (const issue of issues) {
11823
+ const category = categorizeIssue(issue);
11824
+ if (shouldIgnoreCategory(category, ignoreOptions)) {
11825
+ ignoredByCategory[category] += 1;
11826
+ continue;
11827
+ }
11828
+ kept.push(issue);
11829
+ }
11830
+ return kept;
11831
+ };
11832
+ var filterDiagnosticsByDrcCategory = ({
11833
+ errors,
11834
+ warnings,
11835
+ ignoreOptions
11836
+ }) => {
11837
+ const ignoredByCategory = EMPTY_IGNORE_COUNTS();
11838
+ const filteredErrors = filterIssues({
11839
+ issues: errors,
11840
+ ignoreOptions,
11841
+ ignoredByCategory
11842
+ });
11843
+ const filteredWarnings = filterIssues({
11844
+ issues: warnings,
11845
+ ignoreOptions,
11846
+ ignoredByCategory
11847
+ });
11848
+ const ignoredCount = Object.values(ignoredByCategory).reduce((sum, count) => sum + count, 0);
11849
+ return {
11850
+ errors: filteredErrors,
11851
+ warnings: filteredWarnings,
11852
+ ignoredCount,
11853
+ ignoredByCategory
11854
+ };
11855
+ };
11856
+ var formatIgnoredDrcCounts = (counts) => [
11857
+ ["netlist", counts.netlist],
11858
+ ["pin_specification", counts.pin_specification],
11859
+ ["placement", counts.placement],
11860
+ ["routing", counts.routing],
11861
+ ["unknown", counts.unknown]
11862
+ ].filter(([, count]) => count > 0).map(([category, count]) => `${category}: ${count}`).join(", ");
11863
+
11864
+ // cli/build/image-format-selection.ts
11865
+ var DEFAULT_IMAGE_FORMAT_SELECTION = {
11866
+ threeDPngs: true,
11867
+ pcbSvgs: true,
11868
+ schematicSvgs: true
11869
+ };
11870
+ var EMPTY_IMAGE_FORMAT_SELECTION = {
11871
+ threeDPngs: false,
11872
+ pcbSvgs: false,
11873
+ schematicSvgs: false
11874
+ };
11875
+ var hasAnyImageFormatSelected = (selection) => selection.threeDPngs || selection.pcbSvgs || selection.schematicSvgs;
11876
+ var hasNewOutputFlags = (options) => Boolean(options?.pngs || options?.svgs || options?.pcbSvgs || options?.schematicSvgs);
11877
+ var hasEstablishedOutputFlags = (options) => Boolean(options?.["3d"] || options?.pcbOnly || options?.schematicOnly);
11878
+ var resolveImageFormatSelection = (options) => {
11879
+ const hasNewFlags = hasNewOutputFlags(options);
11880
+ const hasEstablishedFlags = hasEstablishedOutputFlags(options);
11881
+ const hasExplicitSelection = hasNewFlags || hasEstablishedFlags;
11882
+ if (!hasExplicitSelection) {
11883
+ return {
11884
+ selection: { ...DEFAULT_IMAGE_FORMAT_SELECTION },
11885
+ hasExplicitSelection: false
11886
+ };
11887
+ }
11888
+ if (!hasNewFlags && hasEstablishedFlags) {
11889
+ const selection2 = {
11890
+ threeDPngs: Boolean(options?.["3d"]),
11891
+ pcbSvgs: true,
11892
+ schematicSvgs: true
11893
+ };
11894
+ if (options?.pcbOnly && !options?.schematicOnly) {
11895
+ selection2.schematicSvgs = false;
11896
+ }
11897
+ if (options?.schematicOnly && !options?.pcbOnly) {
11898
+ selection2.pcbSvgs = false;
11899
+ }
11900
+ return { selection: selection2, hasExplicitSelection: true };
11901
+ }
11902
+ const selection = {
11903
+ ...EMPTY_IMAGE_FORMAT_SELECTION
11904
+ };
11905
+ if (options?.svgs) {
11906
+ selection.pcbSvgs = true;
11907
+ selection.schematicSvgs = true;
11908
+ }
11909
+ if (options?.pcbSvgs) {
11910
+ selection.pcbSvgs = true;
11911
+ }
11912
+ if (options?.schematicSvgs) {
11913
+ selection.schematicSvgs = true;
11914
+ }
11915
+ if (options?.pngs || options?.["3d"]) {
11916
+ selection.threeDPngs = true;
11917
+ }
11918
+ if (options?.pcbOnly && !options?.schematicOnly) {
11919
+ selection.schematicSvgs = false;
11920
+ }
11921
+ if (options?.schematicOnly && !options?.pcbOnly) {
11922
+ selection.pcbSvgs = false;
11923
+ }
11924
+ return { selection, hasExplicitSelection: true };
11925
+ };
11926
+
11780
11927
  // cli/build/worker-output-generators.ts
11781
11928
  import fs9 from "node:fs";
11782
11929
  import path12 from "node:path";
@@ -13369,69 +13516,6 @@ var writeImageAssetsFromCircuitJson = async (circuitJson, options) => {
13369
13516
  }
13370
13517
  };
13371
13518
 
13372
- // cli/build/image-format-selection.ts
13373
- var DEFAULT_IMAGE_FORMAT_SELECTION = {
13374
- threeDPngs: true,
13375
- pcbSvgs: true,
13376
- schematicSvgs: true
13377
- };
13378
- var EMPTY_IMAGE_FORMAT_SELECTION = {
13379
- threeDPngs: false,
13380
- pcbSvgs: false,
13381
- schematicSvgs: false
13382
- };
13383
- var hasAnyImageFormatSelected = (selection) => selection.threeDPngs || selection.pcbSvgs || selection.schematicSvgs;
13384
- var hasNewOutputFlags = (options) => Boolean(options?.pngs || options?.svgs || options?.pcbSvgs || options?.schematicSvgs);
13385
- var hasEstablishedOutputFlags = (options) => Boolean(options?.["3d"] || options?.pcbOnly || options?.schematicOnly);
13386
- var resolveImageFormatSelection = (options) => {
13387
- const hasNewFlags = hasNewOutputFlags(options);
13388
- const hasEstablishedFlags = hasEstablishedOutputFlags(options);
13389
- const hasExplicitSelection = hasNewFlags || hasEstablishedFlags;
13390
- if (!hasExplicitSelection) {
13391
- return {
13392
- selection: { ...DEFAULT_IMAGE_FORMAT_SELECTION },
13393
- hasExplicitSelection: false
13394
- };
13395
- }
13396
- if (!hasNewFlags && hasEstablishedFlags) {
13397
- const selection2 = {
13398
- threeDPngs: Boolean(options?.["3d"]),
13399
- pcbSvgs: true,
13400
- schematicSvgs: true
13401
- };
13402
- if (options?.pcbOnly && !options?.schematicOnly) {
13403
- selection2.schematicSvgs = false;
13404
- }
13405
- if (options?.schematicOnly && !options?.pcbOnly) {
13406
- selection2.pcbSvgs = false;
13407
- }
13408
- return { selection: selection2, hasExplicitSelection: true };
13409
- }
13410
- const selection = {
13411
- ...EMPTY_IMAGE_FORMAT_SELECTION
13412
- };
13413
- if (options?.svgs) {
13414
- selection.pcbSvgs = true;
13415
- selection.schematicSvgs = true;
13416
- }
13417
- if (options?.pcbSvgs) {
13418
- selection.pcbSvgs = true;
13419
- }
13420
- if (options?.schematicSvgs) {
13421
- selection.schematicSvgs = true;
13422
- }
13423
- if (options?.pngs || options?.["3d"]) {
13424
- selection.threeDPngs = true;
13425
- }
13426
- if (options?.pcbOnly && !options?.schematicOnly) {
13427
- selection.schematicSvgs = false;
13428
- }
13429
- if (options?.schematicOnly && !options?.pcbOnly) {
13430
- selection.pcbSvgs = false;
13431
- }
13432
- return { selection, hasExplicitSelection: true };
13433
- };
13434
-
13435
13519
  // cli/build/worker-build-handlers.ts
13436
13520
  var loadCircuitJsonFromInputFile = (filePath) => {
13437
13521
  const parsed = JSON.parse(fs10.readFileSync(filePath, "utf-8"));
@@ -13457,21 +13541,26 @@ var handleBuildFile = async (filePath, outputPath, glbOutputPath, previewOutputD
13457
13541
  fs10.writeFileSync(outputPath, JSON.stringify(circuitJson, null, 2));
13458
13542
  workerLog(`Circuit JSON written to ${path13.relative(projectDir, outputPath)}`);
13459
13543
  const diagnostics = analyzeCircuitJson(circuitJson);
13544
+ const filteredDiagnostics = filterDiagnosticsByDrcCategory({
13545
+ errors: diagnostics.errors,
13546
+ warnings: diagnostics.warnings,
13547
+ ignoreOptions: options
13548
+ });
13460
13549
  if (!options?.ignoreWarnings) {
13461
- for (const warn of diagnostics.warnings) {
13550
+ for (const warn of filteredDiagnostics.warnings) {
13462
13551
  const msg = warn.message || JSON.stringify(warn);
13463
13552
  warnings.push(msg);
13464
13553
  workerLog(`Warning: ${msg}`);
13465
13554
  }
13466
13555
  }
13467
13556
  if (!options?.ignoreErrors) {
13468
- for (const err of diagnostics.errors) {
13557
+ for (const err of filteredDiagnostics.errors) {
13469
13558
  const msg = err.message || JSON.stringify(err);
13470
13559
  errors.push(msg);
13471
13560
  workerLog(`Error: ${msg}`);
13472
13561
  }
13473
13562
  }
13474
- const hasErrors = diagnostics.errors.length > 0 && !options?.ignoreErrors;
13563
+ const hasErrors = filteredDiagnostics.errors.length > 0 && !options?.ignoreErrors;
13475
13564
  let glbOk;
13476
13565
  let glbError;
13477
13566
  let previewOk;
@@ -13515,6 +13604,8 @@ var handleBuildFile = async (filePath, outputPath, glbOutputPath, previewOutputD
13515
13604
  preview_error: previewError,
13516
13605
  ok: true,
13517
13606
  hasErrors,
13607
+ ignoredDrcCount: filteredDiagnostics.ignoredCount,
13608
+ ignoredDrcByCategory: filteredDiagnostics.ignoredByCategory,
13518
13609
  errors,
13519
13610
  warnings,
13520
13611
  durationMs: options?.profile ? performance.now() - startedAt : undefined
package/dist/cli/main.js CHANGED
@@ -19618,6 +19618,7 @@ var require_limitLength = __commonJS((exports2) => {
19618
19618
  var require_pattern2 = __commonJS((exports2) => {
19619
19619
  Object.defineProperty(exports2, "__esModule", { value: true });
19620
19620
  var code_1 = require_code2();
19621
+ var util_1 = require_util3();
19621
19622
  var codegen_1 = require_codegen();
19622
19623
  var error = {
19623
19624
  message: ({ schemaCode }) => (0, codegen_1.str)`must match pattern "${schemaCode}"`,
@@ -19630,10 +19631,18 @@ var require_pattern2 = __commonJS((exports2) => {
19630
19631
  $data: true,
19631
19632
  error,
19632
19633
  code(cxt) {
19633
- const { data, $data, schema, schemaCode, it } = cxt;
19634
+ const { gen, data, $data, schema, schemaCode, it } = cxt;
19634
19635
  const u = it.opts.unicodeRegExp ? "u" : "";
19635
- const regExp = $data ? (0, codegen_1._)`(new RegExp(${schemaCode}, ${u}))` : (0, code_1.usePattern)(cxt, schema);
19636
- cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`);
19636
+ if ($data) {
19637
+ const { regExp } = it.opts.code;
19638
+ const regExpCode = regExp.code === "new RegExp" ? (0, codegen_1._)`new RegExp` : (0, util_1.useFunc)(gen, regExp);
19639
+ const valid = gen.let("valid");
19640
+ gen.try(() => gen.assign(valid, (0, codegen_1._)`${regExpCode}(${schemaCode}, ${u}).test(${data})`), () => gen.assign(valid, false));
19641
+ cxt.fail$data((0, codegen_1._)`!${valid}`);
19642
+ } else {
19643
+ const regExp = (0, code_1.usePattern)(cxt, schema);
19644
+ cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`);
19645
+ }
19637
19646
  }
19638
19647
  };
19639
19648
  exports2.default = def;
@@ -97701,7 +97710,7 @@ var package_default = {
97701
97710
  chokidar: "4.0.1",
97702
97711
  "circuit-json": "^0.0.402",
97703
97712
  "circuit-json-to-kicad": "^0.0.84",
97704
- "circuit-json-to-readable-netlist": "^0.0.14",
97713
+ "circuit-json-to-readable-netlist": "^0.0.15",
97705
97714
  "circuit-json-to-spice": "^0.0.10",
97706
97715
  "circuit-json-to-tscircuit": "^0.0.9",
97707
97716
  commander: "^14.0.0",
@@ -106644,6 +106653,81 @@ async function generateCircuitJson({
106644
106653
  };
106645
106654
  }
106646
106655
 
106656
+ // cli/build/drc-diagnostic-filter.ts
106657
+ import {
106658
+ categorizeErrorOrWarning
106659
+ } from "@tscircuit/circuit-json-util";
106660
+ var EMPTY_IGNORE_COUNTS = () => ({
106661
+ netlist: 0,
106662
+ pin_specification: 0,
106663
+ placement: 0,
106664
+ routing: 0,
106665
+ unknown: 0
106666
+ });
106667
+ var normalizeCategory = (category) => category === "netlist" || category === "pin_specification" || category === "placement" || category === "routing" ? category : "unknown";
106668
+ var categorizeIssue = (issue) => normalizeCategory(categorizeErrorOrWarning(issue));
106669
+ var shouldIgnoreCategory = (category, ignoreOptions) => {
106670
+ switch (category) {
106671
+ case "netlist":
106672
+ return Boolean(ignoreOptions?.ignoreNetlistDrc);
106673
+ case "pin_specification":
106674
+ return Boolean(ignoreOptions?.ignorePinSpecificationDrc);
106675
+ case "placement":
106676
+ return Boolean(ignoreOptions?.ignorePlacementDrc);
106677
+ case "routing":
106678
+ return Boolean(ignoreOptions?.ignoreRoutingDrc);
106679
+ default:
106680
+ return false;
106681
+ }
106682
+ };
106683
+ var filterIssues = ({
106684
+ issues,
106685
+ ignoreOptions,
106686
+ ignoredByCategory
106687
+ }) => {
106688
+ const kept = [];
106689
+ for (const issue of issues) {
106690
+ const category = categorizeIssue(issue);
106691
+ if (shouldIgnoreCategory(category, ignoreOptions)) {
106692
+ ignoredByCategory[category] += 1;
106693
+ continue;
106694
+ }
106695
+ kept.push(issue);
106696
+ }
106697
+ return kept;
106698
+ };
106699
+ var filterDiagnosticsByDrcCategory = ({
106700
+ errors,
106701
+ warnings,
106702
+ ignoreOptions
106703
+ }) => {
106704
+ const ignoredByCategory = EMPTY_IGNORE_COUNTS();
106705
+ const filteredErrors = filterIssues({
106706
+ issues: errors,
106707
+ ignoreOptions,
106708
+ ignoredByCategory
106709
+ });
106710
+ const filteredWarnings = filterIssues({
106711
+ issues: warnings,
106712
+ ignoreOptions,
106713
+ ignoredByCategory
106714
+ });
106715
+ const ignoredCount = Object.values(ignoredByCategory).reduce((sum, count) => sum + count, 0);
106716
+ return {
106717
+ errors: filteredErrors,
106718
+ warnings: filteredWarnings,
106719
+ ignoredCount,
106720
+ ignoredByCategory
106721
+ };
106722
+ };
106723
+ var formatIgnoredDrcCounts = (counts) => [
106724
+ ["netlist", counts.netlist],
106725
+ ["pin_specification", counts.pin_specification],
106726
+ ["placement", counts.placement],
106727
+ ["routing", counts.routing],
106728
+ ["unknown", counts.unknown]
106729
+ ].filter(([, count]) => count > 0).map(([category, count]) => `${category}: ${count}`).join(", ");
106730
+
106647
106731
  // cli/build/build-file.ts
106648
106732
  var buildFile = async (input, output, projectDir, options) => {
106649
106733
  try {
@@ -106667,15 +106751,20 @@ var buildFile = async (input, output, projectDir, options) => {
106667
106751
  fs25.mkdirSync(path26.dirname(output), { recursive: true });
106668
106752
  fs25.writeFileSync(output, JSON.stringify(circuitJson, null, 2));
106669
106753
  console.log(`Circuit JSON written to ${path26.relative(projectDir, output)}`);
106670
- const { errors, warnings } = analyzeCircuitJson(circuitJson);
106754
+ const diagnostics = analyzeCircuitJson(circuitJson);
106755
+ const filteredDiagnostics = filterDiagnosticsByDrcCategory({
106756
+ errors: diagnostics.errors,
106757
+ warnings: diagnostics.warnings,
106758
+ ignoreOptions: options
106759
+ });
106671
106760
  if (!options?.ignoreWarnings) {
106672
- for (const warn of warnings) {
106761
+ for (const warn of filteredDiagnostics.warnings) {
106673
106762
  const msg = warn.message || JSON.stringify(warn);
106674
106763
  console.log(kleur_default.yellow(msg));
106675
106764
  }
106676
106765
  }
106677
106766
  if (!options?.ignoreErrors) {
106678
- for (const err of errors) {
106767
+ for (const err of filteredDiagnostics.errors) {
106679
106768
  const msg = err.message || JSON.stringify(err);
106680
106769
  console.error(kleur_default.red(msg));
106681
106770
  if (err.stack) {
@@ -106686,7 +106775,9 @@ var buildFile = async (input, output, projectDir, options) => {
106686
106775
  return {
106687
106776
  ok: true,
106688
106777
  circuitJson,
106689
- hasErrors: errors.length > 0 && !options?.ignoreErrors
106778
+ hasErrors: filteredDiagnostics.errors.length > 0 && !options?.ignoreErrors,
106779
+ ignoredDrcCount: filteredDiagnostics.ignoredCount,
106780
+ ignoredDrcByCategory: filteredDiagnostics.ignoredByCategory
106690
106781
  };
106691
106782
  } catch (err) {
106692
106783
  console.error(err);
@@ -108268,6 +108359,8 @@ async function buildFilesWithWorkerPool(options) {
108268
108359
  previewError: completedMessage.preview_error,
108269
108360
  ok: completedMessage.ok,
108270
108361
  hasErrors: completedMessage.hasErrors,
108362
+ ignoredDrcCount: completedMessage.ignoredDrcCount,
108363
+ ignoredDrcByCategory: completedMessage.ignoredDrcByCategory,
108271
108364
  isFatalError: completedMessage.isFatalError,
108272
108365
  errors: completedMessage.errors,
108273
108366
  warnings: completedMessage.warnings,
@@ -108360,7 +108453,7 @@ var getOutputDirName = (relativePath) => {
108360
108453
  return relativePath.replace(/(\.board|\.circuit)?\.tsx$/, "").replace(/\.circuit\.json$/, "");
108361
108454
  };
108362
108455
  var registerBuild = (program2) => {
108363
- program2.command("build").description("Run tscircuit eval and output circuit json").argument("[file]", "Path to the entry file").option("--ci", "Run install and optional prebuild/build commands (or default CI build)").option("--ignore-errors", "Do not exit with code 1 on errors").option("--ignore-warnings", "Do not log warnings").option("--ignore-config", "Ignore options from tscircuit.config.json").option("--disable-pcb", "Disable PCB outputs").option("--routing-disabled", "Disable routing during circuit generation").option("--disable-parts-engine", "Disable the parts engine").option("--site", "Generate a static site in the dist directory").option("--transpile", "Transpile the entry file to JavaScript").option("--preview-images", "Generate preview images in the dist directory").option("--all-images", "Generate preview images for every successful build output").option("--pngs", "Generate PNG outputs during build generation").option("--svgs", "Generate SVG outputs during build generation").option("--pcb-svgs", "Generate PCB SVG outputs during build generation").option("--schematic-svgs", "Generate schematic SVG outputs during build generation").option("--3d", "Generate 3D PNG outputs during build generation").option("--pcb-only", "Generate only PCB SVG outputs during build generation").option("--schematic-only", "Generate only schematic SVG outputs during build generation").option("--kicad-project", "Generate KiCad project directories for each successful build output").option("--kicad-library", "Generate KiCad library in dist/kicad-library").option("--kicad-library-name <name>", "Specify the name of the KiCad library").option("--preview-gltf", "Generate a GLTF file from the preview entrypoint").option("--glbs", "Generate GLB 3D model files for every successful build").option("--profile", "Log per-circuit circuit.json generation time during build").option("--kicad-pcm", "Generate KiCad PCM (Plugin and Content Manager) assets in dist/pcm").option("--use-cdn-javascript", "Use CDN-hosted JavaScript instead of bundled standalone file for --site").option("--concurrency <number>", "Number of files to build in parallel (default: 1)", "1").option("--inject-props <json>", "Inject JSON props into the built file's default export").option("--inject-props-file <path>", "Inject JSON props from a file into the built file's default export").action(async (file, options) => {
108456
+ program2.command("build").description("Run tscircuit eval and output circuit json").argument("[file]", "Path to the entry file").option("--ci", "Run install and optional prebuild/build commands (or default CI build)").option("--ignore-errors", "Do not exit with code 1 on errors").option("--ignore-warnings", "Do not log warnings").option("--ignore-netlist-drc", "Ignore netlist DRC errors/warnings").option("--ignore-pin-specification-drc", "Ignore pin-specification DRC errors/warnings").option("--ignore-placement-drc", "Ignore placement DRC errors/warnings").option("--ignore-routing-drc", "Ignore routing DRC errors/warnings").option("--ignore-config", "Ignore options from tscircuit.config.json").option("--disable-pcb", "Disable PCB outputs").option("--routing-disabled", "Disable routing during circuit generation").option("--disable-parts-engine", "Disable the parts engine").option("--site", "Generate a static site in the dist directory").option("--transpile", "Transpile the entry file to JavaScript").option("--preview-images", "Generate preview images in the dist directory").option("--all-images", "Generate preview images for every successful build output").option("--pngs", "Generate PNG outputs during build generation").option("--svgs", "Generate SVG outputs during build generation").option("--pcb-svgs", "Generate PCB SVG outputs during build generation").option("--schematic-svgs", "Generate schematic SVG outputs during build generation").option("--3d", "Generate 3D PNG outputs during build generation").option("--pcb-only", "Generate only PCB SVG outputs during build generation").option("--schematic-only", "Generate only schematic SVG outputs during build generation").option("--kicad-project", "Generate KiCad project directories for each successful build output").option("--kicad-library", "Generate KiCad library in dist/kicad-library").option("--kicad-library-name <name>", "Specify the name of the KiCad library").option("--preview-gltf", "Generate a GLTF file from the preview entrypoint").option("--glbs", "Generate GLB 3D model files for every successful build").option("--profile", "Log per-circuit circuit.json generation time during build").option("--kicad-pcm", "Generate KiCad PCM (Plugin and Content Manager) assets in dist/pcm").option("--use-cdn-javascript", "Use CDN-hosted JavaScript instead of bundled standalone file for --site").option("--concurrency <number>", "Number of files to build in parallel (default: 1)", "1").option("--inject-props <json>", "Inject JSON props into the built file's default export").option("--inject-props-file <path>", "Inject JSON props from a file into the built file's default export").action(async (file, options) => {
108364
108457
  try {
108365
108458
  const transpileExplicitlyRequested = options?.transpile === true;
108366
108459
  const resolvedRoot = path39.resolve(process.cwd());
@@ -108432,6 +108525,13 @@ var registerBuild = (program2) => {
108432
108525
  }
108433
108526
  let hasErrors = false;
108434
108527
  let hasFatalErrors = false;
108528
+ const ignoredDrcByCategory = {
108529
+ netlist: 0,
108530
+ pin_specification: 0,
108531
+ placement: 0,
108532
+ routing: 0,
108533
+ unknown: 0
108534
+ };
108435
108535
  const staticFileReferences = [];
108436
108536
  const builtFiles = [];
108437
108537
  const kicadProjects = [];
@@ -108449,6 +108549,10 @@ var registerBuild = (program2) => {
108449
108549
  const buildOptions = {
108450
108550
  ignoreErrors: resolvedOptions?.ignoreErrors,
108451
108551
  ignoreWarnings: resolvedOptions?.ignoreWarnings,
108552
+ ignoreNetlistDrc: resolvedOptions?.ignoreNetlistDrc,
108553
+ ignorePinSpecificationDrc: resolvedOptions?.ignorePinSpecificationDrc,
108554
+ ignorePlacementDrc: resolvedOptions?.ignorePlacementDrc,
108555
+ ignoreRoutingDrc: resolvedOptions?.ignoreRoutingDrc,
108452
108556
  platformConfig,
108453
108557
  profile: resolvedOptions?.profile,
108454
108558
  injectedProps,
@@ -108472,6 +108576,13 @@ var registerBuild = (program2) => {
108472
108576
  if (buildOutcome.hasErrors) {
108473
108577
  hasErrors = true;
108474
108578
  }
108579
+ if (buildOutcome.ignoredDrcByCategory) {
108580
+ ignoredDrcByCategory.netlist += buildOutcome.ignoredDrcByCategory.netlist;
108581
+ ignoredDrcByCategory.pin_specification += buildOutcome.ignoredDrcByCategory.pin_specification;
108582
+ ignoredDrcByCategory.placement += buildOutcome.ignoredDrcByCategory.placement;
108583
+ ignoredDrcByCategory.routing += buildOutcome.ignoredDrcByCategory.routing;
108584
+ ignoredDrcByCategory.unknown += buildOutcome.ignoredDrcByCategory.unknown;
108585
+ }
108475
108586
  if (!buildOutcome.ok) {
108476
108587
  hasErrors = true;
108477
108588
  if (buildOutcome.isFatalError) {
@@ -108589,6 +108700,7 @@ var registerBuild = (program2) => {
108589
108700
  await processBuildResult(result.filePath, result.outputPath, {
108590
108701
  ok: result.ok,
108591
108702
  hasErrors: result.hasErrors,
108703
+ ignoredDrcByCategory: result.ignoredDrcByCategory,
108592
108704
  isFatalError: result.isFatalError
108593
108705
  });
108594
108706
  if (resolvedOptions?.glbs && result.ok) {
@@ -108760,6 +108872,10 @@ var registerBuild = (program2) => {
108760
108872
  const enabledOpts = [
108761
108873
  resolvedOptions?.site && "site",
108762
108874
  resolvedOptions?.transpile && "transpile",
108875
+ resolvedOptions?.ignoreNetlistDrc && "ignore-netlist-drc",
108876
+ resolvedOptions?.ignorePinSpecificationDrc && "ignore-pin-specification-drc",
108877
+ resolvedOptions?.ignorePlacementDrc && "ignore-placement-drc",
108878
+ resolvedOptions?.ignoreRoutingDrc && "ignore-routing-drc",
108763
108879
  resolvedOptions?.previewImages && "preview-images",
108764
108880
  resolvedOptions?.allImages && "all-images",
108765
108881
  resolvedOptions?.pngs && "pngs",
@@ -108794,6 +108910,10 @@ var registerBuild = (program2) => {
108794
108910
  console.log(` Config ${kleur_default.magenta(configAppliedOpts.join(", "))} ${kleur_default.dim("(from tscircuit.config.json)")}`);
108795
108911
  }
108796
108912
  console.log(` Output ${kleur_default.dim(path39.relative(process.cwd(), distDir) || "dist")}`);
108913
+ const totalIgnoredDrc = Object.values(ignoredDrcByCategory).reduce((sum, count) => sum + count, 0);
108914
+ if (totalIgnoredDrc > 0) {
108915
+ console.log(` Ignored DRC ${kleur_default.yellow(`${totalIgnoredDrc}`)} ${kleur_default.dim(`(${formatIgnoredDrcCounts(ignoredDrcByCategory)})`)}`);
108916
+ }
108797
108917
  console.log(hasErrors ? kleur_default.yellow(`
108798
108918
  ⚠ Build completed with errors`) : kleur_default.green(`
108799
108919
  ✓ Done`));
@@ -219482,19 +219602,87 @@ function stripAnsi(string) {
219482
219602
  if (typeof string !== "string") {
219483
219603
  throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
219484
219604
  }
219605
+ if (!string.includes("\x1B") && !string.includes("›")) {
219606
+ return string;
219607
+ }
219485
219608
  return string.replace(regex, "");
219486
219609
  }
219487
219610
 
219611
+ // node_modules/get-east-asian-width/lookup-data.js
219612
+ var ambiguousRanges = [161, 161, 164, 164, 167, 168, 170, 170, 173, 174, 176, 180, 182, 186, 188, 191, 198, 198, 208, 208, 215, 216, 222, 225, 230, 230, 232, 234, 236, 237, 240, 240, 242, 243, 247, 250, 252, 252, 254, 254, 257, 257, 273, 273, 275, 275, 283, 283, 294, 295, 299, 299, 305, 307, 312, 312, 319, 322, 324, 324, 328, 331, 333, 333, 338, 339, 358, 359, 363, 363, 462, 462, 464, 464, 466, 466, 468, 468, 470, 470, 472, 472, 474, 474, 476, 476, 593, 593, 609, 609, 708, 708, 711, 711, 713, 715, 717, 717, 720, 720, 728, 731, 733, 733, 735, 735, 768, 879, 913, 929, 931, 937, 945, 961, 963, 969, 1025, 1025, 1040, 1103, 1105, 1105, 8208, 8208, 8211, 8214, 8216, 8217, 8220, 8221, 8224, 8226, 8228, 8231, 8240, 8240, 8242, 8243, 8245, 8245, 8251, 8251, 8254, 8254, 8308, 8308, 8319, 8319, 8321, 8324, 8364, 8364, 8451, 8451, 8453, 8453, 8457, 8457, 8467, 8467, 8470, 8470, 8481, 8482, 8486, 8486, 8491, 8491, 8531, 8532, 8539, 8542, 8544, 8555, 8560, 8569, 8585, 8585, 8592, 8601, 8632, 8633, 8658, 8658, 8660, 8660, 8679, 8679, 8704, 8704, 8706, 8707, 8711, 8712, 8715, 8715, 8719, 8719, 8721, 8721, 8725, 8725, 8730, 8730, 8733, 8736, 8739, 8739, 8741, 8741, 8743, 8748, 8750, 8750, 8756, 8759, 8764, 8765, 8776, 8776, 8780, 8780, 8786, 8786, 8800, 8801, 8804, 8807, 8810, 8811, 8814, 8815, 8834, 8835, 8838, 8839, 8853, 8853, 8857, 8857, 8869, 8869, 8895, 8895, 8978, 8978, 9312, 9449, 9451, 9547, 9552, 9587, 9600, 9615, 9618, 9621, 9632, 9633, 9635, 9641, 9650, 9651, 9654, 9655, 9660, 9661, 9664, 9665, 9670, 9672, 9675, 9675, 9678, 9681, 9698, 9701, 9711, 9711, 9733, 9734, 9737, 9737, 9742, 9743, 9756, 9756, 9758, 9758, 9792, 9792, 9794, 9794, 9824, 9825, 9827, 9829, 9831, 9834, 9836, 9837, 9839, 9839, 9886, 9887, 9919, 9919, 9926, 9933, 9935, 9939, 9941, 9953, 9955, 9955, 9960, 9961, 9963, 9969, 9972, 9972, 9974, 9977, 9979, 9980, 9982, 9983, 10045, 10045, 10102, 10111, 11094, 11097, 12872, 12879, 57344, 63743, 65024, 65039, 65533, 65533, 127232, 127242, 127248, 127277, 127280, 127337, 127344, 127373, 127375, 127376, 127387, 127404, 917760, 917999, 983040, 1048573, 1048576, 1114109];
219613
+ var fullwidthRanges = [12288, 12288, 65281, 65376, 65504, 65510];
219614
+ var halfwidthRanges = [8361, 8361, 65377, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, 65512, 65518];
219615
+ var narrowRanges = [32, 126, 162, 163, 165, 166, 172, 172, 175, 175, 10214, 10221, 10629, 10630];
219616
+ var wideRanges = [4352, 4447, 8986, 8987, 9001, 9002, 9193, 9196, 9200, 9200, 9203, 9203, 9725, 9726, 9748, 9749, 9776, 9783, 9800, 9811, 9855, 9855, 9866, 9871, 9875, 9875, 9889, 9889, 9898, 9899, 9917, 9918, 9924, 9925, 9934, 9934, 9940, 9940, 9962, 9962, 9970, 9971, 9973, 9973, 9978, 9978, 9981, 9981, 9989, 9989, 9994, 9995, 10024, 10024, 10060, 10060, 10062, 10062, 10067, 10069, 10071, 10071, 10133, 10135, 10160, 10160, 10175, 10175, 11035, 11036, 11088, 11088, 11093, 11093, 11904, 11929, 11931, 12019, 12032, 12245, 12272, 12287, 12289, 12350, 12353, 12438, 12441, 12543, 12549, 12591, 12593, 12686, 12688, 12773, 12783, 12830, 12832, 12871, 12880, 42124, 42128, 42182, 43360, 43388, 44032, 55203, 63744, 64255, 65040, 65049, 65072, 65106, 65108, 65126, 65128, 65131, 94176, 94180, 94192, 94198, 94208, 101589, 101631, 101662, 101760, 101874, 110576, 110579, 110581, 110587, 110589, 110590, 110592, 110882, 110898, 110898, 110928, 110930, 110933, 110933, 110948, 110951, 110960, 111355, 119552, 119638, 119648, 119670, 126980, 126980, 127183, 127183, 127374, 127374, 127377, 127386, 127488, 127490, 127504, 127547, 127552, 127560, 127568, 127569, 127584, 127589, 127744, 127776, 127789, 127797, 127799, 127868, 127870, 127891, 127904, 127946, 127951, 127955, 127968, 127984, 127988, 127988, 127992, 128062, 128064, 128064, 128066, 128252, 128255, 128317, 128331, 128334, 128336, 128359, 128378, 128378, 128405, 128406, 128420, 128420, 128507, 128591, 128640, 128709, 128716, 128716, 128720, 128722, 128725, 128728, 128732, 128735, 128747, 128748, 128756, 128764, 128992, 129003, 129008, 129008, 129292, 129338, 129340, 129349, 129351, 129535, 129648, 129660, 129664, 129674, 129678, 129734, 129736, 129736, 129741, 129756, 129759, 129770, 129775, 129784, 131072, 196605, 196608, 262141];
219617
+
219618
+ // node_modules/get-east-asian-width/utilities.js
219619
+ var isInRange = (ranges, codePoint) => {
219620
+ let low = 0;
219621
+ let high = Math.floor(ranges.length / 2) - 1;
219622
+ while (low <= high) {
219623
+ const mid = Math.floor((low + high) / 2);
219624
+ const i2 = mid * 2;
219625
+ if (codePoint < ranges[i2]) {
219626
+ high = mid - 1;
219627
+ } else if (codePoint > ranges[i2 + 1]) {
219628
+ low = mid + 1;
219629
+ } else {
219630
+ return true;
219631
+ }
219632
+ }
219633
+ return false;
219634
+ };
219635
+
219488
219636
  // node_modules/get-east-asian-width/lookup.js
219489
- function isAmbiguous(x3) {
219490
- return x3 === 161 || x3 === 164 || x3 === 167 || x3 === 168 || x3 === 170 || x3 === 173 || x3 === 174 || x3 >= 176 && x3 <= 180 || x3 >= 182 && x3 <= 186 || x3 >= 188 && x3 <= 191 || x3 === 198 || x3 === 208 || x3 === 215 || x3 === 216 || x3 >= 222 && x3 <= 225 || x3 === 230 || x3 >= 232 && x3 <= 234 || x3 === 236 || x3 === 237 || x3 === 240 || x3 === 242 || x3 === 243 || x3 >= 247 && x3 <= 250 || x3 === 252 || x3 === 254 || x3 === 257 || x3 === 273 || x3 === 275 || x3 === 283 || x3 === 294 || x3 === 295 || x3 === 299 || x3 >= 305 && x3 <= 307 || x3 === 312 || x3 >= 319 && x3 <= 322 || x3 === 324 || x3 >= 328 && x3 <= 331 || x3 === 333 || x3 === 338 || x3 === 339 || x3 === 358 || x3 === 359 || x3 === 363 || x3 === 462 || x3 === 464 || x3 === 466 || x3 === 468 || x3 === 470 || x3 === 472 || x3 === 474 || x3 === 476 || x3 === 593 || x3 === 609 || x3 === 708 || x3 === 711 || x3 >= 713 && x3 <= 715 || x3 === 717 || x3 === 720 || x3 >= 728 && x3 <= 731 || x3 === 733 || x3 === 735 || x3 >= 768 && x3 <= 879 || x3 >= 913 && x3 <= 929 || x3 >= 931 && x3 <= 937 || x3 >= 945 && x3 <= 961 || x3 >= 963 && x3 <= 969 || x3 === 1025 || x3 >= 1040 && x3 <= 1103 || x3 === 1105 || x3 === 8208 || x3 >= 8211 && x3 <= 8214 || x3 === 8216 || x3 === 8217 || x3 === 8220 || x3 === 8221 || x3 >= 8224 && x3 <= 8226 || x3 >= 8228 && x3 <= 8231 || x3 === 8240 || x3 === 8242 || x3 === 8243 || x3 === 8245 || x3 === 8251 || x3 === 8254 || x3 === 8308 || x3 === 8319 || x3 >= 8321 && x3 <= 8324 || x3 === 8364 || x3 === 8451 || x3 === 8453 || x3 === 8457 || x3 === 8467 || x3 === 8470 || x3 === 8481 || x3 === 8482 || x3 === 8486 || x3 === 8491 || x3 === 8531 || x3 === 8532 || x3 >= 8539 && x3 <= 8542 || x3 >= 8544 && x3 <= 8555 || x3 >= 8560 && x3 <= 8569 || x3 === 8585 || x3 >= 8592 && x3 <= 8601 || x3 === 8632 || x3 === 8633 || x3 === 8658 || x3 === 8660 || x3 === 8679 || x3 === 8704 || x3 === 8706 || x3 === 8707 || x3 === 8711 || x3 === 8712 || x3 === 8715 || x3 === 8719 || x3 === 8721 || x3 === 8725 || x3 === 8730 || x3 >= 8733 && x3 <= 8736 || x3 === 8739 || x3 === 8741 || x3 >= 8743 && x3 <= 8748 || x3 === 8750 || x3 >= 8756 && x3 <= 8759 || x3 === 8764 || x3 === 8765 || x3 === 8776 || x3 === 8780 || x3 === 8786 || x3 === 8800 || x3 === 8801 || x3 >= 8804 && x3 <= 8807 || x3 === 8810 || x3 === 8811 || x3 === 8814 || x3 === 8815 || x3 === 8834 || x3 === 8835 || x3 === 8838 || x3 === 8839 || x3 === 8853 || x3 === 8857 || x3 === 8869 || x3 === 8895 || x3 === 8978 || x3 >= 9312 && x3 <= 9449 || x3 >= 9451 && x3 <= 9547 || x3 >= 9552 && x3 <= 9587 || x3 >= 9600 && x3 <= 9615 || x3 >= 9618 && x3 <= 9621 || x3 === 9632 || x3 === 9633 || x3 >= 9635 && x3 <= 9641 || x3 === 9650 || x3 === 9651 || x3 === 9654 || x3 === 9655 || x3 === 9660 || x3 === 9661 || x3 === 9664 || x3 === 9665 || x3 >= 9670 && x3 <= 9672 || x3 === 9675 || x3 >= 9678 && x3 <= 9681 || x3 >= 9698 && x3 <= 9701 || x3 === 9711 || x3 === 9733 || x3 === 9734 || x3 === 9737 || x3 === 9742 || x3 === 9743 || x3 === 9756 || x3 === 9758 || x3 === 9792 || x3 === 9794 || x3 === 9824 || x3 === 9825 || x3 >= 9827 && x3 <= 9829 || x3 >= 9831 && x3 <= 9834 || x3 === 9836 || x3 === 9837 || x3 === 9839 || x3 === 9886 || x3 === 9887 || x3 === 9919 || x3 >= 9926 && x3 <= 9933 || x3 >= 9935 && x3 <= 9939 || x3 >= 9941 && x3 <= 9953 || x3 === 9955 || x3 === 9960 || x3 === 9961 || x3 >= 9963 && x3 <= 9969 || x3 === 9972 || x3 >= 9974 && x3 <= 9977 || x3 === 9979 || x3 === 9980 || x3 === 9982 || x3 === 9983 || x3 === 10045 || x3 >= 10102 && x3 <= 10111 || x3 >= 11094 && x3 <= 11097 || x3 >= 12872 && x3 <= 12879 || x3 >= 57344 && x3 <= 63743 || x3 >= 65024 && x3 <= 65039 || x3 === 65533 || x3 >= 127232 && x3 <= 127242 || x3 >= 127248 && x3 <= 127277 || x3 >= 127280 && x3 <= 127337 || x3 >= 127344 && x3 <= 127373 || x3 === 127375 || x3 === 127376 || x3 >= 127387 && x3 <= 127404 || x3 >= 917760 && x3 <= 917999 || x3 >= 983040 && x3 <= 1048573 || x3 >= 1048576 && x3 <= 1114109;
219491
- }
219492
- function isFullWidth(x3) {
219493
- return x3 === 12288 || x3 >= 65281 && x3 <= 65376 || x3 >= 65504 && x3 <= 65510;
219494
- }
219495
- function isWide(x3) {
219496
- return x3 >= 4352 && x3 <= 4447 || x3 === 8986 || x3 === 8987 || x3 === 9001 || x3 === 9002 || x3 >= 9193 && x3 <= 9196 || x3 === 9200 || x3 === 9203 || x3 === 9725 || x3 === 9726 || x3 === 9748 || x3 === 9749 || x3 >= 9776 && x3 <= 9783 || x3 >= 9800 && x3 <= 9811 || x3 === 9855 || x3 >= 9866 && x3 <= 9871 || x3 === 9875 || x3 === 9889 || x3 === 9898 || x3 === 9899 || x3 === 9917 || x3 === 9918 || x3 === 9924 || x3 === 9925 || x3 === 9934 || x3 === 9940 || x3 === 9962 || x3 === 9970 || x3 === 9971 || x3 === 9973 || x3 === 9978 || x3 === 9981 || x3 === 9989 || x3 === 9994 || x3 === 9995 || x3 === 10024 || x3 === 10060 || x3 === 10062 || x3 >= 10067 && x3 <= 10069 || x3 === 10071 || x3 >= 10133 && x3 <= 10135 || x3 === 10160 || x3 === 10175 || x3 === 11035 || x3 === 11036 || x3 === 11088 || x3 === 11093 || x3 >= 11904 && x3 <= 11929 || x3 >= 11931 && x3 <= 12019 || x3 >= 12032 && x3 <= 12245 || x3 >= 12272 && x3 <= 12287 || x3 >= 12289 && x3 <= 12350 || x3 >= 12353 && x3 <= 12438 || x3 >= 12441 && x3 <= 12543 || x3 >= 12549 && x3 <= 12591 || x3 >= 12593 && x3 <= 12686 || x3 >= 12688 && x3 <= 12773 || x3 >= 12783 && x3 <= 12830 || x3 >= 12832 && x3 <= 12871 || x3 >= 12880 && x3 <= 42124 || x3 >= 42128 && x3 <= 42182 || x3 >= 43360 && x3 <= 43388 || x3 >= 44032 && x3 <= 55203 || x3 >= 63744 && x3 <= 64255 || x3 >= 65040 && x3 <= 65049 || x3 >= 65072 && x3 <= 65106 || x3 >= 65108 && x3 <= 65126 || x3 >= 65128 && x3 <= 65131 || x3 >= 94176 && x3 <= 94180 || x3 >= 94192 && x3 <= 94198 || x3 >= 94208 && x3 <= 101589 || x3 >= 101631 && x3 <= 101662 || x3 >= 101760 && x3 <= 101874 || x3 >= 110576 && x3 <= 110579 || x3 >= 110581 && x3 <= 110587 || x3 === 110589 || x3 === 110590 || x3 >= 110592 && x3 <= 110882 || x3 === 110898 || x3 >= 110928 && x3 <= 110930 || x3 === 110933 || x3 >= 110948 && x3 <= 110951 || x3 >= 110960 && x3 <= 111355 || x3 >= 119552 && x3 <= 119638 || x3 >= 119648 && x3 <= 119670 || x3 === 126980 || x3 === 127183 || x3 === 127374 || x3 >= 127377 && x3 <= 127386 || x3 >= 127488 && x3 <= 127490 || x3 >= 127504 && x3 <= 127547 || x3 >= 127552 && x3 <= 127560 || x3 === 127568 || x3 === 127569 || x3 >= 127584 && x3 <= 127589 || x3 >= 127744 && x3 <= 127776 || x3 >= 127789 && x3 <= 127797 || x3 >= 127799 && x3 <= 127868 || x3 >= 127870 && x3 <= 127891 || x3 >= 127904 && x3 <= 127946 || x3 >= 127951 && x3 <= 127955 || x3 >= 127968 && x3 <= 127984 || x3 === 127988 || x3 >= 127992 && x3 <= 128062 || x3 === 128064 || x3 >= 128066 && x3 <= 128252 || x3 >= 128255 && x3 <= 128317 || x3 >= 128331 && x3 <= 128334 || x3 >= 128336 && x3 <= 128359 || x3 === 128378 || x3 === 128405 || x3 === 128406 || x3 === 128420 || x3 >= 128507 && x3 <= 128591 || x3 >= 128640 && x3 <= 128709 || x3 === 128716 || x3 >= 128720 && x3 <= 128722 || x3 >= 128725 && x3 <= 128728 || x3 >= 128732 && x3 <= 128735 || x3 === 128747 || x3 === 128748 || x3 >= 128756 && x3 <= 128764 || x3 >= 128992 && x3 <= 129003 || x3 === 129008 || x3 >= 129292 && x3 <= 129338 || x3 >= 129340 && x3 <= 129349 || x3 >= 129351 && x3 <= 129535 || x3 >= 129648 && x3 <= 129660 || x3 >= 129664 && x3 <= 129674 || x3 >= 129678 && x3 <= 129734 || x3 === 129736 || x3 >= 129741 && x3 <= 129756 || x3 >= 129759 && x3 <= 129770 || x3 >= 129775 && x3 <= 129784 || x3 >= 131072 && x3 <= 196605 || x3 >= 196608 && x3 <= 262141;
219497
- }
219637
+ var minimumAmbiguousCodePoint = ambiguousRanges[0];
219638
+ var maximumAmbiguousCodePoint = ambiguousRanges.at(-1);
219639
+ var minimumFullWidthCodePoint = fullwidthRanges[0];
219640
+ var maximumFullWidthCodePoint = fullwidthRanges.at(-1);
219641
+ var minimumHalfWidthCodePoint = halfwidthRanges[0];
219642
+ var maximumHalfWidthCodePoint = halfwidthRanges.at(-1);
219643
+ var minimumNarrowCodePoint = narrowRanges[0];
219644
+ var maximumNarrowCodePoint = narrowRanges.at(-1);
219645
+ var minimumWideCodePoint = wideRanges[0];
219646
+ var maximumWideCodePoint = wideRanges.at(-1);
219647
+ var commonCjkCodePoint = 19968;
219648
+ var [wideFastPathStart, wideFastPathEnd] = findWideFastPathRange(wideRanges);
219649
+ function findWideFastPathRange(ranges) {
219650
+ let fastPathStart = ranges[0];
219651
+ let fastPathEnd = ranges[1];
219652
+ for (let index = 0;index < ranges.length; index += 2) {
219653
+ const start = ranges[index];
219654
+ const end = ranges[index + 1];
219655
+ if (commonCjkCodePoint >= start && commonCjkCodePoint <= end) {
219656
+ return [start, end];
219657
+ }
219658
+ if (end - start > fastPathEnd - fastPathStart) {
219659
+ fastPathStart = start;
219660
+ fastPathEnd = end;
219661
+ }
219662
+ }
219663
+ return [fastPathStart, fastPathEnd];
219664
+ }
219665
+ var isAmbiguous = (codePoint) => {
219666
+ if (codePoint < minimumAmbiguousCodePoint || codePoint > maximumAmbiguousCodePoint) {
219667
+ return false;
219668
+ }
219669
+ return isInRange(ambiguousRanges, codePoint);
219670
+ };
219671
+ var isFullWidth = (codePoint) => {
219672
+ if (codePoint < minimumFullWidthCodePoint || codePoint > maximumFullWidthCodePoint) {
219673
+ return false;
219674
+ }
219675
+ return isInRange(fullwidthRanges, codePoint);
219676
+ };
219677
+ var isWide = (codePoint) => {
219678
+ if (codePoint >= wideFastPathStart && codePoint <= wideFastPathEnd) {
219679
+ return true;
219680
+ }
219681
+ if (codePoint < minimumWideCodePoint || codePoint > maximumWideCodePoint) {
219682
+ return false;
219683
+ }
219684
+ return isInRange(wideRanges, codePoint);
219685
+ };
219498
219686
 
219499
219687
  // node_modules/get-east-asian-width/index.js
219500
219688
  function validate2(codePoint) {
@@ -7023,6 +7023,7 @@ var require_limitLength = __commonJS((exports) => {
7023
7023
  var require_pattern = __commonJS((exports) => {
7024
7024
  Object.defineProperty(exports, "__esModule", { value: true });
7025
7025
  var code_1 = require_code2();
7026
+ var util_1 = require_util();
7026
7027
  var codegen_1 = require_codegen();
7027
7028
  var error = {
7028
7029
  message: ({ schemaCode }) => (0, codegen_1.str)`must match pattern "${schemaCode}"`,
@@ -7035,10 +7036,18 @@ var require_pattern = __commonJS((exports) => {
7035
7036
  $data: true,
7036
7037
  error,
7037
7038
  code(cxt) {
7038
- const { data, $data, schema, schemaCode, it } = cxt;
7039
+ const { gen, data, $data, schema, schemaCode, it } = cxt;
7039
7040
  const u = it.opts.unicodeRegExp ? "u" : "";
7040
- const regExp = $data ? (0, codegen_1._)`(new RegExp(${schemaCode}, ${u}))` : (0, code_1.usePattern)(cxt, schema);
7041
- cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`);
7041
+ if ($data) {
7042
+ const { regExp } = it.opts.code;
7043
+ const regExpCode = regExp.code === "new RegExp" ? (0, codegen_1._)`new RegExp` : (0, util_1.useFunc)(gen, regExp);
7044
+ const valid = gen.let("valid");
7045
+ gen.try(() => gen.assign(valid, (0, codegen_1._)`${regExpCode}(${schemaCode}, ${u}).test(${data})`), () => gen.assign(valid, false));
7046
+ cxt.fail$data((0, codegen_1._)`!${valid}`);
7047
+ } else {
7048
+ const regExp = (0, code_1.usePattern)(cxt, schema);
7049
+ cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`);
7050
+ }
7042
7051
  }
7043
7052
  };
7044
7053
  exports.default = def;
package/dist/lib/index.js CHANGED
@@ -40662,6 +40662,7 @@ var require_limitLength = __commonJS((exports2) => {
40662
40662
  var require_pattern = __commonJS((exports2) => {
40663
40663
  Object.defineProperty(exports2, "__esModule", { value: true });
40664
40664
  var code_1 = require_code2();
40665
+ var util_1 = require_util();
40665
40666
  var codegen_1 = require_codegen();
40666
40667
  var error = {
40667
40668
  message: ({ schemaCode }) => (0, codegen_1.str)`must match pattern "${schemaCode}"`,
@@ -40674,10 +40675,18 @@ var require_pattern = __commonJS((exports2) => {
40674
40675
  $data: true,
40675
40676
  error,
40676
40677
  code(cxt) {
40677
- const { data, $data, schema, schemaCode, it } = cxt;
40678
+ const { gen, data, $data, schema, schemaCode, it } = cxt;
40678
40679
  const u = it.opts.unicodeRegExp ? "u" : "";
40679
- const regExp = $data ? (0, codegen_1._)`(new RegExp(${schemaCode}, ${u}))` : (0, code_1.usePattern)(cxt, schema);
40680
- cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`);
40680
+ if ($data) {
40681
+ const { regExp } = it.opts.code;
40682
+ const regExpCode = regExp.code === "new RegExp" ? (0, codegen_1._)`new RegExp` : (0, util_1.useFunc)(gen, regExp);
40683
+ const valid = gen.let("valid");
40684
+ gen.try(() => gen.assign(valid, (0, codegen_1._)`${regExpCode}(${schemaCode}, ${u}).test(${data})`), () => gen.assign(valid, false));
40685
+ cxt.fail$data((0, codegen_1._)`!${valid}`);
40686
+ } else {
40687
+ const regExp = (0, code_1.usePattern)(cxt, schema);
40688
+ cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`);
40689
+ }
40681
40690
  }
40682
40691
  };
40683
40692
  exports2.default = def;
@@ -60467,7 +60476,7 @@ var package_default = {
60467
60476
  chokidar: "4.0.1",
60468
60477
  "circuit-json": "^0.0.402",
60469
60478
  "circuit-json-to-kicad": "^0.0.84",
60470
- "circuit-json-to-readable-netlist": "^0.0.14",
60479
+ "circuit-json-to-readable-netlist": "^0.0.15",
60471
60480
  "circuit-json-to-spice": "^0.0.10",
60472
60481
  "circuit-json-to-tscircuit": "^0.0.9",
60473
60482
  commander: "^14.0.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.1103",
3
+ "version": "0.1.1104",
4
4
  "main": "dist/cli/main.js",
5
5
  "exports": {
6
6
  ".": "./dist/cli/main.js",
@@ -28,7 +28,7 @@
28
28
  "chokidar": "4.0.1",
29
29
  "circuit-json": "^0.0.402",
30
30
  "circuit-json-to-kicad": "^0.0.84",
31
- "circuit-json-to-readable-netlist": "^0.0.14",
31
+ "circuit-json-to-readable-netlist": "^0.0.15",
32
32
  "circuit-json-to-spice": "^0.0.10",
33
33
  "circuit-json-to-tscircuit": "^0.0.9",
34
34
  "commander": "^14.0.0",