@tscircuit/cli 0.1.942 → 0.1.943

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/cli/main.js CHANGED
@@ -74389,7 +74389,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
74389
74389
  import { execSync as execSync2 } from "node:child_process";
74390
74390
  var import_semver2 = __toESM2(require_semver2(), 1);
74391
74391
  // package.json
74392
- var version = "0.1.941";
74392
+ var version = "0.1.942";
74393
74393
  var package_default = {
74394
74394
  name: "@tscircuit/cli",
74395
74395
  main: "dist/cli/main.js",
@@ -74452,7 +74452,7 @@ var package_default = {
74452
74452
  semver: "^7.6.3",
74453
74453
  sharp: "0.32.6",
74454
74454
  tempy: "^3.1.0",
74455
- tscircuit: "^0.0.1296-libonly",
74455
+ tscircuit: "^0.0.1332-libonly",
74456
74456
  tsx: "^4.7.1",
74457
74457
  "typed-ky": "^0.0.4",
74458
74458
  zod: "^3.23.8"
@@ -85195,6 +85195,7 @@ var import_perfect_cli = __toESM2(require_dist7(), 1);
85195
85195
  import fs35 from "node:fs";
85196
85196
  import path37 from "node:path";
85197
85197
  import { promisify as promisify3 } from "node:util";
85198
+ import { convertCircuitJsonToGltf } from "circuit-json-to-gltf";
85198
85199
 
85199
85200
  // node_modules/circuit-json-to-readable-netlist/dist/index.js
85200
85201
  import { su as su3 } from "@tscircuit/circuit-json-util";
@@ -85433,7 +85434,6 @@ import {
85433
85434
  convertCircuitJsonToPcbSvg,
85434
85435
  convertCircuitJsonToSchematicSvg
85435
85436
  } from "circuit-to-svg";
85436
- import { convertCircuitJsonToGltf } from "circuit-json-to-gltf";
85437
85437
 
85438
85438
  // node_modules/dsn-converter/dist/index.js
85439
85439
  import { applyToPoint as applyToPoint16, scale as scale4 } from "transformation-matrix";
@@ -86551,6 +86551,18 @@ async function generateCircuitJson({
86551
86551
  };
86552
86552
  }
86553
86553
 
86554
+ // lib/shared/get-circuit-json-to-gltf-options.ts
86555
+ var getCircuitJsonToGltfOptions = ({
86556
+ format = "gltf"
86557
+ }) => {
86558
+ const sessionToken = getSessionToken() ?? getSessionTokenFromNpmrc();
86559
+ return {
86560
+ format,
86561
+ projectBaseUrl: getRegistryApiUrl(),
86562
+ ...sessionToken ? { authHeaders: { Authorization: `Bearer ${sessionToken}` } } : {}
86563
+ };
86564
+ };
86565
+
86554
86566
  // lib/shared/export-snippet.ts
86555
86567
  var writeFileAsync = promisify3(fs35.writeFile);
86556
86568
  var ALLOWED_EXPORT_FORMATS = [
@@ -86642,14 +86654,10 @@ var exportSnippet = async ({
86642
86654
  outputContent = convertCircuitJsonToReadableNetlist(circuitData.circuitJson);
86643
86655
  break;
86644
86656
  case "gltf":
86645
- outputContent = JSON.stringify(await convertCircuitJsonToGltf(circuitData.circuitJson, {
86646
- format: "gltf"
86647
- }), null, 2);
86657
+ outputContent = JSON.stringify(await convertCircuitJsonToGltf(circuitData.circuitJson, getCircuitJsonToGltfOptions({ format: "gltf" })), null, 2);
86648
86658
  break;
86649
86659
  case "glb":
86650
- outputContent = Buffer.from(await convertCircuitJsonToGltf(circuitData.circuitJson, {
86651
- format: "glb"
86652
- }));
86660
+ outputContent = Buffer.from(await convertCircuitJsonToGltf(circuitData.circuitJson, getCircuitJsonToGltfOptions({ format: "glb" })));
86653
86661
  break;
86654
86662
  case "kicad_sch": {
86655
86663
  const converter = new CircuitJsonToKicadSchConverter(circuitData.circuitJson);
@@ -174855,12 +174863,12 @@ ${scriptBlock} <script src="https://cdn.tailwindcss.com"></script>
174855
174863
  // cli/build/build-preview-images.ts
174856
174864
  import fs46 from "node:fs";
174857
174865
  import path47 from "node:path";
174866
+ import { convertCircuitJsonToGltf as convertCircuitJsonToGltf2 } from "circuit-json-to-gltf";
174858
174867
  import {
174859
174868
  convertCircuitJsonToPcbSvg as convertCircuitJsonToPcbSvg2,
174860
174869
  convertCircuitJsonToSchematicSvg as convertCircuitJsonToSchematicSvg2
174861
174870
  } from "circuit-to-svg";
174862
174871
  import { renderGLTFToPNGBufferFromGLBBuffer } from "poppygl";
174863
- import { convertCircuitJsonToGltf as convertCircuitJsonToGltf2 } from "circuit-json-to-gltf";
174864
174872
 
174865
174873
  // cli/build/convert-model-urls-to-file-urls.ts
174866
174874
  import path46 from "node:path";
@@ -174965,9 +174973,7 @@ var generatePreviewAssets = async ({
174965
174973
  try {
174966
174974
  console.log(`${prefix}Converting circuit to GLB...`);
174967
174975
  const circuitJsonWithFileUrls = convertModelUrlsToFileUrls(circuitJson);
174968
- const glbBuffer = await convertCircuitJsonToGltf2(circuitJsonWithFileUrls, {
174969
- format: "glb"
174970
- });
174976
+ const glbBuffer = await convertCircuitJsonToGltf2(circuitJsonWithFileUrls, getCircuitJsonToGltfOptions({ format: "glb" }));
174971
174977
  console.log(`${prefix}Rendering GLB to PNG buffer...`);
174972
174978
  const glbArrayBuffer = await normalizeToArrayBuffer(glbBuffer);
174973
174979
  const pngBuffer = await renderGLTFToPNGBufferFromGLBBuffer(glbArrayBuffer, {
@@ -175064,9 +175070,7 @@ var buildPreviewGltf = async ({
175064
175070
  try {
175065
175071
  console.log("Converting circuit to GLTF...");
175066
175072
  const circuitJsonWithFileUrls = convertModelUrlsToFileUrls(circuitJson);
175067
- const gltfData = await convertCircuitJsonToGltf3(circuitJsonWithFileUrls, {
175068
- format: "gltf"
175069
- });
175073
+ const gltfData = await convertCircuitJsonToGltf3(circuitJsonWithFileUrls, getCircuitJsonToGltfOptions({ format: "gltf" }));
175070
175074
  const gltfContent = JSON.stringify(gltfData, null, 2);
175071
175075
  fs47.writeFileSync(outputPath, gltfContent, "utf-8");
175072
175076
  console.log(`Written ${gltfFilename}`);
@@ -175120,9 +175124,7 @@ var buildGlbs = async ({
175120
175124
  try {
175121
175125
  console.log(`${prefix}Converting circuit to GLB...`);
175122
175126
  const circuitJsonWithFileUrls = convertModelUrlsToFileUrls(circuitJson);
175123
- const glbBuffer = await convertCircuitJsonToGltf4(circuitJsonWithFileUrls, {
175124
- format: "glb"
175125
- });
175127
+ const glbBuffer = await convertCircuitJsonToGltf4(circuitJsonWithFileUrls, getCircuitJsonToGltfOptions({ format: "glb" }));
175126
175128
  const glbData = normalizeToUint8Array2(glbBuffer);
175127
175129
  fs48.writeFileSync(path49.join(outputDir, "3d.glb"), Buffer.from(glbData));
175128
175130
  console.log(`${prefix}Written 3d.glb`);
@@ -176041,12 +176043,12 @@ var registerBuild = (program3) => {
176041
176043
  // lib/shared/snapshot-project.ts
176042
176044
  import fs56 from "node:fs";
176043
176045
  import path56 from "node:path";
176044
- import looksSame2 from "looks-same";
176046
+ import { convertCircuitJsonToGltf as convertCircuitJsonToGltf5 } from "circuit-json-to-gltf";
176045
176047
  import {
176046
176048
  convertCircuitJsonToPcbSvg as convertCircuitJsonToPcbSvg3,
176047
176049
  convertCircuitJsonToSchematicSvg as convertCircuitJsonToSchematicSvg3
176048
176050
  } from "circuit-to-svg";
176049
- import { convertCircuitJsonToGltf as convertCircuitJsonToGltf5 } from "circuit-json-to-gltf";
176051
+ import looksSame2 from "looks-same";
176050
176052
  import { renderGLTFToPNGBufferFromGLBBuffer as renderGLTFToPNGBufferFromGLBBuffer2 } from "poppygl";
176051
176053
 
176052
176054
  // lib/shared/compare-images.ts
@@ -176148,9 +176150,7 @@ var snapshotProject = async ({
176148
176150
  let png3d = null;
176149
176151
  if (threeD) {
176150
176152
  try {
176151
- const glbBuffer = await convertCircuitJsonToGltf5(circuitJson, {
176152
- format: "glb"
176153
- });
176153
+ const glbBuffer = await convertCircuitJsonToGltf5(circuitJson, getCircuitJsonToGltfOptions({ format: "glb" }));
176154
176154
  if (!(glbBuffer instanceof ArrayBuffer)) {
176155
176155
  throw new Error("Expected ArrayBuffer from convertCircuitJsonToGltf with glb format");
176156
176156
  }
package/dist/lib/index.js CHANGED
@@ -60414,7 +60414,7 @@ var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
60414
60414
  }));
60415
60415
  };
60416
60416
  // package.json
60417
- var version = "0.1.941";
60417
+ var version = "0.1.942";
60418
60418
  var package_default = {
60419
60419
  name: "@tscircuit/cli",
60420
60420
  main: "dist/cli/main.js",
@@ -60477,7 +60477,7 @@ var package_default = {
60477
60477
  semver: "^7.6.3",
60478
60478
  sharp: "0.32.6",
60479
60479
  tempy: "^3.1.0",
60480
- tscircuit: "^0.0.1296-libonly",
60480
+ tscircuit: "^0.0.1332-libonly",
60481
60481
  tsx: "^4.7.1",
60482
60482
  "typed-ky": "^0.0.4",
60483
60483
  zod: "^3.23.8"
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  ".": "./dist/cli/main.js",
6
6
  "./lib": "./dist/lib/index.js"
7
7
  },
8
- "version": "0.1.942",
8
+ "version": "0.1.943",
9
9
  "devDependencies": {
10
10
  "@babel/standalone": "^7.26.9",
11
11
  "@biomejs/biome": "^1.9.4",
@@ -60,7 +60,7 @@
60
60
  "semver": "^7.6.3",
61
61
  "sharp": "0.32.6",
62
62
  "tempy": "^3.1.0",
63
- "tscircuit": "^0.0.1296-libonly",
63
+ "tscircuit": "^0.0.1332-libonly",
64
64
  "tsx": "^4.7.1",
65
65
  "typed-ky": "^0.0.4",
66
66
  "zod": "^3.23.8"