@tscircuit/cli 0.1.1565 → 0.1.1567

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