@tscircuit/cli 0.1.1050 → 0.1.1051
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/build/build-worker-entrypoint.js +10906 -272
- package/dist/cli/main.js +67 -14
- 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.1050";
|
|
71668
71668
|
var package_default = {
|
|
71669
71669
|
name: "@tscircuit/cli",
|
|
71670
71670
|
version,
|
|
@@ -81939,6 +81939,12 @@ class WorkerPool {
|
|
|
81939
81939
|
job.resolve({
|
|
81940
81940
|
filePath: completedMsg.file_path,
|
|
81941
81941
|
outputPath: completedMsg.output_path,
|
|
81942
|
+
glbOutputPath: completedMsg.glb_output_path,
|
|
81943
|
+
previewOutputDir: completedMsg.preview_output_dir,
|
|
81944
|
+
glbOk: completedMsg.glb_ok,
|
|
81945
|
+
glbError: completedMsg.glb_error,
|
|
81946
|
+
previewOk: completedMsg.preview_ok,
|
|
81947
|
+
previewError: completedMsg.preview_error,
|
|
81942
81948
|
ok: completedMsg.ok,
|
|
81943
81949
|
isFatalError: completedMsg.isFatalError,
|
|
81944
81950
|
errors: completedMsg.errors,
|
|
@@ -81990,6 +81996,8 @@ class WorkerPool {
|
|
|
81990
81996
|
message_type: "build_file",
|
|
81991
81997
|
file_path: job.filePath,
|
|
81992
81998
|
output_path: job.outputPath,
|
|
81999
|
+
glb_output_path: job.glbOutputPath,
|
|
82000
|
+
preview_output_dir: job.previewOutputDir,
|
|
81993
82001
|
project_dir: job.projectDir,
|
|
81994
82002
|
options: job.options
|
|
81995
82003
|
};
|
|
@@ -82056,8 +82064,13 @@ async function buildFilesWithWorkerPool(options) {
|
|
|
82056
82064
|
const promise = pool.queueJob({
|
|
82057
82065
|
filePath: file.filePath,
|
|
82058
82066
|
outputPath: file.outputPath,
|
|
82067
|
+
glbOutputPath: file.glbOutputPath,
|
|
82068
|
+
previewOutputDir: file.previewOutputDir,
|
|
82059
82069
|
projectDir: options.projectDir,
|
|
82060
|
-
options:
|
|
82070
|
+
options: {
|
|
82071
|
+
...options.buildOptions,
|
|
82072
|
+
generatePreviewAssets: file.generatePreviewAssets ?? options.buildOptions?.generatePreviewAssets
|
|
82073
|
+
}
|
|
82061
82074
|
}).then(async (result) => {
|
|
82062
82075
|
results.push(result);
|
|
82063
82076
|
if (options.onJobComplete) {
|
|
@@ -82205,8 +82218,15 @@ var registerBuild = (program2) => {
|
|
|
82205
82218
|
ignoreWarnings: resolvedOptions?.ignoreWarnings,
|
|
82206
82219
|
platformConfig,
|
|
82207
82220
|
profile: resolvedOptions?.profile,
|
|
82208
|
-
injectedProps
|
|
82221
|
+
injectedProps,
|
|
82222
|
+
generatePreviewAssets: false
|
|
82209
82223
|
};
|
|
82224
|
+
const shouldGeneratePreviewImages = resolvedOptions?.previewImages || resolvedOptions?.allImages;
|
|
82225
|
+
const shouldGenerateAllPreviewImages = Boolean(resolvedOptions?.allImages);
|
|
82226
|
+
const shouldGeneratePreviewAssetsInWorker = Boolean(resolvedOptions?.ci && concurrencyValue > 1 && shouldGeneratePreviewImages);
|
|
82227
|
+
buildOptions.generatePreviewAssets = shouldGeneratePreviewAssetsInWorker;
|
|
82228
|
+
const previewEntrypointForWorker = previewComponentPath || mainEntrypoint;
|
|
82229
|
+
const resolvedPreviewEntrypointForWorker = previewEntrypointForWorker ? path39.resolve(previewEntrypointForWorker) : undefined;
|
|
82210
82230
|
const processBuildResult = async (filePath, outputPath, buildOutcome) => {
|
|
82211
82231
|
const relative3 = path39.relative(projectDir, filePath);
|
|
82212
82232
|
const outputDirName = getOutputDirName(relative3);
|
|
@@ -82275,7 +82295,27 @@ var registerBuild = (program2) => {
|
|
|
82275
82295
|
const relative3 = path39.relative(projectDir, filePath);
|
|
82276
82296
|
const outputDirName = getOutputDirName(relative3);
|
|
82277
82297
|
const outputPath = path39.join(distDir, outputDirName, "circuit.json");
|
|
82278
|
-
|
|
82298
|
+
const glbOutputPath = resolvedOptions?.glbs ? path39.join(distDir, outputDirName, "3d.glb") : undefined;
|
|
82299
|
+
const generatePreviewAssets2 = (() => {
|
|
82300
|
+
if (!shouldGeneratePreviewAssetsInWorker) {
|
|
82301
|
+
return false;
|
|
82302
|
+
}
|
|
82303
|
+
if (shouldGenerateAllPreviewImages) {
|
|
82304
|
+
return true;
|
|
82305
|
+
}
|
|
82306
|
+
if (resolvedPreviewEntrypointForWorker) {
|
|
82307
|
+
return path39.resolve(filePath) === resolvedPreviewEntrypointForWorker;
|
|
82308
|
+
}
|
|
82309
|
+
return filePath === circuitFiles[0];
|
|
82310
|
+
})();
|
|
82311
|
+
const previewOutputDir = shouldGeneratePreviewAssetsInWorker && generatePreviewAssets2 && !shouldGenerateAllPreviewImages ? distDir : path39.join(distDir, outputDirName);
|
|
82312
|
+
return {
|
|
82313
|
+
filePath,
|
|
82314
|
+
outputPath,
|
|
82315
|
+
glbOutputPath,
|
|
82316
|
+
previewOutputDir,
|
|
82317
|
+
generatePreviewAssets: generatePreviewAssets2
|
|
82318
|
+
};
|
|
82279
82319
|
});
|
|
82280
82320
|
await buildFilesWithWorkerPool({
|
|
82281
82321
|
files: filesToBuild,
|
|
@@ -82309,6 +82349,16 @@ var registerBuild = (program2) => {
|
|
|
82309
82349
|
ok: result.ok,
|
|
82310
82350
|
isFatalError: result.isFatalError
|
|
82311
82351
|
});
|
|
82352
|
+
if (resolvedOptions?.glbs && result.ok) {
|
|
82353
|
+
const outputDir = path39.dirname(result.outputPath);
|
|
82354
|
+
const prefixRelative = path39.relative(distDir, outputDir) || ".";
|
|
82355
|
+
const prefix = prefixRelative === "." ? "" : `[${prefixRelative}] `;
|
|
82356
|
+
if (result.glbOk) {
|
|
82357
|
+
console.log(`${prefix}Written 3d.glb`);
|
|
82358
|
+
} else if (result.glbOutputPath && result.glbError) {
|
|
82359
|
+
console.error(`${prefix}Failed to generate GLB: ${result.glbError}`);
|
|
82360
|
+
}
|
|
82361
|
+
}
|
|
82312
82362
|
}
|
|
82313
82363
|
});
|
|
82314
82364
|
};
|
|
@@ -82317,16 +82367,19 @@ var registerBuild = (program2) => {
|
|
|
82317
82367
|
} else {
|
|
82318
82368
|
await buildSequentially();
|
|
82319
82369
|
}
|
|
82320
|
-
const shouldGeneratePreviewImages = resolvedOptions?.previewImages || resolvedOptions?.allImages;
|
|
82321
82370
|
if (shouldGeneratePreviewImages) {
|
|
82322
|
-
|
|
82323
|
-
|
|
82324
|
-
|
|
82325
|
-
|
|
82326
|
-
|
|
82327
|
-
|
|
82328
|
-
|
|
82329
|
-
|
|
82371
|
+
if (shouldGeneratePreviewAssetsInWorker) {
|
|
82372
|
+
console.log(shouldGenerateAllPreviewImages ? "Generating preview images for all builds in worker threads..." : "Generating preview images in worker threads...");
|
|
82373
|
+
} else {
|
|
82374
|
+
console.log(shouldGenerateAllPreviewImages ? "Generating preview images for all builds..." : "Generating preview images...");
|
|
82375
|
+
await buildPreviewImages({
|
|
82376
|
+
builtFiles,
|
|
82377
|
+
distDir,
|
|
82378
|
+
mainEntrypoint,
|
|
82379
|
+
previewComponentPath,
|
|
82380
|
+
allImages: shouldGenerateAllPreviewImages
|
|
82381
|
+
});
|
|
82382
|
+
}
|
|
82330
82383
|
}
|
|
82331
82384
|
if (resolvedOptions?.previewGltf) {
|
|
82332
82385
|
console.log("Generating preview GLTF...");
|
|
@@ -82337,7 +82390,7 @@ var registerBuild = (program2) => {
|
|
|
82337
82390
|
previewComponentPath
|
|
82338
82391
|
});
|
|
82339
82392
|
}
|
|
82340
|
-
if (resolvedOptions?.glbs) {
|
|
82393
|
+
if (resolvedOptions?.glbs && concurrencyValue === 1) {
|
|
82341
82394
|
console.log("Generating GLB models for all builds...");
|
|
82342
82395
|
await buildGlbs({
|
|
82343
82396
|
builtFiles,
|
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.1050";
|
|
60439
60439
|
var package_default = {
|
|
60440
60440
|
name: "@tscircuit/cli",
|
|
60441
60441
|
version,
|