@tscircuit/cli 0.1.1031 → 0.1.1032
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 +57 -22
- package/dist/lib/index.js +1 -1
- package/package.json +1 -1
package/dist/cli/main.js
CHANGED
|
@@ -71664,7 +71664,7 @@ var registerStaticAssetLoaders = () => {
|
|
|
71664
71664
|
// cli/main.ts
|
|
71665
71665
|
var import_perfect_cli = __toESM2(require_dist2(), 1);
|
|
71666
71666
|
// package.json
|
|
71667
|
-
var version = "0.1.
|
|
71667
|
+
var version = "0.1.1031";
|
|
71668
71668
|
var package_default = {
|
|
71669
71669
|
name: "@tscircuit/cli",
|
|
71670
71670
|
version,
|
|
@@ -81032,18 +81032,47 @@ async function buildGlbsWithWorkerPool(options) {
|
|
|
81032
81032
|
onLog: options.onLog
|
|
81033
81033
|
});
|
|
81034
81034
|
const results = [];
|
|
81035
|
+
let completedJobs = 0;
|
|
81036
|
+
let lastProgressAt = Date.now();
|
|
81037
|
+
const stallTimeoutMs = options.stallTimeoutMs ?? 60000;
|
|
81038
|
+
let watchdogTimer = null;
|
|
81039
|
+
const watchdogPromise = new Promise((_resolve, reject) => {
|
|
81040
|
+
watchdogTimer = setInterval(() => {
|
|
81041
|
+
if (completedJobs >= options.files.length) {
|
|
81042
|
+
return;
|
|
81043
|
+
}
|
|
81044
|
+
const stalledForMs = Date.now() - lastProgressAt;
|
|
81045
|
+
if (stalledForMs < stallTimeoutMs) {
|
|
81046
|
+
return;
|
|
81047
|
+
}
|
|
81048
|
+
const stallError = new Error(`GLB worker pool stalled: no completed jobs for ${Math.round(stalledForMs / 1000)}s`);
|
|
81049
|
+
pool.stop(stallError).then(() => pool.terminate());
|
|
81050
|
+
reject(stallError);
|
|
81051
|
+
}, 1000);
|
|
81052
|
+
});
|
|
81035
81053
|
const promises = options.files.map((file) => pool.queueGlbJob({
|
|
81036
81054
|
circuitJsonPath: file.circuitJsonPath,
|
|
81037
81055
|
glbOutputPath: file.glbOutputPath,
|
|
81038
81056
|
projectDir: options.projectDir
|
|
81039
81057
|
}).then(async (result) => {
|
|
81040
81058
|
results.push(result);
|
|
81059
|
+
completedJobs += 1;
|
|
81060
|
+
lastProgressAt = Date.now();
|
|
81041
81061
|
if (options.onJobComplete) {
|
|
81042
81062
|
await options.onJobComplete(result);
|
|
81043
81063
|
}
|
|
81044
81064
|
return result;
|
|
81045
81065
|
}));
|
|
81046
|
-
const settledResults = await Promise.
|
|
81066
|
+
const settledResults = await Promise.race([
|
|
81067
|
+
Promise.allSettled(promises),
|
|
81068
|
+
watchdogPromise.then(() => [])
|
|
81069
|
+
]);
|
|
81070
|
+
if (watchdogTimer) {
|
|
81071
|
+
clearInterval(watchdogTimer);
|
|
81072
|
+
}
|
|
81073
|
+
if (!Array.isArray(settledResults)) {
|
|
81074
|
+
throw new Error("Unexpected GLB worker result state");
|
|
81075
|
+
}
|
|
81047
81076
|
for (const settledResult of settledResults) {
|
|
81048
81077
|
if (settledResult.status === "rejected") {
|
|
81049
81078
|
throw settledResult.reason;
|
|
@@ -81092,27 +81121,33 @@ var buildGlbs = async ({
|
|
|
81092
81121
|
glbOutputPath: path28.join(outputDir, "3d.glb")
|
|
81093
81122
|
};
|
|
81094
81123
|
});
|
|
81095
|
-
|
|
81096
|
-
|
|
81097
|
-
|
|
81098
|
-
|
|
81099
|
-
|
|
81100
|
-
|
|
81101
|
-
|
|
81102
|
-
|
|
81103
|
-
|
|
81104
|
-
|
|
81105
|
-
|
|
81106
|
-
|
|
81107
|
-
|
|
81108
|
-
|
|
81109
|
-
|
|
81110
|
-
|
|
81111
|
-
|
|
81124
|
+
try {
|
|
81125
|
+
await buildGlbsWithWorkerPool({
|
|
81126
|
+
files: filesToConvert,
|
|
81127
|
+
projectDir,
|
|
81128
|
+
concurrency,
|
|
81129
|
+
stallTimeoutMs: 60000,
|
|
81130
|
+
onLog: (lines) => {
|
|
81131
|
+
for (const line of lines) {
|
|
81132
|
+
console.log(line);
|
|
81133
|
+
}
|
|
81134
|
+
},
|
|
81135
|
+
onJobComplete: async (result) => {
|
|
81136
|
+
const outputDir = path28.dirname(result.circuitJsonPath);
|
|
81137
|
+
const prefixRelative = path28.relative(distDir, outputDir) || ".";
|
|
81138
|
+
const prefix = prefixRelative === "." ? "" : `[${prefixRelative}] `;
|
|
81139
|
+
if (result.ok) {
|
|
81140
|
+
console.log(`${prefix}Written 3d.glb`);
|
|
81141
|
+
} else {
|
|
81142
|
+
console.error(`${prefix}Failed to generate GLB:${result.error ? ` ${result.error}` : ""}`);
|
|
81143
|
+
}
|
|
81112
81144
|
}
|
|
81113
|
-
}
|
|
81114
|
-
|
|
81115
|
-
|
|
81145
|
+
});
|
|
81146
|
+
return;
|
|
81147
|
+
} catch (error) {
|
|
81148
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
81149
|
+
console.warn(`GLB worker pool failed (${message}). Falling back to sequential conversion.`);
|
|
81150
|
+
}
|
|
81116
81151
|
}
|
|
81117
81152
|
for (const build of successfulBuilds) {
|
|
81118
81153
|
const outputDir = path28.dirname(build.outputPath);
|
package/dist/lib/index.js
CHANGED
|
@@ -60432,7 +60432,7 @@ var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
|
|
|
60432
60432
|
}));
|
|
60433
60433
|
};
|
|
60434
60434
|
// package.json
|
|
60435
|
-
var version = "0.1.
|
|
60435
|
+
var version = "0.1.1031";
|
|
60436
60436
|
var package_default = {
|
|
60437
60437
|
name: "@tscircuit/cli",
|
|
60438
60438
|
version,
|