@tscircuit/cli 0.1.1398 → 0.1.1399

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/lib/index.js CHANGED
@@ -39126,6 +39126,9 @@ var require_data = __commonJS((exports2, module2) => {
39126
39126
  var require_utils = __commonJS((exports2, module2) => {
39127
39127
  var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
39128
39128
  var isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
39129
+ var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
39130
+ var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
39131
+ var isPathCharacter = RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);
39129
39132
  function stringArrayToHexStripped(input) {
39130
39133
  let acc = "";
39131
39134
  let code = 0;
@@ -39319,27 +39322,77 @@ var require_utils = __commonJS((exports2, module2) => {
39319
39322
  }
39320
39323
  return output.join("");
39321
39324
  }
39322
- function normalizeComponentEncoding(component, esc) {
39323
- const func = esc !== true ? escape : unescape;
39324
- if (component.scheme !== undefined) {
39325
- component.scheme = func(component.scheme);
39326
- }
39327
- if (component.userinfo !== undefined) {
39328
- component.userinfo = func(component.userinfo);
39329
- }
39330
- if (component.host !== undefined) {
39331
- component.host = func(component.host);
39325
+ var HOST_DELIMS = { "@": "%40", "/": "%2F", "?": "%3F", "#": "%23", ":": "%3A" };
39326
+ var HOST_DELIM_RE = /[@/?#:]/g;
39327
+ var HOST_DELIM_NO_COLON_RE = /[@/?#]/g;
39328
+ function reescapeHostDelimiters(host, isIP) {
39329
+ const re = isIP ? HOST_DELIM_NO_COLON_RE : HOST_DELIM_RE;
39330
+ re.lastIndex = 0;
39331
+ return host.replace(re, (ch) => HOST_DELIMS[ch]);
39332
+ }
39333
+ function normalizePercentEncoding(input, decodeUnreserved = false) {
39334
+ if (input.indexOf("%") === -1) {
39335
+ return input;
39332
39336
  }
39333
- if (component.path !== undefined) {
39334
- component.path = func(component.path);
39337
+ let output = "";
39338
+ for (let i = 0;i < input.length; i++) {
39339
+ if (input[i] === "%" && i + 2 < input.length) {
39340
+ const hex = input.slice(i + 1, i + 3);
39341
+ if (isHexPair(hex)) {
39342
+ const normalizedHex = hex.toUpperCase();
39343
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
39344
+ if (decodeUnreserved && isUnreserved(decoded)) {
39345
+ output += decoded;
39346
+ } else {
39347
+ output += "%" + normalizedHex;
39348
+ }
39349
+ i += 2;
39350
+ continue;
39351
+ }
39352
+ }
39353
+ output += input[i];
39335
39354
  }
39336
- if (component.query !== undefined) {
39337
- component.query = func(component.query);
39355
+ return output;
39356
+ }
39357
+ function normalizePathEncoding(input) {
39358
+ let output = "";
39359
+ for (let i = 0;i < input.length; i++) {
39360
+ if (input[i] === "%" && i + 2 < input.length) {
39361
+ const hex = input.slice(i + 1, i + 3);
39362
+ if (isHexPair(hex)) {
39363
+ const normalizedHex = hex.toUpperCase();
39364
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
39365
+ if (decoded !== "." && isUnreserved(decoded)) {
39366
+ output += decoded;
39367
+ } else {
39368
+ output += "%" + normalizedHex;
39369
+ }
39370
+ i += 2;
39371
+ continue;
39372
+ }
39373
+ }
39374
+ if (isPathCharacter(input[i])) {
39375
+ output += input[i];
39376
+ } else {
39377
+ output += escape(input[i]);
39378
+ }
39338
39379
  }
39339
- if (component.fragment !== undefined) {
39340
- component.fragment = func(component.fragment);
39380
+ return output;
39381
+ }
39382
+ function escapePreservingEscapes(input) {
39383
+ let output = "";
39384
+ for (let i = 0;i < input.length; i++) {
39385
+ if (input[i] === "%" && i + 2 < input.length) {
39386
+ const hex = input.slice(i + 1, i + 3);
39387
+ if (isHexPair(hex)) {
39388
+ output += "%" + hex.toUpperCase();
39389
+ i += 2;
39390
+ continue;
39391
+ }
39392
+ }
39393
+ output += escape(input[i]);
39341
39394
  }
39342
- return component;
39395
+ return output;
39343
39396
  }
39344
39397
  function recomposeAuthority(component) {
39345
39398
  const uriTokens = [];
@@ -39354,7 +39407,7 @@ var require_utils = __commonJS((exports2, module2) => {
39354
39407
  if (ipV6res.isIPV6 === true) {
39355
39408
  host = `[${ipV6res.escapedHost}]`;
39356
39409
  } else {
39357
- host = component.host;
39410
+ host = reescapeHostDelimiters(host, false);
39358
39411
  }
39359
39412
  }
39360
39413
  uriTokens.push(host);
@@ -39368,7 +39421,10 @@ var require_utils = __commonJS((exports2, module2) => {
39368
39421
  module2.exports = {
39369
39422
  nonSimpleDomain,
39370
39423
  recomposeAuthority,
39371
- normalizeComponentEncoding,
39424
+ reescapeHostDelimiters,
39425
+ normalizePercentEncoding,
39426
+ normalizePathEncoding,
39427
+ escapePreservingEscapes,
39372
39428
  removeDotSegments,
39373
39429
  isIPv4,
39374
39430
  isUUID,
@@ -39553,11 +39609,11 @@ var require_schemes = __commonJS((exports2, module2) => {
39553
39609
 
39554
39610
  // node_modules/fast-uri/index.js
39555
39611
  var require_fast_uri = __commonJS((exports2, module2) => {
39556
- var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizeComponentEncoding, isIPv4, nonSimpleDomain } = require_utils();
39612
+ var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
39557
39613
  var { SCHEMES, getSchemeHandler } = require_schemes();
39558
39614
  function normalize(uri, options) {
39559
39615
  if (typeof uri === "string") {
39560
- uri = serialize(parse(uri, options), options);
39616
+ uri = normalizeString(uri, options);
39561
39617
  } else if (typeof uri === "object") {
39562
39618
  uri = parse(serialize(uri, options), options);
39563
39619
  }
@@ -39623,19 +39679,9 @@ var require_fast_uri = __commonJS((exports2, module2) => {
39623
39679
  return target;
39624
39680
  }
39625
39681
  function equal(uriA, uriB, options) {
39626
- if (typeof uriA === "string") {
39627
- uriA = unescape(uriA);
39628
- uriA = serialize(normalizeComponentEncoding(parse(uriA, options), true), { ...options, skipEscape: true });
39629
- } else if (typeof uriA === "object") {
39630
- uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true });
39631
- }
39632
- if (typeof uriB === "string") {
39633
- uriB = unescape(uriB);
39634
- uriB = serialize(normalizeComponentEncoding(parse(uriB, options), true), { ...options, skipEscape: true });
39635
- } else if (typeof uriB === "object") {
39636
- uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true });
39637
- }
39638
- return uriA.toLowerCase() === uriB.toLowerCase();
39682
+ const normalizedA = normalizeComparableURI(uriA, options);
39683
+ const normalizedB = normalizeComparableURI(uriB, options);
39684
+ return normalizedA !== undefined && normalizedB !== undefined && normalizedA.toLowerCase() === normalizedB.toLowerCase();
39639
39685
  }
39640
39686
  function serialize(cmpts, opts) {
39641
39687
  const component = {
@@ -39661,12 +39707,12 @@ var require_fast_uri = __commonJS((exports2, module2) => {
39661
39707
  schemeHandler.serialize(component, options);
39662
39708
  if (component.path !== undefined) {
39663
39709
  if (!options.skipEscape) {
39664
- component.path = escape(component.path);
39710
+ component.path = escapePreservingEscapes(component.path);
39665
39711
  if (component.scheme !== undefined) {
39666
39712
  component.path = component.path.split("%3A").join(":");
39667
39713
  }
39668
39714
  } else {
39669
- component.path = unescape(component.path);
39715
+ component.path = normalizePercentEncoding(component.path);
39670
39716
  }
39671
39717
  }
39672
39718
  if (options.reference !== "suffix" && component.scheme) {
@@ -39701,7 +39747,16 @@ var require_fast_uri = __commonJS((exports2, module2) => {
39701
39747
  return uriTokens.join("");
39702
39748
  }
39703
39749
  var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
39704
- function parse(uri, opts) {
39750
+ function getParseError(parsed, matches) {
39751
+ if (matches[2] !== undefined && parsed.path && parsed.path[0] !== "/") {
39752
+ return 'URI path must start with "/" when authority is present.';
39753
+ }
39754
+ if (typeof parsed.port === "number" && (parsed.port < 0 || parsed.port > 65535)) {
39755
+ return "URI port is malformed.";
39756
+ }
39757
+ return;
39758
+ }
39759
+ function parseWithStatus(uri, opts) {
39705
39760
  const options = Object.assign({}, opts);
39706
39761
  const parsed = {
39707
39762
  scheme: undefined,
@@ -39712,6 +39767,7 @@ var require_fast_uri = __commonJS((exports2, module2) => {
39712
39767
  query: undefined,
39713
39768
  fragment: undefined
39714
39769
  };
39770
+ let malformedAuthorityOrPort = false;
39715
39771
  let isIP = false;
39716
39772
  if (options.reference === "suffix") {
39717
39773
  if (options.scheme) {
@@ -39732,6 +39788,11 @@ var require_fast_uri = __commonJS((exports2, module2) => {
39732
39788
  if (isNaN(parsed.port)) {
39733
39789
  parsed.port = matches[5];
39734
39790
  }
39791
+ const parseError = getParseError(parsed, matches);
39792
+ if (parseError !== undefined) {
39793
+ parsed.error = parsed.error || parseError;
39794
+ malformedAuthorityOrPort = true;
39795
+ }
39735
39796
  if (parsed.host) {
39736
39797
  const ipv4result = isIPv4(parsed.host);
39737
39798
  if (ipv4result === false) {
@@ -39770,14 +39831,18 @@ var require_fast_uri = __commonJS((exports2, module2) => {
39770
39831
  parsed.scheme = unescape(parsed.scheme);
39771
39832
  }
39772
39833
  if (parsed.host !== undefined) {
39773
- parsed.host = unescape(parsed.host);
39834
+ parsed.host = reescapeHostDelimiters(unescape(parsed.host), isIP);
39774
39835
  }
39775
39836
  }
39776
39837
  if (parsed.path) {
39777
- parsed.path = escape(unescape(parsed.path));
39838
+ parsed.path = normalizePathEncoding(parsed.path);
39778
39839
  }
39779
39840
  if (parsed.fragment) {
39780
- parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
39841
+ try {
39842
+ parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
39843
+ } catch {
39844
+ parsed.error = parsed.error || "URI malformed";
39845
+ }
39781
39846
  }
39782
39847
  }
39783
39848
  if (schemeHandler && schemeHandler.parse) {
@@ -39786,7 +39851,29 @@ var require_fast_uri = __commonJS((exports2, module2) => {
39786
39851
  } else {
39787
39852
  parsed.error = parsed.error || "URI can not be parsed.";
39788
39853
  }
39789
- return parsed;
39854
+ return { parsed, malformedAuthorityOrPort };
39855
+ }
39856
+ function parse(uri, opts) {
39857
+ return parseWithStatus(uri, opts).parsed;
39858
+ }
39859
+ function normalizeString(uri, opts) {
39860
+ return normalizeStringWithStatus(uri, opts).normalized;
39861
+ }
39862
+ function normalizeStringWithStatus(uri, opts) {
39863
+ const { parsed, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
39864
+ return {
39865
+ normalized: malformedAuthorityOrPort ? uri : serialize(parsed, opts),
39866
+ malformedAuthorityOrPort
39867
+ };
39868
+ }
39869
+ function normalizeComparableURI(uri, opts) {
39870
+ if (typeof uri === "string") {
39871
+ const { normalized, malformedAuthorityOrPort } = normalizeStringWithStatus(uri, opts);
39872
+ return malformedAuthorityOrPort ? undefined : normalized;
39873
+ }
39874
+ if (typeof uri === "object") {
39875
+ return serialize(uri, opts);
39876
+ }
39790
39877
  }
39791
39878
  var fastUri = {
39792
39879
  SCHEMES,
@@ -39921,7 +40008,7 @@ var require_core = __commonJS((exports2) => {
39921
40008
  constructor(opts = {}) {
39922
40009
  this.schemas = {};
39923
40010
  this.refs = {};
39924
- this.formats = {};
40011
+ this.formats = Object.create(null);
39925
40012
  this._compilations = new Set;
39926
40013
  this._loading = {};
39927
40014
  this._cache = new Map;
@@ -44088,6 +44175,44 @@ var require_coerce = __commonJS((exports2, module2) => {
44088
44175
  module2.exports = coerce;
44089
44176
  });
44090
44177
 
44178
+ // node_modules/semver/functions/truncate.js
44179
+ var require_truncate = __commonJS((exports2, module2) => {
44180
+ var parse = require_parse();
44181
+ var constants = require_constants();
44182
+ var SemVer = require_semver();
44183
+ var truncate = (version2, truncation, options) => {
44184
+ if (!constants.RELEASE_TYPES.includes(truncation)) {
44185
+ return null;
44186
+ }
44187
+ const clonedVersion = cloneInputVersion(version2, options);
44188
+ return clonedVersion && doTruncation(clonedVersion, truncation);
44189
+ };
44190
+ var cloneInputVersion = (version2, options) => {
44191
+ const versionStringToParse = version2 instanceof SemVer ? version2.version : version2;
44192
+ return parse(versionStringToParse, options);
44193
+ };
44194
+ var doTruncation = (version2, truncation) => {
44195
+ if (isPrerelease(truncation)) {
44196
+ return version2.version;
44197
+ }
44198
+ version2.prerelease = [];
44199
+ switch (truncation) {
44200
+ case "major":
44201
+ version2.minor = 0;
44202
+ version2.patch = 0;
44203
+ break;
44204
+ case "minor":
44205
+ version2.patch = 0;
44206
+ break;
44207
+ }
44208
+ return version2.format();
44209
+ };
44210
+ var isPrerelease = (type) => {
44211
+ return type.startsWith("pre");
44212
+ };
44213
+ module2.exports = truncate;
44214
+ });
44215
+
44091
44216
  // node_modules/semver/internal/lrucache.js
44092
44217
  var require_lrucache = __commonJS((exports2, module2) => {
44093
44218
  class LRUCache {
@@ -45075,6 +45200,7 @@ var require_semver2 = __commonJS((exports2, module2) => {
45075
45200
  var lte = require_lte();
45076
45201
  var cmp = require_cmp();
45077
45202
  var coerce = require_coerce();
45203
+ var truncate = require_truncate();
45078
45204
  var Comparator = require_comparator();
45079
45205
  var Range = require_range();
45080
45206
  var satisfies = require_satisfies();
@@ -45113,6 +45239,7 @@ var require_semver2 = __commonJS((exports2, module2) => {
45113
45239
  lte,
45114
45240
  cmp,
45115
45241
  coerce,
45242
+ truncate,
45116
45243
  Comparator,
45117
45244
  Range,
45118
45245
  satisfies,
@@ -45188,7 +45315,7 @@ var require_isarray = __commonJS((exports2, module2) => {
45188
45315
  };
45189
45316
  });
45190
45317
 
45191
- // node_modules/readable-stream/node_modules/safe-buffer/index.js
45318
+ // node_modules/safe-buffer/index.js
45192
45319
  var require_safe_buffer = __commonJS((exports2, module2) => {
45193
45320
  var buffer = __require("buffer");
45194
45321
  var Buffer3 = buffer.Buffer;
@@ -46042,64 +46169,9 @@ var require__stream_duplex = __commonJS((exports2, module2) => {
46042
46169
  };
46043
46170
  });
46044
46171
 
46045
- // node_modules/string_decoder/node_modules/safe-buffer/index.js
46046
- var require_safe_buffer2 = __commonJS((exports2, module2) => {
46047
- var buffer = __require("buffer");
46048
- var Buffer3 = buffer.Buffer;
46049
- function copyProps(src, dst) {
46050
- for (var key in src) {
46051
- dst[key] = src[key];
46052
- }
46053
- }
46054
- if (Buffer3.from && Buffer3.alloc && Buffer3.allocUnsafe && Buffer3.allocUnsafeSlow) {
46055
- module2.exports = buffer;
46056
- } else {
46057
- copyProps(buffer, exports2);
46058
- exports2.Buffer = SafeBuffer;
46059
- }
46060
- function SafeBuffer(arg, encodingOrOffset, length) {
46061
- return Buffer3(arg, encodingOrOffset, length);
46062
- }
46063
- copyProps(Buffer3, SafeBuffer);
46064
- SafeBuffer.from = function(arg, encodingOrOffset, length) {
46065
- if (typeof arg === "number") {
46066
- throw new TypeError("Argument must not be a number");
46067
- }
46068
- return Buffer3(arg, encodingOrOffset, length);
46069
- };
46070
- SafeBuffer.alloc = function(size, fill, encoding) {
46071
- if (typeof size !== "number") {
46072
- throw new TypeError("Argument must be a number");
46073
- }
46074
- var buf = Buffer3(size);
46075
- if (fill !== undefined) {
46076
- if (typeof encoding === "string") {
46077
- buf.fill(fill, encoding);
46078
- } else {
46079
- buf.fill(fill);
46080
- }
46081
- } else {
46082
- buf.fill(0);
46083
- }
46084
- return buf;
46085
- };
46086
- SafeBuffer.allocUnsafe = function(size) {
46087
- if (typeof size !== "number") {
46088
- throw new TypeError("Argument must be a number");
46089
- }
46090
- return Buffer3(size);
46091
- };
46092
- SafeBuffer.allocUnsafeSlow = function(size) {
46093
- if (typeof size !== "number") {
46094
- throw new TypeError("Argument must be a number");
46095
- }
46096
- return buffer.SlowBuffer(size);
46097
- };
46098
- });
46099
-
46100
46172
  // node_modules/string_decoder/lib/string_decoder.js
46101
46173
  var require_string_decoder = __commonJS((exports2) => {
46102
- var Buffer3 = require_safe_buffer2().Buffer;
46174
+ var Buffer3 = require_safe_buffer().Buffer;
46103
46175
  var isEncoding = Buffer3.isEncoding || function(encoding) {
46104
46176
  encoding = "" + encoding;
46105
46177
  switch (encoding && encoding.toLowerCase()) {
@@ -65661,7 +65733,7 @@ var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
65661
65733
  }));
65662
65734
  };
65663
65735
  // package.json
65664
- var version = "0.1.1397";
65736
+ var version = "0.1.1398";
65665
65737
  var package_default = {
65666
65738
  name: "@tscircuit/cli",
65667
65739
  version,
@@ -65702,7 +65774,7 @@ var package_default = {
65702
65774
  "circuit-json-to-pnp-csv": "^0.0.7",
65703
65775
  "circuit-json-to-readable-netlist": "^0.0.15",
65704
65776
  "circuit-json-to-spice": "^0.0.10",
65705
- "circuit-json-to-step": "^0.0.32",
65777
+ "circuit-json-to-step": "^0.0.33",
65706
65778
  "circuit-json-to-tscircuit": "^0.0.9",
65707
65779
  "circuit-json-trace-length-analysis": "github:tscircuit/circuit-json-trace-length-analysis#2b44792a40df0ca83b6bfb6ac95ed5e35e7168b8",
65708
65780
  commander: "^14.0.0",
@@ -65735,7 +65807,7 @@ var package_default = {
65735
65807
  semver: "^7.6.3",
65736
65808
  stepts: "^0.0.3",
65737
65809
  tempy: "^3.1.0",
65738
- tscircuit: "0.0.1590-libonly",
65810
+ tscircuit: "0.0.1772-libonly",
65739
65811
  tsx: "^4.7.1",
65740
65812
  "typed-ky": "^0.0.4",
65741
65813
  zod: "^3.23.8"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.1398",
3
+ "version": "0.1.1399",
4
4
  "main": "dist/cli/main.js",
5
5
  "exports": {
6
6
  ".": "./dist/cli/main.js",
@@ -38,7 +38,7 @@
38
38
  "circuit-json-to-pnp-csv": "^0.0.7",
39
39
  "circuit-json-to-readable-netlist": "^0.0.15",
40
40
  "circuit-json-to-spice": "^0.0.10",
41
- "circuit-json-to-step": "^0.0.32",
41
+ "circuit-json-to-step": "^0.0.33",
42
42
  "circuit-json-to-tscircuit": "^0.0.9",
43
43
  "circuit-json-trace-length-analysis": "github:tscircuit/circuit-json-trace-length-analysis#2b44792a40df0ca83b6bfb6ac95ed5e35e7168b8",
44
44
  "commander": "^14.0.0",
@@ -71,7 +71,7 @@
71
71
  "semver": "^7.6.3",
72
72
  "stepts": "^0.0.3",
73
73
  "tempy": "^3.1.0",
74
- "tscircuit": "0.0.1590-libonly",
74
+ "tscircuit": "0.0.1772-libonly",
75
75
  "tsx": "^4.7.1",
76
76
  "typed-ky": "^0.0.4",
77
77
  "zod": "^3.23.8"