@tscircuit/cli 0.1.1050 → 0.1.1052
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 +10909 -273
- package/dist/cli/main.js +83 -26
- 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.1051";
|
|
71668
71668
|
var package_default = {
|
|
71669
71669
|
name: "@tscircuit/cli",
|
|
71670
71670
|
version,
|
|
@@ -80669,15 +80669,11 @@ var buildFile = async (input, output, projectDir, options) => {
|
|
|
80669
80669
|
}
|
|
80670
80670
|
}
|
|
80671
80671
|
}
|
|
80672
|
-
|
|
80673
|
-
|
|
80674
|
-
|
|
80675
|
-
|
|
80676
|
-
|
|
80677
|
-
ok: true,
|
|
80678
|
-
circuitJson
|
|
80679
|
-
};
|
|
80680
|
-
}
|
|
80672
|
+
return {
|
|
80673
|
+
ok: true,
|
|
80674
|
+
circuitJson,
|
|
80675
|
+
hasErrors: errors.length > 0 && !options?.ignoreErrors
|
|
80676
|
+
};
|
|
80681
80677
|
} catch (err) {
|
|
80682
80678
|
console.error(err);
|
|
80683
80679
|
if (err instanceof Error) {
|
|
@@ -81939,6 +81935,12 @@ class WorkerPool {
|
|
|
81939
81935
|
job.resolve({
|
|
81940
81936
|
filePath: completedMsg.file_path,
|
|
81941
81937
|
outputPath: completedMsg.output_path,
|
|
81938
|
+
glbOutputPath: completedMsg.glb_output_path,
|
|
81939
|
+
previewOutputDir: completedMsg.preview_output_dir,
|
|
81940
|
+
glbOk: completedMsg.glb_ok,
|
|
81941
|
+
glbError: completedMsg.glb_error,
|
|
81942
|
+
previewOk: completedMsg.preview_ok,
|
|
81943
|
+
previewError: completedMsg.preview_error,
|
|
81942
81944
|
ok: completedMsg.ok,
|
|
81943
81945
|
isFatalError: completedMsg.isFatalError,
|
|
81944
81946
|
errors: completedMsg.errors,
|
|
@@ -81990,6 +81992,8 @@ class WorkerPool {
|
|
|
81990
81992
|
message_type: "build_file",
|
|
81991
81993
|
file_path: job.filePath,
|
|
81992
81994
|
output_path: job.outputPath,
|
|
81995
|
+
glb_output_path: job.glbOutputPath,
|
|
81996
|
+
preview_output_dir: job.previewOutputDir,
|
|
81993
81997
|
project_dir: job.projectDir,
|
|
81994
81998
|
options: job.options
|
|
81995
81999
|
};
|
|
@@ -82056,8 +82060,13 @@ async function buildFilesWithWorkerPool(options) {
|
|
|
82056
82060
|
const promise = pool.queueJob({
|
|
82057
82061
|
filePath: file.filePath,
|
|
82058
82062
|
outputPath: file.outputPath,
|
|
82063
|
+
glbOutputPath: file.glbOutputPath,
|
|
82064
|
+
previewOutputDir: file.previewOutputDir,
|
|
82059
82065
|
projectDir: options.projectDir,
|
|
82060
|
-
options:
|
|
82066
|
+
options: {
|
|
82067
|
+
...options.buildOptions,
|
|
82068
|
+
generatePreviewAssets: file.generatePreviewAssets ?? options.buildOptions?.generatePreviewAssets
|
|
82069
|
+
}
|
|
82061
82070
|
}).then(async (result) => {
|
|
82062
82071
|
results.push(result);
|
|
82063
82072
|
if (options.onJobComplete) {
|
|
@@ -82205,8 +82214,15 @@ var registerBuild = (program2) => {
|
|
|
82205
82214
|
ignoreWarnings: resolvedOptions?.ignoreWarnings,
|
|
82206
82215
|
platformConfig,
|
|
82207
82216
|
profile: resolvedOptions?.profile,
|
|
82208
|
-
injectedProps
|
|
82217
|
+
injectedProps,
|
|
82218
|
+
generatePreviewAssets: false
|
|
82209
82219
|
};
|
|
82220
|
+
const shouldGeneratePreviewImages = resolvedOptions?.previewImages || resolvedOptions?.allImages;
|
|
82221
|
+
const shouldGenerateAllPreviewImages = Boolean(resolvedOptions?.allImages);
|
|
82222
|
+
const shouldGeneratePreviewAssetsInWorker = Boolean(resolvedOptions?.ci && concurrencyValue > 1 && shouldGeneratePreviewImages);
|
|
82223
|
+
buildOptions.generatePreviewAssets = shouldGeneratePreviewAssetsInWorker;
|
|
82224
|
+
const previewEntrypointForWorker = previewComponentPath || mainEntrypoint;
|
|
82225
|
+
const resolvedPreviewEntrypointForWorker = previewEntrypointForWorker ? path39.resolve(previewEntrypointForWorker) : undefined;
|
|
82210
82226
|
const processBuildResult = async (filePath, outputPath, buildOutcome) => {
|
|
82211
82227
|
const relative3 = path39.relative(projectDir, filePath);
|
|
82212
82228
|
const outputDirName = getOutputDirName(relative3);
|
|
@@ -82215,6 +82231,9 @@ var registerBuild = (program2) => {
|
|
|
82215
82231
|
outputPath,
|
|
82216
82232
|
ok: buildOutcome.ok
|
|
82217
82233
|
});
|
|
82234
|
+
if (buildOutcome.hasErrors) {
|
|
82235
|
+
hasErrors = true;
|
|
82236
|
+
}
|
|
82218
82237
|
if (!buildOutcome.ok) {
|
|
82219
82238
|
hasErrors = true;
|
|
82220
82239
|
if (buildOutcome.isFatalError) {
|
|
@@ -82275,7 +82294,27 @@ var registerBuild = (program2) => {
|
|
|
82275
82294
|
const relative3 = path39.relative(projectDir, filePath);
|
|
82276
82295
|
const outputDirName = getOutputDirName(relative3);
|
|
82277
82296
|
const outputPath = path39.join(distDir, outputDirName, "circuit.json");
|
|
82278
|
-
|
|
82297
|
+
const glbOutputPath = resolvedOptions?.glbs ? path39.join(distDir, outputDirName, "3d.glb") : undefined;
|
|
82298
|
+
const generatePreviewAssets2 = (() => {
|
|
82299
|
+
if (!shouldGeneratePreviewAssetsInWorker) {
|
|
82300
|
+
return false;
|
|
82301
|
+
}
|
|
82302
|
+
if (shouldGenerateAllPreviewImages) {
|
|
82303
|
+
return true;
|
|
82304
|
+
}
|
|
82305
|
+
if (resolvedPreviewEntrypointForWorker) {
|
|
82306
|
+
return path39.resolve(filePath) === resolvedPreviewEntrypointForWorker;
|
|
82307
|
+
}
|
|
82308
|
+
return filePath === circuitFiles[0];
|
|
82309
|
+
})();
|
|
82310
|
+
const previewOutputDir = shouldGeneratePreviewAssetsInWorker && generatePreviewAssets2 && !shouldGenerateAllPreviewImages ? distDir : path39.join(distDir, outputDirName);
|
|
82311
|
+
return {
|
|
82312
|
+
filePath,
|
|
82313
|
+
outputPath,
|
|
82314
|
+
glbOutputPath,
|
|
82315
|
+
previewOutputDir,
|
|
82316
|
+
generatePreviewAssets: generatePreviewAssets2
|
|
82317
|
+
};
|
|
82279
82318
|
});
|
|
82280
82319
|
await buildFilesWithWorkerPool({
|
|
82281
82320
|
files: filesToBuild,
|
|
@@ -82291,7 +82330,11 @@ var registerBuild = (program2) => {
|
|
|
82291
82330
|
onJobComplete: async (result) => {
|
|
82292
82331
|
const relative3 = path39.relative(projectDir, result.filePath);
|
|
82293
82332
|
if (result.ok) {
|
|
82294
|
-
|
|
82333
|
+
if (result.hasErrors) {
|
|
82334
|
+
console.log(kleur_default.yellow(`⚠ ${relative3} (${result.errors.length} error(s))`));
|
|
82335
|
+
} else {
|
|
82336
|
+
console.log(kleur_default.green(`✓ ${relative3}`));
|
|
82337
|
+
}
|
|
82295
82338
|
} else {
|
|
82296
82339
|
console.log(kleur_default.red(`✗ ${relative3}`));
|
|
82297
82340
|
for (const error of result.errors) {
|
|
@@ -82307,8 +82350,19 @@ var registerBuild = (program2) => {
|
|
|
82307
82350
|
}
|
|
82308
82351
|
await processBuildResult(result.filePath, result.outputPath, {
|
|
82309
82352
|
ok: result.ok,
|
|
82353
|
+
hasErrors: result.hasErrors,
|
|
82310
82354
|
isFatalError: result.isFatalError
|
|
82311
82355
|
});
|
|
82356
|
+
if (resolvedOptions?.glbs && result.ok) {
|
|
82357
|
+
const outputDir = path39.dirname(result.outputPath);
|
|
82358
|
+
const prefixRelative = path39.relative(distDir, outputDir) || ".";
|
|
82359
|
+
const prefix = prefixRelative === "." ? "" : `[${prefixRelative}] `;
|
|
82360
|
+
if (result.glbOk) {
|
|
82361
|
+
console.log(`${prefix}Written 3d.glb`);
|
|
82362
|
+
} else if (result.glbOutputPath && result.glbError) {
|
|
82363
|
+
console.error(`${prefix}Failed to generate GLB: ${result.glbError}`);
|
|
82364
|
+
}
|
|
82365
|
+
}
|
|
82312
82366
|
}
|
|
82313
82367
|
});
|
|
82314
82368
|
};
|
|
@@ -82317,16 +82371,19 @@ var registerBuild = (program2) => {
|
|
|
82317
82371
|
} else {
|
|
82318
82372
|
await buildSequentially();
|
|
82319
82373
|
}
|
|
82320
|
-
const shouldGeneratePreviewImages = resolvedOptions?.previewImages || resolvedOptions?.allImages;
|
|
82321
82374
|
if (shouldGeneratePreviewImages) {
|
|
82322
|
-
|
|
82323
|
-
|
|
82324
|
-
|
|
82325
|
-
|
|
82326
|
-
|
|
82327
|
-
|
|
82328
|
-
|
|
82329
|
-
|
|
82375
|
+
if (shouldGeneratePreviewAssetsInWorker) {
|
|
82376
|
+
console.log(shouldGenerateAllPreviewImages ? "Generating preview images for all builds in worker threads..." : "Generating preview images in worker threads...");
|
|
82377
|
+
} else {
|
|
82378
|
+
console.log(shouldGenerateAllPreviewImages ? "Generating preview images for all builds..." : "Generating preview images...");
|
|
82379
|
+
await buildPreviewImages({
|
|
82380
|
+
builtFiles,
|
|
82381
|
+
distDir,
|
|
82382
|
+
mainEntrypoint,
|
|
82383
|
+
previewComponentPath,
|
|
82384
|
+
allImages: shouldGenerateAllPreviewImages
|
|
82385
|
+
});
|
|
82386
|
+
}
|
|
82330
82387
|
}
|
|
82331
82388
|
if (resolvedOptions?.previewGltf) {
|
|
82332
82389
|
console.log("Generating preview GLTF...");
|
|
@@ -82337,7 +82394,7 @@ var registerBuild = (program2) => {
|
|
|
82337
82394
|
previewComponentPath
|
|
82338
82395
|
});
|
|
82339
82396
|
}
|
|
82340
|
-
if (resolvedOptions?.glbs) {
|
|
82397
|
+
if (resolvedOptions?.glbs && concurrencyValue === 1) {
|
|
82341
82398
|
console.log("Generating GLB models for all builds...");
|
|
82342
82399
|
await buildGlbs({
|
|
82343
82400
|
builtFiles,
|
|
@@ -82458,7 +82515,7 @@ var registerBuild = (program2) => {
|
|
|
82458
82515
|
}
|
|
82459
82516
|
}
|
|
82460
82517
|
}
|
|
82461
|
-
const shouldExitNonZero = hasFatalErrors
|
|
82518
|
+
const shouldExitNonZero = hasFatalErrors;
|
|
82462
82519
|
const successCount = builtFiles.filter((f) => f.ok).length;
|
|
82463
82520
|
const failCount = builtFiles.length - successCount;
|
|
82464
82521
|
const enabledOpts = [
|
|
@@ -82495,7 +82552,7 @@ var registerBuild = (program2) => {
|
|
|
82495
82552
|
⚠ Build completed with errors`) : kleur_default.green(`
|
|
82496
82553
|
✓ Done`));
|
|
82497
82554
|
if (shouldExitNonZero) {
|
|
82498
|
-
exitBuild(1,
|
|
82555
|
+
exitBuild(1, "fatal circuit build errors occurred");
|
|
82499
82556
|
}
|
|
82500
82557
|
exitBuild(0, "build finished successfully");
|
|
82501
82558
|
} catch (error) {
|
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.1051";
|
|
60439
60439
|
var package_default = {
|
|
60440
60440
|
name: "@tscircuit/cli",
|
|
60441
60441
|
version,
|