@tscircuit/cli 0.1.1190 → 0.1.1191

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.
@@ -11529,9 +11529,8 @@ function analyzeCircuitJson(circuitJson) {
11529
11529
  }
11530
11530
 
11531
11531
  // lib/shared/generate-circuit-json.tsx
11532
- var import_make_vfs = __toESM(require_dist(), 1);
11533
- import path2 from "node:path";
11534
11532
  import fs2 from "node:fs";
11533
+ import path2 from "node:path";
11535
11534
  import { pathToFileURL } from "node:url";
11536
11535
  import Debug from "debug";
11537
11536
 
@@ -11549,6 +11548,9 @@ var abbreviateStringifyObject = (obj) => {
11549
11548
  })));
11550
11549
  };
11551
11550
 
11551
+ // lib/shared/generate-circuit-json.tsx
11552
+ var import_make_vfs = __toESM(require_dist(), 1);
11553
+
11552
11554
  // lib/shared/importFromUserLand.ts
11553
11555
  import { createRequire as createRequire2 } from "node:module";
11554
11556
  import fs from "node:fs";
@@ -11598,7 +11600,8 @@ async function generateCircuitJson({
11598
11600
  outputFileName,
11599
11601
  saveToFile = false,
11600
11602
  platformConfig,
11601
- injectedProps
11603
+ injectedProps,
11604
+ onAsyncEffectStatus
11602
11605
  }) {
11603
11606
  debug(`Generating circuit JSON for ${filePath}`);
11604
11607
  const React = await importFromUserLand("react");
@@ -11648,7 +11651,21 @@ async function generateCircuitJson({
11648
11651
  runner.add(/* @__PURE__ */ jsxDEV(Component, {
11649
11652
  ...injectedProps ?? {}
11650
11653
  }, undefined, false, undefined, this));
11651
- await runner.renderUntilSettled();
11654
+ runner.render();
11655
+ const loggedAsyncEffectNames = new Set;
11656
+ while (runner._hasIncompleteAsyncEffects()) {
11657
+ for (const asyncEffect of runner.getRunningAsyncEffects()) {
11658
+ const asyncEffectName = asyncEffect.effectName;
11659
+ if (!asyncEffectName || loggedAsyncEffectNames.has(asyncEffectName)) {
11660
+ continue;
11661
+ }
11662
+ loggedAsyncEffectNames.add(asyncEffectName);
11663
+ onAsyncEffectStatus?.(asyncEffectName);
11664
+ }
11665
+ await new Promise((resolve2) => setTimeout(resolve2, 100));
11666
+ runner.render();
11667
+ }
11668
+ runner.emit("renderComplete");
11652
11669
  const circuitJson = await runner.getCircuitJson();
11653
11670
  if (saveToFile) {
11654
11671
  debug(`Saving circuit JSON to ${outputPath}`);
@@ -11656,7 +11673,8 @@ async function generateCircuitJson({
11656
11673
  }
11657
11674
  return {
11658
11675
  circuitJson,
11659
- outputPath
11676
+ outputPath,
11677
+ rootCircuit: runner
11660
11678
  };
11661
11679
  }
11662
11680
 
@@ -13543,7 +13561,7 @@ var loadCircuitJsonFromInputFile = (filePath) => {
13543
13561
  const parsed = JSON.parse(fs10.readFileSync(filePath, "utf-8"));
13544
13562
  return Array.isArray(parsed) ? parsed : [];
13545
13563
  };
13546
- var handleBuildFile = async (filePath, outputPath, glbOutputPath, previewOutputDir, projectDir, options, workerLog) => {
13564
+ var handleBuildFile = async (filePath, outputPath, glbOutputPath, previewOutputDir, projectDir, options, workerLog, workerStatus) => {
13547
13565
  const errors = [];
13548
13566
  const warnings = [];
13549
13567
  const startedAt = options?.profile ? performance.now() : 0;
@@ -13557,7 +13575,10 @@ var handleBuildFile = async (filePath, outputPath, glbOutputPath, previewOutputD
13557
13575
  const circuitJson = isPrebuiltCircuitJson ? loadCircuitJsonFromInputFile(filePath) : (await generateCircuitJson({
13558
13576
  filePath,
13559
13577
  platformConfig: completePlatformConfig,
13560
- injectedProps: options?.injectedProps
13578
+ injectedProps: options?.injectedProps,
13579
+ onAsyncEffectStatus: (asyncEffectName) => {
13580
+ workerStatus(`waiting on ${asyncEffectName}…`);
13581
+ }
13561
13582
  })).circuitJson;
13562
13583
  fs10.mkdirSync(path13.dirname(outputPath), { recursive: true });
13563
13584
  fs10.writeFileSync(outputPath, JSON.stringify(circuitJson, null, 2));
@@ -13654,6 +13675,8 @@ var handleBuildFile = async (filePath, outputPath, glbOutputPath, previewOutputD
13654
13675
  warnings,
13655
13676
  durationMs: options?.profile ? performance.now() - startedAt : undefined
13656
13677
  };
13678
+ } finally {
13679
+ workerStatus(null);
13657
13680
  }
13658
13681
  };
13659
13682
 
@@ -13671,9 +13694,16 @@ var workerLog = (...args) => {
13671
13694
  log_lines: [line]
13672
13695
  });
13673
13696
  };
13697
+ var workerStatus = (statusLine) => {
13698
+ sendMessage({
13699
+ message_type: "worker_log",
13700
+ log_lines: [],
13701
+ status_line: statusLine
13702
+ });
13703
+ };
13674
13704
  parentPort.on("message", async (msg) => {
13675
13705
  if (msg.message_type === "build_file") {
13676
- const result = await handleBuildFile(msg.file_path, msg.output_path, msg.glb_output_path, msg.preview_output_dir, msg.project_dir, msg.options, workerLog);
13706
+ const result = await handleBuildFile(msg.file_path, msg.output_path, msg.glb_output_path, msg.preview_output_dir, msg.project_dir, msg.options, workerLog, workerStatus);
13677
13707
  sendMessage(result);
13678
13708
  }
13679
13709
  });
package/dist/cli/main.js CHANGED
@@ -99964,7 +99964,7 @@ var import_perfect_cli = __toESM2(require_dist2(), 1);
99964
99964
  // lib/getVersion.ts
99965
99965
  import { createRequire as createRequire2 } from "node:module";
99966
99966
  // package.json
99967
- var version = "0.1.1189";
99967
+ var version = "0.1.1190";
99968
99968
  var package_default = {
99969
99969
  name: "@tscircuit/cli",
99970
99970
  version,
@@ -100031,7 +100031,7 @@ var package_default = {
100031
100031
  redaxios: "^0.5.1",
100032
100032
  semver: "^7.6.3",
100033
100033
  tempy: "^3.1.0",
100034
- tscircuit: "0.0.1579-libonly",
100034
+ tscircuit: "0.0.1590-libonly",
100035
100035
  tsx: "^4.7.1",
100036
100036
  "typed-ky": "^0.0.4",
100037
100037
  zod: "^3.23.8",
@@ -109050,9 +109050,8 @@ function analyzeCircuitJson(circuitJson) {
109050
109050
  }
109051
109051
 
109052
109052
  // lib/shared/generate-circuit-json.tsx
109053
- var import_make_vfs = __toESM2(require_dist4(), 1);
109054
- import path25 from "node:path";
109055
109053
  import fs24 from "node:fs";
109054
+ import path25 from "node:path";
109056
109055
  import { pathToFileURL as pathToFileURL2 } from "node:url";
109057
109056
  import Debug from "debug";
109058
109057
 
@@ -109071,6 +109070,7 @@ var abbreviateStringifyObject = (obj) => {
109071
109070
  };
109072
109071
 
109073
109072
  // lib/shared/generate-circuit-json.tsx
109073
+ var import_make_vfs = __toESM2(require_dist4(), 1);
109074
109074
  import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
109075
109075
  var debug = Debug("tsci:generate-circuit-json");
109076
109076
  var ALLOWED_FILE_EXTENSIONS = [
@@ -109090,7 +109090,8 @@ async function generateCircuitJson({
109090
109090
  outputFileName,
109091
109091
  saveToFile = false,
109092
109092
  platformConfig,
109093
- injectedProps
109093
+ injectedProps,
109094
+ onAsyncEffectStatus
109094
109095
  }) {
109095
109096
  debug(`Generating circuit JSON for ${filePath}`);
109096
109097
  const React = await importFromUserLand("react");
@@ -109140,7 +109141,21 @@ async function generateCircuitJson({
109140
109141
  runner.add(/* @__PURE__ */ jsxDEV2(Component, {
109141
109142
  ...injectedProps ?? {}
109142
109143
  }, undefined, false, undefined, this));
109143
- await runner.renderUntilSettled();
109144
+ runner.render();
109145
+ const loggedAsyncEffectNames = new Set;
109146
+ while (runner._hasIncompleteAsyncEffects()) {
109147
+ for (const asyncEffect of runner.getRunningAsyncEffects()) {
109148
+ const asyncEffectName = asyncEffect.effectName;
109149
+ if (!asyncEffectName || loggedAsyncEffectNames.has(asyncEffectName)) {
109150
+ continue;
109151
+ }
109152
+ loggedAsyncEffectNames.add(asyncEffectName);
109153
+ onAsyncEffectStatus?.(asyncEffectName);
109154
+ }
109155
+ await new Promise((resolve3) => setTimeout(resolve3, 100));
109156
+ runner.render();
109157
+ }
109158
+ runner.emit("renderComplete");
109144
109159
  const circuitJson = await runner.getCircuitJson();
109145
109160
  if (saveToFile) {
109146
109161
  debug(`Saving circuit JSON to ${outputPath}`);
@@ -109148,7 +109163,8 @@ async function generateCircuitJson({
109148
109163
  }
109149
109164
  return {
109150
109165
  circuitJson,
109151
- outputPath
109166
+ outputPath,
109167
+ rootCircuit: runner
109152
109168
  };
109153
109169
  }
109154
109170
 
@@ -110696,7 +110712,8 @@ class ThreadWorkerPool {
110696
110712
  }
110697
110713
  const runningForMs = now - worker.currentJobStartedAt;
110698
110714
  const jobDescription = this.describeJob(worker.currentJob.job);
110699
- return `w${index}:busy task=${jobDescription} running_ms=${runningForMs}`;
110715
+ const statusSuffix = worker.currentStatus ? ` status=${worker.currentStatus}` : "";
110716
+ return `w${index}:busy task=${jobDescription} running_ms=${runningForMs}${statusSuffix}`;
110700
110717
  });
110701
110718
  this.options.onLog?.([
110702
110719
  `[worker-pool] heartbeat: workers busy=${busyWorkers}/${totalWorkers}, idle=${idleWorkers}, queued_jobs=${queuedJobs} | ${workerDetails.join(" | ")}`
@@ -110717,7 +110734,8 @@ class ThreadWorkerPool {
110717
110734
  busy: false,
110718
110735
  currentJob: null,
110719
110736
  currentJobStartedAt: null,
110720
- timeoutId: null
110737
+ timeoutId: null,
110738
+ currentStatus: null
110721
110739
  };
110722
110740
  this.attachWorkerHandlers(threadWorker);
110723
110741
  return threadWorker;
@@ -110762,6 +110780,7 @@ class ThreadWorkerPool {
110762
110780
  threadWorker.busy = false;
110763
110781
  threadWorker.currentJob = null;
110764
110782
  threadWorker.currentJobStartedAt = null;
110783
+ threadWorker.currentStatus = null;
110765
110784
  this.attachWorkerHandlers(threadWorker);
110766
110785
  }
110767
110786
  finishJob(threadWorker, action) {
@@ -110772,6 +110791,7 @@ class ThreadWorkerPool {
110772
110791
  this.clearWorkerTimeout(threadWorker);
110773
110792
  threadWorker.currentJob = null;
110774
110793
  threadWorker.currentJobStartedAt = null;
110794
+ threadWorker.currentStatus = null;
110775
110795
  threadWorker.busy = false;
110776
110796
  action(job);
110777
110797
  this.processQueue();
@@ -110783,6 +110803,7 @@ class ThreadWorkerPool {
110783
110803
  return;
110784
110804
  }
110785
110805
  if (this.options.isLogMessage(message)) {
110806
+ threadWorker.currentStatus = this.options.getStatusLine?.(message) ?? null;
110786
110807
  this.options.onLog?.(this.options.getLogLines(message));
110787
110808
  return;
110788
110809
  }
@@ -110837,6 +110858,7 @@ class ThreadWorkerPool {
110837
110858
  availableWorker.busy = true;
110838
110859
  availableWorker.currentJob = queuedJob;
110839
110860
  availableWorker.currentJobStartedAt = Date.now();
110861
+ availableWorker.currentStatus = null;
110840
110862
  this.startJobTimeout(availableWorker);
110841
110863
  availableWorker.worker.postMessage(this.options.createMessage(queuedJob.job));
110842
110864
  }
@@ -110902,6 +110924,7 @@ async function buildFilesWithWorkerPool(options) {
110902
110924
  }),
110903
110925
  isLogMessage: (message) => message.message_type === "worker_log",
110904
110926
  getLogLines: (message) => message.message_type === "worker_log" ? message.log_lines : [],
110927
+ getStatusLine: (message) => message.message_type === "worker_log" ? message.status_line ?? null : null,
110905
110928
  isCompletionMessage: (message) => message.message_type === "build_completed",
110906
110929
  getResult: (message) => {
110907
110930
  const completedMessage = message;
@@ -110932,7 +110955,8 @@ async function buildFilesWithWorkerPool(options) {
110932
110955
  },
110933
110956
  cancellationError,
110934
110957
  jobTimeoutMs: Number.isFinite(workerJobTimeoutMs) && workerJobTimeoutMs > 0 ? workerJobTimeoutMs : undefined,
110935
- onLog: options.onLog
110958
+ onLog: options.onLog,
110959
+ heartbeatIntervalMs: 100
110936
110960
  });
110937
110961
  const results = [];
110938
110962
  const promises = [];
@@ -11667,9 +11667,8 @@ function applyCameraPreset(preset, cam) {
11667
11667
  }
11668
11668
 
11669
11669
  // lib/shared/generate-circuit-json.tsx
11670
- var import_make_vfs = __toESM(require_dist(), 1);
11671
- import path2 from "node:path";
11672
11670
  import fs2 from "node:fs";
11671
+ import path2 from "node:path";
11673
11672
  import { pathToFileURL } from "node:url";
11674
11673
  import Debug from "debug";
11675
11674
 
@@ -11687,6 +11686,9 @@ var abbreviateStringifyObject = (obj) => {
11687
11686
  })));
11688
11687
  };
11689
11688
 
11689
+ // lib/shared/generate-circuit-json.tsx
11690
+ var import_make_vfs = __toESM(require_dist(), 1);
11691
+
11690
11692
  // lib/shared/importFromUserLand.ts
11691
11693
  import { createRequire as createRequire2 } from "node:module";
11692
11694
  import fs from "node:fs";
@@ -11736,7 +11738,8 @@ async function generateCircuitJson({
11736
11738
  outputFileName,
11737
11739
  saveToFile = false,
11738
11740
  platformConfig,
11739
- injectedProps
11741
+ injectedProps,
11742
+ onAsyncEffectStatus
11740
11743
  }) {
11741
11744
  debug(`Generating circuit JSON for ${filePath}`);
11742
11745
  const React = await importFromUserLand("react");
@@ -11786,7 +11789,21 @@ async function generateCircuitJson({
11786
11789
  runner.add(/* @__PURE__ */ jsxDEV(Component, {
11787
11790
  ...injectedProps ?? {}
11788
11791
  }, undefined, false, undefined, this));
11789
- await runner.renderUntilSettled();
11792
+ runner.render();
11793
+ const loggedAsyncEffectNames = new Set;
11794
+ while (runner._hasIncompleteAsyncEffects()) {
11795
+ for (const asyncEffect of runner.getRunningAsyncEffects()) {
11796
+ const asyncEffectName = asyncEffect.effectName;
11797
+ if (!asyncEffectName || loggedAsyncEffectNames.has(asyncEffectName)) {
11798
+ continue;
11799
+ }
11800
+ loggedAsyncEffectNames.add(asyncEffectName);
11801
+ onAsyncEffectStatus?.(asyncEffectName);
11802
+ }
11803
+ await new Promise((resolve2) => setTimeout(resolve2, 100));
11804
+ runner.render();
11805
+ }
11806
+ runner.emit("renderComplete");
11790
11807
  const circuitJson = await runner.getCircuitJson();
11791
11808
  if (saveToFile) {
11792
11809
  debug(`Saving circuit JSON to ${outputPath}`);
@@ -11794,7 +11811,8 @@ async function generateCircuitJson({
11794
11811
  }
11795
11812
  return {
11796
11813
  circuitJson,
11797
- outputPath
11814
+ outputPath,
11815
+ rootCircuit: runner
11798
11816
  };
11799
11817
  }
11800
11818
 
package/dist/lib/index.js CHANGED
@@ -60678,7 +60678,7 @@ var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
60678
60678
  }));
60679
60679
  };
60680
60680
  // package.json
60681
- var version = "0.1.1189";
60681
+ var version = "0.1.1190";
60682
60682
  var package_default = {
60683
60683
  name: "@tscircuit/cli",
60684
60684
  version,
@@ -60745,7 +60745,7 @@ var package_default = {
60745
60745
  redaxios: "^0.5.1",
60746
60746
  semver: "^7.6.3",
60747
60747
  tempy: "^3.1.0",
60748
- tscircuit: "0.0.1579-libonly",
60748
+ tscircuit: "0.0.1590-libonly",
60749
60749
  tsx: "^4.7.1",
60750
60750
  "typed-ky": "^0.0.4",
60751
60751
  zod: "^3.23.8",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.1190",
3
+ "version": "0.1.1191",
4
4
  "main": "dist/cli/main.js",
5
5
  "exports": {
6
6
  ".": "./dist/cli/main.js",
@@ -64,7 +64,7 @@
64
64
  "redaxios": "^0.5.1",
65
65
  "semver": "^7.6.3",
66
66
  "tempy": "^3.1.0",
67
- "tscircuit": "0.0.1579-libonly",
67
+ "tscircuit": "0.0.1590-libonly",
68
68
  "tsx": "^4.7.1",
69
69
  "typed-ky": "^0.0.4",
70
70
  "zod": "^3.23.8",