@tscircuit/cli 0.1.145 → 0.1.146
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/main.js +31 -10
- package/package.json +3 -2
package/dist/main.js
CHANGED
|
@@ -442424,7 +442424,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
|
|
|
442424
442424
|
import { execSync as execSync2 } from "node:child_process";
|
|
442425
442425
|
var import_semver2 = __toESM2(require_semver2(), 1);
|
|
442426
442426
|
// package.json
|
|
442427
|
-
var version = "0.1.
|
|
442427
|
+
var version = "0.1.145";
|
|
442428
442428
|
var package_default = {
|
|
442429
442429
|
name: "@tscircuit/cli",
|
|
442430
442430
|
version,
|
|
@@ -442433,6 +442433,7 @@ var package_default = {
|
|
|
442433
442433
|
"@babel/standalone": "^7.26.9",
|
|
442434
442434
|
"@biomejs/biome": "^1.9.4",
|
|
442435
442435
|
"@tscircuit/circuit-json-util": "^0.0.47",
|
|
442436
|
+
"@tscircuit/eval": "^0.0.238",
|
|
442436
442437
|
"@tscircuit/fake-snippets": "^0.0.87",
|
|
442437
442438
|
"@tscircuit/file-server": "^0.0.24",
|
|
442438
442439
|
"@tscircuit/math-utils": "^0.0.18",
|
|
@@ -442440,7 +442441,6 @@ var package_default = {
|
|
|
442440
442441
|
"@tscircuit/runframe": "^0.0.614",
|
|
442441
442442
|
"@tscircuit/schematic-match-adapt": "^0.0.22",
|
|
442442
442443
|
"@tscircuit/simple-3d-svg": "^0.0.10",
|
|
442443
|
-
tscircuit: "^0.0.505",
|
|
442444
442444
|
"@types/bun": "^1.2.2",
|
|
442445
442445
|
"@types/configstore": "^6.0.2",
|
|
442446
442446
|
"@types/debug": "^4.1.12",
|
|
@@ -442473,6 +442473,7 @@ var package_default = {
|
|
|
442473
442473
|
redaxios: "^0.5.1",
|
|
442474
442474
|
semver: "^7.6.3",
|
|
442475
442475
|
tempy: "^3.1.0",
|
|
442476
|
+
tscircuit: "^0.0.505",
|
|
442476
442477
|
"typed-ky": "^0.0.4"
|
|
442477
442478
|
},
|
|
442478
442479
|
peerDependencies: {
|
|
@@ -502038,7 +502039,7 @@ var setupDefaultEntrypointIfNeeded = (opts) => {
|
|
|
502038
502039
|
}
|
|
502039
502040
|
};
|
|
502040
502041
|
var CircuitRunner = class {
|
|
502041
|
-
constructor() {
|
|
502042
|
+
constructor(configuration = {}) {
|
|
502042
502043
|
this._executionContext = null;
|
|
502043
502044
|
this._circuitRunnerConfiguration = {
|
|
502044
502045
|
snippetsApiBaseUrl: "https://registry-api.tscircuit.com",
|
|
@@ -502046,6 +502047,7 @@ var CircuitRunner = class {
|
|
|
502046
502047
|
verbose: false
|
|
502047
502048
|
};
|
|
502048
502049
|
this._eventListeners = {};
|
|
502050
|
+
Object.assign(this._circuitRunnerConfiguration, configuration);
|
|
502049
502051
|
}
|
|
502050
502052
|
async executeWithFsMap(ogOpts) {
|
|
502051
502053
|
const opts = { ...ogOpts };
|
|
@@ -502058,7 +502060,8 @@ var CircuitRunner = class {
|
|
|
502058
502060
|
}
|
|
502059
502061
|
setupDefaultEntrypointIfNeeded(opts);
|
|
502060
502062
|
this._executionContext = createExecutionContext(this._circuitRunnerConfiguration, {
|
|
502061
|
-
name: opts.name
|
|
502063
|
+
name: opts.name,
|
|
502064
|
+
platform: this._circuitRunnerConfiguration.platform
|
|
502062
502065
|
});
|
|
502063
502066
|
this._bindEventListeners(this._executionContext.circuit);
|
|
502064
502067
|
this._executionContext.fsMap = normalizeFsMap(opts.fsMap);
|
|
@@ -502073,7 +502076,10 @@ var CircuitRunner = class {
|
|
|
502073
502076
|
if (this._circuitRunnerConfiguration.verbose) {
|
|
502074
502077
|
console.log("[CircuitRunner] execute called with code length:", code.length);
|
|
502075
502078
|
}
|
|
502076
|
-
this._executionContext = createExecutionContext(this._circuitRunnerConfiguration,
|
|
502079
|
+
this._executionContext = createExecutionContext(this._circuitRunnerConfiguration, {
|
|
502080
|
+
...opts,
|
|
502081
|
+
platform: this._circuitRunnerConfiguration.platform
|
|
502082
|
+
});
|
|
502077
502083
|
this._bindEventListeners(this._executionContext.circuit);
|
|
502078
502084
|
this._executionContext.fsMap["entrypoint.tsx"] = code;
|
|
502079
502085
|
globalThis.__tscircuit_circuit = this._executionContext.circuit;
|
|
@@ -502116,6 +502122,9 @@ var CircuitRunner = class {
|
|
|
502116
502122
|
async setSnippetsApiBaseUrl(baseUrl) {
|
|
502117
502123
|
this._circuitRunnerConfiguration.snippetsApiBaseUrl = baseUrl;
|
|
502118
502124
|
}
|
|
502125
|
+
async setPlatformConfig(platform) {
|
|
502126
|
+
this._circuitRunnerConfiguration.platform = platform;
|
|
502127
|
+
}
|
|
502119
502128
|
_bindEventListeners(circuit2) {
|
|
502120
502129
|
for (const event in this._eventListeners) {
|
|
502121
502130
|
for (const listener of this._eventListeners[event]) {
|
|
@@ -502145,10 +502154,13 @@ async function generateCircuitJson({
|
|
|
502145
502154
|
filePath,
|
|
502146
502155
|
outputDir,
|
|
502147
502156
|
outputFileName,
|
|
502148
|
-
saveToFile = false
|
|
502157
|
+
saveToFile = false,
|
|
502158
|
+
platformConfig: platformConfig2
|
|
502149
502159
|
}) {
|
|
502150
502160
|
debug14(`Generating circuit JSON for ${filePath}`);
|
|
502151
|
-
const runner = new CircuitRunner
|
|
502161
|
+
const runner = new CircuitRunner({
|
|
502162
|
+
platform: platformConfig2
|
|
502163
|
+
});
|
|
502152
502164
|
const projectDir = path21.dirname(filePath);
|
|
502153
502165
|
const resolvedOutputDir = outputDir || projectDir;
|
|
502154
502166
|
const relativeComponentPath = relative6(projectDir, filePath);
|
|
@@ -502498,7 +502510,10 @@ function analyzeCircuitJson(circuitJson) {
|
|
|
502498
502510
|
// cli/build/build-file.ts
|
|
502499
502511
|
var buildFile = async (input, output, projectDir, options) => {
|
|
502500
502512
|
try {
|
|
502501
|
-
const result = await generateCircuitJson({
|
|
502513
|
+
const result = await generateCircuitJson({
|
|
502514
|
+
filePath: input,
|
|
502515
|
+
platformConfig: options?.platformConfig
|
|
502516
|
+
});
|
|
502502
502517
|
fs23.mkdirSync(path23.dirname(output), { recursive: true });
|
|
502503
502518
|
fs23.writeFileSync(output, JSON.stringify(result.circuitJson, null, 2));
|
|
502504
502519
|
console.log(`Circuit JSON written to ${path23.relative(projectDir, output)}`);
|
|
@@ -502573,14 +502588,20 @@ async function getBuildEntrypoints({
|
|
|
502573
502588
|
|
|
502574
502589
|
// cli/build/register.ts
|
|
502575
502590
|
var registerBuild = (program3) => {
|
|
502576
|
-
program3.command("build").description("Run tscircuit eval and output circuit json").argument("[file]", "Path to the entry file").option("--ignore-errors", "Do not exit with code 1 on errors").option("--ignore-warnings", "Do not log warnings").action(async (file, options) => {
|
|
502591
|
+
program3.command("build").description("Run tscircuit eval and output circuit json").argument("[file]", "Path to the entry file").option("--ignore-errors", "Do not exit with code 1 on errors").option("--ignore-warnings", "Do not log warnings").option("--disable-pcb", "Disable PCB outputs").action(async (file, options) => {
|
|
502577
502592
|
const { projectDir, mainEntrypoint, circuitFiles } = await getBuildEntrypoints({ fileOrDir: file });
|
|
502593
|
+
const platformConfig2 = {
|
|
502594
|
+
pcbDisabled: options?.disablePcb
|
|
502595
|
+
};
|
|
502578
502596
|
const distDir = path25.join(projectDir, "dist");
|
|
502579
502597
|
fs25.mkdirSync(distDir, { recursive: true });
|
|
502580
502598
|
let hasErrors = false;
|
|
502581
502599
|
if (mainEntrypoint) {
|
|
502582
502600
|
const outputPath = path25.join(distDir, "circuit.json");
|
|
502583
|
-
const ok = await buildFile(mainEntrypoint, outputPath, projectDir,
|
|
502601
|
+
const ok = await buildFile(mainEntrypoint, outputPath, projectDir, {
|
|
502602
|
+
...options,
|
|
502603
|
+
platformConfig: platformConfig2
|
|
502604
|
+
});
|
|
502584
502605
|
if (!ok)
|
|
502585
502606
|
hasErrors = true;
|
|
502586
502607
|
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.146",
|
|
4
4
|
"main": "dist/main.js",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@babel/standalone": "^7.26.9",
|
|
7
7
|
"@biomejs/biome": "^1.9.4",
|
|
8
8
|
"@tscircuit/circuit-json-util": "^0.0.47",
|
|
9
|
+
"@tscircuit/eval": "^0.0.238",
|
|
9
10
|
"@tscircuit/fake-snippets": "^0.0.87",
|
|
10
11
|
"@tscircuit/file-server": "^0.0.24",
|
|
11
12
|
"@tscircuit/math-utils": "^0.0.18",
|
|
@@ -13,7 +14,6 @@
|
|
|
13
14
|
"@tscircuit/runframe": "^0.0.614",
|
|
14
15
|
"@tscircuit/schematic-match-adapt": "^0.0.22",
|
|
15
16
|
"@tscircuit/simple-3d-svg": "^0.0.10",
|
|
16
|
-
"tscircuit": "^0.0.505",
|
|
17
17
|
"@types/bun": "^1.2.2",
|
|
18
18
|
"@types/configstore": "^6.0.2",
|
|
19
19
|
"@types/debug": "^4.1.12",
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
"redaxios": "^0.5.1",
|
|
47
47
|
"semver": "^7.6.3",
|
|
48
48
|
"tempy": "^3.1.0",
|
|
49
|
+
"tscircuit": "^0.0.505",
|
|
49
50
|
"typed-ky": "^0.0.4"
|
|
50
51
|
},
|
|
51
52
|
"peerDependencies": {
|