@tscircuit/cli 0.1.990 → 0.1.991
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 +31 -24
- package/dist/cli/main.js +21 -14
- package/dist/lib/index.js +1 -1
- package/package.json +1 -1
|
@@ -2481,10 +2481,32 @@ export default {
|
|
|
2481
2481
|
});
|
|
2482
2482
|
|
|
2483
2483
|
// cli/build/build-worker-entrypoint.ts
|
|
2484
|
-
import path5 from "node:path";
|
|
2485
2484
|
import fs5 from "node:fs";
|
|
2485
|
+
import path5 from "node:path";
|
|
2486
2486
|
import { parentPort } from "node:worker_threads";
|
|
2487
2487
|
|
|
2488
|
+
// lib/shared/circuit-json-diagnostics.ts
|
|
2489
|
+
function analyzeCircuitJson(circuitJson) {
|
|
2490
|
+
const errors = [];
|
|
2491
|
+
const warnings = [];
|
|
2492
|
+
for (const item of circuitJson) {
|
|
2493
|
+
if (!item || typeof item !== "object")
|
|
2494
|
+
continue;
|
|
2495
|
+
const t = item.type;
|
|
2496
|
+
if (typeof t === "string") {
|
|
2497
|
+
if (t.endsWith("_error"))
|
|
2498
|
+
errors.push(item);
|
|
2499
|
+
else if (t.endsWith("_warning"))
|
|
2500
|
+
warnings.push(item);
|
|
2501
|
+
}
|
|
2502
|
+
if ("error_type" in item)
|
|
2503
|
+
errors.push(item);
|
|
2504
|
+
if ("warning_type" in item)
|
|
2505
|
+
warnings.push(item);
|
|
2506
|
+
}
|
|
2507
|
+
return { errors, warnings };
|
|
2508
|
+
}
|
|
2509
|
+
|
|
2488
2510
|
// lib/shared/generate-circuit-json.tsx
|
|
2489
2511
|
var import_make_vfs = __toESM(require_dist(), 1);
|
|
2490
2512
|
import path2 from "node:path";
|
|
@@ -2614,28 +2636,6 @@ async function generateCircuitJson({
|
|
|
2614
2636
|
};
|
|
2615
2637
|
}
|
|
2616
2638
|
|
|
2617
|
-
// lib/shared/circuit-json-diagnostics.ts
|
|
2618
|
-
function analyzeCircuitJson(circuitJson) {
|
|
2619
|
-
const errors = [];
|
|
2620
|
-
const warnings = [];
|
|
2621
|
-
for (const item of circuitJson) {
|
|
2622
|
-
if (!item || typeof item !== "object")
|
|
2623
|
-
continue;
|
|
2624
|
-
const t = item.type;
|
|
2625
|
-
if (typeof t === "string") {
|
|
2626
|
-
if (t.endsWith("_error"))
|
|
2627
|
-
errors.push(item);
|
|
2628
|
-
else if (t.endsWith("_warning"))
|
|
2629
|
-
warnings.push(item);
|
|
2630
|
-
}
|
|
2631
|
-
if ("error_type" in item)
|
|
2632
|
-
errors.push(item);
|
|
2633
|
-
if ("warning_type" in item)
|
|
2634
|
-
warnings.push(item);
|
|
2635
|
-
}
|
|
2636
|
-
return { errors, warnings };
|
|
2637
|
-
}
|
|
2638
|
-
|
|
2639
2639
|
// lib/shared/get-complete-platform-config.ts
|
|
2640
2640
|
import { getPlatformConfig } from "@tscircuit/eval/platform-config";
|
|
2641
2641
|
import { createHash } from "node:crypto";
|
|
@@ -2786,7 +2786,14 @@ var handleBuildFile = async (filePath, outputPath, projectDir, options) => {
|
|
|
2786
2786
|
workerLog(`Generating circuit JSON for ${path5.relative(projectDir, filePath)}...`);
|
|
2787
2787
|
await registerStaticAssetLoaders();
|
|
2788
2788
|
const completePlatformConfig = getCompletePlatformConfig(options?.platformConfig);
|
|
2789
|
-
const
|
|
2789
|
+
const normalizedInputPath = filePath.toLowerCase().replaceAll("\\", "/");
|
|
2790
|
+
const isPrebuiltCircuitJson = normalizedInputPath.endsWith(".circuit.json") || normalizedInputPath.endsWith("/circuit.json");
|
|
2791
|
+
const result = isPrebuiltCircuitJson ? {
|
|
2792
|
+
circuitJson: (() => {
|
|
2793
|
+
const parsed = JSON.parse(fs5.readFileSync(filePath, "utf-8"));
|
|
2794
|
+
return Array.isArray(parsed) ? parsed : [];
|
|
2795
|
+
})()
|
|
2796
|
+
} : await generateCircuitJson({
|
|
2790
2797
|
filePath,
|
|
2791
2798
|
platformConfig: completePlatformConfig
|
|
2792
2799
|
});
|
package/dist/cli/main.js
CHANGED
|
@@ -74413,7 +74413,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
|
|
|
74413
74413
|
import { execSync as execSync2 } from "node:child_process";
|
|
74414
74414
|
var import_semver2 = __toESM2(require_semver2(), 1);
|
|
74415
74415
|
// package.json
|
|
74416
|
-
var version = "0.1.
|
|
74416
|
+
var version = "0.1.990";
|
|
74417
74417
|
var package_default = {
|
|
74418
74418
|
name: "@tscircuit/cli",
|
|
74419
74419
|
main: "dist/cli/main.js",
|
|
@@ -174892,7 +174892,8 @@ function analyzeCircuitJson(circuitJson) {
|
|
|
174892
174892
|
var buildFile = async (input, output, projectDir, options) => {
|
|
174893
174893
|
try {
|
|
174894
174894
|
console.log("Generating circuit JSON...");
|
|
174895
|
-
const
|
|
174895
|
+
const normalizedInputPath = input.toLowerCase().replaceAll("\\", "/");
|
|
174896
|
+
const isPrebuiltCircuitJson = normalizedInputPath.endsWith(".circuit.json") || normalizedInputPath.endsWith("/circuit.json");
|
|
174896
174897
|
let circuitJson = [];
|
|
174897
174898
|
if (isPrebuiltCircuitJson) {
|
|
174898
174899
|
const parsed = JSON.parse(fs45.readFileSync(input, "utf-8"));
|
|
@@ -175258,17 +175259,6 @@ var buildPreviewImages = async ({
|
|
|
175258
175259
|
});
|
|
175259
175260
|
};
|
|
175260
175261
|
|
|
175261
|
-
// cli/build/utils/exit-build.ts
|
|
175262
|
-
var exitBuild = (code, reason) => {
|
|
175263
|
-
const message = `Build exiting with code ${code}: ${reason}`;
|
|
175264
|
-
if (code === 0) {
|
|
175265
|
-
console.log(kleur_default.dim(message));
|
|
175266
|
-
} else {
|
|
175267
|
-
console.error(kleur_default.yellow(message));
|
|
175268
|
-
}
|
|
175269
|
-
process.exit(code);
|
|
175270
|
-
};
|
|
175271
|
-
|
|
175272
175262
|
// cli/build/generate-kicad-project.ts
|
|
175273
175263
|
import fs49 from "node:fs";
|
|
175274
175264
|
import path50 from "node:path";
|
|
@@ -175799,6 +175789,17 @@ var transpileFile = async ({
|
|
|
175799
175789
|
}
|
|
175800
175790
|
};
|
|
175801
175791
|
|
|
175792
|
+
// cli/build/utils/exit-build.ts
|
|
175793
|
+
var exitBuild = (code, reason) => {
|
|
175794
|
+
const message = `Build exiting with code ${code}: ${reason}`;
|
|
175795
|
+
if (code === 0) {
|
|
175796
|
+
console.log(kleur_default.dim(message));
|
|
175797
|
+
} else {
|
|
175798
|
+
console.error(kleur_default.yellow(message));
|
|
175799
|
+
}
|
|
175800
|
+
process.exit(code);
|
|
175801
|
+
};
|
|
175802
|
+
|
|
175802
175803
|
// cli/build/worker-pool.ts
|
|
175803
175804
|
import fs53 from "node:fs";
|
|
175804
175805
|
import path54 from "node:path";
|
|
@@ -176008,7 +176009,13 @@ async function buildFilesWithWorkerPool(options) {
|
|
|
176008
176009
|
|
|
176009
176010
|
// cli/build/register.ts
|
|
176010
176011
|
var normalizeRelativePath = (projectDir, targetPath) => path55.relative(projectDir, targetPath).split(path55.sep).join("/");
|
|
176011
|
-
var getOutputDirName = (relativePath) =>
|
|
176012
|
+
var getOutputDirName = (relativePath) => {
|
|
176013
|
+
const normalizedRelativePath = relativePath.toLowerCase().replaceAll("\\", "/");
|
|
176014
|
+
if (normalizedRelativePath === "circuit.json" || normalizedRelativePath.endsWith("/circuit.json")) {
|
|
176015
|
+
return path55.dirname(relativePath);
|
|
176016
|
+
}
|
|
176017
|
+
return relativePath.replace(/(\.board|\.circuit)?\.tsx$/, "").replace(/\.circuit\.json$/, "");
|
|
176018
|
+
};
|
|
176012
176019
|
var registerBuild = (program3) => {
|
|
176013
176020
|
program3.command("build").description("Run tscircuit eval and output circuit json").argument("[file]", "Path to the entry file").option("--ci", "Run install and optional prebuild/build commands (or default CI build)").option("--ignore-errors", "Do not exit with code 1 on errors").option("--ignore-warnings", "Do not log warnings").option("--ignore-config", "Ignore options from tscircuit.config.json").option("--disable-pcb", "Disable PCB outputs").option("--disable-parts-engine", "Disable the parts engine").option("--site", "Generate a static site in the dist directory").option("--transpile", "Transpile the entry file to JavaScript").option("--preview-images", "Generate preview images in the dist directory").option("--all-images", "Generate preview images for every successful build output").option("--kicad-project", "Generate KiCad project directories for each successful build output").option("--kicad-library", "Generate KiCad library in dist/kicad-library").option("--kicad-library-name <name>", "Specify the name of the KiCad library").option("--preview-gltf", "Generate a GLTF file from the preview entrypoint").option("--glbs", "Generate GLB 3D model files for every successful build").option("--profile", "Log per-circuit circuit.json generation time during build").option("--kicad-pcm", "Generate KiCad PCM (Plugin and Content Manager) assets in dist/pcm").option("--use-cdn-javascript", "Use CDN-hosted JavaScript instead of bundled standalone file for --site").option("--concurrency <number>", "Number of files to build in parallel (default: 1)", "1").action(async (file, options) => {
|
|
176014
176021
|
try {
|
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.990";
|
|
60436
60436
|
var package_default = {
|
|
60437
60437
|
name: "@tscircuit/cli",
|
|
60438
60438
|
main: "dist/cli/main.js",
|