@tscircuit/cli 0.1.2453 → 0.1.2454
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.js +268 -206
- package/dist/cli/main.js +2 -2
- package/package.json +1 -1
|
@@ -31483,7 +31483,7 @@ var init_dot_prop = __esm(() => {
|
|
|
31483
31483
|
});
|
|
31484
31484
|
|
|
31485
31485
|
// node_modules/env-paths/index.js
|
|
31486
|
-
import
|
|
31486
|
+
import path14 from "node:path";
|
|
31487
31487
|
import os from "node:os";
|
|
31488
31488
|
import process3 from "node:process";
|
|
31489
31489
|
function envPaths(name, { suffix = "nodejs" } = {}) {
|
|
@@ -31502,32 +31502,32 @@ function envPaths(name, { suffix = "nodejs" } = {}) {
|
|
|
31502
31502
|
return linux(name);
|
|
31503
31503
|
}
|
|
31504
31504
|
var homedir, tmpdir, env, macos = (name) => {
|
|
31505
|
-
const library =
|
|
31505
|
+
const library = path14.join(homedir, "Library");
|
|
31506
31506
|
return {
|
|
31507
|
-
data:
|
|
31508
|
-
config:
|
|
31509
|
-
cache:
|
|
31510
|
-
log:
|
|
31511
|
-
temp:
|
|
31507
|
+
data: path14.join(library, "Application Support", name),
|
|
31508
|
+
config: path14.join(library, "Preferences", name),
|
|
31509
|
+
cache: path14.join(library, "Caches", name),
|
|
31510
|
+
log: path14.join(library, "Logs", name),
|
|
31511
|
+
temp: path14.join(tmpdir, name)
|
|
31512
31512
|
};
|
|
31513
31513
|
}, windows = (name) => {
|
|
31514
|
-
const appData = env.APPDATA ||
|
|
31515
|
-
const localAppData = env.LOCALAPPDATA ||
|
|
31514
|
+
const appData = env.APPDATA || path14.join(homedir, "AppData", "Roaming");
|
|
31515
|
+
const localAppData = env.LOCALAPPDATA || path14.join(homedir, "AppData", "Local");
|
|
31516
31516
|
return {
|
|
31517
|
-
data:
|
|
31518
|
-
config:
|
|
31519
|
-
cache:
|
|
31520
|
-
log:
|
|
31521
|
-
temp:
|
|
31517
|
+
data: path14.join(localAppData, name, "Data"),
|
|
31518
|
+
config: path14.join(appData, name, "Config"),
|
|
31519
|
+
cache: path14.join(localAppData, name, "Cache"),
|
|
31520
|
+
log: path14.join(localAppData, name, "Log"),
|
|
31521
|
+
temp: path14.join(tmpdir, name)
|
|
31522
31522
|
};
|
|
31523
31523
|
}, linux = (name) => {
|
|
31524
|
-
const username =
|
|
31524
|
+
const username = path14.basename(homedir);
|
|
31525
31525
|
return {
|
|
31526
|
-
data:
|
|
31527
|
-
config:
|
|
31528
|
-
cache:
|
|
31529
|
-
log:
|
|
31530
|
-
temp:
|
|
31526
|
+
data: path14.join(env.XDG_DATA_HOME || path14.join(homedir, ".local", "share"), name),
|
|
31527
|
+
config: path14.join(env.XDG_CONFIG_HOME || path14.join(homedir, ".config"), name),
|
|
31528
|
+
cache: path14.join(env.XDG_CACHE_HOME || path14.join(homedir, ".cache"), name),
|
|
31529
|
+
log: path14.join(env.XDG_STATE_HOME || path14.join(homedir, ".local", "state"), name),
|
|
31530
|
+
temp: path14.join(tmpdir, username, name)
|
|
31531
31531
|
};
|
|
31532
31532
|
};
|
|
31533
31533
|
var init_env_paths = __esm(() => {
|
|
@@ -31685,7 +31685,7 @@ var init_constants2 = __esm(() => {
|
|
|
31685
31685
|
});
|
|
31686
31686
|
|
|
31687
31687
|
// node_modules/stubborn-fs/dist/index.js
|
|
31688
|
-
import
|
|
31688
|
+
import fs11 from "node:fs";
|
|
31689
31689
|
import { promisify } from "node:util";
|
|
31690
31690
|
var FS, dist_default;
|
|
31691
31691
|
var init_dist4 = __esm(() => {
|
|
@@ -31694,41 +31694,41 @@ var init_dist4 = __esm(() => {
|
|
|
31694
31694
|
init_constants2();
|
|
31695
31695
|
FS = {
|
|
31696
31696
|
attempt: {
|
|
31697
|
-
chmod: attemptify_async_default(promisify(
|
|
31698
|
-
chown: attemptify_async_default(promisify(
|
|
31699
|
-
close: attemptify_async_default(promisify(
|
|
31700
|
-
fsync: attemptify_async_default(promisify(
|
|
31701
|
-
mkdir: attemptify_async_default(promisify(
|
|
31702
|
-
realpath: attemptify_async_default(promisify(
|
|
31703
|
-
stat: attemptify_async_default(promisify(
|
|
31704
|
-
unlink: attemptify_async_default(promisify(
|
|
31705
|
-
chmodSync: attemptify_sync_default(
|
|
31706
|
-
chownSync: attemptify_sync_default(
|
|
31707
|
-
closeSync: attemptify_sync_default(
|
|
31708
|
-
existsSync: attemptify_sync_default(
|
|
31709
|
-
fsyncSync: attemptify_sync_default(
|
|
31710
|
-
mkdirSync: attemptify_sync_default(
|
|
31711
|
-
realpathSync: attemptify_sync_default(
|
|
31712
|
-
statSync: attemptify_sync_default(
|
|
31713
|
-
unlinkSync: attemptify_sync_default(
|
|
31697
|
+
chmod: attemptify_async_default(promisify(fs11.chmod), ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
|
|
31698
|
+
chown: attemptify_async_default(promisify(fs11.chown), ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
|
|
31699
|
+
close: attemptify_async_default(promisify(fs11.close), ATTEMPTIFY_NOOP_OPTIONS),
|
|
31700
|
+
fsync: attemptify_async_default(promisify(fs11.fsync), ATTEMPTIFY_NOOP_OPTIONS),
|
|
31701
|
+
mkdir: attemptify_async_default(promisify(fs11.mkdir), ATTEMPTIFY_NOOP_OPTIONS),
|
|
31702
|
+
realpath: attemptify_async_default(promisify(fs11.realpath), ATTEMPTIFY_NOOP_OPTIONS),
|
|
31703
|
+
stat: attemptify_async_default(promisify(fs11.stat), ATTEMPTIFY_NOOP_OPTIONS),
|
|
31704
|
+
unlink: attemptify_async_default(promisify(fs11.unlink), ATTEMPTIFY_NOOP_OPTIONS),
|
|
31705
|
+
chmodSync: attemptify_sync_default(fs11.chmodSync, ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
|
|
31706
|
+
chownSync: attemptify_sync_default(fs11.chownSync, ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
|
|
31707
|
+
closeSync: attemptify_sync_default(fs11.closeSync, ATTEMPTIFY_NOOP_OPTIONS),
|
|
31708
|
+
existsSync: attemptify_sync_default(fs11.existsSync, ATTEMPTIFY_NOOP_OPTIONS),
|
|
31709
|
+
fsyncSync: attemptify_sync_default(fs11.fsync, ATTEMPTIFY_NOOP_OPTIONS),
|
|
31710
|
+
mkdirSync: attemptify_sync_default(fs11.mkdirSync, ATTEMPTIFY_NOOP_OPTIONS),
|
|
31711
|
+
realpathSync: attemptify_sync_default(fs11.realpathSync, ATTEMPTIFY_NOOP_OPTIONS),
|
|
31712
|
+
statSync: attemptify_sync_default(fs11.statSync, ATTEMPTIFY_NOOP_OPTIONS),
|
|
31713
|
+
unlinkSync: attemptify_sync_default(fs11.unlinkSync, ATTEMPTIFY_NOOP_OPTIONS)
|
|
31714
31714
|
},
|
|
31715
31715
|
retry: {
|
|
31716
|
-
close: retryify_async_default(promisify(
|
|
31717
|
-
fsync: retryify_async_default(promisify(
|
|
31718
|
-
open: retryify_async_default(promisify(
|
|
31719
|
-
readFile: retryify_async_default(promisify(
|
|
31720
|
-
rename: retryify_async_default(promisify(
|
|
31721
|
-
stat: retryify_async_default(promisify(
|
|
31722
|
-
write: retryify_async_default(promisify(
|
|
31723
|
-
writeFile: retryify_async_default(promisify(
|
|
31724
|
-
closeSync: retryify_sync_default(
|
|
31725
|
-
fsyncSync: retryify_sync_default(
|
|
31726
|
-
openSync: retryify_sync_default(
|
|
31727
|
-
readFileSync: retryify_sync_default(
|
|
31728
|
-
renameSync: retryify_sync_default(
|
|
31729
|
-
statSync: retryify_sync_default(
|
|
31730
|
-
writeSync: retryify_sync_default(
|
|
31731
|
-
writeFileSync: retryify_sync_default(
|
|
31716
|
+
close: retryify_async_default(promisify(fs11.close), RETRYIFY_OPTIONS),
|
|
31717
|
+
fsync: retryify_async_default(promisify(fs11.fsync), RETRYIFY_OPTIONS),
|
|
31718
|
+
open: retryify_async_default(promisify(fs11.open), RETRYIFY_OPTIONS),
|
|
31719
|
+
readFile: retryify_async_default(promisify(fs11.readFile), RETRYIFY_OPTIONS),
|
|
31720
|
+
rename: retryify_async_default(promisify(fs11.rename), RETRYIFY_OPTIONS),
|
|
31721
|
+
stat: retryify_async_default(promisify(fs11.stat), RETRYIFY_OPTIONS),
|
|
31722
|
+
write: retryify_async_default(promisify(fs11.write), RETRYIFY_OPTIONS),
|
|
31723
|
+
writeFile: retryify_async_default(promisify(fs11.writeFile), RETRYIFY_OPTIONS),
|
|
31724
|
+
closeSync: retryify_sync_default(fs11.closeSync, RETRYIFY_OPTIONS),
|
|
31725
|
+
fsyncSync: retryify_sync_default(fs11.fsyncSync, RETRYIFY_OPTIONS),
|
|
31726
|
+
openSync: retryify_sync_default(fs11.openSync, RETRYIFY_OPTIONS),
|
|
31727
|
+
readFileSync: retryify_sync_default(fs11.readFileSync, RETRYIFY_OPTIONS),
|
|
31728
|
+
renameSync: retryify_sync_default(fs11.renameSync, RETRYIFY_OPTIONS),
|
|
31729
|
+
statSync: retryify_sync_default(fs11.statSync, RETRYIFY_OPTIONS),
|
|
31730
|
+
writeSync: retryify_sync_default(fs11.writeSync, RETRYIFY_OPTIONS),
|
|
31731
|
+
writeFileSync: retryify_sync_default(fs11.writeFileSync, RETRYIFY_OPTIONS)
|
|
31732
31732
|
}
|
|
31733
31733
|
};
|
|
31734
31734
|
dist_default = FS;
|
|
@@ -31835,7 +31835,7 @@ var init_node = __esm(() => {
|
|
|
31835
31835
|
});
|
|
31836
31836
|
|
|
31837
31837
|
// node_modules/atomically/dist/utils/temp.js
|
|
31838
|
-
import
|
|
31838
|
+
import path15 from "node:path";
|
|
31839
31839
|
var Temp, temp_default;
|
|
31840
31840
|
var init_temp = __esm(() => {
|
|
31841
31841
|
init_dist4();
|
|
@@ -31877,7 +31877,7 @@ var init_temp = __esm(() => {
|
|
|
31877
31877
|
}
|
|
31878
31878
|
},
|
|
31879
31879
|
truncate: (filePath) => {
|
|
31880
|
-
const basename =
|
|
31880
|
+
const basename = path15.basename(filePath);
|
|
31881
31881
|
if (basename.length <= LIMIT_BASENAME_LENGTH)
|
|
31882
31882
|
return filePath;
|
|
31883
31883
|
const truncable = /^(\.?)(.*?)((?:\.[^.]+)?(?:\.tmp-\d{10}[a-f0-9]{6})?)$/.exec(basename);
|
|
@@ -31892,7 +31892,7 @@ var init_temp = __esm(() => {
|
|
|
31892
31892
|
});
|
|
31893
31893
|
|
|
31894
31894
|
// node_modules/atomically/dist/index.js
|
|
31895
|
-
import
|
|
31895
|
+
import path16 from "node:path";
|
|
31896
31896
|
function writeFileSync2(filePath, data, options = DEFAULT_WRITE_OPTIONS) {
|
|
31897
31897
|
if (isString(options))
|
|
31898
31898
|
return writeFileSync2(filePath, data, { encoding: options });
|
|
@@ -31921,7 +31921,7 @@ function writeFileSync2(filePath, data, options = DEFAULT_WRITE_OPTIONS) {
|
|
|
31921
31921
|
}
|
|
31922
31922
|
}
|
|
31923
31923
|
if (!filePathExists) {
|
|
31924
|
-
const parentPath =
|
|
31924
|
+
const parentPath = path16.dirname(filePath);
|
|
31925
31925
|
dist_default.attempt.mkdirSync(parentPath, {
|
|
31926
31926
|
mode: DEFAULT_FOLDER_MODE,
|
|
31927
31927
|
recursive: true
|
|
@@ -39865,8 +39865,8 @@ var init_uint8array_extras = __esm(() => {
|
|
|
39865
39865
|
// node_modules/conf/dist/source/index.js
|
|
39866
39866
|
import { isDeepStrictEqual } from "node:util";
|
|
39867
39867
|
import process8 from "node:process";
|
|
39868
|
-
import
|
|
39869
|
-
import
|
|
39868
|
+
import fs12 from "node:fs";
|
|
39869
|
+
import path17 from "node:path";
|
|
39870
39870
|
import crypto from "node:crypto";
|
|
39871
39871
|
import assert3 from "node:assert";
|
|
39872
39872
|
var import__2020, import_ajv_formats, import_semver2, ajvFormats, encryptionAlgorithm = "aes-256-cbc", createPlainObject = () => Object.create(null), isExist = (data) => data !== undefined && data !== null, checkValueType = (key, value) => {
|
|
@@ -39952,7 +39952,7 @@ var init_source = __esm(() => {
|
|
|
39952
39952
|
this.events = new EventTarget;
|
|
39953
39953
|
this.#encryptionKey = options.encryptionKey;
|
|
39954
39954
|
const fileExtension = options.fileExtension ? `.${options.fileExtension}` : "";
|
|
39955
|
-
this.path =
|
|
39955
|
+
this.path = path17.resolve(options.cwd, `${options.configName ?? "config"}${fileExtension}`);
|
|
39956
39956
|
const fileStore = this.store;
|
|
39957
39957
|
const store = Object.assign(createPlainObject(), options.defaults, fileStore);
|
|
39958
39958
|
if (options.migrations) {
|
|
@@ -40055,7 +40055,7 @@ var init_source = __esm(() => {
|
|
|
40055
40055
|
}
|
|
40056
40056
|
get store() {
|
|
40057
40057
|
try {
|
|
40058
|
-
const data =
|
|
40058
|
+
const data = fs12.readFileSync(this.path, this.#encryptionKey ? null : "utf8");
|
|
40059
40059
|
const dataString = this._encryptData(data);
|
|
40060
40060
|
const deserializedData = this._deserialize(dataString);
|
|
40061
40061
|
this._validate(deserializedData);
|
|
@@ -40126,7 +40126,7 @@ var init_source = __esm(() => {
|
|
|
40126
40126
|
throw new Error("Config schema violation: " + errors.join("; "));
|
|
40127
40127
|
}
|
|
40128
40128
|
_ensureDirectory() {
|
|
40129
|
-
|
|
40129
|
+
fs12.mkdirSync(path17.dirname(this.path), { recursive: true });
|
|
40130
40130
|
}
|
|
40131
40131
|
_write(value) {
|
|
40132
40132
|
let data = this._serialize(value);
|
|
@@ -40137,13 +40137,13 @@ var init_source = __esm(() => {
|
|
|
40137
40137
|
data = concatUint8Arrays2([initializationVector, stringToUint8Array(":"), cipher.update(stringToUint8Array(data)), cipher.final()]);
|
|
40138
40138
|
}
|
|
40139
40139
|
if (process8.env.SNAP) {
|
|
40140
|
-
|
|
40140
|
+
fs12.writeFileSync(this.path, data, { mode: this.#options.configFileMode });
|
|
40141
40141
|
} else {
|
|
40142
40142
|
try {
|
|
40143
40143
|
writeFileSync2(this.path, data, { mode: this.#options.configFileMode });
|
|
40144
40144
|
} catch (error) {
|
|
40145
40145
|
if (error?.code === "EXDEV") {
|
|
40146
|
-
|
|
40146
|
+
fs12.writeFileSync(this.path, data, { mode: this.#options.configFileMode });
|
|
40147
40147
|
return;
|
|
40148
40148
|
}
|
|
40149
40149
|
throw error;
|
|
@@ -40152,15 +40152,15 @@ var init_source = __esm(() => {
|
|
|
40152
40152
|
}
|
|
40153
40153
|
_watch() {
|
|
40154
40154
|
this._ensureDirectory();
|
|
40155
|
-
if (!
|
|
40155
|
+
if (!fs12.existsSync(this.path)) {
|
|
40156
40156
|
this._write(createPlainObject());
|
|
40157
40157
|
}
|
|
40158
40158
|
if (process8.platform === "win32") {
|
|
40159
|
-
|
|
40159
|
+
fs12.watch(this.path, { persistent: false }, debounce_fn_default(() => {
|
|
40160
40160
|
this.events.dispatchEvent(new Event("change"));
|
|
40161
40161
|
}, { wait: 100 }));
|
|
40162
40162
|
} else {
|
|
40163
|
-
|
|
40163
|
+
fs12.watchFile(this.path, { persistent: false }, debounce_fn_default(() => {
|
|
40164
40164
|
this.events.dispatchEvent(new Event("change"));
|
|
40165
40165
|
}, { wait: 5000 }));
|
|
40166
40166
|
}
|
|
@@ -40300,9 +40300,9 @@ var init_esm2 = __esm(() => {
|
|
|
40300
40300
|
});
|
|
40301
40301
|
|
|
40302
40302
|
// lib/shared/handle-registry-auth-error.ts
|
|
40303
|
-
import
|
|
40303
|
+
import fs13 from "node:fs";
|
|
40304
40304
|
import os2 from "node:os";
|
|
40305
|
-
import
|
|
40305
|
+
import path18 from "node:path";
|
|
40306
40306
|
function isUnauthorizedError(error) {
|
|
40307
40307
|
const output = [
|
|
40308
40308
|
error instanceof Error ? error.message : "",
|
|
@@ -40322,9 +40322,9 @@ function isUnauthorizedError(error) {
|
|
|
40322
40322
|
return /\b(401|E401)\b/i.test(output) || /unauthorized/i.test(output);
|
|
40323
40323
|
}
|
|
40324
40324
|
function hasTsciAuthToken(npmrcPath) {
|
|
40325
|
-
if (!
|
|
40325
|
+
if (!fs13.existsSync(npmrcPath))
|
|
40326
40326
|
return false;
|
|
40327
|
-
const content =
|
|
40327
|
+
const content = fs13.readFileSync(npmrcPath, "utf-8");
|
|
40328
40328
|
return AUTH_TOKEN_REGEX.test(content);
|
|
40329
40329
|
}
|
|
40330
40330
|
function handleRegistryAuthError({
|
|
@@ -40334,8 +40334,8 @@ function handleRegistryAuthError({
|
|
|
40334
40334
|
if (!isUnauthorizedError(error))
|
|
40335
40335
|
return;
|
|
40336
40336
|
const npmrcPaths = [
|
|
40337
|
-
|
|
40338
|
-
|
|
40337
|
+
path18.join(projectDir, ".npmrc"),
|
|
40338
|
+
path18.join(os2.homedir(), ".npmrc")
|
|
40339
40339
|
];
|
|
40340
40340
|
const hasToken = npmrcPaths.some(hasTsciAuthToken);
|
|
40341
40341
|
if (hasToken) {
|
|
@@ -40351,9 +40351,9 @@ var init_handle_registry_auth_error = __esm(() => {
|
|
|
40351
40351
|
});
|
|
40352
40352
|
|
|
40353
40353
|
// lib/cli-config/index.ts
|
|
40354
|
-
import
|
|
40354
|
+
import fs14 from "node:fs";
|
|
40355
40355
|
import os3 from "node:os";
|
|
40356
|
-
import
|
|
40356
|
+
import path19 from "node:path";
|
|
40357
40357
|
var getCliConfig = (opts = {}) => {
|
|
40358
40358
|
return new Conf({
|
|
40359
40359
|
projectName: "tscircuit",
|
|
@@ -40363,13 +40363,13 @@ var getCliConfig = (opts = {}) => {
|
|
|
40363
40363
|
return process.env.TSCIRCUIT_TOKEN || cliConfig.get("sessionToken");
|
|
40364
40364
|
}, getSessionTokenFromNpmrc = () => {
|
|
40365
40365
|
const npmrcPaths = [
|
|
40366
|
-
|
|
40367
|
-
|
|
40366
|
+
path19.join(process.cwd(), ".npmrc"),
|
|
40367
|
+
path19.join(os3.homedir(), ".npmrc")
|
|
40368
40368
|
];
|
|
40369
40369
|
for (const npmrcPath of npmrcPaths) {
|
|
40370
|
-
if (!
|
|
40370
|
+
if (!fs14.existsSync(npmrcPath))
|
|
40371
40371
|
continue;
|
|
40372
|
-
const content =
|
|
40372
|
+
const content = fs14.readFileSync(npmrcPath, "utf-8");
|
|
40373
40373
|
const match = content.match(AUTH_TOKEN_REGEX);
|
|
40374
40374
|
if (match?.[1]) {
|
|
40375
40375
|
return match[1].trim();
|
|
@@ -40413,7 +40413,7 @@ var init_get_circuit_json_to_gltf_options = __esm(() => {
|
|
|
40413
40413
|
});
|
|
40414
40414
|
|
|
40415
40415
|
// cli/build/convert-model-urls-to-file-urls.ts
|
|
40416
|
-
import
|
|
40416
|
+
import path20 from "node:path";
|
|
40417
40417
|
import { pathToFileURL as pathToFileURL5 } from "node:url";
|
|
40418
40418
|
var convertModelUrlsToFileUrls = (circuitJson) => {
|
|
40419
40419
|
const modelUrlKeys = [
|
|
@@ -40440,7 +40440,7 @@ var convertModelUrlsToFileUrls = (circuitJson) => {
|
|
|
40440
40440
|
if (value.startsWith("/") || value.match(/^[a-zA-Z]:\\/)) {
|
|
40441
40441
|
updated[key] = pathToFileURL5(value).href;
|
|
40442
40442
|
} else if (value.startsWith(".")) {
|
|
40443
|
-
updated[key] = pathToFileURL5(
|
|
40443
|
+
updated[key] = pathToFileURL5(path20.resolve(process.cwd(), value)).href;
|
|
40444
40444
|
}
|
|
40445
40445
|
}
|
|
40446
40446
|
}
|
|
@@ -40453,8 +40453,8 @@ var init_convert_model_urls_to_file_urls = () => {};
|
|
|
40453
40453
|
import { parentPort } from "node:worker_threads";
|
|
40454
40454
|
|
|
40455
40455
|
// cli/build/worker-build-handlers.ts
|
|
40456
|
-
import
|
|
40457
|
-
import
|
|
40456
|
+
import fs16 from "node:fs";
|
|
40457
|
+
import path22 from "node:path";
|
|
40458
40458
|
|
|
40459
40459
|
// lib/project-config/index.ts
|
|
40460
40460
|
import * as fs from "node:fs";
|
|
@@ -40676,6 +40676,7 @@ var saveProjectConfig = (config, projectDir = process.cwd()) => {
|
|
|
40676
40676
|
};
|
|
40677
40677
|
|
|
40678
40678
|
// lib/shared/circuit-json-diagnostics.ts
|
|
40679
|
+
var getIssueType = (issue) => issue.warning_type ?? issue.error_type ?? issue.type ?? "unknown_issue";
|
|
40679
40680
|
function analyzeCircuitJson(circuitJson) {
|
|
40680
40681
|
const errors = [];
|
|
40681
40682
|
const warnings = [];
|
|
@@ -40703,16 +40704,60 @@ function formatCircuitJsonDiagnostics({
|
|
|
40703
40704
|
}) {
|
|
40704
40705
|
const lines = [`Errors: ${errors.length}`, `Warnings: ${warnings.length}`];
|
|
40705
40706
|
for (const issue of [...errors, ...warnings]) {
|
|
40706
|
-
|
|
40707
|
-
lines.push(`- ${issueType}: ${issue.message ?? ""}`);
|
|
40707
|
+
lines.push(`- ${getIssueType(issue)}: ${issue.message ?? ""}`);
|
|
40708
40708
|
}
|
|
40709
40709
|
return lines.join(`
|
|
40710
40710
|
`);
|
|
40711
40711
|
}
|
|
40712
40712
|
|
|
40713
|
+
// lib/shared/collapse-repeated-issues.ts
|
|
40714
|
+
var MAX_ISSUES_LOGGED_PER_TYPE = 10;
|
|
40715
|
+
function collapseRepeatedIssues(issues, { maxPerType = MAX_ISSUES_LOGGED_PER_TYPE } = {}) {
|
|
40716
|
+
const countByType = new Map;
|
|
40717
|
+
const issuesToLog = [];
|
|
40718
|
+
for (const issue of issues) {
|
|
40719
|
+
const issueType = getIssueType(issue);
|
|
40720
|
+
const count = (countByType.get(issueType) ?? 0) + 1;
|
|
40721
|
+
countByType.set(issueType, count);
|
|
40722
|
+
if (count <= maxPerType)
|
|
40723
|
+
issuesToLog.push(issue);
|
|
40724
|
+
}
|
|
40725
|
+
const omittedLines = [];
|
|
40726
|
+
for (const [issueType, count] of countByType) {
|
|
40727
|
+
if (count > maxPerType) {
|
|
40728
|
+
omittedLines.push(`… ${count - maxPerType} more ${issueType} not shown`);
|
|
40729
|
+
}
|
|
40730
|
+
}
|
|
40731
|
+
return { issuesToLog, omittedLines };
|
|
40732
|
+
}
|
|
40733
|
+
function getIssueTypeCountLines(issues) {
|
|
40734
|
+
const countByType = new Map;
|
|
40735
|
+
for (const issue of issues) {
|
|
40736
|
+
const issueType = getIssueType(issue);
|
|
40737
|
+
countByType.set(issueType, (countByType.get(issueType) ?? 0) + 1);
|
|
40738
|
+
}
|
|
40739
|
+
const width = String(Math.max(0, ...countByType.values())).length;
|
|
40740
|
+
return [...countByType].sort(([typeA, a], [typeB, b]) => b - a || typeA.localeCompare(typeB)).map(([issueType, count]) => ` ${String(count).padStart(width)} ${issueType}`);
|
|
40741
|
+
}
|
|
40742
|
+
|
|
40743
|
+
// lib/shared/write-build-errors-file.ts
|
|
40744
|
+
import fs2 from "node:fs";
|
|
40745
|
+
import path2 from "node:path";
|
|
40746
|
+
var BUILD_ERRORS_FILE_NAME = "errors.json";
|
|
40747
|
+
function writeBuildErrorsFile(circuitJsonOutputPath, errors) {
|
|
40748
|
+
const errorsFilePath = path2.join(path2.dirname(circuitJsonOutputPath), BUILD_ERRORS_FILE_NAME);
|
|
40749
|
+
if (errors.length === 0) {
|
|
40750
|
+
fs2.rmSync(errorsFilePath, { force: true });
|
|
40751
|
+
return null;
|
|
40752
|
+
}
|
|
40753
|
+
fs2.writeFileSync(errorsFilePath, `${JSON.stringify(errors, null, 2)}
|
|
40754
|
+
`);
|
|
40755
|
+
return errorsFilePath;
|
|
40756
|
+
}
|
|
40757
|
+
|
|
40713
40758
|
// lib/shared/generate-circuit-json.tsx
|
|
40714
|
-
import
|
|
40715
|
-
import
|
|
40759
|
+
import fs9 from "node:fs";
|
|
40760
|
+
import path11 from "node:path";
|
|
40716
40761
|
import { pathToFileURL as pathToFileURL4 } from "node:url";
|
|
40717
40762
|
import Debug from "debug";
|
|
40718
40763
|
|
|
@@ -40735,8 +40780,8 @@ var import_make_vfs = __toESM(require_dist(), 1);
|
|
|
40735
40780
|
|
|
40736
40781
|
// lib/shared/autorouter-diagnostics.ts
|
|
40737
40782
|
init_kleur();
|
|
40738
|
-
import
|
|
40739
|
-
import
|
|
40783
|
+
import fs3 from "node:fs";
|
|
40784
|
+
import path3 from "node:path";
|
|
40740
40785
|
import { convertCircuitJsonToPcbSvg } from "circuit-to-svg";
|
|
40741
40786
|
|
|
40742
40787
|
// lib/shared/compute-cost-summary.ts
|
|
@@ -40769,7 +40814,7 @@ var convertSvgToPngBuffer = (svg) => {
|
|
|
40769
40814
|
};
|
|
40770
40815
|
|
|
40771
40816
|
// lib/shared/autorouter-diagnostics.ts
|
|
40772
|
-
var DEFAULT_DEBUG_DIR =
|
|
40817
|
+
var DEFAULT_DEBUG_DIR = path3.join("dist", "autorouter-debug");
|
|
40773
40818
|
var PROGRESS_LOG_INTERVAL_MS = 1e4;
|
|
40774
40819
|
var CIRCUIT_JSON_ID_PATTERN = /\b(?:source|pcb|schematic|subcircuit|cad|simulation)_[a-z0-9_]*_\d+\b/gi;
|
|
40775
40820
|
var parseAutorouterTimeout = (duration) => {
|
|
@@ -41236,10 +41281,10 @@ class AutorouterDiagnostics {
|
|
|
41236
41281
|
return this.options.dumpSrj === "all" || this.options.dumpSrj === "failed" || this.options.dumpSrj === `phase:${routingPhaseIndex}`;
|
|
41237
41282
|
}
|
|
41238
41283
|
writeJson(fileName, value) {
|
|
41239
|
-
const debugDir =
|
|
41240
|
-
|
|
41241
|
-
const filePath =
|
|
41242
|
-
|
|
41284
|
+
const debugDir = path3.resolve(this.options.debugDir ?? DEFAULT_DEBUG_DIR);
|
|
41285
|
+
fs3.mkdirSync(debugDir, { recursive: true });
|
|
41286
|
+
const filePath = path3.join(debugDir, fileName);
|
|
41287
|
+
fs3.writeFileSync(filePath, JSON.stringify(value, null, 2));
|
|
41243
41288
|
this.logArtifact(filePath);
|
|
41244
41289
|
return filePath;
|
|
41245
41290
|
}
|
|
@@ -41247,10 +41292,10 @@ class AutorouterDiagnostics {
|
|
|
41247
41292
|
try {
|
|
41248
41293
|
const pcbSvg = convertCircuitJsonToPcbSvg(circuitJson, options);
|
|
41249
41294
|
const png = convertSvgToPngBuffer(pcbSvg);
|
|
41250
|
-
const debugDir =
|
|
41251
|
-
|
|
41252
|
-
const filePath =
|
|
41253
|
-
|
|
41295
|
+
const debugDir = path3.resolve(this.options.debugDir ?? DEFAULT_DEBUG_DIR);
|
|
41296
|
+
fs3.mkdirSync(debugDir, { recursive: true });
|
|
41297
|
+
const filePath = path3.join(debugDir, fileName);
|
|
41298
|
+
fs3.writeFileSync(filePath, png);
|
|
41254
41299
|
this.logArtifact(filePath);
|
|
41255
41300
|
} catch (error) {
|
|
41256
41301
|
const serializedError = this.serializeError(error instanceof Error ? error : String(error));
|
|
@@ -41258,7 +41303,7 @@ class AutorouterDiagnostics {
|
|
|
41258
41303
|
}
|
|
41259
41304
|
}
|
|
41260
41305
|
logArtifact(filePath) {
|
|
41261
|
-
this.log(`Wrote debug artifact: ${
|
|
41306
|
+
this.log(`Wrote debug artifact: ${path3.relative(process.cwd(), filePath)}`);
|
|
41262
41307
|
}
|
|
41263
41308
|
getCircuitJsonWithCompletedPhaseTraces() {
|
|
41264
41309
|
const circuitJson = [...this.getCurrentCircuitJson()];
|
|
@@ -41468,13 +41513,13 @@ class AutorouterDiagnostics {
|
|
|
41468
41513
|
}
|
|
41469
41514
|
|
|
41470
41515
|
// lib/shared/autorouting-artifacts.ts
|
|
41471
|
-
import
|
|
41472
|
-
import
|
|
41516
|
+
import fs4 from "node:fs";
|
|
41517
|
+
import path4 from "node:path";
|
|
41473
41518
|
import { createHash } from "node:crypto";
|
|
41474
41519
|
function attachAutoroutingArtifacts(root, filePath, projectDir = process.cwd()) {
|
|
41475
|
-
const entryPath =
|
|
41476
|
-
const entryKey = `${
|
|
41477
|
-
const directory =
|
|
41520
|
+
const entryPath = path4.relative(projectDir, path4.resolve(projectDir, filePath));
|
|
41521
|
+
const entryKey = `${path4.basename(filePath).replace(/[^a-zA-Z0-9_-]/g, "-")}-${createHash("sha256").update(entryPath).digest("hex").slice(0, 10)}`;
|
|
41522
|
+
const directory = path4.resolve(projectDir, ".tscircuit", "autorouting-artifacts", entryKey);
|
|
41478
41523
|
let warnedUnsupportedVersion = false;
|
|
41479
41524
|
root.on("autorouting:end", (event) => {
|
|
41480
41525
|
try {
|
|
@@ -41494,14 +41539,14 @@ function attachAutoroutingArtifacts(root, filePath, projectDir = process.cwd())
|
|
|
41494
41539
|
const order = event._actualRoutingPhaseOrderIndex;
|
|
41495
41540
|
const safeSubcircuit = event.subcircuit_id.replace(/[^a-zA-Z0-9_-]/g, "-");
|
|
41496
41541
|
const stage = event.phaseStageIndex === undefined ? "" : `-stage-${event.phaseStageIndex}`;
|
|
41497
|
-
const outputPath =
|
|
41542
|
+
const outputPath = path4.join(directory, `${safeSubcircuit}-phase-${phase}-order-${order}${stage}.pcb-trace-paths.json`);
|
|
41498
41543
|
const contents = `${JSON.stringify(event.pcbTracePaths, null, 2)}
|
|
41499
41544
|
`;
|
|
41500
|
-
|
|
41501
|
-
if (!
|
|
41502
|
-
|
|
41545
|
+
fs4.mkdirSync(directory, { recursive: true });
|
|
41546
|
+
if (!fs4.existsSync(outputPath) || fs4.readFileSync(outputPath, "utf8") !== contents) {
|
|
41547
|
+
fs4.writeFileSync(outputPath, contents);
|
|
41503
41548
|
}
|
|
41504
|
-
console.log(`Saved autorouting paths to ${
|
|
41549
|
+
console.log(`Saved autorouting paths to ${path4.relative(projectDir, outputPath)} (import this JSON into <autoroutingphase pcbTracePaths={...} />).`);
|
|
41505
41550
|
} catch (error) {
|
|
41506
41551
|
console.warn(`Could not save autorouting paths for ${event.subcircuit_id}: ${error instanceof Error ? error.message : String(error)}`);
|
|
41507
41552
|
}
|
|
@@ -41510,7 +41555,7 @@ function attachAutoroutingArtifacts(root, filePath, projectDir = process.cwd())
|
|
|
41510
41555
|
|
|
41511
41556
|
// lib/shared/importFromUserLand.ts
|
|
41512
41557
|
import { createRequire as createRequire2 } from "node:module";
|
|
41513
|
-
import
|
|
41558
|
+
import path7 from "node:path";
|
|
41514
41559
|
import { pathToFileURL as pathToFileURL3 } from "node:url";
|
|
41515
41560
|
|
|
41516
41561
|
// node_modules/import-meta-resolve/lib/resolve.js
|
|
@@ -41518,15 +41563,15 @@ import assert2 from "node:assert";
|
|
|
41518
41563
|
import { statSync as statSync2, realpathSync } from "node:fs";
|
|
41519
41564
|
import process2 from "node:process";
|
|
41520
41565
|
import { fileURLToPath as fileURLToPath3, pathToFileURL as pathToFileURL2 } from "node:url";
|
|
41521
|
-
import
|
|
41566
|
+
import path6 from "node:path";
|
|
41522
41567
|
import { builtinModules } from "node:module";
|
|
41523
41568
|
|
|
41524
41569
|
// node_modules/import-meta-resolve/lib/get-format.js
|
|
41525
41570
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
41526
41571
|
|
|
41527
41572
|
// node_modules/import-meta-resolve/lib/package-json-reader.js
|
|
41528
|
-
import
|
|
41529
|
-
import
|
|
41573
|
+
import fs5 from "node:fs";
|
|
41574
|
+
import path5 from "node:path";
|
|
41530
41575
|
import { fileURLToPath } from "node:url";
|
|
41531
41576
|
|
|
41532
41577
|
// node_modules/import-meta-resolve/lib/errors.js
|
|
@@ -41759,7 +41804,7 @@ function read(jsonPath, { base, specifier }) {
|
|
|
41759
41804
|
}
|
|
41760
41805
|
let string;
|
|
41761
41806
|
try {
|
|
41762
|
-
string =
|
|
41807
|
+
string = fs5.readFileSync(path5.toNamespacedPath(jsonPath), "utf8");
|
|
41763
41808
|
} catch (error) {
|
|
41764
41809
|
const exception = error;
|
|
41765
41810
|
if (exception.code !== "ENOENT") {
|
|
@@ -41976,7 +42021,7 @@ function emitLegacyIndexDeprecation(url, packageJsonUrl, base, main) {
|
|
|
41976
42021
|
if (!main) {
|
|
41977
42022
|
process2.emitWarning(`No "main" or "exports" field defined in the package.json for ${packagePath} resolving the main entry point "${urlPath.slice(packagePath.length)}", imported from ${basePath}.
|
|
41978
42023
|
Default "index" lookups for the main are deprecated for ES modules.`, "DeprecationWarning", "DEP0151");
|
|
41979
|
-
} else if (
|
|
42024
|
+
} else if (path6.resolve(packagePath, main) !== urlPath) {
|
|
41980
42025
|
process2.emitWarning(`Package ${packagePath} has a "main" field set to "${main}", ` + `excluding the full filename and extension to the resolved file at "${urlPath.slice(packagePath.length)}", imported from ${basePath}.
|
|
41981
42026
|
Automatic extension resolution of the "main" field is ` + "deprecated for ES modules.", "DeprecationWarning", "DEP0151");
|
|
41982
42027
|
}
|
|
@@ -42058,7 +42103,7 @@ function finalizeResolution(resolved, base, preserveSymlinks) {
|
|
|
42058
42103
|
if (!preserveSymlinks) {
|
|
42059
42104
|
const real = realpathSync(filePath);
|
|
42060
42105
|
const { search, hash } = resolved;
|
|
42061
|
-
resolved = pathToFileURL2(real + (filePath.endsWith(
|
|
42106
|
+
resolved = pathToFileURL2(real + (filePath.endsWith(path6.sep) ? "/" : ""));
|
|
42062
42107
|
resolved.search = search;
|
|
42063
42108
|
resolved.hash = hash;
|
|
42064
42109
|
}
|
|
@@ -42526,7 +42571,7 @@ function resolve(specifier, parent) {
|
|
|
42526
42571
|
// lib/shared/importFromUserLand.ts
|
|
42527
42572
|
async function importFromUserLand(moduleName, projectDir = process.cwd()) {
|
|
42528
42573
|
for (const parent of [
|
|
42529
|
-
pathToFileURL3(
|
|
42574
|
+
pathToFileURL3(path7.join(projectDir, "noop.js")).href,
|
|
42530
42575
|
import.meta.url
|
|
42531
42576
|
]) {
|
|
42532
42577
|
let resolved;
|
|
@@ -42547,8 +42592,8 @@ async function importFromUserLand(moduleName, projectDir = process.cwd()) {
|
|
|
42547
42592
|
}
|
|
42548
42593
|
|
|
42549
42594
|
// lib/shared/register-static-asset-loaders.ts
|
|
42550
|
-
import
|
|
42551
|
-
import
|
|
42595
|
+
import fs6 from "node:fs";
|
|
42596
|
+
import path8 from "node:path";
|
|
42552
42597
|
var STATIC_ASSET_EXTENSIONS = [
|
|
42553
42598
|
".glb",
|
|
42554
42599
|
".gltf",
|
|
@@ -42575,15 +42620,15 @@ var TEXT_STATIC_ASSET_EXTENSIONS = new Set([
|
|
|
42575
42620
|
".kicad_sym"
|
|
42576
42621
|
]);
|
|
42577
42622
|
var readFileContentForStaticLoader = (filePath) => {
|
|
42578
|
-
const ext =
|
|
42623
|
+
const ext = path8.extname(filePath).toLowerCase();
|
|
42579
42624
|
if (TEXT_STATIC_ASSET_EXTENSIONS.has(ext)) {
|
|
42580
|
-
return
|
|
42625
|
+
return fs6.readFileSync(filePath, "utf-8");
|
|
42581
42626
|
}
|
|
42582
|
-
const buffer =
|
|
42627
|
+
const buffer = fs6.readFileSync(filePath);
|
|
42583
42628
|
return buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength);
|
|
42584
42629
|
};
|
|
42585
42630
|
var getStaticFileLoader = (filePath) => {
|
|
42586
|
-
const extWithDot =
|
|
42631
|
+
const extWithDot = path8.extname(filePath).toLowerCase();
|
|
42587
42632
|
const ext = extWithDot.replace(/^\./, "");
|
|
42588
42633
|
return activePlatformConfig?.staticFileLoaderMap?.[ext] ?? activePlatformConfig?.staticFileLoaderMap?.[extWithDot];
|
|
42589
42634
|
};
|
|
@@ -42597,12 +42642,12 @@ var normalizeStaticFileLoaderResult = (result) => {
|
|
|
42597
42642
|
};
|
|
42598
42643
|
};
|
|
42599
42644
|
var getBaseUrlFromTsConfig = (projectDir) => {
|
|
42600
|
-
const tsconfigPath =
|
|
42645
|
+
const tsconfigPath = path8.join(projectDir, "tsconfig.json");
|
|
42601
42646
|
try {
|
|
42602
|
-
if (!
|
|
42647
|
+
if (!fs6.existsSync(tsconfigPath)) {
|
|
42603
42648
|
return null;
|
|
42604
42649
|
}
|
|
42605
|
-
const tsconfigContent =
|
|
42650
|
+
const tsconfigContent = fs6.readFileSync(tsconfigPath, "utf-8");
|
|
42606
42651
|
const tsconfig = JSON.parse(tsconfigContent);
|
|
42607
42652
|
if (tsconfig.compilerOptions?.baseUrl) {
|
|
42608
42653
|
return tsconfig.compilerOptions.baseUrl;
|
|
@@ -42629,8 +42674,8 @@ var registerStaticAssetLoaders = (platformConfig, projectDir = process.cwd()) =>
|
|
|
42629
42674
|
loader: "object"
|
|
42630
42675
|
};
|
|
42631
42676
|
}
|
|
42632
|
-
const baseDir = baseUrl ?
|
|
42633
|
-
const relativePath =
|
|
42677
|
+
const baseDir = baseUrl ? path8.resolve(projectDir, baseUrl) : projectDir;
|
|
42678
|
+
const relativePath = path8.relative(baseDir, args.path).split(path8.sep).join("/");
|
|
42634
42679
|
const pathStr = `./${relativePath}`;
|
|
42635
42680
|
return {
|
|
42636
42681
|
exports: {
|
|
@@ -42646,8 +42691,8 @@ var registerStaticAssetLoaders = (platformConfig, projectDir = process.cwd()) =>
|
|
|
42646
42691
|
};
|
|
42647
42692
|
|
|
42648
42693
|
// lib/shared/circuit-json-build-cache.ts
|
|
42649
|
-
import
|
|
42650
|
-
import
|
|
42694
|
+
import fs7 from "node:fs";
|
|
42695
|
+
import path9 from "node:path";
|
|
42651
42696
|
import { createHash as createHash2 } from "node:crypto";
|
|
42652
42697
|
var SOURCE_FILE_EXTENSIONS = new Set([
|
|
42653
42698
|
".tsx",
|
|
@@ -42671,43 +42716,43 @@ var IGNORED_DIRECTORY_NAMES = new Set([
|
|
|
42671
42716
|
".git"
|
|
42672
42717
|
]);
|
|
42673
42718
|
var isPathInside = (childPath, parentPath) => {
|
|
42674
|
-
const relative =
|
|
42675
|
-
return relative === "" || !relative.startsWith("..") && !
|
|
42719
|
+
const relative = path9.relative(parentPath, childPath);
|
|
42720
|
+
return relative === "" || !relative.startsWith("..") && !path9.isAbsolute(relative);
|
|
42676
42721
|
};
|
|
42677
42722
|
var findCircuitProjectDir = (filePath) => {
|
|
42678
|
-
const absoluteFilePath =
|
|
42679
|
-
let currentDir =
|
|
42723
|
+
const absoluteFilePath = path9.resolve(filePath);
|
|
42724
|
+
let currentDir = path9.dirname(absoluteFilePath);
|
|
42680
42725
|
while (true) {
|
|
42681
|
-
if (
|
|
42726
|
+
if (fs7.existsSync(path9.join(currentDir, "package.json"))) {
|
|
42682
42727
|
return currentDir;
|
|
42683
42728
|
}
|
|
42684
|
-
const parentDir =
|
|
42729
|
+
const parentDir = path9.dirname(currentDir);
|
|
42685
42730
|
if (parentDir === currentDir)
|
|
42686
42731
|
break;
|
|
42687
42732
|
currentDir = parentDir;
|
|
42688
42733
|
}
|
|
42689
|
-
const cwd =
|
|
42690
|
-
return isPathInside(absoluteFilePath, cwd) ? cwd :
|
|
42734
|
+
const cwd = path9.resolve(process.cwd());
|
|
42735
|
+
return isPathInside(absoluteFilePath, cwd) ? cwd : path9.dirname(absoluteFilePath);
|
|
42691
42736
|
};
|
|
42692
42737
|
var getCircuitJsonOutputDirName = (relativePath) => {
|
|
42693
42738
|
const normalizedRelativePath = relativePath.toLowerCase().replaceAll("\\", "/");
|
|
42694
42739
|
if (normalizedRelativePath === "circuit.json" || normalizedRelativePath.endsWith("/circuit.json")) {
|
|
42695
|
-
return
|
|
42740
|
+
return path9.dirname(relativePath);
|
|
42696
42741
|
}
|
|
42697
42742
|
return relativePath.replace(/(\.board|\.circuit)?\.tsx$/, "").replace(/\.circuit\.json$/, "");
|
|
42698
42743
|
};
|
|
42699
42744
|
var getCircuitJsonBuildOutputPath = (filePath) => {
|
|
42700
|
-
const absoluteFilePath =
|
|
42745
|
+
const absoluteFilePath = path9.resolve(filePath);
|
|
42701
42746
|
const projectDir = findCircuitProjectDir(absoluteFilePath);
|
|
42702
|
-
const relativePath =
|
|
42703
|
-
return
|
|
42747
|
+
const relativePath = path9.relative(projectDir, absoluteFilePath);
|
|
42748
|
+
return path9.join(projectDir, "dist", getCircuitJsonOutputDirName(relativePath), "circuit.json");
|
|
42704
42749
|
};
|
|
42705
42750
|
var getSourceFilePaths = (projectDir) => {
|
|
42706
42751
|
const sourceFilePaths = [];
|
|
42707
42752
|
const visit = (directoryPath) => {
|
|
42708
|
-
const entries =
|
|
42753
|
+
const entries = fs7.readdirSync(directoryPath, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name));
|
|
42709
42754
|
for (const entry of entries) {
|
|
42710
|
-
const entryPath =
|
|
42755
|
+
const entryPath = path9.join(directoryPath, entry.name);
|
|
42711
42756
|
if (entry.isDirectory()) {
|
|
42712
42757
|
if (IGNORED_DIRECTORY_NAMES.has(entry.name) || entry.name.startsWith(".")) {
|
|
42713
42758
|
continue;
|
|
@@ -42715,7 +42760,7 @@ var getSourceFilePaths = (projectDir) => {
|
|
|
42715
42760
|
visit(entryPath);
|
|
42716
42761
|
continue;
|
|
42717
42762
|
}
|
|
42718
|
-
if (!entry.isFile() || entry.name.endsWith(".circuit.json") || !SOURCE_FILE_EXTENSIONS.has(
|
|
42763
|
+
if (!entry.isFile() || entry.name.endsWith(".circuit.json") || !SOURCE_FILE_EXTENSIONS.has(path9.extname(entry.name).toLowerCase())) {
|
|
42719
42764
|
continue;
|
|
42720
42765
|
}
|
|
42721
42766
|
sourceFilePaths.push(entryPath);
|
|
@@ -42728,8 +42773,8 @@ var getSourceFilesystemMd5Hash = (filePath) => {
|
|
|
42728
42773
|
const projectDir = findCircuitProjectDir(filePath);
|
|
42729
42774
|
const hash = createHash2("md5");
|
|
42730
42775
|
for (const sourceFilePath of getSourceFilePaths(projectDir)) {
|
|
42731
|
-
const relativePath =
|
|
42732
|
-
const content =
|
|
42776
|
+
const relativePath = path9.relative(projectDir, sourceFilePath).split(path9.sep).join("/");
|
|
42777
|
+
const content = fs7.readFileSync(sourceFilePath);
|
|
42733
42778
|
hash.update(`${Buffer.byteLength(relativePath)}:`);
|
|
42734
42779
|
hash.update(relativePath);
|
|
42735
42780
|
hash.update(`${content.byteLength}:`);
|
|
@@ -42764,7 +42809,7 @@ var readCurrentCircuitJsonBuild = ({
|
|
|
42764
42809
|
}) => {
|
|
42765
42810
|
const outputPath = getCircuitJsonBuildOutputPath(filePath);
|
|
42766
42811
|
try {
|
|
42767
|
-
const parsed = JSON.parse(
|
|
42812
|
+
const parsed = JSON.parse(fs7.readFileSync(outputPath, "utf-8"));
|
|
42768
42813
|
if (!Array.isArray(parsed))
|
|
42769
42814
|
return null;
|
|
42770
42815
|
const hasCurrentFilesystemHash = parsed.some((element) => element?.type === "source_project_metadata" && element.source_filesystem_md5_hash === sourceFilesystemMd5Hash);
|
|
@@ -42778,8 +42823,8 @@ var readCurrentCircuitJsonBuild = ({
|
|
|
42778
42823
|
};
|
|
42779
42824
|
|
|
42780
42825
|
// lib/shared/solver-diagnostics.ts
|
|
42781
|
-
import
|
|
42782
|
-
import
|
|
42826
|
+
import fs8 from "node:fs";
|
|
42827
|
+
import path10 from "node:path";
|
|
42783
42828
|
var escapeJsonPointerSegment = (segment) => segment.replaceAll("~", "~0").replaceAll("/", "~1");
|
|
42784
42829
|
var cloneAsJson = (value, ancestors = new WeakMap, path = "#") => {
|
|
42785
42830
|
if (value === undefined)
|
|
@@ -42880,8 +42925,8 @@ class SolverDiagnostics {
|
|
|
42880
42925
|
finalize() {
|
|
42881
42926
|
if (!this.options.enabled)
|
|
42882
42927
|
return;
|
|
42883
|
-
|
|
42884
|
-
|
|
42928
|
+
fs8.mkdirSync(path10.dirname(this.options.outputPath), { recursive: true });
|
|
42929
|
+
fs8.writeFileSync(this.options.outputPath, `${JSON.stringify({
|
|
42885
42930
|
format: "tscircuit_solver_debug_v1",
|
|
42886
42931
|
entrypoint: this.options.entrypoint,
|
|
42887
42932
|
solvers: this.solverInvocations
|
|
@@ -42924,7 +42969,7 @@ async function generateCircuitJson({
|
|
|
42924
42969
|
}) {
|
|
42925
42970
|
debug(`Generating circuit JSON for ${filePath}`);
|
|
42926
42971
|
const currentSourceFilesystemMd5Hash = sourceFilesystemMd5Hash ?? getSourceFilesystemMd5Hash(filePath);
|
|
42927
|
-
const projectRootDir =
|
|
42972
|
+
const projectRootDir = path11.resolve(projectDirOption ?? process.cwd());
|
|
42928
42973
|
const React = await importFromUserLand("react", projectRootDir);
|
|
42929
42974
|
globalThis.React = React;
|
|
42930
42975
|
registerStaticAssetLoaders(platformConfig, projectRootDir);
|
|
@@ -42937,12 +42982,12 @@ async function generateCircuitJson({
|
|
|
42937
42982
|
const solverDiagnostics = solverDiagnosticsOptions ? new SolverDiagnostics(solverDiagnosticsOptions) : null;
|
|
42938
42983
|
solverDiagnostics?.attachToRootCircuit(runner);
|
|
42939
42984
|
attachAutoroutingArtifacts(runner, filePath, projectRootDir);
|
|
42940
|
-
const absoluteFilePath =
|
|
42941
|
-
const sourceDir =
|
|
42985
|
+
const absoluteFilePath = path11.isAbsolute(filePath) ? filePath : path11.resolve(projectRootDir, filePath);
|
|
42986
|
+
const sourceDir = path11.dirname(absoluteFilePath);
|
|
42942
42987
|
const resolvedOutputDir = outputDir ?? sourceDir;
|
|
42943
|
-
const relativeComponentPath =
|
|
42944
|
-
const baseFileName = outputFileName ||
|
|
42945
|
-
const outputPath =
|
|
42988
|
+
const relativeComponentPath = path11.relative(sourceDir, absoluteFilePath);
|
|
42989
|
+
const baseFileName = outputFileName || path11.basename(absoluteFilePath).replace(/\.[^.]+$/, "");
|
|
42990
|
+
const outputPath = path11.join(resolvedOutputDir, `${baseFileName}.circuit.json`);
|
|
42946
42991
|
debug(`Project directory: ${sourceDir}`);
|
|
42947
42992
|
debug(`Relative component path: ${relativeComponentPath}`);
|
|
42948
42993
|
debug(`Output path: ${outputPath}`);
|
|
@@ -42962,7 +43007,7 @@ async function generateCircuitJson({
|
|
|
42962
43007
|
return false;
|
|
42963
43008
|
if (normalizedFilePath.match(/^\.[^/]/))
|
|
42964
43009
|
return false;
|
|
42965
|
-
if (!ALLOWED_FILE_EXTENSIONS.includes(
|
|
43010
|
+
if (!ALLOWED_FILE_EXTENSIONS.includes(path11.extname(normalizedFilePath)))
|
|
42966
43011
|
return false;
|
|
42967
43012
|
return true;
|
|
42968
43013
|
},
|
|
@@ -43007,7 +43052,7 @@ async function generateCircuitJson({
|
|
|
43007
43052
|
await autorouterDiagnostics.finalize(circuitJson);
|
|
43008
43053
|
if (saveToFile) {
|
|
43009
43054
|
debug(`Saving circuit JSON to ${outputPath}`);
|
|
43010
|
-
|
|
43055
|
+
fs9.writeFileSync(outputPath, JSON.stringify(circuitJson, null, 2));
|
|
43011
43056
|
}
|
|
43012
43057
|
return {
|
|
43013
43058
|
circuitJson,
|
|
@@ -43020,8 +43065,8 @@ async function generateCircuitJson({
|
|
|
43020
43065
|
// lib/shared/get-platform-config-with-cli-defaults.ts
|
|
43021
43066
|
var import_semver = __toESM(require_semver2(), 1);
|
|
43022
43067
|
import { createHash as createHash3 } from "node:crypto";
|
|
43023
|
-
import
|
|
43024
|
-
import
|
|
43068
|
+
import fs10 from "node:fs";
|
|
43069
|
+
import path12 from "node:path";
|
|
43025
43070
|
import { getPlatformConfig } from "@tscircuit/eval/platform-config";
|
|
43026
43071
|
|
|
43027
43072
|
// lib/shared/platform-config-utils.ts
|
|
@@ -43082,25 +43127,25 @@ var getPlatformFetch = (upstreamFetch = globalThis.fetch) => {
|
|
|
43082
43127
|
};
|
|
43083
43128
|
|
|
43084
43129
|
// lib/shared/get-platform-config-with-cli-defaults.ts
|
|
43085
|
-
function createLocalCacheEngine(cacheDir =
|
|
43130
|
+
function createLocalCacheEngine(cacheDir = path12.join(process.cwd(), ".tscircuit", "cache")) {
|
|
43086
43131
|
return {
|
|
43087
43132
|
getItem: (key) => {
|
|
43088
43133
|
try {
|
|
43089
43134
|
const hash = createHash3("md5").update(key).digest("hex");
|
|
43090
43135
|
const keyWithSafeCharacters = key.replace(/[^a-zA-Z0-9]/g, "_");
|
|
43091
|
-
const filePath =
|
|
43092
|
-
return
|
|
43136
|
+
const filePath = path12.join(cacheDir, `${keyWithSafeCharacters.slice(keyWithSafeCharacters.length - 10, keyWithSafeCharacters.length)}-${hash}.json`);
|
|
43137
|
+
return fs10.readFileSync(filePath, "utf-8");
|
|
43093
43138
|
} catch {
|
|
43094
43139
|
return null;
|
|
43095
43140
|
}
|
|
43096
43141
|
},
|
|
43097
43142
|
setItem: (key, value) => {
|
|
43098
43143
|
try {
|
|
43099
|
-
|
|
43144
|
+
fs10.mkdirSync(cacheDir, { recursive: true });
|
|
43100
43145
|
const hash = createHash3("md5").update(key).digest("hex");
|
|
43101
43146
|
const keyWithSafeCharacters = key.replace(/[^a-zA-Z0-9]/g, "_");
|
|
43102
|
-
const filePath =
|
|
43103
|
-
|
|
43147
|
+
const filePath = path12.join(cacheDir, `${keyWithSafeCharacters.slice(keyWithSafeCharacters.length - 10, keyWithSafeCharacters.length)}-${hash}.json`);
|
|
43148
|
+
fs10.writeFileSync(filePath, value);
|
|
43104
43149
|
} catch {}
|
|
43105
43150
|
}
|
|
43106
43151
|
};
|
|
@@ -43108,7 +43153,7 @@ function createLocalCacheEngine(cacheDir = path11.join(process.cwd(), ".tscircui
|
|
|
43108
43153
|
function getPlatformConfigWithCliDefaults(userConfig, options) {
|
|
43109
43154
|
const projectDir = options?.projectDir ?? process.cwd();
|
|
43110
43155
|
const basePlatformConfig = getPlatformConfig();
|
|
43111
|
-
const cacheDir =
|
|
43156
|
+
const cacheDir = path12.join(projectDir, ".tscircuit", "cache");
|
|
43112
43157
|
const defaultConfig = {
|
|
43113
43158
|
...basePlatformConfig,
|
|
43114
43159
|
autorouterThreads: process.versions.bun && !import_semver.default.satisfies(process.versions.bun, ">=1.4.2") ? 1 : 4,
|
|
@@ -43120,15 +43165,15 @@ function getPlatformConfigWithCliDefaults(userConfig, options) {
|
|
|
43120
43165
|
loadFromUrl: async (url) => {
|
|
43121
43166
|
let fetchUrl = url;
|
|
43122
43167
|
if (url.startsWith("./") || url.startsWith("../")) {
|
|
43123
|
-
const absolutePath =
|
|
43168
|
+
const absolutePath = path12.resolve(projectDir, url);
|
|
43124
43169
|
fetchUrl = `file://${absolutePath}`;
|
|
43125
43170
|
} else if (url.startsWith("/")) {
|
|
43126
|
-
if (
|
|
43171
|
+
if (fs10.existsSync(url)) {
|
|
43127
43172
|
fetchUrl = `file://${url}`;
|
|
43128
43173
|
} else {
|
|
43129
43174
|
const relativePath = `.${url}`;
|
|
43130
|
-
const absolutePath =
|
|
43131
|
-
if (
|
|
43175
|
+
const absolutePath = path12.resolve(projectDir, relativePath);
|
|
43176
|
+
if (fs10.existsSync(absolutePath)) {
|
|
43132
43177
|
fetchUrl = `file://${absolutePath}`;
|
|
43133
43178
|
} else {
|
|
43134
43179
|
fetchUrl = `file://${url}`;
|
|
@@ -43397,8 +43442,8 @@ function convertCircuitJsonToPcbSvg2(elements, options = {}) {
|
|
|
43397
43442
|
}
|
|
43398
43443
|
|
|
43399
43444
|
// cli/build/worker-output-generators.ts
|
|
43400
|
-
import
|
|
43401
|
-
import
|
|
43445
|
+
import fs15 from "node:fs";
|
|
43446
|
+
import path21 from "node:path";
|
|
43402
43447
|
|
|
43403
43448
|
// node_modules/circuit-json-to-3d-png/dist/index.js
|
|
43404
43449
|
function normalizeDir(dir) {
|
|
@@ -62420,7 +62465,7 @@ var getSystemSvgAssets = async (circuitJson) => {
|
|
|
62420
62465
|
// lib/shared/load-local-step-model-fs-map.ts
|
|
62421
62466
|
import { existsSync as existsSync2 } from "node:fs";
|
|
62422
62467
|
import { readFile } from "node:fs/promises";
|
|
62423
|
-
import
|
|
62468
|
+
import path13 from "node:path";
|
|
62424
62469
|
var isRemoteUrl = (value) => /^https?:\/\//i.test(value);
|
|
62425
62470
|
async function loadLocalStepModelFsMap(circuitJson) {
|
|
62426
62471
|
const fsMap = {};
|
|
@@ -62432,7 +62477,7 @@ async function loadLocalStepModelFsMap(circuitJson) {
|
|
|
62432
62477
|
continue;
|
|
62433
62478
|
if (isRemoteUrl(modelUrl) || fsMap[modelUrl])
|
|
62434
62479
|
continue;
|
|
62435
|
-
const localPath =
|
|
62480
|
+
const localPath = path13.resolve(process.cwd(), modelUrl);
|
|
62436
62481
|
if (!existsSync2(localPath))
|
|
62437
62482
|
continue;
|
|
62438
62483
|
fsMap[modelUrl] = await readFile(localPath, "utf-8");
|
|
@@ -62542,13 +62587,13 @@ var writeDiagramSvgAssetsFromCircuitJson = async (circuitJson, outputDir, imageF
|
|
|
62542
62587
|
});
|
|
62543
62588
|
}
|
|
62544
62589
|
const generatedNames = new Set(assets.map((asset) => asset.fileName));
|
|
62545
|
-
for (const fileName of
|
|
62590
|
+
for (const fileName of fs15.readdirSync(outputDir)) {
|
|
62546
62591
|
const selected = imageFormats.systemSvgs && /^system(?:-.*)?\.svg$/.test(fileName) || imageFormats.assemblySvgs && fileName === "assembly.svg";
|
|
62547
62592
|
if (selected && !generatedNames.has(fileName))
|
|
62548
|
-
|
|
62593
|
+
fs15.rmSync(path21.join(outputDir, fileName), { force: true });
|
|
62549
62594
|
}
|
|
62550
62595
|
for (const { fileName, svg } of assets)
|
|
62551
|
-
|
|
62596
|
+
fs15.writeFileSync(path21.join(outputDir, fileName), svg, "utf-8");
|
|
62552
62597
|
return assets.map((asset) => asset.fileName);
|
|
62553
62598
|
};
|
|
62554
62599
|
var writeSimulationSvgAssetsFromCircuitJson = (circuitJson, outputDir, imageFormats) => {
|
|
@@ -62564,12 +62609,12 @@ var writeSimulationSvgAssetsFromCircuitJson = (circuitJson, outputDir, imageForm
|
|
|
62564
62609
|
for (const simulationSvgAsset of simulationSvgAssets) {
|
|
62565
62610
|
if (imageFormats.simulationSvgs) {
|
|
62566
62611
|
const fileName = hasMultipleSimulations ? `simulation-${simulationSvgAsset.fileNameSuffix}.svg` : "simulation.svg";
|
|
62567
|
-
|
|
62612
|
+
fs15.writeFileSync(path21.join(outputDir, fileName), simulationSvgAsset.simulationSvg, "utf-8");
|
|
62568
62613
|
simulationFileNames.push(fileName);
|
|
62569
62614
|
}
|
|
62570
62615
|
if (imageFormats.simulationSchematicSvgs) {
|
|
62571
62616
|
const fileName = hasMultipleSimulations ? `simulation-schematic-${simulationSvgAsset.fileNameSuffix}.svg` : "simulation-schematic.svg";
|
|
62572
|
-
|
|
62617
|
+
fs15.writeFileSync(path21.join(outputDir, fileName), simulationSvgAsset.schematicSimulationSvg, "utf-8");
|
|
62573
62618
|
schematicSimulationFileNames.push(fileName);
|
|
62574
62619
|
}
|
|
62575
62620
|
}
|
|
@@ -62579,8 +62624,8 @@ var writeGlbFromCircuitJson = async (circuitJson, glbOutputPath) => {
|
|
|
62579
62624
|
const circuitJsonWithFileUrls = convertModelUrlsToFileUrls(circuitJson);
|
|
62580
62625
|
const glbBuffer = await convertCircuitJsonToGltf(circuitJsonWithFileUrls, getCircuitJsonToGltfOptions({ format: "glb" }));
|
|
62581
62626
|
const glbData = normalizeToUint8Array2(glbBuffer);
|
|
62582
|
-
|
|
62583
|
-
|
|
62627
|
+
fs15.mkdirSync(path21.dirname(glbOutputPath), { recursive: true });
|
|
62628
|
+
fs15.writeFileSync(glbOutputPath, Buffer.from(glbData));
|
|
62584
62629
|
};
|
|
62585
62630
|
var writeStepFromCircuitJson = async (circuitJson, stepOutputPath) => {
|
|
62586
62631
|
const stepContent = await circuitJsonToStep(circuitJson, {
|
|
@@ -62589,46 +62634,46 @@ var writeStepFromCircuitJson = async (circuitJson, stepOutputPath) => {
|
|
|
62589
62634
|
includeExternalMeshes: true,
|
|
62590
62635
|
fsMap: await loadLocalStepModelFsMap(circuitJson)
|
|
62591
62636
|
});
|
|
62592
|
-
|
|
62593
|
-
|
|
62637
|
+
fs15.mkdirSync(path21.dirname(stepOutputPath), { recursive: true });
|
|
62638
|
+
fs15.writeFileSync(stepOutputPath, stepContent);
|
|
62594
62639
|
};
|
|
62595
62640
|
var writeImageAssetsFromCircuitJson = async (circuitJson, options) => {
|
|
62596
62641
|
const { outputDir, imageFormats, pcbSnapshotSettings } = options;
|
|
62597
|
-
|
|
62642
|
+
fs15.mkdirSync(outputDir, { recursive: true });
|
|
62598
62643
|
const hasSchematic = circuitJson.some((e) => e.type.startsWith("schematic_"));
|
|
62599
62644
|
if (!hasSchematic) {
|
|
62600
62645
|
if (imageFormats.schematicSvgs)
|
|
62601
|
-
|
|
62646
|
+
fs15.rmSync(path21.join(outputDir, "schematic.svg"), { force: true });
|
|
62602
62647
|
if (imageFormats.schematicPngs)
|
|
62603
|
-
|
|
62648
|
+
fs15.rmSync(path21.join(outputDir, "schematic.png"), { force: true });
|
|
62604
62649
|
}
|
|
62605
62650
|
if (imageFormats.pcbSvgs) {
|
|
62606
62651
|
const pcbSvg = convertCircuitJsonToPcbSvg2(circuitJson, pcbSnapshotSettings);
|
|
62607
|
-
|
|
62652
|
+
fs15.writeFileSync(path21.join(outputDir, "pcb.svg"), pcbSvg, "utf-8");
|
|
62608
62653
|
}
|
|
62609
62654
|
if (imageFormats.pcbPngs) {
|
|
62610
62655
|
const pcbSvg = convertCircuitJsonToPcbSvg2(circuitJson, pcbSnapshotSettings);
|
|
62611
|
-
|
|
62656
|
+
fs15.writeFileSync(path21.join(outputDir, "pcb.png"), await convertSvgToPngBuffer(pcbSvg));
|
|
62612
62657
|
}
|
|
62613
62658
|
if (imageFormats.schematicSvgs && hasSchematic) {
|
|
62614
62659
|
const schematicSvg = convertCircuitJsonToSchematicSvg(circuitJson);
|
|
62615
|
-
|
|
62660
|
+
fs15.writeFileSync(path21.join(outputDir, "schematic.svg"), schematicSvg, "utf-8");
|
|
62616
62661
|
}
|
|
62617
62662
|
if (imageFormats.schematicPngs && hasSchematic) {
|
|
62618
62663
|
const schematicSvg = convertCircuitJsonToSchematicSvg(circuitJson);
|
|
62619
|
-
|
|
62664
|
+
fs15.writeFileSync(path21.join(outputDir, "schematic.png"), await convertSvgToPngBuffer(schematicSvg));
|
|
62620
62665
|
}
|
|
62621
62666
|
writeSimulationSvgAssetsFromCircuitJson(circuitJson, outputDir, imageFormats);
|
|
62622
62667
|
await writeDiagramSvgAssetsFromCircuitJson(circuitJson, outputDir, imageFormats);
|
|
62623
62668
|
if (imageFormats.threeDPngs) {
|
|
62624
62669
|
const pngBuffer = await render3dThumbnail(circuitJson);
|
|
62625
|
-
|
|
62670
|
+
fs15.writeFileSync(path21.join(outputDir, "3d.png"), Buffer.from(pngBuffer));
|
|
62626
62671
|
}
|
|
62627
62672
|
};
|
|
62628
62673
|
|
|
62629
62674
|
// cli/build/worker-build-handlers.ts
|
|
62630
62675
|
var loadCircuitJsonFromInputFile = (filePath) => {
|
|
62631
|
-
const parsed = JSON.parse(
|
|
62676
|
+
const parsed = JSON.parse(fs16.readFileSync(filePath, "utf-8"));
|
|
62632
62677
|
return Array.isArray(parsed) ? parsed : [];
|
|
62633
62678
|
};
|
|
62634
62679
|
var handleBuildFile = async (filePath, outputPath, glbOutputPath, stepOutputPath, previewOutputDir, projectDir, options, workerLog, workerStatus) => {
|
|
@@ -62636,7 +62681,7 @@ var handleBuildFile = async (filePath, outputPath, glbOutputPath, stepOutputPath
|
|
|
62636
62681
|
const warnings = [];
|
|
62637
62682
|
const startedAt = options?.profile ? performance.now() : 0;
|
|
62638
62683
|
try {
|
|
62639
|
-
workerLog(`Generating circuit JSON for ${
|
|
62684
|
+
workerLog(`Generating circuit JSON for ${path22.relative(projectDir, filePath)}...`);
|
|
62640
62685
|
await registerStaticAssetLoaders(undefined, projectDir);
|
|
62641
62686
|
const projectConfig = await loadRuntimeProjectConfig(projectDir);
|
|
62642
62687
|
const platformConfig = mergePlatformConfigs(projectConfig?.platformConfig, options?.platformConfig);
|
|
@@ -62660,27 +62705,44 @@ var handleBuildFile = async (filePath, outputPath, glbOutputPath, stepOutputPath
|
|
|
62660
62705
|
workerStatus(`waiting on ${asyncEffectName}…`);
|
|
62661
62706
|
}
|
|
62662
62707
|
})).circuitJson;
|
|
62663
|
-
|
|
62664
|
-
|
|
62665
|
-
workerLog(`Circuit JSON written to ${
|
|
62708
|
+
fs16.mkdirSync(path22.dirname(outputPath), { recursive: true });
|
|
62709
|
+
fs16.writeFileSync(outputPath, JSON.stringify(circuitJson, null, 2));
|
|
62710
|
+
workerLog(`Circuit JSON written to ${path22.relative(projectDir, outputPath)}`);
|
|
62666
62711
|
const diagnostics = analyzeCircuitJson(circuitJson);
|
|
62667
62712
|
const filteredDiagnostics = filterDiagnosticsByDrcCategory({
|
|
62668
62713
|
errors: diagnostics.errors,
|
|
62669
62714
|
warnings: diagnostics.warnings,
|
|
62670
62715
|
ignoreOptions: options
|
|
62671
62716
|
});
|
|
62717
|
+
const errorsFilePath = writeBuildErrorsFile(outputPath, filteredDiagnostics.errors);
|
|
62672
62718
|
if (!options?.ignoreWarnings) {
|
|
62719
|
+
const { issuesToLog, omittedLines } = collapseRepeatedIssues(filteredDiagnostics.warnings);
|
|
62720
|
+
const loggedWarnings = new Set(issuesToLog);
|
|
62673
62721
|
for (const warn of filteredDiagnostics.warnings) {
|
|
62674
62722
|
const msg = warn.message || JSON.stringify(warn);
|
|
62675
62723
|
warnings.push(msg);
|
|
62676
|
-
|
|
62724
|
+
if (loggedWarnings.has(warn))
|
|
62725
|
+
workerLog(`Warning: ${msg}`);
|
|
62677
62726
|
}
|
|
62727
|
+
for (const line of omittedLines)
|
|
62728
|
+
workerLog(`Warning: ${line}`);
|
|
62678
62729
|
}
|
|
62679
62730
|
if (!options?.ignoreErrors) {
|
|
62731
|
+
const { issuesToLog, omittedLines } = collapseRepeatedIssues(filteredDiagnostics.errors);
|
|
62732
|
+
const loggedErrors = new Set(issuesToLog);
|
|
62680
62733
|
for (const err of filteredDiagnostics.errors) {
|
|
62681
62734
|
const msg = err.message || JSON.stringify(err);
|
|
62682
62735
|
errors.push(msg);
|
|
62683
|
-
|
|
62736
|
+
if (loggedErrors.has(err))
|
|
62737
|
+
workerLog(`Error: ${msg}`);
|
|
62738
|
+
}
|
|
62739
|
+
for (const line of omittedLines)
|
|
62740
|
+
workerLog(`Error: ${line}`);
|
|
62741
|
+
if (errorsFilePath) {
|
|
62742
|
+
workerLog(`${filteredDiagnostics.errors.length} error(s), all written to ${path22.relative(projectDir, errorsFilePath)}:`);
|
|
62743
|
+
for (const line of getIssueTypeCountLines(filteredDiagnostics.errors)) {
|
|
62744
|
+
workerLog(line);
|
|
62745
|
+
}
|
|
62684
62746
|
}
|
|
62685
62747
|
}
|
|
62686
62748
|
const hasErrors = filteredDiagnostics.errors.length > 0 && !options?.ignoreErrors;
|
|
@@ -62692,7 +62754,7 @@ var handleBuildFile = async (filePath, outputPath, glbOutputPath, stepOutputPath
|
|
|
62692
62754
|
let previewError;
|
|
62693
62755
|
if (glbOutputPath) {
|
|
62694
62756
|
try {
|
|
62695
|
-
workerLog(`Converting ${
|
|
62757
|
+
workerLog(`Converting ${path22.relative(projectDir, outputPath)} to GLB in same worker...`);
|
|
62696
62758
|
await writeGlbFromCircuitJson(circuitJson, glbOutputPath);
|
|
62697
62759
|
glbOk = true;
|
|
62698
62760
|
} catch (err) {
|
|
@@ -62703,7 +62765,7 @@ var handleBuildFile = async (filePath, outputPath, glbOutputPath, stepOutputPath
|
|
|
62703
62765
|
}
|
|
62704
62766
|
if (stepOutputPath) {
|
|
62705
62767
|
try {
|
|
62706
|
-
workerLog(`Converting ${
|
|
62768
|
+
workerLog(`Converting ${path22.relative(projectDir, outputPath)} to STEP in same worker...`);
|
|
62707
62769
|
await writeStepFromCircuitJson(circuitJson, stepOutputPath);
|
|
62708
62770
|
stepOk = true;
|
|
62709
62771
|
} catch (err) {
|
|
@@ -62714,8 +62776,8 @@ var handleBuildFile = async (filePath, outputPath, glbOutputPath, stepOutputPath
|
|
|
62714
62776
|
}
|
|
62715
62777
|
if (options?.generatePreviewAssets) {
|
|
62716
62778
|
try {
|
|
62717
|
-
const resolvedPreviewOutputDir = previewOutputDir ??
|
|
62718
|
-
workerLog(`Generating preview assets for ${
|
|
62779
|
+
const resolvedPreviewOutputDir = previewOutputDir ?? path22.dirname(outputPath);
|
|
62780
|
+
workerLog(`Generating preview assets for ${path22.relative(projectDir, resolvedPreviewOutputDir)} in same worker...`);
|
|
62719
62781
|
await writeImageAssetsFromCircuitJson(circuitJson, {
|
|
62720
62782
|
outputDir: resolvedPreviewOutputDir,
|
|
62721
62783
|
imageFormats: options?.imageFormats ?? DEFAULT_IMAGE_FORMAT_SELECTION,
|
package/dist/cli/main.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
[diffend] Oversized file quarantined before diffing.
|
|
2
2
|
name: package/dist/cli/main.js
|
|
3
|
-
size:
|
|
4
|
-
sha256:
|
|
3
|
+
size: 47931472 bytes
|
|
4
|
+
sha256: 5a3ffc748fb63fa2f59e1ff26b70a30fd2ed5df4a712cdd525d66ec4857fb16d
|