@tscircuit/cli 0.1.469 → 0.1.470
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 +631 -334
- package/package.json +4 -4
package/dist/main.js
CHANGED
|
@@ -1596,7 +1596,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1596
1596
|
return arg.length > 1 && arg[0] === "-";
|
|
1597
1597
|
}
|
|
1598
1598
|
const negativeNumberArg = (arg) => {
|
|
1599
|
-
if (
|
|
1599
|
+
if (!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(arg))
|
|
1600
1600
|
return false;
|
|
1601
1601
|
return !this._getCommandAndAncestors().some((cmd) => cmd.options.map((opt) => opt.short).some((short) => /^-\d$/.test(short)));
|
|
1602
1602
|
};
|
|
@@ -52173,9 +52173,9 @@ var require_fs = __commonJS((exports2) => {
|
|
|
52173
52173
|
var require_path = __commonJS((exports2) => {
|
|
52174
52174
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
52175
52175
|
exports2.convertPosixPathToPattern = exports2.convertWindowsPathToPattern = exports2.convertPathToPattern = exports2.escapePosixPath = exports2.escapeWindowsPath = exports2.escape = exports2.removeLeadingDotSegment = exports2.makeAbsolute = exports2.unixify = undefined;
|
|
52176
|
-
var
|
|
52176
|
+
var os2 = __require("os");
|
|
52177
52177
|
var path14 = __require("path");
|
|
52178
|
-
var IS_WINDOWS_PLATFORM =
|
|
52178
|
+
var IS_WINDOWS_PLATFORM = os2.platform() === "win32";
|
|
52179
52179
|
var LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2;
|
|
52180
52180
|
var POSIX_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g;
|
|
52181
52181
|
var WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()[\]{}]|^!|[!+@](?=\())/g;
|
|
@@ -53442,7 +53442,7 @@ var require_braces = __commonJS((exports2, module2) => {
|
|
|
53442
53442
|
module2.exports = braces;
|
|
53443
53443
|
});
|
|
53444
53444
|
|
|
53445
|
-
// node_modules/picomatch/lib/constants.js
|
|
53445
|
+
// node_modules/micromatch/node_modules/picomatch/lib/constants.js
|
|
53446
53446
|
var require_constants3 = __commonJS((exports2, module2) => {
|
|
53447
53447
|
var path14 = __require("path");
|
|
53448
53448
|
var WIN_SLASH = "\\\\/";
|
|
@@ -53582,7 +53582,7 @@ var require_constants3 = __commonJS((exports2, module2) => {
|
|
|
53582
53582
|
};
|
|
53583
53583
|
});
|
|
53584
53584
|
|
|
53585
|
-
// node_modules/picomatch/lib/utils.js
|
|
53585
|
+
// node_modules/micromatch/node_modules/picomatch/lib/utils.js
|
|
53586
53586
|
var require_utils3 = __commonJS((exports2) => {
|
|
53587
53587
|
var path14 = __require("path");
|
|
53588
53588
|
var win32 = process.platform === "win32";
|
|
@@ -53642,7 +53642,7 @@ var require_utils3 = __commonJS((exports2) => {
|
|
|
53642
53642
|
};
|
|
53643
53643
|
});
|
|
53644
53644
|
|
|
53645
|
-
// node_modules/picomatch/lib/scan.js
|
|
53645
|
+
// node_modules/micromatch/node_modules/picomatch/lib/scan.js
|
|
53646
53646
|
var require_scan = __commonJS((exports2, module2) => {
|
|
53647
53647
|
var utils = require_utils3();
|
|
53648
53648
|
var {
|
|
@@ -53957,7 +53957,7 @@ var require_scan = __commonJS((exports2, module2) => {
|
|
|
53957
53957
|
module2.exports = scan;
|
|
53958
53958
|
});
|
|
53959
53959
|
|
|
53960
|
-
// node_modules/picomatch/lib/parse.js
|
|
53960
|
+
// node_modules/micromatch/node_modules/picomatch/lib/parse.js
|
|
53961
53961
|
var require_parse3 = __commonJS((exports2, module2) => {
|
|
53962
53962
|
var constants = require_constants3();
|
|
53963
53963
|
var utils = require_utils3();
|
|
@@ -54735,7 +54735,7 @@ var require_parse3 = __commonJS((exports2, module2) => {
|
|
|
54735
54735
|
module2.exports = parse3;
|
|
54736
54736
|
});
|
|
54737
54737
|
|
|
54738
|
-
// node_modules/picomatch/lib/picomatch.js
|
|
54738
|
+
// node_modules/micromatch/node_modules/picomatch/lib/picomatch.js
|
|
54739
54739
|
var require_picomatch = __commonJS((exports2, module2) => {
|
|
54740
54740
|
var path14 = __require("path");
|
|
54741
54741
|
var scan = require_scan();
|
|
@@ -57205,8 +57205,8 @@ var require_settings4 = __commonJS((exports2) => {
|
|
|
57205
57205
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
57206
57206
|
exports2.DEFAULT_FILE_SYSTEM_ADAPTER = undefined;
|
|
57207
57207
|
var fs13 = __require("fs");
|
|
57208
|
-
var
|
|
57209
|
-
var CPU_COUNT = Math.max(
|
|
57208
|
+
var os2 = __require("os");
|
|
57209
|
+
var CPU_COUNT = Math.max(os2.cpus().length, 1);
|
|
57210
57210
|
exports2.DEFAULT_FILE_SYSTEM_ADAPTER = {
|
|
57211
57211
|
lstat: fs13.lstat,
|
|
57212
57212
|
lstatSync: fs13.lstatSync,
|
|
@@ -70470,13 +70470,18 @@ import path7 from "node:path";
|
|
|
70470
70470
|
import fs4 from "node:fs";
|
|
70471
70471
|
import { promisify } from "node:util";
|
|
70472
70472
|
|
|
70473
|
-
// node_modules/stubborn-
|
|
70474
|
-
var attemptifyAsync = (fn,
|
|
70473
|
+
// node_modules/stubborn-utils/dist/attemptify_async.js
|
|
70474
|
+
var attemptifyAsync = (fn, options) => {
|
|
70475
|
+
const { onError } = options;
|
|
70475
70476
|
return function attemptified(...args) {
|
|
70476
70477
|
return fn.apply(undefined, args).catch(onError);
|
|
70477
70478
|
};
|
|
70478
70479
|
};
|
|
70479
|
-
var
|
|
70480
|
+
var attemptify_async_default = attemptifyAsync;
|
|
70481
|
+
|
|
70482
|
+
// node_modules/stubborn-utils/dist/attemptify_sync.js
|
|
70483
|
+
var attemptifySync = (fn, options) => {
|
|
70484
|
+
const { onError } = options;
|
|
70480
70485
|
return function attemptified(...args) {
|
|
70481
70486
|
try {
|
|
70482
70487
|
return fn.apply(undefined, args);
|
|
@@ -70485,14 +70490,62 @@ var attemptifySync = (fn, onError) => {
|
|
|
70485
70490
|
}
|
|
70486
70491
|
};
|
|
70487
70492
|
};
|
|
70493
|
+
var attemptify_sync_default = attemptifySync;
|
|
70494
|
+
|
|
70495
|
+
// node_modules/stubborn-utils/dist/constants.js
|
|
70496
|
+
var RETRY_INTERVAL = 250;
|
|
70497
|
+
|
|
70498
|
+
// node_modules/stubborn-utils/dist/retryify_async.js
|
|
70499
|
+
var retryifyAsync = (fn, options) => {
|
|
70500
|
+
const { isRetriable } = options;
|
|
70501
|
+
return function retryified(options2) {
|
|
70502
|
+
const { timeout } = options2;
|
|
70503
|
+
const interval = options2.interval ?? RETRY_INTERVAL;
|
|
70504
|
+
const timestamp = Date.now() + timeout;
|
|
70505
|
+
return function attempt(...args) {
|
|
70506
|
+
return fn.apply(undefined, args).catch((error) => {
|
|
70507
|
+
if (!isRetriable(error))
|
|
70508
|
+
throw error;
|
|
70509
|
+
if (Date.now() >= timestamp)
|
|
70510
|
+
throw error;
|
|
70511
|
+
const delay = Math.round(interval * Math.random());
|
|
70512
|
+
if (delay > 0) {
|
|
70513
|
+
const delayPromise = new Promise((resolve) => setTimeout(resolve, delay));
|
|
70514
|
+
return delayPromise.then(() => attempt.apply(undefined, args));
|
|
70515
|
+
} else {
|
|
70516
|
+
return attempt.apply(undefined, args);
|
|
70517
|
+
}
|
|
70518
|
+
});
|
|
70519
|
+
};
|
|
70520
|
+
};
|
|
70521
|
+
};
|
|
70522
|
+
var retryify_async_default = retryifyAsync;
|
|
70523
|
+
|
|
70524
|
+
// node_modules/stubborn-utils/dist/retryify_sync.js
|
|
70525
|
+
var retryifySync = (fn, options) => {
|
|
70526
|
+
const { isRetriable } = options;
|
|
70527
|
+
return function retryified(options2) {
|
|
70528
|
+
const { timeout } = options2;
|
|
70529
|
+
const timestamp = Date.now() + timeout;
|
|
70530
|
+
return function attempt(...args) {
|
|
70531
|
+
while (true) {
|
|
70532
|
+
try {
|
|
70533
|
+
return fn.apply(undefined, args);
|
|
70534
|
+
} catch (error) {
|
|
70535
|
+
if (!isRetriable(error))
|
|
70536
|
+
throw error;
|
|
70537
|
+
if (Date.now() >= timestamp)
|
|
70538
|
+
throw error;
|
|
70539
|
+
continue;
|
|
70540
|
+
}
|
|
70541
|
+
}
|
|
70542
|
+
};
|
|
70543
|
+
};
|
|
70544
|
+
};
|
|
70545
|
+
var retryify_sync_default = retryifySync;
|
|
70488
70546
|
|
|
70489
70547
|
// node_modules/stubborn-fs/dist/constants.js
|
|
70490
70548
|
import process3 from "node:process";
|
|
70491
|
-
var IS_USER_ROOT = process3.getuid ? !process3.getuid() : false;
|
|
70492
|
-
var LIMIT_FILES_DESCRIPTORS = 1e4;
|
|
70493
|
-
var NOOP = () => {
|
|
70494
|
-
return;
|
|
70495
|
-
};
|
|
70496
70549
|
|
|
70497
70550
|
// node_modules/stubborn-fs/dist/handlers.js
|
|
70498
70551
|
var Handlers = {
|
|
@@ -70527,153 +70580,70 @@ var Handlers = {
|
|
|
70527
70580
|
};
|
|
70528
70581
|
var handlers_default = Handlers;
|
|
70529
70582
|
|
|
70530
|
-
// node_modules/stubborn-fs/dist/
|
|
70531
|
-
|
|
70532
|
-
|
|
70533
|
-
|
|
70534
|
-
|
|
70535
|
-
|
|
70536
|
-
|
|
70537
|
-
this.queueWaiting = new Set;
|
|
70538
|
-
this.init = () => {
|
|
70539
|
-
if (this.intervalId)
|
|
70540
|
-
return;
|
|
70541
|
-
this.intervalId = setInterval(this.tick, this.interval);
|
|
70542
|
-
};
|
|
70543
|
-
this.reset = () => {
|
|
70544
|
-
if (!this.intervalId)
|
|
70545
|
-
return;
|
|
70546
|
-
clearInterval(this.intervalId);
|
|
70547
|
-
delete this.intervalId;
|
|
70548
|
-
};
|
|
70549
|
-
this.add = (fn) => {
|
|
70550
|
-
this.queueWaiting.add(fn);
|
|
70551
|
-
if (this.queueActive.size < this.limit / 2) {
|
|
70552
|
-
this.tick();
|
|
70553
|
-
} else {
|
|
70554
|
-
this.init();
|
|
70555
|
-
}
|
|
70556
|
-
};
|
|
70557
|
-
this.remove = (fn) => {
|
|
70558
|
-
this.queueWaiting.delete(fn);
|
|
70559
|
-
this.queueActive.delete(fn);
|
|
70560
|
-
};
|
|
70561
|
-
this.schedule = () => {
|
|
70562
|
-
return new Promise((resolve) => {
|
|
70563
|
-
const cleanup = () => this.remove(resolver);
|
|
70564
|
-
const resolver = () => resolve(cleanup);
|
|
70565
|
-
this.add(resolver);
|
|
70566
|
-
});
|
|
70567
|
-
};
|
|
70568
|
-
this.tick = () => {
|
|
70569
|
-
if (this.queueActive.size >= this.limit)
|
|
70570
|
-
return;
|
|
70571
|
-
if (!this.queueWaiting.size)
|
|
70572
|
-
return this.reset();
|
|
70573
|
-
for (const fn of this.queueWaiting) {
|
|
70574
|
-
if (this.queueActive.size >= this.limit)
|
|
70575
|
-
break;
|
|
70576
|
-
this.queueWaiting.delete(fn);
|
|
70577
|
-
this.queueActive.add(fn);
|
|
70578
|
-
fn();
|
|
70579
|
-
}
|
|
70580
|
-
};
|
|
70583
|
+
// node_modules/stubborn-fs/dist/constants.js
|
|
70584
|
+
var ATTEMPTIFY_CHANGE_ERROR_OPTIONS = {
|
|
70585
|
+
onError: handlers_default.onChangeError
|
|
70586
|
+
};
|
|
70587
|
+
var ATTEMPTIFY_NOOP_OPTIONS = {
|
|
70588
|
+
onError: () => {
|
|
70589
|
+
return;
|
|
70581
70590
|
}
|
|
70582
|
-
}
|
|
70583
|
-
var retryify_queue_default = new RetryfyQueue;
|
|
70584
|
-
|
|
70585
|
-
// node_modules/stubborn-fs/dist/retryify.js
|
|
70586
|
-
var retryifyAsync = (fn, isRetriableError) => {
|
|
70587
|
-
return function retrified(timestamp) {
|
|
70588
|
-
return function attempt(...args) {
|
|
70589
|
-
return retryify_queue_default.schedule().then((cleanup) => {
|
|
70590
|
-
const onResolve = (result) => {
|
|
70591
|
-
cleanup();
|
|
70592
|
-
return result;
|
|
70593
|
-
};
|
|
70594
|
-
const onReject = (error) => {
|
|
70595
|
-
cleanup();
|
|
70596
|
-
if (Date.now() >= timestamp)
|
|
70597
|
-
throw error;
|
|
70598
|
-
if (isRetriableError(error)) {
|
|
70599
|
-
const delay = Math.round(100 * Math.random());
|
|
70600
|
-
const delayPromise = new Promise((resolve) => setTimeout(resolve, delay));
|
|
70601
|
-
return delayPromise.then(() => attempt.apply(undefined, args));
|
|
70602
|
-
}
|
|
70603
|
-
throw error;
|
|
70604
|
-
};
|
|
70605
|
-
return fn.apply(undefined, args).then(onResolve, onReject);
|
|
70606
|
-
});
|
|
70607
|
-
};
|
|
70608
|
-
};
|
|
70609
70591
|
};
|
|
70610
|
-
var
|
|
70611
|
-
|
|
70612
|
-
|
|
70613
|
-
try {
|
|
70614
|
-
return fn.apply(undefined, args);
|
|
70615
|
-
} catch (error) {
|
|
70616
|
-
if (Date.now() > timestamp)
|
|
70617
|
-
throw error;
|
|
70618
|
-
if (isRetriableError(error))
|
|
70619
|
-
return attempt.apply(undefined, args);
|
|
70620
|
-
throw error;
|
|
70621
|
-
}
|
|
70622
|
-
};
|
|
70623
|
-
};
|
|
70592
|
+
var IS_USER_ROOT = process3.getuid ? !process3.getuid() : false;
|
|
70593
|
+
var RETRYIFY_OPTIONS = {
|
|
70594
|
+
isRetriable: handlers_default.isRetriableError
|
|
70624
70595
|
};
|
|
70625
70596
|
|
|
70626
70597
|
// node_modules/stubborn-fs/dist/index.js
|
|
70627
70598
|
var FS = {
|
|
70628
70599
|
attempt: {
|
|
70629
|
-
chmod:
|
|
70630
|
-
chown:
|
|
70631
|
-
close:
|
|
70632
|
-
fsync:
|
|
70633
|
-
mkdir:
|
|
70634
|
-
realpath:
|
|
70635
|
-
stat:
|
|
70636
|
-
unlink:
|
|
70637
|
-
chmodSync:
|
|
70638
|
-
chownSync:
|
|
70639
|
-
closeSync:
|
|
70640
|
-
existsSync:
|
|
70641
|
-
fsyncSync:
|
|
70642
|
-
mkdirSync:
|
|
70643
|
-
realpathSync:
|
|
70644
|
-
statSync:
|
|
70645
|
-
unlinkSync:
|
|
70600
|
+
chmod: attemptify_async_default(promisify(fs4.chmod), ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
|
|
70601
|
+
chown: attemptify_async_default(promisify(fs4.chown), ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
|
|
70602
|
+
close: attemptify_async_default(promisify(fs4.close), ATTEMPTIFY_NOOP_OPTIONS),
|
|
70603
|
+
fsync: attemptify_async_default(promisify(fs4.fsync), ATTEMPTIFY_NOOP_OPTIONS),
|
|
70604
|
+
mkdir: attemptify_async_default(promisify(fs4.mkdir), ATTEMPTIFY_NOOP_OPTIONS),
|
|
70605
|
+
realpath: attemptify_async_default(promisify(fs4.realpath), ATTEMPTIFY_NOOP_OPTIONS),
|
|
70606
|
+
stat: attemptify_async_default(promisify(fs4.stat), ATTEMPTIFY_NOOP_OPTIONS),
|
|
70607
|
+
unlink: attemptify_async_default(promisify(fs4.unlink), ATTEMPTIFY_NOOP_OPTIONS),
|
|
70608
|
+
chmodSync: attemptify_sync_default(fs4.chmodSync, ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
|
|
70609
|
+
chownSync: attemptify_sync_default(fs4.chownSync, ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
|
|
70610
|
+
closeSync: attemptify_sync_default(fs4.closeSync, ATTEMPTIFY_NOOP_OPTIONS),
|
|
70611
|
+
existsSync: attemptify_sync_default(fs4.existsSync, ATTEMPTIFY_NOOP_OPTIONS),
|
|
70612
|
+
fsyncSync: attemptify_sync_default(fs4.fsync, ATTEMPTIFY_NOOP_OPTIONS),
|
|
70613
|
+
mkdirSync: attemptify_sync_default(fs4.mkdirSync, ATTEMPTIFY_NOOP_OPTIONS),
|
|
70614
|
+
realpathSync: attemptify_sync_default(fs4.realpathSync, ATTEMPTIFY_NOOP_OPTIONS),
|
|
70615
|
+
statSync: attemptify_sync_default(fs4.statSync, ATTEMPTIFY_NOOP_OPTIONS),
|
|
70616
|
+
unlinkSync: attemptify_sync_default(fs4.unlinkSync, ATTEMPTIFY_NOOP_OPTIONS)
|
|
70646
70617
|
},
|
|
70647
70618
|
retry: {
|
|
70648
|
-
close:
|
|
70649
|
-
fsync:
|
|
70650
|
-
open:
|
|
70651
|
-
readFile:
|
|
70652
|
-
rename:
|
|
70653
|
-
stat:
|
|
70654
|
-
write:
|
|
70655
|
-
writeFile:
|
|
70656
|
-
closeSync:
|
|
70657
|
-
fsyncSync:
|
|
70658
|
-
openSync:
|
|
70659
|
-
readFileSync:
|
|
70660
|
-
renameSync:
|
|
70661
|
-
statSync:
|
|
70662
|
-
writeSync:
|
|
70663
|
-
writeFileSync:
|
|
70619
|
+
close: retryify_async_default(promisify(fs4.close), RETRYIFY_OPTIONS),
|
|
70620
|
+
fsync: retryify_async_default(promisify(fs4.fsync), RETRYIFY_OPTIONS),
|
|
70621
|
+
open: retryify_async_default(promisify(fs4.open), RETRYIFY_OPTIONS),
|
|
70622
|
+
readFile: retryify_async_default(promisify(fs4.readFile), RETRYIFY_OPTIONS),
|
|
70623
|
+
rename: retryify_async_default(promisify(fs4.rename), RETRYIFY_OPTIONS),
|
|
70624
|
+
stat: retryify_async_default(promisify(fs4.stat), RETRYIFY_OPTIONS),
|
|
70625
|
+
write: retryify_async_default(promisify(fs4.write), RETRYIFY_OPTIONS),
|
|
70626
|
+
writeFile: retryify_async_default(promisify(fs4.writeFile), RETRYIFY_OPTIONS),
|
|
70627
|
+
closeSync: retryify_sync_default(fs4.closeSync, RETRYIFY_OPTIONS),
|
|
70628
|
+
fsyncSync: retryify_sync_default(fs4.fsyncSync, RETRYIFY_OPTIONS),
|
|
70629
|
+
openSync: retryify_sync_default(fs4.openSync, RETRYIFY_OPTIONS),
|
|
70630
|
+
readFileSync: retryify_sync_default(fs4.readFileSync, RETRYIFY_OPTIONS),
|
|
70631
|
+
renameSync: retryify_sync_default(fs4.renameSync, RETRYIFY_OPTIONS),
|
|
70632
|
+
statSync: retryify_sync_default(fs4.statSync, RETRYIFY_OPTIONS),
|
|
70633
|
+
writeSync: retryify_sync_default(fs4.writeSync, RETRYIFY_OPTIONS),
|
|
70634
|
+
writeFileSync: retryify_sync_default(fs4.writeFileSync, RETRYIFY_OPTIONS)
|
|
70664
70635
|
}
|
|
70665
70636
|
};
|
|
70666
70637
|
var dist_default = FS;
|
|
70667
70638
|
|
|
70668
70639
|
// node_modules/atomically/dist/constants.js
|
|
70669
|
-
import os2 from "node:os";
|
|
70670
70640
|
import process4 from "node:process";
|
|
70671
70641
|
var DEFAULT_ENCODING = "utf8";
|
|
70672
70642
|
var DEFAULT_FILE_MODE = 438;
|
|
70673
70643
|
var DEFAULT_FOLDER_MODE = 511;
|
|
70674
70644
|
var DEFAULT_WRITE_OPTIONS = {};
|
|
70675
|
-
var DEFAULT_USER_UID =
|
|
70676
|
-
var DEFAULT_USER_GID =
|
|
70645
|
+
var DEFAULT_USER_UID = process4.geteuid ? process4.geteuid() : -1;
|
|
70646
|
+
var DEFAULT_USER_GID = process4.getegid ? process4.getegid() : -1;
|
|
70677
70647
|
var DEFAULT_TIMEOUT_SYNC = 1000;
|
|
70678
70648
|
var IS_POSIX = !!process4.getuid;
|
|
70679
70649
|
var IS_USER_ROOT2 = process4.getuid ? !process4.getuid() : false;
|
|
@@ -70702,12 +70672,12 @@ var IS_LINUX = process5.platform === "linux";
|
|
|
70702
70672
|
var IS_WINDOWS = process5.platform === "win32";
|
|
70703
70673
|
|
|
70704
70674
|
// node_modules/when-exit/dist/node/signals.js
|
|
70705
|
-
var Signals = ["
|
|
70675
|
+
var Signals = ["SIGHUP", "SIGINT", "SIGTERM"];
|
|
70706
70676
|
if (!IS_WINDOWS) {
|
|
70707
|
-
Signals.push("SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
|
|
70677
|
+
Signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
|
|
70708
70678
|
}
|
|
70709
70679
|
if (IS_LINUX) {
|
|
70710
|
-
Signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT"
|
|
70680
|
+
Signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
|
|
70711
70681
|
}
|
|
70712
70682
|
var signals_default = Signals;
|
|
70713
70683
|
|
|
@@ -70808,7 +70778,8 @@ var temp_default = Temp;
|
|
|
70808
70778
|
function writeFileSync(filePath, data, options = DEFAULT_WRITE_OPTIONS) {
|
|
70809
70779
|
if (isString(options))
|
|
70810
70780
|
return writeFileSync(filePath, data, { encoding: options });
|
|
70811
|
-
const timeout =
|
|
70781
|
+
const timeout = options.timeout ?? DEFAULT_TIMEOUT_SYNC;
|
|
70782
|
+
const retryOptions = { timeout };
|
|
70812
70783
|
let tempDisposer = null;
|
|
70813
70784
|
let tempPath = null;
|
|
70814
70785
|
let fd = null;
|
|
@@ -70838,23 +70809,23 @@ function writeFileSync(filePath, data, options = DEFAULT_WRITE_OPTIONS) {
|
|
|
70838
70809
|
recursive: true
|
|
70839
70810
|
});
|
|
70840
70811
|
}
|
|
70841
|
-
fd = dist_default.retry.openSync(
|
|
70812
|
+
fd = dist_default.retry.openSync(retryOptions)(tempPath, "w", options.mode || DEFAULT_FILE_MODE);
|
|
70842
70813
|
if (options.tmpCreated) {
|
|
70843
70814
|
options.tmpCreated(tempPath);
|
|
70844
70815
|
}
|
|
70845
70816
|
if (isString(data)) {
|
|
70846
|
-
dist_default.retry.writeSync(
|
|
70817
|
+
dist_default.retry.writeSync(retryOptions)(fd, data, 0, options.encoding || DEFAULT_ENCODING);
|
|
70847
70818
|
} else if (!isUndefined(data)) {
|
|
70848
|
-
dist_default.retry.writeSync(
|
|
70819
|
+
dist_default.retry.writeSync(retryOptions)(fd, data, 0, data.length, 0);
|
|
70849
70820
|
}
|
|
70850
70821
|
if (options.fsync !== false) {
|
|
70851
70822
|
if (options.fsyncWait !== false) {
|
|
70852
|
-
dist_default.retry.fsyncSync(
|
|
70823
|
+
dist_default.retry.fsyncSync(retryOptions)(fd);
|
|
70853
70824
|
} else {
|
|
70854
70825
|
dist_default.attempt.fsync(fd);
|
|
70855
70826
|
}
|
|
70856
70827
|
}
|
|
70857
|
-
dist_default.retry.closeSync(
|
|
70828
|
+
dist_default.retry.closeSync(retryOptions)(fd);
|
|
70858
70829
|
fd = null;
|
|
70859
70830
|
if (options.chown && (options.chown.uid !== DEFAULT_USER_UID || options.chown.gid !== DEFAULT_USER_GID)) {
|
|
70860
70831
|
dist_default.attempt.chownSync(tempPath, options.chown.uid, options.chown.gid);
|
|
@@ -70863,13 +70834,13 @@ function writeFileSync(filePath, data, options = DEFAULT_WRITE_OPTIONS) {
|
|
|
70863
70834
|
dist_default.attempt.chmodSync(tempPath, options.mode);
|
|
70864
70835
|
}
|
|
70865
70836
|
try {
|
|
70866
|
-
dist_default.retry.renameSync(
|
|
70837
|
+
dist_default.retry.renameSync(retryOptions)(tempPath, filePath);
|
|
70867
70838
|
} catch (error) {
|
|
70868
70839
|
if (!isException(error))
|
|
70869
70840
|
throw error;
|
|
70870
70841
|
if (error.code !== "ENAMETOOLONG")
|
|
70871
70842
|
throw error;
|
|
70872
|
-
dist_default.retry.renameSync(
|
|
70843
|
+
dist_default.retry.renameSync(retryOptions)(tempPath, temp_default.truncate(filePath));
|
|
70873
70844
|
}
|
|
70874
70845
|
tempDisposer();
|
|
70875
70846
|
tempPath = null;
|
|
@@ -71595,13 +71566,36 @@ class HTTPError extends Error {
|
|
|
71595
71566
|
}
|
|
71596
71567
|
}
|
|
71597
71568
|
|
|
71598
|
-
// node_modules/ky/distribution/errors/
|
|
71599
|
-
class
|
|
71600
|
-
|
|
71601
|
-
|
|
71602
|
-
|
|
71603
|
-
|
|
71604
|
-
|
|
71569
|
+
// node_modules/ky/distribution/errors/NonError.js
|
|
71570
|
+
class NonError extends Error {
|
|
71571
|
+
name = "NonError";
|
|
71572
|
+
value;
|
|
71573
|
+
constructor(value) {
|
|
71574
|
+
let message = "Non-error value was thrown";
|
|
71575
|
+
try {
|
|
71576
|
+
if (typeof value === "string") {
|
|
71577
|
+
message = value;
|
|
71578
|
+
} else if (value && typeof value === "object" && "message" in value && typeof value.message === "string") {
|
|
71579
|
+
message = value.message;
|
|
71580
|
+
}
|
|
71581
|
+
} catch {}
|
|
71582
|
+
super(message);
|
|
71583
|
+
this.value = value;
|
|
71584
|
+
}
|
|
71585
|
+
}
|
|
71586
|
+
|
|
71587
|
+
// node_modules/ky/distribution/errors/ForceRetryError.js
|
|
71588
|
+
class ForceRetryError extends Error {
|
|
71589
|
+
name = "ForceRetryError";
|
|
71590
|
+
customDelay;
|
|
71591
|
+
code;
|
|
71592
|
+
customRequest;
|
|
71593
|
+
constructor(options) {
|
|
71594
|
+
const cause = options?.cause ? options.cause instanceof Error ? options.cause : new NonError(options.cause) : undefined;
|
|
71595
|
+
super(options?.code ? `Forced retry: ${options.code}` : "Forced retry", cause ? { cause } : undefined);
|
|
71596
|
+
this.customDelay = options?.delay;
|
|
71597
|
+
this.code = options?.code;
|
|
71598
|
+
this.customRequest = options?.request;
|
|
71605
71599
|
}
|
|
71606
71600
|
}
|
|
71607
71601
|
|
|
@@ -71650,6 +71644,14 @@ var responseTypes = {
|
|
|
71650
71644
|
var maxSafeTimeout = 2147483647;
|
|
71651
71645
|
var usualFormBoundarySize = new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length;
|
|
71652
71646
|
var stop = Symbol("stop");
|
|
71647
|
+
|
|
71648
|
+
class RetryMarker {
|
|
71649
|
+
options;
|
|
71650
|
+
constructor(options) {
|
|
71651
|
+
this.options = options;
|
|
71652
|
+
}
|
|
71653
|
+
}
|
|
71654
|
+
var retry = (options) => new RetryMarker(options);
|
|
71653
71655
|
var kyOptionKeys = {
|
|
71654
71656
|
json: true,
|
|
71655
71657
|
parseJson: true,
|
|
@@ -71662,7 +71664,11 @@ var kyOptionKeys = {
|
|
|
71662
71664
|
throwHttpErrors: true,
|
|
71663
71665
|
onDownloadProgress: true,
|
|
71664
71666
|
onUploadProgress: true,
|
|
71665
|
-
fetch: true
|
|
71667
|
+
fetch: true,
|
|
71668
|
+
context: true
|
|
71669
|
+
};
|
|
71670
|
+
var vendorSpecificOptions = {
|
|
71671
|
+
next: true
|
|
71666
71672
|
};
|
|
71667
71673
|
var requestOptionsRegistry = {
|
|
71668
71674
|
method: true,
|
|
@@ -71678,9 +71684,7 @@ var requestOptionsRegistry = {
|
|
|
71678
71684
|
keepalive: true,
|
|
71679
71685
|
signal: true,
|
|
71680
71686
|
window: true,
|
|
71681
|
-
|
|
71682
|
-
duplex: true,
|
|
71683
|
-
priority: true
|
|
71687
|
+
duplex: true
|
|
71684
71688
|
};
|
|
71685
71689
|
|
|
71686
71690
|
// node_modules/ky/distribution/utils/body.js
|
|
@@ -71757,7 +71761,7 @@ var streamResponse = (response, onDownloadProgress) => {
|
|
|
71757
71761
|
headers: response.headers
|
|
71758
71762
|
});
|
|
71759
71763
|
}
|
|
71760
|
-
const totalBytes = Number(response.headers.get("content-length")) || 0;
|
|
71764
|
+
const totalBytes = Math.max(0, Number(response.headers.get("content-length")) || 0);
|
|
71761
71765
|
return new Response(withProgress(response.body, totalBytes, onDownloadProgress), {
|
|
71762
71766
|
status: response.status,
|
|
71763
71767
|
statusText: response.statusText,
|
|
@@ -71809,10 +71813,44 @@ var mergeHooks = (original = {}, incoming = {}) => ({
|
|
|
71809
71813
|
afterResponse: newHookValue(original, incoming, "afterResponse"),
|
|
71810
71814
|
beforeError: newHookValue(original, incoming, "beforeError")
|
|
71811
71815
|
});
|
|
71816
|
+
var appendSearchParameters = (target, source) => {
|
|
71817
|
+
const result = new URLSearchParams;
|
|
71818
|
+
for (const input of [target, source]) {
|
|
71819
|
+
if (input === undefined) {
|
|
71820
|
+
continue;
|
|
71821
|
+
}
|
|
71822
|
+
if (input instanceof URLSearchParams) {
|
|
71823
|
+
for (const [key, value] of input.entries()) {
|
|
71824
|
+
result.append(key, value);
|
|
71825
|
+
}
|
|
71826
|
+
} else if (Array.isArray(input)) {
|
|
71827
|
+
for (const pair of input) {
|
|
71828
|
+
if (!Array.isArray(pair) || pair.length !== 2) {
|
|
71829
|
+
throw new TypeError("Array search parameters must be provided in [[key, value], ...] format");
|
|
71830
|
+
}
|
|
71831
|
+
result.append(String(pair[0]), String(pair[1]));
|
|
71832
|
+
}
|
|
71833
|
+
} else if (isObject2(input)) {
|
|
71834
|
+
for (const [key, value] of Object.entries(input)) {
|
|
71835
|
+
if (value !== undefined) {
|
|
71836
|
+
result.append(key, String(value));
|
|
71837
|
+
}
|
|
71838
|
+
}
|
|
71839
|
+
} else {
|
|
71840
|
+
const parameters = new URLSearchParams(input);
|
|
71841
|
+
for (const [key, value] of parameters.entries()) {
|
|
71842
|
+
result.append(key, value);
|
|
71843
|
+
}
|
|
71844
|
+
}
|
|
71845
|
+
}
|
|
71846
|
+
return result;
|
|
71847
|
+
};
|
|
71812
71848
|
var deepMerge = (...sources) => {
|
|
71813
71849
|
let returnValue = {};
|
|
71814
71850
|
let headers = {};
|
|
71815
71851
|
let hooks = {};
|
|
71852
|
+
let searchParameters;
|
|
71853
|
+
const signals = [];
|
|
71816
71854
|
for (const source of sources) {
|
|
71817
71855
|
if (Array.isArray(source)) {
|
|
71818
71856
|
if (!Array.isArray(returnValue)) {
|
|
@@ -71821,6 +71859,28 @@ var deepMerge = (...sources) => {
|
|
|
71821
71859
|
returnValue = [...returnValue, ...source];
|
|
71822
71860
|
} else if (isObject2(source)) {
|
|
71823
71861
|
for (let [key, value] of Object.entries(source)) {
|
|
71862
|
+
if (key === "signal" && value instanceof globalThis.AbortSignal) {
|
|
71863
|
+
signals.push(value);
|
|
71864
|
+
continue;
|
|
71865
|
+
}
|
|
71866
|
+
if (key === "context") {
|
|
71867
|
+
if (value !== undefined && value !== null && (!isObject2(value) || Array.isArray(value))) {
|
|
71868
|
+
throw new TypeError("The `context` option must be an object");
|
|
71869
|
+
}
|
|
71870
|
+
returnValue = {
|
|
71871
|
+
...returnValue,
|
|
71872
|
+
context: value === undefined || value === null ? {} : { ...returnValue.context, ...value }
|
|
71873
|
+
};
|
|
71874
|
+
continue;
|
|
71875
|
+
}
|
|
71876
|
+
if (key === "searchParams") {
|
|
71877
|
+
if (value === undefined || value === null) {
|
|
71878
|
+
searchParameters = undefined;
|
|
71879
|
+
} else {
|
|
71880
|
+
searchParameters = searchParameters === undefined ? value : appendSearchParameters(searchParameters, value);
|
|
71881
|
+
}
|
|
71882
|
+
continue;
|
|
71883
|
+
}
|
|
71824
71884
|
if (isObject2(value) && key in returnValue) {
|
|
71825
71885
|
value = deepMerge(returnValue[key], value);
|
|
71826
71886
|
}
|
|
@@ -71836,6 +71896,21 @@ var deepMerge = (...sources) => {
|
|
|
71836
71896
|
}
|
|
71837
71897
|
}
|
|
71838
71898
|
}
|
|
71899
|
+
if (searchParameters !== undefined) {
|
|
71900
|
+
returnValue.searchParams = searchParameters;
|
|
71901
|
+
}
|
|
71902
|
+
if (signals.length > 0) {
|
|
71903
|
+
if (signals.length === 1) {
|
|
71904
|
+
returnValue.signal = signals[0];
|
|
71905
|
+
} else if (supportsAbortSignal) {
|
|
71906
|
+
returnValue.signal = AbortSignal.any(signals);
|
|
71907
|
+
} else {
|
|
71908
|
+
returnValue.signal = signals.at(-1);
|
|
71909
|
+
}
|
|
71910
|
+
}
|
|
71911
|
+
if (returnValue.context === undefined) {
|
|
71912
|
+
returnValue.context = {};
|
|
71913
|
+
}
|
|
71839
71914
|
return returnValue;
|
|
71840
71915
|
};
|
|
71841
71916
|
|
|
@@ -71851,27 +71926,39 @@ var defaultRetryOptions = {
|
|
|
71851
71926
|
afterStatusCodes: retryAfterStatusCodes,
|
|
71852
71927
|
maxRetryAfter: Number.POSITIVE_INFINITY,
|
|
71853
71928
|
backoffLimit: Number.POSITIVE_INFINITY,
|
|
71854
|
-
delay: (attemptCount) => 0.3 * 2 ** (attemptCount - 1) * 1000
|
|
71929
|
+
delay: (attemptCount) => 0.3 * 2 ** (attemptCount - 1) * 1000,
|
|
71930
|
+
jitter: undefined,
|
|
71931
|
+
retryOnTimeout: false
|
|
71855
71932
|
};
|
|
71856
|
-
var normalizeRetryOptions = (
|
|
71857
|
-
if (typeof
|
|
71933
|
+
var normalizeRetryOptions = (retry2 = {}) => {
|
|
71934
|
+
if (typeof retry2 === "number") {
|
|
71858
71935
|
return {
|
|
71859
71936
|
...defaultRetryOptions,
|
|
71860
|
-
limit:
|
|
71937
|
+
limit: retry2
|
|
71861
71938
|
};
|
|
71862
71939
|
}
|
|
71863
|
-
if (
|
|
71940
|
+
if (retry2.methods && !Array.isArray(retry2.methods)) {
|
|
71864
71941
|
throw new Error("retry.methods must be an array");
|
|
71865
71942
|
}
|
|
71866
|
-
if (
|
|
71943
|
+
if (retry2.statusCodes && !Array.isArray(retry2.statusCodes)) {
|
|
71867
71944
|
throw new Error("retry.statusCodes must be an array");
|
|
71868
71945
|
}
|
|
71869
71946
|
return {
|
|
71870
71947
|
...defaultRetryOptions,
|
|
71871
|
-
...
|
|
71948
|
+
...retry2
|
|
71872
71949
|
};
|
|
71873
71950
|
};
|
|
71874
71951
|
|
|
71952
|
+
// node_modules/ky/distribution/errors/TimeoutError.js
|
|
71953
|
+
class TimeoutError extends Error {
|
|
71954
|
+
request;
|
|
71955
|
+
constructor(request) {
|
|
71956
|
+
super(`Request timed out: ${request.method} ${request.url}`);
|
|
71957
|
+
this.name = "TimeoutError";
|
|
71958
|
+
this.request = request;
|
|
71959
|
+
}
|
|
71960
|
+
}
|
|
71961
|
+
|
|
71875
71962
|
// node_modules/ky/distribution/utils/timeout.js
|
|
71876
71963
|
async function timeout(request, init2, abortController, options) {
|
|
71877
71964
|
return new Promise((resolve, reject) => {
|
|
@@ -71909,7 +71996,10 @@ async function delay(ms, { signal }) {
|
|
|
71909
71996
|
var findUnknownOptions = (request, options) => {
|
|
71910
71997
|
const unknownOptions = {};
|
|
71911
71998
|
for (const key in options) {
|
|
71912
|
-
if (!(
|
|
71999
|
+
if (!Object.hasOwn(options, key)) {
|
|
72000
|
+
continue;
|
|
72001
|
+
}
|
|
72002
|
+
if (!(key in requestOptionsRegistry) && !(key in kyOptionKeys) && (!(key in request) || (key in vendorSpecificOptions))) {
|
|
71913
72003
|
unknownOptions[key] = options[key];
|
|
71914
72004
|
}
|
|
71915
72005
|
}
|
|
@@ -71934,44 +72024,59 @@ var hasSearchParameters = (search) => {
|
|
|
71934
72024
|
return Boolean(search);
|
|
71935
72025
|
};
|
|
71936
72026
|
|
|
72027
|
+
// node_modules/ky/distribution/utils/type-guards.js
|
|
72028
|
+
function isHTTPError(error) {
|
|
72029
|
+
return error instanceof HTTPError || error?.name === HTTPError.name;
|
|
72030
|
+
}
|
|
72031
|
+
function isTimeoutError(error) {
|
|
72032
|
+
return error instanceof TimeoutError || error?.name === TimeoutError.name;
|
|
72033
|
+
}
|
|
72034
|
+
|
|
71937
72035
|
// node_modules/ky/distribution/core/Ky.js
|
|
71938
72036
|
class Ky {
|
|
71939
72037
|
static create(input, options) {
|
|
71940
72038
|
const ky = new Ky(input, options);
|
|
71941
72039
|
const function_ = async () => {
|
|
71942
|
-
if (typeof ky.
|
|
72040
|
+
if (typeof ky.#options.timeout === "number" && ky.#options.timeout > maxSafeTimeout) {
|
|
71943
72041
|
throw new RangeError(`The \`timeout\` option cannot be greater than ${maxSafeTimeout}`);
|
|
71944
72042
|
}
|
|
71945
72043
|
await Promise.resolve();
|
|
71946
|
-
let response = await ky
|
|
71947
|
-
for (const hook of ky.
|
|
71948
|
-
const
|
|
72044
|
+
let response = await ky.#fetch();
|
|
72045
|
+
for (const hook of ky.#options.hooks.afterResponse) {
|
|
72046
|
+
const clonedResponse = ky.#decorateResponse(response.clone());
|
|
72047
|
+
const modifiedResponse = await hook(ky.request, ky.#getNormalizedOptions(), clonedResponse, { retryCount: ky.#retryCount });
|
|
71949
72048
|
if (modifiedResponse instanceof globalThis.Response) {
|
|
71950
72049
|
response = modifiedResponse;
|
|
71951
72050
|
}
|
|
72051
|
+
if (modifiedResponse instanceof RetryMarker) {
|
|
72052
|
+
await Promise.all([
|
|
72053
|
+
clonedResponse.body?.cancel(),
|
|
72054
|
+
response.body?.cancel()
|
|
72055
|
+
]);
|
|
72056
|
+
throw new ForceRetryError(modifiedResponse.options);
|
|
72057
|
+
}
|
|
71952
72058
|
}
|
|
71953
|
-
ky
|
|
71954
|
-
if (!response.ok && ky.
|
|
71955
|
-
let error = new HTTPError(response, ky.request, ky
|
|
71956
|
-
for (const hook of ky.
|
|
71957
|
-
error = await hook(error);
|
|
72059
|
+
ky.#decorateResponse(response);
|
|
72060
|
+
if (!response.ok && (typeof ky.#options.throwHttpErrors === "function" ? ky.#options.throwHttpErrors(response.status) : ky.#options.throwHttpErrors)) {
|
|
72061
|
+
let error = new HTTPError(response, ky.request, ky.#getNormalizedOptions());
|
|
72062
|
+
for (const hook of ky.#options.hooks.beforeError) {
|
|
72063
|
+
error = await hook(error, { retryCount: ky.#retryCount });
|
|
71958
72064
|
}
|
|
71959
72065
|
throw error;
|
|
71960
72066
|
}
|
|
71961
|
-
if (ky.
|
|
71962
|
-
if (typeof ky.
|
|
72067
|
+
if (ky.#options.onDownloadProgress) {
|
|
72068
|
+
if (typeof ky.#options.onDownloadProgress !== "function") {
|
|
71963
72069
|
throw new TypeError("The `onDownloadProgress` option must be a function");
|
|
71964
72070
|
}
|
|
71965
72071
|
if (!supportsResponseStreams) {
|
|
71966
72072
|
throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
|
|
71967
72073
|
}
|
|
71968
|
-
return streamResponse(response.clone(), ky.
|
|
72074
|
+
return streamResponse(response.clone(), ky.#options.onDownloadProgress);
|
|
71969
72075
|
}
|
|
71970
72076
|
return response;
|
|
71971
72077
|
};
|
|
71972
|
-
const
|
|
71973
|
-
|
|
71974
|
-
const originalRequest = ky._originalRequest;
|
|
72078
|
+
const result = ky.#retry(function_).finally(async () => {
|
|
72079
|
+
const originalRequest = ky.#originalRequest;
|
|
71975
72080
|
const cleanupPromises = [];
|
|
71976
72081
|
if (originalRequest && !originalRequest.bodyUsed) {
|
|
71977
72082
|
cleanupPromises.push(originalRequest.body?.cancel());
|
|
@@ -72013,150 +72118,215 @@ class Ky {
|
|
|
72013
72118
|
return searchParams;
|
|
72014
72119
|
}
|
|
72015
72120
|
request;
|
|
72016
|
-
abortController;
|
|
72017
|
-
|
|
72018
|
-
|
|
72019
|
-
|
|
72020
|
-
|
|
72121
|
+
#abortController;
|
|
72122
|
+
#retryCount = 0;
|
|
72123
|
+
#input;
|
|
72124
|
+
#options;
|
|
72125
|
+
#originalRequest;
|
|
72126
|
+
#userProvidedAbortSignal;
|
|
72127
|
+
#cachedNormalizedOptions;
|
|
72021
72128
|
constructor(input, options = {}) {
|
|
72022
|
-
this
|
|
72023
|
-
this
|
|
72129
|
+
this.#input = input;
|
|
72130
|
+
this.#options = {
|
|
72024
72131
|
...options,
|
|
72025
|
-
headers: mergeHeaders(this.
|
|
72132
|
+
headers: mergeHeaders(this.#input.headers, options.headers),
|
|
72026
72133
|
hooks: mergeHooks({
|
|
72027
72134
|
beforeRequest: [],
|
|
72028
72135
|
beforeRetry: [],
|
|
72029
72136
|
beforeError: [],
|
|
72030
72137
|
afterResponse: []
|
|
72031
72138
|
}, options.hooks),
|
|
72032
|
-
method: normalizeRequestMethod(options.method ?? this.
|
|
72139
|
+
method: normalizeRequestMethod(options.method ?? this.#input.method ?? "GET"),
|
|
72033
72140
|
prefixUrl: String(options.prefixUrl || ""),
|
|
72034
72141
|
retry: normalizeRetryOptions(options.retry),
|
|
72035
|
-
throwHttpErrors: options.throwHttpErrors
|
|
72142
|
+
throwHttpErrors: options.throwHttpErrors ?? true,
|
|
72036
72143
|
timeout: options.timeout ?? 1e4,
|
|
72037
|
-
fetch: options.fetch ?? globalThis.fetch.bind(globalThis)
|
|
72144
|
+
fetch: options.fetch ?? globalThis.fetch.bind(globalThis),
|
|
72145
|
+
context: options.context ?? {}
|
|
72038
72146
|
};
|
|
72039
|
-
if (typeof this
|
|
72147
|
+
if (typeof this.#input !== "string" && !(this.#input instanceof URL || this.#input instanceof globalThis.Request)) {
|
|
72040
72148
|
throw new TypeError("`input` must be a string, URL, or Request");
|
|
72041
72149
|
}
|
|
72042
|
-
if (this.
|
|
72043
|
-
if (this.
|
|
72150
|
+
if (this.#options.prefixUrl && typeof this.#input === "string") {
|
|
72151
|
+
if (this.#input.startsWith("/")) {
|
|
72044
72152
|
throw new Error("`input` must not begin with a slash when using `prefixUrl`");
|
|
72045
72153
|
}
|
|
72046
|
-
if (!this.
|
|
72047
|
-
this.
|
|
72154
|
+
if (!this.#options.prefixUrl.endsWith("/")) {
|
|
72155
|
+
this.#options.prefixUrl += "/";
|
|
72048
72156
|
}
|
|
72049
|
-
this
|
|
72157
|
+
this.#input = this.#options.prefixUrl + this.#input;
|
|
72050
72158
|
}
|
|
72051
72159
|
if (supportsAbortController && supportsAbortSignal) {
|
|
72052
|
-
|
|
72053
|
-
this
|
|
72054
|
-
this.
|
|
72160
|
+
this.#userProvidedAbortSignal = this.#options.signal ?? this.#input.signal;
|
|
72161
|
+
this.#abortController = new globalThis.AbortController;
|
|
72162
|
+
this.#options.signal = this.#userProvidedAbortSignal ? AbortSignal.any([this.#userProvidedAbortSignal, this.#abortController.signal]) : this.#abortController.signal;
|
|
72055
72163
|
}
|
|
72056
72164
|
if (supportsRequestStreams) {
|
|
72057
|
-
this.
|
|
72165
|
+
this.#options.duplex = "half";
|
|
72166
|
+
}
|
|
72167
|
+
if (this.#options.json !== undefined) {
|
|
72168
|
+
this.#options.body = this.#options.stringifyJson?.(this.#options.json) ?? JSON.stringify(this.#options.json);
|
|
72169
|
+
this.#options.headers.set("content-type", this.#options.headers.get("content-type") ?? "application/json");
|
|
72058
72170
|
}
|
|
72059
|
-
|
|
72060
|
-
|
|
72061
|
-
this.
|
|
72171
|
+
const userProvidedContentType = options.headers && new globalThis.Headers(options.headers).has("content-type");
|
|
72172
|
+
if (this.#input instanceof globalThis.Request && (supportsFormData && this.#options.body instanceof globalThis.FormData || this.#options.body instanceof URLSearchParams) && !userProvidedContentType) {
|
|
72173
|
+
this.#options.headers.delete("content-type");
|
|
72062
72174
|
}
|
|
72063
|
-
this.request = new globalThis.Request(this
|
|
72064
|
-
if (hasSearchParameters(this.
|
|
72065
|
-
const textSearchParams = typeof this.
|
|
72175
|
+
this.request = new globalThis.Request(this.#input, this.#options);
|
|
72176
|
+
if (hasSearchParameters(this.#options.searchParams)) {
|
|
72177
|
+
const textSearchParams = typeof this.#options.searchParams === "string" ? this.#options.searchParams.replace(/^\?/, "") : new URLSearchParams(Ky.#normalizeSearchParams(this.#options.searchParams)).toString();
|
|
72066
72178
|
const searchParams = "?" + textSearchParams;
|
|
72067
72179
|
const url = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, searchParams);
|
|
72068
|
-
|
|
72069
|
-
this.request.headers.delete("content-type");
|
|
72070
|
-
}
|
|
72071
|
-
this.request = new globalThis.Request(new globalThis.Request(url, { ...this.request }), this._options);
|
|
72180
|
+
this.request = new globalThis.Request(url, this.#options);
|
|
72072
72181
|
}
|
|
72073
|
-
if (this.
|
|
72074
|
-
if (typeof this.
|
|
72182
|
+
if (this.#options.onUploadProgress) {
|
|
72183
|
+
if (typeof this.#options.onUploadProgress !== "function") {
|
|
72075
72184
|
throw new TypeError("The `onUploadProgress` option must be a function");
|
|
72076
72185
|
}
|
|
72077
72186
|
if (!supportsRequestStreams) {
|
|
72078
72187
|
throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");
|
|
72079
72188
|
}
|
|
72080
|
-
|
|
72081
|
-
|
|
72082
|
-
|
|
72189
|
+
this.request = this.#wrapRequestWithUploadProgress(this.request, this.#options.body ?? undefined);
|
|
72190
|
+
}
|
|
72191
|
+
}
|
|
72192
|
+
#calculateDelay() {
|
|
72193
|
+
const retryDelay = this.#options.retry.delay(this.#retryCount);
|
|
72194
|
+
let jitteredDelay = retryDelay;
|
|
72195
|
+
if (this.#options.retry.jitter === true) {
|
|
72196
|
+
jitteredDelay = Math.random() * retryDelay;
|
|
72197
|
+
} else if (typeof this.#options.retry.jitter === "function") {
|
|
72198
|
+
jitteredDelay = this.#options.retry.jitter(retryDelay);
|
|
72199
|
+
if (!Number.isFinite(jitteredDelay) || jitteredDelay < 0) {
|
|
72200
|
+
jitteredDelay = retryDelay;
|
|
72083
72201
|
}
|
|
72084
72202
|
}
|
|
72203
|
+
return Math.min(this.#options.retry.backoffLimit, jitteredDelay);
|
|
72085
72204
|
}
|
|
72086
|
-
|
|
72087
|
-
this
|
|
72088
|
-
if (this
|
|
72205
|
+
async#calculateRetryDelay(error) {
|
|
72206
|
+
this.#retryCount++;
|
|
72207
|
+
if (this.#retryCount > this.#options.retry.limit) {
|
|
72208
|
+
throw error;
|
|
72209
|
+
}
|
|
72210
|
+
const errorObject = error instanceof Error ? error : new NonError(error);
|
|
72211
|
+
if (errorObject instanceof ForceRetryError) {
|
|
72212
|
+
return errorObject.customDelay ?? this.#calculateDelay();
|
|
72213
|
+
}
|
|
72214
|
+
if (!this.#options.retry.methods.includes(this.request.method.toLowerCase())) {
|
|
72215
|
+
throw error;
|
|
72216
|
+
}
|
|
72217
|
+
if (this.#options.retry.shouldRetry !== undefined) {
|
|
72218
|
+
const result = await this.#options.retry.shouldRetry({ error: errorObject, retryCount: this.#retryCount });
|
|
72219
|
+
if (result === false) {
|
|
72220
|
+
throw error;
|
|
72221
|
+
}
|
|
72222
|
+
if (result === true) {
|
|
72223
|
+
return this.#calculateDelay();
|
|
72224
|
+
}
|
|
72225
|
+
}
|
|
72226
|
+
if (isTimeoutError(error) && !this.#options.retry.retryOnTimeout) {
|
|
72089
72227
|
throw error;
|
|
72090
72228
|
}
|
|
72091
|
-
if (error
|
|
72092
|
-
if (!this.
|
|
72229
|
+
if (isHTTPError(error)) {
|
|
72230
|
+
if (!this.#options.retry.statusCodes.includes(error.response.status)) {
|
|
72093
72231
|
throw error;
|
|
72094
72232
|
}
|
|
72095
|
-
const retryAfter = error.response.headers.get("Retry-After") ?? error.response.headers.get("RateLimit-Reset") ?? error.response.headers.get("X-RateLimit-Reset") ?? error.response.headers.get("X-Rate-Limit-Reset");
|
|
72096
|
-
if (retryAfter && this.
|
|
72233
|
+
const retryAfter = error.response.headers.get("Retry-After") ?? error.response.headers.get("RateLimit-Reset") ?? error.response.headers.get("X-RateLimit-Retry-After") ?? error.response.headers.get("X-RateLimit-Reset") ?? error.response.headers.get("X-Rate-Limit-Reset");
|
|
72234
|
+
if (retryAfter && this.#options.retry.afterStatusCodes.includes(error.response.status)) {
|
|
72097
72235
|
let after = Number(retryAfter) * 1000;
|
|
72098
72236
|
if (Number.isNaN(after)) {
|
|
72099
72237
|
after = Date.parse(retryAfter) - Date.now();
|
|
72100
72238
|
} else if (after >= Date.parse("2024-01-01")) {
|
|
72101
72239
|
after -= Date.now();
|
|
72102
72240
|
}
|
|
72103
|
-
const max = this.
|
|
72241
|
+
const max = this.#options.retry.maxRetryAfter ?? after;
|
|
72104
72242
|
return after < max ? after : max;
|
|
72105
72243
|
}
|
|
72106
72244
|
if (error.response.status === 413) {
|
|
72107
72245
|
throw error;
|
|
72108
72246
|
}
|
|
72109
72247
|
}
|
|
72110
|
-
|
|
72111
|
-
return Math.min(this._options.retry.backoffLimit, retryDelay);
|
|
72248
|
+
return this.#calculateDelay();
|
|
72112
72249
|
}
|
|
72113
|
-
|
|
72114
|
-
if (this.
|
|
72115
|
-
response.json = async () => this.
|
|
72250
|
+
#decorateResponse(response) {
|
|
72251
|
+
if (this.#options.parseJson) {
|
|
72252
|
+
response.json = async () => this.#options.parseJson(await response.text());
|
|
72116
72253
|
}
|
|
72117
72254
|
return response;
|
|
72118
72255
|
}
|
|
72119
|
-
async
|
|
72256
|
+
async#retry(function_) {
|
|
72120
72257
|
try {
|
|
72121
72258
|
return await function_();
|
|
72122
72259
|
} catch (error) {
|
|
72123
|
-
const ms = Math.min(this
|
|
72124
|
-
if (this
|
|
72260
|
+
const ms = Math.min(await this.#calculateRetryDelay(error), maxSafeTimeout);
|
|
72261
|
+
if (this.#retryCount < 1) {
|
|
72125
72262
|
throw error;
|
|
72126
72263
|
}
|
|
72127
|
-
await delay(ms, { signal: this
|
|
72128
|
-
|
|
72264
|
+
await delay(ms, this.#userProvidedAbortSignal ? { signal: this.#userProvidedAbortSignal } : {});
|
|
72265
|
+
if (error instanceof ForceRetryError && error.customRequest) {
|
|
72266
|
+
const managedRequest = this.#options.signal ? new globalThis.Request(error.customRequest, { signal: this.#options.signal }) : new globalThis.Request(error.customRequest);
|
|
72267
|
+
this.#assignRequest(managedRequest);
|
|
72268
|
+
}
|
|
72269
|
+
for (const hook of this.#options.hooks.beforeRetry) {
|
|
72129
72270
|
const hookResult = await hook({
|
|
72130
72271
|
request: this.request,
|
|
72131
|
-
options: this
|
|
72272
|
+
options: this.#getNormalizedOptions(),
|
|
72132
72273
|
error,
|
|
72133
|
-
retryCount: this
|
|
72274
|
+
retryCount: this.#retryCount
|
|
72134
72275
|
});
|
|
72276
|
+
if (hookResult instanceof globalThis.Request) {
|
|
72277
|
+
this.#assignRequest(hookResult);
|
|
72278
|
+
break;
|
|
72279
|
+
}
|
|
72280
|
+
if (hookResult instanceof globalThis.Response) {
|
|
72281
|
+
return hookResult;
|
|
72282
|
+
}
|
|
72135
72283
|
if (hookResult === stop) {
|
|
72136
72284
|
return;
|
|
72137
72285
|
}
|
|
72138
72286
|
}
|
|
72139
|
-
return this
|
|
72287
|
+
return this.#retry(function_);
|
|
72140
72288
|
}
|
|
72141
72289
|
}
|
|
72142
|
-
async
|
|
72143
|
-
|
|
72144
|
-
|
|
72145
|
-
|
|
72146
|
-
|
|
72147
|
-
|
|
72148
|
-
|
|
72290
|
+
async#fetch() {
|
|
72291
|
+
if (this.#abortController?.signal.aborted) {
|
|
72292
|
+
this.#abortController = new globalThis.AbortController;
|
|
72293
|
+
this.#options.signal = this.#userProvidedAbortSignal ? AbortSignal.any([this.#userProvidedAbortSignal, this.#abortController.signal]) : this.#abortController.signal;
|
|
72294
|
+
this.request = new globalThis.Request(this.request, { signal: this.#options.signal });
|
|
72295
|
+
}
|
|
72296
|
+
for (const hook of this.#options.hooks.beforeRequest) {
|
|
72297
|
+
const result = await hook(this.request, this.#getNormalizedOptions(), { retryCount: this.#retryCount });
|
|
72149
72298
|
if (result instanceof Response) {
|
|
72150
72299
|
return result;
|
|
72151
72300
|
}
|
|
72301
|
+
if (result instanceof globalThis.Request) {
|
|
72302
|
+
this.#assignRequest(result);
|
|
72303
|
+
break;
|
|
72304
|
+
}
|
|
72305
|
+
}
|
|
72306
|
+
const nonRequestOptions = findUnknownOptions(this.request, this.#options);
|
|
72307
|
+
this.#originalRequest = this.request;
|
|
72308
|
+
this.request = this.#originalRequest.clone();
|
|
72309
|
+
if (this.#options.timeout === false) {
|
|
72310
|
+
return this.#options.fetch(this.#originalRequest, nonRequestOptions);
|
|
72152
72311
|
}
|
|
72153
|
-
|
|
72154
|
-
|
|
72155
|
-
|
|
72156
|
-
if (this
|
|
72157
|
-
|
|
72312
|
+
return timeout(this.#originalRequest, nonRequestOptions, this.#abortController, this.#options);
|
|
72313
|
+
}
|
|
72314
|
+
#getNormalizedOptions() {
|
|
72315
|
+
if (!this.#cachedNormalizedOptions) {
|
|
72316
|
+
const { hooks, ...normalizedOptions } = this.#options;
|
|
72317
|
+
this.#cachedNormalizedOptions = Object.freeze(normalizedOptions);
|
|
72158
72318
|
}
|
|
72159
|
-
return
|
|
72319
|
+
return this.#cachedNormalizedOptions;
|
|
72320
|
+
}
|
|
72321
|
+
#assignRequest(request) {
|
|
72322
|
+
this.#cachedNormalizedOptions = undefined;
|
|
72323
|
+
this.request = this.#wrapRequestWithUploadProgress(request);
|
|
72324
|
+
}
|
|
72325
|
+
#wrapRequestWithUploadProgress(request, originalBody) {
|
|
72326
|
+
if (!this.#options.onUploadProgress || !request.body) {
|
|
72327
|
+
return request;
|
|
72328
|
+
}
|
|
72329
|
+
return streamRequest(request, this.#options.onUploadProgress, originalBody ?? this.#options.body ?? undefined);
|
|
72160
72330
|
}
|
|
72161
72331
|
}
|
|
72162
72332
|
|
|
@@ -72175,6 +72345,7 @@ var createInstance = (defaults) => {
|
|
|
72175
72345
|
return createInstance(validateAndMerge(defaults, newDefaults));
|
|
72176
72346
|
};
|
|
72177
72347
|
ky.stop = stop;
|
|
72348
|
+
ky.retry = retry;
|
|
72178
72349
|
return ky;
|
|
72179
72350
|
};
|
|
72180
72351
|
var ky = createInstance();
|
|
@@ -72198,7 +72369,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
|
|
|
72198
72369
|
import { execSync as execSync2 } from "node:child_process";
|
|
72199
72370
|
var import_semver2 = __toESM2(require_semver2(), 1);
|
|
72200
72371
|
// package.json
|
|
72201
|
-
var version = "0.1.
|
|
72372
|
+
var version = "0.1.469";
|
|
72202
72373
|
var package_default = {
|
|
72203
72374
|
name: "@tscircuit/cli",
|
|
72204
72375
|
version,
|
|
@@ -72209,7 +72380,7 @@ var package_default = {
|
|
|
72209
72380
|
"@tscircuit/circuit-json-util": "0.0.67",
|
|
72210
72381
|
"@tscircuit/fake-snippets": "^0.0.128",
|
|
72211
72382
|
"@tscircuit/file-server": "^0.0.32",
|
|
72212
|
-
"@tscircuit/math-utils": "0.0.
|
|
72383
|
+
"@tscircuit/math-utils": "0.0.29",
|
|
72213
72384
|
"@tscircuit/props": "^0.0.371",
|
|
72214
72385
|
"@tscircuit/runframe": "^0.0.1233",
|
|
72215
72386
|
"@tscircuit/schematic-match-adapt": "^0.0.22",
|
|
@@ -72223,6 +72394,7 @@ var package_default = {
|
|
|
72223
72394
|
"@types/semver": "^7.5.8",
|
|
72224
72395
|
"bun-match-svg": "^0.0.12",
|
|
72225
72396
|
chokidar: "4.0.1",
|
|
72397
|
+
"circuit-json": "^0.0.306",
|
|
72226
72398
|
"circuit-json-to-gltf": "^0.0.14",
|
|
72227
72399
|
"circuit-json-to-kicad": "^0.0.3",
|
|
72228
72400
|
"circuit-json-to-readable-netlist": "^0.0.13",
|
|
@@ -72257,10 +72429,9 @@ var package_default = {
|
|
|
72257
72429
|
semver: "^7.6.3",
|
|
72258
72430
|
sharp: "0.32.6",
|
|
72259
72431
|
tempy: "^3.1.0",
|
|
72260
|
-
tscircuit: "^0.0.
|
|
72432
|
+
tscircuit: "^0.0.878-libonly",
|
|
72261
72433
|
tsx: "^4.7.1",
|
|
72262
72434
|
"typed-ky": "^0.0.4",
|
|
72263
|
-
"circuit-json": "^0.0.275",
|
|
72264
72435
|
zod: "3"
|
|
72265
72436
|
},
|
|
72266
72437
|
peerDependencies: {
|
|
@@ -94235,10 +94406,10 @@ var getSpiceWithPaddedSim = (circuitJson, options) => {
|
|
|
94235
94406
|
// lib/eecircuit-engine/run-simulation.ts
|
|
94236
94407
|
import { promises as fs26, existsSync as existsSync9 } from "node:fs";
|
|
94237
94408
|
import path26 from "node:path";
|
|
94238
|
-
import
|
|
94409
|
+
import os2 from "node:os";
|
|
94239
94410
|
var sim = null;
|
|
94240
94411
|
var fetchSimulation = async () => {
|
|
94241
|
-
const tempFilePath = path26.join(
|
|
94412
|
+
const tempFilePath = path26.join(os2.tmpdir(), "eecircuit-engine-1.5.2.mjs");
|
|
94242
94413
|
if (!existsSync9(tempFilePath)) {
|
|
94243
94414
|
const url = "https://cdn.jsdelivr.net/npm/eecircuit-engine@1.5.2/+esm";
|
|
94244
94415
|
const response = await fetch(url);
|
|
@@ -100996,7 +101167,7 @@ var zo = rs.find((t2) => t2.text === "{REF}");
|
|
|
100996
101167
|
zo.y = 0;
|
|
100997
101168
|
zo.x = 0.35;
|
|
100998
101169
|
zo.anchor = "middle_left";
|
|
100999
|
-
var
|
|
101170
|
+
var os3 = es;
|
|
101000
101171
|
var is = { paths: { path11: { type: "path", points: [{ x: -0.39, y: 0 }, { x: 0.06, y: -0.01 }], color: "primary", fill: false }, path40: { type: "path", points: [{ x: 0.07, y: 0.19 }, { x: 0.07, y: -0.18 }], color: "primary", fill: false }, "path12-1": { type: "path", points: [{ x: 0.28, y: 0.53 }, { x: 0.28, y: 0.11 }], color: "primary", fill: false }, "path12-1-5": { type: "path", points: [{ x: 0.29, y: -0.53 }, { x: 0.29, y: -0.1 }], color: "primary", fill: false }, path2: { type: "path", points: [{ x: 0.07, y: 0.11 }, { x: 0.29, y: 0.11 }], color: "primary", fill: false }, "path2-5": { type: "path", points: [{ x: 0.07, y: -0.1 }, { x: 0.29, y: -0.1 }], color: "primary", fill: false }, path15: { type: "path", points: [{ x: -0.08, y: 0.06 }, { x: -0.08, y: -0.07 }, { x: 0.01, y: 0 }, { x: -0.08, y: 0.06 }], color: "primary", fill: true } }, texts: { top1: { type: "text", text: "{REF}", x: -0.15, y: 0.36 }, bottom1: { type: "text", text: "{VAL}", x: 0.04, y: -0.42 } }, refblocks: { top1: { x: 0.28, y: 0.55 }, bottom1: { x: 0.29, y: -0.55 }, left1: { x: -0.4, y: 0 } }, bounds: { minX: -0.43, maxX: 0.43, minY: -0.58, maxY: 0.58, width: 0.85, height: 1.16, centerX: 0, centerY: 0 }, circles: { path1: { type: "circle", x: 0.14, y: 0, radius: 0.29, color: "primary", fill: false } } };
|
|
101001
101172
|
var { paths: ud, texts: ls, bounds: Ke, refblocks: Oo, circles: vd } = is;
|
|
101002
101173
|
var t0 = s({ primitives: [...Object.values(ud), ...Object.values(vd), { ...ls.top1, anchor: "middle_right", x: 0 }, { ...ls.bottom1, anchor: "middle_right", x: 0 }], ports: [{ ...Oo.top1, labels: ["1", "drain"] }, { ...Oo.bottom1, labels: ["2", "source"] }, { ...Oo.left1, labels: ["3", "gate"] }], size: { width: Ke.width, height: Ke.height }, center: { x: Ke.centerX, y: Ke.centerY } });
|
|
@@ -101585,7 +101756,7 @@ var mb = Cl.primitives.find((t3) => t3.type === "text" && t3.text === "{VAL}");
|
|
|
101585
101756
|
sb.anchor = "middle_left";
|
|
101586
101757
|
mb.anchor = "middle_right";
|
|
101587
101758
|
var B1 = Cl;
|
|
101588
|
-
var q1 = { ac_voltmeter_down: Ul, ac_voltmeter_horz: Wl, ac_voltmeter_left: Zl, ac_voltmeter_right: Kl, ac_voltmeter_up: ep, ac_voltmeter_vert: op, avalanche_diode_down: lp, avalanche_diode_horz: pp, avalanche_diode_left: yp, avalanche_diode_right: xp, avalanche_diode_up: mp, avalanche_diode_vert: fp, backward_diode_down: cp, backward_diode_left: Dt, backward_diode_right: _p, backward_diode_up: gp, battery_horz: Wt, battery_vert: Ap, boxresistor_down: Fp, boxresistor_left: Ep, boxresistor_right: Lp, boxresistor_small_down: jp, boxresistor_small_left: zp, boxresistor_small_right: Jp, boxresistor_small_up: Mp, boxresistor_up: Ip, bridged_ground_down: Dp, bridged_ground_left: Wp, bridged_ground_right: te, bridged_ground_up: Qp, capacitor_down: ta, capacitor_left: ea, capacitor_polarized_down: oa, capacitor_polarized_left: ia, capacitor_polarized_right: pa, capacitor_polarized_up: ya, capacitor_right: xa, capacitor_up: ma, constant_current_diode_down: fa, constant_current_diode_horz: ha, constant_current_diode_left: da, constant_current_diode_right: ba, constant_current_diode_up: ga, constant_current_diode_vert: va, crystal_4pin_down: wa, crystal_4pin_left: Aa, crystal_4pin_right: Pa, crystal_4pin_up: Sa, crystal_down: Ra, crystal_left: Ta, crystal_right: Ea, crystal_up: Xa, darlington_pair_transistor_down: La, darlington_pair_transistor_horz: Va, darlington_pair_transistor_left: ja, darlington_pair_transistor_right: ka, darlington_pair_transistor_up: za, darlington_pair_transistor_vert: Oa, dc_ammeter_horz: wt, dc_ammeter_vert: Ca, dc_voltmeter_down: Ia, dc_voltmeter_horz: qa, dc_voltmeter_left: Ua, dc_voltmeter_right: Wa, dc_voltmeter_up: Za, dc_voltmeter_vert: Ka, diac_down: ty, diac_horz: ey, diac_left: ry, diac_right: oy, diac_up: iy, diac_vert: ly, diode_down: ay, diode_left: yy, diode_right: $2, diode_up: xy, dpdt_normally_closed_switch_down: my, dpdt_normally_closed_switch_left: ny, dpdt_normally_closed_switch_right: M, dpdt_normally_closed_switch_up: fy, dpdt_switch_down: cy, dpdt_switch_left: dy, dpdt_switch_right: C, dpdt_switch_up: by, dpst_normally_closed_switch_down: gy, dpst_normally_closed_switch_left: uy, dpst_normally_closed_switch_right: N, dpst_normally_closed_switch_up: vy, dpst_switch_down: Ay, dpst_switch_left: Py, dpst_switch_right: I, dpst_switch_up: Sy, ferrite_bead_down: Ry, ferrite_bead_left: Ty, ferrite_bead_right: Fe, ferrite_bead_up: Se, filled_diode_down: Yy, filled_diode_horz: Ly, filled_diode_left: jy, filled_diode_right: zy, filled_diode_up: Jy, filled_diode_vert: My, frequency_meter_horz: At2, frequency_meter_vert: By, fuse_horz: ke, fuse_vert: Uy, ground_down: Gy, ground_horz: Wy, ground_left: Hy, ground_right: Zy, ground_up: Qy, ground_vert: Ky2, ground2_down: ex, ground2_left: ox, ground2_right: lx, ground2_up: ax, gunn_diode_horz: yx, gunn_diode_vert: xx, icled_down: mx, icled_left: nx, icled_right: q, icled_up: fx, igbt_transistor_horz: ze, igbt_transistor_vert: dx, illuminated_push_button_normally_open_horz: Oe, illuminated_push_button_normally_open_vert: ux, inductor_down: Px, inductor_left: Sx, inductor_right: _t, inductor_up: $e, laser_diode_down: Fx, laser_diode_left: Rx, laser_diode_right: D, laser_diode_up: Tx, led_down: Lx, led_left: Vx, led_right: gt, led_up: Ce, light_dependent_resistor_horz: Ie, light_dependent_resistor_vert: $x, mosfet_depletion_normally_on_horz: qe, mosfet_depletion_normally_on_vert: Ix, mushroom_head_normally_open_momentary_horz: Ue, mushroom_head_normally_open_momentary_vert: Ux, n_channel_d_mosfet_transistor_horz: He, n_channel_d_mosfet_transistor_vert: Qx, n_channel_e_mosfet_transistor_horz: Qe, n_channel_e_mosfet_transistor_vert:
|
|
101759
|
+
var q1 = { ac_voltmeter_down: Ul, ac_voltmeter_horz: Wl, ac_voltmeter_left: Zl, ac_voltmeter_right: Kl, ac_voltmeter_up: ep, ac_voltmeter_vert: op, avalanche_diode_down: lp, avalanche_diode_horz: pp, avalanche_diode_left: yp, avalanche_diode_right: xp, avalanche_diode_up: mp, avalanche_diode_vert: fp, backward_diode_down: cp, backward_diode_left: Dt, backward_diode_right: _p, backward_diode_up: gp, battery_horz: Wt, battery_vert: Ap, boxresistor_down: Fp, boxresistor_left: Ep, boxresistor_right: Lp, boxresistor_small_down: jp, boxresistor_small_left: zp, boxresistor_small_right: Jp, boxresistor_small_up: Mp, boxresistor_up: Ip, bridged_ground_down: Dp, bridged_ground_left: Wp, bridged_ground_right: te, bridged_ground_up: Qp, capacitor_down: ta, capacitor_left: ea, capacitor_polarized_down: oa, capacitor_polarized_left: ia, capacitor_polarized_right: pa, capacitor_polarized_up: ya, capacitor_right: xa, capacitor_up: ma, constant_current_diode_down: fa, constant_current_diode_horz: ha, constant_current_diode_left: da, constant_current_diode_right: ba, constant_current_diode_up: ga, constant_current_diode_vert: va, crystal_4pin_down: wa, crystal_4pin_left: Aa, crystal_4pin_right: Pa, crystal_4pin_up: Sa, crystal_down: Ra, crystal_left: Ta, crystal_right: Ea, crystal_up: Xa, darlington_pair_transistor_down: La, darlington_pair_transistor_horz: Va, darlington_pair_transistor_left: ja, darlington_pair_transistor_right: ka, darlington_pair_transistor_up: za, darlington_pair_transistor_vert: Oa, dc_ammeter_horz: wt, dc_ammeter_vert: Ca, dc_voltmeter_down: Ia, dc_voltmeter_horz: qa, dc_voltmeter_left: Ua, dc_voltmeter_right: Wa, dc_voltmeter_up: Za, dc_voltmeter_vert: Ka, diac_down: ty, diac_horz: ey, diac_left: ry, diac_right: oy, diac_up: iy, diac_vert: ly, diode_down: ay, diode_left: yy, diode_right: $2, diode_up: xy, dpdt_normally_closed_switch_down: my, dpdt_normally_closed_switch_left: ny, dpdt_normally_closed_switch_right: M, dpdt_normally_closed_switch_up: fy, dpdt_switch_down: cy, dpdt_switch_left: dy, dpdt_switch_right: C, dpdt_switch_up: by, dpst_normally_closed_switch_down: gy, dpst_normally_closed_switch_left: uy, dpst_normally_closed_switch_right: N, dpst_normally_closed_switch_up: vy, dpst_switch_down: Ay, dpst_switch_left: Py, dpst_switch_right: I, dpst_switch_up: Sy, ferrite_bead_down: Ry, ferrite_bead_left: Ty, ferrite_bead_right: Fe, ferrite_bead_up: Se, filled_diode_down: Yy, filled_diode_horz: Ly, filled_diode_left: jy, filled_diode_right: zy, filled_diode_up: Jy, filled_diode_vert: My, frequency_meter_horz: At2, frequency_meter_vert: By, fuse_horz: ke, fuse_vert: Uy, ground_down: Gy, ground_horz: Wy, ground_left: Hy, ground_right: Zy, ground_up: Qy, ground_vert: Ky2, ground2_down: ex, ground2_left: ox, ground2_right: lx, ground2_up: ax, gunn_diode_horz: yx, gunn_diode_vert: xx, icled_down: mx, icled_left: nx, icled_right: q, icled_up: fx, igbt_transistor_horz: ze, igbt_transistor_vert: dx, illuminated_push_button_normally_open_horz: Oe, illuminated_push_button_normally_open_vert: ux, inductor_down: Px, inductor_left: Sx, inductor_right: _t, inductor_up: $e, laser_diode_down: Fx, laser_diode_left: Rx, laser_diode_right: D, laser_diode_up: Tx, led_down: Lx, led_left: Vx, led_right: gt, led_up: Ce, light_dependent_resistor_horz: Ie, light_dependent_resistor_vert: $x, mosfet_depletion_normally_on_horz: qe, mosfet_depletion_normally_on_vert: Ix, mushroom_head_normally_open_momentary_horz: Ue, mushroom_head_normally_open_momentary_vert: Ux, n_channel_d_mosfet_transistor_horz: He, n_channel_d_mosfet_transistor_vert: Qx, n_channel_e_mosfet_transistor_horz: Qe, n_channel_e_mosfet_transistor_vert: os3, njfet_transistor_horz: t0, njfet_transistor_vert: ys, not_connected_down: ms, not_connected_left: ns, not_connected_right: U, not_connected_up: fs28, npn_bipolar_transistor_down: hs, npn_bipolar_transistor_horz: cs, npn_bipolar_transistor_left: ds, npn_bipolar_transistor_right: bs, npn_bipolar_transistor_up: _s, npn_bipolar_transistor_vert: gs, opamp_no_power_down: vs, opamp_no_power_left: ws, opamp_no_power_right: G, opamp_no_power_up: As, opamp_with_power_down: Ss, opamp_with_power_left: Fs, opamp_with_power_right: W, opamp_with_power_up: Rs, p_channel_d_mosfet_transistor_horz: a0, p_channel_d_mosfet_transistor_vert: Ls, p_channel_e_mosfet_transistor_horz: x0, p_channel_e_mosfet_transistor_vert: Os, photodiode_horz: s0, photodiode_vert: Cs, pjfet_transistor_horz: n0, pjfet_transistor_vert: Ds, pnp_bipolar_transistor_down: Us, pnp_bipolar_transistor_horz: Gs, pnp_bipolar_transistor_left: Ws, pnp_bipolar_transistor_right: Hs, pnp_bipolar_transistor_up: Zs, pnp_bipolar_transistor_vert: Qs, potentiometer_horz: g0, potentiometer_vert: rm, potentiometer2_down: pm, potentiometer2_left: am, potentiometer2_right: H, potentiometer2_up: ym, potentiometer3_down: xm, potentiometer3_left: sm, potentiometer3_right: mm, potentiometer3_up: nm, power_factor_meter_horz: S0, power_factor_meter_vert: dm, push_button_normally_closed_momentary_horz: R0, push_button_normally_closed_momentary_vert: um, push_button_normally_open_momentary_horz: E0, push_button_normally_open_momentary_vert: Pm, rectifier_diode_horz: L0, rectifier_diode_vert: Rm, resistor_down: Em, resistor_left: Xm, resistor_right: Vm, resistor_up: km, resonator_down: Om, resonator_horz: M0, resonator_left: Jm, resonator_right: K, resonator_up: $m, resonator_vert: Mm, schottky_diode_down: Nm, schottky_diode_left: Im, schottky_diode_right: tt, schottky_diode_up: Bm, silicon_controlled_rectifier_horz: C0, silicon_controlled_rectifier_vert: Um, solderjumper2_bridged12_down: Gm, solderjumper2_bridged12_left: Wm, solderjumper2_bridged12_right: Hm, solderjumper2_bridged12_up: Zm, solderjumper2_down: Qm, solderjumper2_left: Km, solderjumper2_right: tn, solderjumper2_up: en, solderjumper3_bridged12_down: rn, solderjumper3_bridged12_left: on2, solderjumper3_bridged12_right: ln, solderjumper3_bridged12_up: pn, solderjumper3_bridged123_down: an, solderjumper3_bridged123_left: yn, solderjumper3_bridged123_right: xn, solderjumper3_bridged123_up: sn, solderjumper3_bridged23_down: mn, solderjumper3_bridged23_left: nn, solderjumper3_bridged23_right: fn, solderjumper3_bridged23_up: hn, solderjumper3_down: cn, solderjumper3_left: dn, solderjumper3_right: bn, solderjumper3_up: _n, spdt_normally_closed_switch_down: un, spdt_normally_closed_switch_left: vn, spdt_normally_closed_switch_right: at, spdt_normally_closed_switch_up: wn, spdt_switch_down: Pn, spdt_switch_left: Sn, spdt_switch_right: yt, spdt_switch_up: Fn, spst_normally_closed_switch_down: Rn, spst_normally_closed_switch_left: Tn, spst_normally_closed_switch_right: xt, spst_normally_closed_switch_up: En, spst_switch_down: Yn, spst_switch_left: Xn, spst_switch_right: st, spst_switch_up: Ln, square_wave_down: Vn, square_wave_left: jn, square_wave_right: kn, square_wave_up: zn, step_recovery_diode_horz: N0, step_recovery_diode_vert: On, tachometer_horz: Tt, tachometer_vert: Cn, testpoint_down: Bn, testpoint_left: qn, testpoint_right: nt, testpoint_up: Gn, tilted_ground_down: Hn, tilted_ground_left: Zn, tilted_ground_right: ut, tilted_ground_up: B0, triac_horz: q0, triac_vert: t1, tunnel_diode_horz: U0, tunnel_diode_vert: i1, unijunction_transistor_horz: W0, unijunction_transistor_vert: s1, usbc: n1, var_meter_horz: Z0, var_meter_vert: c1, varactor_diode_horz: K0, varactor_diode_vert: g1, varistor_horz: er, varistor_vert: A1, varmeter_horz: Et, varmeter_vert: R1, vcc_down: T1, vcc_left: E1, vcc_right: Y1, vcc_up: X1, volt_meter_horz: or, volt_meter_vert: L1, watt_hour_meter_horz: Yt, watt_hour_meter_vert: z1, wattmeter_horz: Xt, wattmeter_vert: M1, zener_diode_horz: ar, zener_diode_vert: B1 };
|
|
101589
101760
|
var Y$ = Object.fromEntries(Object.keys(q1).map((t3) => [t3, t3]));
|
|
101590
101761
|
function doesLineIntersectLine([a12, a22], [b12, b22], {
|
|
101591
101762
|
lineThickness = 0
|
|
@@ -109281,7 +109452,7 @@ Learn more about data fetching with Hooks: https://react.dev/link/hooks-data-fet
|
|
|
109281
109452
|
function attachSuspenseRetryListeners(finishedWork, wakeables) {
|
|
109282
109453
|
var retryCache = getRetryCache(finishedWork);
|
|
109283
109454
|
wakeables.forEach(function(wakeable) {
|
|
109284
|
-
var
|
|
109455
|
+
var retry2 = resolveRetryWakeable.bind(null, finishedWork, wakeable);
|
|
109285
109456
|
if (!retryCache.has(wakeable)) {
|
|
109286
109457
|
retryCache.add(wakeable);
|
|
109287
109458
|
if (isDevToolsPresent)
|
|
@@ -109289,7 +109460,7 @@ Learn more about data fetching with Hooks: https://react.dev/link/hooks-data-fet
|
|
|
109289
109460
|
restorePendingUpdaters(inProgressRoot, inProgressLanes);
|
|
109290
109461
|
else
|
|
109291
109462
|
throw Error("Expected finished root and lanes to be set. This is a bug in React.");
|
|
109292
|
-
wakeable.then(
|
|
109463
|
+
wakeable.then(retry2, retry2);
|
|
109293
109464
|
}
|
|
109294
109465
|
});
|
|
109295
109466
|
}
|
|
@@ -121836,8 +122007,8 @@ Check the render method of \`` + ownerName + "`.";
|
|
|
121836
122007
|
} else if (isSuspenseInstancePending(suspenseInstance)) {
|
|
121837
122008
|
workInProgress2.flags |= DidCapture;
|
|
121838
122009
|
workInProgress2.child = current22.child;
|
|
121839
|
-
var
|
|
121840
|
-
registerSuspenseInstanceRetry(suspenseInstance,
|
|
122010
|
+
var retry2 = retryDehydratedSuspenseBoundary.bind(null, current22);
|
|
122011
|
+
registerSuspenseInstanceRetry(suspenseInstance, retry2);
|
|
121841
122012
|
return null;
|
|
121842
122013
|
} else {
|
|
121843
122014
|
reenterHydrationStateFromDehydratedSuspenseInstance(workInProgress2, suspenseInstance, suspenseState.treeContext);
|
|
@@ -124391,7 +124562,7 @@ Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-f
|
|
|
124391
124562
|
retryCache = finishedWork.stateNode = new PossiblyWeakSet;
|
|
124392
124563
|
}
|
|
124393
124564
|
wakeables.forEach(function(wakeable) {
|
|
124394
|
-
var
|
|
124565
|
+
var retry2 = resolveRetryWakeable.bind(null, finishedWork, wakeable);
|
|
124395
124566
|
if (!retryCache.has(wakeable)) {
|
|
124396
124567
|
retryCache.add(wakeable);
|
|
124397
124568
|
{
|
|
@@ -124403,7 +124574,7 @@ Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-f
|
|
|
124403
124574
|
}
|
|
124404
124575
|
}
|
|
124405
124576
|
}
|
|
124406
|
-
wakeable.then(
|
|
124577
|
+
wakeable.then(retry2, retry2);
|
|
124407
124578
|
}
|
|
124408
124579
|
});
|
|
124409
124580
|
}
|
|
@@ -140951,7 +141122,7 @@ var import_debug62 = __toESM3(require_browser(), 1);
|
|
|
140951
141122
|
var import_react = __toESM3(require_react(), 1);
|
|
140952
141123
|
var import_react_reconciler = __toESM3(require_react_reconciler(), 1);
|
|
140953
141124
|
var import_react_reconciler_18 = __toESM3(require_react_reconciler_18(), 1);
|
|
140954
|
-
var
|
|
141125
|
+
var import_constants14 = __toESM3(require_constants6(), 1);
|
|
140955
141126
|
var import_debug72 = __toESM3(require_browser(), 1);
|
|
140956
141127
|
var import_debug82 = __toESM3(require_browser(), 1);
|
|
140957
141128
|
var esm_exports2 = {};
|
|
@@ -185986,9 +186157,9 @@ var hostConfig = {
|
|
|
185986
186157
|
detachDeletedInstance: (node) => {
|
|
185987
186158
|
throw new Error("Function not implemented.");
|
|
185988
186159
|
},
|
|
185989
|
-
getCurrentEventPriority: () =>
|
|
185990
|
-
getCurrentUpdatePriority: () =>
|
|
185991
|
-
resolveUpdatePriority: () =>
|
|
186160
|
+
getCurrentEventPriority: () => import_constants14.DefaultEventPriority,
|
|
186161
|
+
getCurrentUpdatePriority: () => import_constants14.DefaultEventPriority,
|
|
186162
|
+
resolveUpdatePriority: () => import_constants14.DefaultEventPriority,
|
|
185992
186163
|
setCurrentUpdatePriority: () => {},
|
|
185993
186164
|
maySuspendCommit: () => false,
|
|
185994
186165
|
supportsHydration: false
|
|
@@ -195691,8 +195862,8 @@ var registerRemove = (program3) => {
|
|
|
195691
195862
|
};
|
|
195692
195863
|
|
|
195693
195864
|
// cli/build/register.ts
|
|
195694
|
-
import
|
|
195695
|
-
import
|
|
195865
|
+
import path33 from "node:path";
|
|
195866
|
+
import fs34 from "node:fs";
|
|
195696
195867
|
|
|
195697
195868
|
// cli/build/build-file.ts
|
|
195698
195869
|
import path29 from "node:path";
|
|
@@ -195966,9 +196137,118 @@ var buildPreviewImages = async ({
|
|
|
195966
196137
|
});
|
|
195967
196138
|
};
|
|
195968
196139
|
|
|
196140
|
+
// cli/build/transpile.ts
|
|
196141
|
+
import path32 from "node:path";
|
|
196142
|
+
import fs33 from "node:fs";
|
|
196143
|
+
import { rollup } from "rollup";
|
|
196144
|
+
import typescript from "@rollup/plugin-typescript";
|
|
196145
|
+
import resolve11 from "@rollup/plugin-node-resolve";
|
|
196146
|
+
import commonjs from "@rollup/plugin-commonjs";
|
|
196147
|
+
import dts from "rollup-plugin-dts";
|
|
196148
|
+
var transpileFile = async ({
|
|
196149
|
+
input,
|
|
196150
|
+
outputDir,
|
|
196151
|
+
projectDir
|
|
196152
|
+
}) => {
|
|
196153
|
+
try {
|
|
196154
|
+
fs33.mkdirSync(outputDir, { recursive: true });
|
|
196155
|
+
console.log("Building ESM bundle...");
|
|
196156
|
+
const esmBundle = await rollup({
|
|
196157
|
+
input,
|
|
196158
|
+
external: (id2) => {
|
|
196159
|
+
return !id2.startsWith(".") && !id2.startsWith("/");
|
|
196160
|
+
},
|
|
196161
|
+
plugins: [
|
|
196162
|
+
resolve11({
|
|
196163
|
+
extensions: [".ts", ".tsx", ".js", ".jsx"]
|
|
196164
|
+
}),
|
|
196165
|
+
commonjs(),
|
|
196166
|
+
typescript({
|
|
196167
|
+
jsx: "react",
|
|
196168
|
+
tsconfig: false,
|
|
196169
|
+
compilerOptions: {
|
|
196170
|
+
target: "ES2020",
|
|
196171
|
+
module: "ESNext",
|
|
196172
|
+
jsx: "react",
|
|
196173
|
+
declaration: false,
|
|
196174
|
+
sourceMap: false,
|
|
196175
|
+
skipLibCheck: true
|
|
196176
|
+
}
|
|
196177
|
+
})
|
|
196178
|
+
]
|
|
196179
|
+
});
|
|
196180
|
+
await esmBundle.write({
|
|
196181
|
+
file: path32.join(outputDir, "index.js"),
|
|
196182
|
+
format: "es",
|
|
196183
|
+
sourcemap: false
|
|
196184
|
+
});
|
|
196185
|
+
console.log(`ESM bundle written to ${path32.relative(projectDir, path32.join(outputDir, "index.js"))}`);
|
|
196186
|
+
console.log("Building CommonJS bundle...");
|
|
196187
|
+
const cjsBundle = await rollup({
|
|
196188
|
+
input,
|
|
196189
|
+
external: (id2) => {
|
|
196190
|
+
return !id2.startsWith(".") && !id2.startsWith("/");
|
|
196191
|
+
},
|
|
196192
|
+
plugins: [
|
|
196193
|
+
resolve11({
|
|
196194
|
+
extensions: [".ts", ".tsx", ".js", ".jsx"]
|
|
196195
|
+
}),
|
|
196196
|
+
commonjs(),
|
|
196197
|
+
typescript({
|
|
196198
|
+
jsx: "react",
|
|
196199
|
+
tsconfig: false,
|
|
196200
|
+
compilerOptions: {
|
|
196201
|
+
target: "ES2020",
|
|
196202
|
+
module: "CommonJS",
|
|
196203
|
+
jsx: "react",
|
|
196204
|
+
declaration: false,
|
|
196205
|
+
sourceMap: false,
|
|
196206
|
+
skipLibCheck: true
|
|
196207
|
+
}
|
|
196208
|
+
})
|
|
196209
|
+
]
|
|
196210
|
+
});
|
|
196211
|
+
await cjsBundle.write({
|
|
196212
|
+
file: path32.join(outputDir, "index.cjs"),
|
|
196213
|
+
format: "cjs",
|
|
196214
|
+
sourcemap: false
|
|
196215
|
+
});
|
|
196216
|
+
console.log(`CommonJS bundle written to ${path32.relative(projectDir, path32.join(outputDir, "index.cjs"))}`);
|
|
196217
|
+
console.log("Generating type declarations...");
|
|
196218
|
+
const dtsBundle = await rollup({
|
|
196219
|
+
input,
|
|
196220
|
+
external: (id2) => {
|
|
196221
|
+
return !id2.startsWith(".") && !id2.startsWith("/");
|
|
196222
|
+
},
|
|
196223
|
+
plugins: [
|
|
196224
|
+
dts({
|
|
196225
|
+
respectExternal: true
|
|
196226
|
+
})
|
|
196227
|
+
]
|
|
196228
|
+
});
|
|
196229
|
+
const dtsOutput = await dtsBundle.generate({
|
|
196230
|
+
format: "es"
|
|
196231
|
+
});
|
|
196232
|
+
let dtsContent = dtsOutput.output[0].code;
|
|
196233
|
+
dtsContent = dtsContent.replace(/import \* as [\w_]+ from ['"]react\/jsx-runtime['"];?\s*\n?/g, "");
|
|
196234
|
+
dtsContent = dtsContent.replace(/[\w_]+\.JSX\.Element/g, "any");
|
|
196235
|
+
dtsContent = dtsContent.replace(/export\s*{\s*};\s*$/gm, "").trim();
|
|
196236
|
+
fs33.writeFileSync(path32.join(outputDir, "index.d.ts"), dtsContent);
|
|
196237
|
+
console.log(`Type declarations written to ${path32.relative(projectDir, path32.join(outputDir, "index.d.ts"))}`);
|
|
196238
|
+
console.log(kleur_default.green("Transpilation complete!"));
|
|
196239
|
+
return true;
|
|
196240
|
+
} catch (err) {
|
|
196241
|
+
console.error(kleur_default.red(`Transpilation failed: ${err}`));
|
|
196242
|
+
if (err instanceof Error && err.stack) {
|
|
196243
|
+
console.error(err.stack);
|
|
196244
|
+
}
|
|
196245
|
+
return false;
|
|
196246
|
+
}
|
|
196247
|
+
};
|
|
196248
|
+
|
|
195969
196249
|
// cli/build/register.ts
|
|
195970
196250
|
var registerBuild = (program3) => {
|
|
195971
|
-
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").option("--disable-parts-engine", "Disable the parts engine").option("--site", "Generate a static site in the dist directory").option("--preview-images", "Generate preview images in the dist directory").option("--all-images", "Generate preview images for every successful build output").action(async (file, options) => {
|
|
196251
|
+
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").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").action(async (file, options) => {
|
|
195972
196252
|
try {
|
|
195973
196253
|
const { projectDir, circuitFiles, mainEntrypoint } = await getBuildEntrypoints({
|
|
195974
196254
|
fileOrDir: file
|
|
@@ -195985,17 +196265,17 @@ var registerBuild = (program3) => {
|
|
|
195985
196265
|
}
|
|
195986
196266
|
return config;
|
|
195987
196267
|
})();
|
|
195988
|
-
const distDir =
|
|
195989
|
-
|
|
196268
|
+
const distDir = path33.join(projectDir, "dist");
|
|
196269
|
+
fs34.mkdirSync(distDir, { recursive: true });
|
|
195990
196270
|
console.log(`Building ${circuitFiles.length} file(s)...`);
|
|
195991
196271
|
let hasErrors = false;
|
|
195992
196272
|
const staticFileReferences = [];
|
|
195993
196273
|
const builtFiles = [];
|
|
195994
196274
|
for (const filePath of circuitFiles) {
|
|
195995
|
-
const relative9 =
|
|
196275
|
+
const relative9 = path33.relative(projectDir, filePath);
|
|
195996
196276
|
console.log(`Building ${relative9}...`);
|
|
195997
196277
|
const outputDirName = relative9.replace(/(\.board|\.circuit)?\.tsx$/, "");
|
|
195998
|
-
const outputPath =
|
|
196278
|
+
const outputPath = path33.join(distDir, outputDirName, "circuit.json");
|
|
195999
196279
|
const ok = await buildFile(filePath, outputPath, projectDir, {
|
|
196000
196280
|
ignoreErrors: options?.ignoreErrors,
|
|
196001
196281
|
ignoreWarnings: options?.ignoreWarnings,
|
|
@@ -196009,9 +196289,9 @@ var registerBuild = (program3) => {
|
|
|
196009
196289
|
if (!ok) {
|
|
196010
196290
|
hasErrors = true;
|
|
196011
196291
|
} else if (options?.site) {
|
|
196012
|
-
const normalizedSourcePath = relative9.split(
|
|
196013
|
-
const relativeOutputPath =
|
|
196014
|
-
const normalizedOutputPath = relativeOutputPath.split(
|
|
196292
|
+
const normalizedSourcePath = relative9.split(path33.sep).join("/");
|
|
196293
|
+
const relativeOutputPath = path33.join(outputDirName, "circuit.json");
|
|
196294
|
+
const normalizedOutputPath = relativeOutputPath.split(path33.sep).join("/");
|
|
196015
196295
|
staticFileReferences.push({
|
|
196016
196296
|
filePath: normalizedSourcePath,
|
|
196017
196297
|
fileStaticAssetUrl: `./${normalizedOutputPath}`
|
|
@@ -196031,13 +196311,30 @@ var registerBuild = (program3) => {
|
|
|
196031
196311
|
allImages: options?.allImages
|
|
196032
196312
|
});
|
|
196033
196313
|
}
|
|
196314
|
+
if (options?.transpile) {
|
|
196315
|
+
console.log("Transpiling entry file...");
|
|
196316
|
+
const entryFile = mainEntrypoint || circuitFiles[0];
|
|
196317
|
+
if (!entryFile) {
|
|
196318
|
+
console.error("No entry file found for transpilation");
|
|
196319
|
+
process.exit(1);
|
|
196320
|
+
}
|
|
196321
|
+
const transpileSuccess = await transpileFile({
|
|
196322
|
+
input: entryFile,
|
|
196323
|
+
outputDir: distDir,
|
|
196324
|
+
projectDir
|
|
196325
|
+
});
|
|
196326
|
+
if (!transpileSuccess) {
|
|
196327
|
+
console.error("Transpilation failed");
|
|
196328
|
+
process.exit(1);
|
|
196329
|
+
}
|
|
196330
|
+
}
|
|
196034
196331
|
if (options?.site) {
|
|
196035
196332
|
const indexHtml = getStaticIndexHtmlFile({
|
|
196036
196333
|
files: staticFileReferences,
|
|
196037
196334
|
standaloneScriptSrc: "./standalone.min.js"
|
|
196038
196335
|
});
|
|
196039
|
-
|
|
196040
|
-
|
|
196336
|
+
fs34.writeFileSync(path33.join(distDir, "index.html"), indexHtml);
|
|
196337
|
+
fs34.writeFileSync(path33.join(distDir, "standalone.min.js"), standalone_min_default);
|
|
196041
196338
|
}
|
|
196042
196339
|
console.log("Build complete!");
|
|
196043
196340
|
process.exit(0);
|
|
@@ -196050,8 +196347,8 @@ var registerBuild = (program3) => {
|
|
|
196050
196347
|
};
|
|
196051
196348
|
|
|
196052
196349
|
// lib/shared/snapshot-project.ts
|
|
196053
|
-
import
|
|
196054
|
-
import
|
|
196350
|
+
import fs36 from "node:fs";
|
|
196351
|
+
import path34 from "node:path";
|
|
196055
196352
|
import looksSame2 from "looks-same";
|
|
196056
196353
|
import {
|
|
196057
196354
|
convertCircuitJsonToPcbSvg as convertCircuitJsonToPcbSvg3,
|
|
@@ -196062,7 +196359,7 @@ import { renderGLTFToPNGBufferFromGLBBuffer as renderGLTFToPNGBufferFromGLBBuffe
|
|
|
196062
196359
|
|
|
196063
196360
|
// lib/shared/compare-images.ts
|
|
196064
196361
|
import looksSame from "looks-same";
|
|
196065
|
-
import
|
|
196362
|
+
import fs35 from "node:fs/promises";
|
|
196066
196363
|
var compareAndCreateDiff = async (buffer1, buffer2, diffPath) => {
|
|
196067
196364
|
const { equal: equal2 } = await looksSame(buffer1, buffer2, {
|
|
196068
196365
|
strict: false,
|
|
@@ -196078,7 +196375,7 @@ var compareAndCreateDiff = async (buffer1, buffer2, diffPath) => {
|
|
|
196078
196375
|
tolerance: 2
|
|
196079
196376
|
});
|
|
196080
196377
|
} else {
|
|
196081
|
-
await
|
|
196378
|
+
await fs35.writeFile(diffPath, buffer2);
|
|
196082
196379
|
}
|
|
196083
196380
|
}
|
|
196084
196381
|
return { equal: equal2 };
|
|
@@ -196103,7 +196400,7 @@ var snapshotProject = async ({
|
|
|
196103
196400
|
...DEFAULT_IGNORED_PATTERNS,
|
|
196104
196401
|
...ignored.map(normalizeIgnorePattern)
|
|
196105
196402
|
];
|
|
196106
|
-
const resolvedPaths = filePaths.map((f) =>
|
|
196403
|
+
const resolvedPaths = filePaths.map((f) => path34.resolve(projectDir, f));
|
|
196107
196404
|
const boardFiles = findBoardFiles({
|
|
196108
196405
|
projectDir,
|
|
196109
196406
|
ignore,
|
|
@@ -196117,7 +196414,7 @@ var snapshotProject = async ({
|
|
|
196117
196414
|
const mismatches = [];
|
|
196118
196415
|
let didUpdate = false;
|
|
196119
196416
|
for (const file of boardFiles) {
|
|
196120
|
-
const relativeFilePath =
|
|
196417
|
+
const relativeFilePath = path34.relative(projectDir, file);
|
|
196121
196418
|
let circuitJson;
|
|
196122
196419
|
let pcbSvg;
|
|
196123
196420
|
let schSvg;
|
|
@@ -196171,17 +196468,17 @@ var snapshotProject = async ({
|
|
|
196171
196468
|
} catch (error) {
|
|
196172
196469
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
196173
196470
|
if (errorMessage.includes("No pcb_board found in circuit JSON")) {
|
|
196174
|
-
const fileDir =
|
|
196175
|
-
const relativeDir =
|
|
196176
|
-
const snapDir2 = snapshotsDirName ?
|
|
196177
|
-
const base2 =
|
|
196178
|
-
const snap3dPath =
|
|
196179
|
-
const existing3dSnapshot =
|
|
196471
|
+
const fileDir = path34.dirname(file);
|
|
196472
|
+
const relativeDir = path34.relative(projectDir, fileDir);
|
|
196473
|
+
const snapDir2 = snapshotsDirName ? path34.join(projectDir, snapshotsDirName, relativeDir) : path34.join(fileDir, "__snapshots__");
|
|
196474
|
+
const base2 = path34.basename(file).replace(/\.tsx$/, "");
|
|
196475
|
+
const snap3dPath = path34.join(snapDir2, `${base2}-3d.snap.png`);
|
|
196476
|
+
const existing3dSnapshot = fs36.existsSync(snap3dPath);
|
|
196180
196477
|
if (existing3dSnapshot) {
|
|
196181
196478
|
onError(kleur_default.red(`
|
|
196182
196479
|
❌ Failed to generate 3D snapshot for ${relativeFilePath}:
|
|
196183
196480
|
`) + kleur_default.red(` No pcb_board found in circuit JSON
|
|
196184
|
-
`) + kleur_default.red(` Existing snapshot: ${
|
|
196481
|
+
`) + kleur_default.red(` Existing snapshot: ${path34.relative(projectDir, snap3dPath)}
|
|
196185
196482
|
`));
|
|
196186
196483
|
return onExit(1);
|
|
196187
196484
|
} else {
|
|
@@ -196197,9 +196494,9 @@ var snapshotProject = async ({
|
|
|
196197
196494
|
}
|
|
196198
196495
|
}
|
|
196199
196496
|
}
|
|
196200
|
-
const snapDir = snapshotsDirName ?
|
|
196201
|
-
|
|
196202
|
-
const base =
|
|
196497
|
+
const snapDir = snapshotsDirName ? path34.join(projectDir, snapshotsDirName, path34.relative(projectDir, path34.dirname(file))) : path34.join(path34.dirname(file), "__snapshots__");
|
|
196498
|
+
fs36.mkdirSync(snapDir, { recursive: true });
|
|
196499
|
+
const base = path34.basename(file).replace(/\.tsx$/, "");
|
|
196203
196500
|
const snapshots = [];
|
|
196204
196501
|
if (pcbOnly || !schematicOnly) {
|
|
196205
196502
|
snapshots.push({ type: "pcb", content: pcbSvg, isBinary: false });
|
|
@@ -196217,31 +196514,31 @@ var snapshotProject = async ({
|
|
|
196217
196514
|
for (const snapshot of snapshots) {
|
|
196218
196515
|
const { type } = snapshot;
|
|
196219
196516
|
const is3d = type === "3d";
|
|
196220
|
-
const snapPath =
|
|
196221
|
-
const existing =
|
|
196517
|
+
const snapPath = path34.join(snapDir, `${base}-${type}.snap.${is3d ? "png" : "svg"}`);
|
|
196518
|
+
const existing = fs36.existsSync(snapPath);
|
|
196222
196519
|
const newContentBuffer = snapshot.isBinary ? snapshot.content : Buffer.from(snapshot.content, "utf8");
|
|
196223
196520
|
const newContentForFile = snapshot.content;
|
|
196224
196521
|
if (!existing) {
|
|
196225
|
-
|
|
196226
|
-
console.log("✅", kleur_default.gray(
|
|
196522
|
+
fs36.writeFileSync(snapPath, newContentForFile);
|
|
196523
|
+
console.log("✅", kleur_default.gray(path34.relative(projectDir, snapPath)));
|
|
196227
196524
|
didUpdate = true;
|
|
196228
196525
|
continue;
|
|
196229
196526
|
}
|
|
196230
|
-
const oldContentBuffer =
|
|
196527
|
+
const oldContentBuffer = fs36.readFileSync(snapPath);
|
|
196231
196528
|
const diffPath = snapPath.replace(is3d ? ".snap.png" : ".snap.svg", is3d ? ".diff.png" : ".diff.svg");
|
|
196232
196529
|
const { equal: equal2 } = await compareAndCreateDiff(oldContentBuffer, newContentBuffer, diffPath);
|
|
196233
196530
|
if (update) {
|
|
196234
196531
|
if (!forceUpdate && equal2) {
|
|
196235
|
-
console.log("✅", kleur_default.gray(
|
|
196532
|
+
console.log("✅", kleur_default.gray(path34.relative(projectDir, snapPath)));
|
|
196236
196533
|
} else {
|
|
196237
|
-
|
|
196238
|
-
console.log("✅", kleur_default.gray(
|
|
196534
|
+
fs36.writeFileSync(snapPath, newContentForFile);
|
|
196535
|
+
console.log("✅", kleur_default.gray(path34.relative(projectDir, snapPath)));
|
|
196239
196536
|
didUpdate = true;
|
|
196240
196537
|
}
|
|
196241
196538
|
} else if (!equal2) {
|
|
196242
196539
|
mismatches.push(`${snapPath} (diff: ${diffPath})`);
|
|
196243
196540
|
} else {
|
|
196244
|
-
console.log("✅", kleur_default.gray(
|
|
196541
|
+
console.log("✅", kleur_default.gray(path34.relative(projectDir, snapPath)));
|
|
196245
196542
|
}
|
|
196246
196543
|
}
|
|
196247
196544
|
}
|
|
@@ -196280,22 +196577,22 @@ var registerSnapshot = (program3) => {
|
|
|
196280
196577
|
};
|
|
196281
196578
|
|
|
196282
196579
|
// lib/shared/setup-github-actions.ts
|
|
196283
|
-
import
|
|
196284
|
-
import
|
|
196580
|
+
import fs37 from "node:fs";
|
|
196581
|
+
import path35 from "node:path";
|
|
196285
196582
|
var setupGithubActions = (projectDir = process.cwd()) => {
|
|
196286
196583
|
const findGitRoot = (startDir) => {
|
|
196287
|
-
let dir =
|
|
196288
|
-
while (dir !==
|
|
196289
|
-
if (
|
|
196584
|
+
let dir = path35.resolve(startDir);
|
|
196585
|
+
while (dir !== path35.parse(dir).root) {
|
|
196586
|
+
if (fs37.existsSync(path35.join(dir, ".git"))) {
|
|
196290
196587
|
return dir;
|
|
196291
196588
|
}
|
|
196292
|
-
dir =
|
|
196589
|
+
dir = path35.dirname(dir);
|
|
196293
196590
|
}
|
|
196294
196591
|
return null;
|
|
196295
196592
|
};
|
|
196296
196593
|
const gitRoot = findGitRoot(projectDir) ?? projectDir;
|
|
196297
|
-
const workflowsDir =
|
|
196298
|
-
|
|
196594
|
+
const workflowsDir = path35.join(gitRoot, ".github", "workflows");
|
|
196595
|
+
fs37.mkdirSync(workflowsDir, { recursive: true });
|
|
196299
196596
|
const buildWorkflow = `name: tscircuit Build
|
|
196300
196597
|
|
|
196301
196598
|
on:
|
|
@@ -196334,8 +196631,8 @@ jobs:
|
|
|
196334
196631
|
- run: bun install
|
|
196335
196632
|
- run: bunx tsci snapshot
|
|
196336
196633
|
`;
|
|
196337
|
-
writeFileIfNotExists(
|
|
196338
|
-
writeFileIfNotExists(
|
|
196634
|
+
writeFileIfNotExists(path35.join(workflowsDir, "tscircuit-build.yml"), buildWorkflow);
|
|
196635
|
+
writeFileIfNotExists(path35.join(workflowsDir, "tscircuit-snapshot.yml"), snapshotWorkflow);
|
|
196339
196636
|
};
|
|
196340
196637
|
|
|
196341
196638
|
// cli/setup/register.ts
|
|
@@ -196361,8 +196658,8 @@ var registerSetup = (program3) => {
|
|
|
196361
196658
|
};
|
|
196362
196659
|
|
|
196363
196660
|
// cli/convert/register.ts
|
|
196364
|
-
import
|
|
196365
|
-
import
|
|
196661
|
+
import fs38 from "node:fs/promises";
|
|
196662
|
+
import path36 from "node:path";
|
|
196366
196663
|
import { parseKicadModToCircuitJson } from "kicad-component-converter";
|
|
196367
196664
|
|
|
196368
196665
|
// node_modules/@tscircuit/mm/dist/index.js
|
|
@@ -196482,15 +196779,15 @@ var convertCircuitJsonToTscircuit = (circuitJson, opts) => {
|
|
|
196482
196779
|
var registerConvert = (program3) => {
|
|
196483
196780
|
program3.command("convert").description("Convert a .kicad_mod footprint to a tscircuit component").argument("<file>", "Path to the .kicad_mod file").option("-o, --output <path>", "Output TSX file path").option("-n, --name <component>", "Component name for export").action(async (file, options) => {
|
|
196484
196781
|
try {
|
|
196485
|
-
const inputPath =
|
|
196486
|
-
const modContent = await
|
|
196782
|
+
const inputPath = path36.resolve(file);
|
|
196783
|
+
const modContent = await fs38.readFile(inputPath, "utf-8");
|
|
196487
196784
|
const circuitJson = await parseKicadModToCircuitJson(modContent);
|
|
196488
|
-
const componentName = options.name ??
|
|
196785
|
+
const componentName = options.name ?? path36.basename(inputPath, ".kicad_mod");
|
|
196489
196786
|
const tsx = convertCircuitJsonToTscircuit(circuitJson, {
|
|
196490
196787
|
componentName
|
|
196491
196788
|
});
|
|
196492
|
-
const outputPath = options.output ?
|
|
196493
|
-
await
|
|
196789
|
+
const outputPath = options.output ? path36.resolve(options.output) : path36.join(path36.dirname(inputPath), `${componentName}.tsx`);
|
|
196790
|
+
await fs38.writeFile(outputPath, tsx);
|
|
196494
196791
|
console.log(kleur_default.green(`Converted ${outputPath}`));
|
|
196495
196792
|
} catch (error) {
|
|
196496
196793
|
console.error(kleur_default.red("Failed to convert footprint:"), error instanceof Error ? error.message : error);
|