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