@tscircuit/cli 0.1.607 → 0.1.608

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.
Files changed (2) hide show
  1. package/dist/main.js +32 -3
  2. package/package.json +3 -3
package/dist/main.js CHANGED
@@ -72479,7 +72479,7 @@ var package_default = {
72479
72479
  "bun-match-svg": "^0.0.12",
72480
72480
  chokidar: "4.0.1",
72481
72481
  "circuit-json": "0.0.325",
72482
- "circuit-json-to-gltf": "^0.0.14",
72482
+ "circuit-json-to-gltf": "^0.0.51",
72483
72483
  "circuit-json-to-kicad": "^0.0.3",
72484
72484
  "circuit-json-to-readable-netlist": "^0.0.13",
72485
72485
  "circuit-json-to-spice": "^0.0.10",
@@ -72514,7 +72514,7 @@ var package_default = {
72514
72514
  semver: "^7.6.3",
72515
72515
  sharp: "0.32.6",
72516
72516
  tempy: "^3.1.0",
72517
- tscircuit: "^0.0.1008-libonly",
72517
+ tscircuit: "^0.0.1014-libonly",
72518
72518
  tsx: "^4.7.1",
72519
72519
  "typed-ky": "^0.0.4",
72520
72520
  zod: "^3.23.8"
@@ -183196,6 +183196,7 @@ ${scriptBlock} <script src="https://cdn.tailwindcss.com"></script>
183196
183196
  // cli/build/build-preview-images.ts
183197
183197
  import fs34 from "node:fs";
183198
183198
  import path34 from "node:path";
183199
+ import { pathToFileURL as pathToFileURL2 } from "node:url";
183199
183200
  import {
183200
183201
  convertCircuitJsonToPcbSvg as convertCircuitJsonToPcbSvg2,
183201
183202
  convertCircuitJsonToSchematicSvg as convertCircuitJsonToSchematicSvg2
@@ -183235,6 +183236,33 @@ var normalizeToUint8Array = (value) => {
183235
183236
  }
183236
183237
  throw new Error("Expected Uint8Array, ArrayBuffer, or ArrayBufferView for PNG");
183237
183238
  };
183239
+ var convertModelUrlsToFileUrls = (circuitJson) => {
183240
+ const modelUrlKeys = [
183241
+ "model_glb_url",
183242
+ "glb_model_url",
183243
+ "model_stl_url",
183244
+ "stl_model_url",
183245
+ "model_obj_url",
183246
+ "obj_model_url",
183247
+ "model_gltf_url",
183248
+ "gltf_model_url"
183249
+ ];
183250
+ return circuitJson.map((element) => {
183251
+ if (!element || typeof element !== "object")
183252
+ return element;
183253
+ const updated = { ...element };
183254
+ for (const key of modelUrlKeys) {
183255
+ const value = updated[key];
183256
+ if (typeof value === "string" && value.length > 0) {
183257
+ console.log("value", value);
183258
+ if (!value.match(/^[a-zA-Z]+:\/\//) && (value.startsWith("/") || value.match(/^[a-zA-Z]:\\/))) {
183259
+ updated[key] = pathToFileURL2(value).href;
183260
+ }
183261
+ }
183262
+ }
183263
+ return updated;
183264
+ });
183265
+ };
183238
183266
  var generatePreviewAssets = async ({
183239
183267
  build,
183240
183268
  outputDir,
@@ -183250,7 +183278,8 @@ var generatePreviewAssets = async ({
183250
183278
  console.log(`${prefix}Generating schematic SVG...`);
183251
183279
  const schematicSvg = convertCircuitJsonToSchematicSvg2(circuitJson);
183252
183280
  console.log(`${prefix}Converting circuit to GLB...`);
183253
- const glbBuffer = await convertCircuitJsonToGltf2(circuitJson, {
183281
+ const circuitJsonWithFileUrls = convertModelUrlsToFileUrls(circuitJson);
183282
+ const glbBuffer = await convertCircuitJsonToGltf2(circuitJsonWithFileUrls, {
183254
183283
  format: "glb"
183255
183284
  });
183256
183285
  console.log(`${prefix}Rendering GLB to PNG buffer...`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.607",
3
+ "version": "0.1.608",
4
4
  "main": "dist/main.js",
5
5
  "devDependencies": {
6
6
  "@babel/standalone": "^7.26.9",
@@ -23,7 +23,7 @@
23
23
  "bun-match-svg": "^0.0.12",
24
24
  "chokidar": "4.0.1",
25
25
  "circuit-json": "0.0.325",
26
- "circuit-json-to-gltf": "^0.0.14",
26
+ "circuit-json-to-gltf": "^0.0.51",
27
27
  "circuit-json-to-kicad": "^0.0.3",
28
28
  "circuit-json-to-readable-netlist": "^0.0.13",
29
29
  "circuit-json-to-spice": "^0.0.10",
@@ -58,7 +58,7 @@
58
58
  "semver": "^7.6.3",
59
59
  "sharp": "0.32.6",
60
60
  "tempy": "^3.1.0",
61
- "tscircuit": "^0.0.1008-libonly",
61
+ "tscircuit": "^0.0.1014-libonly",
62
62
  "tsx": "^4.7.1",
63
63
  "typed-ky": "^0.0.4",
64
64
  "zod": "^3.23.8"