@tscircuit/cli 0.1.497 → 0.1.499
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 +883 -574
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -59656,14 +59656,14 @@ var require__stream_transform = __commonJS((exports2, module2) => {
|
|
|
59656
59656
|
util.inherits = require_inherits();
|
|
59657
59657
|
util.inherits(Transform, Duplex);
|
|
59658
59658
|
function afterTransform(er, data) {
|
|
59659
|
-
var
|
|
59660
|
-
|
|
59661
|
-
var cb =
|
|
59659
|
+
var ts4 = this._transformState;
|
|
59660
|
+
ts4.transforming = false;
|
|
59661
|
+
var cb = ts4.writecb;
|
|
59662
59662
|
if (!cb) {
|
|
59663
59663
|
return this.emit("error", new Error("write callback called multiple times"));
|
|
59664
59664
|
}
|
|
59665
|
-
|
|
59666
|
-
|
|
59665
|
+
ts4.writechunk = null;
|
|
59666
|
+
ts4.writecb = null;
|
|
59667
59667
|
if (data != null)
|
|
59668
59668
|
this.push(data);
|
|
59669
59669
|
cb(er);
|
|
@@ -59713,23 +59713,23 @@ var require__stream_transform = __commonJS((exports2, module2) => {
|
|
|
59713
59713
|
throw new Error("_transform() is not implemented");
|
|
59714
59714
|
};
|
|
59715
59715
|
Transform.prototype._write = function(chunk, encoding, cb) {
|
|
59716
|
-
var
|
|
59717
|
-
|
|
59718
|
-
|
|
59719
|
-
|
|
59720
|
-
if (!
|
|
59716
|
+
var ts4 = this._transformState;
|
|
59717
|
+
ts4.writecb = cb;
|
|
59718
|
+
ts4.writechunk = chunk;
|
|
59719
|
+
ts4.writeencoding = encoding;
|
|
59720
|
+
if (!ts4.transforming) {
|
|
59721
59721
|
var rs = this._readableState;
|
|
59722
|
-
if (
|
|
59722
|
+
if (ts4.needTransform || rs.needReadable || rs.length < rs.highWaterMark)
|
|
59723
59723
|
this._read(rs.highWaterMark);
|
|
59724
59724
|
}
|
|
59725
59725
|
};
|
|
59726
59726
|
Transform.prototype._read = function(n) {
|
|
59727
|
-
var
|
|
59728
|
-
if (
|
|
59729
|
-
|
|
59730
|
-
this._transform(
|
|
59727
|
+
var ts4 = this._transformState;
|
|
59728
|
+
if (ts4.writechunk !== null && ts4.writecb && !ts4.transforming) {
|
|
59729
|
+
ts4.transforming = true;
|
|
59730
|
+
this._transform(ts4.writechunk, ts4.writeencoding, ts4.afterTransform);
|
|
59731
59731
|
} else {
|
|
59732
|
-
|
|
59732
|
+
ts4.needTransform = true;
|
|
59733
59733
|
}
|
|
59734
59734
|
};
|
|
59735
59735
|
Transform.prototype._destroy = function(err, cb) {
|
|
@@ -60005,8 +60005,8 @@ var require_lib3 = __commonJS((exports2, module2) => {
|
|
|
60005
60005
|
return this;
|
|
60006
60006
|
}
|
|
60007
60007
|
var p = this.constructor;
|
|
60008
|
-
return this.then(
|
|
60009
|
-
function
|
|
60008
|
+
return this.then(resolve10, reject2);
|
|
60009
|
+
function resolve10(value) {
|
|
60010
60010
|
function yes() {
|
|
60011
60011
|
return value;
|
|
60012
60012
|
}
|
|
@@ -60159,8 +60159,8 @@ var require_lib3 = __commonJS((exports2, module2) => {
|
|
|
60159
60159
|
}
|
|
60160
60160
|
return out;
|
|
60161
60161
|
}
|
|
60162
|
-
Promise2.resolve =
|
|
60163
|
-
function
|
|
60162
|
+
Promise2.resolve = resolve9;
|
|
60163
|
+
function resolve9(value) {
|
|
60164
60164
|
if (value instanceof this) {
|
|
60165
60165
|
return value;
|
|
60166
60166
|
}
|
|
@@ -60586,8 +60586,8 @@ var require_utils6 = __commonJS((exports2) => {
|
|
|
60586
60586
|
var result = transform[inputType][outputType](input);
|
|
60587
60587
|
return result;
|
|
60588
60588
|
};
|
|
60589
|
-
exports2.resolve = function(
|
|
60590
|
-
var parts =
|
|
60589
|
+
exports2.resolve = function(path22) {
|
|
60590
|
+
var parts = path22.split("/");
|
|
60591
60591
|
var result = [];
|
|
60592
60592
|
for (var index = 0;index < parts.length; index++) {
|
|
60593
60593
|
var part = parts[index];
|
|
@@ -60659,10 +60659,10 @@ var require_utils6 = __commonJS((exports2) => {
|
|
|
60659
60659
|
var promise = external.Promise.resolve(inputData).then(function(data) {
|
|
60660
60660
|
var isBlob = support.blob && (data instanceof Blob || ["[object File]", "[object Blob]"].indexOf(Object.prototype.toString.call(data)) !== -1);
|
|
60661
60661
|
if (isBlob && typeof FileReader !== "undefined") {
|
|
60662
|
-
return new external.Promise(function(
|
|
60662
|
+
return new external.Promise(function(resolve9, reject) {
|
|
60663
60663
|
var reader = new FileReader;
|
|
60664
60664
|
reader.onload = function(e) {
|
|
60665
|
-
|
|
60665
|
+
resolve9(e.target.result);
|
|
60666
60666
|
};
|
|
60667
60667
|
reader.onerror = function(e) {
|
|
60668
60668
|
reject(e.target.error);
|
|
@@ -61126,7 +61126,7 @@ var require_StreamHelper = __commonJS((exports2, module2) => {
|
|
|
61126
61126
|
}
|
|
61127
61127
|
}
|
|
61128
61128
|
function accumulate(helper, updateCallback) {
|
|
61129
|
-
return new external.Promise(function(
|
|
61129
|
+
return new external.Promise(function(resolve9, reject) {
|
|
61130
61130
|
var dataArray = [];
|
|
61131
61131
|
var { _internalType: chunkType, _outputType: resultType, _mimeType: mimeType } = helper;
|
|
61132
61132
|
helper.on("data", function(data, meta) {
|
|
@@ -61140,7 +61140,7 @@ var require_StreamHelper = __commonJS((exports2, module2) => {
|
|
|
61140
61140
|
}).on("end", function() {
|
|
61141
61141
|
try {
|
|
61142
61142
|
var result = transformZipOutput(resultType, concat(chunkType, dataArray), mimeType);
|
|
61143
|
-
|
|
61143
|
+
resolve9(result);
|
|
61144
61144
|
} catch (e) {
|
|
61145
61145
|
reject(e);
|
|
61146
61146
|
}
|
|
@@ -66037,18 +66037,18 @@ var require_object = __commonJS((exports2, module2) => {
|
|
|
66037
66037
|
var object = new ZipObject(name, zipObjectContent, o);
|
|
66038
66038
|
this.files[name] = object;
|
|
66039
66039
|
};
|
|
66040
|
-
var parentFolder = function(
|
|
66041
|
-
if (
|
|
66042
|
-
|
|
66040
|
+
var parentFolder = function(path22) {
|
|
66041
|
+
if (path22.slice(-1) === "/") {
|
|
66042
|
+
path22 = path22.substring(0, path22.length - 1);
|
|
66043
66043
|
}
|
|
66044
|
-
var lastSlash =
|
|
66045
|
-
return lastSlash > 0 ?
|
|
66044
|
+
var lastSlash = path22.lastIndexOf("/");
|
|
66045
|
+
return lastSlash > 0 ? path22.substring(0, lastSlash) : "";
|
|
66046
66046
|
};
|
|
66047
|
-
var forceTrailingSlash = function(
|
|
66048
|
-
if (
|
|
66049
|
-
|
|
66047
|
+
var forceTrailingSlash = function(path22) {
|
|
66048
|
+
if (path22.slice(-1) !== "/") {
|
|
66049
|
+
path22 += "/";
|
|
66050
66050
|
}
|
|
66051
|
-
return
|
|
66051
|
+
return path22;
|
|
66052
66052
|
};
|
|
66053
66053
|
var folderAdd = function(name, createFolders) {
|
|
66054
66054
|
createFolders = typeof createFolders !== "undefined" ? createFolders : defaults.createFolders;
|
|
@@ -66716,7 +66716,7 @@ var require_load2 = __commonJS((exports2, module2) => {
|
|
|
66716
66716
|
var Crc32Probe = require_Crc32Probe();
|
|
66717
66717
|
var nodejsUtils = require_nodejsUtils();
|
|
66718
66718
|
function checkEntryCRC32(zipEntry) {
|
|
66719
|
-
return new external.Promise(function(
|
|
66719
|
+
return new external.Promise(function(resolve9, reject) {
|
|
66720
66720
|
var worker = zipEntry.decompressed.getContentWorker().pipe(new Crc32Probe);
|
|
66721
66721
|
worker.on("error", function(e) {
|
|
66722
66722
|
reject(e);
|
|
@@ -66724,7 +66724,7 @@ var require_load2 = __commonJS((exports2, module2) => {
|
|
|
66724
66724
|
if (worker.streamInfo.crc32 !== zipEntry.decompressed.crc32) {
|
|
66725
66725
|
reject(new Error("Corrupted zip : CRC32 mismatch"));
|
|
66726
66726
|
} else {
|
|
66727
|
-
|
|
66727
|
+
resolve9();
|
|
66728
66728
|
}
|
|
66729
66729
|
}).resume();
|
|
66730
66730
|
});
|
|
@@ -67088,7 +67088,7 @@ var require_dist7 = __commonJS((exports2, module2) => {
|
|
|
67088
67088
|
var __toESM3 = (mod, isNodeMode, target) => (target = mod != null ? __create3(__getProtoOf3(mod)) : {}, __copyProps2(isNodeMode || !mod || !mod.__esModule ? __defProp3(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
67089
67089
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
|
|
67090
67090
|
var __async = (__this, __arguments, generator) => {
|
|
67091
|
-
return new Promise((
|
|
67091
|
+
return new Promise((resolve11, reject) => {
|
|
67092
67092
|
var fulfilled = (value) => {
|
|
67093
67093
|
try {
|
|
67094
67094
|
step(generator.next(value));
|
|
@@ -67103,7 +67103,7 @@ var require_dist7 = __commonJS((exports2, module2) => {
|
|
|
67103
67103
|
reject(e);
|
|
67104
67104
|
}
|
|
67105
67105
|
};
|
|
67106
|
-
var step = (x) => x.done ?
|
|
67106
|
+
var step = (x) => x.done ? resolve11(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
67107
67107
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
67108
67108
|
});
|
|
67109
67109
|
};
|
|
@@ -67127,7 +67127,7 @@ var require_dist7 = __commonJS((exports2, module2) => {
|
|
|
67127
67127
|
});
|
|
67128
67128
|
};
|
|
67129
67129
|
traverse(program3, []);
|
|
67130
|
-
return allCommandPaths.filter((
|
|
67130
|
+
return allCommandPaths.filter((path25) => path25 !== "");
|
|
67131
67131
|
};
|
|
67132
67132
|
var normalizeCommandName = (s) => s.replace(/_/g, "-").toLowerCase();
|
|
67133
67133
|
var getCommandFromPath = (program3, commandPathAndPositionalArgs) => {
|
|
@@ -67135,7 +67135,7 @@ var require_dist7 = __commonJS((exports2, module2) => {
|
|
|
67135
67135
|
return commandPath.reduce((curr, nextCommandName) => !curr ? null : curr.commands.find((c) => normalizeCommandName(c.name()) === normalizeCommandName(nextCommandName)), program3);
|
|
67136
67136
|
};
|
|
67137
67137
|
var getCommandPathOnly = (program3, commandPathAndPositionalArgs) => {
|
|
67138
|
-
const allLeafCommandPaths = getAllLeafCommandPaths(program3).map((
|
|
67138
|
+
const allLeafCommandPaths = getAllLeafCommandPaths(program3).map((path25) => normalizeCommandName(path25));
|
|
67139
67139
|
const commandPath = [];
|
|
67140
67140
|
for (const elm of commandPathAndPositionalArgs) {
|
|
67141
67141
|
if (elm.startsWith("-"))
|
|
@@ -67422,7 +67422,7 @@ var require_dist8 = __commonJS((exports2, module2) => {
|
|
|
67422
67422
|
"node_modules/fs.realpath/old.js"(exports3) {
|
|
67423
67423
|
var pathModule = __require("path");
|
|
67424
67424
|
var isWindows2 = process.platform === "win32";
|
|
67425
|
-
var
|
|
67425
|
+
var fs25 = __require("fs");
|
|
67426
67426
|
var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG);
|
|
67427
67427
|
function rethrow() {
|
|
67428
67428
|
var callback;
|
|
@@ -67487,7 +67487,7 @@ var require_dist8 = __commonJS((exports2, module2) => {
|
|
|
67487
67487
|
base = m2[0];
|
|
67488
67488
|
previous = "";
|
|
67489
67489
|
if (isWindows2 && !knownHard[base]) {
|
|
67490
|
-
|
|
67490
|
+
fs25.lstatSync(base);
|
|
67491
67491
|
knownHard[base] = true;
|
|
67492
67492
|
}
|
|
67493
67493
|
}
|
|
@@ -67505,7 +67505,7 @@ var require_dist8 = __commonJS((exports2, module2) => {
|
|
|
67505
67505
|
if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
|
|
67506
67506
|
resolvedLink = cache[base];
|
|
67507
67507
|
} else {
|
|
67508
|
-
var stat4 =
|
|
67508
|
+
var stat4 = fs25.lstatSync(base);
|
|
67509
67509
|
if (!stat4.isSymbolicLink()) {
|
|
67510
67510
|
knownHard[base] = true;
|
|
67511
67511
|
if (cache)
|
|
@@ -67520,8 +67520,8 @@ var require_dist8 = __commonJS((exports2, module2) => {
|
|
|
67520
67520
|
}
|
|
67521
67521
|
}
|
|
67522
67522
|
if (linkTarget === null) {
|
|
67523
|
-
|
|
67524
|
-
linkTarget =
|
|
67523
|
+
fs25.statSync(base);
|
|
67524
|
+
linkTarget = fs25.readlinkSync(base);
|
|
67525
67525
|
}
|
|
67526
67526
|
resolvedLink = pathModule.resolve(previous, linkTarget);
|
|
67527
67527
|
if (cache)
|
|
@@ -67558,7 +67558,7 @@ var require_dist8 = __commonJS((exports2, module2) => {
|
|
|
67558
67558
|
base = m2[0];
|
|
67559
67559
|
previous = "";
|
|
67560
67560
|
if (isWindows2 && !knownHard[base]) {
|
|
67561
|
-
|
|
67561
|
+
fs25.lstat(base, function(err) {
|
|
67562
67562
|
if (err)
|
|
67563
67563
|
return cb(err);
|
|
67564
67564
|
knownHard[base] = true;
|
|
@@ -67586,7 +67586,7 @@ var require_dist8 = __commonJS((exports2, module2) => {
|
|
|
67586
67586
|
if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
|
|
67587
67587
|
return gotResolvedLink(cache[base]);
|
|
67588
67588
|
}
|
|
67589
|
-
return
|
|
67589
|
+
return fs25.lstat(base, gotStat);
|
|
67590
67590
|
}
|
|
67591
67591
|
function gotStat(err, stat4) {
|
|
67592
67592
|
if (err)
|
|
@@ -67603,10 +67603,10 @@ var require_dist8 = __commonJS((exports2, module2) => {
|
|
|
67603
67603
|
return gotTarget(null, seenLinks[id], base);
|
|
67604
67604
|
}
|
|
67605
67605
|
}
|
|
67606
|
-
|
|
67606
|
+
fs25.stat(base, function(err2) {
|
|
67607
67607
|
if (err2)
|
|
67608
67608
|
return cb(err2);
|
|
67609
|
-
|
|
67609
|
+
fs25.readlink(base, function(err3, target) {
|
|
67610
67610
|
if (!isWindows2)
|
|
67611
67611
|
seenLinks[id] = target;
|
|
67612
67612
|
gotTarget(err3, target);
|
|
@@ -67636,9 +67636,9 @@ var require_dist8 = __commonJS((exports2, module2) => {
|
|
|
67636
67636
|
realpath2.realpathSync = realpathSync;
|
|
67637
67637
|
realpath2.monkeypatch = monkeypatch;
|
|
67638
67638
|
realpath2.unmonkeypatch = unmonkeypatch;
|
|
67639
|
-
var
|
|
67640
|
-
var origRealpath =
|
|
67641
|
-
var origRealpathSync =
|
|
67639
|
+
var fs25 = __require("fs");
|
|
67640
|
+
var origRealpath = fs25.realpath;
|
|
67641
|
+
var origRealpathSync = fs25.realpathSync;
|
|
67642
67642
|
var version2 = process.version;
|
|
67643
67643
|
var ok = /^v[0-5]\./.test(version2);
|
|
67644
67644
|
var old = require_old();
|
|
@@ -67676,12 +67676,12 @@ var require_dist8 = __commonJS((exports2, module2) => {
|
|
|
67676
67676
|
}
|
|
67677
67677
|
}
|
|
67678
67678
|
function monkeypatch() {
|
|
67679
|
-
|
|
67680
|
-
|
|
67679
|
+
fs25.realpath = realpath2;
|
|
67680
|
+
fs25.realpathSync = realpathSync;
|
|
67681
67681
|
}
|
|
67682
67682
|
function unmonkeypatch() {
|
|
67683
|
-
|
|
67684
|
-
|
|
67683
|
+
fs25.realpath = origRealpath;
|
|
67684
|
+
fs25.realpathSync = origRealpathSync;
|
|
67685
67685
|
}
|
|
67686
67686
|
}
|
|
67687
67687
|
});
|
|
@@ -67907,8 +67907,8 @@ var require_dist8 = __commonJS((exports2, module2) => {
|
|
|
67907
67907
|
return new Minimatch(pattern, options).match(p);
|
|
67908
67908
|
};
|
|
67909
67909
|
module22.exports = minimatch;
|
|
67910
|
-
var
|
|
67911
|
-
minimatch.sep =
|
|
67910
|
+
var path25 = require_path2();
|
|
67911
|
+
minimatch.sep = path25.sep;
|
|
67912
67912
|
var GLOBSTAR = Symbol("globstar **");
|
|
67913
67913
|
minimatch.GLOBSTAR = GLOBSTAR;
|
|
67914
67914
|
var expand = require_brace_expansion();
|
|
@@ -68399,8 +68399,8 @@ globstar while`, file, fr, pattern, pr, swallowee);
|
|
|
68399
68399
|
if (f === "/" && partial)
|
|
68400
68400
|
return true;
|
|
68401
68401
|
const options = this.options;
|
|
68402
|
-
if (
|
|
68403
|
-
f = f.split(
|
|
68402
|
+
if (path25.sep !== "/") {
|
|
68403
|
+
f = f.split(path25.sep).join("/");
|
|
68404
68404
|
}
|
|
68405
68405
|
f = f.split(slashSplit);
|
|
68406
68406
|
this.debug(this.pattern, "split", f);
|
|
@@ -68490,8 +68490,8 @@ globstar while`, file, fr, pattern, pr, swallowee);
|
|
|
68490
68490
|
function ownProp(obj, field) {
|
|
68491
68491
|
return Object.prototype.hasOwnProperty.call(obj, field);
|
|
68492
68492
|
}
|
|
68493
|
-
var
|
|
68494
|
-
var
|
|
68493
|
+
var fs25 = __require("fs");
|
|
68494
|
+
var path25 = __require("path");
|
|
68495
68495
|
var minimatch = require_minimatch();
|
|
68496
68496
|
var isAbsolute3 = __require("path").isAbsolute;
|
|
68497
68497
|
var Minimatch = minimatch.Minimatch;
|
|
@@ -68545,7 +68545,7 @@ globstar while`, file, fr, pattern, pr, swallowee);
|
|
|
68545
68545
|
self2.stat = !!options.stat;
|
|
68546
68546
|
self2.noprocess = !!options.noprocess;
|
|
68547
68547
|
self2.absolute = !!options.absolute;
|
|
68548
|
-
self2.fs = options.fs ||
|
|
68548
|
+
self2.fs = options.fs || fs25;
|
|
68549
68549
|
self2.maxLength = options.maxLength || Infinity;
|
|
68550
68550
|
self2.cache = options.cache || /* @__PURE__ */ Object.create(null);
|
|
68551
68551
|
self2.statCache = options.statCache || /* @__PURE__ */ Object.create(null);
|
|
@@ -68554,13 +68554,13 @@ globstar while`, file, fr, pattern, pr, swallowee);
|
|
|
68554
68554
|
self2.changedCwd = false;
|
|
68555
68555
|
var cwd = process.cwd();
|
|
68556
68556
|
if (!ownProp(options, "cwd"))
|
|
68557
|
-
self2.cwd =
|
|
68557
|
+
self2.cwd = path25.resolve(cwd);
|
|
68558
68558
|
else {
|
|
68559
|
-
self2.cwd =
|
|
68559
|
+
self2.cwd = path25.resolve(options.cwd);
|
|
68560
68560
|
self2.changedCwd = self2.cwd !== cwd;
|
|
68561
68561
|
}
|
|
68562
|
-
self2.root = options.root ||
|
|
68563
|
-
self2.root =
|
|
68562
|
+
self2.root = options.root || path25.resolve(self2.cwd, "/");
|
|
68563
|
+
self2.root = path25.resolve(self2.root);
|
|
68564
68564
|
self2.cwdAbs = isAbsolute3(self2.cwd) ? self2.cwd : makeAbs(self2, self2.cwd);
|
|
68565
68565
|
self2.nomount = !!options.nomount;
|
|
68566
68566
|
if (process.platform === "win32") {
|
|
@@ -68643,13 +68643,13 @@ globstar while`, file, fr, pattern, pr, swallowee);
|
|
|
68643
68643
|
function makeAbs(self2, f) {
|
|
68644
68644
|
var abs = f;
|
|
68645
68645
|
if (f.charAt(0) === "/") {
|
|
68646
|
-
abs =
|
|
68646
|
+
abs = path25.join(self2.root, f);
|
|
68647
68647
|
} else if (isAbsolute3(f) || f === "") {
|
|
68648
68648
|
abs = f;
|
|
68649
68649
|
} else if (self2.changedCwd) {
|
|
68650
|
-
abs =
|
|
68650
|
+
abs = path25.resolve(self2.cwd, f);
|
|
68651
68651
|
} else {
|
|
68652
|
-
abs =
|
|
68652
|
+
abs = path25.resolve(f);
|
|
68653
68653
|
}
|
|
68654
68654
|
if (process.platform === "win32")
|
|
68655
68655
|
abs = abs.replace(/\\/g, "/");
|
|
@@ -68680,7 +68680,7 @@ globstar while`, file, fr, pattern, pr, swallowee);
|
|
|
68680
68680
|
var Minimatch = minimatch.Minimatch;
|
|
68681
68681
|
var Glob = require_glob().Glob;
|
|
68682
68682
|
var util = __require("util");
|
|
68683
|
-
var
|
|
68683
|
+
var path25 = __require("path");
|
|
68684
68684
|
var assert2 = __require("assert");
|
|
68685
68685
|
var isAbsolute3 = __require("path").isAbsolute;
|
|
68686
68686
|
var common = require_common4();
|
|
@@ -68810,7 +68810,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);
|
|
|
68810
68810
|
e = prefix + e;
|
|
68811
68811
|
}
|
|
68812
68812
|
if (e.charAt(0) === "/" && !this.nomount) {
|
|
68813
|
-
e =
|
|
68813
|
+
e = path25.join(this.root, e);
|
|
68814
68814
|
}
|
|
68815
68815
|
this._emitMatch(index, e);
|
|
68816
68816
|
}
|
|
@@ -68959,9 +68959,9 @@ See: https://github.com/isaacs/node-glob/issues/167`);
|
|
|
68959
68959
|
if (prefix && isAbsolute3(prefix) && !this.nomount) {
|
|
68960
68960
|
var trail = /[\/\\]$/.test(prefix);
|
|
68961
68961
|
if (prefix.charAt(0) === "/") {
|
|
68962
|
-
prefix =
|
|
68962
|
+
prefix = path25.join(this.root, prefix);
|
|
68963
68963
|
} else {
|
|
68964
|
-
prefix =
|
|
68964
|
+
prefix = path25.resolve(this.root, prefix);
|
|
68965
68965
|
if (trail)
|
|
68966
68966
|
prefix += "/";
|
|
68967
68967
|
}
|
|
@@ -69148,7 +69148,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);
|
|
|
69148
69148
|
var Minimatch = minimatch.Minimatch;
|
|
69149
69149
|
var inherits = require_inherits2();
|
|
69150
69150
|
var EE = __require("events").EventEmitter;
|
|
69151
|
-
var
|
|
69151
|
+
var path25 = __require("path");
|
|
69152
69152
|
var assert2 = __require("assert");
|
|
69153
69153
|
var isAbsolute3 = __require("path").isAbsolute;
|
|
69154
69154
|
var globSync = require_sync7();
|
|
@@ -69431,7 +69431,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);
|
|
|
69431
69431
|
e = prefix + e;
|
|
69432
69432
|
}
|
|
69433
69433
|
if (e.charAt(0) === "/" && !this.nomount) {
|
|
69434
|
-
e =
|
|
69434
|
+
e = path25.join(this.root, e);
|
|
69435
69435
|
}
|
|
69436
69436
|
this._emitMatch(index, e);
|
|
69437
69437
|
}
|
|
@@ -69618,9 +69618,9 @@ See: https://github.com/isaacs/node-glob/issues/167`);
|
|
|
69618
69618
|
if (prefix && isAbsolute3(prefix) && !this.nomount) {
|
|
69619
69619
|
var trail = /[\/\\]$/.test(prefix);
|
|
69620
69620
|
if (prefix.charAt(0) === "/") {
|
|
69621
|
-
prefix =
|
|
69621
|
+
prefix = path25.join(this.root, prefix);
|
|
69622
69622
|
} else {
|
|
69623
|
-
prefix =
|
|
69623
|
+
prefix = path25.resolve(this.root, prefix);
|
|
69624
69624
|
if (trail)
|
|
69625
69625
|
prefix += "/";
|
|
69626
69626
|
}
|
|
@@ -69697,8 +69697,8 @@ See: https://github.com/isaacs/node-glob/issues/167`);
|
|
|
69697
69697
|
"node_modules/glob-promise/lib/index.js"(exports3, module22) {
|
|
69698
69698
|
var glob2 = require_glob();
|
|
69699
69699
|
var promise = function(pattern, options) {
|
|
69700
|
-
return new Promise((
|
|
69701
|
-
glob2(pattern, options, (err, files) => err === null ?
|
|
69700
|
+
return new Promise((resolve11, reject) => {
|
|
69701
|
+
glob2(pattern, options, (err, files) => err === null ? resolve11(files) : reject(err));
|
|
69702
69702
|
});
|
|
69703
69703
|
};
|
|
69704
69704
|
module22.exports = promise;
|
|
@@ -69804,7 +69804,7 @@ export default {
|
|
|
69804
69804
|
}
|
|
69805
69805
|
case "export-pathlist": {
|
|
69806
69806
|
return `export default [
|
|
69807
|
-
` + Object.keys(vfs).map((
|
|
69807
|
+
` + Object.keys(vfs).map((path25) => ` "${path25}"`).join(`,
|
|
69808
69808
|
`) + `
|
|
69809
69809
|
]`;
|
|
69810
69810
|
}
|
|
@@ -72387,7 +72387,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
|
|
|
72387
72387
|
import { execSync as execSync2 } from "node:child_process";
|
|
72388
72388
|
var import_semver2 = __toESM2(require_semver2(), 1);
|
|
72389
72389
|
// package.json
|
|
72390
|
-
var version = "0.1.
|
|
72390
|
+
var version = "0.1.498";
|
|
72391
72391
|
var package_default = {
|
|
72392
72392
|
name: "@tscircuit/cli",
|
|
72393
72393
|
version,
|
|
@@ -72648,9 +72648,9 @@ export default () => (
|
|
|
72648
72648
|
};
|
|
72649
72649
|
|
|
72650
72650
|
// cli/dev/register.ts
|
|
72651
|
-
import * as
|
|
72651
|
+
import * as fs21 from "node:fs";
|
|
72652
72652
|
import * as net from "node:net";
|
|
72653
|
-
import * as
|
|
72653
|
+
import * as path21 from "node:path";
|
|
72654
72654
|
|
|
72655
72655
|
// lib/dependency-analysis/installNodeModuleTypesForSnippet.ts
|
|
72656
72656
|
import * as fs8 from "node:fs";
|
|
@@ -74370,8 +74370,8 @@ class EventsWatcher extends EventEmitter {
|
|
|
74370
74370
|
}
|
|
74371
74371
|
|
|
74372
74372
|
// cli/dev/DevServer.ts
|
|
74373
|
-
import
|
|
74374
|
-
import
|
|
74373
|
+
import path19 from "node:path";
|
|
74374
|
+
import fs19 from "node:fs";
|
|
74375
74375
|
|
|
74376
74376
|
// node_modules/chokidar/esm/index.js
|
|
74377
74377
|
import { stat as statcb } from "fs";
|
|
@@ -77094,6 +77094,265 @@ async function addPackage(componentPath, projectDir = process.cwd()) {
|
|
|
77094
77094
|
|
|
77095
77095
|
// cli/dev/DevServer.ts
|
|
77096
77096
|
import Debug2 from "debug";
|
|
77097
|
+
|
|
77098
|
+
// lib/dependency-analysis/getNodeModuleDependencies.ts
|
|
77099
|
+
import * as ts3 from "typescript";
|
|
77100
|
+
import * as path18 from "path";
|
|
77101
|
+
import * as fs18 from "fs";
|
|
77102
|
+
function getLocalPackages(projectDir) {
|
|
77103
|
+
const packageJsonPath = path18.join(projectDir, "package.json");
|
|
77104
|
+
const localPackages = new Set;
|
|
77105
|
+
if (!fs18.existsSync(packageJsonPath)) {
|
|
77106
|
+
return localPackages;
|
|
77107
|
+
}
|
|
77108
|
+
try {
|
|
77109
|
+
const packageJson = JSON.parse(fs18.readFileSync(packageJsonPath, "utf-8"));
|
|
77110
|
+
const allDeps = {
|
|
77111
|
+
...packageJson.dependencies,
|
|
77112
|
+
...packageJson.devDependencies,
|
|
77113
|
+
...packageJson.peerDependencies
|
|
77114
|
+
};
|
|
77115
|
+
for (const [packageName, version2] of Object.entries(allDeps)) {
|
|
77116
|
+
if (typeof version2 !== "string")
|
|
77117
|
+
continue;
|
|
77118
|
+
const isLocalPackage = version2.startsWith("file:") || version2.startsWith("link:") || version2.includes(".yalc");
|
|
77119
|
+
if (isLocalPackage) {
|
|
77120
|
+
localPackages.add(packageName);
|
|
77121
|
+
}
|
|
77122
|
+
}
|
|
77123
|
+
} catch (error) {
|
|
77124
|
+
console.warn("Failed to parse package.json for local packages:", error);
|
|
77125
|
+
}
|
|
77126
|
+
return localPackages;
|
|
77127
|
+
}
|
|
77128
|
+
function getNodeModuleImports(filePath) {
|
|
77129
|
+
const absolutePath = path18.resolve(filePath);
|
|
77130
|
+
if (!fs18.existsSync(absolutePath)) {
|
|
77131
|
+
return [];
|
|
77132
|
+
}
|
|
77133
|
+
const content = fs18.readFileSync(absolutePath, "utf-8");
|
|
77134
|
+
const sourceFile = ts3.createSourceFile(absolutePath, content, ts3.ScriptTarget.Latest, true);
|
|
77135
|
+
const imports = new Set;
|
|
77136
|
+
function visit(node) {
|
|
77137
|
+
if (ts3.isImportDeclaration(node) || ts3.isExportDeclaration(node)) {
|
|
77138
|
+
const moduleSpecifier = node.moduleSpecifier;
|
|
77139
|
+
if (moduleSpecifier && ts3.isStringLiteral(moduleSpecifier)) {
|
|
77140
|
+
const importPath = moduleSpecifier.text;
|
|
77141
|
+
if (!importPath.startsWith(".") && !importPath.startsWith("/")) {
|
|
77142
|
+
imports.add(importPath);
|
|
77143
|
+
}
|
|
77144
|
+
}
|
|
77145
|
+
}
|
|
77146
|
+
if (ts3.isCallExpression(node) && node.expression.kind === ts3.SyntaxKind.ImportKeyword) {
|
|
77147
|
+
const argument = node.arguments[0];
|
|
77148
|
+
if (argument && ts3.isStringLiteral(argument)) {
|
|
77149
|
+
const importPath = argument.text;
|
|
77150
|
+
if (!importPath.startsWith(".") && !importPath.startsWith("/")) {
|
|
77151
|
+
imports.add(importPath);
|
|
77152
|
+
}
|
|
77153
|
+
}
|
|
77154
|
+
}
|
|
77155
|
+
if (ts3.isCallExpression(node) && ts3.isIdentifier(node.expression) && node.expression.text === "require") {
|
|
77156
|
+
const argument = node.arguments[0];
|
|
77157
|
+
if (argument && ts3.isStringLiteral(argument)) {
|
|
77158
|
+
const importPath = argument.text;
|
|
77159
|
+
if (!importPath.startsWith(".") && !importPath.startsWith("/")) {
|
|
77160
|
+
imports.add(importPath);
|
|
77161
|
+
}
|
|
77162
|
+
}
|
|
77163
|
+
}
|
|
77164
|
+
ts3.forEachChild(node, visit);
|
|
77165
|
+
}
|
|
77166
|
+
visit(sourceFile);
|
|
77167
|
+
return Array.from(imports);
|
|
77168
|
+
}
|
|
77169
|
+
function getPackageNameFromImport(importPath) {
|
|
77170
|
+
if (importPath.startsWith("@")) {
|
|
77171
|
+
const parts = importPath.split("/");
|
|
77172
|
+
return `${parts[0]}/${parts[1]}`;
|
|
77173
|
+
}
|
|
77174
|
+
return importPath.split("/")[0];
|
|
77175
|
+
}
|
|
77176
|
+
function resolveNodeModuleImport(importPath, projectDir) {
|
|
77177
|
+
const packageName = getPackageNameFromImport(importPath);
|
|
77178
|
+
const packageDir = path18.join(projectDir, "node_modules", packageName);
|
|
77179
|
+
if (!fs18.existsSync(packageDir)) {
|
|
77180
|
+
return [];
|
|
77181
|
+
}
|
|
77182
|
+
const packageJsonPath = path18.join(packageDir, "package.json");
|
|
77183
|
+
if (!fs18.existsSync(packageJsonPath)) {
|
|
77184
|
+
return [];
|
|
77185
|
+
}
|
|
77186
|
+
const packageJson = JSON.parse(fs18.readFileSync(packageJsonPath, "utf-8"));
|
|
77187
|
+
const resolvedFiles = [];
|
|
77188
|
+
if (importPath !== packageName) {
|
|
77189
|
+
const subpath = importPath.slice(packageName.length + 1);
|
|
77190
|
+
const possiblePaths = [
|
|
77191
|
+
path18.join(packageDir, subpath),
|
|
77192
|
+
path18.join(packageDir, `${subpath}.js`),
|
|
77193
|
+
path18.join(packageDir, `${subpath}.mjs`),
|
|
77194
|
+
path18.join(packageDir, `${subpath}.ts`),
|
|
77195
|
+
path18.join(packageDir, `${subpath}.tsx`),
|
|
77196
|
+
path18.join(packageDir, subpath, "index.js"),
|
|
77197
|
+
path18.join(packageDir, subpath, "index.mjs"),
|
|
77198
|
+
path18.join(packageDir, subpath, "index.ts"),
|
|
77199
|
+
path18.join(packageDir, subpath, "index.tsx")
|
|
77200
|
+
];
|
|
77201
|
+
for (const p of possiblePaths) {
|
|
77202
|
+
if (fs18.existsSync(p) && fs18.statSync(p).isFile()) {
|
|
77203
|
+
resolvedFiles.push(p);
|
|
77204
|
+
break;
|
|
77205
|
+
}
|
|
77206
|
+
}
|
|
77207
|
+
}
|
|
77208
|
+
const entryPoints = [
|
|
77209
|
+
packageJson.main,
|
|
77210
|
+
packageJson.module,
|
|
77211
|
+
packageJson.exports?.["."]?.default,
|
|
77212
|
+
packageJson.exports?.["."]?.import,
|
|
77213
|
+
packageJson.exports?.["."]?.require
|
|
77214
|
+
].filter(Boolean);
|
|
77215
|
+
for (const entry of entryPoints) {
|
|
77216
|
+
const entryPath = path18.join(packageDir, entry);
|
|
77217
|
+
if (fs18.existsSync(entryPath) && fs18.statSync(entryPath).isFile()) {
|
|
77218
|
+
resolvedFiles.push(entryPath);
|
|
77219
|
+
}
|
|
77220
|
+
}
|
|
77221
|
+
return resolvedFiles;
|
|
77222
|
+
}
|
|
77223
|
+
function collectAllNodeModuleDependencies(entryFilePath, projectDir, maxDepth = 10) {
|
|
77224
|
+
const visited = new Set;
|
|
77225
|
+
const nodeModuleFiles = new Map;
|
|
77226
|
+
function processFile(filePath, depth) {
|
|
77227
|
+
if (depth > maxDepth || visited.has(filePath)) {
|
|
77228
|
+
return;
|
|
77229
|
+
}
|
|
77230
|
+
visited.add(filePath);
|
|
77231
|
+
const imports = getNodeModuleImports(filePath);
|
|
77232
|
+
for (const importPath of imports) {
|
|
77233
|
+
if (!nodeModuleFiles.has(importPath)) {
|
|
77234
|
+
const resolvedFiles = resolveNodeModuleImport(importPath, projectDir);
|
|
77235
|
+
if (resolvedFiles.length > 0) {
|
|
77236
|
+
nodeModuleFiles.set(importPath, resolvedFiles);
|
|
77237
|
+
for (const resolvedFile of resolvedFiles) {
|
|
77238
|
+
processFile(resolvedFile, depth + 1);
|
|
77239
|
+
}
|
|
77240
|
+
}
|
|
77241
|
+
}
|
|
77242
|
+
}
|
|
77243
|
+
const localDeps = getLocalDependencies(filePath);
|
|
77244
|
+
for (const localDep of localDeps) {
|
|
77245
|
+
processFile(localDep, depth);
|
|
77246
|
+
}
|
|
77247
|
+
}
|
|
77248
|
+
function getLocalDependencies(filePath) {
|
|
77249
|
+
const absolutePath = path18.resolve(filePath);
|
|
77250
|
+
const baseDir = path18.dirname(absolutePath);
|
|
77251
|
+
if (!fs18.existsSync(absolutePath)) {
|
|
77252
|
+
return [];
|
|
77253
|
+
}
|
|
77254
|
+
const content = fs18.readFileSync(absolutePath, "utf-8");
|
|
77255
|
+
const sourceFile = ts3.createSourceFile(absolutePath, content, ts3.ScriptTarget.Latest, true);
|
|
77256
|
+
const dependencies2 = [];
|
|
77257
|
+
function visit(node) {
|
|
77258
|
+
if (ts3.isImportDeclaration(node) || ts3.isExportDeclaration(node)) {
|
|
77259
|
+
const moduleSpecifier = node.moduleSpecifier;
|
|
77260
|
+
if (moduleSpecifier && ts3.isStringLiteral(moduleSpecifier)) {
|
|
77261
|
+
const importPath = moduleSpecifier.text;
|
|
77262
|
+
if (importPath.startsWith(".")) {
|
|
77263
|
+
const resolved = resolveLocalImport(importPath, baseDir);
|
|
77264
|
+
if (resolved)
|
|
77265
|
+
dependencies2.push(resolved);
|
|
77266
|
+
}
|
|
77267
|
+
}
|
|
77268
|
+
}
|
|
77269
|
+
ts3.forEachChild(node, visit);
|
|
77270
|
+
}
|
|
77271
|
+
visit(sourceFile);
|
|
77272
|
+
return dependencies2;
|
|
77273
|
+
}
|
|
77274
|
+
function resolveLocalImport(importPath, baseDir) {
|
|
77275
|
+
const extensions = [".tsx", ".ts", ".jsx", ".js", ".mjs"];
|
|
77276
|
+
const resolvedPath = path18.resolve(baseDir, importPath);
|
|
77277
|
+
if (fs18.existsSync(resolvedPath) && fs18.statSync(resolvedPath).isFile()) {
|
|
77278
|
+
return resolvedPath;
|
|
77279
|
+
}
|
|
77280
|
+
for (const ext of extensions) {
|
|
77281
|
+
const pathWithExt = resolvedPath + ext;
|
|
77282
|
+
if (fs18.existsSync(pathWithExt)) {
|
|
77283
|
+
return pathWithExt;
|
|
77284
|
+
}
|
|
77285
|
+
}
|
|
77286
|
+
if (fs18.existsSync(resolvedPath) && fs18.statSync(resolvedPath).isDirectory()) {
|
|
77287
|
+
for (const ext of extensions) {
|
|
77288
|
+
const indexPath = path18.join(resolvedPath, `index${ext}`);
|
|
77289
|
+
if (fs18.existsSync(indexPath)) {
|
|
77290
|
+
return indexPath;
|
|
77291
|
+
}
|
|
77292
|
+
}
|
|
77293
|
+
}
|
|
77294
|
+
return null;
|
|
77295
|
+
}
|
|
77296
|
+
processFile(entryFilePath, 0);
|
|
77297
|
+
return nodeModuleFiles;
|
|
77298
|
+
}
|
|
77299
|
+
var EXCLUDED_PACKAGE_DIRECTORIES = new Set([
|
|
77300
|
+
"node_modules",
|
|
77301
|
+
".git",
|
|
77302
|
+
".next",
|
|
77303
|
+
"dist",
|
|
77304
|
+
"build",
|
|
77305
|
+
".turbo",
|
|
77306
|
+
"coverage",
|
|
77307
|
+
".cache",
|
|
77308
|
+
"tmp",
|
|
77309
|
+
"temp"
|
|
77310
|
+
]);
|
|
77311
|
+
function collectLocalPackageFiles(packageDir) {
|
|
77312
|
+
const files = [];
|
|
77313
|
+
function walkDirectory(dir) {
|
|
77314
|
+
if (!fs18.existsSync(dir))
|
|
77315
|
+
return;
|
|
77316
|
+
const entries = fs18.readdirSync(dir, { withFileTypes: true });
|
|
77317
|
+
for (const entry of entries) {
|
|
77318
|
+
const fullPath = path18.join(dir, entry.name);
|
|
77319
|
+
if (entry.isDirectory()) {
|
|
77320
|
+
if (EXCLUDED_PACKAGE_DIRECTORIES.has(entry.name)) {
|
|
77321
|
+
continue;
|
|
77322
|
+
}
|
|
77323
|
+
walkDirectory(fullPath);
|
|
77324
|
+
} else if (entry.isFile()) {
|
|
77325
|
+
files.push(fullPath);
|
|
77326
|
+
}
|
|
77327
|
+
}
|
|
77328
|
+
}
|
|
77329
|
+
walkDirectory(packageDir);
|
|
77330
|
+
return files;
|
|
77331
|
+
}
|
|
77332
|
+
function getAllNodeModuleFilePaths(entryFilePath, projectDir) {
|
|
77333
|
+
const localPackages = getLocalPackages(projectDir);
|
|
77334
|
+
if (localPackages.size === 0) {
|
|
77335
|
+
return [];
|
|
77336
|
+
}
|
|
77337
|
+
const dependencies2 = collectAllNodeModuleDependencies(entryFilePath, projectDir);
|
|
77338
|
+
const processedPackages = new Set;
|
|
77339
|
+
const allFiles = new Set;
|
|
77340
|
+
for (const [importPath] of dependencies2.entries()) {
|
|
77341
|
+
const packageName = getPackageNameFromImport(importPath);
|
|
77342
|
+
if (!localPackages.has(packageName) || processedPackages.has(packageName)) {
|
|
77343
|
+
continue;
|
|
77344
|
+
}
|
|
77345
|
+
processedPackages.add(packageName);
|
|
77346
|
+
const packageDir = path18.join(projectDir, "node_modules", packageName);
|
|
77347
|
+
if (fs18.existsSync(packageDir)) {
|
|
77348
|
+
const packageFiles = collectLocalPackageFiles(packageDir);
|
|
77349
|
+
packageFiles.forEach((file) => allFiles.add(file));
|
|
77350
|
+
}
|
|
77351
|
+
}
|
|
77352
|
+
return Array.from(allFiles);
|
|
77353
|
+
}
|
|
77354
|
+
|
|
77355
|
+
// cli/dev/DevServer.ts
|
|
77097
77356
|
var debug2 = Debug2("tscircuit:devserver");
|
|
77098
77357
|
var BINARY_FILE_EXTENSIONS = new Set([".glb", ".png", ".jpeg", ".jpg"]);
|
|
77099
77358
|
|
|
@@ -77107,6 +77366,7 @@ class DevServer {
|
|
|
77107
77366
|
fsKy;
|
|
77108
77367
|
filesystemWatcher;
|
|
77109
77368
|
typesHandler;
|
|
77369
|
+
uploadedNodeModules = new Set;
|
|
77110
77370
|
constructor({
|
|
77111
77371
|
port,
|
|
77112
77372
|
componentFilePath,
|
|
@@ -77114,7 +77374,7 @@ class DevServer {
|
|
|
77114
77374
|
}) {
|
|
77115
77375
|
this.port = port;
|
|
77116
77376
|
this.componentFilePath = componentFilePath;
|
|
77117
|
-
this.projectDir = projectDir ??
|
|
77377
|
+
this.projectDir = projectDir ?? path19.dirname(componentFilePath);
|
|
77118
77378
|
const projectConfig = loadProjectConfig(this.projectDir);
|
|
77119
77379
|
this.ignoredFiles = projectConfig?.ignoredFiles ?? [];
|
|
77120
77380
|
this.fsKy = distribution_default.create({
|
|
@@ -77125,7 +77385,7 @@ class DevServer {
|
|
|
77125
77385
|
async start() {
|
|
77126
77386
|
const { server } = await createHttpServer({
|
|
77127
77387
|
port: this.port,
|
|
77128
|
-
defaultMainComponentPath:
|
|
77388
|
+
defaultMainComponentPath: path19.relative(this.projectDir, this.componentFilePath)
|
|
77129
77389
|
});
|
|
77130
77390
|
this.httpServer = server;
|
|
77131
77391
|
this.eventsWatcher = new EventsWatcher(`http://localhost:${this.port}`);
|
|
@@ -77137,7 +77397,7 @@ class DevServer {
|
|
|
77137
77397
|
this.filesystemWatcher = watch(this.projectDir, {
|
|
77138
77398
|
persistent: true,
|
|
77139
77399
|
ignoreInitial: true,
|
|
77140
|
-
ignored: (p) => shouldIgnorePath(
|
|
77400
|
+
ignored: (p) => shouldIgnorePath(path19.relative(this.projectDir, p), this.ignoredFiles)
|
|
77141
77401
|
});
|
|
77142
77402
|
this.filesystemWatcher.on("change", (filePath) => this.handleFileChangedOnFilesystem(filePath));
|
|
77143
77403
|
this.filesystemWatcher.on("add", (filePath) => this.handleFileChangedOnFilesystem(filePath));
|
|
@@ -77153,27 +77413,27 @@ class DevServer {
|
|
|
77153
77413
|
const { file } = await this.fsKy.get("api/files/get", {
|
|
77154
77414
|
searchParams: { file_path: ev.file_path }
|
|
77155
77415
|
}).json();
|
|
77156
|
-
const fullPath =
|
|
77157
|
-
const dirPath =
|
|
77158
|
-
if (!
|
|
77159
|
-
|
|
77416
|
+
const fullPath = path19.join(this.projectDir, ev.file_path);
|
|
77417
|
+
const dirPath = path19.dirname(fullPath);
|
|
77418
|
+
if (!fs19.existsSync(dirPath)) {
|
|
77419
|
+
fs19.mkdirSync(dirPath, { recursive: true });
|
|
77160
77420
|
}
|
|
77161
77421
|
if (file.binary_content_b64) {
|
|
77162
77422
|
const decodedContent = Buffer.from(file.binary_content_b64, "base64");
|
|
77163
|
-
|
|
77423
|
+
fs19.writeFileSync(fullPath, decodedContent);
|
|
77164
77424
|
} else {
|
|
77165
|
-
|
|
77425
|
+
fs19.writeFileSync(fullPath, file.text_content ?? "", "utf-8");
|
|
77166
77426
|
}
|
|
77167
77427
|
}
|
|
77168
77428
|
async handleFileDeletedEventFromServer(ev) {
|
|
77169
|
-
const fullPath =
|
|
77170
|
-
if (
|
|
77429
|
+
const fullPath = path19.join(this.projectDir, ev.file_path);
|
|
77430
|
+
if (fs19.existsSync(fullPath)) {
|
|
77171
77431
|
debug2(`Deleting file ${ev.file_path} from filesystem`);
|
|
77172
|
-
|
|
77432
|
+
fs19.unlinkSync(fullPath);
|
|
77173
77433
|
}
|
|
77174
77434
|
}
|
|
77175
77435
|
async handleFileChangedOnFilesystem(absoluteFilePath) {
|
|
77176
|
-
const relativeFilePath =
|
|
77436
|
+
const relativeFilePath = path19.relative(this.projectDir, absoluteFilePath);
|
|
77177
77437
|
if (relativeFilePath.includes("manual-edits.json"))
|
|
77178
77438
|
return;
|
|
77179
77439
|
if (shouldIgnorePath(relativeFilePath, this.ignoredFiles))
|
|
@@ -77188,9 +77448,30 @@ class DevServer {
|
|
|
77188
77448
|
...filePayload
|
|
77189
77449
|
}
|
|
77190
77450
|
}).json();
|
|
77451
|
+
await this.checkAndUploadNewNodeModules(absoluteFilePath);
|
|
77452
|
+
}
|
|
77453
|
+
async checkAndUploadNewNodeModules(filePath) {
|
|
77454
|
+
const ext = path19.extname(filePath).toLowerCase();
|
|
77455
|
+
const isSourceFile = [".ts", ".tsx", ".js", ".jsx", ".mjs"].includes(ext);
|
|
77456
|
+
if (!isSourceFile)
|
|
77457
|
+
return;
|
|
77458
|
+
try {
|
|
77459
|
+
const nodeModuleFiles = getAllNodeModuleFilePaths(filePath, this.projectDir);
|
|
77460
|
+
const newFiles = nodeModuleFiles.filter((file) => {
|
|
77461
|
+
const relativePath = path19.relative(this.projectDir, file);
|
|
77462
|
+
return !this.uploadedNodeModules.has(relativePath);
|
|
77463
|
+
});
|
|
77464
|
+
if (newFiles.length === 0)
|
|
77465
|
+
return;
|
|
77466
|
+
console.log(kleur_default.blue(`Uploading ${newFiles.length} new node_modules files...`));
|
|
77467
|
+
await this.uploadNodeModuleFiles(newFiles);
|
|
77468
|
+
console.log(kleur_default.green("New node modules uploaded"));
|
|
77469
|
+
} catch (error) {
|
|
77470
|
+
debug2("Error checking for new node modules:", error);
|
|
77471
|
+
}
|
|
77191
77472
|
}
|
|
77192
77473
|
async handleFileRemovedFromFilesystem(absoluteFilePath) {
|
|
77193
|
-
const relativeFilePath =
|
|
77474
|
+
const relativeFilePath = path19.relative(this.projectDir, absoluteFilePath);
|
|
77194
77475
|
if (shouldIgnorePath(relativeFilePath, this.ignoredFiles))
|
|
77195
77476
|
return;
|
|
77196
77477
|
if (!relativeFilePath || relativeFilePath.trim() === "") {
|
|
@@ -77228,8 +77509,8 @@ class DevServer {
|
|
|
77228
77509
|
debug2(`Successfully deleted file ${relativeFilePath} from server`);
|
|
77229
77510
|
}
|
|
77230
77511
|
async handleFileRename(oldPath, newPath) {
|
|
77231
|
-
const oldRelativePath =
|
|
77232
|
-
const newRelativePath =
|
|
77512
|
+
const oldRelativePath = path19.relative(this.projectDir, oldPath);
|
|
77513
|
+
const newRelativePath = path19.relative(this.projectDir, newPath);
|
|
77233
77514
|
if (shouldIgnorePath(oldRelativePath, this.ignoredFiles) || shouldIgnorePath(newRelativePath, this.ignoredFiles))
|
|
77234
77515
|
return;
|
|
77235
77516
|
await this.handleFileRemovedFromFilesystem(oldPath);
|
|
@@ -77249,7 +77530,7 @@ class DevServer {
|
|
|
77249
77530
|
});
|
|
77250
77531
|
const filePaths = getPackageFilePaths(this.projectDir, this.ignoredFiles);
|
|
77251
77532
|
for (const filePath of filePaths) {
|
|
77252
|
-
const relativeFilePath =
|
|
77533
|
+
const relativeFilePath = path19.relative(this.projectDir, filePath);
|
|
77253
77534
|
const filePayload = this.createFileUploadPayload(filePath, relativeFilePath);
|
|
77254
77535
|
await this.fsKy.post("api/files/upsert", {
|
|
77255
77536
|
json: {
|
|
@@ -77259,6 +77540,7 @@ class DevServer {
|
|
|
77259
77540
|
}
|
|
77260
77541
|
});
|
|
77261
77542
|
}
|
|
77543
|
+
await this.uploadInitialNodeModules();
|
|
77262
77544
|
await this.fsKy.post("api/events/create", {
|
|
77263
77545
|
json: {
|
|
77264
77546
|
event_type: "INITIAL_FILES_UPLOADED",
|
|
@@ -77267,6 +77549,33 @@ class DevServer {
|
|
|
77267
77549
|
throwHttpErrors: false
|
|
77268
77550
|
});
|
|
77269
77551
|
}
|
|
77552
|
+
async uploadInitialNodeModules() {
|
|
77553
|
+
try {
|
|
77554
|
+
console.log(kleur_default.blue("Analyzing node_modules dependencies..."));
|
|
77555
|
+
const nodeModuleFiles = getAllNodeModuleFilePaths(this.componentFilePath, this.projectDir);
|
|
77556
|
+
console.log(kleur_default.blue(`Found ${nodeModuleFiles.length} node_modules files to upload`));
|
|
77557
|
+
if (nodeModuleFiles.length > 0) {
|
|
77558
|
+
await this.uploadNodeModuleFiles(nodeModuleFiles);
|
|
77559
|
+
}
|
|
77560
|
+
console.log(kleur_default.green("Node modules uploaded successfully"));
|
|
77561
|
+
} catch (error) {
|
|
77562
|
+
console.warn(kleur_default.yellow("Warning: Failed to upload some node_modules files:"), error);
|
|
77563
|
+
}
|
|
77564
|
+
}
|
|
77565
|
+
async uploadNodeModuleFiles(files) {
|
|
77566
|
+
for (const nodeModuleFile of files) {
|
|
77567
|
+
const relativeFilePath = path19.relative(this.projectDir, nodeModuleFile);
|
|
77568
|
+
this.uploadedNodeModules.add(relativeFilePath);
|
|
77569
|
+
const filePayload = this.createFileUploadPayload(nodeModuleFile, relativeFilePath);
|
|
77570
|
+
await this.fsKy.post("api/files/upsert", {
|
|
77571
|
+
json: {
|
|
77572
|
+
file_path: relativeFilePath,
|
|
77573
|
+
initiator: "filesystem_change",
|
|
77574
|
+
...filePayload
|
|
77575
|
+
}
|
|
77576
|
+
});
|
|
77577
|
+
}
|
|
77578
|
+
}
|
|
77270
77579
|
async saveSnippet() {
|
|
77271
77580
|
const postEvent = async (event, message) => this.fsKy.post("api/events/create", {
|
|
77272
77581
|
json: { event_type: event, ...message ? { message } : {} },
|
|
@@ -77290,12 +77599,12 @@ class DevServer {
|
|
|
77290
77599
|
await this.filesystemWatcher?.close();
|
|
77291
77600
|
}
|
|
77292
77601
|
createFileUploadPayload(absoluteFilePath, relativeFilePath) {
|
|
77293
|
-
const ext =
|
|
77602
|
+
const ext = path19.extname(relativeFilePath).toLowerCase();
|
|
77294
77603
|
if (BINARY_FILE_EXTENSIONS.has(ext)) {
|
|
77295
|
-
const fileBuffer =
|
|
77604
|
+
const fileBuffer = fs19.readFileSync(absoluteFilePath);
|
|
77296
77605
|
return { binary_content_b64: fileBuffer.toString("base64") };
|
|
77297
77606
|
}
|
|
77298
|
-
return { text_content:
|
|
77607
|
+
return { text_content: fs19.readFileSync(absoluteFilePath, "utf-8") };
|
|
77299
77608
|
}
|
|
77300
77609
|
async handleInstallPackage(full_package_name) {
|
|
77301
77610
|
const postEvent = async (event, message) => {
|
|
@@ -77323,11 +77632,11 @@ var getVersion = () => {
|
|
|
77323
77632
|
};
|
|
77324
77633
|
|
|
77325
77634
|
// lib/shared/find-board-files.ts
|
|
77326
|
-
import
|
|
77327
|
-
import
|
|
77635
|
+
import fs20 from "node:fs";
|
|
77636
|
+
import path20 from "node:path";
|
|
77328
77637
|
var isSubPath = (maybeChild, maybeParent) => {
|
|
77329
|
-
const relative5 =
|
|
77330
|
-
return relative5 === "" || !relative5.startsWith("..") && !
|
|
77638
|
+
const relative5 = path20.relative(maybeParent, maybeChild);
|
|
77639
|
+
return relative5 === "" || !relative5.startsWith("..") && !path20.isAbsolute(relative5);
|
|
77331
77640
|
};
|
|
77332
77641
|
var isGlobPattern = (str) => {
|
|
77333
77642
|
return /[*?[\]{}]/.test(str);
|
|
@@ -77337,13 +77646,13 @@ var findBoardFiles = ({
|
|
|
77337
77646
|
ignore = DEFAULT_IGNORED_PATTERNS,
|
|
77338
77647
|
filePaths = []
|
|
77339
77648
|
} = {}) => {
|
|
77340
|
-
const resolvedProjectDir =
|
|
77649
|
+
const resolvedProjectDir = path20.resolve(projectDir);
|
|
77341
77650
|
const boardFilePatterns = getBoardFilePatterns(resolvedProjectDir);
|
|
77342
77651
|
const relativeBoardFiles = globbySync(boardFilePatterns, {
|
|
77343
77652
|
cwd: resolvedProjectDir,
|
|
77344
77653
|
ignore
|
|
77345
77654
|
});
|
|
77346
|
-
const absoluteBoardFiles = relativeBoardFiles.map((f) =>
|
|
77655
|
+
const absoluteBoardFiles = relativeBoardFiles.map((f) => path20.join(resolvedProjectDir, f));
|
|
77347
77656
|
const boardFileSet = new Set;
|
|
77348
77657
|
if (filePaths.length > 0) {
|
|
77349
77658
|
for (const inputPath of filePaths) {
|
|
@@ -77357,13 +77666,13 @@ var findBoardFiles = ({
|
|
|
77357
77666
|
boardFileSet.add(match);
|
|
77358
77667
|
}
|
|
77359
77668
|
} else {
|
|
77360
|
-
const targetPath =
|
|
77361
|
-
if (!
|
|
77669
|
+
const targetPath = path20.resolve(resolvedProjectDir, inputPath);
|
|
77670
|
+
if (!fs20.existsSync(targetPath)) {
|
|
77362
77671
|
continue;
|
|
77363
77672
|
}
|
|
77364
|
-
const stat4 =
|
|
77673
|
+
const stat4 = fs20.statSync(targetPath);
|
|
77365
77674
|
if (stat4.isDirectory()) {
|
|
77366
|
-
const resolvedDir =
|
|
77675
|
+
const resolvedDir = path20.resolve(targetPath);
|
|
77367
77676
|
if (isSubPath(resolvedDir, resolvedProjectDir)) {
|
|
77368
77677
|
for (const boardFile of absoluteBoardFiles) {
|
|
77369
77678
|
if (isSubPath(boardFile, resolvedDir)) {
|
|
@@ -77374,7 +77683,7 @@ var findBoardFiles = ({
|
|
|
77374
77683
|
const externalMatches = globbySync(boardFilePatterns, {
|
|
77375
77684
|
cwd: resolvedDir,
|
|
77376
77685
|
ignore
|
|
77377
|
-
}).map((f) =>
|
|
77686
|
+
}).map((f) => path20.join(resolvedDir, f));
|
|
77378
77687
|
for (const match of externalMatches) {
|
|
77379
77688
|
boardFileSet.add(match);
|
|
77380
77689
|
}
|
|
@@ -77394,7 +77703,7 @@ var findBoardFiles = ({
|
|
|
77394
77703
|
|
|
77395
77704
|
// cli/dev/register.ts
|
|
77396
77705
|
var findSelectableTsxFiles = (projectDir) => {
|
|
77397
|
-
const boardFiles = findBoardFiles({ projectDir }).filter((file) =>
|
|
77706
|
+
const boardFiles = findBoardFiles({ projectDir }).filter((file) => fs21.existsSync(file)).sort();
|
|
77398
77707
|
if (boardFiles.length > 0) {
|
|
77399
77708
|
return boardFiles;
|
|
77400
77709
|
}
|
|
@@ -77402,18 +77711,18 @@ var findSelectableTsxFiles = (projectDir) => {
|
|
|
77402
77711
|
cwd: projectDir,
|
|
77403
77712
|
ignore: DEFAULT_IGNORED_PATTERNS
|
|
77404
77713
|
});
|
|
77405
|
-
return files.map((file) =>
|
|
77714
|
+
return files.map((file) => path21.resolve(projectDir, file)).filter((file) => fs21.existsSync(file)).sort();
|
|
77406
77715
|
};
|
|
77407
77716
|
var registerDev = (program3) => {
|
|
77408
77717
|
program3.command("dev").description("Start development server for a package").argument("[file]", "Path to the package file").option("-p, --port <number>", "Port to run server on", "3020").action(async (file, options) => {
|
|
77409
77718
|
let port = parseInt(options.port);
|
|
77410
77719
|
const startTime = Date.now();
|
|
77411
77720
|
const isPortAvailable = (port2) => {
|
|
77412
|
-
return new Promise((
|
|
77721
|
+
return new Promise((resolve9) => {
|
|
77413
77722
|
const server2 = net.createServer();
|
|
77414
|
-
server2.once("error", () =>
|
|
77723
|
+
server2.once("error", () => resolve9(false));
|
|
77415
77724
|
server2.once("listening", () => {
|
|
77416
|
-
server2.close(() =>
|
|
77725
|
+
server2.close(() => resolve9(true));
|
|
77417
77726
|
});
|
|
77418
77727
|
server2.listen(port2);
|
|
77419
77728
|
});
|
|
@@ -77424,7 +77733,7 @@ var registerDev = (program3) => {
|
|
|
77424
77733
|
}
|
|
77425
77734
|
let absolutePath;
|
|
77426
77735
|
if (file) {
|
|
77427
|
-
absolutePath =
|
|
77736
|
+
absolutePath = path21.resolve(file);
|
|
77428
77737
|
if (!absolutePath.endsWith(".tsx") && !absolutePath.endsWith(".ts")) {
|
|
77429
77738
|
console.error("Error: Only .tsx files are supported");
|
|
77430
77739
|
return;
|
|
@@ -77433,7 +77742,7 @@ var registerDev = (program3) => {
|
|
|
77433
77742
|
const entrypointPath = await getEntrypoint({
|
|
77434
77743
|
onError: () => {}
|
|
77435
77744
|
});
|
|
77436
|
-
if (entrypointPath &&
|
|
77745
|
+
if (entrypointPath && fs21.existsSync(entrypointPath)) {
|
|
77437
77746
|
absolutePath = entrypointPath;
|
|
77438
77747
|
console.log("Found entrypoint at:", entrypointPath);
|
|
77439
77748
|
} else {
|
|
@@ -77443,7 +77752,7 @@ var registerDev = (program3) => {
|
|
|
77443
77752
|
return;
|
|
77444
77753
|
}
|
|
77445
77754
|
absolutePath = availableFiles[0];
|
|
77446
|
-
console.log("Selected file:",
|
|
77755
|
+
console.log("Selected file:", path21.relative(process.cwd(), absolutePath));
|
|
77447
77756
|
}
|
|
77448
77757
|
}
|
|
77449
77758
|
try {
|
|
@@ -77464,7 +77773,7 @@ var registerDev = (program3) => {
|
|
|
77464
77773
|
|
|
77465
77774
|
${kleur_default.green(`@tscircuit/cli@${getVersion()}`)} ${kleur_default.gray("ready in")} ${kleur_default.white(`${Math.round(timeToStart)}ms`)}`);
|
|
77466
77775
|
console.log(`
|
|
77467
|
-
${kleur_default.bold("➜ Local:")} ${kleur_default.underline(kleur_default.cyan(`http://localhost:${port}`))}${server.componentFilePath ? kleur_default.underline(kleur_default.cyan(`/#file=${encodeURIComponent(
|
|
77776
|
+
${kleur_default.bold("➜ Local:")} ${kleur_default.underline(kleur_default.cyan(`http://localhost:${port}`))}${server.componentFilePath ? kleur_default.underline(kleur_default.cyan(`/#file=${encodeURIComponent(path21.relative(process.cwd(), server.componentFilePath).replaceAll("\\", "/"))}`)) : ""}
|
|
77468
77777
|
|
|
77469
77778
|
`);
|
|
77470
77779
|
console.log(kleur_default.gray(`Watching ${kleur_default.underline(server.projectDir.split("/").slice(-2).join("/"))} for changes...`));
|
|
@@ -77496,10 +77805,10 @@ function createDelay({ clearTimeout: defaultClear, setTimeout: defaultSet } = {}
|
|
|
77496
77805
|
signal.removeEventListener("abort", signalListener);
|
|
77497
77806
|
}
|
|
77498
77807
|
};
|
|
77499
|
-
const delayPromise = new Promise((
|
|
77808
|
+
const delayPromise = new Promise((resolve9, reject) => {
|
|
77500
77809
|
settle = () => {
|
|
77501
77810
|
cleanup();
|
|
77502
|
-
|
|
77811
|
+
resolve9(value);
|
|
77503
77812
|
};
|
|
77504
77813
|
rejectFunction = reject;
|
|
77505
77814
|
timeoutId = (defaultSet ?? setTimeout)(settle, milliseconds);
|
|
@@ -77599,25 +77908,25 @@ var registerConfigPrint = (program3) => {
|
|
|
77599
77908
|
};
|
|
77600
77909
|
|
|
77601
77910
|
// cli/clone/register.ts
|
|
77602
|
-
import * as
|
|
77603
|
-
import * as
|
|
77911
|
+
import * as fs24 from "node:fs";
|
|
77912
|
+
import * as path24 from "node:path";
|
|
77604
77913
|
|
|
77605
77914
|
// cli/clone/clone-bug-report.ts
|
|
77606
77915
|
var import_jszip = __toESM2(require_lib4(), 1);
|
|
77607
|
-
import * as
|
|
77608
|
-
import * as
|
|
77916
|
+
import * as fs23 from "node:fs";
|
|
77917
|
+
import * as path23 from "node:path";
|
|
77609
77918
|
|
|
77610
77919
|
// cli/clone/handle-existing-directory.ts
|
|
77611
77920
|
var import_prompts6 = __toESM2(require_prompts3(), 1);
|
|
77612
|
-
import * as
|
|
77613
|
-
import * as
|
|
77921
|
+
import * as fs22 from "node:fs";
|
|
77922
|
+
import * as path22 from "node:path";
|
|
77614
77923
|
var handleExistingDirectory = async (dirPath) => {
|
|
77615
|
-
if (!
|
|
77924
|
+
if (!fs22.existsSync(dirPath))
|
|
77616
77925
|
return;
|
|
77617
77926
|
const response = await import_prompts6.default({
|
|
77618
77927
|
type: "select",
|
|
77619
77928
|
name: "action",
|
|
77620
|
-
message: `Directory "${
|
|
77929
|
+
message: `Directory "${path22.basename(dirPath)}" already exists. What would you like to do?`,
|
|
77621
77930
|
choices: [
|
|
77622
77931
|
{ title: "Merge files into existing directory", value: "merge" },
|
|
77623
77932
|
{
|
|
@@ -77632,7 +77941,7 @@ var handleExistingDirectory = async (dirPath) => {
|
|
|
77632
77941
|
process.exit(0);
|
|
77633
77942
|
}
|
|
77634
77943
|
if (response.action === "delete") {
|
|
77635
|
-
|
|
77944
|
+
fs22.rmSync(dirPath, { recursive: true, force: true });
|
|
77636
77945
|
console.log(`Deleted existing directory: ${dirPath}`);
|
|
77637
77946
|
} else if (response.action === "merge") {
|
|
77638
77947
|
console.log(`Merging files into existing directory: ${dirPath}`);
|
|
@@ -77658,12 +77967,12 @@ var getCommonDirectoryPrefix = (paths) => {
|
|
|
77658
77967
|
return commonSegments.join("/");
|
|
77659
77968
|
};
|
|
77660
77969
|
var sanitizeRelativePath = (relativePath) => {
|
|
77661
|
-
const normalizedPath =
|
|
77970
|
+
const normalizedPath = path23.normalize(relativePath);
|
|
77662
77971
|
if (!normalizedPath)
|
|
77663
77972
|
return null;
|
|
77664
|
-
if (
|
|
77973
|
+
if (path23.isAbsolute(normalizedPath))
|
|
77665
77974
|
return null;
|
|
77666
|
-
const segments = normalizedPath.split(
|
|
77975
|
+
const segments = normalizedPath.split(path23.sep);
|
|
77667
77976
|
if (segments.some((segment) => segment === ".." || segment === "")) {
|
|
77668
77977
|
return null;
|
|
77669
77978
|
}
|
|
@@ -77678,7 +77987,7 @@ var cloneBugReport = async ({
|
|
|
77678
77987
|
console.error("Bug report ID must not be empty.");
|
|
77679
77988
|
process.exit(1);
|
|
77680
77989
|
}
|
|
77681
|
-
const dirPath =
|
|
77990
|
+
const dirPath = path23.resolve(`bug-report-${trimmedBugReportId}`);
|
|
77682
77991
|
await handleExistingDirectory(dirPath);
|
|
77683
77992
|
const ky2 = getRegistryApiKy();
|
|
77684
77993
|
let zipBuffer;
|
|
@@ -77696,7 +78005,7 @@ var cloneBugReport = async ({
|
|
|
77696
78005
|
}
|
|
77697
78006
|
process.exit(1);
|
|
77698
78007
|
}
|
|
77699
|
-
|
|
78008
|
+
fs23.mkdirSync(dirPath, { recursive: true });
|
|
77700
78009
|
const zip = await import_jszip.default.loadAsync(zipBuffer);
|
|
77701
78010
|
const fileEntries = Object.entries(zip.files).filter(([, entry]) => !entry.dir);
|
|
77702
78011
|
const commonPrefix = getCommonDirectoryPrefix(fileEntries.map(([fileName]) => fileName));
|
|
@@ -77708,15 +78017,15 @@ var cloneBugReport = async ({
|
|
|
77708
78017
|
console.warn(`Skipping potentially unsafe path: ${fileName}`);
|
|
77709
78018
|
continue;
|
|
77710
78019
|
}
|
|
77711
|
-
const fullPath =
|
|
77712
|
-
|
|
78020
|
+
const fullPath = path23.join(dirPath, sanitizedRelativePath);
|
|
78021
|
+
fs23.mkdirSync(path23.dirname(fullPath), { recursive: true });
|
|
77713
78022
|
const fileContent = await entry.async("nodebuffer");
|
|
77714
|
-
|
|
78023
|
+
fs23.writeFileSync(fullPath, fileContent);
|
|
77715
78024
|
}
|
|
77716
|
-
|
|
78025
|
+
fs23.writeFileSync(path23.join(dirPath, ".npmrc"), "@tsci:registry=https://npm.tscircuit.com");
|
|
77717
78026
|
generateTsConfig(dirPath);
|
|
77718
78027
|
await setupTsciProject(dirPath);
|
|
77719
|
-
const relativeDirPath =
|
|
78028
|
+
const relativeDirPath = path23.relative(originalCwd, dirPath);
|
|
77720
78029
|
console.log(kleur_default.green(`
|
|
77721
78030
|
Successfully cloned bug report to:`));
|
|
77722
78031
|
console.log(` ${dirPath}/
|
|
@@ -77755,7 +78064,7 @@ var registerClone = (program3) => {
|
|
|
77755
78064
|
const [, author, packageName] = match;
|
|
77756
78065
|
console.log(`Cloning ${author}/${packageName}...`);
|
|
77757
78066
|
const userSettingToIncludeAuthor = options.includeAuthor || cliConfig.get("alwaysCloneWithAuthorName");
|
|
77758
|
-
const dirPath = userSettingToIncludeAuthor ?
|
|
78067
|
+
const dirPath = userSettingToIncludeAuthor ? path24.resolve(`${author}.${packageName}`) : path24.resolve(packageName);
|
|
77759
78068
|
await handleExistingDirectory(dirPath);
|
|
77760
78069
|
const ky2 = getRegistryApiKy();
|
|
77761
78070
|
let packageFileList = {
|
|
@@ -77776,13 +78085,13 @@ var registerClone = (program3) => {
|
|
|
77776
78085
|
console.error("Failed to fetch package files:", error instanceof Error ? error.message : error);
|
|
77777
78086
|
process.exit(1);
|
|
77778
78087
|
}
|
|
77779
|
-
|
|
78088
|
+
fs24.mkdirSync(dirPath, { recursive: true });
|
|
77780
78089
|
for (const fileInfo of packageFileList.package_files) {
|
|
77781
78090
|
const filePath = fileInfo.file_path.replace(/^\/|dist\//g, "");
|
|
77782
78091
|
if (!filePath)
|
|
77783
78092
|
continue;
|
|
77784
|
-
const fullPath =
|
|
77785
|
-
|
|
78093
|
+
const fullPath = path24.join(dirPath, filePath);
|
|
78094
|
+
fs24.mkdirSync(path24.dirname(fullPath), { recursive: true });
|
|
77786
78095
|
try {
|
|
77787
78096
|
const fileContent = await ky2.get("package_files/get", {
|
|
77788
78097
|
searchParams: {
|
|
@@ -77791,15 +78100,15 @@ var registerClone = (program3) => {
|
|
|
77791
78100
|
file_path: fileInfo.file_path
|
|
77792
78101
|
}
|
|
77793
78102
|
}).json();
|
|
77794
|
-
|
|
78103
|
+
fs24.writeFileSync(fullPath, fileContent.package_file.content_text);
|
|
77795
78104
|
} catch (error) {
|
|
77796
78105
|
console.warn(`Skipping ${filePath} due to error:`, error instanceof Error ? error.message : error);
|
|
77797
78106
|
}
|
|
77798
78107
|
}
|
|
77799
|
-
|
|
78108
|
+
fs24.writeFileSync(path24.join(dirPath, ".npmrc"), "@tsci:registry=https://npm.tscircuit.com");
|
|
77800
78109
|
generateTsConfig(dirPath);
|
|
77801
78110
|
await setupTsciProject(dirPath);
|
|
77802
|
-
const relativeDirPath =
|
|
78111
|
+
const relativeDirPath = path24.relative(originalCwd, dirPath);
|
|
77803
78112
|
console.log(kleur_default.green(`
|
|
77804
78113
|
Successfully cloned to:`));
|
|
77805
78114
|
console.log(` ${dirPath}/
|
|
@@ -77815,8 +78124,8 @@ Successfully cloned to:`));
|
|
|
77815
78124
|
var import_perfect_cli = __toESM2(require_dist7(), 1);
|
|
77816
78125
|
|
|
77817
78126
|
// lib/shared/export-snippet.ts
|
|
77818
|
-
import
|
|
77819
|
-
import
|
|
78127
|
+
import fs26 from "node:fs";
|
|
78128
|
+
import path26 from "node:path";
|
|
77820
78129
|
import { promisify as promisify3 } from "node:util";
|
|
77821
78130
|
|
|
77822
78131
|
// node_modules/circuit-json-to-readable-netlist/dist/index.js
|
|
@@ -78995,9 +79304,9 @@ var stringifyDsnJson = (dsnJson) => {
|
|
|
78995
79304
|
const stringifyCoordinates = (coordinates) => {
|
|
78996
79305
|
return coordinates.join(" ");
|
|
78997
79306
|
};
|
|
78998
|
-
const stringifyPath = (
|
|
79307
|
+
const stringifyPath = (path25, level) => {
|
|
78999
79308
|
const padding = indent.repeat(level);
|
|
79000
|
-
return `${padding}(path ${
|
|
79309
|
+
return `${padding}(path ${path25.layer} ${path25.width} ${stringifyCoordinates(path25.coordinates)})`;
|
|
79001
79310
|
};
|
|
79002
79311
|
result += `(pcb ${dsnJson.filename ? dsnJson.filename : "./converted_dsn.dsn"}
|
|
79003
79312
|
`;
|
|
@@ -82177,8 +82486,8 @@ var SymbolInstancesProject = class _SymbolInstancesProject extends SxClass {
|
|
|
82177
82486
|
}
|
|
82178
82487
|
getString() {
|
|
82179
82488
|
const lines = [`(project ${quoteSExprString(this.name)}`];
|
|
82180
|
-
for (const
|
|
82181
|
-
lines.push(
|
|
82489
|
+
for (const path25 of this.paths) {
|
|
82490
|
+
lines.push(path25.getStringIndented());
|
|
82182
82491
|
}
|
|
82183
82492
|
lines.push(")");
|
|
82184
82493
|
return lines.join(`
|
|
@@ -82200,11 +82509,11 @@ var SymbolInstancePath = class _SymbolInstancePath extends SxClass {
|
|
|
82200
82509
|
static fromSexprPrimitives(primitiveSexprs) {
|
|
82201
82510
|
const [pathPrimitive, ...rest] = primitiveSexprs;
|
|
82202
82511
|
const value = toStringValue(pathPrimitive) ?? "";
|
|
82203
|
-
const
|
|
82512
|
+
const path25 = new _SymbolInstancePath(value);
|
|
82204
82513
|
const { propertyMap } = SxClass.parsePrimitivesToClassProperties(rest, this.token);
|
|
82205
|
-
|
|
82206
|
-
|
|
82207
|
-
return
|
|
82514
|
+
path25._sxReference = propertyMap.reference;
|
|
82515
|
+
path25._sxUnit = propertyMap.unit;
|
|
82516
|
+
return path25;
|
|
82208
82517
|
}
|
|
82209
82518
|
get reference() {
|
|
82210
82519
|
return this._sxReference?.value;
|
|
@@ -83251,8 +83560,8 @@ var SheetInstancesRootPath = class _SheetInstancesRootPath extends SxClass {
|
|
|
83251
83560
|
if (value === undefined) {
|
|
83252
83561
|
throw new Error("sheet_instances path requires a string identifier");
|
|
83253
83562
|
}
|
|
83254
|
-
const
|
|
83255
|
-
|
|
83563
|
+
const path25 = new _SheetInstancesRootPath;
|
|
83564
|
+
path25._value = value;
|
|
83256
83565
|
const { propertyMap, arrayPropertyMap } = SxClass.parsePrimitivesToClassProperties(rest, "sheet_instances_path");
|
|
83257
83566
|
const unsupportedSingularTokens = Object.keys(propertyMap).filter((token) => !SUPPORTED_ARRAY_TOKENS2.has(token));
|
|
83258
83567
|
if (unsupportedSingularTokens.length > 0) {
|
|
@@ -83266,8 +83575,8 @@ var SheetInstancesRootPath = class _SheetInstancesRootPath extends SxClass {
|
|
|
83266
83575
|
if (!pages.length && propertyMap.page) {
|
|
83267
83576
|
pages.push(propertyMap.page);
|
|
83268
83577
|
}
|
|
83269
|
-
|
|
83270
|
-
return
|
|
83578
|
+
path25._pages = pages;
|
|
83579
|
+
return path25;
|
|
83271
83580
|
}
|
|
83272
83581
|
get value() {
|
|
83273
83582
|
return this._value;
|
|
@@ -83415,8 +83724,8 @@ var SheetInstancesProject = class _SheetInstancesProject extends SxClass {
|
|
|
83415
83724
|
}
|
|
83416
83725
|
getString() {
|
|
83417
83726
|
const lines = [`(project ${quoteSExprString(this.name)}`];
|
|
83418
|
-
for (const
|
|
83419
|
-
lines.push(
|
|
83727
|
+
for (const path25 of this.paths) {
|
|
83728
|
+
lines.push(path25.getStringIndented());
|
|
83420
83729
|
}
|
|
83421
83730
|
lines.push(")");
|
|
83422
83731
|
return lines.join(`
|
|
@@ -83440,10 +83749,10 @@ var SheetInstancePath = class _SheetInstancePath extends SxClass {
|
|
|
83440
83749
|
if (value === undefined) {
|
|
83441
83750
|
throw new Error("sheet instance path value must be a string");
|
|
83442
83751
|
}
|
|
83443
|
-
const
|
|
83752
|
+
const path25 = new _SheetInstancePath(value);
|
|
83444
83753
|
const { arrayPropertyMap } = SxClass.parsePrimitivesToClassProperties(rest, "sheet_path");
|
|
83445
|
-
|
|
83446
|
-
return
|
|
83754
|
+
path25.pages = arrayPropertyMap.page ?? [];
|
|
83755
|
+
return path25;
|
|
83447
83756
|
}
|
|
83448
83757
|
getChildren() {
|
|
83449
83758
|
return [...this.pages];
|
|
@@ -88681,20 +88990,20 @@ var FootprintModel = class _FootprintModel extends SxClass {
|
|
|
88681
88990
|
_offset;
|
|
88682
88991
|
_scale;
|
|
88683
88992
|
_rotate;
|
|
88684
|
-
constructor(
|
|
88993
|
+
constructor(path25) {
|
|
88685
88994
|
super();
|
|
88686
|
-
this._path =
|
|
88995
|
+
this._path = path25;
|
|
88687
88996
|
}
|
|
88688
88997
|
static fromSexprPrimitives(primitiveSexprs) {
|
|
88689
88998
|
if (primitiveSexprs.length === 0) {
|
|
88690
88999
|
throw new Error("model requires a path argument");
|
|
88691
89000
|
}
|
|
88692
89001
|
const [rawPath, ...rest] = primitiveSexprs;
|
|
88693
|
-
const
|
|
88694
|
-
if (
|
|
89002
|
+
const path25 = toStringValue(rawPath);
|
|
89003
|
+
if (path25 === undefined) {
|
|
88695
89004
|
throw new Error("model path must be a string value");
|
|
88696
89005
|
}
|
|
88697
|
-
const model = new _FootprintModel(
|
|
89006
|
+
const model = new _FootprintModel(path25);
|
|
88698
89007
|
for (const primitive of rest) {
|
|
88699
89008
|
if (!Array.isArray(primitive) || primitive.length === 0) {
|
|
88700
89009
|
throw new Error(`model encountered invalid child expression: ${JSON.stringify(primitive)}`);
|
|
@@ -93382,10 +93691,10 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
|
|
|
93382
93691
|
}
|
|
93383
93692
|
const instances = new SymbolInstances;
|
|
93384
93693
|
const project = new SymbolInstancesProject("");
|
|
93385
|
-
const
|
|
93386
|
-
|
|
93387
|
-
|
|
93388
|
-
project.paths.push(
|
|
93694
|
+
const path25 = new SymbolInstancePath(`/${kicadSch?.uuid?.value || ""}`);
|
|
93695
|
+
path25.reference = reference;
|
|
93696
|
+
path25.unit = 1;
|
|
93697
|
+
project.paths.push(path25);
|
|
93389
93698
|
instances.projects.push(project);
|
|
93390
93699
|
symbol._sxInstances = instances;
|
|
93391
93700
|
symbols3.push(symbol);
|
|
@@ -93593,11 +93902,11 @@ var AddSheetInstancesStage = class extends ConverterStage {
|
|
|
93593
93902
|
throw new Error("KicadSch instance not initialized in context");
|
|
93594
93903
|
}
|
|
93595
93904
|
const sheetInstances = new SheetInstances;
|
|
93596
|
-
const
|
|
93597
|
-
|
|
93905
|
+
const path25 = new SheetInstancesRootPath;
|
|
93906
|
+
path25.value = "/";
|
|
93598
93907
|
const page = new SheetInstancesRootPage("1");
|
|
93599
|
-
|
|
93600
|
-
sheetInstances.paths = [
|
|
93908
|
+
path25.pages = [page];
|
|
93909
|
+
sheetInstances.paths = [path25];
|
|
93601
93910
|
kicadSch.sheetInstances = sheetInstances;
|
|
93602
93911
|
kicadSch.embeddedFonts = new EmbeddedFonts(false);
|
|
93603
93912
|
this.finished = true;
|
|
@@ -93952,12 +94261,12 @@ var AddGraphicsStage = class extends ConverterStage {
|
|
|
93952
94261
|
throw new Error("PCB transformation matrix not initialized in context");
|
|
93953
94262
|
}
|
|
93954
94263
|
const pcbSilkscreenPaths = this.ctx.db.pcb_silkscreen_path?.list() || [];
|
|
93955
|
-
for (const
|
|
93956
|
-
if (!
|
|
94264
|
+
for (const path25 of pcbSilkscreenPaths) {
|
|
94265
|
+
if (!path25.route || path25.route.length < 2)
|
|
93957
94266
|
continue;
|
|
93958
|
-
for (let i = 0;i <
|
|
93959
|
-
const startPoint =
|
|
93960
|
-
const endPoint =
|
|
94267
|
+
for (let i = 0;i < path25.route.length - 1; i++) {
|
|
94268
|
+
const startPoint = path25.route[i];
|
|
94269
|
+
const endPoint = path25.route[i + 1];
|
|
93961
94270
|
if (!startPoint || !endPoint)
|
|
93962
94271
|
continue;
|
|
93963
94272
|
const transformedStart = applyToPoint62(c2kMatPcb, {
|
|
@@ -93972,12 +94281,12 @@ var AddGraphicsStage = class extends ConverterStage {
|
|
|
93972
94281
|
top: "F.SilkS",
|
|
93973
94282
|
bottom: "B.SilkS"
|
|
93974
94283
|
};
|
|
93975
|
-
const kicadLayer = layerMap[
|
|
94284
|
+
const kicadLayer = layerMap[path25.layer] || path25.layer || "F.SilkS";
|
|
93976
94285
|
const grLine = new GrLine({
|
|
93977
94286
|
start: { x: transformedStart.x, y: transformedStart.y },
|
|
93978
94287
|
end: { x: transformedEnd.x, y: transformedEnd.y },
|
|
93979
94288
|
layer: kicadLayer,
|
|
93980
|
-
width:
|
|
94289
|
+
width: path25.stroke_width || 0.15
|
|
93981
94290
|
});
|
|
93982
94291
|
const graphicLines = kicadPcb.graphicLines;
|
|
93983
94292
|
graphicLines.push(grLine);
|
|
@@ -94085,8 +94394,8 @@ var import_jszip2 = __toESM2(require_lib4(), 1);
|
|
|
94085
94394
|
|
|
94086
94395
|
// lib/shared/generate-circuit-json.tsx
|
|
94087
94396
|
var import_make_vfs2 = __toESM2(require_dist8(), 1);
|
|
94088
|
-
import
|
|
94089
|
-
import
|
|
94397
|
+
import path25 from "node:path";
|
|
94398
|
+
import fs25 from "node:fs";
|
|
94090
94399
|
import { pathToFileURL } from "node:url";
|
|
94091
94400
|
import Debug11 from "debug";
|
|
94092
94401
|
|
|
@@ -94105,10 +94414,10 @@ var abbreviateStringifyObject = (obj) => {
|
|
|
94105
94414
|
};
|
|
94106
94415
|
|
|
94107
94416
|
// lib/shared/importFromUserLand.ts
|
|
94108
|
-
import { resolve as
|
|
94417
|
+
import { resolve as resolve11 } from "node:path";
|
|
94109
94418
|
async function importFromUserLand(moduleName) {
|
|
94110
94419
|
try {
|
|
94111
|
-
const resolvedPath = import.meta.resolve(moduleName,
|
|
94420
|
+
const resolvedPath = import.meta.resolve(moduleName, resolve11(process.cwd(), "dummy.js"));
|
|
94112
94421
|
return await import(resolvedPath);
|
|
94113
94422
|
} catch (error) {
|
|
94114
94423
|
try {
|
|
@@ -94148,12 +94457,12 @@ async function generateCircuitJson({
|
|
|
94148
94457
|
const runner = new userLandTscircuit.RootCircuit({
|
|
94149
94458
|
platform: platformConfig
|
|
94150
94459
|
});
|
|
94151
|
-
const absoluteFilePath =
|
|
94152
|
-
const projectDir =
|
|
94460
|
+
const absoluteFilePath = path25.isAbsolute(filePath) ? filePath : path25.resolve(process.cwd(), filePath);
|
|
94461
|
+
const projectDir = path25.dirname(absoluteFilePath);
|
|
94153
94462
|
const resolvedOutputDir = outputDir ?? projectDir;
|
|
94154
|
-
const relativeComponentPath =
|
|
94155
|
-
const baseFileName = outputFileName ||
|
|
94156
|
-
const outputPath =
|
|
94463
|
+
const relativeComponentPath = path25.relative(projectDir, absoluteFilePath);
|
|
94464
|
+
const baseFileName = outputFileName || path25.basename(absoluteFilePath).replace(/\.[^.]+$/, "");
|
|
94465
|
+
const outputPath = path25.join(resolvedOutputDir, `${baseFileName}.circuit.json`);
|
|
94157
94466
|
debug11(`Project directory: ${projectDir}`);
|
|
94158
94467
|
debug11(`Relative component path: ${relativeComponentPath}`);
|
|
94159
94468
|
debug11(`Output path: ${outputPath}`);
|
|
@@ -94170,7 +94479,7 @@ async function generateCircuitJson({
|
|
|
94170
94479
|
return false;
|
|
94171
94480
|
if (normalizedFilePath.match(/^\.[^/]/))
|
|
94172
94481
|
return false;
|
|
94173
|
-
if (!ALLOWED_FILE_EXTENSIONS.includes(
|
|
94482
|
+
if (!ALLOWED_FILE_EXTENSIONS.includes(path25.extname(normalizedFilePath)))
|
|
94174
94483
|
return false;
|
|
94175
94484
|
return true;
|
|
94176
94485
|
},
|
|
@@ -94188,7 +94497,7 @@ async function generateCircuitJson({
|
|
|
94188
94497
|
const circuitJson = await runner.getCircuitJson();
|
|
94189
94498
|
if (saveToFile) {
|
|
94190
94499
|
debug11(`Saving circuit JSON to ${outputPath}`);
|
|
94191
|
-
|
|
94500
|
+
fs25.writeFileSync(outputPath, JSON.stringify(circuitJson, null, 2));
|
|
94192
94501
|
}
|
|
94193
94502
|
return {
|
|
94194
94503
|
circuitJson,
|
|
@@ -94197,8 +94506,8 @@ async function generateCircuitJson({
|
|
|
94197
94506
|
}
|
|
94198
94507
|
|
|
94199
94508
|
// lib/shared/export-snippet.ts
|
|
94200
|
-
var writeFileAsync = promisify3(
|
|
94201
|
-
var
|
|
94509
|
+
var writeFileAsync = promisify3(fs26.writeFile);
|
|
94510
|
+
var ALLOWED_EXPORT_FORMATS = [
|
|
94202
94511
|
"json",
|
|
94203
94512
|
"circuit-json",
|
|
94204
94513
|
"schematic-svg",
|
|
@@ -94236,14 +94545,14 @@ var exportSnippet = async ({
|
|
|
94236
94545
|
onError = (message) => console.error(message),
|
|
94237
94546
|
onSuccess = (result) => console.log(result)
|
|
94238
94547
|
}) => {
|
|
94239
|
-
if (!
|
|
94548
|
+
if (!ALLOWED_EXPORT_FORMATS.includes(format)) {
|
|
94240
94549
|
onError(`Invalid format: ${format}`);
|
|
94241
94550
|
return onExit(1);
|
|
94242
94551
|
}
|
|
94243
|
-
const projectDir =
|
|
94244
|
-
const outputBaseName =
|
|
94552
|
+
const projectDir = path26.dirname(filePath);
|
|
94553
|
+
const outputBaseName = path26.basename(filePath).replace(/\.[^.]+$/, "");
|
|
94245
94554
|
const outputFileName = `${outputBaseName}${OUTPUT_EXTENSIONS[format]}`;
|
|
94246
|
-
const outputDestination =
|
|
94555
|
+
const outputDestination = path26.join(projectDir, outputPath ?? outputFileName);
|
|
94247
94556
|
const circuitData = await generateCircuitJson({
|
|
94248
94557
|
filePath,
|
|
94249
94558
|
saveToFile: format === "circuit-json",
|
|
@@ -94427,20 +94736,20 @@ var getSpiceWithPaddedSim = (circuitJson, options) => {
|
|
|
94427
94736
|
};
|
|
94428
94737
|
|
|
94429
94738
|
// lib/eecircuit-engine/run-simulation.ts
|
|
94430
|
-
import { promises as
|
|
94431
|
-
import
|
|
94739
|
+
import { promises as fs27, existsSync as existsSync10 } from "node:fs";
|
|
94740
|
+
import path27 from "node:path";
|
|
94432
94741
|
import os2 from "node:os";
|
|
94433
94742
|
var sim = null;
|
|
94434
94743
|
var fetchSimulation = async () => {
|
|
94435
|
-
const tempFilePath =
|
|
94436
|
-
if (!
|
|
94744
|
+
const tempFilePath = path27.join(os2.tmpdir(), "eecircuit-engine-1.5.2.mjs");
|
|
94745
|
+
if (!existsSync10(tempFilePath)) {
|
|
94437
94746
|
const url = "https://cdn.jsdelivr.net/npm/eecircuit-engine@1.5.2/+esm";
|
|
94438
94747
|
const response = await fetch(url);
|
|
94439
94748
|
if (!response.ok) {
|
|
94440
94749
|
throw new Error(`Failed to fetch eecircuit-engine from ${url}: ${response.statusText}`);
|
|
94441
94750
|
}
|
|
94442
94751
|
const scriptContent = await response.text();
|
|
94443
|
-
await
|
|
94752
|
+
await fs27.writeFile(tempFilePath, scriptContent);
|
|
94444
94753
|
}
|
|
94445
94754
|
const module2 = await import(tempFilePath);
|
|
94446
94755
|
return module2.Simulation;
|
|
@@ -94467,7 +94776,7 @@ var initializeSimulation = async () => {
|
|
|
94467
94776
|
}
|
|
94468
94777
|
throw new Error("Simulation engine initialization timed out.");
|
|
94469
94778
|
}
|
|
94470
|
-
await new Promise((
|
|
94779
|
+
await new Promise((resolve12) => setTimeout(resolve12, 200));
|
|
94471
94780
|
}
|
|
94472
94781
|
};
|
|
94473
94782
|
var runSimulation = async (spiceString) => {
|
|
@@ -94529,10 +94838,10 @@ var resultToCsv = (result) => {
|
|
|
94529
94838
|
};
|
|
94530
94839
|
|
|
94531
94840
|
// cli/export/register.ts
|
|
94532
|
-
import
|
|
94533
|
-
import { promises as
|
|
94841
|
+
import path28 from "node:path";
|
|
94842
|
+
import { promises as fs28 } from "node:fs";
|
|
94534
94843
|
var registerExport = (program3) => {
|
|
94535
|
-
program3.command("export").description("Export tscircuit code to various formats").argument("<file>", "Path to the package file").option("-f, --format <format>",
|
|
94844
|
+
program3.command("export").description("Export tscircuit code to various formats").argument("<file>", "Path to the package file").option("-f, --format <format>", `Output format (${ALLOWED_EXPORT_FORMATS.join(", ")})`).option("-o, --output <path>", "Output file path").option("--disable-parts-engine", "Disable the parts engine").action(async (file, options) => {
|
|
94536
94845
|
const formatOption = options.format ?? "json";
|
|
94537
94846
|
const platformConfig = options.disablePartsEngine === true ? { partsEngineDisabled: true } : undefined;
|
|
94538
94847
|
if (formatOption === "spice") {
|
|
@@ -94542,12 +94851,12 @@ var registerExport = (program3) => {
|
|
|
94542
94851
|
});
|
|
94543
94852
|
if (circuitJson) {
|
|
94544
94853
|
const spiceString = getSpiceWithPaddedSim(circuitJson);
|
|
94545
|
-
const outputSpicePath = options.output ??
|
|
94546
|
-
await
|
|
94854
|
+
const outputSpicePath = options.output ?? path28.join(path28.dirname(file), `${path28.basename(file, path28.extname(file))}.spice.cir`);
|
|
94855
|
+
await fs28.writeFile(outputSpicePath, spiceString);
|
|
94547
94856
|
const { result } = await runSimulation(spiceString);
|
|
94548
94857
|
const csvContent = resultToCsv(result);
|
|
94549
94858
|
const outputCsvPath = outputSpicePath.replace(/\.spice\.cir$/, ".csv");
|
|
94550
|
-
await
|
|
94859
|
+
await fs28.writeFile(outputCsvPath, csvContent);
|
|
94551
94860
|
console.log(`Exported to ${outputSpicePath} and ${outputCsvPath} (simulation results)!`);
|
|
94552
94861
|
}
|
|
94553
94862
|
return;
|
|
@@ -94779,14 +95088,14 @@ class KeyStore {
|
|
|
94779
95088
|
}
|
|
94780
95089
|
}
|
|
94781
95090
|
function createKey(key) {
|
|
94782
|
-
let
|
|
95091
|
+
let path29 = null;
|
|
94783
95092
|
let id = null;
|
|
94784
95093
|
let src = null;
|
|
94785
95094
|
let weight = 1;
|
|
94786
95095
|
let getFn = null;
|
|
94787
95096
|
if (isString2(key) || isArray(key)) {
|
|
94788
95097
|
src = key;
|
|
94789
|
-
|
|
95098
|
+
path29 = createKeyPath(key);
|
|
94790
95099
|
id = createKeyId(key);
|
|
94791
95100
|
} else {
|
|
94792
95101
|
if (!hasOwn.call(key, "name")) {
|
|
@@ -94800,11 +95109,11 @@ function createKey(key) {
|
|
|
94800
95109
|
throw new Error(INVALID_KEY_WEIGHT_VALUE(name));
|
|
94801
95110
|
}
|
|
94802
95111
|
}
|
|
94803
|
-
|
|
95112
|
+
path29 = createKeyPath(name);
|
|
94804
95113
|
id = createKeyId(name);
|
|
94805
95114
|
getFn = key.getFn;
|
|
94806
95115
|
}
|
|
94807
|
-
return { path:
|
|
95116
|
+
return { path: path29, id, weight, src, getFn };
|
|
94808
95117
|
}
|
|
94809
95118
|
function createKeyPath(key) {
|
|
94810
95119
|
return isArray(key) ? key : key.split(".");
|
|
@@ -94812,34 +95121,34 @@ function createKeyPath(key) {
|
|
|
94812
95121
|
function createKeyId(key) {
|
|
94813
95122
|
return isArray(key) ? key.join(".") : key;
|
|
94814
95123
|
}
|
|
94815
|
-
function get(obj,
|
|
95124
|
+
function get(obj, path29) {
|
|
94816
95125
|
let list = [];
|
|
94817
95126
|
let arr = false;
|
|
94818
|
-
const deepGet = (obj2,
|
|
95127
|
+
const deepGet = (obj2, path30, index) => {
|
|
94819
95128
|
if (!isDefined(obj2)) {
|
|
94820
95129
|
return;
|
|
94821
95130
|
}
|
|
94822
|
-
if (!
|
|
95131
|
+
if (!path30[index]) {
|
|
94823
95132
|
list.push(obj2);
|
|
94824
95133
|
} else {
|
|
94825
|
-
let key =
|
|
95134
|
+
let key = path30[index];
|
|
94826
95135
|
const value = obj2[key];
|
|
94827
95136
|
if (!isDefined(value)) {
|
|
94828
95137
|
return;
|
|
94829
95138
|
}
|
|
94830
|
-
if (index ===
|
|
95139
|
+
if (index === path30.length - 1 && (isString2(value) || isNumber(value) || isBoolean(value))) {
|
|
94831
95140
|
list.push(toString(value));
|
|
94832
95141
|
} else if (isArray(value)) {
|
|
94833
95142
|
arr = true;
|
|
94834
95143
|
for (let i = 0, len = value.length;i < len; i += 1) {
|
|
94835
|
-
deepGet(value[i],
|
|
95144
|
+
deepGet(value[i], path30, index + 1);
|
|
94836
95145
|
}
|
|
94837
|
-
} else if (
|
|
94838
|
-
deepGet(value,
|
|
95146
|
+
} else if (path30.length) {
|
|
95147
|
+
deepGet(value, path30, index + 1);
|
|
94839
95148
|
}
|
|
94840
95149
|
}
|
|
94841
95150
|
};
|
|
94842
|
-
deepGet(obj, isString2(
|
|
95151
|
+
deepGet(obj, isString2(path29) ? path29.split(".") : path29, 0);
|
|
94843
95152
|
return arr ? list : list[0];
|
|
94844
95153
|
}
|
|
94845
95154
|
var MatchOptions = {
|
|
@@ -96031,8 +96340,8 @@ var registerSearch = (program3) => {
|
|
|
96031
96340
|
}
|
|
96032
96341
|
if (kicadResults.length) {
|
|
96033
96342
|
console.log(kleur_default.bold().underline(`Found ${kicadResults.length} footprint(s) from KiCad:`));
|
|
96034
|
-
kicadResults.forEach((
|
|
96035
|
-
console.log(`${(idx + 1).toString().padStart(2, " ")}. kicad:${
|
|
96343
|
+
kicadResults.forEach((path29, idx) => {
|
|
96344
|
+
console.log(`${(idx + 1).toString().padStart(2, " ")}. kicad:${path29.replace(".kicad_mod", "").replace(".pretty", "")}`);
|
|
96036
96345
|
});
|
|
96037
96346
|
}
|
|
96038
96347
|
if (!onlyKicad && results.packages.length) {
|
|
@@ -96915,10 +97224,10 @@ var require_svgson_umd = __commonJS2({
|
|
|
96915
97224
|
for (var _len = arguments.length, args = new Array(_len), _key = 0;_key < _len; _key++) {
|
|
96916
97225
|
args[_key] = arguments[_key];
|
|
96917
97226
|
}
|
|
96918
|
-
return new Promise(function(
|
|
97227
|
+
return new Promise(function(resolve12, reject) {
|
|
96919
97228
|
try {
|
|
96920
97229
|
var res = svgsonSync.apply(undefined, args);
|
|
96921
|
-
|
|
97230
|
+
resolve12(res);
|
|
96922
97231
|
} catch (e3) {
|
|
96923
97232
|
reject(e3);
|
|
96924
97233
|
}
|
|
@@ -101178,8 +101487,8 @@ Vo.x = 0.35;
|
|
|
101178
101487
|
Vo.anchor = "middle_left";
|
|
101179
101488
|
var Qx = Hx;
|
|
101180
101489
|
var Kx = { paths: { path11: { type: "path", points: [{ x: -0.39, y: -0.1 }, { x: 0.05, y: -0.11 }], color: "primary", fill: false }, "path12-1": { type: "path", points: [{ x: 0.3, y: 0.53 }, { x: 0.3, y: 0.11 }], color: "primary", fill: false }, "path12-1-5": { type: "path", points: [{ x: 0.31, y: -0.53 }, { x: 0.31, y: -0.01 }], color: "primary", fill: false }, path2: { type: "path", points: [{ x: 0.09, y: 0.11 }, { x: 0.31, y: 0.11 }], color: "primary", fill: false }, "path2-8-3-7": { type: "path", points: [{ x: 0.09, y: 0.15 }, { x: 0.09, y: 0.07 }], color: "primary", fill: false }, "path2-5": { type: "path", points: [{ x: 0.09, y: -0.1 }, { x: 0.31, y: -0.1 }], color: "primary", fill: false }, "path2-8-3": { type: "path", points: [{ x: 0.09, y: -0.08 }, { x: 0.09, y: -0.15 }], color: "primary", fill: false }, "path2-8-3-2": { type: "path", points: [{ x: 0.09, y: 0.03 }, { x: 0.09, y: -0.04 }], color: "primary", fill: false }, path15: { type: "path", points: [{ x: 0.27, y: -0.04 }, { x: 0.27, y: 0.03 }, { x: 0.2, y: 0 }, { x: 0.27, y: -0.04 }], color: "primary", fill: true }, "path2-0": { type: "path", points: [{ x: 0.09, y: 0 }, { x: 0.31, y: -0.01 }], color: "primary", fill: false }, "path12-1-0": { type: "path", points: [{ x: 0.05, y: 0.11 }, { x: 0.05, y: -0.11 }], color: "primary", fill: false } }, texts: { top1: { type: "text", text: "{REF}", x: -0.13, y: 0.36 }, bottom1: { type: "text", text: "{VAL}", x: 0.06, y: -0.42 } }, refblocks: { top1: { x: 0.3, y: 0.55 }, bottom1: { x: 0.31, y: -0.55 }, left1: { x: -0.42, y: -0.1 } }, bounds: { minX: -0.45, maxX: 0.45, minY: -0.58, maxY: 0.58, width: 0.89, height: 1.16, centerX: 0, centerY: 0 }, circles: { path1: { type: "circle", x: 0.16, y: 0, radius: 0.29, color: "primary", fill: false } } };
|
|
101181
|
-
var { paths: bd, texts:
|
|
101182
|
-
var Qe = s({ primitives: [...Object.values(bd), ...Object.values(_d), { ...
|
|
101490
|
+
var { paths: bd, texts: ts4, bounds: Ze, refblocks: jo, circles: _d } = Kx;
|
|
101491
|
+
var Qe = s({ primitives: [...Object.values(bd), ...Object.values(_d), { ...ts4.top1, anchor: "middle_right", x: 0 }, { ...ts4.bottom1, anchor: "middle_right", x: 0 }], ports: [{ ...jo.top1, labels: ["1", "drain"] }, { ...jo.bottom1, labels: ["2", "source"] }, { ...jo.left1, labels: ["3", "gate"] }], size: { width: Ze.width, height: Ze.height }, center: { x: Ze.centerX, y: Ze.centerY } });
|
|
101183
101492
|
var es = r(Qe);
|
|
101184
101493
|
var rs = es.primitives.filter((t2) => t2.type === "text");
|
|
101185
101494
|
var ko = rs.find((t2) => t2.text === "{VAL}");
|
|
@@ -101210,7 +101519,7 @@ var { paths: Ad, bounds: ss, refblocks: Pd } = xs;
|
|
|
101210
101519
|
var U = e({ primitives: [...Object.values(Ad)], ports: [{ ...Pd.left1, labels: ["1"] }], center: { x: ss.centerX, y: ss.centerY } }).rotateRightFacingSymbol("right").labelPort("left1", ["1"]).build();
|
|
101211
101520
|
var ms = r(U, "down");
|
|
101212
101521
|
var ns = r(U, "left");
|
|
101213
|
-
var
|
|
101522
|
+
var fs29 = r(U, "up");
|
|
101214
101523
|
var g = { paths: { path11: { type: "path", points: [{ x: -0.39, y: 0 }, { x: 0.06, y: -0.01 }], color: "primary", fill: false }, "path40-0": { type: "path", points: [{ x: 0.07, y: 0.27 }, { x: 0.07, y: -0.28 }], color: "primary", fill: false }, "path40-0-5": { type: "path", points: [{ x: 0.28, y: 0.24 }, { x: 0.08, y: 0.11 }], color: "primary", fill: false }, "path40-0-5-0": { type: "path", points: [{ x: 0.29, y: -0.24 }, { x: 0.09, y: -0.11 }], color: "primary", fill: false }, "path12-1-5": { type: "path", points: [{ x: 0.29, y: 0.25 }, { x: 0.29, y: 0.54 }], color: "primary", fill: false }, "path12-1-5-3": { type: "path", points: [{ x: 0.29, y: -0.54 }, { x: 0.29, y: -0.25 }], color: "primary", fill: false }, path15: { type: "path", points: [{ x: 0.19, y: -0.1 }, { x: 0.12, y: -0.2 }, { x: 0.22, y: -0.2 }, { x: 0.19, y: -0.1 }], color: "primary", fill: true } }, texts: { top1: { type: "text", text: "{REF}", x: -0.08, y: 0.36 }, bottom1: { type: "text", text: "{VAL}", x: -0.07, y: -0.41 } }, refblocks: { top1: { x: 0.29, 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-0": { type: "circle", x: 0.14, y: 0, radius: 0.29, color: "primary", fill: false } } };
|
|
101215
101524
|
var { paths: Fd, texts: XA, bounds: e0, refblocks: Mo, circles: Rd } = g;
|
|
101216
101525
|
var hs = e({ primitives: [...Object.values(Fd), ...Object.values(Rd), { type: "text", text: "{REF}", x: -0.1, y: 0.3094553499999995 }, { type: "text", text: "{VAL}", x: -0.1, y: -0.3094553499999995 }], ports: [{ ...Mo.top1, labels: ["1", "collector"] }, { ...Mo.bottom1, labels: ["2", "emitter"] }, { ...Mo.left1, labels: ["3", "base"] }], size: { width: e0.width, height: e0.height }, center: { x: e0.centerX, y: e0.centerY } }).rotateRightFacingSymbol("right").changeTextAnchor("{REF}", "middle_right").changeTextAnchor("{VAL}", "middle_right").build();
|
|
@@ -101779,7 +102088,7 @@ var mb = Cl.primitives.find((t3) => t3.type === "text" && t3.text === "{VAL}");
|
|
|
101779
102088
|
sb.anchor = "middle_left";
|
|
101780
102089
|
mb.anchor = "middle_right";
|
|
101781
102090
|
var B1 = Cl;
|
|
101782
|
-
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:
|
|
102091
|
+
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: fs29, 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 };
|
|
101783
102092
|
var Y$ = Object.fromEntries(Object.keys(q1).map((t3) => [t3, t3]));
|
|
101784
102093
|
function doesLineIntersectLine([a12, a22], [b12, b22], {
|
|
101785
102094
|
lineThickness = 0
|
|
@@ -103079,14 +103388,14 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
|
|
|
103079
103388
|
prevActScopeDepth !== actScopeDepth - 1 && console.error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. ");
|
|
103080
103389
|
actScopeDepth = prevActScopeDepth;
|
|
103081
103390
|
}
|
|
103082
|
-
function recursivelyFlushAsyncActWork(returnValue,
|
|
103391
|
+
function recursivelyFlushAsyncActWork(returnValue, resolve12, reject) {
|
|
103083
103392
|
var queue = ReactSharedInternals.actQueue;
|
|
103084
103393
|
if (queue !== null)
|
|
103085
103394
|
if (queue.length !== 0)
|
|
103086
103395
|
try {
|
|
103087
103396
|
flushActQueue(queue);
|
|
103088
103397
|
enqueueTask(function() {
|
|
103089
|
-
return recursivelyFlushAsyncActWork(returnValue,
|
|
103398
|
+
return recursivelyFlushAsyncActWork(returnValue, resolve12, reject);
|
|
103090
103399
|
});
|
|
103091
103400
|
return;
|
|
103092
103401
|
} catch (error) {
|
|
@@ -103094,7 +103403,7 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
|
|
|
103094
103403
|
}
|
|
103095
103404
|
else
|
|
103096
103405
|
ReactSharedInternals.actQueue = null;
|
|
103097
|
-
0 < ReactSharedInternals.thrownErrors.length ? (queue = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(queue)) :
|
|
103406
|
+
0 < ReactSharedInternals.thrownErrors.length ? (queue = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(queue)) : resolve12(returnValue);
|
|
103098
103407
|
}
|
|
103099
103408
|
function flushActQueue(queue) {
|
|
103100
103409
|
if (!isFlushing) {
|
|
@@ -103270,14 +103579,14 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
|
|
|
103270
103579
|
didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = true, console.error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"));
|
|
103271
103580
|
});
|
|
103272
103581
|
return {
|
|
103273
|
-
then: function(
|
|
103582
|
+
then: function(resolve12, reject) {
|
|
103274
103583
|
didAwaitActCall = true;
|
|
103275
103584
|
thenable.then(function(returnValue) {
|
|
103276
103585
|
popActScope(prevActQueue, prevActScopeDepth);
|
|
103277
103586
|
if (prevActScopeDepth === 0) {
|
|
103278
103587
|
try {
|
|
103279
103588
|
flushActQueue(queue), enqueueTask(function() {
|
|
103280
|
-
return recursivelyFlushAsyncActWork(returnValue,
|
|
103589
|
+
return recursivelyFlushAsyncActWork(returnValue, resolve12, reject);
|
|
103281
103590
|
});
|
|
103282
103591
|
} catch (error$0) {
|
|
103283
103592
|
ReactSharedInternals.thrownErrors.push(error$0);
|
|
@@ -103288,7 +103597,7 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
|
|
|
103288
103597
|
reject(_thrownError);
|
|
103289
103598
|
}
|
|
103290
103599
|
} else
|
|
103291
|
-
|
|
103600
|
+
resolve12(returnValue);
|
|
103292
103601
|
}, function(error) {
|
|
103293
103602
|
popActScope(prevActQueue, prevActScopeDepth);
|
|
103294
103603
|
0 < ReactSharedInternals.thrownErrors.length ? (error = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(error)) : reject(error);
|
|
@@ -103304,11 +103613,11 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
|
|
|
103304
103613
|
if (0 < ReactSharedInternals.thrownErrors.length)
|
|
103305
103614
|
throw callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
|
|
103306
103615
|
return {
|
|
103307
|
-
then: function(
|
|
103616
|
+
then: function(resolve12, reject) {
|
|
103308
103617
|
didAwaitActCall = true;
|
|
103309
103618
|
prevActScopeDepth === 0 ? (ReactSharedInternals.actQueue = queue, enqueueTask(function() {
|
|
103310
|
-
return recursivelyFlushAsyncActWork(returnValue$jscomp$0,
|
|
103311
|
-
})) :
|
|
103619
|
+
return recursivelyFlushAsyncActWork(returnValue$jscomp$0, resolve12, reject);
|
|
103620
|
+
})) : resolve12(returnValue$jscomp$0);
|
|
103312
103621
|
}
|
|
103313
103622
|
};
|
|
103314
103623
|
};
|
|
@@ -103809,11 +104118,11 @@ var require_react_reconciler_development = __commonJS2({
|
|
|
103809
104118
|
fiber = fiber.next, id2--;
|
|
103810
104119
|
return fiber;
|
|
103811
104120
|
}
|
|
103812
|
-
function copyWithSetImpl(obj,
|
|
103813
|
-
if (index >=
|
|
104121
|
+
function copyWithSetImpl(obj, path29, index, value) {
|
|
104122
|
+
if (index >= path29.length)
|
|
103814
104123
|
return value;
|
|
103815
|
-
var key =
|
|
103816
|
-
updated[key] = copyWithSetImpl(obj[key],
|
|
104124
|
+
var key = path29[index], updated = isArrayImpl(obj) ? obj.slice() : assign2({}, obj);
|
|
104125
|
+
updated[key] = copyWithSetImpl(obj[key], path29, index + 1, value);
|
|
103817
104126
|
return updated;
|
|
103818
104127
|
}
|
|
103819
104128
|
function copyWithRename(obj, oldPath, newPath) {
|
|
@@ -103833,11 +104142,11 @@ var require_react_reconciler_development = __commonJS2({
|
|
|
103833
104142
|
index + 1 === oldPath.length ? (updated[newPath[index]] = updated[oldKey], isArrayImpl(updated) ? updated.splice(oldKey, 1) : delete updated[oldKey]) : updated[oldKey] = copyWithRenameImpl(obj[oldKey], oldPath, newPath, index + 1);
|
|
103834
104143
|
return updated;
|
|
103835
104144
|
}
|
|
103836
|
-
function copyWithDeleteImpl(obj,
|
|
103837
|
-
var key =
|
|
103838
|
-
if (index + 1 ===
|
|
104145
|
+
function copyWithDeleteImpl(obj, path29, index) {
|
|
104146
|
+
var key = path29[index], updated = isArrayImpl(obj) ? obj.slice() : assign2({}, obj);
|
|
104147
|
+
if (index + 1 === path29.length)
|
|
103839
104148
|
return isArrayImpl(updated) ? updated.splice(key, 1) : delete updated[key], updated;
|
|
103840
|
-
updated[key] = copyWithDeleteImpl(obj[key],
|
|
104149
|
+
updated[key] = copyWithDeleteImpl(obj[key], path29, index + 1);
|
|
103841
104150
|
return updated;
|
|
103842
104151
|
}
|
|
103843
104152
|
function shouldSuspendImpl() {
|
|
@@ -105549,8 +105858,8 @@ It can also happen if the client has a browser extension installed which messes
|
|
|
105549
105858
|
currentEntangledActionThenable = {
|
|
105550
105859
|
status: "pending",
|
|
105551
105860
|
value: undefined,
|
|
105552
|
-
then: function(
|
|
105553
|
-
entangledListeners.push(
|
|
105861
|
+
then: function(resolve12) {
|
|
105862
|
+
entangledListeners.push(resolve12);
|
|
105554
105863
|
}
|
|
105555
105864
|
};
|
|
105556
105865
|
}
|
|
@@ -105574,8 +105883,8 @@ It can also happen if the client has a browser extension installed which messes
|
|
|
105574
105883
|
status: "pending",
|
|
105575
105884
|
value: null,
|
|
105576
105885
|
reason: null,
|
|
105577
|
-
then: function(
|
|
105578
|
-
listeners.push(
|
|
105886
|
+
then: function(resolve12) {
|
|
105887
|
+
listeners.push(resolve12);
|
|
105579
105888
|
}
|
|
105580
105889
|
};
|
|
105581
105890
|
thenable.then(function() {
|
|
@@ -112868,29 +113177,29 @@ Check the top-level render call using <` + componentName2 + ">.");
|
|
|
112868
113177
|
var didWarnAboutNestedUpdates = false;
|
|
112869
113178
|
var didWarnAboutFindNodeInStrictMode = {};
|
|
112870
113179
|
var overrideHookState = null, overrideHookStateDeletePath = null, overrideHookStateRenamePath = null, overrideProps = null, overridePropsDeletePath = null, overridePropsRenamePath = null, scheduleUpdate = null, setErrorHandler = null, setSuspenseHandler = null;
|
|
112871
|
-
overrideHookState = function(fiber, id2,
|
|
113180
|
+
overrideHookState = function(fiber, id2, path29, value) {
|
|
112872
113181
|
id2 = findHook(fiber, id2);
|
|
112873
|
-
id2 !== null && (
|
|
113182
|
+
id2 !== null && (path29 = copyWithSetImpl(id2.memoizedState, path29, 0, value), id2.memoizedState = path29, id2.baseState = path29, fiber.memoizedProps = assign2({}, fiber.memoizedProps), path29 = enqueueConcurrentRenderForLane(fiber, 2), path29 !== null && scheduleUpdateOnFiber(path29, fiber, 2));
|
|
112874
113183
|
};
|
|
112875
|
-
overrideHookStateDeletePath = function(fiber, id2,
|
|
113184
|
+
overrideHookStateDeletePath = function(fiber, id2, path29) {
|
|
112876
113185
|
id2 = findHook(fiber, id2);
|
|
112877
|
-
id2 !== null && (
|
|
113186
|
+
id2 !== null && (path29 = copyWithDeleteImpl(id2.memoizedState, path29, 0), id2.memoizedState = path29, id2.baseState = path29, fiber.memoizedProps = assign2({}, fiber.memoizedProps), path29 = enqueueConcurrentRenderForLane(fiber, 2), path29 !== null && scheduleUpdateOnFiber(path29, fiber, 2));
|
|
112878
113187
|
};
|
|
112879
113188
|
overrideHookStateRenamePath = function(fiber, id2, oldPath, newPath) {
|
|
112880
113189
|
id2 = findHook(fiber, id2);
|
|
112881
113190
|
id2 !== null && (oldPath = copyWithRename(id2.memoizedState, oldPath, newPath), id2.memoizedState = oldPath, id2.baseState = oldPath, fiber.memoizedProps = assign2({}, fiber.memoizedProps), oldPath = enqueueConcurrentRenderForLane(fiber, 2), oldPath !== null && scheduleUpdateOnFiber(oldPath, fiber, 2));
|
|
112882
113191
|
};
|
|
112883
|
-
overrideProps = function(fiber,
|
|
112884
|
-
fiber.pendingProps = copyWithSetImpl(fiber.memoizedProps,
|
|
113192
|
+
overrideProps = function(fiber, path29, value) {
|
|
113193
|
+
fiber.pendingProps = copyWithSetImpl(fiber.memoizedProps, path29, 0, value);
|
|
112885
113194
|
fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps);
|
|
112886
|
-
|
|
112887
|
-
|
|
113195
|
+
path29 = enqueueConcurrentRenderForLane(fiber, 2);
|
|
113196
|
+
path29 !== null && scheduleUpdateOnFiber(path29, fiber, 2);
|
|
112888
113197
|
};
|
|
112889
|
-
overridePropsDeletePath = function(fiber,
|
|
112890
|
-
fiber.pendingProps = copyWithDeleteImpl(fiber.memoizedProps,
|
|
113198
|
+
overridePropsDeletePath = function(fiber, path29) {
|
|
113199
|
+
fiber.pendingProps = copyWithDeleteImpl(fiber.memoizedProps, path29, 0);
|
|
112891
113200
|
fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps);
|
|
112892
|
-
|
|
112893
|
-
|
|
113201
|
+
path29 = enqueueConcurrentRenderForLane(fiber, 2);
|
|
113202
|
+
path29 !== null && scheduleUpdateOnFiber(path29, fiber, 2);
|
|
112894
113203
|
};
|
|
112895
113204
|
overridePropsRenamePath = function(fiber, oldPath, newPath) {
|
|
112896
113205
|
fiber.pendingProps = copyWithRename(fiber.memoizedProps, oldPath, newPath);
|
|
@@ -128227,10 +128536,10 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
128227
128536
|
var setErrorHandler = null;
|
|
128228
128537
|
var setSuspenseHandler = null;
|
|
128229
128538
|
{
|
|
128230
|
-
var copyWithDeleteImpl = function(obj,
|
|
128231
|
-
var key =
|
|
128539
|
+
var copyWithDeleteImpl = function(obj, path29, index2) {
|
|
128540
|
+
var key = path29[index2];
|
|
128232
128541
|
var updated = isArray2(obj) ? obj.slice() : assign2({}, obj);
|
|
128233
|
-
if (index2 + 1 ===
|
|
128542
|
+
if (index2 + 1 === path29.length) {
|
|
128234
128543
|
if (isArray2(updated)) {
|
|
128235
128544
|
updated.splice(key, 1);
|
|
128236
128545
|
} else {
|
|
@@ -128238,11 +128547,11 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
128238
128547
|
}
|
|
128239
128548
|
return updated;
|
|
128240
128549
|
}
|
|
128241
|
-
updated[key] = copyWithDeleteImpl(obj[key],
|
|
128550
|
+
updated[key] = copyWithDeleteImpl(obj[key], path29, index2 + 1);
|
|
128242
128551
|
return updated;
|
|
128243
128552
|
};
|
|
128244
|
-
var copyWithDelete = function(obj,
|
|
128245
|
-
return copyWithDeleteImpl(obj,
|
|
128553
|
+
var copyWithDelete = function(obj, path29) {
|
|
128554
|
+
return copyWithDeleteImpl(obj, path29, 0);
|
|
128246
128555
|
};
|
|
128247
128556
|
var copyWithRenameImpl = function(obj, oldPath, newPath, index2) {
|
|
128248
128557
|
var oldKey = oldPath[index2];
|
|
@@ -128274,17 +128583,17 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
128274
128583
|
}
|
|
128275
128584
|
return copyWithRenameImpl(obj, oldPath, newPath, 0);
|
|
128276
128585
|
};
|
|
128277
|
-
var copyWithSetImpl = function(obj,
|
|
128278
|
-
if (index2 >=
|
|
128586
|
+
var copyWithSetImpl = function(obj, path29, index2, value) {
|
|
128587
|
+
if (index2 >= path29.length) {
|
|
128279
128588
|
return value;
|
|
128280
128589
|
}
|
|
128281
|
-
var key =
|
|
128590
|
+
var key = path29[index2];
|
|
128282
128591
|
var updated = isArray2(obj) ? obj.slice() : assign2({}, obj);
|
|
128283
|
-
updated[key] = copyWithSetImpl(obj[key],
|
|
128592
|
+
updated[key] = copyWithSetImpl(obj[key], path29, index2 + 1, value);
|
|
128284
128593
|
return updated;
|
|
128285
128594
|
};
|
|
128286
|
-
var copyWithSet = function(obj,
|
|
128287
|
-
return copyWithSetImpl(obj,
|
|
128595
|
+
var copyWithSet = function(obj, path29, value) {
|
|
128596
|
+
return copyWithSetImpl(obj, path29, 0, value);
|
|
128288
128597
|
};
|
|
128289
128598
|
var findHook = function(fiber, id2) {
|
|
128290
128599
|
var currentHook2 = fiber.memoizedState;
|
|
@@ -128294,10 +128603,10 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
128294
128603
|
}
|
|
128295
128604
|
return currentHook2;
|
|
128296
128605
|
};
|
|
128297
|
-
overrideHookState = function(fiber, id2,
|
|
128606
|
+
overrideHookState = function(fiber, id2, path29, value) {
|
|
128298
128607
|
var hook = findHook(fiber, id2);
|
|
128299
128608
|
if (hook !== null) {
|
|
128300
|
-
var newState = copyWithSet(hook.memoizedState,
|
|
128609
|
+
var newState = copyWithSet(hook.memoizedState, path29, value);
|
|
128301
128610
|
hook.memoizedState = newState;
|
|
128302
128611
|
hook.baseState = newState;
|
|
128303
128612
|
fiber.memoizedProps = assign2({}, fiber.memoizedProps);
|
|
@@ -128307,10 +128616,10 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
128307
128616
|
}
|
|
128308
128617
|
}
|
|
128309
128618
|
};
|
|
128310
|
-
overrideHookStateDeletePath = function(fiber, id2,
|
|
128619
|
+
overrideHookStateDeletePath = function(fiber, id2, path29) {
|
|
128311
128620
|
var hook = findHook(fiber, id2);
|
|
128312
128621
|
if (hook !== null) {
|
|
128313
|
-
var newState = copyWithDelete(hook.memoizedState,
|
|
128622
|
+
var newState = copyWithDelete(hook.memoizedState, path29);
|
|
128314
128623
|
hook.memoizedState = newState;
|
|
128315
128624
|
hook.baseState = newState;
|
|
128316
128625
|
fiber.memoizedProps = assign2({}, fiber.memoizedProps);
|
|
@@ -128333,8 +128642,8 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
128333
128642
|
}
|
|
128334
128643
|
}
|
|
128335
128644
|
};
|
|
128336
|
-
overrideProps = function(fiber,
|
|
128337
|
-
fiber.pendingProps = copyWithSet(fiber.memoizedProps,
|
|
128645
|
+
overrideProps = function(fiber, path29, value) {
|
|
128646
|
+
fiber.pendingProps = copyWithSet(fiber.memoizedProps, path29, value);
|
|
128338
128647
|
if (fiber.alternate) {
|
|
128339
128648
|
fiber.alternate.pendingProps = fiber.pendingProps;
|
|
128340
128649
|
}
|
|
@@ -128343,8 +128652,8 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
128343
128652
|
scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp);
|
|
128344
128653
|
}
|
|
128345
128654
|
};
|
|
128346
|
-
overridePropsDeletePath = function(fiber,
|
|
128347
|
-
fiber.pendingProps = copyWithDelete(fiber.memoizedProps,
|
|
128655
|
+
overridePropsDeletePath = function(fiber, path29) {
|
|
128656
|
+
fiber.pendingProps = copyWithDelete(fiber.memoizedProps, path29);
|
|
128348
128657
|
if (fiber.alternate) {
|
|
128349
128658
|
fiber.alternate.pendingProps = fiber.pendingProps;
|
|
128350
128659
|
}
|
|
@@ -134395,7 +134704,7 @@ var parsePin = (pinString) => {
|
|
|
134395
134704
|
const colorMatch = pinString.match(/#[0-9A-F]{6}/);
|
|
134396
134705
|
const labelColor = colorMatch ? colorMatch[0] : "";
|
|
134397
134706
|
const pathMatch = pinString.match(/\^\^([^~]+)/);
|
|
134398
|
-
const
|
|
134707
|
+
const path29 = pathMatch ? pathMatch[1] : "";
|
|
134399
134708
|
const arrowMatch = pinString.match(/\^\^0~(.+)$/);
|
|
134400
134709
|
const arrow = arrowMatch ? arrowMatch[1] : "";
|
|
134401
134710
|
const r3 = Number.parseFloat(rotation2);
|
|
@@ -134409,7 +134718,7 @@ var parsePin = (pinString) => {
|
|
|
134409
134718
|
rotation: Number.isNaN(r3) ? 0 : r3,
|
|
134410
134719
|
label,
|
|
134411
134720
|
labelColor,
|
|
134412
|
-
path:
|
|
134721
|
+
path: path29,
|
|
134413
134722
|
arrow
|
|
134414
134723
|
};
|
|
134415
134724
|
};
|
|
@@ -134849,15 +135158,15 @@ function generateArcFromSweep(startX, startY, endX, endY, radius, largeArcFlag,
|
|
|
134849
135158
|
}
|
|
134850
135159
|
}
|
|
134851
135160
|
const numPoints = Math.max(2, Math.ceil(Math.abs(endAngle - startAngle) * radius));
|
|
134852
|
-
const
|
|
135161
|
+
const path29 = [];
|
|
134853
135162
|
for (let i = 0;i <= numPoints; i++) {
|
|
134854
135163
|
const t3 = i / numPoints;
|
|
134855
135164
|
const angle2 = startAngle + t3 * (endAngle - startAngle);
|
|
134856
135165
|
const x = centerX + radius * Math.cos(angle2);
|
|
134857
135166
|
const y = centerY + radius * Math.sin(angle2);
|
|
134858
|
-
|
|
135167
|
+
path29.push({ x, y });
|
|
134859
135168
|
}
|
|
134860
|
-
return
|
|
135169
|
+
return path29;
|
|
134861
135170
|
}
|
|
134862
135171
|
var __defProp4 = Object.defineProperty;
|
|
134863
135172
|
var __export22 = (target, all) => {
|
|
@@ -136275,7 +136584,7 @@ var platedHoleWithRectPad = (pn2, x, y, holeDiameter, rectPadWidth, rectPadHeigh
|
|
|
136275
136584
|
};
|
|
136276
136585
|
};
|
|
136277
136586
|
var silkscreenPin = ({
|
|
136278
|
-
fs:
|
|
136587
|
+
fs: fs30,
|
|
136279
136588
|
pn: pn2,
|
|
136280
136589
|
anchor_x,
|
|
136281
136590
|
anchor_y,
|
|
@@ -136318,7 +136627,7 @@ var silkscreenPin = ({
|
|
|
136318
136627
|
type: "pcb_silkscreen_text",
|
|
136319
136628
|
pcb_silkscreen_text_id: "silkscreen_text_1",
|
|
136320
136629
|
font: "tscircuit2024",
|
|
136321
|
-
font_size:
|
|
136630
|
+
font_size: fs30,
|
|
136322
136631
|
pcb_component_id: "pcb_component_1",
|
|
136323
136632
|
text: `{PIN${pn2}}`,
|
|
136324
136633
|
layer,
|
|
@@ -143934,17 +144243,17 @@ var ObstacleList = class {
|
|
|
143934
144243
|
return obstacles;
|
|
143935
144244
|
}
|
|
143936
144245
|
};
|
|
143937
|
-
function removePathLoops(
|
|
143938
|
-
if (
|
|
143939
|
-
return
|
|
143940
|
-
const result = [{ ...
|
|
143941
|
-
let currentLayer =
|
|
143942
|
-
for (let i = 1;i <
|
|
143943
|
-
const currentSegment = { start:
|
|
143944
|
-
const isVia =
|
|
143945
|
-
if (
|
|
143946
|
-
result.push({ ...
|
|
143947
|
-
currentLayer =
|
|
144246
|
+
function removePathLoops(path29) {
|
|
144247
|
+
if (path29.length < 4)
|
|
144248
|
+
return path29;
|
|
144249
|
+
const result = [{ ...path29[0] }];
|
|
144250
|
+
let currentLayer = path29[0].layer;
|
|
144251
|
+
for (let i = 1;i < path29.length; i++) {
|
|
144252
|
+
const currentSegment = { start: path29[i - 1], end: path29[i] };
|
|
144253
|
+
const isVia = path29[i].route_type === "via" || path29[i - 1].route_type === "via";
|
|
144254
|
+
if (path29[i].layer !== currentLayer || isVia) {
|
|
144255
|
+
result.push({ ...path29[i] });
|
|
144256
|
+
currentLayer = path29[i].layer;
|
|
143948
144257
|
continue;
|
|
143949
144258
|
}
|
|
143950
144259
|
let intersectionFound = false;
|
|
@@ -143973,8 +144282,8 @@ function removePathLoops(path28) {
|
|
|
143973
144282
|
result.push(intersectionPoint);
|
|
143974
144283
|
}
|
|
143975
144284
|
const lastPoint = result[result.length - 1];
|
|
143976
|
-
if (lastPoint.x !==
|
|
143977
|
-
result.push(
|
|
144285
|
+
if (lastPoint.x !== path29[i].x || lastPoint.y !== path29[i].y) {
|
|
144286
|
+
result.push(path29[i]);
|
|
143978
144287
|
}
|
|
143979
144288
|
}
|
|
143980
144289
|
return result;
|
|
@@ -144463,10 +144772,10 @@ var GeneralizedAstarAutorouter = class {
|
|
|
144463
144772
|
});
|
|
144464
144773
|
}
|
|
144465
144774
|
if (current2.parent) {
|
|
144466
|
-
const
|
|
144775
|
+
const path29 = [];
|
|
144467
144776
|
let p = current2;
|
|
144468
144777
|
while (p) {
|
|
144469
|
-
|
|
144778
|
+
path29.unshift(p);
|
|
144470
144779
|
p = p.parent;
|
|
144471
144780
|
}
|
|
144472
144781
|
debugSolution.push({
|
|
@@ -144474,7 +144783,7 @@ var GeneralizedAstarAutorouter = class {
|
|
|
144474
144783
|
pcb_component_id: "",
|
|
144475
144784
|
pcb_fabrication_note_path_id: `note_path_${current2.x}_${current2.y}`,
|
|
144476
144785
|
layer: "top",
|
|
144477
|
-
route:
|
|
144786
|
+
route: path29,
|
|
144478
144787
|
stroke_width: 0.01
|
|
144479
144788
|
});
|
|
144480
144789
|
}
|
|
@@ -149396,13 +149705,13 @@ var RBush = class {
|
|
|
149396
149705
|
return this;
|
|
149397
149706
|
let node = this.data;
|
|
149398
149707
|
const bbox = this.toBBox(item);
|
|
149399
|
-
const
|
|
149708
|
+
const path29 = [];
|
|
149400
149709
|
const indexes = [];
|
|
149401
149710
|
let i, parent, goingUp;
|
|
149402
|
-
while (node ||
|
|
149711
|
+
while (node || path29.length) {
|
|
149403
149712
|
if (!node) {
|
|
149404
|
-
node =
|
|
149405
|
-
parent =
|
|
149713
|
+
node = path29.pop();
|
|
149714
|
+
parent = path29[path29.length - 1];
|
|
149406
149715
|
i = indexes.pop();
|
|
149407
149716
|
goingUp = true;
|
|
149408
149717
|
}
|
|
@@ -149410,13 +149719,13 @@ var RBush = class {
|
|
|
149410
149719
|
const index = findItem(item, node.children, equalsFn);
|
|
149411
149720
|
if (index !== -1) {
|
|
149412
149721
|
node.children.splice(index, 1);
|
|
149413
|
-
|
|
149414
|
-
this._condense(
|
|
149722
|
+
path29.push(node);
|
|
149723
|
+
this._condense(path29);
|
|
149415
149724
|
return this;
|
|
149416
149725
|
}
|
|
149417
149726
|
}
|
|
149418
149727
|
if (!goingUp && !node.leaf && contains(node, bbox)) {
|
|
149419
|
-
|
|
149728
|
+
path29.push(node);
|
|
149420
149729
|
indexes.push(i);
|
|
149421
149730
|
i = 0;
|
|
149422
149731
|
parent = node;
|
|
@@ -149487,10 +149796,10 @@ var RBush = class {
|
|
|
149487
149796
|
calcBBox(node, this.toBBox);
|
|
149488
149797
|
return node;
|
|
149489
149798
|
}
|
|
149490
|
-
_chooseSubtree(bbox, node, level,
|
|
149799
|
+
_chooseSubtree(bbox, node, level, path29) {
|
|
149491
149800
|
while (true) {
|
|
149492
|
-
|
|
149493
|
-
if (node.leaf ||
|
|
149801
|
+
path29.push(node);
|
|
149802
|
+
if (node.leaf || path29.length - 1 === level)
|
|
149494
149803
|
break;
|
|
149495
149804
|
let minArea = Infinity;
|
|
149496
149805
|
let minEnlargement = Infinity;
|
|
@@ -149599,21 +149908,21 @@ var RBush = class {
|
|
|
149599
149908
|
}
|
|
149600
149909
|
return margin;
|
|
149601
149910
|
}
|
|
149602
|
-
_adjustParentBBoxes(bbox,
|
|
149911
|
+
_adjustParentBBoxes(bbox, path29, level) {
|
|
149603
149912
|
for (let i = level;i >= 0; i--) {
|
|
149604
|
-
extend(
|
|
149913
|
+
extend(path29[i], bbox);
|
|
149605
149914
|
}
|
|
149606
149915
|
}
|
|
149607
|
-
_condense(
|
|
149608
|
-
for (let i =
|
|
149609
|
-
if (
|
|
149916
|
+
_condense(path29) {
|
|
149917
|
+
for (let i = path29.length - 1, siblings;i >= 0; i--) {
|
|
149918
|
+
if (path29[i].children.length === 0) {
|
|
149610
149919
|
if (i > 0) {
|
|
149611
|
-
siblings =
|
|
149612
|
-
siblings.splice(siblings.indexOf(
|
|
149920
|
+
siblings = path29[i - 1].children;
|
|
149921
|
+
siblings.splice(siblings.indexOf(path29[i]), 1);
|
|
149613
149922
|
} else
|
|
149614
149923
|
this.clear();
|
|
149615
149924
|
} else
|
|
149616
|
-
calcBBox(
|
|
149925
|
+
calcBBox(path29[i], this.toBBox);
|
|
149617
149926
|
}
|
|
149618
149927
|
}
|
|
149619
149928
|
};
|
|
@@ -150758,7 +151067,7 @@ var CapacityEdgeToPortSegmentSolver = class extends BaseSolver {
|
|
|
150758
151067
|
this.capacityPaths = capacityPaths;
|
|
150759
151068
|
this.colorMap = colorMap ?? {};
|
|
150760
151069
|
this.unprocessedNodeIds = [
|
|
150761
|
-
...new Set(capacityPaths.flatMap((
|
|
151070
|
+
...new Set(capacityPaths.flatMap((path29) => path29.nodeIds))
|
|
150762
151071
|
];
|
|
150763
151072
|
this.nodePortSegments = /* @__PURE__ */ new Map;
|
|
150764
151073
|
}
|
|
@@ -150769,17 +151078,17 @@ var CapacityEdgeToPortSegmentSolver = class extends BaseSolver {
|
|
|
150769
151078
|
return;
|
|
150770
151079
|
}
|
|
150771
151080
|
const pathsGoingThroughNode = [];
|
|
150772
|
-
for (const
|
|
150773
|
-
const indexOfNodeInPath =
|
|
151081
|
+
for (const path29 of this.capacityPaths) {
|
|
151082
|
+
const indexOfNodeInPath = path29.nodeIds.indexOf(nodeId);
|
|
150774
151083
|
if (indexOfNodeInPath !== -1) {
|
|
150775
|
-
pathsGoingThroughNode.push({ path:
|
|
151084
|
+
pathsGoingThroughNode.push({ path: path29, indexOfNodeInPath });
|
|
150776
151085
|
}
|
|
150777
151086
|
}
|
|
150778
151087
|
const node = this.nodeMap.get(nodeId);
|
|
150779
151088
|
const nodePortSegments = [];
|
|
150780
|
-
for (const { path:
|
|
150781
|
-
const entryNodeId =
|
|
150782
|
-
const exitNodeId =
|
|
151089
|
+
for (const { path: path29, indexOfNodeInPath } of pathsGoingThroughNode) {
|
|
151090
|
+
const entryNodeId = path29.nodeIds[indexOfNodeInPath - 1];
|
|
151091
|
+
const exitNodeId = path29.nodeIds[indexOfNodeInPath + 1];
|
|
150783
151092
|
for (const adjNodeId of [entryNodeId, exitNodeId]) {
|
|
150784
151093
|
const adjNode = this.nodeMap.get(adjNodeId);
|
|
150785
151094
|
if (!adjNode)
|
|
@@ -150792,7 +151101,7 @@ var CapacityEdgeToPortSegmentSolver = class extends BaseSolver {
|
|
|
150792
151101
|
capacityMeshNodeId: nodeId,
|
|
150793
151102
|
start: segment2.start,
|
|
150794
151103
|
end: segment2.end,
|
|
150795
|
-
connectionNames: [
|
|
151104
|
+
connectionNames: [path29.connectionName],
|
|
150796
151105
|
availableZ: mutuallyAvailableZ
|
|
150797
151106
|
};
|
|
150798
151107
|
nodePortSegments.push(portSegment);
|
|
@@ -151598,37 +151907,37 @@ var SingleHighDensityRouteSolver = class extends BaseSolver {
|
|
|
151598
151907
|
return neighbors;
|
|
151599
151908
|
}
|
|
151600
151909
|
getNodePath(node) {
|
|
151601
|
-
const
|
|
151910
|
+
const path29 = [];
|
|
151602
151911
|
while (node) {
|
|
151603
|
-
|
|
151912
|
+
path29.push(node);
|
|
151604
151913
|
node = node.parent;
|
|
151605
151914
|
}
|
|
151606
|
-
return
|
|
151915
|
+
return path29;
|
|
151607
151916
|
}
|
|
151608
151917
|
getViasInNodePath(node) {
|
|
151609
|
-
const
|
|
151918
|
+
const path29 = this.getNodePath(node);
|
|
151610
151919
|
const vias = [];
|
|
151611
|
-
for (let i = 0;i <
|
|
151612
|
-
if (
|
|
151613
|
-
vias.push({ x:
|
|
151920
|
+
for (let i = 0;i < path29.length - 1; i++) {
|
|
151921
|
+
if (path29[i].z !== path29[i + 1].z) {
|
|
151922
|
+
vias.push({ x: path29[i].x, y: path29[i].y });
|
|
151614
151923
|
}
|
|
151615
151924
|
}
|
|
151616
151925
|
return vias;
|
|
151617
151926
|
}
|
|
151618
151927
|
setSolvedPath(node) {
|
|
151619
|
-
const
|
|
151620
|
-
|
|
151928
|
+
const path29 = this.getNodePath(node);
|
|
151929
|
+
path29.reverse();
|
|
151621
151930
|
const vias = [];
|
|
151622
|
-
for (let i = 0;i <
|
|
151623
|
-
if (
|
|
151624
|
-
vias.push({ x:
|
|
151931
|
+
for (let i = 0;i < path29.length - 1; i++) {
|
|
151932
|
+
if (path29[i].z !== path29[i + 1].z) {
|
|
151933
|
+
vias.push({ x: path29[i].x, y: path29[i].y });
|
|
151625
151934
|
}
|
|
151626
151935
|
}
|
|
151627
151936
|
this.solvedPath = {
|
|
151628
151937
|
connectionName: this.connectionName,
|
|
151629
151938
|
traceThickness: this.traceThickness,
|
|
151630
151939
|
viaDiameter: this.viaDiameter,
|
|
151631
|
-
route:
|
|
151940
|
+
route: path29.map((node2) => ({ x: node2.x, y: node2.y, z: node2.z })).concat([this.B]),
|
|
151632
151941
|
vias
|
|
151633
151942
|
};
|
|
151634
151943
|
}
|
|
@@ -152367,14 +152676,14 @@ function computeDumbbellPaths({
|
|
|
152367
152676
|
const u3 = (dx2 * d1y - dy2 * d1x) / det;
|
|
152368
152677
|
return t3 > 0 && t3 < 1 && u3 > 0 && u3 < 1;
|
|
152369
152678
|
};
|
|
152370
|
-
const doPathsIntersect = (path1,
|
|
152679
|
+
const doPathsIntersect = (path1, path29) => {
|
|
152371
152680
|
const segments1 = [];
|
|
152372
152681
|
for (let i = 0;i < path1.length - 1; i++) {
|
|
152373
152682
|
segments1.push({ start: path1[i], end: path1[i + 1] });
|
|
152374
152683
|
}
|
|
152375
152684
|
const segments2 = [];
|
|
152376
|
-
for (let i = 0;i <
|
|
152377
|
-
segments2.push({ start:
|
|
152685
|
+
for (let i = 0;i < path29.length - 1; i++) {
|
|
152686
|
+
segments2.push({ start: path29[i], end: path29[i + 1] });
|
|
152378
152687
|
}
|
|
152379
152688
|
for (const seg1 of segments1) {
|
|
152380
152689
|
for (const seg2 of segments2) {
|
|
@@ -152436,12 +152745,12 @@ function computeDumbbellPaths({
|
|
|
152436
152745
|
specialType: circleCenter === A3 ? "A" : "B"
|
|
152437
152746
|
};
|
|
152438
152747
|
};
|
|
152439
|
-
const subdivideOptimalPath = (
|
|
152440
|
-
if (
|
|
152441
|
-
return
|
|
152442
|
-
const result = [
|
|
152443
|
-
for (let i = 0;i <
|
|
152444
|
-
const segment2 = { start:
|
|
152748
|
+
const subdivideOptimalPath = (path29, numSubdivisions) => {
|
|
152749
|
+
if (path29.length < 2)
|
|
152750
|
+
return path29;
|
|
152751
|
+
const result = [path29[0]];
|
|
152752
|
+
for (let i = 0;i < path29.length - 1; i++) {
|
|
152753
|
+
const segment2 = { start: path29[i], end: path29[i + 1] };
|
|
152445
152754
|
const segmentMidpoint = {
|
|
152446
152755
|
x: (segment2.start.x + segment2.end.x) / 2,
|
|
152447
152756
|
y: (segment2.start.y + segment2.end.y) / 2
|
|
@@ -152503,7 +152812,7 @@ function computeDumbbellPaths({
|
|
|
152503
152812
|
}
|
|
152504
152813
|
subdivisionPoints.forEach((p) => result.push(p));
|
|
152505
152814
|
}
|
|
152506
|
-
result.push(
|
|
152815
|
+
result.push(path29[i + 1]);
|
|
152507
152816
|
}
|
|
152508
152817
|
if (result.length > 1) {
|
|
152509
152818
|
const filteredResult = [result[0]];
|
|
@@ -152738,13 +153047,13 @@ function computeDumbbellPaths({
|
|
|
152738
153047
|
].map((l, index) => ({ ...l, index }));
|
|
152739
153048
|
};
|
|
152740
153049
|
const subdivideJLinePath = (jLine, oppositePoint, r3, m2, numSubdivisions) => {
|
|
152741
|
-
const
|
|
152742
|
-
if (
|
|
152743
|
-
return
|
|
153050
|
+
const path29 = jLine.points;
|
|
153051
|
+
if (path29.length < 2)
|
|
153052
|
+
return path29;
|
|
152744
153053
|
const minDistThreshold = r3 + m2;
|
|
152745
|
-
const result = [
|
|
152746
|
-
for (let i = 0;i <
|
|
152747
|
-
const segment2 = { start:
|
|
153054
|
+
const result = [path29[0]];
|
|
153055
|
+
for (let i = 0;i < path29.length - 1; i++) {
|
|
153056
|
+
const segment2 = { start: path29[i], end: path29[i + 1] };
|
|
152748
153057
|
const distToOpposite = pointToSegmentDistance22(oppositePoint, segment2.start, segment2.end);
|
|
152749
153058
|
if (distToOpposite < minDistThreshold) {
|
|
152750
153059
|
const closestPt = closestPointOnSegment(segment2, oppositePoint);
|
|
@@ -152794,18 +153103,18 @@ function computeDumbbellPaths({
|
|
|
152794
153103
|
const paths = getPaths();
|
|
152795
153104
|
const validPaths = [];
|
|
152796
153105
|
for (let i = 0;i < paths.length; i++) {
|
|
152797
|
-
const
|
|
152798
|
-
const firstSeg = { start:
|
|
153106
|
+
const path210 = paths[i];
|
|
153107
|
+
const firstSeg = { start: path210[0], end: path210[1] };
|
|
152799
153108
|
const lastSeg = {
|
|
152800
|
-
start:
|
|
152801
|
-
end:
|
|
153109
|
+
start: path210[path210.length - 2],
|
|
153110
|
+
end: path210[path210.length - 1]
|
|
152802
153111
|
};
|
|
152803
|
-
const midSeg = { start:
|
|
153112
|
+
const midSeg = { start: path210[3], end: path210[4] };
|
|
152804
153113
|
if (!intersect2(firstSeg, lastSeg) && !intersect2(firstSeg, midSeg) && !intersect2(lastSeg, midSeg)) {
|
|
152805
153114
|
validPaths.push({
|
|
152806
153115
|
index: i + 1,
|
|
152807
|
-
path:
|
|
152808
|
-
length: pathLength(
|
|
153116
|
+
path: path210,
|
|
153117
|
+
length: pathLength(path210)
|
|
152809
153118
|
});
|
|
152810
153119
|
}
|
|
152811
153120
|
}
|
|
@@ -152813,26 +153122,26 @@ function computeDumbbellPaths({
|
|
|
152813
153122
|
return { index: 0, path: [] };
|
|
152814
153123
|
}
|
|
152815
153124
|
const optimalPath2 = validPaths.sort((a, b3) => a.length - b3.length)[0];
|
|
152816
|
-
const
|
|
152817
|
-
const firstPoint =
|
|
152818
|
-
const dist3 = distance3(firstPoint,
|
|
152819
|
-
const dist4 = distance3(firstPoint,
|
|
153125
|
+
const path29 = [...optimalPath2.path];
|
|
153126
|
+
const firstPoint = path29[0];
|
|
153127
|
+
const dist3 = distance3(firstPoint, path29[2]);
|
|
153128
|
+
const dist4 = distance3(firstPoint, path29[3]);
|
|
152820
153129
|
const closerIdx = dist3 < dist4 ? 2 : 3;
|
|
152821
|
-
if (dist3 < distance3(firstPoint,
|
|
152822
|
-
|
|
153130
|
+
if (dist3 < distance3(firstPoint, path29[1]) || dist4 < distance3(firstPoint, path29[1])) {
|
|
153131
|
+
path29.splice(1, closerIdx - 1);
|
|
152823
153132
|
}
|
|
152824
|
-
const lastPoint =
|
|
152825
|
-
const distM3 = distance3(lastPoint,
|
|
152826
|
-
const distM4 = distance3(lastPoint,
|
|
152827
|
-
const closerLastIdx = distM3 < distM4 ?
|
|
152828
|
-
if (distM3 < distance3(lastPoint,
|
|
152829
|
-
|
|
153133
|
+
const lastPoint = path29[path29.length - 1];
|
|
153134
|
+
const distM3 = distance3(lastPoint, path29[path29.length - 3]);
|
|
153135
|
+
const distM4 = distance3(lastPoint, path29[path29.length - 4]);
|
|
153136
|
+
const closerLastIdx = distM3 < distM4 ? path29.length - 3 : path29.length - 4;
|
|
153137
|
+
if (distM3 < distance3(lastPoint, path29[path29.length - 2]) || distM4 < distance3(lastPoint, path29[path29.length - 2])) {
|
|
153138
|
+
path29.splice(closerLastIdx + 1, path29.length - closerLastIdx - 2);
|
|
152830
153139
|
}
|
|
152831
153140
|
return {
|
|
152832
153141
|
index: optimalPath2.index,
|
|
152833
|
-
path:
|
|
152834
|
-
startsAt:
|
|
152835
|
-
goesTo:
|
|
153142
|
+
path: path29,
|
|
153143
|
+
startsAt: path29[0] === C2 ? "C" : "D",
|
|
153144
|
+
goesTo: path29[path29.length - 1] === C2 ? "C" : "D"
|
|
152836
153145
|
};
|
|
152837
153146
|
};
|
|
152838
153147
|
const optimalPath = findOptimalPath();
|
|
@@ -154252,9 +154561,9 @@ var ViaPossibilitiesSolver2 = class extends BaseSolver {
|
|
|
154252
154561
|
let closestIntersection = null;
|
|
154253
154562
|
let intersectedSegmentZ = null;
|
|
154254
154563
|
const checkIntersectionsWithPathMap = (pathMap) => {
|
|
154255
|
-
for (const
|
|
154256
|
-
for (let i = 0;i <
|
|
154257
|
-
const segment2 = [
|
|
154564
|
+
for (const path29 of pathMap.values()) {
|
|
154565
|
+
for (let i = 0;i < path29.length - 1; i++) {
|
|
154566
|
+
const segment2 = [path29[i], path29[i + 1]];
|
|
154258
154567
|
if (segment2[0].x === segment2[1].x && segment2[0].y === segment2[1].y) {
|
|
154259
154568
|
continue;
|
|
154260
154569
|
}
|
|
@@ -154384,11 +154693,11 @@ var ViaPossibilitiesSolver2 = class extends BaseSolver {
|
|
|
154384
154693
|
});
|
|
154385
154694
|
}
|
|
154386
154695
|
const drawPath = (pathMap, labelPrefix) => {
|
|
154387
|
-
for (const [connectionName,
|
|
154696
|
+
for (const [connectionName, path29] of pathMap.entries()) {
|
|
154388
154697
|
const color = colorMap[connectionName] ?? "black";
|
|
154389
|
-
for (let i = 0;i <
|
|
154390
|
-
const p12 =
|
|
154391
|
-
const p2 =
|
|
154698
|
+
for (let i = 0;i < path29.length - 1; i++) {
|
|
154699
|
+
const p12 = path29[i];
|
|
154700
|
+
const p2 = path29[i + 1];
|
|
154392
154701
|
if (p12.x === p2.x && p12.y === p2.y && p12.z !== p2.z) {
|
|
154393
154702
|
graphics.circles.push({
|
|
154394
154703
|
center: { x: p12.x, y: p12.y },
|
|
@@ -154986,10 +155295,10 @@ function detectMultiConnectionClosedFacesWithoutVias(polyLines, bounds) {
|
|
|
154986
155295
|
const allSegments = [];
|
|
154987
155296
|
const viaPoints = /* @__PURE__ */ new Map;
|
|
154988
155297
|
for (const polyLine of polyLines) {
|
|
154989
|
-
const
|
|
154990
|
-
for (let i = 0;i <
|
|
154991
|
-
const p12 =
|
|
154992
|
-
const p2 =
|
|
155298
|
+
const path29 = [polyLine.start, ...polyLine.mPoints, polyLine.end];
|
|
155299
|
+
for (let i = 0;i < path29.length - 1; i++) {
|
|
155300
|
+
const p12 = path29[i];
|
|
155301
|
+
const p2 = path29[i + 1];
|
|
154993
155302
|
const layer = p12.z2;
|
|
154994
155303
|
allSegments.push({
|
|
154995
155304
|
start: { x: p12.x, y: p12.y },
|
|
@@ -155007,7 +155316,7 @@ function detectMultiConnectionClosedFacesWithoutVias(polyLines, bounds) {
|
|
|
155007
155316
|
}
|
|
155008
155317
|
}
|
|
155009
155318
|
}
|
|
155010
|
-
const lastPoint =
|
|
155319
|
+
const lastPoint = path29[path29.length - 1];
|
|
155011
155320
|
if (lastPoint.z1 !== lastPoint.z2) {
|
|
155012
155321
|
const key = pointKey2(lastPoint);
|
|
155013
155322
|
if (!viaPoints.has(key)) {
|
|
@@ -155306,14 +155615,14 @@ var MultiHeadPolyLineIntraNodeSolver = class extends BaseSolver {
|
|
|
155306
155615
|
const polyLineVias = [];
|
|
155307
155616
|
for (let i = 0;i < polyLines.length; i++) {
|
|
155308
155617
|
const polyLine = polyLines[i];
|
|
155309
|
-
const
|
|
155618
|
+
const path29 = [polyLine.start, ...polyLine.mPoints, polyLine.end];
|
|
155310
155619
|
const segmentsByLayer = new Map(this.availableZ.map((z852) => [z852, []]));
|
|
155311
|
-
for (let i22 = 0;i22 <
|
|
155312
|
-
const segment2 = [
|
|
155620
|
+
for (let i22 = 0;i22 < path29.length - 1; i22++) {
|
|
155621
|
+
const segment2 = [path29[i22], path29[i22 + 1]];
|
|
155313
155622
|
segmentsByLayer.get(segment2[0].z2).push(segment2);
|
|
155314
155623
|
}
|
|
155315
155624
|
polyLineSegmentsByLayer.push(segmentsByLayer);
|
|
155316
|
-
polyLineVias.push(
|
|
155625
|
+
polyLineVias.push(path29.filter((p) => p.z1 !== p.z2));
|
|
155317
155626
|
}
|
|
155318
155627
|
for (let i = 0;i < polyLines.length; i++) {
|
|
155319
155628
|
const path1SegmentsByLayer = polyLineSegmentsByLayer[i];
|
|
@@ -156742,7 +157051,7 @@ var HighDensitySolver = class extends BaseSolver {
|
|
|
156742
157051
|
if (this.failedSolvers.length > 0) {
|
|
156743
157052
|
this.solved = false;
|
|
156744
157053
|
this.failed = true;
|
|
156745
|
-
this.error = `Failed to solve ${this.failedSolvers.length} nodes, ${this.failedSolvers.slice(0, 5).map((
|
|
157054
|
+
this.error = `Failed to solve ${this.failedSolvers.length} nodes, ${this.failedSolvers.slice(0, 5).map((fs30) => fs30.nodeWithPortPoints.capacityMeshNodeId)}. err0: ${this.failedSolvers[0].error}.`;
|
|
156746
157055
|
return;
|
|
156747
157056
|
}
|
|
156748
157057
|
this.solved = true;
|
|
@@ -159523,13 +159832,13 @@ var CapacityPathingSolver = class extends BaseSolver {
|
|
|
159523
159832
|
return this.getDistanceBetweenNodes(node, endGoal);
|
|
159524
159833
|
}
|
|
159525
159834
|
getBacktrackedPath(candidate) {
|
|
159526
|
-
const
|
|
159835
|
+
const path29 = [];
|
|
159527
159836
|
let currentCandidate = candidate;
|
|
159528
159837
|
while (currentCandidate) {
|
|
159529
|
-
|
|
159838
|
+
path29.push(currentCandidate.node);
|
|
159530
159839
|
currentCandidate = currentCandidate.prevCandidate;
|
|
159531
159840
|
}
|
|
159532
|
-
return
|
|
159841
|
+
return path29;
|
|
159533
159842
|
}
|
|
159534
159843
|
getNeighboringNodes(node) {
|
|
159535
159844
|
return this.nodeEdgeMap.get(node.capacityMeshNodeId).flatMap((edge) => edge.nodeIds.filter((n3) => n3 !== node.capacityMeshNodeId)).map((n3) => this.nodeMap.get(n3));
|
|
@@ -159537,12 +159846,12 @@ var CapacityPathingSolver = class extends BaseSolver {
|
|
|
159537
159846
|
getCapacityPaths() {
|
|
159538
159847
|
const capacityPaths = [];
|
|
159539
159848
|
for (const connection of this.connectionsWithNodes) {
|
|
159540
|
-
const
|
|
159541
|
-
if (
|
|
159849
|
+
const path29 = connection.path;
|
|
159850
|
+
if (path29) {
|
|
159542
159851
|
capacityPaths.push({
|
|
159543
159852
|
capacityPathId: connection.connection.name,
|
|
159544
159853
|
connectionName: connection.connection.name,
|
|
159545
|
-
nodeIds:
|
|
159854
|
+
nodeIds: path29.map((node) => node.capacityMeshNodeId)
|
|
159546
159855
|
});
|
|
159547
159856
|
}
|
|
159548
159857
|
}
|
|
@@ -160227,10 +160536,10 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
|
|
|
160227
160536
|
return this.getDistanceBetweenNodes(node, endGoal) + this.getNodeCapacityPenalty(node);
|
|
160228
160537
|
}
|
|
160229
160538
|
getBacktrackedPath(candidate) {
|
|
160230
|
-
const
|
|
160539
|
+
const path29 = [];
|
|
160231
160540
|
let currentCandidate = candidate;
|
|
160232
160541
|
while (currentCandidate) {
|
|
160233
|
-
|
|
160542
|
+
path29.push(currentCandidate.node);
|
|
160234
160543
|
if (this.nodeMap.has(currentCandidate.node.capacityMeshNodeId)) {
|
|
160235
160544
|
currentCandidate = currentCandidate.prevCandidate;
|
|
160236
160545
|
} else {
|
|
@@ -160238,7 +160547,7 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
|
|
|
160238
160547
|
break;
|
|
160239
160548
|
}
|
|
160240
160549
|
}
|
|
160241
|
-
return
|
|
160550
|
+
return path29.reverse();
|
|
160242
160551
|
}
|
|
160243
160552
|
getNeighboringNodes(node) {
|
|
160244
160553
|
if (!this.nodeMap.has(node.capacityMeshNodeId))
|
|
@@ -160253,8 +160562,8 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
|
|
|
160253
160562
|
doesNodeHaveCapacityForTrace(node, prevNode) {
|
|
160254
160563
|
return true;
|
|
160255
160564
|
}
|
|
160256
|
-
reduceCapacityAlongPath(
|
|
160257
|
-
for (const pathNode of
|
|
160565
|
+
reduceCapacityAlongPath(path29) {
|
|
160566
|
+
for (const pathNode of path29) {
|
|
160258
160567
|
if (this.usedNodeCapacityMap.has(pathNode.capacityMeshNodeId)) {
|
|
160259
160568
|
const nodeId = pathNode.capacityMeshNodeId;
|
|
160260
160569
|
const nodeInSection = this.nodeMap.get(nodeId);
|
|
@@ -160383,9 +160692,9 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
|
|
|
160383
160692
|
this.queuedNodes = null;
|
|
160384
160693
|
}
|
|
160385
160694
|
_handleGoalReached(currentCandidate, currentTerminal, endNode) {
|
|
160386
|
-
const
|
|
160387
|
-
currentTerminal.path =
|
|
160388
|
-
this.reduceCapacityAlongPath(
|
|
160695
|
+
const path29 = this.getBacktrackedPath(currentCandidate);
|
|
160696
|
+
currentTerminal.path = path29;
|
|
160697
|
+
this.reduceCapacityAlongPath(path29);
|
|
160389
160698
|
this.currentConnectionIndex++;
|
|
160390
160699
|
this.candidates = null;
|
|
160391
160700
|
this.visitedNodes = null;
|
|
@@ -160434,10 +160743,10 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
|
|
|
160434
160743
|
const connectionColor = this.colorMap[connectionName] ?? "purple";
|
|
160435
160744
|
topCandidates.forEach((candidate, index) => {
|
|
160436
160745
|
const opacity = 0.8 * (1 - index / 5);
|
|
160437
|
-
const
|
|
160438
|
-
if (
|
|
160746
|
+
const path29 = this.getBacktrackedPath(candidate);
|
|
160747
|
+
if (path29.length > 0) {
|
|
160439
160748
|
baseGraphics.lines.push({
|
|
160440
|
-
points:
|
|
160749
|
+
points: path29.map(({ center: { x, y } }) => ({ x, y })),
|
|
160441
160750
|
strokeColor: safeTransparentize(connectionColor, 1 - opacity),
|
|
160442
160751
|
strokeWidth: 0.05
|
|
160443
160752
|
});
|
|
@@ -161126,12 +161435,12 @@ var CapacityPathingMultiSectionSolver = class extends BaseSolver {
|
|
|
161126
161435
|
getCapacityPaths() {
|
|
161127
161436
|
const capacityPaths = [];
|
|
161128
161437
|
for (const connection of this.connectionsWithNodes) {
|
|
161129
|
-
const
|
|
161130
|
-
if (
|
|
161438
|
+
const path29 = connection.path;
|
|
161439
|
+
if (path29) {
|
|
161131
161440
|
capacityPaths.push({
|
|
161132
161441
|
capacityPathId: connection.connection.name,
|
|
161133
161442
|
connectionName: connection.connection.name,
|
|
161134
|
-
nodeIds:
|
|
161443
|
+
nodeIds: path29.map((node) => node.capacityMeshNodeId)
|
|
161135
161444
|
});
|
|
161136
161445
|
}
|
|
161137
161446
|
}
|
|
@@ -162152,22 +162461,22 @@ var SingleSimplifiedPathSolver5 = class extends SingleSimplifiedPathSolver {
|
|
|
162152
162461
|
return null;
|
|
162153
162462
|
}
|
|
162154
162463
|
const possiblePaths = calculate45DegreePaths({ x: start.x, y: start.y }, { x: end.x, y: end.y });
|
|
162155
|
-
for (const
|
|
162156
|
-
const fullPath =
|
|
162464
|
+
for (const path29 of possiblePaths) {
|
|
162465
|
+
const fullPath = path29.map((p) => ({ x: p.x, y: p.y, z: start.z }));
|
|
162157
162466
|
if (this.isValidPath(fullPath)) {
|
|
162158
162467
|
return fullPath;
|
|
162159
162468
|
}
|
|
162160
162469
|
}
|
|
162161
162470
|
return null;
|
|
162162
162471
|
}
|
|
162163
|
-
addPathToResult(
|
|
162164
|
-
if (
|
|
162472
|
+
addPathToResult(path29) {
|
|
162473
|
+
if (path29.length === 0)
|
|
162165
162474
|
return;
|
|
162166
|
-
for (let i = 0;i <
|
|
162167
|
-
if (i === 0 && this.newRoute.length > 0 && this.arePointsEqual(this.newRoute[this.newRoute.length - 1],
|
|
162475
|
+
for (let i = 0;i < path29.length; i++) {
|
|
162476
|
+
if (i === 0 && this.newRoute.length > 0 && this.arePointsEqual(this.newRoute[this.newRoute.length - 1], path29[i])) {
|
|
162168
162477
|
continue;
|
|
162169
162478
|
}
|
|
162170
|
-
this.newRoute.push(
|
|
162479
|
+
this.newRoute.push(path29[i]);
|
|
162171
162480
|
}
|
|
162172
162481
|
this.currentStepSize = this.maxStepSize;
|
|
162173
162482
|
}
|
|
@@ -189574,7 +189883,7 @@ var Trace_doInitialSchematicTraceRender = (trace) => {
|
|
|
189574
189883
|
for (let i = 0;i < portsWithPosition.length - 1; i++) {
|
|
189575
189884
|
const start = portsWithPosition[i];
|
|
189576
189885
|
const end = portsWithPosition[i + 1];
|
|
189577
|
-
const
|
|
189886
|
+
const path29 = calculateElbow({
|
|
189578
189887
|
x: start.position.x,
|
|
189579
189888
|
y: start.position.y,
|
|
189580
189889
|
facingDirection: convertFacingDirectionToElbowDirection(start.facingDirection)
|
|
@@ -189583,8 +189892,8 @@ var Trace_doInitialSchematicTraceRender = (trace) => {
|
|
|
189583
189892
|
y: end.position.y,
|
|
189584
189893
|
facingDirection: convertFacingDirectionToElbowDirection(end.facingDirection)
|
|
189585
189894
|
});
|
|
189586
|
-
for (let j4 = 0;j4 <
|
|
189587
|
-
elbowEdges.push({ from:
|
|
189895
|
+
for (let j4 = 0;j4 < path29.length - 1; j4++) {
|
|
189896
|
+
elbowEdges.push({ from: path29[j4], to: path29[j4 + 1] });
|
|
189588
189897
|
}
|
|
189589
189898
|
}
|
|
189590
189899
|
const doesSegmentIntersectRect = (edge, rect) => {
|
|
@@ -192444,7 +192753,7 @@ var Group = class extends NormalComponent {
|
|
|
192444
192753
|
});
|
|
192445
192754
|
throw err;
|
|
192446
192755
|
}
|
|
192447
|
-
await new Promise((
|
|
192756
|
+
await new Promise((resolve12) => setTimeout(resolve12, 100));
|
|
192448
192757
|
}
|
|
192449
192758
|
}
|
|
192450
192759
|
async _runLocalAutorouting() {
|
|
@@ -192477,10 +192786,10 @@ var Group = class extends NormalComponent {
|
|
|
192477
192786
|
targetMinCapacity: this.props.autorouter?.targetMinCapacity
|
|
192478
192787
|
});
|
|
192479
192788
|
}
|
|
192480
|
-
const routingPromise = new Promise((
|
|
192789
|
+
const routingPromise = new Promise((resolve12, reject) => {
|
|
192481
192790
|
autorouter.on("complete", (event) => {
|
|
192482
192791
|
debug622(`[${this.getString()}] local autorouting complete`);
|
|
192483
|
-
|
|
192792
|
+
resolve12(event.traces);
|
|
192484
192793
|
});
|
|
192485
192794
|
autorouter.on("error", (event) => {
|
|
192486
192795
|
debug622(`[${this.getString()}] local autorouting error: ${event.error.message}`);
|
|
@@ -195772,8 +196081,8 @@ react/cjs/react-jsx-runtime.development.js:
|
|
|
195772
196081
|
*/
|
|
195773
196082
|
|
|
195774
196083
|
// lib/import/import-component-from-jlcpcb.ts
|
|
195775
|
-
import
|
|
195776
|
-
import
|
|
196084
|
+
import fs30 from "node:fs/promises";
|
|
196085
|
+
import path29 from "node:path";
|
|
195777
196086
|
var importComponentFromJlcpcb = async (jlcpcbPartNumber, projectDir = process.cwd()) => {
|
|
195778
196087
|
const component = await fetchEasyEDAComponent(jlcpcbPartNumber);
|
|
195779
196088
|
const tsx = await convertRawEasyToTsx(component);
|
|
@@ -195781,10 +196090,10 @@ var importComponentFromJlcpcb = async (jlcpcbPartNumber, projectDir = process.cw
|
|
|
195781
196090
|
if (!fileName) {
|
|
195782
196091
|
throw new Error("Could not determine file name of converted component");
|
|
195783
196092
|
}
|
|
195784
|
-
const importsDir =
|
|
195785
|
-
await
|
|
195786
|
-
const filePath =
|
|
195787
|
-
await
|
|
196093
|
+
const importsDir = path29.join(projectDir, "imports");
|
|
196094
|
+
await fs30.mkdir(importsDir, { recursive: true });
|
|
196095
|
+
const filePath = path29.join(importsDir, `${fileName}.tsx`);
|
|
196096
|
+
await fs30.writeFile(filePath, tsx);
|
|
195788
196097
|
return { filePath };
|
|
195789
196098
|
};
|
|
195790
196099
|
|
|
@@ -195885,12 +196194,12 @@ var registerRemove = (program3) => {
|
|
|
195885
196194
|
};
|
|
195886
196195
|
|
|
195887
196196
|
// cli/build/register.ts
|
|
195888
|
-
import
|
|
195889
|
-
import
|
|
196197
|
+
import path36 from "node:path";
|
|
196198
|
+
import fs37 from "node:fs";
|
|
195890
196199
|
|
|
195891
196200
|
// cli/build/build-file.ts
|
|
195892
|
-
import
|
|
195893
|
-
import
|
|
196201
|
+
import path30 from "node:path";
|
|
196202
|
+
import fs31 from "node:fs";
|
|
195894
196203
|
|
|
195895
196204
|
// lib/shared/circuit-json-diagnostics.ts
|
|
195896
196205
|
function analyzeCircuitJson(circuitJson) {
|
|
@@ -195922,9 +196231,9 @@ var buildFile = async (input, output, projectDir, options) => {
|
|
|
195922
196231
|
filePath: input,
|
|
195923
196232
|
platformConfig: options?.platformConfig
|
|
195924
196233
|
});
|
|
195925
|
-
|
|
195926
|
-
|
|
195927
|
-
console.log(`Circuit JSON written to ${
|
|
196234
|
+
fs31.mkdirSync(path30.dirname(output), { recursive: true });
|
|
196235
|
+
fs31.writeFileSync(output, JSON.stringify(result.circuitJson, null, 2));
|
|
196236
|
+
console.log(`Circuit JSON written to ${path30.relative(projectDir, output)}`);
|
|
195928
196237
|
const { errors, warnings } = analyzeCircuitJson(result.circuitJson);
|
|
195929
196238
|
if (!options?.ignoreWarnings) {
|
|
195930
196239
|
for (const warn of warnings) {
|
|
@@ -195955,17 +196264,17 @@ var buildFile = async (input, output, projectDir, options) => {
|
|
|
195955
196264
|
};
|
|
195956
196265
|
|
|
195957
196266
|
// cli/build/get-build-entrypoints.ts
|
|
195958
|
-
import
|
|
195959
|
-
import
|
|
196267
|
+
import fs32 from "node:fs";
|
|
196268
|
+
import path31 from "node:path";
|
|
195960
196269
|
var isSubPath2 = (maybeChild, maybeParent) => {
|
|
195961
|
-
const relative9 =
|
|
195962
|
-
return relative9 === "" || !relative9.startsWith("..") && !
|
|
196270
|
+
const relative9 = path31.relative(maybeParent, maybeChild);
|
|
196271
|
+
return relative9 === "" || !relative9.startsWith("..") && !path31.isAbsolute(relative9);
|
|
195963
196272
|
};
|
|
195964
196273
|
async function getBuildEntrypoints({
|
|
195965
196274
|
fileOrDir,
|
|
195966
196275
|
rootDir = process.cwd()
|
|
195967
196276
|
}) {
|
|
195968
|
-
const resolvedRoot =
|
|
196277
|
+
const resolvedRoot = path31.resolve(rootDir);
|
|
195969
196278
|
const includeBoardFiles = getBoardFilePatterns(resolvedRoot);
|
|
195970
196279
|
const buildFromProjectDir = async () => {
|
|
195971
196280
|
const files = findBoardFiles({ projectDir: resolvedRoot });
|
|
@@ -195997,8 +196306,8 @@ async function getBuildEntrypoints({
|
|
|
195997
196306
|
};
|
|
195998
196307
|
};
|
|
195999
196308
|
if (fileOrDir) {
|
|
196000
|
-
const resolved =
|
|
196001
|
-
if (
|
|
196309
|
+
const resolved = path31.resolve(resolvedRoot, fileOrDir);
|
|
196310
|
+
if (fs32.existsSync(resolved) && fs32.statSync(resolved).isDirectory()) {
|
|
196002
196311
|
const circuitFiles = findBoardFiles({
|
|
196003
196312
|
projectDir: resolvedRoot,
|
|
196004
196313
|
filePaths: [resolved]
|
|
@@ -196011,7 +196320,7 @@ async function getBuildEntrypoints({
|
|
|
196011
196320
|
circuitFiles
|
|
196012
196321
|
};
|
|
196013
196322
|
}
|
|
196014
|
-
return { projectDir:
|
|
196323
|
+
return { projectDir: path31.dirname(resolved), circuitFiles: [resolved] };
|
|
196015
196324
|
}
|
|
196016
196325
|
return buildFromProjectDir();
|
|
196017
196326
|
}
|
|
@@ -196045,8 +196354,8 @@ ${scriptBlock} <script src="https://cdn.tailwindcss.com"></script>
|
|
|
196045
196354
|
};
|
|
196046
196355
|
|
|
196047
196356
|
// cli/build/build-preview-images.ts
|
|
196048
|
-
import
|
|
196049
|
-
import
|
|
196357
|
+
import fs33 from "node:fs";
|
|
196358
|
+
import path32 from "node:path";
|
|
196050
196359
|
import {
|
|
196051
196360
|
convertCircuitJsonToPcbSvg as convertCircuitJsonToPcbSvg2,
|
|
196052
196361
|
convertCircuitJsonToSchematicSvg as convertCircuitJsonToSchematicSvg2
|
|
@@ -196091,10 +196400,10 @@ var generatePreviewAssets = async ({
|
|
|
196091
196400
|
outputDir,
|
|
196092
196401
|
distDir
|
|
196093
196402
|
}) => {
|
|
196094
|
-
const prefixRelative =
|
|
196403
|
+
const prefixRelative = path32.relative(distDir, outputDir) || ".";
|
|
196095
196404
|
const prefix = prefixRelative === "." ? "" : `[${prefixRelative}] `;
|
|
196096
196405
|
try {
|
|
196097
|
-
const circuitJsonRaw =
|
|
196406
|
+
const circuitJsonRaw = fs33.readFileSync(build.outputPath, "utf-8");
|
|
196098
196407
|
const circuitJson = JSON.parse(circuitJsonRaw);
|
|
196099
196408
|
console.log(`${prefix}Generating PCB SVG...`);
|
|
196100
196409
|
const pcbSvg = convertCircuitJsonToPcbSvg2(circuitJson);
|
|
@@ -196110,12 +196419,12 @@ var generatePreviewAssets = async ({
|
|
|
196110
196419
|
camPos: [10, 10, 10],
|
|
196111
196420
|
lookAt: [0, 0, 0]
|
|
196112
196421
|
});
|
|
196113
|
-
|
|
196114
|
-
|
|
196422
|
+
fs33.mkdirSync(outputDir, { recursive: true });
|
|
196423
|
+
fs33.writeFileSync(path32.join(outputDir, "pcb.svg"), pcbSvg, "utf-8");
|
|
196115
196424
|
console.log(`${prefix}Written pcb.svg`);
|
|
196116
|
-
|
|
196425
|
+
fs33.writeFileSync(path32.join(outputDir, "schematic.svg"), schematicSvg, "utf-8");
|
|
196117
196426
|
console.log(`${prefix}Written schematic.svg`);
|
|
196118
|
-
|
|
196427
|
+
fs33.writeFileSync(path32.join(outputDir, "3d.png"), Buffer.from(normalizeToUint8Array(pngBuffer)));
|
|
196119
196428
|
console.log(`${prefix}Written 3d.png`);
|
|
196120
196429
|
} catch (error) {
|
|
196121
196430
|
console.error(`${prefix}Failed to generate preview images:`, error);
|
|
@@ -196128,14 +196437,14 @@ var buildPreviewImages = async ({
|
|
|
196128
196437
|
allImages
|
|
196129
196438
|
}) => {
|
|
196130
196439
|
const successfulBuilds = builtFiles.filter((file) => file.ok);
|
|
196131
|
-
const normalizedMainEntrypoint = mainEntrypoint ?
|
|
196440
|
+
const normalizedMainEntrypoint = mainEntrypoint ? path32.resolve(mainEntrypoint) : undefined;
|
|
196132
196441
|
if (allImages) {
|
|
196133
196442
|
if (successfulBuilds.length === 0) {
|
|
196134
196443
|
console.warn("No successful build output available for preview image generation.");
|
|
196135
196444
|
return;
|
|
196136
196445
|
}
|
|
196137
196446
|
for (const build of successfulBuilds) {
|
|
196138
|
-
const outputDir =
|
|
196447
|
+
const outputDir = path32.dirname(build.outputPath);
|
|
196139
196448
|
await generatePreviewAssets({
|
|
196140
196449
|
build,
|
|
196141
196450
|
outputDir,
|
|
@@ -196146,7 +196455,7 @@ var buildPreviewImages = async ({
|
|
|
196146
196455
|
}
|
|
196147
196456
|
const previewBuild = (() => {
|
|
196148
196457
|
if (normalizedMainEntrypoint) {
|
|
196149
|
-
const match = successfulBuilds.find((built) =>
|
|
196458
|
+
const match = successfulBuilds.find((built) => path32.resolve(built.sourcePath) === normalizedMainEntrypoint);
|
|
196150
196459
|
if (match)
|
|
196151
196460
|
return match;
|
|
196152
196461
|
}
|
|
@@ -196164,8 +196473,8 @@ var buildPreviewImages = async ({
|
|
|
196164
196473
|
};
|
|
196165
196474
|
|
|
196166
196475
|
// cli/build/generate-kicad-project.ts
|
|
196167
|
-
import
|
|
196168
|
-
import
|
|
196476
|
+
import fs34 from "node:fs";
|
|
196477
|
+
import path33 from "node:path";
|
|
196169
196478
|
var createKicadProContent = ({
|
|
196170
196479
|
projectName,
|
|
196171
196480
|
schematicFileName,
|
|
@@ -196205,10 +196514,10 @@ var generateKicadProject = async ({
|
|
|
196205
196514
|
boardFileName
|
|
196206
196515
|
});
|
|
196207
196516
|
if (writeFiles) {
|
|
196208
|
-
|
|
196209
|
-
|
|
196210
|
-
|
|
196211
|
-
|
|
196517
|
+
fs34.mkdirSync(outputDir, { recursive: true });
|
|
196518
|
+
fs34.writeFileSync(path33.join(outputDir, schematicFileName), schContent);
|
|
196519
|
+
fs34.writeFileSync(path33.join(outputDir, boardFileName), pcbContent);
|
|
196520
|
+
fs34.writeFileSync(path33.join(outputDir, projectFileName), proContent);
|
|
196212
196521
|
}
|
|
196213
196522
|
return {
|
|
196214
196523
|
pcbContent,
|
|
@@ -196220,8 +196529,8 @@ var generateKicadProject = async ({
|
|
|
196220
196529
|
};
|
|
196221
196530
|
|
|
196222
196531
|
// cli/build/generate-kicad-footprint-library.ts
|
|
196223
|
-
import
|
|
196224
|
-
import
|
|
196532
|
+
import fs35 from "node:fs";
|
|
196533
|
+
import path34 from "node:path";
|
|
196225
196534
|
var sanitizeLibraryAndFootprintName = (libraryLink) => {
|
|
196226
196535
|
if (!libraryLink) {
|
|
196227
196536
|
return {
|
|
@@ -196280,8 +196589,8 @@ var generateKicadFootprintLibrary = async ({
|
|
|
196280
196589
|
projects,
|
|
196281
196590
|
distDir
|
|
196282
196591
|
}) => {
|
|
196283
|
-
const libraryRoot =
|
|
196284
|
-
|
|
196592
|
+
const libraryRoot = path34.join(distDir, "kicad-footprints");
|
|
196593
|
+
fs35.mkdirSync(libraryRoot, { recursive: true });
|
|
196285
196594
|
const uniqueFootprints = new Map;
|
|
196286
196595
|
for (const project of projects) {
|
|
196287
196596
|
try {
|
|
@@ -196304,10 +196613,10 @@ var generateKicadFootprintLibrary = async ({
|
|
|
196304
196613
|
const libraryNames = new Set;
|
|
196305
196614
|
for (const entry of uniqueFootprints.values()) {
|
|
196306
196615
|
libraryNames.add(entry.libraryName);
|
|
196307
|
-
const libraryDir =
|
|
196308
|
-
|
|
196309
|
-
const footprintPath =
|
|
196310
|
-
|
|
196616
|
+
const libraryDir = path34.join(libraryRoot, `${entry.libraryName}.pretty`);
|
|
196617
|
+
fs35.mkdirSync(libraryDir, { recursive: true });
|
|
196618
|
+
const footprintPath = path34.join(libraryDir, `${entry.footprintName}.kicad_mod`);
|
|
196619
|
+
fs35.writeFileSync(footprintPath, `${entry.content}
|
|
196311
196620
|
`);
|
|
196312
196621
|
}
|
|
196313
196622
|
if (libraryNames.size > 0) {
|
|
@@ -196317,16 +196626,16 @@ ${libTableEntries.join(`
|
|
|
196317
196626
|
`)}
|
|
196318
196627
|
)
|
|
196319
196628
|
`;
|
|
196320
|
-
|
|
196629
|
+
fs35.writeFileSync(path34.join(libraryRoot, "fp-lib-table"), libTableContent);
|
|
196321
196630
|
}
|
|
196322
196631
|
};
|
|
196323
196632
|
|
|
196324
196633
|
// cli/build/transpile.ts
|
|
196325
|
-
import
|
|
196326
|
-
import
|
|
196634
|
+
import path35 from "node:path";
|
|
196635
|
+
import fs36 from "node:fs";
|
|
196327
196636
|
import { rollup } from "rollup";
|
|
196328
196637
|
import typescript from "@rollup/plugin-typescript";
|
|
196329
|
-
import
|
|
196638
|
+
import resolve12 from "@rollup/plugin-node-resolve";
|
|
196330
196639
|
import commonjs from "@rollup/plugin-commonjs";
|
|
196331
196640
|
import json from "@rollup/plugin-json";
|
|
196332
196641
|
import dts from "rollup-plugin-dts";
|
|
@@ -196336,7 +196645,7 @@ var transpileFile = async ({
|
|
|
196336
196645
|
projectDir
|
|
196337
196646
|
}) => {
|
|
196338
196647
|
try {
|
|
196339
|
-
|
|
196648
|
+
fs36.mkdirSync(outputDir, { recursive: true });
|
|
196340
196649
|
console.log("Building ESM bundle...");
|
|
196341
196650
|
const esmBundle = await rollup({
|
|
196342
196651
|
input,
|
|
@@ -196344,7 +196653,7 @@ var transpileFile = async ({
|
|
|
196344
196653
|
return !id2.startsWith(".") && !id2.startsWith("/");
|
|
196345
196654
|
},
|
|
196346
196655
|
plugins: [
|
|
196347
|
-
|
|
196656
|
+
resolve12({
|
|
196348
196657
|
extensions: [".ts", ".tsx", ".js", ".jsx"]
|
|
196349
196658
|
}),
|
|
196350
196659
|
commonjs(),
|
|
@@ -196366,11 +196675,11 @@ var transpileFile = async ({
|
|
|
196366
196675
|
]
|
|
196367
196676
|
});
|
|
196368
196677
|
await esmBundle.write({
|
|
196369
|
-
file:
|
|
196678
|
+
file: path35.join(outputDir, "index.js"),
|
|
196370
196679
|
format: "es",
|
|
196371
196680
|
sourcemap: false
|
|
196372
196681
|
});
|
|
196373
|
-
console.log(`ESM bundle written to ${
|
|
196682
|
+
console.log(`ESM bundle written to ${path35.relative(projectDir, path35.join(outputDir, "index.js"))}`);
|
|
196374
196683
|
console.log("Building CommonJS bundle...");
|
|
196375
196684
|
const cjsBundle = await rollup({
|
|
196376
196685
|
input,
|
|
@@ -196378,7 +196687,7 @@ var transpileFile = async ({
|
|
|
196378
196687
|
return !id2.startsWith(".") && !id2.startsWith("/");
|
|
196379
196688
|
},
|
|
196380
196689
|
plugins: [
|
|
196381
|
-
|
|
196690
|
+
resolve12({
|
|
196382
196691
|
extensions: [".ts", ".tsx", ".js", ".jsx"]
|
|
196383
196692
|
}),
|
|
196384
196693
|
commonjs(),
|
|
@@ -196400,11 +196709,11 @@ var transpileFile = async ({
|
|
|
196400
196709
|
]
|
|
196401
196710
|
});
|
|
196402
196711
|
await cjsBundle.write({
|
|
196403
|
-
file:
|
|
196712
|
+
file: path35.join(outputDir, "index.cjs"),
|
|
196404
196713
|
format: "cjs",
|
|
196405
196714
|
sourcemap: false
|
|
196406
196715
|
});
|
|
196407
|
-
console.log(`CommonJS bundle written to ${
|
|
196716
|
+
console.log(`CommonJS bundle written to ${path35.relative(projectDir, path35.join(outputDir, "index.cjs"))}`);
|
|
196408
196717
|
console.log("Generating type declarations...");
|
|
196409
196718
|
const dtsBundle = await rollup({
|
|
196410
196719
|
input,
|
|
@@ -196424,8 +196733,8 @@ var transpileFile = async ({
|
|
|
196424
196733
|
dtsContent = dtsContent.replace(/import \* as [\w_]+ from ['"]react\/jsx-runtime['"];?\s*\n?/g, "");
|
|
196425
196734
|
dtsContent = dtsContent.replace(/[\w_]+\.JSX\.Element/g, "any");
|
|
196426
196735
|
dtsContent = dtsContent.replace(/export\s*{\s*};\s*$/gm, "").trim();
|
|
196427
|
-
|
|
196428
|
-
console.log(`Type declarations written to ${
|
|
196736
|
+
fs36.writeFileSync(path35.join(outputDir, "index.d.ts"), dtsContent);
|
|
196737
|
+
console.log(`Type declarations written to ${path35.relative(projectDir, path35.join(outputDir, "index.d.ts"))}`);
|
|
196429
196738
|
console.log(kleur_default.green("Transpilation complete!"));
|
|
196430
196739
|
return true;
|
|
196431
196740
|
} catch (err) {
|
|
@@ -196456,8 +196765,8 @@ var registerBuild = (program3) => {
|
|
|
196456
196765
|
}
|
|
196457
196766
|
return config;
|
|
196458
196767
|
})();
|
|
196459
|
-
const distDir =
|
|
196460
|
-
|
|
196768
|
+
const distDir = path36.join(projectDir, "dist");
|
|
196769
|
+
fs37.mkdirSync(distDir, { recursive: true });
|
|
196461
196770
|
console.log(`Building ${circuitFiles.length} file(s)...`);
|
|
196462
196771
|
let hasErrors = false;
|
|
196463
196772
|
const staticFileReferences = [];
|
|
@@ -196465,10 +196774,10 @@ var registerBuild = (program3) => {
|
|
|
196465
196774
|
const kicadProjects = [];
|
|
196466
196775
|
const shouldGenerateKicad = options?.kicad || options?.kicadFootprintLibrary;
|
|
196467
196776
|
for (const filePath of circuitFiles) {
|
|
196468
|
-
const relative9 =
|
|
196777
|
+
const relative9 = path36.relative(projectDir, filePath);
|
|
196469
196778
|
console.log(`Building ${relative9}...`);
|
|
196470
196779
|
const outputDirName = relative9.replace(/(\.board|\.circuit)?\.tsx$/, "");
|
|
196471
|
-
const outputPath =
|
|
196780
|
+
const outputPath = path36.join(distDir, outputDirName, "circuit.json");
|
|
196472
196781
|
const buildOutcome = await buildFile(filePath, outputPath, projectDir, {
|
|
196473
196782
|
ignoreErrors: options?.ignoreErrors,
|
|
196474
196783
|
ignoreWarnings: options?.ignoreWarnings,
|
|
@@ -196482,17 +196791,17 @@ var registerBuild = (program3) => {
|
|
|
196482
196791
|
if (!buildOutcome.ok) {
|
|
196483
196792
|
hasErrors = true;
|
|
196484
196793
|
} else if (options?.site) {
|
|
196485
|
-
const normalizedSourcePath = relative9.split(
|
|
196486
|
-
const relativeOutputPath =
|
|
196487
|
-
const normalizedOutputPath = relativeOutputPath.split(
|
|
196794
|
+
const normalizedSourcePath = relative9.split(path36.sep).join("/");
|
|
196795
|
+
const relativeOutputPath = path36.join(outputDirName, "circuit.json");
|
|
196796
|
+
const normalizedOutputPath = relativeOutputPath.split(path36.sep).join("/");
|
|
196488
196797
|
staticFileReferences.push({
|
|
196489
196798
|
filePath: normalizedSourcePath,
|
|
196490
196799
|
fileStaticAssetUrl: `./${normalizedOutputPath}`
|
|
196491
196800
|
});
|
|
196492
196801
|
}
|
|
196493
196802
|
if (buildOutcome.ok && shouldGenerateKicad && buildOutcome.circuitJson) {
|
|
196494
|
-
const projectOutputDir =
|
|
196495
|
-
const projectName =
|
|
196803
|
+
const projectOutputDir = path36.join(distDir, outputDirName, "kicad");
|
|
196804
|
+
const projectName = path36.basename(outputDirName);
|
|
196496
196805
|
const project = await generateKicadProject({
|
|
196497
196806
|
circuitJson: buildOutcome.circuitJson,
|
|
196498
196807
|
outputDir: projectOutputDir,
|
|
@@ -196540,8 +196849,8 @@ var registerBuild = (program3) => {
|
|
|
196540
196849
|
files: staticFileReferences,
|
|
196541
196850
|
standaloneScriptSrc: "./standalone.min.js"
|
|
196542
196851
|
});
|
|
196543
|
-
|
|
196544
|
-
|
|
196852
|
+
fs37.writeFileSync(path36.join(distDir, "index.html"), indexHtml);
|
|
196853
|
+
fs37.writeFileSync(path36.join(distDir, "standalone.min.js"), standalone_min_default);
|
|
196545
196854
|
}
|
|
196546
196855
|
if (options?.kicadFootprintLibrary) {
|
|
196547
196856
|
if (kicadProjects.length === 0) {
|
|
@@ -196564,8 +196873,8 @@ var registerBuild = (program3) => {
|
|
|
196564
196873
|
};
|
|
196565
196874
|
|
|
196566
196875
|
// lib/shared/snapshot-project.ts
|
|
196567
|
-
import
|
|
196568
|
-
import
|
|
196876
|
+
import fs39 from "node:fs";
|
|
196877
|
+
import path37 from "node:path";
|
|
196569
196878
|
import looksSame2 from "looks-same";
|
|
196570
196879
|
import {
|
|
196571
196880
|
convertCircuitJsonToPcbSvg as convertCircuitJsonToPcbSvg3,
|
|
@@ -196576,7 +196885,7 @@ import { renderGLTFToPNGBufferFromGLBBuffer as renderGLTFToPNGBufferFromGLBBuffe
|
|
|
196576
196885
|
|
|
196577
196886
|
// lib/shared/compare-images.ts
|
|
196578
196887
|
import looksSame from "looks-same";
|
|
196579
|
-
import
|
|
196888
|
+
import fs38 from "node:fs/promises";
|
|
196580
196889
|
var compareAndCreateDiff = async (buffer1, buffer2, diffPath) => {
|
|
196581
196890
|
const { equal: equal2 } = await looksSame(buffer1, buffer2, {
|
|
196582
196891
|
strict: false,
|
|
@@ -196592,7 +196901,7 @@ var compareAndCreateDiff = async (buffer1, buffer2, diffPath) => {
|
|
|
196592
196901
|
tolerance: 2
|
|
196593
196902
|
});
|
|
196594
196903
|
} else {
|
|
196595
|
-
await
|
|
196904
|
+
await fs38.writeFile(diffPath, buffer2);
|
|
196596
196905
|
}
|
|
196597
196906
|
}
|
|
196598
196907
|
return { equal: equal2 };
|
|
@@ -196617,7 +196926,7 @@ var snapshotProject = async ({
|
|
|
196617
196926
|
...DEFAULT_IGNORED_PATTERNS,
|
|
196618
196927
|
...ignored.map(normalizeIgnorePattern)
|
|
196619
196928
|
];
|
|
196620
|
-
const resolvedPaths = filePaths.map((f) =>
|
|
196929
|
+
const resolvedPaths = filePaths.map((f) => path37.resolve(projectDir, f));
|
|
196621
196930
|
const boardFiles = findBoardFiles({
|
|
196622
196931
|
projectDir,
|
|
196623
196932
|
ignore,
|
|
@@ -196631,7 +196940,7 @@ var snapshotProject = async ({
|
|
|
196631
196940
|
const mismatches = [];
|
|
196632
196941
|
let didUpdate = false;
|
|
196633
196942
|
for (const file of boardFiles) {
|
|
196634
|
-
const relativeFilePath =
|
|
196943
|
+
const relativeFilePath = path37.relative(projectDir, file);
|
|
196635
196944
|
let circuitJson;
|
|
196636
196945
|
let pcbSvg;
|
|
196637
196946
|
let schSvg;
|
|
@@ -196685,17 +196994,17 @@ var snapshotProject = async ({
|
|
|
196685
196994
|
} catch (error) {
|
|
196686
196995
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
196687
196996
|
if (errorMessage.includes("No pcb_board found in circuit JSON")) {
|
|
196688
|
-
const fileDir =
|
|
196689
|
-
const relativeDir =
|
|
196690
|
-
const snapDir2 = snapshotsDirName ?
|
|
196691
|
-
const base2 =
|
|
196692
|
-
const snap3dPath =
|
|
196693
|
-
const existing3dSnapshot =
|
|
196997
|
+
const fileDir = path37.dirname(file);
|
|
196998
|
+
const relativeDir = path37.relative(projectDir, fileDir);
|
|
196999
|
+
const snapDir2 = snapshotsDirName ? path37.join(projectDir, snapshotsDirName, relativeDir) : path37.join(fileDir, "__snapshots__");
|
|
197000
|
+
const base2 = path37.basename(file).replace(/\.tsx$/, "");
|
|
197001
|
+
const snap3dPath = path37.join(snapDir2, `${base2}-3d.snap.png`);
|
|
197002
|
+
const existing3dSnapshot = fs39.existsSync(snap3dPath);
|
|
196694
197003
|
if (existing3dSnapshot) {
|
|
196695
197004
|
onError(kleur_default.red(`
|
|
196696
197005
|
❌ Failed to generate 3D snapshot for ${relativeFilePath}:
|
|
196697
197006
|
`) + kleur_default.red(` No pcb_board found in circuit JSON
|
|
196698
|
-
`) + kleur_default.red(` Existing snapshot: ${
|
|
197007
|
+
`) + kleur_default.red(` Existing snapshot: ${path37.relative(projectDir, snap3dPath)}
|
|
196699
197008
|
`));
|
|
196700
197009
|
return onExit(1);
|
|
196701
197010
|
} else {
|
|
@@ -196711,9 +197020,9 @@ var snapshotProject = async ({
|
|
|
196711
197020
|
}
|
|
196712
197021
|
}
|
|
196713
197022
|
}
|
|
196714
|
-
const snapDir = snapshotsDirName ?
|
|
196715
|
-
|
|
196716
|
-
const base =
|
|
197023
|
+
const snapDir = snapshotsDirName ? path37.join(projectDir, snapshotsDirName, path37.relative(projectDir, path37.dirname(file))) : path37.join(path37.dirname(file), "__snapshots__");
|
|
197024
|
+
fs39.mkdirSync(snapDir, { recursive: true });
|
|
197025
|
+
const base = path37.basename(file).replace(/\.tsx$/, "");
|
|
196717
197026
|
const snapshots = [];
|
|
196718
197027
|
if (pcbOnly || !schematicOnly) {
|
|
196719
197028
|
snapshots.push({ type: "pcb", content: pcbSvg, isBinary: false });
|
|
@@ -196731,31 +197040,31 @@ var snapshotProject = async ({
|
|
|
196731
197040
|
for (const snapshot of snapshots) {
|
|
196732
197041
|
const { type } = snapshot;
|
|
196733
197042
|
const is3d = type === "3d";
|
|
196734
|
-
const snapPath =
|
|
196735
|
-
const existing =
|
|
197043
|
+
const snapPath = path37.join(snapDir, `${base}-${type}.snap.${is3d ? "png" : "svg"}`);
|
|
197044
|
+
const existing = fs39.existsSync(snapPath);
|
|
196736
197045
|
const newContentBuffer = snapshot.isBinary ? snapshot.content : Buffer.from(snapshot.content, "utf8");
|
|
196737
197046
|
const newContentForFile = snapshot.content;
|
|
196738
197047
|
if (!existing) {
|
|
196739
|
-
|
|
196740
|
-
console.log("✅", kleur_default.gray(
|
|
197048
|
+
fs39.writeFileSync(snapPath, newContentForFile);
|
|
197049
|
+
console.log("✅", kleur_default.gray(path37.relative(projectDir, snapPath)));
|
|
196741
197050
|
didUpdate = true;
|
|
196742
197051
|
continue;
|
|
196743
197052
|
}
|
|
196744
|
-
const oldContentBuffer =
|
|
197053
|
+
const oldContentBuffer = fs39.readFileSync(snapPath);
|
|
196745
197054
|
const diffPath = snapPath.replace(is3d ? ".snap.png" : ".snap.svg", is3d ? ".diff.png" : ".diff.svg");
|
|
196746
197055
|
const { equal: equal2 } = await compareAndCreateDiff(oldContentBuffer, newContentBuffer, diffPath);
|
|
196747
197056
|
if (update) {
|
|
196748
197057
|
if (!forceUpdate && equal2) {
|
|
196749
|
-
console.log("✅", kleur_default.gray(
|
|
197058
|
+
console.log("✅", kleur_default.gray(path37.relative(projectDir, snapPath)));
|
|
196750
197059
|
} else {
|
|
196751
|
-
|
|
196752
|
-
console.log("✅", kleur_default.gray(
|
|
197060
|
+
fs39.writeFileSync(snapPath, newContentForFile);
|
|
197061
|
+
console.log("✅", kleur_default.gray(path37.relative(projectDir, snapPath)));
|
|
196753
197062
|
didUpdate = true;
|
|
196754
197063
|
}
|
|
196755
197064
|
} else if (!equal2) {
|
|
196756
197065
|
mismatches.push(`${snapPath} (diff: ${diffPath})`);
|
|
196757
197066
|
} else {
|
|
196758
|
-
console.log("✅", kleur_default.gray(
|
|
197067
|
+
console.log("✅", kleur_default.gray(path37.relative(projectDir, snapPath)));
|
|
196759
197068
|
}
|
|
196760
197069
|
}
|
|
196761
197070
|
}
|
|
@@ -196794,22 +197103,22 @@ var registerSnapshot = (program3) => {
|
|
|
196794
197103
|
};
|
|
196795
197104
|
|
|
196796
197105
|
// lib/shared/setup-github-actions.ts
|
|
196797
|
-
import
|
|
196798
|
-
import
|
|
197106
|
+
import fs40 from "node:fs";
|
|
197107
|
+
import path38 from "node:path";
|
|
196799
197108
|
var setupGithubActions = (projectDir = process.cwd()) => {
|
|
196800
197109
|
const findGitRoot = (startDir) => {
|
|
196801
|
-
let dir =
|
|
196802
|
-
while (dir !==
|
|
196803
|
-
if (
|
|
197110
|
+
let dir = path38.resolve(startDir);
|
|
197111
|
+
while (dir !== path38.parse(dir).root) {
|
|
197112
|
+
if (fs40.existsSync(path38.join(dir, ".git"))) {
|
|
196804
197113
|
return dir;
|
|
196805
197114
|
}
|
|
196806
|
-
dir =
|
|
197115
|
+
dir = path38.dirname(dir);
|
|
196807
197116
|
}
|
|
196808
197117
|
return null;
|
|
196809
197118
|
};
|
|
196810
197119
|
const gitRoot = findGitRoot(projectDir) ?? projectDir;
|
|
196811
|
-
const workflowsDir =
|
|
196812
|
-
|
|
197120
|
+
const workflowsDir = path38.join(gitRoot, ".github", "workflows");
|
|
197121
|
+
fs40.mkdirSync(workflowsDir, { recursive: true });
|
|
196813
197122
|
const buildWorkflow = `name: tscircuit Build
|
|
196814
197123
|
|
|
196815
197124
|
on:
|
|
@@ -196848,8 +197157,8 @@ jobs:
|
|
|
196848
197157
|
- run: bun install
|
|
196849
197158
|
- run: bunx tsci snapshot
|
|
196850
197159
|
`;
|
|
196851
|
-
writeFileIfNotExists(
|
|
196852
|
-
writeFileIfNotExists(
|
|
197160
|
+
writeFileIfNotExists(path38.join(workflowsDir, "tscircuit-build.yml"), buildWorkflow);
|
|
197161
|
+
writeFileIfNotExists(path38.join(workflowsDir, "tscircuit-snapshot.yml"), snapshotWorkflow);
|
|
196853
197162
|
};
|
|
196854
197163
|
|
|
196855
197164
|
// cli/setup/register.ts
|
|
@@ -196875,8 +197184,8 @@ var registerSetup = (program3) => {
|
|
|
196875
197184
|
};
|
|
196876
197185
|
|
|
196877
197186
|
// cli/convert/register.ts
|
|
196878
|
-
import
|
|
196879
|
-
import
|
|
197187
|
+
import fs41 from "node:fs/promises";
|
|
197188
|
+
import path39 from "node:path";
|
|
196880
197189
|
import { parseKicadModToCircuitJson } from "kicad-component-converter";
|
|
196881
197190
|
|
|
196882
197191
|
// node_modules/@tscircuit/mm/dist/index.js
|
|
@@ -196996,15 +197305,15 @@ var convertCircuitJsonToTscircuit = (circuitJson, opts) => {
|
|
|
196996
197305
|
var registerConvert = (program3) => {
|
|
196997
197306
|
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) => {
|
|
196998
197307
|
try {
|
|
196999
|
-
const inputPath =
|
|
197000
|
-
const modContent = await
|
|
197308
|
+
const inputPath = path39.resolve(file);
|
|
197309
|
+
const modContent = await fs41.readFile(inputPath, "utf-8");
|
|
197001
197310
|
const circuitJson = await parseKicadModToCircuitJson(modContent);
|
|
197002
|
-
const componentName = options.name ??
|
|
197311
|
+
const componentName = options.name ?? path39.basename(inputPath, ".kicad_mod");
|
|
197003
197312
|
const tsx = convertCircuitJsonToTscircuit(circuitJson, {
|
|
197004
197313
|
componentName
|
|
197005
197314
|
});
|
|
197006
|
-
const outputPath = options.output ?
|
|
197007
|
-
await
|
|
197315
|
+
const outputPath = options.output ? path39.resolve(options.output) : path39.join(path39.dirname(inputPath), `${componentName}.tsx`);
|
|
197316
|
+
await fs41.writeFile(outputPath, tsx);
|
|
197008
197317
|
console.log(kleur_default.green(`Converted ${outputPath}`));
|
|
197009
197318
|
} catch (error) {
|
|
197010
197319
|
console.error(kleur_default.red("Failed to convert footprint:"), error instanceof Error ? error.message : error);
|
|
@@ -197099,12 +197408,12 @@ var registerSimulate = (program3) => {
|
|
|
197099
197408
|
};
|
|
197100
197409
|
|
|
197101
197410
|
// lib/shared/install-project-dependencies.ts
|
|
197102
|
-
import
|
|
197103
|
-
import
|
|
197411
|
+
import fs43 from "node:fs";
|
|
197412
|
+
import path41 from "node:path";
|
|
197104
197413
|
|
|
197105
197414
|
// lib/shared/collect-tsci-dependencies.ts
|
|
197106
|
-
import
|
|
197107
|
-
import
|
|
197415
|
+
import fs42 from "node:fs";
|
|
197416
|
+
import path40 from "node:path";
|
|
197108
197417
|
var DEFAULT_PATTERNS = ["**/*.{ts,tsx,js,jsx}"];
|
|
197109
197418
|
var DEFAULT_IGNORES = [
|
|
197110
197419
|
"**/node_modules/**",
|
|
@@ -197119,7 +197428,7 @@ function collectTsciDependencies({
|
|
|
197119
197428
|
patterns = DEFAULT_PATTERNS,
|
|
197120
197429
|
ignore = DEFAULT_IGNORES
|
|
197121
197430
|
} = {}) {
|
|
197122
|
-
const searchRoot =
|
|
197431
|
+
const searchRoot = path40.resolve(cwd);
|
|
197123
197432
|
const files = globbySync(patterns, {
|
|
197124
197433
|
cwd: searchRoot,
|
|
197125
197434
|
absolute: true,
|
|
@@ -197129,7 +197438,7 @@ function collectTsciDependencies({
|
|
|
197129
197438
|
const dependencies2 = new Set;
|
|
197130
197439
|
for (const filePath of files) {
|
|
197131
197440
|
try {
|
|
197132
|
-
const fileContents =
|
|
197441
|
+
const fileContents = fs42.readFileSync(filePath, "utf-8");
|
|
197133
197442
|
let match;
|
|
197134
197443
|
while (true) {
|
|
197135
197444
|
match = IMPORT_PATTERN.exec(fileContents);
|
|
@@ -197146,26 +197455,26 @@ function collectTsciDependencies({
|
|
|
197146
197455
|
async function installProjectDependencies({
|
|
197147
197456
|
cwd = process.cwd()
|
|
197148
197457
|
} = {}) {
|
|
197149
|
-
const projectRoot =
|
|
197150
|
-
const packageJsonPath =
|
|
197151
|
-
const npmrcPath =
|
|
197458
|
+
const projectRoot = path41.resolve(cwd);
|
|
197459
|
+
const packageJsonPath = path41.join(projectRoot, "package.json");
|
|
197460
|
+
const npmrcPath = path41.join(projectRoot, ".npmrc");
|
|
197152
197461
|
const packageManager = getPackageManager();
|
|
197153
|
-
if (!
|
|
197462
|
+
if (!fs43.existsSync(projectRoot)) {
|
|
197154
197463
|
throw new Error(`Directory not found: ${projectRoot}`);
|
|
197155
197464
|
}
|
|
197156
197465
|
let packageJsonCreated = false;
|
|
197157
|
-
if (!
|
|
197466
|
+
if (!fs43.existsSync(packageJsonPath)) {
|
|
197158
197467
|
console.log("No package.json found. Generating a new one.");
|
|
197159
197468
|
generatePackageJson(projectRoot);
|
|
197160
197469
|
packageJsonCreated = true;
|
|
197161
197470
|
} else {
|
|
197162
197471
|
console.log("Found existing package.json.");
|
|
197163
197472
|
}
|
|
197164
|
-
if (!
|
|
197473
|
+
if (!fs43.existsSync(npmrcPath)) {
|
|
197165
197474
|
console.log("Creating .npmrc with tscircuit registry configuration.");
|
|
197166
|
-
|
|
197475
|
+
fs43.writeFileSync(npmrcPath, "@tsci:registry=https://npm.tscircuit.com");
|
|
197167
197476
|
}
|
|
197168
|
-
const packageJson = JSON.parse(
|
|
197477
|
+
const packageJson = JSON.parse(fs43.readFileSync(packageJsonPath, "utf-8"));
|
|
197169
197478
|
if (packageJsonCreated) {
|
|
197170
197479
|
const tsciDependencies = collectTsciDependencies({ cwd: projectRoot });
|
|
197171
197480
|
if (tsciDependencies.length > 0) {
|
|
@@ -197180,7 +197489,7 @@ async function installProjectDependencies({
|
|
|
197180
197489
|
console.log("No @tsci dependencies detected in circuit files.");
|
|
197181
197490
|
}
|
|
197182
197491
|
}
|
|
197183
|
-
|
|
197492
|
+
fs43.writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}
|
|
197184
197493
|
`);
|
|
197185
197494
|
console.log(`Installing dependencies using ${kleur_default.bold(packageManager.name)}...`);
|
|
197186
197495
|
try {
|