@tscircuit/cli 0.1.1494 → 0.1.1496

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
@@ -65327,9 +65327,6 @@ class WinterSpecMultiPartFormDataResponse extends WinterSpecResponse {
65327
65327
  return new Response(formData, this.options);
65328
65328
  }
65329
65329
  }
65330
- function createWinterSpecRequest(request, options) {
65331
- return Object.assign(request, options);
65332
- }
65333
65330
  function mergeHeaders(h1, h2) {
65334
65331
  return new Headers(Object.fromEntries([
65335
65332
  ...h1 instanceof Headers ? h1 : new Headers(h1 ?? undefined).entries() ?? [],
@@ -65343,7 +65340,6 @@ var DEFAULT_CONTEXT = {
65343
65340
  multipartFormData: WinterSpecResponse.multipartFormData,
65344
65341
  custom: WinterSpecResponse.custom
65345
65342
  };
65346
- var getDefaultContext = () => ({ ...DEFAULT_CONTEXT });
65347
65343
 
65348
65344
  // node_modules/winterspec/dist/serve/create-node-server-from-route-map.js
65349
65345
  var import_next_route_matcher = __toESM2(require_dist4(), 1);
@@ -65351,7 +65347,233 @@ var import_next_route_matcher = __toESM2(require_dist4(), 1);
65351
65347
  // node_modules/winterspec/dist/create-with-winter-spec.js
65352
65348
  import { z as z2 } from "zod";
65353
65349
 
65354
- // node_modules/winterspec/dist/lib/format-zod-error.js
65350
+ // node_modules/winterspec/dist/middleware/with-input-validation.js
65351
+ import { z, ZodError, ZodFirstPartyTypeKind } from "zod";
65352
+
65353
+ // node_modules/winterspec/dist/serve/create-winter-spec-from-route-map.js
65354
+ var import_next_route_matcher2 = __toESM2(require_dist4(), 1);
65355
+
65356
+ // node_modules/winterspec/dist/adapters/node.js
65357
+ var EdgePrimitives = __toESM2(require_dist2(), 1);
65358
+ var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
65359
+ const transformToNode = transformToNodeBuilder({
65360
+ defaultOrigin: `http://localhost${port ? `:${port}` : ""}`
65361
+ });
65362
+ return transformToNode((req) => winterSpec.makeRequest(req, {
65363
+ middleware
65364
+ }));
65365
+ };
65366
+ // package.json
65367
+ var version = "0.1.1495";
65368
+ var package_default = {
65369
+ name: "@tscircuit/cli",
65370
+ version,
65371
+ main: "dist/cli/main.js",
65372
+ exports: {
65373
+ ".": "./dist/cli/main.js",
65374
+ "./lib": "./dist/lib/index.js"
65375
+ },
65376
+ devDependencies: {
65377
+ "@babel/standalone": "^7.26.9",
65378
+ "@biomejs/biome": "^1.9.4",
65379
+ "@tscircuit/circuit-json-placement-analysis": "^0.0.6",
65380
+ "@tscircuit/circuit-json-routing-analysis": "^0.0.1",
65381
+ "@tscircuit/circuit-json-schematic-placement-analysis": "github:tscircuit/circuit-json-schematic-placement-analysis#b6d5fe675adc26a2fc988aa081e6fb51e6bf696a",
65382
+ "@tscircuit/eval": "^0.0.915",
65383
+ "@tscircuit/fake-snippets": "^0.0.182",
65384
+ "@tscircuit/fake-ul-kicad-proxy": "github:tscircuit/fake-ul-kicad-proxy#d174c33c1b17a52d7a9dc3c2b5506d6fd593bed7",
65385
+ "@tscircuit/file-server": "^0.0.32",
65386
+ "@tscircuit/image-utils": "^0.0.3",
65387
+ "@tscircuit/krt-wasm": "^0.1.0",
65388
+ "@tscircuit/math-utils": "0.0.36",
65389
+ "@tscircuit/props": "^0.0.546",
65390
+ "@tscircuit/runframe": "^0.0.2074",
65391
+ "@tscircuit/schematic-match-adapt": "^0.0.22",
65392
+ "@tscircuit/ti-parts-engine": "github:tscircuit/ti-parts-engine#cead194495b8fbfb73a88b5995ce86a4b61a9d04",
65393
+ "@tscircuit/solver-utils": "0.0.16",
65394
+ "@types/bun": "^1.2.2",
65395
+ "@types/configstore": "^6.0.2",
65396
+ "@types/debug": "^4.1.12",
65397
+ "@types/jsonwebtoken": "^9.0.9",
65398
+ "@types/micromatch": "^4.0.9",
65399
+ "@types/prompts": "^2.4.9",
65400
+ "@types/react": "^19.0.8",
65401
+ "@types/semver": "^7.5.8",
65402
+ "bun-match-svg": "^0.0.12",
65403
+ chokidar: "4.0.1",
65404
+ "circuit-json": "^0.0.425",
65405
+ "circuit-json-to-bom-csv": "^0.0.7",
65406
+ "circuit-json-to-gerber": "^0.0.51",
65407
+ "circuit-json-to-kicad": "0.0.150",
65408
+ "circuit-json-to-pnp-csv": "^0.0.7",
65409
+ "circuit-json-to-readable-netlist": "^0.0.15",
65410
+ "circuit-json-to-spice": "^0.0.10",
65411
+ "circuit-json-to-step": "^0.0.33",
65412
+ "circuit-json-to-tscircuit": "^0.0.35",
65413
+ "circuit-json-trace-length-analysis": "github:tscircuit/circuit-json-trace-length-analysis#2b44792a40df0ca83b6bfb6ac95ed5e35e7168b8",
65414
+ commander: "^14.0.0",
65415
+ conf: "^13.1.0",
65416
+ configstore: "^7.0.0",
65417
+ cosmiconfig: "^9.0.0",
65418
+ debug: "^4.4.0",
65419
+ delay: "^6.0.0",
65420
+ "dsn-converter": "^0.0.90",
65421
+ easyeda: "^0.0.269",
65422
+ "fuse.js": "^7.1.0",
65423
+ "get-port": "^7.1.0",
65424
+ globby: "^14.1.0",
65425
+ jose: "^6.1.0",
65426
+ jsonwebtoken: "^9.0.2",
65427
+ jszip: "^3.10.1",
65428
+ "jwt-decode": "^4.0.0",
65429
+ "kicad-component-converter": "^0.1.40",
65430
+ "kicad-to-circuit-json": "^0.0.96",
65431
+ kicadts: "^0.0.45",
65432
+ kleur: "^4.1.5",
65433
+ ky: "^1.7.4",
65434
+ "make-vfs": "^1.0.15",
65435
+ md5: "^2.3.0",
65436
+ "perfect-cli": "^1.0.21",
65437
+ playwright: "^1.57.0",
65438
+ poppygl: "^0.0.20",
65439
+ prompts: "^2.4.2",
65440
+ redaxios: "^0.5.1",
65441
+ semver: "^7.6.3",
65442
+ stepts: "^0.0.3",
65443
+ tempy: "^3.1.0",
65444
+ tscircuit: "0.0.1885-libonly",
65445
+ tsx: "^4.7.1",
65446
+ "typed-ky": "^0.0.4",
65447
+ zod: "^3.23.8"
65448
+ },
65449
+ peerDependencies: {
65450
+ tscircuit: "*"
65451
+ },
65452
+ bin: {
65453
+ "tscircuit-cli": "./cli/entrypoint.js"
65454
+ },
65455
+ files: [
65456
+ "dist",
65457
+ "cli/entrypoint.js",
65458
+ "types"
65459
+ ],
65460
+ peerDependenciesMeta: {
65461
+ tscircuit: {
65462
+ optional: false
65463
+ }
65464
+ },
65465
+ scripts: {
65466
+ start: "bun run dev",
65467
+ dev: "bun --hot ./cli/main.ts dev ./examples/basic/index.circuit.tsx",
65468
+ "dev:kicad-pcm": "bun --hot ./cli/main.ts dev ./examples/scaffold --kicad-pcm",
65469
+ setup: "bun run build && npm install -g .",
65470
+ build: "bun run build:bun",
65471
+ "build:bun": "bun run scripts/bun-build.ts",
65472
+ smoketest: "docker build --progress=plain -f Dockerfile.smoketest .",
65473
+ format: "biome format --write .",
65474
+ "format:check": "biome format .",
65475
+ cli: "bun ./cli/main.ts",
65476
+ "pkg-pr-new-release": "bunx pkg-pr-new publish --comment=off --peerDeps"
65477
+ },
65478
+ type: "module"
65479
+ };
65480
+
65481
+ // node_modules/@tscircuit/file-server/dist/bundle.js
65482
+ var import_next_route_matcher4 = __toESM2(require_dist4(), 1);
65483
+
65484
+ // node_modules/@tscircuit/file-server/node_modules/winterspec/dist/types/web-handler.js
65485
+ class WinterSpecResponse2 {
65486
+ statusCode() {
65487
+ return this.options.status ?? 200;
65488
+ }
65489
+ status(status) {
65490
+ this.options.status = status;
65491
+ return this;
65492
+ }
65493
+ header(key, value) {
65494
+ this.options.headers = mergeHeaders2(this.options.headers, {
65495
+ [key]: value
65496
+ });
65497
+ return this;
65498
+ }
65499
+ headers(headers) {
65500
+ this.options.headers = mergeHeaders2(this.options.headers, headers);
65501
+ return this;
65502
+ }
65503
+ statusText(statusText) {
65504
+ this.options.statusText = statusText;
65505
+ return this;
65506
+ }
65507
+ constructor(options = {}) {
65508
+ this.options = options;
65509
+ }
65510
+ static json(...args) {
65511
+ return new WinterSpecJsonResponse2(...args);
65512
+ }
65513
+ static multipartFormData(...args) {
65514
+ return new WinterSpecMultiPartFormDataResponse2(...args);
65515
+ }
65516
+ static custom(...args) {
65517
+ return new WinterSpecCustomResponse2(...args);
65518
+ }
65519
+ }
65520
+
65521
+ class WinterSpecJsonResponse2 extends WinterSpecResponse2 {
65522
+ constructor(data, options = {}) {
65523
+ super(options);
65524
+ this.data = data;
65525
+ this.options.headers = mergeHeaders2(this.options.headers, {
65526
+ "Content-Type": "application/json"
65527
+ });
65528
+ }
65529
+ serializeToResponse(schema) {
65530
+ return new Response(JSON.stringify(schema.parse(this.data)), this.options);
65531
+ }
65532
+ }
65533
+
65534
+ class WinterSpecCustomResponse2 extends WinterSpecResponse2 {
65535
+ constructor(data, contentType, options = {}) {
65536
+ super(options);
65537
+ this.data = data;
65538
+ this.contentType = contentType;
65539
+ this.options.headers = mergeHeaders2(this.options.headers, {
65540
+ "Content-Type": contentType
65541
+ });
65542
+ }
65543
+ serializeToResponse(schema) {
65544
+ return new Response(schema.parse(this.data), this.options);
65545
+ }
65546
+ }
65547
+ class WinterSpecMultiPartFormDataResponse2 extends WinterSpecResponse2 {
65548
+ constructor(data, options = {}) {
65549
+ super(options);
65550
+ this.data = data;
65551
+ this.options.headers = mergeHeaders2(this.options.headers, {
65552
+ "Content-Type": "multipart/form-data"
65553
+ });
65554
+ }
65555
+ serializeToResponse(schema) {
65556
+ const formData = new FormData;
65557
+ for (const [key, value] of Object.entries(schema.parse(this.data))) {
65558
+ formData.append(key, value instanceof Blob ? value : String(value));
65559
+ }
65560
+ return new Response(formData, this.options);
65561
+ }
65562
+ }
65563
+ function createWinterSpecRequest2(request, options) {
65564
+ return Object.assign(request, options);
65565
+ }
65566
+ function mergeHeaders2(h1, h2) {
65567
+ return new Headers(Object.fromEntries([
65568
+ ...h1 instanceof Headers ? h1 : new Headers(h1 ?? undefined).entries() ?? [],
65569
+ ...h2 instanceof Headers ? h2 : new Headers(h2 ?? undefined).entries() ?? []
65570
+ ]));
65571
+ }
65572
+
65573
+ // node_modules/@tscircuit/file-server/node_modules/winterspec/dist/create-with-winter-spec.js
65574
+ import { z as z4 } from "zod";
65575
+
65576
+ // node_modules/@tscircuit/file-server/node_modules/winterspec/dist/lib/format-zod-error.js
65355
65577
  var zodIssueToString = (issue) => {
65356
65578
  if (issue.path.join(".") === "") {
65357
65579
  return issue.message;
@@ -65361,7 +65583,7 @@ var zodIssueToString = (issue) => {
65361
65583
  }
65362
65584
  return `${issue.message} for "${issue.path.join(".")}"`;
65363
65585
  };
65364
- var formatZodError = (error) => {
65586
+ var formatZodError2 = (error) => {
65365
65587
  let message;
65366
65588
  if (error.issues.length === 1) {
65367
65589
  const issue = error.issues[0];
@@ -65377,7 +65599,7 @@ var formatZodError = (error) => {
65377
65599
  return message;
65378
65600
  };
65379
65601
 
65380
- // node_modules/winterspec/dist/middleware/http-exceptions.js
65602
+ // node_modules/@tscircuit/file-server/node_modules/winterspec/dist/middleware/http-exceptions.js
65381
65603
  class WinterSpecMiddlewareError extends Error {
65382
65604
  constructor(message, status = 500) {
65383
65605
  super(message);
@@ -65388,79 +65610,79 @@ class WinterSpecMiddlewareError extends Error {
65388
65610
  }
65389
65611
  }
65390
65612
 
65391
- class MethodNotAllowedError extends WinterSpecMiddlewareError {
65613
+ class MethodNotAllowedError2 extends WinterSpecMiddlewareError {
65392
65614
  constructor(allowedMethods) {
65393
65615
  super(`only ${allowedMethods.join(",")} accepted`, 405);
65394
65616
  }
65395
65617
  }
65396
- class BadRequestError extends WinterSpecMiddlewareError {
65618
+ class BadRequestError2 extends WinterSpecMiddlewareError {
65397
65619
  constructor(message) {
65398
65620
  super(message, 400);
65399
65621
  }
65400
65622
  }
65401
65623
 
65402
- class InvalidQueryParamsError extends BadRequestError {
65624
+ class InvalidQueryParamsError2 extends BadRequestError2 {
65403
65625
  constructor(message) {
65404
65626
  super(message);
65405
65627
  }
65406
65628
  }
65407
65629
 
65408
- class InvalidContentTypeError extends BadRequestError {
65630
+ class InvalidContentTypeError2 extends BadRequestError2 {
65409
65631
  constructor(message) {
65410
65632
  super(message);
65411
65633
  }
65412
65634
  }
65413
65635
 
65414
- class InputParsingError extends BadRequestError {
65636
+ class InputParsingError2 extends BadRequestError2 {
65415
65637
  constructor(message) {
65416
65638
  super(message);
65417
65639
  }
65418
65640
  }
65419
65641
 
65420
- class InputValidationError extends BadRequestError {
65642
+ class InputValidationError2 extends BadRequestError2 {
65421
65643
  constructor(error) {
65422
- super(formatZodError(error));
65644
+ super(formatZodError2(error));
65423
65645
  }
65424
65646
  }
65425
65647
 
65426
- class ResponseValidationError extends WinterSpecMiddlewareError {
65648
+ class ResponseValidationError2 extends WinterSpecMiddlewareError {
65427
65649
  constructor(error) {
65428
- super(formatZodError(error), 500);
65650
+ super(formatZodError2(error), 500);
65429
65651
  }
65430
65652
  }
65431
65653
 
65432
- // node_modules/winterspec/dist/middleware/with-methods.js
65433
- var withMethods = (methods) => (req, ctx, next) => {
65654
+ // node_modules/@tscircuit/file-server/node_modules/winterspec/dist/middleware/with-methods.js
65655
+ var withMethods2 = (methods) => (req, ctx, next) => {
65434
65656
  if (!methods.includes(req.method)) {
65435
- throw new MethodNotAllowedError(methods);
65657
+ throw new MethodNotAllowedError2(methods);
65436
65658
  }
65437
65659
  return next(req, ctx);
65438
65660
  };
65439
65661
 
65440
- // node_modules/winterspec/dist/middleware/with-input-validation.js
65441
- import { z, ZodError, ZodFirstPartyTypeKind } from "zod";
65662
+ // node_modules/@tscircuit/file-server/node_modules/winterspec/dist/middleware/with-input-validation.js
65663
+ import { z as z3, ZodError as ZodError2, ZodFirstPartyTypeKind as ZodFirstPartyTypeKind2 } from "zod";
65442
65664
  var getZodObjectSchemaFromZodEffectSchema = (isZodEffect, schema) => {
65443
65665
  if (!isZodEffect) {
65444
65666
  return schema;
65445
65667
  }
65446
65668
  let currentSchema = schema;
65447
- while (currentSchema instanceof z.ZodEffects) {
65669
+ while (currentSchema instanceof z3.ZodEffects) {
65448
65670
  currentSchema = currentSchema._def.schema;
65449
65671
  }
65450
65672
  return currentSchema;
65451
65673
  };
65452
65674
  var getZodDefFromZodSchemaHelpers = (schema) => {
65453
65675
  const special_zod_types = [
65454
- ZodFirstPartyTypeKind.ZodOptional,
65455
- ZodFirstPartyTypeKind.ZodDefault,
65456
- ZodFirstPartyTypeKind.ZodEffects
65676
+ ZodFirstPartyTypeKind2.ZodOptional,
65677
+ ZodFirstPartyTypeKind2.ZodDefault,
65678
+ ZodFirstPartyTypeKind2.ZodEffects
65457
65679
  ];
65458
65680
  while (special_zod_types.includes(schema._def.typeName)) {
65459
- if (schema._def.typeName === ZodFirstPartyTypeKind.ZodOptional || schema._def.typeName === ZodFirstPartyTypeKind.ZodDefault) {
65681
+ if (schema._def.typeName === ZodFirstPartyTypeKind2.ZodOptional || schema._def.typeName === ZodFirstPartyTypeKind2.ZodDefault) {
65460
65682
  schema = schema._def.innerType;
65461
65683
  continue;
65462
65684
  }
65463
- if (schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects) {
65685
+ if (schema._def.typeName === ZodFirstPartyTypeKind2.ZodEffects) {
65464
65686
  schema = schema._def.schema;
65465
65687
  continue;
65466
65688
  }
@@ -65468,9 +65690,9 @@ var getZodDefFromZodSchemaHelpers = (schema) => {
65468
65690
  return schema._def;
65469
65691
  };
65470
65692
  var tryGetZodSchemaAsObject = (schema) => {
65471
- const isZodEffect = schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects;
65693
+ const isZodEffect = schema._def.typeName === ZodFirstPartyTypeKind2.ZodEffects;
65472
65694
  const safe_schema = getZodObjectSchemaFromZodEffectSchema(isZodEffect, schema);
65473
- const isZodObject = safe_schema._def.typeName === ZodFirstPartyTypeKind.ZodObject;
65695
+ const isZodObject = safe_schema._def.typeName === ZodFirstPartyTypeKind2.ZodObject;
65474
65696
  if (!isZodObject) {
65475
65697
  return;
65476
65698
  }
@@ -65478,11 +65700,11 @@ var tryGetZodSchemaAsObject = (schema) => {
65478
65700
  };
65479
65701
  var isZodSchemaArray = (schema) => {
65480
65702
  const def = getZodDefFromZodSchemaHelpers(schema);
65481
- return def.typeName === ZodFirstPartyTypeKind.ZodArray;
65703
+ return def.typeName === ZodFirstPartyTypeKind2.ZodArray;
65482
65704
  };
65483
65705
  var isZodSchemaBoolean = (schema) => {
65484
65706
  const def = getZodDefFromZodSchemaHelpers(schema);
65485
- return def.typeName === ZodFirstPartyTypeKind.ZodBoolean;
65707
+ return def.typeName === ZodFirstPartyTypeKind2.ZodBoolean;
65486
65708
  };
65487
65709
  var parseQueryParams = (schema, input, supportedArrayFormats) => {
65488
65710
  const parsed_input = Object.assign({}, input);
@@ -65525,7 +65747,7 @@ var validateQueryParams = (inputUrl, schema, supportedArrayFormats) => {
65525
65747
  for (const [schemaKey, value] of Object.entries(obj_schema.shape)) {
65526
65748
  if (isZodSchemaArray(value)) {
65527
65749
  if (key === `${schemaKey}[]` && !supportedArrayFormats.includes("brackets")) {
65528
- throw new InvalidQueryParamsError(`Bracket syntax not supported for query param "${schemaKey}"`);
65750
+ throw new InvalidQueryParamsError2(`Bracket syntax not supported for query param "${schemaKey}"`);
65529
65751
  }
65530
65752
  }
65531
65753
  }
@@ -65533,26 +65755,26 @@ var validateQueryParams = (inputUrl, schema, supportedArrayFormats) => {
65533
65755
  if (key_schema) {
65534
65756
  if (isZodSchemaArray(key_schema)) {
65535
65757
  if (seenKeys.has(key) && !supportedArrayFormats.includes("repeat")) {
65536
- throw new InvalidQueryParamsError(`Repeated parameters not supported for duplicate query param "${key}"`);
65758
+ throw new InvalidQueryParamsError2(`Repeated parameters not supported for duplicate query param "${key}"`);
65537
65759
  }
65538
65760
  }
65539
65761
  }
65540
65762
  seenKeys.add(key);
65541
65763
  }
65542
65764
  };
65543
- var withInputValidation = (input) => async (req, ctx, next) => {
65765
+ var withInputValidation2 = (input) => async (req, ctx, next) => {
65544
65766
  const { supportedArrayFormats } = input;
65545
65767
  if (input.formData && input.jsonBody || input.formData && input.commonParams) {
65546
65768
  throw new Error("Cannot use formData with jsonBody or commonParams");
65547
65769
  }
65548
65770
  if ((req.method === "POST" || req.method === "PATCH") && (input.jsonBody || input.commonParams) && !req.headers.get("content-type")?.includes("application/json")) {
65549
- throw new InvalidContentTypeError(`${req.method} requests must have Content-Type header with "application/json"`);
65771
+ throw new InvalidContentTypeError2(`${req.method} requests must have Content-Type header with "application/json"`);
65550
65772
  }
65551
65773
  if (input.urlEncodedFormData && req.method !== "GET" && !req.headers.get("content-type")?.includes("application/x-www-form-urlencoded")) {
65552
- throw new InvalidContentTypeError(`Must have Content-Type header with "application/x-www-form-urlencoded"`);
65774
+ throw new InvalidContentTypeError2(`Must have Content-Type header with "application/x-www-form-urlencoded"`);
65553
65775
  }
65554
65776
  if (input.formData && (req.method === "POST" || req.method === "PATCH") && !req.headers.get("content-type")?.includes("multipart/form-data")) {
65555
- throw new InvalidContentTypeError(`${req.method} requests must have Content-Type header with "multipart/form-data"`);
65777
+ throw new InvalidContentTypeError2(`${req.method} requests must have Content-Type header with "multipart/form-data"`);
65556
65778
  }
65557
65779
  const originalParams = Object.fromEntries(new URL(req.url).searchParams.entries());
65558
65780
  let jsonBody;
@@ -65561,7 +65783,7 @@ var withInputValidation = (input) => async (req, ctx, next) => {
65561
65783
  jsonBody = await req.clone().json();
65562
65784
  } catch (e) {
65563
65785
  if (!input.jsonBody?.isOptional()) {
65564
- throw new InputParsingError("Error while parsing JSON body");
65786
+ throw new InputParsingError2("Error while parsing JSON body");
65565
65787
  }
65566
65788
  }
65567
65789
  }
@@ -65572,7 +65794,7 @@ var withInputValidation = (input) => async (req, ctx, next) => {
65572
65794
  multiPartFormData = Object.fromEntries(multiPartFormData.entries());
65573
65795
  } catch (e) {
65574
65796
  if (!input.formData?.isOptional()) {
65575
- throw new InputParsingError("Error while parsing form data");
65797
+ throw new InputParsingError2("Error while parsing form data");
65576
65798
  }
65577
65799
  }
65578
65800
  }
@@ -65583,7 +65805,7 @@ var withInputValidation = (input) => async (req, ctx, next) => {
65583
65805
  urlEncodedFormData = Object.fromEntries(params2.entries());
65584
65806
  } catch (e) {
65585
65807
  if (!input.urlEncodedFormData?.isOptional()) {
65586
- throw new InputParsingError("Error while parsing url encoded form data");
65808
+ throw new InputParsingError2("Error while parsing url encoded form data");
65587
65809
  }
65588
65810
  }
65589
65811
  }
@@ -65616,19 +65838,19 @@ var withInputValidation = (input) => async (req, ctx, next) => {
65616
65838
  req.commonParams = parseQueryParams(input.commonParams, originalCombinedParams, supportedArrayFormats);
65617
65839
  }
65618
65840
  } catch (error) {
65619
- if (error instanceof BadRequestError) {
65841
+ if (error instanceof BadRequestError2) {
65620
65842
  throw error;
65621
65843
  }
65622
- if (error instanceof ZodError) {
65623
- throw new InputValidationError(error);
65844
+ if (error instanceof ZodError2) {
65845
+ throw new InputValidationError2(error);
65624
65846
  }
65625
- throw new InputParsingError("Error while parsing input");
65847
+ throw new InputParsingError2("Error while parsing input");
65626
65848
  }
65627
65849
  return next(req, ctx);
65628
65850
  };
65629
65851
 
65630
- // node_modules/winterspec/dist/middleware/with-unhandled-exception-handling.js
65631
- var withUnhandledExceptionHandling = async (req, ctx, next) => {
65852
+ // node_modules/@tscircuit/file-server/node_modules/winterspec/dist/middleware/with-unhandled-exception-handling.js
65853
+ var withUnhandledExceptionHandling2 = async (req, ctx, next) => {
65632
65854
  try {
65633
65855
  return await next(req, ctx);
65634
65856
  } catch (e) {
@@ -65645,7 +65867,7 @@ var withUnhandledExceptionHandling = async (req, ctx, next) => {
65645
65867
  }
65646
65868
  };
65647
65869
 
65648
- // node_modules/winterspec/dist/create-with-winter-spec.js
65870
+ // node_modules/@tscircuit/file-server/node_modules/winterspec/dist/create-with-winter-spec.js
65649
65871
  var attachMetadataToRouteFn = ({ globalSpec, routeSpec }, routeFn) => {
65650
65872
  routeFn._globalSpec = globalSpec;
65651
65873
  routeFn._routeSpec = routeSpec;
@@ -65659,16 +65881,16 @@ var createWithWinterSpec = (globalSpec) => {
65659
65881
  const onMultipleAuthMiddlewareFailures = globalSpec.onMultipleAuthMiddlewareFailures ?? routeSpec.onMultipleAuthMiddlewareFailures;
65660
65882
  const supportedAuthMiddlewares = new Set(routeSpec.auth == null || routeSpec.auth === "none" ? [] : Array.isArray(routeSpec.auth) ? routeSpec.auth : [routeSpec.auth]);
65661
65883
  const authMiddlewares = Object.entries(globalSpec.authMiddleware).filter(([k, _]) => supportedAuthMiddlewares.has(k)).map(([_, v]) => v);
65662
- return await wrapMiddlewares([
65884
+ return await wrapMiddlewares2([
65663
65885
  ...typeof _injectedWinterSpecMiddleware !== "undefined" ? _injectedWinterSpecMiddleware : [],
65664
- withUnhandledExceptionHandling,
65886
+ withUnhandledExceptionHandling2,
65665
65887
  serializeResponse(globalSpec, routeSpec, false),
65666
65888
  ...globalSpec.beforeAuthMiddleware ?? [],
65667
65889
  firstAuthMiddlewareThatSucceeds(authMiddlewares, onMultipleAuthMiddlewareFailures),
65668
65890
  ...globalSpec.afterAuthMiddleware ?? [],
65669
65891
  ...routeSpec.middleware ?? [],
65670
- withMethods(routeSpec.methods),
65671
- withInputValidation({
65892
+ withMethods2(routeSpec.methods),
65893
+ withInputValidation2({
65672
65894
  supportedArrayFormats: globalSpec.supportedArrayFormats ?? [
65673
65895
  "brackets",
65674
65896
  "comma",
@@ -65688,17 +65910,17 @@ var createWithWinterSpec = (globalSpec) => {
65688
65910
  function serializeResponse(globalSpec, routeSpec, skipValidation = false) {
65689
65911
  return async (req, ctx, next) => {
65690
65912
  const rawResponse = await next(req, ctx);
65691
- const statusCode = rawResponse instanceof WinterSpecResponse ? rawResponse.statusCode() : rawResponse.status;
65913
+ const statusCode = rawResponse instanceof WinterSpecResponse2 ? rawResponse.statusCode() : rawResponse.status;
65692
65914
  const isSuccess = statusCode >= 200 && statusCode < 300;
65693
65915
  try {
65694
65916
  const response = serializeToResponse(isSuccess && !skipValidation && (globalSpec.shouldValidateResponses ?? true), routeSpec, rawResponse);
65695
65917
  return response;
65696
65918
  } catch (err) {
65697
- throw new ResponseValidationError(err);
65919
+ throw new ResponseValidationError2(err);
65698
65920
  }
65699
65921
  };
65700
65922
  }
65701
- async function wrapMiddlewares(middlewares, routeFn, request, ctx) {
65923
+ async function wrapMiddlewares2(middlewares, routeFn, request, ctx) {
65702
65924
  return await middlewares.reduceRight((next, middleware) => {
65703
65925
  return async (req, ctx2) => {
65704
65926
  return middleware(req, ctx2, next);
@@ -65707,17 +65929,17 @@ async function wrapMiddlewares(middlewares, routeFn, request, ctx) {
65707
65929
  }
65708
65930
  function serializeToResponse(shouldValidateResponse, routeSpec, response) {
65709
65931
  if (!shouldValidateResponse) {
65710
- return "serializeToResponse" in response ? response.serializeToResponse(z2.any()) : response;
65932
+ return "serializeToResponse" in response ? response.serializeToResponse(z4.any()) : response;
65711
65933
  }
65712
- if (response instanceof WinterSpecResponse) {
65713
- if (response instanceof WinterSpecJsonResponse) {
65714
- return response.serializeToResponse(routeSpec.jsonResponse ?? z2.any());
65934
+ if (response instanceof WinterSpecResponse2) {
65935
+ if (response instanceof WinterSpecJsonResponse2) {
65936
+ return response.serializeToResponse(routeSpec.jsonResponse ?? z4.any());
65715
65937
  }
65716
- if (response instanceof WinterSpecMultiPartFormDataResponse) {
65717
- return response.serializeToResponse(routeSpec.multipartFormDataResponse ?? z2.any());
65938
+ if (response instanceof WinterSpecMultiPartFormDataResponse2) {
65939
+ return response.serializeToResponse(routeSpec.multipartFormDataResponse ?? z4.any());
65718
65940
  }
65719
- if (response instanceof WinterSpecCustomResponse) {
65720
- return response.serializeToResponse(z2.any());
65941
+ if (response instanceof WinterSpecCustomResponse2) {
65942
+ return response.serializeToResponse(z4.any());
65721
65943
  }
65722
65944
  }
65723
65945
  if ("serializeToResponse" in response) {
@@ -65754,8 +65976,16 @@ function firstAuthMiddlewareThatSucceeds(authMiddlewares, onMultipleAuthMiddlewa
65754
65976
  };
65755
65977
  }
65756
65978
 
65757
- // node_modules/winterspec/dist/types/winter-spec.js
65758
- function makeRequestAgainstWinterSpec(winterSpec, options = {}) {
65979
+ // node_modules/@tscircuit/file-server/node_modules/winterspec/dist/types/context.js
65980
+ var DEFAULT_CONTEXT2 = {
65981
+ json: WinterSpecResponse2.json,
65982
+ multipartFormData: WinterSpecResponse2.multipartFormData,
65983
+ custom: WinterSpecResponse2.custom
65984
+ };
65985
+ var getDefaultContext2 = () => ({ ...DEFAULT_CONTEXT2 });
65986
+
65987
+ // node_modules/@tscircuit/file-server/node_modules/winterspec/dist/types/winter-spec.js
65988
+ function makeRequestAgainstWinterSpec2(winterSpec, options = {}) {
65759
65989
  return async (request) => {
65760
65990
  const { routeMatcher, routeMapWithHandlers, handle404 = () => new Response("Not found", {
65761
65991
  status: 404
@@ -65783,154 +66013,27 @@ function makeRequestAgainstWinterSpec(winterSpec, options = {}) {
65783
66013
  }
65784
66014
  const { matchedRoute, routeParams } = routeMatcher(pathname) ?? {};
65785
66015
  let routeFn = matchedRoute && routeMapWithHandlers[matchedRoute];
65786
- const winterSpecRequest = createWinterSpecRequest(request, {
66016
+ const winterSpecRequest = createWinterSpecRequest2(request, {
65787
66017
  winterSpec,
65788
66018
  routeParams: routeParams ?? {}
65789
66019
  });
65790
66020
  if (!routeFn) {
65791
- return await handle404(winterSpecRequest, getDefaultContext());
66021
+ return await handle404(winterSpecRequest, getDefaultContext2());
65792
66022
  }
65793
- return wrapMiddlewares(options.middleware ?? [], routeFn, winterSpecRequest, getDefaultContext());
66023
+ return wrapMiddlewares2(options.middleware ?? [], routeFn, winterSpecRequest, getDefaultContext2());
65794
66024
  };
65795
66025
  }
65796
-
65797
- // node_modules/winterspec/dist/serve/create-winter-spec-from-route-map.js
65798
- var import_next_route_matcher2 = __toESM2(require_dist4(), 1);
65799
-
65800
- // node_modules/winterspec/dist/adapters/node.js
65801
- var EdgePrimitives = __toESM2(require_dist2(), 1);
65802
- var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
65803
- const transformToNode = transformToNodeBuilder({
65804
- defaultOrigin: `http://localhost${port ? `:${port}` : ""}`
65805
- });
65806
- return transformToNode((req) => winterSpec.makeRequest(req, {
65807
- middleware
65808
- }));
65809
- };
65810
- // package.json
65811
- var version = "0.1.1493";
65812
- var package_default = {
65813
- name: "@tscircuit/cli",
65814
- version,
65815
- main: "dist/cli/main.js",
65816
- exports: {
65817
- ".": "./dist/cli/main.js",
65818
- "./lib": "./dist/lib/index.js"
65819
- },
65820
- devDependencies: {
65821
- "@babel/standalone": "^7.26.9",
65822
- "@biomejs/biome": "^1.9.4",
65823
- "@tscircuit/circuit-json-placement-analysis": "^0.0.6",
65824
- "@tscircuit/circuit-json-routing-analysis": "^0.0.1",
65825
- "@tscircuit/circuit-json-schematic-placement-analysis": "github:tscircuit/circuit-json-schematic-placement-analysis#b6d5fe675adc26a2fc988aa081e6fb51e6bf696a",
65826
- "@tscircuit/eval": "^0.0.915",
65827
- "@tscircuit/fake-snippets": "^0.0.182",
65828
- "@tscircuit/file-server": "^0.0.32",
65829
- "@tscircuit/image-utils": "^0.0.3",
65830
- "@tscircuit/krt-wasm": "^0.1.0",
65831
- "@tscircuit/math-utils": "0.0.36",
65832
- "@tscircuit/props": "^0.0.546",
65833
- "@tscircuit/runframe": "^0.0.2074",
65834
- "@tscircuit/schematic-match-adapt": "^0.0.22",
65835
- "@tscircuit/solver-utils": "0.0.16",
65836
- "@types/bun": "^1.2.2",
65837
- "@types/configstore": "^6.0.2",
65838
- "@types/debug": "^4.1.12",
65839
- "@types/jsonwebtoken": "^9.0.9",
65840
- "@types/micromatch": "^4.0.9",
65841
- "@types/prompts": "^2.4.9",
65842
- "@types/react": "^19.0.8",
65843
- "@types/semver": "^7.5.8",
65844
- "bun-match-svg": "^0.0.12",
65845
- chokidar: "4.0.1",
65846
- "circuit-json": "^0.0.425",
65847
- "circuit-json-to-bom-csv": "^0.0.7",
65848
- "circuit-json-to-gerber": "^0.0.51",
65849
- "circuit-json-to-kicad": "0.0.150",
65850
- "circuit-json-to-pnp-csv": "^0.0.7",
65851
- "circuit-json-to-readable-netlist": "^0.0.15",
65852
- "circuit-json-to-spice": "^0.0.10",
65853
- "circuit-json-to-step": "^0.0.33",
65854
- "circuit-json-to-tscircuit": "^0.0.35",
65855
- "circuit-json-trace-length-analysis": "github:tscircuit/circuit-json-trace-length-analysis#2b44792a40df0ca83b6bfb6ac95ed5e35e7168b8",
65856
- commander: "^14.0.0",
65857
- conf: "^13.1.0",
65858
- configstore: "^7.0.0",
65859
- cosmiconfig: "^9.0.0",
65860
- debug: "^4.4.0",
65861
- delay: "^6.0.0",
65862
- "dsn-converter": "^0.0.90",
65863
- easyeda: "^0.0.269",
65864
- "fuse.js": "^7.1.0",
65865
- "get-port": "^7.1.0",
65866
- globby: "^14.1.0",
65867
- jose: "^6.1.0",
65868
- jsonwebtoken: "^9.0.2",
65869
- jszip: "^3.10.1",
65870
- "jwt-decode": "^4.0.0",
65871
- "kicad-component-converter": "^0.1.40",
65872
- "kicad-to-circuit-json": "^0.0.94",
65873
- kicadts: "^0.0.45",
65874
- kleur: "^4.1.5",
65875
- ky: "^1.7.4",
65876
- "make-vfs": "^1.0.15",
65877
- md5: "^2.3.0",
65878
- "perfect-cli": "^1.0.21",
65879
- playwright: "^1.57.0",
65880
- poppygl: "^0.0.20",
65881
- prompts: "^2.4.2",
65882
- redaxios: "^0.5.1",
65883
- semver: "^7.6.3",
65884
- stepts: "^0.0.3",
65885
- tempy: "^3.1.0",
65886
- tscircuit: "^0.0.1849-libonly",
65887
- tsx: "^4.7.1",
65888
- "typed-ky": "^0.0.4",
65889
- zod: "^3.23.8"
65890
- },
65891
- peerDependencies: {
65892
- tscircuit: "*"
65893
- },
65894
- bin: {
65895
- "tscircuit-cli": "./cli/entrypoint.js"
65896
- },
65897
- files: [
65898
- "dist",
65899
- "cli/entrypoint.js",
65900
- "types"
65901
- ],
65902
- peerDependenciesMeta: {
65903
- tscircuit: {
65904
- optional: false
65905
- }
65906
- },
65907
- scripts: {
65908
- start: "bun run dev",
65909
- dev: "bun --hot ./cli/main.ts dev ./examples/basic/index.circuit.tsx",
65910
- "dev:kicad-pcm": "bun --hot ./cli/main.ts dev ./examples/scaffold --kicad-pcm",
65911
- setup: "bun run build && npm install -g .",
65912
- build: "bun run build:bun",
65913
- "build:bun": "bun run scripts/bun-build.ts",
65914
- smoketest: "docker build --progress=plain -f Dockerfile.smoketest .",
65915
- format: "biome format --write .",
65916
- "format:check": "biome format .",
65917
- cli: "bun ./cli/main.ts",
65918
- "pkg-pr-new-release": "bunx pkg-pr-new publish --comment=off --peerDeps"
65919
- },
65920
- type: "module"
65921
- };
65922
-
65923
- // node_modules/@tscircuit/file-server/dist/bundle.js
65924
- var import_next_route_matcher3 = __toESM2(require_dist4(), 1);
65925
- // node_modules/winterspec/dist/config/config.js
65926
- import { z as z3 } from "zod";
65927
- var winterSpecConfigSchema = z3.object({
65928
- rootDirectory: z3.string().optional(),
65929
- tsconfigPath: z3.string().optional(),
65930
- routesDirectory: z3.string().optional(),
65931
- platform: z3.enum(["node", "wintercg-minimal"]).default("wintercg-minimal").optional()
66026
+ // node_modules/@tscircuit/file-server/node_modules/winterspec/dist/config/config.js
66027
+ import { z as z5 } from "zod";
66028
+ var winterSpecConfigSchema = z5.object({
66029
+ rootDirectory: z5.string().optional(),
66030
+ tsconfigPath: z5.string().optional(),
66031
+ routesDirectory: z5.string().optional(),
66032
+ platform: z5.enum(["node", "wintercg-minimal"]).default("wintercg-minimal").optional()
65932
66033
  }).strict();
65933
- // node_modules/zustand/esm/vanilla.mjs
66034
+ // node_modules/@tscircuit/file-server/node_modules/winterspec/dist/serve/create-winter-spec-from-route-map.js
66035
+ var import_next_route_matcher3 = __toESM2(require_dist4(), 1);
66036
+ // node_modules/@tscircuit/file-server/node_modules/zustand/esm/vanilla.mjs
65934
66037
  var createStoreImpl = (createState) => {
65935
66038
  let state;
65936
66039
  const listeners = /* @__PURE__ */ new Set;
@@ -65997,16 +66100,16 @@ var hoist = (store) => {
65997
66100
  return hoistState(hoistActions(store));
65998
66101
  };
65999
66102
 
66000
- // node_modules/zustand/esm/middleware.mjs
66103
+ // node_modules/@tscircuit/file-server/node_modules/zustand/esm/middleware.mjs
66001
66104
  var combine = (initialState, create) => (...a) => Object.assign({}, initialState, create(...a));
66002
66105
 
66003
66106
  // node_modules/@tscircuit/file-server/dist/bundle.js
66004
- import { z as z4 } from "zod";
66107
+ import { z as z6 } from "zod";
66005
66108
  import { z as z22 } from "zod";
66006
66109
  import { z as z32 } from "zod";
66007
66110
  import { z as z42 } from "zod";
66008
- import { z as z5 } from "zod";
66009
- import { z as z6 } from "zod";
66111
+ import { z as z52 } from "zod";
66112
+ import { z as z62 } from "zod";
66010
66113
  import { z as z7 } from "zod";
66011
66114
  import { z as z8 } from "zod";
66012
66115
  import { z as z9 } from "zod";
@@ -66022,31 +66125,31 @@ import { z as z17 } from "zod";
66022
66125
  import { z as z18 } from "zod";
66023
66126
  import { z as z19 } from "zod";
66024
66127
  import { z as z20 } from "zod";
66025
- var fileSchema = z4.object({
66026
- file_id: z4.string(),
66027
- file_path: z4.string(),
66028
- text_content: z4.string().optional(),
66029
- binary_content_b64: z4.string().optional(),
66030
- created_at: z4.string()
66128
+ var fileSchema = z6.object({
66129
+ file_id: z6.string(),
66130
+ file_path: z6.string(),
66131
+ text_content: z6.string().optional(),
66132
+ binary_content_b64: z6.string().optional(),
66133
+ created_at: z6.string()
66031
66134
  }).refine((data) => data.text_content !== undefined !== (data.binary_content_b64 !== undefined), {
66032
66135
  message: "Provide either text_content or binary_content_b64",
66033
66136
  path: ["text_content"]
66034
66137
  });
66035
- var eventSchema = z4.object({
66036
- event_id: z4.string(),
66037
- event_type: z4.union([
66038
- z4.literal("FILE_UPDATED"),
66039
- z4.literal("FILE_DELETED"),
66040
- z4.literal("FILE_CREATED")
66138
+ var eventSchema = z6.object({
66139
+ event_id: z6.string(),
66140
+ event_type: z6.union([
66141
+ z6.literal("FILE_UPDATED"),
66142
+ z6.literal("FILE_DELETED"),
66143
+ z6.literal("FILE_CREATED")
66041
66144
  ]),
66042
- file_path: z4.string(),
66043
- created_at: z4.string(),
66044
- initiator: z4.string().optional()
66145
+ file_path: z6.string(),
66146
+ created_at: z6.string(),
66147
+ initiator: z6.string().optional()
66045
66148
  });
66046
- var databaseSchema = z4.object({
66047
- idCounter: z4.number().default(0),
66048
- files: z4.array(fileSchema).default([]),
66049
- events: z4.array(eventSchema).default([])
66149
+ var databaseSchema = z6.object({
66150
+ idCounter: z6.number().default(0),
66151
+ files: z6.array(fileSchema).default([]),
66152
+ events: z6.array(eventSchema).default([])
66050
66153
  });
66051
66154
  function normalizePath(path) {
66052
66155
  if (!path || path === "/")
@@ -66383,7 +66486,7 @@ var get_default = withRouteSpec({
66383
66486
  });
66384
66487
  var list_default2 = withRouteSpec({
66385
66488
  methods: ["GET"],
66386
- jsonResponse: z5.any()
66489
+ jsonResponse: z52.any()
66387
66490
  })((req, ctx) => {
66388
66491
  const files = ctx.db.files;
66389
66492
  return new Response(`<html>
@@ -66424,7 +66527,7 @@ var list_default2 = withRouteSpec({
66424
66527
  });
66425
66528
  var admin_default = withRouteSpec({
66426
66529
  methods: ["GET"],
66427
- jsonResponse: z6.any()
66530
+ jsonResponse: z62.any()
66428
66531
  })((req, ctx) => {
66429
66532
  return new Response(`<html>
66430
66533
  <head>
@@ -66874,9 +66977,9 @@ var routeMapWithHandlers = {
66874
66977
  "/": routes_default
66875
66978
  };
66876
66979
  var winterSpec = {
66877
- routeMatcher: import_next_route_matcher3.getRouteMatcher(Object.keys(routeMapWithHandlers)),
66980
+ routeMatcher: import_next_route_matcher4.getRouteMatcher(Object.keys(routeMapWithHandlers)),
66878
66981
  routeMapWithHandlers,
66879
- makeRequest: async (req, options) => makeRequestAgainstWinterSpec(winterSpec, options)(req)
66982
+ makeRequest: async (req, options) => makeRequestAgainstWinterSpec2(winterSpec, options)(req)
66880
66983
  };
66881
66984
  var stdin_default = winterSpec;
66882
66985
 
@@ -77444,7 +77547,7 @@ var validateAndMerge = (...sources) => {
77444
77547
  }
77445
77548
  return deepMerge({}, ...sources);
77446
77549
  };
77447
- var mergeHeaders2 = (source1 = {}, source2 = {}) => {
77550
+ var mergeHeaders3 = (source1 = {}, source2 = {}) => {
77448
77551
  const result = new globalThis.Headers(source1);
77449
77552
  const isHeadersInstance = source2 instanceof globalThis.Headers;
77450
77553
  const source = new globalThis.Headers(source2);
@@ -77544,7 +77647,7 @@ var deepMerge = (...sources) => {
77544
77647
  returnValue.hooks = hooks;
77545
77648
  }
77546
77649
  if (isObject2(source.headers)) {
77547
- headers = mergeHeaders2(headers, source.headers);
77650
+ headers = mergeHeaders3(headers, source.headers);
77548
77651
  returnValue.headers = headers;
77549
77652
  }
77550
77653
  }
@@ -77787,7 +77890,7 @@ class Ky {
77787
77890
  this.#input = input;
77788
77891
  this.#options = {
77789
77892
  ...options,
77790
- headers: mergeHeaders2(this.#input.headers, options.headers),
77893
+ headers: mergeHeaders3(this.#input.headers, options.headers),
77791
77894
  hooks: mergeHooks({
77792
77895
  beforeRequest: [],
77793
77896
  beforeRetry: [],