@tscircuit/cli 0.1.1162 → 0.1.1163

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
@@ -55607,6 +55607,7 @@ var require_constants4 = __commonJS((exports2, module2) => {
55607
55607
  var path14 = __require("path");
55608
55608
  var WIN_SLASH = "\\\\/";
55609
55609
  var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
55610
+ var DEFAULT_MAX_EXTGLOB_RECURSION = 0;
55610
55611
  var DOT_LITERAL = "\\.";
55611
55612
  var PLUS_LITERAL = "\\+";
55612
55613
  var QMARK_LITERAL = "\\?";
@@ -55654,6 +55655,7 @@ var require_constants4 = __commonJS((exports2, module2) => {
55654
55655
  END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
55655
55656
  };
55656
55657
  var POSIX_REGEX_SOURCE = {
55658
+ __proto__: null,
55657
55659
  alnum: "a-zA-Z0-9",
55658
55660
  alpha: "a-zA-Z",
55659
55661
  ascii: "\\x00-\\x7F",
@@ -55670,6 +55672,7 @@ var require_constants4 = __commonJS((exports2, module2) => {
55670
55672
  xdigit: "A-Fa-f0-9"
55671
55673
  };
55672
55674
  module2.exports = {
55675
+ DEFAULT_MAX_EXTGLOB_RECURSION,
55673
55676
  MAX_LENGTH: 1024 * 64,
55674
55677
  POSIX_REGEX_SOURCE,
55675
55678
  REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
@@ -55679,6 +55682,7 @@ var require_constants4 = __commonJS((exports2, module2) => {
55679
55682
  REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
55680
55683
  REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
55681
55684
  REPLACEMENTS: {
55685
+ __proto__: null,
55682
55686
  "***": "*",
55683
55687
  "**/**": "**",
55684
55688
  "**/**/**": "**"
@@ -56144,6 +56148,213 @@ var require_parse3 = __commonJS((exports2, module2) => {
56144
56148
  var syntaxError = (type, char) => {
56145
56149
  return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
56146
56150
  };
56151
+ var splitTopLevel = (input) => {
56152
+ const parts = [];
56153
+ let bracket = 0;
56154
+ let paren = 0;
56155
+ let quote = 0;
56156
+ let value = "";
56157
+ let escaped = false;
56158
+ for (const ch of input) {
56159
+ if (escaped === true) {
56160
+ value += ch;
56161
+ escaped = false;
56162
+ continue;
56163
+ }
56164
+ if (ch === "\\") {
56165
+ value += ch;
56166
+ escaped = true;
56167
+ continue;
56168
+ }
56169
+ if (ch === '"') {
56170
+ quote = quote === 1 ? 0 : 1;
56171
+ value += ch;
56172
+ continue;
56173
+ }
56174
+ if (quote === 0) {
56175
+ if (ch === "[") {
56176
+ bracket++;
56177
+ } else if (ch === "]" && bracket > 0) {
56178
+ bracket--;
56179
+ } else if (bracket === 0) {
56180
+ if (ch === "(") {
56181
+ paren++;
56182
+ } else if (ch === ")" && paren > 0) {
56183
+ paren--;
56184
+ } else if (ch === "|" && paren === 0) {
56185
+ parts.push(value);
56186
+ value = "";
56187
+ continue;
56188
+ }
56189
+ }
56190
+ }
56191
+ value += ch;
56192
+ }
56193
+ parts.push(value);
56194
+ return parts;
56195
+ };
56196
+ var isPlainBranch = (branch) => {
56197
+ let escaped = false;
56198
+ for (const ch of branch) {
56199
+ if (escaped === true) {
56200
+ escaped = false;
56201
+ continue;
56202
+ }
56203
+ if (ch === "\\") {
56204
+ escaped = true;
56205
+ continue;
56206
+ }
56207
+ if (/[?*+@!()[\]{}]/.test(ch)) {
56208
+ return false;
56209
+ }
56210
+ }
56211
+ return true;
56212
+ };
56213
+ var normalizeSimpleBranch = (branch) => {
56214
+ let value = branch.trim();
56215
+ let changed = true;
56216
+ while (changed === true) {
56217
+ changed = false;
56218
+ if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
56219
+ value = value.slice(2, -1);
56220
+ changed = true;
56221
+ }
56222
+ }
56223
+ if (!isPlainBranch(value)) {
56224
+ return;
56225
+ }
56226
+ return value.replace(/\\(.)/g, "$1");
56227
+ };
56228
+ var hasRepeatedCharPrefixOverlap = (branches) => {
56229
+ const values = branches.map(normalizeSimpleBranch).filter(Boolean);
56230
+ for (let i = 0;i < values.length; i++) {
56231
+ for (let j = i + 1;j < values.length; j++) {
56232
+ const a = values[i];
56233
+ const b = values[j];
56234
+ const char = a[0];
56235
+ if (!char || a !== char.repeat(a.length) || b !== char.repeat(b.length)) {
56236
+ continue;
56237
+ }
56238
+ if (a === b || a.startsWith(b) || b.startsWith(a)) {
56239
+ return true;
56240
+ }
56241
+ }
56242
+ }
56243
+ return false;
56244
+ };
56245
+ var parseRepeatedExtglob = (pattern, requireEnd = true) => {
56246
+ if (pattern[0] !== "+" && pattern[0] !== "*" || pattern[1] !== "(") {
56247
+ return;
56248
+ }
56249
+ let bracket = 0;
56250
+ let paren = 0;
56251
+ let quote = 0;
56252
+ let escaped = false;
56253
+ for (let i = 1;i < pattern.length; i++) {
56254
+ const ch = pattern[i];
56255
+ if (escaped === true) {
56256
+ escaped = false;
56257
+ continue;
56258
+ }
56259
+ if (ch === "\\") {
56260
+ escaped = true;
56261
+ continue;
56262
+ }
56263
+ if (ch === '"') {
56264
+ quote = quote === 1 ? 0 : 1;
56265
+ continue;
56266
+ }
56267
+ if (quote === 1) {
56268
+ continue;
56269
+ }
56270
+ if (ch === "[") {
56271
+ bracket++;
56272
+ continue;
56273
+ }
56274
+ if (ch === "]" && bracket > 0) {
56275
+ bracket--;
56276
+ continue;
56277
+ }
56278
+ if (bracket > 0) {
56279
+ continue;
56280
+ }
56281
+ if (ch === "(") {
56282
+ paren++;
56283
+ continue;
56284
+ }
56285
+ if (ch === ")") {
56286
+ paren--;
56287
+ if (paren === 0) {
56288
+ if (requireEnd === true && i !== pattern.length - 1) {
56289
+ return;
56290
+ }
56291
+ return {
56292
+ type: pattern[0],
56293
+ body: pattern.slice(2, i),
56294
+ end: i
56295
+ };
56296
+ }
56297
+ }
56298
+ }
56299
+ };
56300
+ var getStarExtglobSequenceOutput = (pattern) => {
56301
+ let index = 0;
56302
+ const chars = [];
56303
+ while (index < pattern.length) {
56304
+ const match = parseRepeatedExtglob(pattern.slice(index), false);
56305
+ if (!match || match.type !== "*") {
56306
+ return;
56307
+ }
56308
+ const branches = splitTopLevel(match.body).map((branch2) => branch2.trim());
56309
+ if (branches.length !== 1) {
56310
+ return;
56311
+ }
56312
+ const branch = normalizeSimpleBranch(branches[0]);
56313
+ if (!branch || branch.length !== 1) {
56314
+ return;
56315
+ }
56316
+ chars.push(branch);
56317
+ index += match.end + 1;
56318
+ }
56319
+ if (chars.length < 1) {
56320
+ return;
56321
+ }
56322
+ const source = chars.length === 1 ? utils.escapeRegex(chars[0]) : `[${chars.map((ch) => utils.escapeRegex(ch)).join("")}]`;
56323
+ return `${source}*`;
56324
+ };
56325
+ var repeatedExtglobRecursion = (pattern) => {
56326
+ let depth = 0;
56327
+ let value = pattern.trim();
56328
+ let match = parseRepeatedExtglob(value);
56329
+ while (match) {
56330
+ depth++;
56331
+ value = match.body.trim();
56332
+ match = parseRepeatedExtglob(value);
56333
+ }
56334
+ return depth;
56335
+ };
56336
+ var analyzeRepeatedExtglob = (body, options) => {
56337
+ if (options.maxExtglobRecursion === false) {
56338
+ return { risky: false };
56339
+ }
56340
+ const max = typeof options.maxExtglobRecursion === "number" ? options.maxExtglobRecursion : constants.DEFAULT_MAX_EXTGLOB_RECURSION;
56341
+ const branches = splitTopLevel(body).map((branch) => branch.trim());
56342
+ if (branches.length > 1) {
56343
+ if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) {
56344
+ return { risky: true };
56345
+ }
56346
+ }
56347
+ for (const branch of branches) {
56348
+ const safeOutput = getStarExtglobSequenceOutput(branch);
56349
+ if (safeOutput) {
56350
+ return { risky: true, safeOutput };
56351
+ }
56352
+ if (repeatedExtglobRecursion(branch) > max) {
56353
+ return { risky: true };
56354
+ }
56355
+ }
56356
+ return { risky: false };
56357
+ };
56147
56358
  var parse = (input, options) => {
56148
56359
  if (typeof input !== "string") {
56149
56360
  throw new TypeError("Expected a string");
@@ -56276,6 +56487,8 @@ var require_parse3 = __commonJS((exports2, module2) => {
56276
56487
  token.prev = prev;
56277
56488
  token.parens = state.parens;
56278
56489
  token.output = state.output;
56490
+ token.startIndex = state.index;
56491
+ token.tokensIndex = tokens.length;
56279
56492
  const output = (opts.capture ? "(" : "") + token.open;
56280
56493
  increment("parens");
56281
56494
  push({ type, value: value2, output: state.output ? "" : ONE_CHAR });
@@ -56283,6 +56496,26 @@ var require_parse3 = __commonJS((exports2, module2) => {
56283
56496
  extglobs.push(token);
56284
56497
  };
56285
56498
  const extglobClose = (token) => {
56499
+ const literal = input.slice(token.startIndex, state.index + 1);
56500
+ const body = input.slice(token.startIndex + 2, state.index);
56501
+ const analysis = analyzeRepeatedExtglob(body, opts);
56502
+ if ((token.type === "plus" || token.type === "star") && analysis.risky) {
56503
+ const safeOutput = analysis.safeOutput ? (token.output ? "" : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput) : undefined;
56504
+ const open = tokens[token.tokensIndex];
56505
+ open.type = "text";
56506
+ open.value = literal;
56507
+ open.output = safeOutput || utils.escapeRegex(literal);
56508
+ for (let i = token.tokensIndex + 1;i < tokens.length; i++) {
56509
+ tokens[i].value = "";
56510
+ tokens[i].output = "";
56511
+ delete tokens[i].suffix;
56512
+ }
56513
+ state.output = token.output + open.output;
56514
+ state.backtrack = true;
56515
+ push({ type: "paren", extglob: true, value, output: "" });
56516
+ decrement("parens");
56517
+ return;
56518
+ }
56286
56519
  let output = token.close + (opts.capture ? ")" : "");
56287
56520
  let rest;
56288
56521
  if (token.type === "negate") {
@@ -60445,7 +60678,7 @@ var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
60445
60678
  }));
60446
60679
  };
60447
60680
  // package.json
60448
- var version = "0.1.1161";
60681
+ var version = "0.1.1162";
60449
60682
  var package_default = {
60450
60683
  name: "@tscircuit/cli",
60451
60684
  version,
@@ -60509,10 +60742,12 @@ var package_default = {
60509
60742
  redaxios: "^0.5.1",
60510
60743
  semver: "^7.6.3",
60511
60744
  tempy: "^3.1.0",
60512
- tscircuit: "0.0.1519-libonly",
60745
+ tscircuit: "0.0.1563-libonly",
60513
60746
  tsx: "^4.7.1",
60514
60747
  "typed-ky": "^0.0.4",
60515
- zod: "^3.23.8"
60748
+ zod: "^3.23.8",
60749
+ "circuit-json-to-step": "^0.0.19",
60750
+ stepts: "^0.0.3"
60516
60751
  },
60517
60752
  peerDependencies: {
60518
60753
  tscircuit: "*"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.1162",
3
+ "version": "0.1.1163",
4
4
  "main": "dist/cli/main.js",
5
5
  "exports": {
6
6
  ".": "./dist/cli/main.js",
@@ -61,10 +61,12 @@
61
61
  "redaxios": "^0.5.1",
62
62
  "semver": "^7.6.3",
63
63
  "tempy": "^3.1.0",
64
- "tscircuit": "0.0.1519-libonly",
64
+ "tscircuit": "0.0.1563-libonly",
65
65
  "tsx": "^4.7.1",
66
66
  "typed-ky": "^0.0.4",
67
- "zod": "^3.23.8"
67
+ "zod": "^3.23.8",
68
+ "circuit-json-to-step": "^0.0.19",
69
+ "stepts": "^0.0.3"
68
70
  },
69
71
  "peerDependencies": {
70
72
  "tscircuit": "*"