@tscircuit/cli 0.1.594 → 0.1.595
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 +538 -485
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -60652,8 +60652,8 @@ var require_utils6 = __commonJS((exports2) => {
|
|
|
60652
60652
|
var result = transform[inputType][outputType](input);
|
|
60653
60653
|
return result;
|
|
60654
60654
|
};
|
|
60655
|
-
exports2.resolve = function(
|
|
60656
|
-
var parts =
|
|
60655
|
+
exports2.resolve = function(path24) {
|
|
60656
|
+
var parts = path24.split("/");
|
|
60657
60657
|
var result = [];
|
|
60658
60658
|
for (var index = 0;index < parts.length; index++) {
|
|
60659
60659
|
var part = parts[index];
|
|
@@ -66103,18 +66103,18 @@ var require_object = __commonJS((exports2, module2) => {
|
|
|
66103
66103
|
var object = new ZipObject(name, zipObjectContent, o);
|
|
66104
66104
|
this.files[name] = object;
|
|
66105
66105
|
};
|
|
66106
|
-
var parentFolder = function(
|
|
66107
|
-
if (
|
|
66108
|
-
|
|
66106
|
+
var parentFolder = function(path24) {
|
|
66107
|
+
if (path24.slice(-1) === "/") {
|
|
66108
|
+
path24 = path24.substring(0, path24.length - 1);
|
|
66109
66109
|
}
|
|
66110
|
-
var lastSlash =
|
|
66111
|
-
return lastSlash > 0 ?
|
|
66110
|
+
var lastSlash = path24.lastIndexOf("/");
|
|
66111
|
+
return lastSlash > 0 ? path24.substring(0, lastSlash) : "";
|
|
66112
66112
|
};
|
|
66113
|
-
var forceTrailingSlash = function(
|
|
66114
|
-
if (
|
|
66115
|
-
|
|
66113
|
+
var forceTrailingSlash = function(path24) {
|
|
66114
|
+
if (path24.slice(-1) !== "/") {
|
|
66115
|
+
path24 += "/";
|
|
66116
66116
|
}
|
|
66117
|
-
return
|
|
66117
|
+
return path24;
|
|
66118
66118
|
};
|
|
66119
66119
|
var folderAdd = function(name, createFolders) {
|
|
66120
66120
|
createFolders = typeof createFolders !== "undefined" ? createFolders : defaults.createFolders;
|
|
@@ -67193,7 +67193,7 @@ var require_dist7 = __commonJS((exports2, module2) => {
|
|
|
67193
67193
|
});
|
|
67194
67194
|
};
|
|
67195
67195
|
traverse(program3, []);
|
|
67196
|
-
return allCommandPaths.filter((
|
|
67196
|
+
return allCommandPaths.filter((path27) => path27 !== "");
|
|
67197
67197
|
};
|
|
67198
67198
|
var normalizeCommandName = (s) => s.replace(/_/g, "-").toLowerCase();
|
|
67199
67199
|
var getCommandFromPath = (program3, commandPathAndPositionalArgs) => {
|
|
@@ -67201,7 +67201,7 @@ var require_dist7 = __commonJS((exports2, module2) => {
|
|
|
67201
67201
|
return commandPath.reduce((curr, nextCommandName) => !curr ? null : curr.commands.find((c) => normalizeCommandName(c.name()) === normalizeCommandName(nextCommandName)), program3);
|
|
67202
67202
|
};
|
|
67203
67203
|
var getCommandPathOnly = (program3, commandPathAndPositionalArgs) => {
|
|
67204
|
-
const allLeafCommandPaths = getAllLeafCommandPaths(program3).map((
|
|
67204
|
+
const allLeafCommandPaths = getAllLeafCommandPaths(program3).map((path27) => normalizeCommandName(path27));
|
|
67205
67205
|
const commandPath = [];
|
|
67206
67206
|
for (const elm of commandPathAndPositionalArgs) {
|
|
67207
67207
|
if (elm.startsWith("-"))
|
|
@@ -67973,8 +67973,8 @@ var require_dist8 = __commonJS((exports2, module2) => {
|
|
|
67973
67973
|
return new Minimatch(pattern, options).match(p);
|
|
67974
67974
|
};
|
|
67975
67975
|
module22.exports = minimatch;
|
|
67976
|
-
var
|
|
67977
|
-
minimatch.sep =
|
|
67976
|
+
var path27 = require_path2();
|
|
67977
|
+
minimatch.sep = path27.sep;
|
|
67978
67978
|
var GLOBSTAR = Symbol("globstar **");
|
|
67979
67979
|
minimatch.GLOBSTAR = GLOBSTAR;
|
|
67980
67980
|
var expand = require_brace_expansion();
|
|
@@ -68465,8 +68465,8 @@ globstar while`, file, fr, pattern, pr, swallowee);
|
|
|
68465
68465
|
if (f === "/" && partial)
|
|
68466
68466
|
return true;
|
|
68467
68467
|
const options = this.options;
|
|
68468
|
-
if (
|
|
68469
|
-
f = f.split(
|
|
68468
|
+
if (path27.sep !== "/") {
|
|
68469
|
+
f = f.split(path27.sep).join("/");
|
|
68470
68470
|
}
|
|
68471
68471
|
f = f.split(slashSplit);
|
|
68472
68472
|
this.debug(this.pattern, "split", f);
|
|
@@ -68557,7 +68557,7 @@ globstar while`, file, fr, pattern, pr, swallowee);
|
|
|
68557
68557
|
return Object.prototype.hasOwnProperty.call(obj, field);
|
|
68558
68558
|
}
|
|
68559
68559
|
var fs26 = __require("fs");
|
|
68560
|
-
var
|
|
68560
|
+
var path27 = __require("path");
|
|
68561
68561
|
var minimatch = require_minimatch();
|
|
68562
68562
|
var isAbsolute3 = __require("path").isAbsolute;
|
|
68563
68563
|
var Minimatch = minimatch.Minimatch;
|
|
@@ -68620,13 +68620,13 @@ globstar while`, file, fr, pattern, pr, swallowee);
|
|
|
68620
68620
|
self2.changedCwd = false;
|
|
68621
68621
|
var cwd = process.cwd();
|
|
68622
68622
|
if (!ownProp(options, "cwd"))
|
|
68623
|
-
self2.cwd =
|
|
68623
|
+
self2.cwd = path27.resolve(cwd);
|
|
68624
68624
|
else {
|
|
68625
|
-
self2.cwd =
|
|
68625
|
+
self2.cwd = path27.resolve(options.cwd);
|
|
68626
68626
|
self2.changedCwd = self2.cwd !== cwd;
|
|
68627
68627
|
}
|
|
68628
|
-
self2.root = options.root ||
|
|
68629
|
-
self2.root =
|
|
68628
|
+
self2.root = options.root || path27.resolve(self2.cwd, "/");
|
|
68629
|
+
self2.root = path27.resolve(self2.root);
|
|
68630
68630
|
self2.cwdAbs = isAbsolute3(self2.cwd) ? self2.cwd : makeAbs(self2, self2.cwd);
|
|
68631
68631
|
self2.nomount = !!options.nomount;
|
|
68632
68632
|
if (process.platform === "win32") {
|
|
@@ -68709,13 +68709,13 @@ globstar while`, file, fr, pattern, pr, swallowee);
|
|
|
68709
68709
|
function makeAbs(self2, f) {
|
|
68710
68710
|
var abs = f;
|
|
68711
68711
|
if (f.charAt(0) === "/") {
|
|
68712
|
-
abs =
|
|
68712
|
+
abs = path27.join(self2.root, f);
|
|
68713
68713
|
} else if (isAbsolute3(f) || f === "") {
|
|
68714
68714
|
abs = f;
|
|
68715
68715
|
} else if (self2.changedCwd) {
|
|
68716
|
-
abs =
|
|
68716
|
+
abs = path27.resolve(self2.cwd, f);
|
|
68717
68717
|
} else {
|
|
68718
|
-
abs =
|
|
68718
|
+
abs = path27.resolve(f);
|
|
68719
68719
|
}
|
|
68720
68720
|
if (process.platform === "win32")
|
|
68721
68721
|
abs = abs.replace(/\\/g, "/");
|
|
@@ -68746,7 +68746,7 @@ globstar while`, file, fr, pattern, pr, swallowee);
|
|
|
68746
68746
|
var Minimatch = minimatch.Minimatch;
|
|
68747
68747
|
var Glob = require_glob().Glob;
|
|
68748
68748
|
var util = __require("util");
|
|
68749
|
-
var
|
|
68749
|
+
var path27 = __require("path");
|
|
68750
68750
|
var assert2 = __require("assert");
|
|
68751
68751
|
var isAbsolute3 = __require("path").isAbsolute;
|
|
68752
68752
|
var common = require_common4();
|
|
@@ -68876,7 +68876,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);
|
|
|
68876
68876
|
e = prefix + e;
|
|
68877
68877
|
}
|
|
68878
68878
|
if (e.charAt(0) === "/" && !this.nomount) {
|
|
68879
|
-
e =
|
|
68879
|
+
e = path27.join(this.root, e);
|
|
68880
68880
|
}
|
|
68881
68881
|
this._emitMatch(index, e);
|
|
68882
68882
|
}
|
|
@@ -69025,9 +69025,9 @@ See: https://github.com/isaacs/node-glob/issues/167`);
|
|
|
69025
69025
|
if (prefix && isAbsolute3(prefix) && !this.nomount) {
|
|
69026
69026
|
var trail = /[\/\\]$/.test(prefix);
|
|
69027
69027
|
if (prefix.charAt(0) === "/") {
|
|
69028
|
-
prefix =
|
|
69028
|
+
prefix = path27.join(this.root, prefix);
|
|
69029
69029
|
} else {
|
|
69030
|
-
prefix =
|
|
69030
|
+
prefix = path27.resolve(this.root, prefix);
|
|
69031
69031
|
if (trail)
|
|
69032
69032
|
prefix += "/";
|
|
69033
69033
|
}
|
|
@@ -69214,7 +69214,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);
|
|
|
69214
69214
|
var Minimatch = minimatch.Minimatch;
|
|
69215
69215
|
var inherits = require_inherits2();
|
|
69216
69216
|
var EE = __require("events").EventEmitter;
|
|
69217
|
-
var
|
|
69217
|
+
var path27 = __require("path");
|
|
69218
69218
|
var assert2 = __require("assert");
|
|
69219
69219
|
var isAbsolute3 = __require("path").isAbsolute;
|
|
69220
69220
|
var globSync = require_sync7();
|
|
@@ -69497,7 +69497,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);
|
|
|
69497
69497
|
e = prefix + e;
|
|
69498
69498
|
}
|
|
69499
69499
|
if (e.charAt(0) === "/" && !this.nomount) {
|
|
69500
|
-
e =
|
|
69500
|
+
e = path27.join(this.root, e);
|
|
69501
69501
|
}
|
|
69502
69502
|
this._emitMatch(index, e);
|
|
69503
69503
|
}
|
|
@@ -69684,9 +69684,9 @@ See: https://github.com/isaacs/node-glob/issues/167`);
|
|
|
69684
69684
|
if (prefix && isAbsolute3(prefix) && !this.nomount) {
|
|
69685
69685
|
var trail = /[\/\\]$/.test(prefix);
|
|
69686
69686
|
if (prefix.charAt(0) === "/") {
|
|
69687
|
-
prefix =
|
|
69687
|
+
prefix = path27.join(this.root, prefix);
|
|
69688
69688
|
} else {
|
|
69689
|
-
prefix =
|
|
69689
|
+
prefix = path27.resolve(this.root, prefix);
|
|
69690
69690
|
if (trail)
|
|
69691
69691
|
prefix += "/";
|
|
69692
69692
|
}
|
|
@@ -69870,7 +69870,7 @@ export default {
|
|
|
69870
69870
|
}
|
|
69871
69871
|
case "export-pathlist": {
|
|
69872
69872
|
return `export default [
|
|
69873
|
-
` + Object.keys(vfs).map((
|
|
69873
|
+
` + Object.keys(vfs).map((path27) => ` "${path27}"`).join(`,
|
|
69874
69874
|
`) + `
|
|
69875
69875
|
]`;
|
|
69876
69876
|
}
|
|
@@ -72718,7 +72718,7 @@ export default () => (
|
|
|
72718
72718
|
// cli/dev/register.ts
|
|
72719
72719
|
import * as fs22 from "node:fs";
|
|
72720
72720
|
import * as net from "node:net";
|
|
72721
|
-
import * as
|
|
72721
|
+
import * as path23 from "node:path";
|
|
72722
72722
|
|
|
72723
72723
|
// lib/dependency-analysis/installNodeModuleTypesForSnippet.ts
|
|
72724
72724
|
import * as fs8 from "node:fs";
|
|
@@ -74438,7 +74438,7 @@ class EventsWatcher extends EventEmitter {
|
|
|
74438
74438
|
}
|
|
74439
74439
|
|
|
74440
74440
|
// cli/dev/DevServer.ts
|
|
74441
|
-
import
|
|
74441
|
+
import path21 from "node:path";
|
|
74442
74442
|
import fs20 from "node:fs";
|
|
74443
74443
|
|
|
74444
74444
|
// node_modules/chokidar/esm/index.js
|
|
@@ -76143,7 +76143,7 @@ var getRegistryApiKy = ({
|
|
|
76143
76143
|
// lib/shared/push-snippet.ts
|
|
76144
76144
|
var import_semver3 = __toESM2(require_semver2(), 1);
|
|
76145
76145
|
import * as fs16 from "node:fs";
|
|
76146
|
-
import * as
|
|
76146
|
+
import * as path17 from "node:path";
|
|
76147
76147
|
import Debug from "debug";
|
|
76148
76148
|
|
|
76149
76149
|
// lib/shared/get-entrypoint.ts
|
|
@@ -76844,6 +76844,44 @@ var checkOrgAccess = async (ky2, accountName) => {
|
|
|
76844
76844
|
}
|
|
76845
76845
|
};
|
|
76846
76846
|
|
|
76847
|
+
// lib/shared/is-binary-file.ts
|
|
76848
|
+
import * as path16 from "node:path";
|
|
76849
|
+
var BINARY_FILE_EXTENSIONS = new Set([
|
|
76850
|
+
".glb",
|
|
76851
|
+
".gltf",
|
|
76852
|
+
".obj",
|
|
76853
|
+
".stl",
|
|
76854
|
+
".step",
|
|
76855
|
+
".png",
|
|
76856
|
+
".jpg",
|
|
76857
|
+
".jpeg",
|
|
76858
|
+
".gif",
|
|
76859
|
+
".webp",
|
|
76860
|
+
".zip",
|
|
76861
|
+
".gz",
|
|
76862
|
+
".tar"
|
|
76863
|
+
]);
|
|
76864
|
+
var isBinaryFile = (filePath) => {
|
|
76865
|
+
const ext = path16.extname(filePath).toLowerCase();
|
|
76866
|
+
return BINARY_FILE_EXTENSIONS.has(ext);
|
|
76867
|
+
};
|
|
76868
|
+
|
|
76869
|
+
// lib/shared/has-binary-content.ts
|
|
76870
|
+
var hasBinaryContent = (content) => {
|
|
76871
|
+
const checkLength = Math.min(content.length, 8192);
|
|
76872
|
+
const slice = content.subarray(0, checkLength);
|
|
76873
|
+
const decoded = slice.toString("utf-8");
|
|
76874
|
+
if (decoded.includes("�")) {
|
|
76875
|
+
return true;
|
|
76876
|
+
}
|
|
76877
|
+
for (let i = 0;i < checkLength; i++) {
|
|
76878
|
+
if (content[i] === 0) {
|
|
76879
|
+
return true;
|
|
76880
|
+
}
|
|
76881
|
+
}
|
|
76882
|
+
return false;
|
|
76883
|
+
};
|
|
76884
|
+
|
|
76847
76885
|
// lib/shared/push-snippet.ts
|
|
76848
76886
|
var debug = Debug("tsci:push-snippet");
|
|
76849
76887
|
var pushSnippet = async ({
|
|
@@ -76869,10 +76907,10 @@ var pushSnippet = async ({
|
|
|
76869
76907
|
return onExit(1);
|
|
76870
76908
|
}
|
|
76871
76909
|
const packageJsonPath = [
|
|
76872
|
-
|
|
76873
|
-
|
|
76874
|
-
].find((
|
|
76875
|
-
const projectDir = packageJsonPath ?
|
|
76910
|
+
path17.resolve(path17.join(path17.dirname(snippetFilePath), "package.json")),
|
|
76911
|
+
path17.resolve(path17.join(process.cwd(), "package.json"))
|
|
76912
|
+
].find((path18) => fs16.existsSync(path18));
|
|
76913
|
+
const projectDir = packageJsonPath ? path17.dirname(packageJsonPath) : path17.dirname(snippetFilePath);
|
|
76876
76914
|
if (!packageJsonPath) {
|
|
76877
76915
|
onError("No package.json found, try running 'tsci init' to bootstrap the project");
|
|
76878
76916
|
return onExit(1);
|
|
@@ -77043,18 +77081,33 @@ var pushSnippet = async ({
|
|
|
77043
77081
|
`);
|
|
77044
77082
|
const filePaths = getPackageFilePaths(projectDir);
|
|
77045
77083
|
for (const fullFilePath of filePaths) {
|
|
77046
|
-
const relativeFilePath =
|
|
77047
|
-
const
|
|
77084
|
+
const relativeFilePath = path17.relative(projectDir, fullFilePath);
|
|
77085
|
+
const fileBuffer = fs16.readFileSync(fullFilePath);
|
|
77086
|
+
const isBinary = isBinaryFile(relativeFilePath) || hasBinaryContent(fileBuffer);
|
|
77087
|
+
const payload = {
|
|
77088
|
+
file_path: relativeFilePath,
|
|
77089
|
+
package_name_with_version: `${scopedPackageName}@${releaseVersion}`
|
|
77090
|
+
};
|
|
77091
|
+
if (isBinary) {
|
|
77092
|
+
payload.content_base64 = fileBuffer.toString("base64");
|
|
77093
|
+
} else {
|
|
77094
|
+
payload.content_text = fileBuffer.toString("utf-8");
|
|
77095
|
+
}
|
|
77048
77096
|
await ky2.post("package_files/create", {
|
|
77049
|
-
json:
|
|
77050
|
-
file_path: relativeFilePath,
|
|
77051
|
-
content_text: fileContent,
|
|
77052
|
-
package_name_with_version: `${scopedPackageName}@${releaseVersion}`
|
|
77053
|
-
}
|
|
77097
|
+
json: payload
|
|
77054
77098
|
}).json().then((response) => {
|
|
77055
|
-
|
|
77056
|
-
|
|
77057
|
-
|
|
77099
|
+
const icon = isBinary ? "\uD83D\uDCE6" : "⬆︎";
|
|
77100
|
+
console.log(kleur_default.gray(`${icon} ${relativeFilePath}`));
|
|
77101
|
+
}).catch(async (error) => {
|
|
77102
|
+
let errorDetails = "";
|
|
77103
|
+
try {
|
|
77104
|
+
const errorResponse = await error.response?.json();
|
|
77105
|
+
if (errorResponse?.error?.message) {
|
|
77106
|
+
errorDetails = `: ${errorResponse.error.message}`;
|
|
77107
|
+
}
|
|
77108
|
+
} catch {}
|
|
77109
|
+
onError(`Error uploading file "${relativeFilePath}"${errorDetails}
|
|
77110
|
+
` + ` Full path: ${fullFilePath}`);
|
|
77058
77111
|
return onExit(1);
|
|
77059
77112
|
});
|
|
77060
77113
|
}
|
|
@@ -77074,7 +77127,7 @@ var pushSnippet = async ({
|
|
|
77074
77127
|
|
|
77075
77128
|
// lib/shared/add-package.ts
|
|
77076
77129
|
import * as fs18 from "node:fs";
|
|
77077
|
-
import * as
|
|
77130
|
+
import * as path19 from "node:path";
|
|
77078
77131
|
|
|
77079
77132
|
// lib/shared/resolve-tarball-url-from-registry.ts
|
|
77080
77133
|
async function resolveTarballUrlFromRegistry(packageName) {
|
|
@@ -77104,7 +77157,7 @@ async function resolveTarballUrlFromRegistry(packageName) {
|
|
|
77104
77157
|
|
|
77105
77158
|
// lib/shared/detect-and-setup-kicad-library.ts
|
|
77106
77159
|
import * as fs17 from "node:fs";
|
|
77107
|
-
import * as
|
|
77160
|
+
import * as path18 from "node:path";
|
|
77108
77161
|
var import_strip_json_comments = __toESM2(require_strip_json_comments(), 1);
|
|
77109
77162
|
function extractPackageName(packageSpec) {
|
|
77110
77163
|
if (packageSpec.startsWith("http")) {
|
|
@@ -77133,7 +77186,7 @@ function extractPackageName(packageSpec) {
|
|
|
77133
77186
|
async function detectAndSetupKicadLibrary(packageSpec, projectDir = process.cwd()) {
|
|
77134
77187
|
try {
|
|
77135
77188
|
const packageName = extractPackageName(packageSpec);
|
|
77136
|
-
const nodeModulesPath =
|
|
77189
|
+
const nodeModulesPath = path18.join(projectDir, "node_modules", packageName);
|
|
77137
77190
|
if (!fs17.existsSync(nodeModulesPath)) {
|
|
77138
77191
|
return false;
|
|
77139
77192
|
}
|
|
@@ -77156,10 +77209,10 @@ async function detectAndSetupKicadLibrary(packageSpec, projectDir = process.cwd(
|
|
|
77156
77209
|
}
|
|
77157
77210
|
}
|
|
77158
77211
|
async function generateKicadTypes(projectDir, packageName, kicadModFiles) {
|
|
77159
|
-
const typesDir =
|
|
77212
|
+
const typesDir = path18.join(projectDir, "types");
|
|
77160
77213
|
fs17.mkdirSync(typesDir, { recursive: true });
|
|
77161
77214
|
const typeFileName = `${packageName.replace(/[@/]/g, "-")}.d.ts`;
|
|
77162
|
-
const typesFilePath =
|
|
77215
|
+
const typesFilePath = path18.join(typesDir, typeFileName);
|
|
77163
77216
|
const declarations = kicadModFiles.map((filePath) => {
|
|
77164
77217
|
const modulePath = `${packageName}/${filePath}`;
|
|
77165
77218
|
return `declare module "${modulePath}" {
|
|
@@ -77173,7 +77226,7 @@ async function generateKicadTypes(projectDir, packageName, kicadModFiles) {
|
|
|
77173
77226
|
console.log(kleur_default.green(`✓ Generated types at ${kleur_default.cyan(`types/${typeFileName}`)}`));
|
|
77174
77227
|
}
|
|
77175
77228
|
async function setupTsConfig(projectDir) {
|
|
77176
|
-
const tsconfigPath =
|
|
77229
|
+
const tsconfigPath = path18.join(projectDir, "tsconfig.json");
|
|
77177
77230
|
if (!fs17.existsSync(tsconfigPath)) {
|
|
77178
77231
|
console.log(kleur_default.dim("Creating tsconfig.json..."));
|
|
77179
77232
|
generateTsConfig(projectDir);
|
|
@@ -77221,7 +77274,7 @@ async function addPackage(packageSpec, projectDir = process.cwd()) {
|
|
|
77221
77274
|
let installTarget = normalizedName || packageSpec;
|
|
77222
77275
|
console.log(kleur_default.cyan(`Adding ${kleur_default.bold(displayName)}...`));
|
|
77223
77276
|
if (normalizedName && normalizedName.startsWith("@tsci/")) {
|
|
77224
|
-
const npmrcPath =
|
|
77277
|
+
const npmrcPath = path19.join(projectDir, ".npmrc");
|
|
77225
77278
|
const npmrcContent = fs18.existsSync(npmrcPath) ? fs18.readFileSync(npmrcPath, "utf-8") : "";
|
|
77226
77279
|
let hasTsciRegistry = /@tsci[/:]/.test(npmrcContent);
|
|
77227
77280
|
if (!hasTsciRegistry) {
|
|
@@ -77264,10 +77317,10 @@ import Debug2 from "debug";
|
|
|
77264
77317
|
|
|
77265
77318
|
// lib/dependency-analysis/getNodeModuleDependencies.ts
|
|
77266
77319
|
import * as ts3 from "typescript";
|
|
77267
|
-
import * as
|
|
77320
|
+
import * as path20 from "path";
|
|
77268
77321
|
import * as fs19 from "fs";
|
|
77269
77322
|
function getLocalPackages(projectDir) {
|
|
77270
|
-
const packageJsonPath =
|
|
77323
|
+
const packageJsonPath = path20.join(projectDir, "package.json");
|
|
77271
77324
|
const localPackages = new Set;
|
|
77272
77325
|
if (!fs19.existsSync(packageJsonPath)) {
|
|
77273
77326
|
return localPackages;
|
|
@@ -77291,7 +77344,7 @@ function getLocalPackages(projectDir) {
|
|
|
77291
77344
|
return localPackages;
|
|
77292
77345
|
}
|
|
77293
77346
|
function getAllDependencyPackages(projectDir) {
|
|
77294
|
-
const packageJsonPath =
|
|
77347
|
+
const packageJsonPath = path20.join(projectDir, "package.json");
|
|
77295
77348
|
const allPackages = new Set;
|
|
77296
77349
|
if (!fs19.existsSync(packageJsonPath)) {
|
|
77297
77350
|
return allPackages;
|
|
@@ -77308,7 +77361,7 @@ function getAllDependencyPackages(projectDir) {
|
|
|
77308
77361
|
return allPackages;
|
|
77309
77362
|
}
|
|
77310
77363
|
function getNodeModuleImports(filePath) {
|
|
77311
|
-
const absolutePath =
|
|
77364
|
+
const absolutePath = path20.resolve(filePath);
|
|
77312
77365
|
if (!fs19.existsSync(absolutePath)) {
|
|
77313
77366
|
return [];
|
|
77314
77367
|
}
|
|
@@ -77362,17 +77415,17 @@ function resolveNodeModuleImport({
|
|
|
77362
77415
|
}) {
|
|
77363
77416
|
const packageName = getPackageNameFromImport(importPath);
|
|
77364
77417
|
const searchPaths = [
|
|
77365
|
-
|
|
77418
|
+
path20.join(projectDir, "node_modules", packageName)
|
|
77366
77419
|
];
|
|
77367
77420
|
if (searchFromDir) {
|
|
77368
|
-
let currentDir =
|
|
77369
|
-
const projectDirNormalized =
|
|
77421
|
+
let currentDir = path20.dirname(searchFromDir);
|
|
77422
|
+
const projectDirNormalized = path20.normalize(projectDir);
|
|
77370
77423
|
while (currentDir.startsWith(projectDirNormalized)) {
|
|
77371
|
-
const candidatePath =
|
|
77424
|
+
const candidatePath = path20.join(currentDir, "node_modules", packageName);
|
|
77372
77425
|
if (!searchPaths.includes(candidatePath)) {
|
|
77373
77426
|
searchPaths.push(candidatePath);
|
|
77374
77427
|
}
|
|
77375
|
-
const parentDir =
|
|
77428
|
+
const parentDir = path20.dirname(currentDir);
|
|
77376
77429
|
if (parentDir === currentDir)
|
|
77377
77430
|
break;
|
|
77378
77431
|
currentDir = parentDir;
|
|
@@ -77388,7 +77441,7 @@ function resolveNodeModuleImport({
|
|
|
77388
77441
|
if (!packageDir) {
|
|
77389
77442
|
return [];
|
|
77390
77443
|
}
|
|
77391
|
-
const packageJsonPath =
|
|
77444
|
+
const packageJsonPath = path20.join(packageDir, "package.json");
|
|
77392
77445
|
if (!fs19.existsSync(packageJsonPath)) {
|
|
77393
77446
|
return [];
|
|
77394
77447
|
}
|
|
@@ -77397,15 +77450,15 @@ function resolveNodeModuleImport({
|
|
|
77397
77450
|
if (importPath !== packageName) {
|
|
77398
77451
|
const subpath = importPath.slice(packageName.length + 1);
|
|
77399
77452
|
const possiblePaths = [
|
|
77400
|
-
|
|
77401
|
-
|
|
77402
|
-
|
|
77403
|
-
|
|
77404
|
-
|
|
77405
|
-
|
|
77406
|
-
|
|
77407
|
-
|
|
77408
|
-
|
|
77453
|
+
path20.join(packageDir, subpath),
|
|
77454
|
+
path20.join(packageDir, `${subpath}.js`),
|
|
77455
|
+
path20.join(packageDir, `${subpath}.mjs`),
|
|
77456
|
+
path20.join(packageDir, `${subpath}.ts`),
|
|
77457
|
+
path20.join(packageDir, `${subpath}.tsx`),
|
|
77458
|
+
path20.join(packageDir, subpath, "index.js"),
|
|
77459
|
+
path20.join(packageDir, subpath, "index.mjs"),
|
|
77460
|
+
path20.join(packageDir, subpath, "index.ts"),
|
|
77461
|
+
path20.join(packageDir, subpath, "index.tsx")
|
|
77409
77462
|
];
|
|
77410
77463
|
for (const p of possiblePaths) {
|
|
77411
77464
|
if (fs19.existsSync(p) && fs19.statSync(p).isFile()) {
|
|
@@ -77422,22 +77475,22 @@ function resolveNodeModuleImport({
|
|
|
77422
77475
|
packageJson.exports?.["."]?.require
|
|
77423
77476
|
].filter(Boolean);
|
|
77424
77477
|
for (const entry of entryPoints) {
|
|
77425
|
-
const entryPath =
|
|
77478
|
+
const entryPath = path20.join(packageDir, entry);
|
|
77426
77479
|
if (fs19.existsSync(entryPath) && fs19.statSync(entryPath).isFile()) {
|
|
77427
77480
|
resolvedFiles.push(entryPath);
|
|
77428
77481
|
}
|
|
77429
77482
|
}
|
|
77430
77483
|
if (resolvedFiles.length === 0) {
|
|
77431
77484
|
const fallbackPaths = [
|
|
77432
|
-
|
|
77433
|
-
|
|
77434
|
-
|
|
77435
|
-
|
|
77436
|
-
|
|
77437
|
-
|
|
77438
|
-
|
|
77439
|
-
|
|
77440
|
-
|
|
77485
|
+
path20.join(packageDir, "index.js"),
|
|
77486
|
+
path20.join(packageDir, "index.mjs"),
|
|
77487
|
+
path20.join(packageDir, "index.ts"),
|
|
77488
|
+
path20.join(packageDir, "index.tsx"),
|
|
77489
|
+
path20.join(packageDir, "dist", "index.js"),
|
|
77490
|
+
path20.join(packageDir, "dist", "index.mjs"),
|
|
77491
|
+
path20.join(packageDir, "lib", "index.js"),
|
|
77492
|
+
path20.join(packageDir, "src", "index.ts"),
|
|
77493
|
+
path20.join(packageDir, "src", "index.tsx")
|
|
77441
77494
|
];
|
|
77442
77495
|
for (const p of fallbackPaths) {
|
|
77443
77496
|
if (fs19.existsSync(p) && fs19.statSync(p).isFile()) {
|
|
@@ -77478,8 +77531,8 @@ function collectAllNodeModuleDependencies(entryFilePath, projectDir, maxDepth =
|
|
|
77478
77531
|
}
|
|
77479
77532
|
}
|
|
77480
77533
|
function getLocalDependencies(filePath) {
|
|
77481
|
-
const absolutePath =
|
|
77482
|
-
const baseDir =
|
|
77534
|
+
const absolutePath = path20.resolve(filePath);
|
|
77535
|
+
const baseDir = path20.dirname(absolutePath);
|
|
77483
77536
|
if (!fs19.existsSync(absolutePath)) {
|
|
77484
77537
|
return [];
|
|
77485
77538
|
}
|
|
@@ -77505,7 +77558,7 @@ function collectAllNodeModuleDependencies(entryFilePath, projectDir, maxDepth =
|
|
|
77505
77558
|
}
|
|
77506
77559
|
function resolveLocalImport(importPath, baseDir) {
|
|
77507
77560
|
const extensions = [".tsx", ".ts", ".jsx", ".js", ".mjs"];
|
|
77508
|
-
const resolvedPath =
|
|
77561
|
+
const resolvedPath = path20.resolve(baseDir, importPath);
|
|
77509
77562
|
if (fs19.existsSync(resolvedPath) && fs19.statSync(resolvedPath).isFile()) {
|
|
77510
77563
|
return resolvedPath;
|
|
77511
77564
|
}
|
|
@@ -77517,7 +77570,7 @@ function collectAllNodeModuleDependencies(entryFilePath, projectDir, maxDepth =
|
|
|
77517
77570
|
}
|
|
77518
77571
|
if (fs19.existsSync(resolvedPath) && fs19.statSync(resolvedPath).isDirectory()) {
|
|
77519
77572
|
for (const ext of extensions) {
|
|
77520
|
-
const indexPath =
|
|
77573
|
+
const indexPath = path20.join(resolvedPath, `index${ext}`);
|
|
77521
77574
|
if (fs19.existsSync(indexPath)) {
|
|
77522
77575
|
return indexPath;
|
|
77523
77576
|
}
|
|
@@ -77543,11 +77596,11 @@ var EXCLUDED_PACKAGE_DIRECTORIES = new Set([
|
|
|
77543
77596
|
function collectLocalPackageFiles(packageDir) {
|
|
77544
77597
|
const buildDirs = ["dist", "build"];
|
|
77545
77598
|
for (const dirName of buildDirs) {
|
|
77546
|
-
const dirPath =
|
|
77599
|
+
const dirPath = path20.join(packageDir, dirName);
|
|
77547
77600
|
if (fs19.existsSync(dirPath)) {
|
|
77548
77601
|
const files = walkDirectory(dirPath, new Set);
|
|
77549
77602
|
if (files.length > 0) {
|
|
77550
|
-
const packageJsonPath =
|
|
77603
|
+
const packageJsonPath = path20.join(packageDir, "package.json");
|
|
77551
77604
|
if (fs19.existsSync(packageJsonPath)) {
|
|
77552
77605
|
files.push(packageJsonPath);
|
|
77553
77606
|
}
|
|
@@ -77563,7 +77616,7 @@ function walkDirectory(dir, excludedDirs) {
|
|
|
77563
77616
|
return files;
|
|
77564
77617
|
const entries = fs19.readdirSync(dir, { withFileTypes: true });
|
|
77565
77618
|
for (const entry of entries) {
|
|
77566
|
-
const fullPath =
|
|
77619
|
+
const fullPath = path20.join(dir, entry.name);
|
|
77567
77620
|
if (entry.isDirectory()) {
|
|
77568
77621
|
if (excludedDirs.has(entry.name)) {
|
|
77569
77622
|
continue;
|
|
@@ -77631,9 +77684,9 @@ function getAllNodeModuleFilePaths(entryFilePath, projectDir) {
|
|
|
77631
77684
|
processedPackages.add(packageName);
|
|
77632
77685
|
if (resolvedFiles.length > 0) {
|
|
77633
77686
|
const firstResolvedFile = resolvedFiles[0];
|
|
77634
|
-
let packageDir =
|
|
77687
|
+
let packageDir = path20.dirname(firstResolvedFile);
|
|
77635
77688
|
while (packageDir.includes("node_modules")) {
|
|
77636
|
-
const packageJsonPath =
|
|
77689
|
+
const packageJsonPath = path20.join(packageDir, "package.json");
|
|
77637
77690
|
if (fs19.existsSync(packageJsonPath)) {
|
|
77638
77691
|
try {
|
|
77639
77692
|
const pkgJson = JSON.parse(fs19.readFileSync(packageJsonPath, "utf-8"));
|
|
@@ -77642,7 +77695,7 @@ function getAllNodeModuleFilePaths(entryFilePath, projectDir) {
|
|
|
77642
77695
|
}
|
|
77643
77696
|
} catch {}
|
|
77644
77697
|
}
|
|
77645
|
-
const parentDir =
|
|
77698
|
+
const parentDir = path20.dirname(packageDir);
|
|
77646
77699
|
if (parentDir === packageDir)
|
|
77647
77700
|
break;
|
|
77648
77701
|
packageDir = parentDir;
|
|
@@ -77659,7 +77712,7 @@ function getAllNodeModuleFilePaths(entryFilePath, projectDir) {
|
|
|
77659
77712
|
|
|
77660
77713
|
// cli/dev/DevServer.ts
|
|
77661
77714
|
var debug2 = Debug2("tscircuit:devserver");
|
|
77662
|
-
var
|
|
77715
|
+
var BINARY_FILE_EXTENSIONS2 = new Set([".glb", ".png", ".jpeg", ".jpg"]);
|
|
77663
77716
|
|
|
77664
77717
|
class DevServer {
|
|
77665
77718
|
port;
|
|
@@ -77679,7 +77732,7 @@ class DevServer {
|
|
|
77679
77732
|
}) {
|
|
77680
77733
|
this.port = port;
|
|
77681
77734
|
this.componentFilePath = componentFilePath;
|
|
77682
|
-
this.projectDir = projectDir ??
|
|
77735
|
+
this.projectDir = projectDir ?? path21.dirname(componentFilePath);
|
|
77683
77736
|
const projectConfig = loadProjectConfig(this.projectDir);
|
|
77684
77737
|
this.ignoredFiles = projectConfig?.ignoredFiles ?? [];
|
|
77685
77738
|
this.fsKy = distribution_default.create({
|
|
@@ -77690,7 +77743,7 @@ class DevServer {
|
|
|
77690
77743
|
async start() {
|
|
77691
77744
|
const { server } = await createHttpServer({
|
|
77692
77745
|
port: this.port,
|
|
77693
|
-
defaultMainComponentPath:
|
|
77746
|
+
defaultMainComponentPath: path21.relative(this.projectDir, this.componentFilePath)
|
|
77694
77747
|
});
|
|
77695
77748
|
this.httpServer = server;
|
|
77696
77749
|
this.eventsWatcher = new EventsWatcher(`http://localhost:${this.port}`);
|
|
@@ -77703,7 +77756,7 @@ class DevServer {
|
|
|
77703
77756
|
this.filesystemWatcher = watch(this.projectDir, {
|
|
77704
77757
|
persistent: true,
|
|
77705
77758
|
ignoreInitial: true,
|
|
77706
|
-
ignored: (p) => shouldIgnorePath(
|
|
77759
|
+
ignored: (p) => shouldIgnorePath(path21.relative(this.projectDir, p), this.ignoredFiles)
|
|
77707
77760
|
});
|
|
77708
77761
|
this.filesystemWatcher.on("change", (filePath) => this.handleFileChangedOnFilesystem(filePath));
|
|
77709
77762
|
this.filesystemWatcher.on("add", (filePath) => this.handleFileChangedOnFilesystem(filePath));
|
|
@@ -77719,8 +77772,8 @@ class DevServer {
|
|
|
77719
77772
|
const { file } = await this.fsKy.get("api/files/get", {
|
|
77720
77773
|
searchParams: { file_path: ev.file_path }
|
|
77721
77774
|
}).json();
|
|
77722
|
-
const fullPath =
|
|
77723
|
-
const dirPath =
|
|
77775
|
+
const fullPath = path21.join(this.projectDir, ev.file_path);
|
|
77776
|
+
const dirPath = path21.dirname(fullPath);
|
|
77724
77777
|
if (!fs20.existsSync(dirPath)) {
|
|
77725
77778
|
fs20.mkdirSync(dirPath, { recursive: true });
|
|
77726
77779
|
}
|
|
@@ -77732,14 +77785,14 @@ class DevServer {
|
|
|
77732
77785
|
}
|
|
77733
77786
|
}
|
|
77734
77787
|
async handleFileDeletedEventFromServer(ev) {
|
|
77735
|
-
const fullPath =
|
|
77788
|
+
const fullPath = path21.join(this.projectDir, ev.file_path);
|
|
77736
77789
|
if (fs20.existsSync(fullPath)) {
|
|
77737
77790
|
debug2(`Deleting file ${ev.file_path} from filesystem`);
|
|
77738
77791
|
fs20.unlinkSync(fullPath);
|
|
77739
77792
|
}
|
|
77740
77793
|
}
|
|
77741
77794
|
async handleFileChangedOnFilesystem(absoluteFilePath) {
|
|
77742
|
-
const relativeFilePath =
|
|
77795
|
+
const relativeFilePath = path21.relative(this.projectDir, absoluteFilePath);
|
|
77743
77796
|
if (relativeFilePath.includes("manual-edits.json"))
|
|
77744
77797
|
return;
|
|
77745
77798
|
if (shouldIgnorePath(relativeFilePath, this.ignoredFiles))
|
|
@@ -77757,14 +77810,14 @@ class DevServer {
|
|
|
77757
77810
|
await this.checkAndUploadNewNodeModules(absoluteFilePath);
|
|
77758
77811
|
}
|
|
77759
77812
|
async checkAndUploadNewNodeModules(filePath) {
|
|
77760
|
-
const ext =
|
|
77813
|
+
const ext = path21.extname(filePath).toLowerCase();
|
|
77761
77814
|
const isSourceFile = [".ts", ".tsx", ".js", ".jsx", ".mjs"].includes(ext);
|
|
77762
77815
|
if (!isSourceFile)
|
|
77763
77816
|
return;
|
|
77764
77817
|
try {
|
|
77765
77818
|
const nodeModuleFiles = getAllNodeModuleFilePaths(filePath, this.projectDir);
|
|
77766
77819
|
const newFiles = nodeModuleFiles.filter((file) => {
|
|
77767
|
-
const relativePath =
|
|
77820
|
+
const relativePath = path21.relative(this.projectDir, file);
|
|
77768
77821
|
return !this.uploadedNodeModules.has(relativePath);
|
|
77769
77822
|
});
|
|
77770
77823
|
if (newFiles.length === 0)
|
|
@@ -77777,7 +77830,7 @@ class DevServer {
|
|
|
77777
77830
|
}
|
|
77778
77831
|
}
|
|
77779
77832
|
async handleFileRemovedFromFilesystem(absoluteFilePath) {
|
|
77780
|
-
const relativeFilePath =
|
|
77833
|
+
const relativeFilePath = path21.relative(this.projectDir, absoluteFilePath);
|
|
77781
77834
|
if (shouldIgnorePath(relativeFilePath, this.ignoredFiles))
|
|
77782
77835
|
return;
|
|
77783
77836
|
if (!relativeFilePath || relativeFilePath.trim() === "") {
|
|
@@ -77815,8 +77868,8 @@ class DevServer {
|
|
|
77815
77868
|
debug2(`Successfully deleted file ${relativeFilePath} from server`);
|
|
77816
77869
|
}
|
|
77817
77870
|
async handleFileRename(oldPath, newPath) {
|
|
77818
|
-
const oldRelativePath =
|
|
77819
|
-
const newRelativePath =
|
|
77871
|
+
const oldRelativePath = path21.relative(this.projectDir, oldPath);
|
|
77872
|
+
const newRelativePath = path21.relative(this.projectDir, newPath);
|
|
77820
77873
|
if (shouldIgnorePath(oldRelativePath, this.ignoredFiles) || shouldIgnorePath(newRelativePath, this.ignoredFiles))
|
|
77821
77874
|
return;
|
|
77822
77875
|
await this.handleFileRemovedFromFilesystem(oldPath);
|
|
@@ -77836,7 +77889,7 @@ class DevServer {
|
|
|
77836
77889
|
});
|
|
77837
77890
|
const filePaths = getPackageFilePaths(this.projectDir, this.ignoredFiles);
|
|
77838
77891
|
for (const filePath of filePaths) {
|
|
77839
|
-
const relativeFilePath =
|
|
77892
|
+
const relativeFilePath = path21.relative(this.projectDir, filePath);
|
|
77840
77893
|
const filePayload = this.createFileUploadPayload(filePath, relativeFilePath);
|
|
77841
77894
|
await this.fsKy.post("api/files/upsert", {
|
|
77842
77895
|
json: {
|
|
@@ -77870,7 +77923,7 @@ class DevServer {
|
|
|
77870
77923
|
}
|
|
77871
77924
|
async uploadNodeModuleFiles(files) {
|
|
77872
77925
|
for (const nodeModuleFile of files) {
|
|
77873
|
-
const relativeFilePath =
|
|
77926
|
+
const relativeFilePath = path21.relative(this.projectDir, nodeModuleFile);
|
|
77874
77927
|
this.uploadedNodeModules.add(relativeFilePath);
|
|
77875
77928
|
const filePayload = this.createFileUploadPayload(nodeModuleFile, relativeFilePath);
|
|
77876
77929
|
await this.fsKy.post("api/files/upsert", {
|
|
@@ -77906,8 +77959,8 @@ class DevServer {
|
|
|
77906
77959
|
await this.filesystemWatcher?.close();
|
|
77907
77960
|
}
|
|
77908
77961
|
createFileUploadPayload(absoluteFilePath, relativeFilePath) {
|
|
77909
|
-
const ext =
|
|
77910
|
-
if (
|
|
77962
|
+
const ext = path21.extname(relativeFilePath).toLowerCase();
|
|
77963
|
+
if (BINARY_FILE_EXTENSIONS2.has(ext)) {
|
|
77911
77964
|
const fileBuffer = fs20.readFileSync(absoluteFilePath);
|
|
77912
77965
|
return { binary_content_b64: fileBuffer.toString("base64") };
|
|
77913
77966
|
}
|
|
@@ -77948,10 +78001,10 @@ var getVersion = () => {
|
|
|
77948
78001
|
|
|
77949
78002
|
// lib/shared/find-board-files.ts
|
|
77950
78003
|
import fs21 from "node:fs";
|
|
77951
|
-
import
|
|
78004
|
+
import path22 from "node:path";
|
|
77952
78005
|
var isSubPath = (maybeChild, maybeParent) => {
|
|
77953
|
-
const relative5 =
|
|
77954
|
-
return relative5 === "" || !relative5.startsWith("..") && !
|
|
78006
|
+
const relative5 = path22.relative(maybeParent, maybeChild);
|
|
78007
|
+
return relative5 === "" || !relative5.startsWith("..") && !path22.isAbsolute(relative5);
|
|
77955
78008
|
};
|
|
77956
78009
|
var isGlobPattern = (str) => {
|
|
77957
78010
|
return /[*?[\]{}]/.test(str);
|
|
@@ -77961,13 +78014,13 @@ var findBoardFiles = ({
|
|
|
77961
78014
|
ignore = DEFAULT_IGNORED_PATTERNS,
|
|
77962
78015
|
filePaths = []
|
|
77963
78016
|
} = {}) => {
|
|
77964
|
-
const resolvedProjectDir =
|
|
78017
|
+
const resolvedProjectDir = path22.resolve(projectDir);
|
|
77965
78018
|
const boardFilePatterns = getBoardFilePatterns(resolvedProjectDir);
|
|
77966
78019
|
const relativeBoardFiles = globbySync(boardFilePatterns, {
|
|
77967
78020
|
cwd: resolvedProjectDir,
|
|
77968
78021
|
ignore
|
|
77969
78022
|
});
|
|
77970
|
-
const absoluteBoardFiles = relativeBoardFiles.map((f) =>
|
|
78023
|
+
const absoluteBoardFiles = relativeBoardFiles.map((f) => path22.join(resolvedProjectDir, f));
|
|
77971
78024
|
const boardFileSet = new Set;
|
|
77972
78025
|
if (filePaths.length > 0) {
|
|
77973
78026
|
for (const inputPath of filePaths) {
|
|
@@ -77981,13 +78034,13 @@ var findBoardFiles = ({
|
|
|
77981
78034
|
boardFileSet.add(match);
|
|
77982
78035
|
}
|
|
77983
78036
|
} else {
|
|
77984
|
-
const targetPath =
|
|
78037
|
+
const targetPath = path22.resolve(resolvedProjectDir, inputPath);
|
|
77985
78038
|
if (!fs21.existsSync(targetPath)) {
|
|
77986
78039
|
continue;
|
|
77987
78040
|
}
|
|
77988
78041
|
const stat4 = fs21.statSync(targetPath);
|
|
77989
78042
|
if (stat4.isDirectory()) {
|
|
77990
|
-
const resolvedDir =
|
|
78043
|
+
const resolvedDir = path22.resolve(targetPath);
|
|
77991
78044
|
if (isSubPath(resolvedDir, resolvedProjectDir)) {
|
|
77992
78045
|
for (const boardFile of absoluteBoardFiles) {
|
|
77993
78046
|
if (isSubPath(boardFile, resolvedDir)) {
|
|
@@ -77998,7 +78051,7 @@ var findBoardFiles = ({
|
|
|
77998
78051
|
const externalMatches = globbySync(boardFilePatterns, {
|
|
77999
78052
|
cwd: resolvedDir,
|
|
78000
78053
|
ignore
|
|
78001
|
-
}).map((f) =>
|
|
78054
|
+
}).map((f) => path22.join(resolvedDir, f));
|
|
78002
78055
|
for (const match of externalMatches) {
|
|
78003
78056
|
boardFileSet.add(match);
|
|
78004
78057
|
}
|
|
@@ -78026,10 +78079,10 @@ var findSelectableTsxFiles = (projectDir) => {
|
|
|
78026
78079
|
cwd: projectDir,
|
|
78027
78080
|
ignore: DEFAULT_IGNORED_PATTERNS
|
|
78028
78081
|
});
|
|
78029
|
-
return files.map((file) =>
|
|
78082
|
+
return files.map((file) => path23.resolve(projectDir, file)).filter((file) => fs22.existsSync(file)).sort();
|
|
78030
78083
|
};
|
|
78031
78084
|
var warnIfTsconfigMissingTscircuitType = (projectDir) => {
|
|
78032
|
-
const tsconfigPath =
|
|
78085
|
+
const tsconfigPath = path23.join(projectDir, "tsconfig.json");
|
|
78033
78086
|
if (!fs22.existsSync(tsconfigPath)) {
|
|
78034
78087
|
return;
|
|
78035
78088
|
}
|
|
@@ -78061,7 +78114,7 @@ var registerDev = (program3) => {
|
|
|
78061
78114
|
}
|
|
78062
78115
|
let absolutePath;
|
|
78063
78116
|
if (file) {
|
|
78064
|
-
absolutePath =
|
|
78117
|
+
absolutePath = path23.resolve(file);
|
|
78065
78118
|
if (!absolutePath.endsWith(".tsx") && !absolutePath.endsWith(".ts")) {
|
|
78066
78119
|
console.error("Error: Only .tsx files are supported");
|
|
78067
78120
|
return;
|
|
@@ -78080,7 +78133,7 @@ var registerDev = (program3) => {
|
|
|
78080
78133
|
return;
|
|
78081
78134
|
}
|
|
78082
78135
|
absolutePath = availableFiles[0];
|
|
78083
|
-
console.log("Selected file:",
|
|
78136
|
+
console.log("Selected file:", path23.relative(process.cwd(), absolutePath));
|
|
78084
78137
|
}
|
|
78085
78138
|
}
|
|
78086
78139
|
warnIfTsconfigMissingTscircuitType(process.cwd());
|
|
@@ -78102,7 +78155,7 @@ var registerDev = (program3) => {
|
|
|
78102
78155
|
|
|
78103
78156
|
${kleur_default.green(`@tscircuit/cli@${getVersion()}`)} ${kleur_default.gray("ready in")} ${kleur_default.white(`${Math.round(timeToStart)}ms`)}`);
|
|
78104
78157
|
console.log(`
|
|
78105
|
-
${kleur_default.bold("➜ Local:")} ${kleur_default.underline(kleur_default.cyan(`http://localhost:${port}`))}${server.componentFilePath ? kleur_default.underline(kleur_default.cyan(`/#file=${encodeURIComponent(
|
|
78158
|
+
${kleur_default.bold("➜ Local:")} ${kleur_default.underline(kleur_default.cyan(`http://localhost:${port}`))}${server.componentFilePath ? kleur_default.underline(kleur_default.cyan(`/#file=${encodeURIComponent(path23.relative(process.cwd(), server.componentFilePath).replaceAll("\\", "/"))}`)) : ""}
|
|
78106
78159
|
|
|
78107
78160
|
`);
|
|
78108
78161
|
console.log(kleur_default.gray(`Watching ${kleur_default.underline(server.projectDir.split("/").slice(-2).join("/"))} for changes...`));
|
|
@@ -78238,25 +78291,25 @@ var registerConfigPrint = (program3) => {
|
|
|
78238
78291
|
|
|
78239
78292
|
// cli/clone/register.ts
|
|
78240
78293
|
import * as fs25 from "node:fs";
|
|
78241
|
-
import * as
|
|
78294
|
+
import * as path26 from "node:path";
|
|
78242
78295
|
|
|
78243
78296
|
// cli/clone/clone-bug-report.ts
|
|
78244
78297
|
var import_jszip = __toESM2(require_lib4(), 1);
|
|
78245
78298
|
var import_prompts7 = __toESM2(require_prompts3(), 1);
|
|
78246
78299
|
import * as fs24 from "node:fs";
|
|
78247
|
-
import * as
|
|
78300
|
+
import * as path25 from "node:path";
|
|
78248
78301
|
|
|
78249
78302
|
// cli/clone/handle-existing-directory.ts
|
|
78250
78303
|
var import_prompts6 = __toESM2(require_prompts3(), 1);
|
|
78251
78304
|
import * as fs23 from "node:fs";
|
|
78252
|
-
import * as
|
|
78305
|
+
import * as path24 from "node:path";
|
|
78253
78306
|
var handleExistingDirectory = async (dirPath) => {
|
|
78254
78307
|
if (!fs23.existsSync(dirPath))
|
|
78255
78308
|
return;
|
|
78256
78309
|
const response = await import_prompts6.default({
|
|
78257
78310
|
type: "select",
|
|
78258
78311
|
name: "action",
|
|
78259
|
-
message: `Directory "${
|
|
78312
|
+
message: `Directory "${path24.basename(dirPath)}" already exists. What would you like to do?`,
|
|
78260
78313
|
choices: [
|
|
78261
78314
|
{ title: "Merge files into existing directory", value: "merge" },
|
|
78262
78315
|
{
|
|
@@ -78297,12 +78350,12 @@ var getCommonDirectoryPrefix = (paths) => {
|
|
|
78297
78350
|
return commonSegments.join("/");
|
|
78298
78351
|
};
|
|
78299
78352
|
var sanitizeRelativePath = (relativePath) => {
|
|
78300
|
-
const normalizedPath =
|
|
78353
|
+
const normalizedPath = path25.normalize(relativePath);
|
|
78301
78354
|
if (!normalizedPath)
|
|
78302
78355
|
return null;
|
|
78303
|
-
if (
|
|
78356
|
+
if (path25.isAbsolute(normalizedPath))
|
|
78304
78357
|
return null;
|
|
78305
|
-
const segments = normalizedPath.split(
|
|
78358
|
+
const segments = normalizedPath.split(path25.sep);
|
|
78306
78359
|
if (segments.some((segment) => segment === ".." || segment === "")) {
|
|
78307
78360
|
return null;
|
|
78308
78361
|
}
|
|
@@ -78317,7 +78370,7 @@ var cloneBugReport = async ({
|
|
|
78317
78370
|
console.error("Bug report ID must not be empty.");
|
|
78318
78371
|
process.exit(1);
|
|
78319
78372
|
}
|
|
78320
|
-
let dirPath =
|
|
78373
|
+
let dirPath = path25.resolve(`bug-report-${trimmedBugReportId}`);
|
|
78321
78374
|
await handleExistingDirectory(dirPath);
|
|
78322
78375
|
const ky2 = getRegistryApiKy();
|
|
78323
78376
|
let zipBuffer;
|
|
@@ -78347,25 +78400,25 @@ var cloneBugReport = async ({
|
|
|
78347
78400
|
console.warn(`Skipping potentially unsafe path: ${fileName}`);
|
|
78348
78401
|
continue;
|
|
78349
78402
|
}
|
|
78350
|
-
const fullPath =
|
|
78351
|
-
fs24.mkdirSync(
|
|
78403
|
+
const fullPath = path25.join(dirPath, sanitizedRelativePath);
|
|
78404
|
+
fs24.mkdirSync(path25.dirname(fullPath), { recursive: true });
|
|
78352
78405
|
const fileContent = await entry.async("nodebuffer");
|
|
78353
78406
|
fs24.writeFileSync(fullPath, fileContent);
|
|
78354
78407
|
}
|
|
78355
|
-
const packageJsonPath =
|
|
78408
|
+
const packageJsonPath = path25.join(dirPath, "package.json");
|
|
78356
78409
|
if (fs24.existsSync(packageJsonPath)) {
|
|
78357
78410
|
try {
|
|
78358
78411
|
const packageJson = JSON.parse(fs24.readFileSync(packageJsonPath, "utf-8"));
|
|
78359
78412
|
const packageName = packageJson?.name;
|
|
78360
78413
|
if (typeof packageName === "string" && packageName.trim()) {
|
|
78361
78414
|
const sanitizedName = packageName.replace(/[^a-zA-Z0-9]/g, "_");
|
|
78362
|
-
const suggestedDirPath =
|
|
78415
|
+
const suggestedDirPath = path25.resolve(`${sanitizedName}_${trimmedBugReportId.slice(7)}`);
|
|
78363
78416
|
if (suggestedDirPath !== dirPath) {
|
|
78364
78417
|
const response = await import_prompts7.default({
|
|
78365
78418
|
type: "confirm",
|
|
78366
78419
|
name: "rename",
|
|
78367
78420
|
initial: true,
|
|
78368
|
-
message: `Rename the directory to "${
|
|
78421
|
+
message: `Rename the directory to "${path25.basename(suggestedDirPath)}"?`
|
|
78369
78422
|
});
|
|
78370
78423
|
if (response.rename) {
|
|
78371
78424
|
await handleExistingDirectory(suggestedDirPath);
|
|
@@ -78378,9 +78431,9 @@ var cloneBugReport = async ({
|
|
|
78378
78431
|
console.warn("Unable to read package name for renaming:", error);
|
|
78379
78432
|
}
|
|
78380
78433
|
}
|
|
78381
|
-
fs24.writeFileSync(
|
|
78434
|
+
fs24.writeFileSync(path25.join(dirPath, ".npmrc"), "@tsci:registry=https://npm.tscircuit.com");
|
|
78382
78435
|
generateTsConfig(dirPath);
|
|
78383
|
-
const relativeDirPath =
|
|
78436
|
+
const relativeDirPath = path25.relative(originalCwd, dirPath);
|
|
78384
78437
|
console.log(kleur_default.green(`
|
|
78385
78438
|
Successfully cloned bug report to:`));
|
|
78386
78439
|
console.log(` ${dirPath}/
|
|
@@ -78419,7 +78472,7 @@ var registerClone = (program3) => {
|
|
|
78419
78472
|
const [, author, packageName] = match;
|
|
78420
78473
|
console.log(`Cloning ${author}/${packageName}...`);
|
|
78421
78474
|
const userSettingToIncludeAuthor = options.includeAuthor || cliConfig.get("alwaysCloneWithAuthorName");
|
|
78422
|
-
const dirPath = userSettingToIncludeAuthor ?
|
|
78475
|
+
const dirPath = userSettingToIncludeAuthor ? path26.resolve(`${author}.${packageName}`) : path26.resolve(packageName);
|
|
78423
78476
|
await handleExistingDirectory(dirPath);
|
|
78424
78477
|
const ky2 = getRegistryApiKy();
|
|
78425
78478
|
let packageFileList = {
|
|
@@ -78445,8 +78498,8 @@ var registerClone = (program3) => {
|
|
|
78445
78498
|
const filePath = fileInfo.file_path.replace(/^\/|dist\//g, "");
|
|
78446
78499
|
if (!filePath)
|
|
78447
78500
|
continue;
|
|
78448
|
-
const fullPath =
|
|
78449
|
-
fs25.mkdirSync(
|
|
78501
|
+
const fullPath = path26.join(dirPath, filePath);
|
|
78502
|
+
fs25.mkdirSync(path26.dirname(fullPath), { recursive: true });
|
|
78450
78503
|
try {
|
|
78451
78504
|
const fileContent = await ky2.get("package_files/get", {
|
|
78452
78505
|
searchParams: {
|
|
@@ -78460,10 +78513,10 @@ var registerClone = (program3) => {
|
|
|
78460
78513
|
console.warn(`Skipping ${filePath} due to error:`, error instanceof Error ? error.message : error);
|
|
78461
78514
|
}
|
|
78462
78515
|
}
|
|
78463
|
-
fs25.writeFileSync(
|
|
78516
|
+
fs25.writeFileSync(path26.join(dirPath, ".npmrc"), "@tsci:registry=https://npm.tscircuit.com");
|
|
78464
78517
|
generateTsConfig(dirPath);
|
|
78465
78518
|
await setupTsciProject(dirPath);
|
|
78466
|
-
const relativeDirPath =
|
|
78519
|
+
const relativeDirPath = path26.relative(originalCwd, dirPath);
|
|
78467
78520
|
console.log(kleur_default.green(`
|
|
78468
78521
|
Successfully cloned to:`));
|
|
78469
78522
|
console.log(` ${dirPath}/
|
|
@@ -78480,7 +78533,7 @@ var import_perfect_cli = __toESM2(require_dist7(), 1);
|
|
|
78480
78533
|
|
|
78481
78534
|
// lib/shared/export-snippet.ts
|
|
78482
78535
|
import fs27 from "node:fs";
|
|
78483
|
-
import
|
|
78536
|
+
import path28 from "node:path";
|
|
78484
78537
|
import { promisify as promisify3 } from "node:util";
|
|
78485
78538
|
|
|
78486
78539
|
// node_modules/circuit-json-to-readable-netlist/dist/index.js
|
|
@@ -79659,9 +79712,9 @@ var stringifyDsnJson = (dsnJson) => {
|
|
|
79659
79712
|
const stringifyCoordinates = (coordinates) => {
|
|
79660
79713
|
return coordinates.join(" ");
|
|
79661
79714
|
};
|
|
79662
|
-
const stringifyPath = (
|
|
79715
|
+
const stringifyPath = (path27, level) => {
|
|
79663
79716
|
const padding = indent.repeat(level);
|
|
79664
|
-
return `${padding}(path ${
|
|
79717
|
+
return `${padding}(path ${path27.layer} ${path27.width} ${stringifyCoordinates(path27.coordinates)})`;
|
|
79665
79718
|
};
|
|
79666
79719
|
result += `(pcb ${dsnJson.filename ? dsnJson.filename : "./converted_dsn.dsn"}
|
|
79667
79720
|
`;
|
|
@@ -80359,10 +80412,10 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
|
|
|
80359
80412
|
}
|
|
80360
80413
|
const instances = new SymbolInstances;
|
|
80361
80414
|
const project = new SymbolInstancesProject("");
|
|
80362
|
-
const
|
|
80363
|
-
|
|
80364
|
-
|
|
80365
|
-
project.paths.push(
|
|
80415
|
+
const path27 = new SymbolInstancePath(`/${kicadSch?.uuid?.value || ""}`);
|
|
80416
|
+
path27.reference = reference;
|
|
80417
|
+
path27.unit = 1;
|
|
80418
|
+
project.paths.push(path27);
|
|
80366
80419
|
instances.projects.push(project);
|
|
80367
80420
|
symbol._sxInstances = instances;
|
|
80368
80421
|
symbols3.push(symbol);
|
|
@@ -80570,11 +80623,11 @@ var AddSheetInstancesStage = class extends ConverterStage {
|
|
|
80570
80623
|
throw new Error("KicadSch instance not initialized in context");
|
|
80571
80624
|
}
|
|
80572
80625
|
const sheetInstances = new SheetInstances;
|
|
80573
|
-
const
|
|
80574
|
-
|
|
80626
|
+
const path27 = new SheetInstancesRootPath;
|
|
80627
|
+
path27.value = "/";
|
|
80575
80628
|
const page = new SheetInstancesRootPage("1");
|
|
80576
|
-
|
|
80577
|
-
sheetInstances.paths = [
|
|
80629
|
+
path27.pages = [page];
|
|
80630
|
+
sheetInstances.paths = [path27];
|
|
80578
80631
|
kicadSch.sheetInstances = sheetInstances;
|
|
80579
80632
|
kicadSch.embeddedFonts = new EmbeddedFonts3(false);
|
|
80580
80633
|
this.finished = true;
|
|
@@ -80929,12 +80982,12 @@ var AddGraphicsStage = class extends ConverterStage {
|
|
|
80929
80982
|
throw new Error("PCB transformation matrix not initialized in context");
|
|
80930
80983
|
}
|
|
80931
80984
|
const pcbSilkscreenPaths = this.ctx.db.pcb_silkscreen_path?.list() || [];
|
|
80932
|
-
for (const
|
|
80933
|
-
if (!
|
|
80985
|
+
for (const path27 of pcbSilkscreenPaths) {
|
|
80986
|
+
if (!path27.route || path27.route.length < 2)
|
|
80934
80987
|
continue;
|
|
80935
|
-
for (let i = 0;i <
|
|
80936
|
-
const startPoint =
|
|
80937
|
-
const endPoint =
|
|
80988
|
+
for (let i = 0;i < path27.route.length - 1; i++) {
|
|
80989
|
+
const startPoint = path27.route[i];
|
|
80990
|
+
const endPoint = path27.route[i + 1];
|
|
80938
80991
|
if (!startPoint || !endPoint)
|
|
80939
80992
|
continue;
|
|
80940
80993
|
const transformedStart = applyToPoint62(c2kMatPcb, {
|
|
@@ -80949,12 +81002,12 @@ var AddGraphicsStage = class extends ConverterStage {
|
|
|
80949
81002
|
top: "F.SilkS",
|
|
80950
81003
|
bottom: "B.SilkS"
|
|
80951
81004
|
};
|
|
80952
|
-
const kicadLayer = layerMap[
|
|
81005
|
+
const kicadLayer = layerMap[path27.layer] || path27.layer || "F.SilkS";
|
|
80953
81006
|
const grLine = new GrLine({
|
|
80954
81007
|
start: { x: transformedStart.x, y: transformedStart.y },
|
|
80955
81008
|
end: { x: transformedEnd.x, y: transformedEnd.y },
|
|
80956
81009
|
layer: kicadLayer,
|
|
80957
|
-
width:
|
|
81010
|
+
width: path27.stroke_width || 0.15
|
|
80958
81011
|
});
|
|
80959
81012
|
const graphicLines = kicadPcb.graphicLines;
|
|
80960
81013
|
graphicLines.push(grLine);
|
|
@@ -81062,7 +81115,7 @@ var import_jszip2 = __toESM2(require_lib4(), 1);
|
|
|
81062
81115
|
|
|
81063
81116
|
// lib/shared/generate-circuit-json.tsx
|
|
81064
81117
|
var import_make_vfs2 = __toESM2(require_dist8(), 1);
|
|
81065
|
-
import
|
|
81118
|
+
import path27 from "node:path";
|
|
81066
81119
|
import fs26 from "node:fs";
|
|
81067
81120
|
import { pathToFileURL } from "node:url";
|
|
81068
81121
|
import Debug11 from "debug";
|
|
@@ -81126,12 +81179,12 @@ async function generateCircuitJson({
|
|
|
81126
81179
|
const runner = new userLandTscircuit.RootCircuit({
|
|
81127
81180
|
platform: platformConfig
|
|
81128
81181
|
});
|
|
81129
|
-
const absoluteFilePath =
|
|
81130
|
-
const projectDir =
|
|
81182
|
+
const absoluteFilePath = path27.isAbsolute(filePath) ? filePath : path27.resolve(process.cwd(), filePath);
|
|
81183
|
+
const projectDir = path27.dirname(absoluteFilePath);
|
|
81131
81184
|
const resolvedOutputDir = outputDir ?? projectDir;
|
|
81132
|
-
const relativeComponentPath =
|
|
81133
|
-
const baseFileName = outputFileName ||
|
|
81134
|
-
const outputPath =
|
|
81185
|
+
const relativeComponentPath = path27.relative(projectDir, absoluteFilePath);
|
|
81186
|
+
const baseFileName = outputFileName || path27.basename(absoluteFilePath).replace(/\.[^.]+$/, "");
|
|
81187
|
+
const outputPath = path27.join(resolvedOutputDir, `${baseFileName}.circuit.json`);
|
|
81135
81188
|
debug11(`Project directory: ${projectDir}`);
|
|
81136
81189
|
debug11(`Relative component path: ${relativeComponentPath}`);
|
|
81137
81190
|
debug11(`Output path: ${outputPath}`);
|
|
@@ -81151,7 +81204,7 @@ async function generateCircuitJson({
|
|
|
81151
81204
|
return false;
|
|
81152
81205
|
if (normalizedFilePath.match(/^\.[^/]/))
|
|
81153
81206
|
return false;
|
|
81154
|
-
if (!ALLOWED_FILE_EXTENSIONS.includes(
|
|
81207
|
+
if (!ALLOWED_FILE_EXTENSIONS.includes(path27.extname(normalizedFilePath)))
|
|
81155
81208
|
return false;
|
|
81156
81209
|
return true;
|
|
81157
81210
|
},
|
|
@@ -81221,10 +81274,10 @@ var exportSnippet = async ({
|
|
|
81221
81274
|
onError(`Invalid format: ${format}`);
|
|
81222
81275
|
return onExit(1);
|
|
81223
81276
|
}
|
|
81224
|
-
const projectDir =
|
|
81225
|
-
const outputBaseName =
|
|
81277
|
+
const projectDir = path28.dirname(filePath);
|
|
81278
|
+
const outputBaseName = path28.basename(filePath).replace(/\.[^.]+$/, "");
|
|
81226
81279
|
const outputFileName = `${outputBaseName}${OUTPUT_EXTENSIONS[format]}`;
|
|
81227
|
-
const outputDestination =
|
|
81280
|
+
const outputDestination = path28.join(projectDir, outputPath ?? outputFileName);
|
|
81228
81281
|
const circuitData = await generateCircuitJson({
|
|
81229
81282
|
filePath,
|
|
81230
81283
|
saveToFile: format === "circuit-json",
|
|
@@ -81410,11 +81463,11 @@ var getSpiceWithPaddedSim = (circuitJson, options) => {
|
|
|
81410
81463
|
|
|
81411
81464
|
// lib/eecircuit-engine/run-simulation.ts
|
|
81412
81465
|
import { promises as fs28, existsSync as existsSync12 } from "node:fs";
|
|
81413
|
-
import
|
|
81466
|
+
import path29 from "node:path";
|
|
81414
81467
|
import os2 from "node:os";
|
|
81415
81468
|
var sim = null;
|
|
81416
81469
|
var fetchSimulation = async () => {
|
|
81417
|
-
const tempFilePath =
|
|
81470
|
+
const tempFilePath = path29.join(os2.tmpdir(), "eecircuit-engine-1.5.2.mjs");
|
|
81418
81471
|
if (!existsSync12(tempFilePath)) {
|
|
81419
81472
|
const url = "https://cdn.jsdelivr.net/npm/eecircuit-engine@1.5.2/+esm";
|
|
81420
81473
|
const response = await fetch(url);
|
|
@@ -81511,7 +81564,7 @@ var resultToCsv = (result) => {
|
|
|
81511
81564
|
};
|
|
81512
81565
|
|
|
81513
81566
|
// cli/export/register.ts
|
|
81514
|
-
import
|
|
81567
|
+
import path30 from "node:path";
|
|
81515
81568
|
import { promises as fs29 } from "node:fs";
|
|
81516
81569
|
var registerExport = (program3) => {
|
|
81517
81570
|
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) => {
|
|
@@ -81524,7 +81577,7 @@ var registerExport = (program3) => {
|
|
|
81524
81577
|
});
|
|
81525
81578
|
if (circuitJson) {
|
|
81526
81579
|
const spiceString = getSpiceWithPaddedSim(circuitJson);
|
|
81527
|
-
const outputSpicePath = options.output ??
|
|
81580
|
+
const outputSpicePath = options.output ?? path30.join(path30.dirname(file), `${path30.basename(file, path30.extname(file))}.spice.cir`);
|
|
81528
81581
|
await fs29.writeFile(outputSpicePath, spiceString);
|
|
81529
81582
|
const { result } = await runSimulation(spiceString);
|
|
81530
81583
|
const csvContent = resultToCsv(result);
|
|
@@ -81761,14 +81814,14 @@ class KeyStore {
|
|
|
81761
81814
|
}
|
|
81762
81815
|
}
|
|
81763
81816
|
function createKey(key) {
|
|
81764
|
-
let
|
|
81817
|
+
let path31 = null;
|
|
81765
81818
|
let id = null;
|
|
81766
81819
|
let src = null;
|
|
81767
81820
|
let weight = 1;
|
|
81768
81821
|
let getFn = null;
|
|
81769
81822
|
if (isString2(key) || isArray(key)) {
|
|
81770
81823
|
src = key;
|
|
81771
|
-
|
|
81824
|
+
path31 = createKeyPath(key);
|
|
81772
81825
|
id = createKeyId(key);
|
|
81773
81826
|
} else {
|
|
81774
81827
|
if (!hasOwn.call(key, "name")) {
|
|
@@ -81782,11 +81835,11 @@ function createKey(key) {
|
|
|
81782
81835
|
throw new Error(INVALID_KEY_WEIGHT_VALUE(name));
|
|
81783
81836
|
}
|
|
81784
81837
|
}
|
|
81785
|
-
|
|
81838
|
+
path31 = createKeyPath(name);
|
|
81786
81839
|
id = createKeyId(name);
|
|
81787
81840
|
getFn = key.getFn;
|
|
81788
81841
|
}
|
|
81789
|
-
return { path:
|
|
81842
|
+
return { path: path31, id, weight, src, getFn };
|
|
81790
81843
|
}
|
|
81791
81844
|
function createKeyPath(key) {
|
|
81792
81845
|
return isArray(key) ? key : key.split(".");
|
|
@@ -81794,34 +81847,34 @@ function createKeyPath(key) {
|
|
|
81794
81847
|
function createKeyId(key) {
|
|
81795
81848
|
return isArray(key) ? key.join(".") : key;
|
|
81796
81849
|
}
|
|
81797
|
-
function get(obj,
|
|
81850
|
+
function get(obj, path31) {
|
|
81798
81851
|
let list = [];
|
|
81799
81852
|
let arr = false;
|
|
81800
|
-
const deepGet = (obj2,
|
|
81853
|
+
const deepGet = (obj2, path32, index) => {
|
|
81801
81854
|
if (!isDefined(obj2)) {
|
|
81802
81855
|
return;
|
|
81803
81856
|
}
|
|
81804
|
-
if (!
|
|
81857
|
+
if (!path32[index]) {
|
|
81805
81858
|
list.push(obj2);
|
|
81806
81859
|
} else {
|
|
81807
|
-
let key =
|
|
81860
|
+
let key = path32[index];
|
|
81808
81861
|
const value = obj2[key];
|
|
81809
81862
|
if (!isDefined(value)) {
|
|
81810
81863
|
return;
|
|
81811
81864
|
}
|
|
81812
|
-
if (index ===
|
|
81865
|
+
if (index === path32.length - 1 && (isString2(value) || isNumber(value) || isBoolean(value))) {
|
|
81813
81866
|
list.push(toString(value));
|
|
81814
81867
|
} else if (isArray(value)) {
|
|
81815
81868
|
arr = true;
|
|
81816
81869
|
for (let i = 0, len = value.length;i < len; i += 1) {
|
|
81817
|
-
deepGet(value[i],
|
|
81870
|
+
deepGet(value[i], path32, index + 1);
|
|
81818
81871
|
}
|
|
81819
|
-
} else if (
|
|
81820
|
-
deepGet(value,
|
|
81872
|
+
} else if (path32.length) {
|
|
81873
|
+
deepGet(value, path32, index + 1);
|
|
81821
81874
|
}
|
|
81822
81875
|
}
|
|
81823
81876
|
};
|
|
81824
|
-
deepGet(obj, isString2(
|
|
81877
|
+
deepGet(obj, isString2(path31) ? path31.split(".") : path31, 0);
|
|
81825
81878
|
return arr ? list : list[0];
|
|
81826
81879
|
}
|
|
81827
81880
|
var MatchOptions = {
|
|
@@ -83013,8 +83066,8 @@ var registerSearch = (program3) => {
|
|
|
83013
83066
|
}
|
|
83014
83067
|
if (kicadResults.length) {
|
|
83015
83068
|
console.log(kleur_default.bold().underline(`Found ${kicadResults.length} footprint(s) from KiCad:`));
|
|
83016
|
-
kicadResults.forEach((
|
|
83017
|
-
console.log(`${(idx + 1).toString().padStart(2, " ")}. kicad:${
|
|
83069
|
+
kicadResults.forEach((path31, idx) => {
|
|
83070
|
+
console.log(`${(idx + 1).toString().padStart(2, " ")}. kicad:${path31.replace(".kicad_mod", "").replace(".pretty", "")}`);
|
|
83018
83071
|
});
|
|
83019
83072
|
}
|
|
83020
83073
|
if (!onlyKicad && results.packages.length) {
|
|
@@ -90791,11 +90844,11 @@ var require_react_reconciler_development = __commonJS2({
|
|
|
90791
90844
|
fiber = fiber.next, id2--;
|
|
90792
90845
|
return fiber;
|
|
90793
90846
|
}
|
|
90794
|
-
function copyWithSetImpl(obj,
|
|
90795
|
-
if (index >=
|
|
90847
|
+
function copyWithSetImpl(obj, path31, index, value) {
|
|
90848
|
+
if (index >= path31.length)
|
|
90796
90849
|
return value;
|
|
90797
|
-
var key =
|
|
90798
|
-
updated[key] = copyWithSetImpl(obj[key],
|
|
90850
|
+
var key = path31[index], updated = isArrayImpl(obj) ? obj.slice() : assign2({}, obj);
|
|
90851
|
+
updated[key] = copyWithSetImpl(obj[key], path31, index + 1, value);
|
|
90799
90852
|
return updated;
|
|
90800
90853
|
}
|
|
90801
90854
|
function copyWithRename(obj, oldPath, newPath) {
|
|
@@ -90815,11 +90868,11 @@ var require_react_reconciler_development = __commonJS2({
|
|
|
90815
90868
|
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);
|
|
90816
90869
|
return updated;
|
|
90817
90870
|
}
|
|
90818
|
-
function copyWithDeleteImpl(obj,
|
|
90819
|
-
var key =
|
|
90820
|
-
if (index + 1 ===
|
|
90871
|
+
function copyWithDeleteImpl(obj, path31, index) {
|
|
90872
|
+
var key = path31[index], updated = isArrayImpl(obj) ? obj.slice() : assign2({}, obj);
|
|
90873
|
+
if (index + 1 === path31.length)
|
|
90821
90874
|
return isArrayImpl(updated) ? updated.splice(key, 1) : delete updated[key], updated;
|
|
90822
|
-
updated[key] = copyWithDeleteImpl(obj[key],
|
|
90875
|
+
updated[key] = copyWithDeleteImpl(obj[key], path31, index + 1);
|
|
90823
90876
|
return updated;
|
|
90824
90877
|
}
|
|
90825
90878
|
function shouldSuspendImpl() {
|
|
@@ -99850,29 +99903,29 @@ Check the top-level render call using <` + componentName2 + ">.");
|
|
|
99850
99903
|
var didWarnAboutNestedUpdates = false;
|
|
99851
99904
|
var didWarnAboutFindNodeInStrictMode = {};
|
|
99852
99905
|
var overrideHookState = null, overrideHookStateDeletePath = null, overrideHookStateRenamePath = null, overrideProps = null, overridePropsDeletePath = null, overridePropsRenamePath = null, scheduleUpdate = null, setErrorHandler = null, setSuspenseHandler = null;
|
|
99853
|
-
overrideHookState = function(fiber, id2,
|
|
99906
|
+
overrideHookState = function(fiber, id2, path31, value) {
|
|
99854
99907
|
id2 = findHook(fiber, id2);
|
|
99855
|
-
id2 !== null && (
|
|
99908
|
+
id2 !== null && (path31 = copyWithSetImpl(id2.memoizedState, path31, 0, value), id2.memoizedState = path31, id2.baseState = path31, fiber.memoizedProps = assign2({}, fiber.memoizedProps), path31 = enqueueConcurrentRenderForLane(fiber, 2), path31 !== null && scheduleUpdateOnFiber(path31, fiber, 2));
|
|
99856
99909
|
};
|
|
99857
|
-
overrideHookStateDeletePath = function(fiber, id2,
|
|
99910
|
+
overrideHookStateDeletePath = function(fiber, id2, path31) {
|
|
99858
99911
|
id2 = findHook(fiber, id2);
|
|
99859
|
-
id2 !== null && (
|
|
99912
|
+
id2 !== null && (path31 = copyWithDeleteImpl(id2.memoizedState, path31, 0), id2.memoizedState = path31, id2.baseState = path31, fiber.memoizedProps = assign2({}, fiber.memoizedProps), path31 = enqueueConcurrentRenderForLane(fiber, 2), path31 !== null && scheduleUpdateOnFiber(path31, fiber, 2));
|
|
99860
99913
|
};
|
|
99861
99914
|
overrideHookStateRenamePath = function(fiber, id2, oldPath, newPath) {
|
|
99862
99915
|
id2 = findHook(fiber, id2);
|
|
99863
99916
|
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));
|
|
99864
99917
|
};
|
|
99865
|
-
overrideProps = function(fiber,
|
|
99866
|
-
fiber.pendingProps = copyWithSetImpl(fiber.memoizedProps,
|
|
99918
|
+
overrideProps = function(fiber, path31, value) {
|
|
99919
|
+
fiber.pendingProps = copyWithSetImpl(fiber.memoizedProps, path31, 0, value);
|
|
99867
99920
|
fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps);
|
|
99868
|
-
|
|
99869
|
-
|
|
99921
|
+
path31 = enqueueConcurrentRenderForLane(fiber, 2);
|
|
99922
|
+
path31 !== null && scheduleUpdateOnFiber(path31, fiber, 2);
|
|
99870
99923
|
};
|
|
99871
|
-
overridePropsDeletePath = function(fiber,
|
|
99872
|
-
fiber.pendingProps = copyWithDeleteImpl(fiber.memoizedProps,
|
|
99924
|
+
overridePropsDeletePath = function(fiber, path31) {
|
|
99925
|
+
fiber.pendingProps = copyWithDeleteImpl(fiber.memoizedProps, path31, 0);
|
|
99873
99926
|
fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps);
|
|
99874
|
-
|
|
99875
|
-
|
|
99927
|
+
path31 = enqueueConcurrentRenderForLane(fiber, 2);
|
|
99928
|
+
path31 !== null && scheduleUpdateOnFiber(path31, fiber, 2);
|
|
99876
99929
|
};
|
|
99877
99930
|
overridePropsRenamePath = function(fiber, oldPath, newPath) {
|
|
99878
99931
|
fiber.pendingProps = copyWithRename(fiber.memoizedProps, oldPath, newPath);
|
|
@@ -115209,10 +115262,10 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
115209
115262
|
var setErrorHandler = null;
|
|
115210
115263
|
var setSuspenseHandler = null;
|
|
115211
115264
|
{
|
|
115212
|
-
var copyWithDeleteImpl = function(obj,
|
|
115213
|
-
var key =
|
|
115265
|
+
var copyWithDeleteImpl = function(obj, path31, index2) {
|
|
115266
|
+
var key = path31[index2];
|
|
115214
115267
|
var updated = isArray2(obj) ? obj.slice() : assign2({}, obj);
|
|
115215
|
-
if (index2 + 1 ===
|
|
115268
|
+
if (index2 + 1 === path31.length) {
|
|
115216
115269
|
if (isArray2(updated)) {
|
|
115217
115270
|
updated.splice(key, 1);
|
|
115218
115271
|
} else {
|
|
@@ -115220,11 +115273,11 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
115220
115273
|
}
|
|
115221
115274
|
return updated;
|
|
115222
115275
|
}
|
|
115223
|
-
updated[key] = copyWithDeleteImpl(obj[key],
|
|
115276
|
+
updated[key] = copyWithDeleteImpl(obj[key], path31, index2 + 1);
|
|
115224
115277
|
return updated;
|
|
115225
115278
|
};
|
|
115226
|
-
var copyWithDelete = function(obj,
|
|
115227
|
-
return copyWithDeleteImpl(obj,
|
|
115279
|
+
var copyWithDelete = function(obj, path31) {
|
|
115280
|
+
return copyWithDeleteImpl(obj, path31, 0);
|
|
115228
115281
|
};
|
|
115229
115282
|
var copyWithRenameImpl = function(obj, oldPath, newPath, index2) {
|
|
115230
115283
|
var oldKey = oldPath[index2];
|
|
@@ -115256,17 +115309,17 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
115256
115309
|
}
|
|
115257
115310
|
return copyWithRenameImpl(obj, oldPath, newPath, 0);
|
|
115258
115311
|
};
|
|
115259
|
-
var copyWithSetImpl = function(obj,
|
|
115260
|
-
if (index2 >=
|
|
115312
|
+
var copyWithSetImpl = function(obj, path31, index2, value) {
|
|
115313
|
+
if (index2 >= path31.length) {
|
|
115261
115314
|
return value;
|
|
115262
115315
|
}
|
|
115263
|
-
var key =
|
|
115316
|
+
var key = path31[index2];
|
|
115264
115317
|
var updated = isArray2(obj) ? obj.slice() : assign2({}, obj);
|
|
115265
|
-
updated[key] = copyWithSetImpl(obj[key],
|
|
115318
|
+
updated[key] = copyWithSetImpl(obj[key], path31, index2 + 1, value);
|
|
115266
115319
|
return updated;
|
|
115267
115320
|
};
|
|
115268
|
-
var copyWithSet = function(obj,
|
|
115269
|
-
return copyWithSetImpl(obj,
|
|
115321
|
+
var copyWithSet = function(obj, path31, value) {
|
|
115322
|
+
return copyWithSetImpl(obj, path31, 0, value);
|
|
115270
115323
|
};
|
|
115271
115324
|
var findHook = function(fiber, id2) {
|
|
115272
115325
|
var currentHook2 = fiber.memoizedState;
|
|
@@ -115276,10 +115329,10 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
115276
115329
|
}
|
|
115277
115330
|
return currentHook2;
|
|
115278
115331
|
};
|
|
115279
|
-
overrideHookState = function(fiber, id2,
|
|
115332
|
+
overrideHookState = function(fiber, id2, path31, value) {
|
|
115280
115333
|
var hook = findHook(fiber, id2);
|
|
115281
115334
|
if (hook !== null) {
|
|
115282
|
-
var newState = copyWithSet(hook.memoizedState,
|
|
115335
|
+
var newState = copyWithSet(hook.memoizedState, path31, value);
|
|
115283
115336
|
hook.memoizedState = newState;
|
|
115284
115337
|
hook.baseState = newState;
|
|
115285
115338
|
fiber.memoizedProps = assign2({}, fiber.memoizedProps);
|
|
@@ -115289,10 +115342,10 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
115289
115342
|
}
|
|
115290
115343
|
}
|
|
115291
115344
|
};
|
|
115292
|
-
overrideHookStateDeletePath = function(fiber, id2,
|
|
115345
|
+
overrideHookStateDeletePath = function(fiber, id2, path31) {
|
|
115293
115346
|
var hook = findHook(fiber, id2);
|
|
115294
115347
|
if (hook !== null) {
|
|
115295
|
-
var newState = copyWithDelete(hook.memoizedState,
|
|
115348
|
+
var newState = copyWithDelete(hook.memoizedState, path31);
|
|
115296
115349
|
hook.memoizedState = newState;
|
|
115297
115350
|
hook.baseState = newState;
|
|
115298
115351
|
fiber.memoizedProps = assign2({}, fiber.memoizedProps);
|
|
@@ -115315,8 +115368,8 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
115315
115368
|
}
|
|
115316
115369
|
}
|
|
115317
115370
|
};
|
|
115318
|
-
overrideProps = function(fiber,
|
|
115319
|
-
fiber.pendingProps = copyWithSet(fiber.memoizedProps,
|
|
115371
|
+
overrideProps = function(fiber, path31, value) {
|
|
115372
|
+
fiber.pendingProps = copyWithSet(fiber.memoizedProps, path31, value);
|
|
115320
115373
|
if (fiber.alternate) {
|
|
115321
115374
|
fiber.alternate.pendingProps = fiber.pendingProps;
|
|
115322
115375
|
}
|
|
@@ -115325,8 +115378,8 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
115325
115378
|
scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp);
|
|
115326
115379
|
}
|
|
115327
115380
|
};
|
|
115328
|
-
overridePropsDeletePath = function(fiber,
|
|
115329
|
-
fiber.pendingProps = copyWithDelete(fiber.memoizedProps,
|
|
115381
|
+
overridePropsDeletePath = function(fiber, path31) {
|
|
115382
|
+
fiber.pendingProps = copyWithDelete(fiber.memoizedProps, path31);
|
|
115330
115383
|
if (fiber.alternate) {
|
|
115331
115384
|
fiber.alternate.pendingProps = fiber.pendingProps;
|
|
115332
115385
|
}
|
|
@@ -121377,7 +121430,7 @@ var parsePin = (pinString) => {
|
|
|
121377
121430
|
const colorMatch = pinString.match(/#[0-9A-F]{6}/);
|
|
121378
121431
|
const labelColor = colorMatch ? colorMatch[0] : "";
|
|
121379
121432
|
const pathMatch = pinString.match(/\^\^([^~]+)/);
|
|
121380
|
-
const
|
|
121433
|
+
const path31 = pathMatch ? pathMatch[1] : "";
|
|
121381
121434
|
const arrowMatch = pinString.match(/\^\^0~(.+)$/);
|
|
121382
121435
|
const arrow = arrowMatch ? arrowMatch[1] : "";
|
|
121383
121436
|
const r3 = Number.parseFloat(rotation2);
|
|
@@ -121391,7 +121444,7 @@ var parsePin = (pinString) => {
|
|
|
121391
121444
|
rotation: Number.isNaN(r3) ? 0 : r3,
|
|
121392
121445
|
label,
|
|
121393
121446
|
labelColor,
|
|
121394
|
-
path:
|
|
121447
|
+
path: path31,
|
|
121395
121448
|
arrow
|
|
121396
121449
|
};
|
|
121397
121450
|
};
|
|
@@ -121831,15 +121884,15 @@ function generateArcFromSweep(startX, startY, endX, endY, radius, largeArcFlag,
|
|
|
121831
121884
|
}
|
|
121832
121885
|
}
|
|
121833
121886
|
const numPoints = Math.max(2, Math.ceil(Math.abs(endAngle - startAngle) * radius));
|
|
121834
|
-
const
|
|
121887
|
+
const path31 = [];
|
|
121835
121888
|
for (let i = 0;i <= numPoints; i++) {
|
|
121836
121889
|
const t3 = i / numPoints;
|
|
121837
121890
|
const angle2 = startAngle + t3 * (endAngle - startAngle);
|
|
121838
121891
|
const x = centerX + radius * Math.cos(angle2);
|
|
121839
121892
|
const y = centerY + radius * Math.sin(angle2);
|
|
121840
|
-
|
|
121893
|
+
path31.push({ x, y });
|
|
121841
121894
|
}
|
|
121842
|
-
return
|
|
121895
|
+
return path31;
|
|
121843
121896
|
}
|
|
121844
121897
|
var __defProp4 = Object.defineProperty;
|
|
121845
121898
|
var __export22 = (target, all) => {
|
|
@@ -130916,17 +130969,17 @@ var ObstacleList = class {
|
|
|
130916
130969
|
return obstacles;
|
|
130917
130970
|
}
|
|
130918
130971
|
};
|
|
130919
|
-
function removePathLoops(
|
|
130920
|
-
if (
|
|
130921
|
-
return
|
|
130922
|
-
const result = [{ ...
|
|
130923
|
-
let currentLayer =
|
|
130924
|
-
for (let i = 1;i <
|
|
130925
|
-
const currentSegment = { start:
|
|
130926
|
-
const isVia =
|
|
130927
|
-
if (
|
|
130928
|
-
result.push({ ...
|
|
130929
|
-
currentLayer =
|
|
130972
|
+
function removePathLoops(path31) {
|
|
130973
|
+
if (path31.length < 4)
|
|
130974
|
+
return path31;
|
|
130975
|
+
const result = [{ ...path31[0] }];
|
|
130976
|
+
let currentLayer = path31[0].layer;
|
|
130977
|
+
for (let i = 1;i < path31.length; i++) {
|
|
130978
|
+
const currentSegment = { start: path31[i - 1], end: path31[i] };
|
|
130979
|
+
const isVia = path31[i].route_type === "via" || path31[i - 1].route_type === "via";
|
|
130980
|
+
if (path31[i].layer !== currentLayer || isVia) {
|
|
130981
|
+
result.push({ ...path31[i] });
|
|
130982
|
+
currentLayer = path31[i].layer;
|
|
130930
130983
|
continue;
|
|
130931
130984
|
}
|
|
130932
130985
|
let intersectionFound = false;
|
|
@@ -130955,8 +131008,8 @@ function removePathLoops(path30) {
|
|
|
130955
131008
|
result.push(intersectionPoint);
|
|
130956
131009
|
}
|
|
130957
131010
|
const lastPoint = result[result.length - 1];
|
|
130958
|
-
if (lastPoint.x !==
|
|
130959
|
-
result.push(
|
|
131011
|
+
if (lastPoint.x !== path31[i].x || lastPoint.y !== path31[i].y) {
|
|
131012
|
+
result.push(path31[i]);
|
|
130960
131013
|
}
|
|
130961
131014
|
}
|
|
130962
131015
|
return result;
|
|
@@ -131445,10 +131498,10 @@ var GeneralizedAstarAutorouter = class {
|
|
|
131445
131498
|
});
|
|
131446
131499
|
}
|
|
131447
131500
|
if (current2.parent) {
|
|
131448
|
-
const
|
|
131501
|
+
const path31 = [];
|
|
131449
131502
|
let p = current2;
|
|
131450
131503
|
while (p) {
|
|
131451
|
-
|
|
131504
|
+
path31.unshift(p);
|
|
131452
131505
|
p = p.parent;
|
|
131453
131506
|
}
|
|
131454
131507
|
debugSolution.push({
|
|
@@ -131456,7 +131509,7 @@ var GeneralizedAstarAutorouter = class {
|
|
|
131456
131509
|
pcb_component_id: "",
|
|
131457
131510
|
pcb_fabrication_note_path_id: `note_path_${current2.x}_${current2.y}`,
|
|
131458
131511
|
layer: "top",
|
|
131459
|
-
route:
|
|
131512
|
+
route: path31,
|
|
131460
131513
|
stroke_width: 0.01
|
|
131461
131514
|
});
|
|
131462
131515
|
}
|
|
@@ -136378,13 +136431,13 @@ var RBush = class {
|
|
|
136378
136431
|
return this;
|
|
136379
136432
|
let node = this.data;
|
|
136380
136433
|
const bbox = this.toBBox(item);
|
|
136381
|
-
const
|
|
136434
|
+
const path31 = [];
|
|
136382
136435
|
const indexes = [];
|
|
136383
136436
|
let i, parent, goingUp;
|
|
136384
|
-
while (node ||
|
|
136437
|
+
while (node || path31.length) {
|
|
136385
136438
|
if (!node) {
|
|
136386
|
-
node =
|
|
136387
|
-
parent =
|
|
136439
|
+
node = path31.pop();
|
|
136440
|
+
parent = path31[path31.length - 1];
|
|
136388
136441
|
i = indexes.pop();
|
|
136389
136442
|
goingUp = true;
|
|
136390
136443
|
}
|
|
@@ -136392,13 +136445,13 @@ var RBush = class {
|
|
|
136392
136445
|
const index = findItem(item, node.children, equalsFn);
|
|
136393
136446
|
if (index !== -1) {
|
|
136394
136447
|
node.children.splice(index, 1);
|
|
136395
|
-
|
|
136396
|
-
this._condense(
|
|
136448
|
+
path31.push(node);
|
|
136449
|
+
this._condense(path31);
|
|
136397
136450
|
return this;
|
|
136398
136451
|
}
|
|
136399
136452
|
}
|
|
136400
136453
|
if (!goingUp && !node.leaf && contains(node, bbox)) {
|
|
136401
|
-
|
|
136454
|
+
path31.push(node);
|
|
136402
136455
|
indexes.push(i);
|
|
136403
136456
|
i = 0;
|
|
136404
136457
|
parent = node;
|
|
@@ -136469,10 +136522,10 @@ var RBush = class {
|
|
|
136469
136522
|
calcBBox(node, this.toBBox);
|
|
136470
136523
|
return node;
|
|
136471
136524
|
}
|
|
136472
|
-
_chooseSubtree(bbox, node, level,
|
|
136525
|
+
_chooseSubtree(bbox, node, level, path31) {
|
|
136473
136526
|
while (true) {
|
|
136474
|
-
|
|
136475
|
-
if (node.leaf ||
|
|
136527
|
+
path31.push(node);
|
|
136528
|
+
if (node.leaf || path31.length - 1 === level)
|
|
136476
136529
|
break;
|
|
136477
136530
|
let minArea = Infinity;
|
|
136478
136531
|
let minEnlargement = Infinity;
|
|
@@ -136581,21 +136634,21 @@ var RBush = class {
|
|
|
136581
136634
|
}
|
|
136582
136635
|
return margin;
|
|
136583
136636
|
}
|
|
136584
|
-
_adjustParentBBoxes(bbox,
|
|
136637
|
+
_adjustParentBBoxes(bbox, path31, level) {
|
|
136585
136638
|
for (let i = level;i >= 0; i--) {
|
|
136586
|
-
extend(
|
|
136639
|
+
extend(path31[i], bbox);
|
|
136587
136640
|
}
|
|
136588
136641
|
}
|
|
136589
|
-
_condense(
|
|
136590
|
-
for (let i =
|
|
136591
|
-
if (
|
|
136642
|
+
_condense(path31) {
|
|
136643
|
+
for (let i = path31.length - 1, siblings;i >= 0; i--) {
|
|
136644
|
+
if (path31[i].children.length === 0) {
|
|
136592
136645
|
if (i > 0) {
|
|
136593
|
-
siblings =
|
|
136594
|
-
siblings.splice(siblings.indexOf(
|
|
136646
|
+
siblings = path31[i - 1].children;
|
|
136647
|
+
siblings.splice(siblings.indexOf(path31[i]), 1);
|
|
136595
136648
|
} else
|
|
136596
136649
|
this.clear();
|
|
136597
136650
|
} else
|
|
136598
|
-
calcBBox(
|
|
136651
|
+
calcBBox(path31[i], this.toBBox);
|
|
136599
136652
|
}
|
|
136600
136653
|
}
|
|
136601
136654
|
};
|
|
@@ -137740,7 +137793,7 @@ var CapacityEdgeToPortSegmentSolver = class extends BaseSolver {
|
|
|
137740
137793
|
this.capacityPaths = capacityPaths;
|
|
137741
137794
|
this.colorMap = colorMap ?? {};
|
|
137742
137795
|
this.unprocessedNodeIds = [
|
|
137743
|
-
...new Set(capacityPaths.flatMap((
|
|
137796
|
+
...new Set(capacityPaths.flatMap((path31) => path31.nodeIds))
|
|
137744
137797
|
];
|
|
137745
137798
|
this.nodePortSegments = /* @__PURE__ */ new Map;
|
|
137746
137799
|
}
|
|
@@ -137751,17 +137804,17 @@ var CapacityEdgeToPortSegmentSolver = class extends BaseSolver {
|
|
|
137751
137804
|
return;
|
|
137752
137805
|
}
|
|
137753
137806
|
const pathsGoingThroughNode = [];
|
|
137754
|
-
for (const
|
|
137755
|
-
const indexOfNodeInPath =
|
|
137807
|
+
for (const path31 of this.capacityPaths) {
|
|
137808
|
+
const indexOfNodeInPath = path31.nodeIds.indexOf(nodeId);
|
|
137756
137809
|
if (indexOfNodeInPath !== -1) {
|
|
137757
|
-
pathsGoingThroughNode.push({ path:
|
|
137810
|
+
pathsGoingThroughNode.push({ path: path31, indexOfNodeInPath });
|
|
137758
137811
|
}
|
|
137759
137812
|
}
|
|
137760
137813
|
const node = this.nodeMap.get(nodeId);
|
|
137761
137814
|
const nodePortSegments = [];
|
|
137762
|
-
for (const { path:
|
|
137763
|
-
const entryNodeId =
|
|
137764
|
-
const exitNodeId =
|
|
137815
|
+
for (const { path: path31, indexOfNodeInPath } of pathsGoingThroughNode) {
|
|
137816
|
+
const entryNodeId = path31.nodeIds[indexOfNodeInPath - 1];
|
|
137817
|
+
const exitNodeId = path31.nodeIds[indexOfNodeInPath + 1];
|
|
137765
137818
|
for (const adjNodeId of [entryNodeId, exitNodeId]) {
|
|
137766
137819
|
const adjNode = this.nodeMap.get(adjNodeId);
|
|
137767
137820
|
if (!adjNode)
|
|
@@ -137774,7 +137827,7 @@ var CapacityEdgeToPortSegmentSolver = class extends BaseSolver {
|
|
|
137774
137827
|
capacityMeshNodeId: nodeId,
|
|
137775
137828
|
start: segment2.start,
|
|
137776
137829
|
end: segment2.end,
|
|
137777
|
-
connectionNames: [
|
|
137830
|
+
connectionNames: [path31.connectionName],
|
|
137778
137831
|
availableZ: mutuallyAvailableZ
|
|
137779
137832
|
};
|
|
137780
137833
|
nodePortSegments.push(portSegment);
|
|
@@ -138580,37 +138633,37 @@ var SingleHighDensityRouteSolver = class extends BaseSolver {
|
|
|
138580
138633
|
return neighbors;
|
|
138581
138634
|
}
|
|
138582
138635
|
getNodePath(node) {
|
|
138583
|
-
const
|
|
138636
|
+
const path31 = [];
|
|
138584
138637
|
while (node) {
|
|
138585
|
-
|
|
138638
|
+
path31.push(node);
|
|
138586
138639
|
node = node.parent;
|
|
138587
138640
|
}
|
|
138588
|
-
return
|
|
138641
|
+
return path31;
|
|
138589
138642
|
}
|
|
138590
138643
|
getViasInNodePath(node) {
|
|
138591
|
-
const
|
|
138644
|
+
const path31 = this.getNodePath(node);
|
|
138592
138645
|
const vias = [];
|
|
138593
|
-
for (let i = 0;i <
|
|
138594
|
-
if (
|
|
138595
|
-
vias.push({ x:
|
|
138646
|
+
for (let i = 0;i < path31.length - 1; i++) {
|
|
138647
|
+
if (path31[i].z !== path31[i + 1].z) {
|
|
138648
|
+
vias.push({ x: path31[i].x, y: path31[i].y });
|
|
138596
138649
|
}
|
|
138597
138650
|
}
|
|
138598
138651
|
return vias;
|
|
138599
138652
|
}
|
|
138600
138653
|
setSolvedPath(node) {
|
|
138601
|
-
const
|
|
138602
|
-
|
|
138654
|
+
const path31 = this.getNodePath(node);
|
|
138655
|
+
path31.reverse();
|
|
138603
138656
|
const vias = [];
|
|
138604
|
-
for (let i = 0;i <
|
|
138605
|
-
if (
|
|
138606
|
-
vias.push({ x:
|
|
138657
|
+
for (let i = 0;i < path31.length - 1; i++) {
|
|
138658
|
+
if (path31[i].z !== path31[i + 1].z) {
|
|
138659
|
+
vias.push({ x: path31[i].x, y: path31[i].y });
|
|
138607
138660
|
}
|
|
138608
138661
|
}
|
|
138609
138662
|
this.solvedPath = {
|
|
138610
138663
|
connectionName: this.connectionName,
|
|
138611
138664
|
traceThickness: this.traceThickness,
|
|
138612
138665
|
viaDiameter: this.viaDiameter,
|
|
138613
|
-
route:
|
|
138666
|
+
route: path31.map((node2) => ({ x: node2.x, y: node2.y, z: node2.z })).concat([this.B]),
|
|
138614
138667
|
vias
|
|
138615
138668
|
};
|
|
138616
138669
|
}
|
|
@@ -139418,12 +139471,12 @@ function computeDumbbellPaths({
|
|
|
139418
139471
|
specialType: circleCenter === A3 ? "A" : "B"
|
|
139419
139472
|
};
|
|
139420
139473
|
};
|
|
139421
|
-
const subdivideOptimalPath = (
|
|
139422
|
-
if (
|
|
139423
|
-
return
|
|
139424
|
-
const result = [
|
|
139425
|
-
for (let i = 0;i <
|
|
139426
|
-
const segment2 = { start:
|
|
139474
|
+
const subdivideOptimalPath = (path31, numSubdivisions) => {
|
|
139475
|
+
if (path31.length < 2)
|
|
139476
|
+
return path31;
|
|
139477
|
+
const result = [path31[0]];
|
|
139478
|
+
for (let i = 0;i < path31.length - 1; i++) {
|
|
139479
|
+
const segment2 = { start: path31[i], end: path31[i + 1] };
|
|
139427
139480
|
const segmentMidpoint = {
|
|
139428
139481
|
x: (segment2.start.x + segment2.end.x) / 2,
|
|
139429
139482
|
y: (segment2.start.y + segment2.end.y) / 2
|
|
@@ -139485,7 +139538,7 @@ function computeDumbbellPaths({
|
|
|
139485
139538
|
}
|
|
139486
139539
|
subdivisionPoints.forEach((p) => result.push(p));
|
|
139487
139540
|
}
|
|
139488
|
-
result.push(
|
|
139541
|
+
result.push(path31[i + 1]);
|
|
139489
139542
|
}
|
|
139490
139543
|
if (result.length > 1) {
|
|
139491
139544
|
const filteredResult = [result[0]];
|
|
@@ -139720,13 +139773,13 @@ function computeDumbbellPaths({
|
|
|
139720
139773
|
].map((l, index) => ({ ...l, index }));
|
|
139721
139774
|
};
|
|
139722
139775
|
const subdivideJLinePath = (jLine, oppositePoint, r3, m2, numSubdivisions) => {
|
|
139723
|
-
const
|
|
139724
|
-
if (
|
|
139725
|
-
return
|
|
139776
|
+
const path31 = jLine.points;
|
|
139777
|
+
if (path31.length < 2)
|
|
139778
|
+
return path31;
|
|
139726
139779
|
const minDistThreshold = r3 + m2;
|
|
139727
|
-
const result = [
|
|
139728
|
-
for (let i = 0;i <
|
|
139729
|
-
const segment2 = { start:
|
|
139780
|
+
const result = [path31[0]];
|
|
139781
|
+
for (let i = 0;i < path31.length - 1; i++) {
|
|
139782
|
+
const segment2 = { start: path31[i], end: path31[i + 1] };
|
|
139730
139783
|
const distToOpposite = pointToSegmentDistance22(oppositePoint, segment2.start, segment2.end);
|
|
139731
139784
|
if (distToOpposite < minDistThreshold) {
|
|
139732
139785
|
const closestPt = closestPointOnSegment(segment2, oppositePoint);
|
|
@@ -139795,26 +139848,26 @@ function computeDumbbellPaths({
|
|
|
139795
139848
|
return { index: 0, path: [] };
|
|
139796
139849
|
}
|
|
139797
139850
|
const optimalPath2 = validPaths.sort((a, b3) => a.length - b3.length)[0];
|
|
139798
|
-
const
|
|
139799
|
-
const firstPoint =
|
|
139800
|
-
const dist3 = distance3(firstPoint,
|
|
139801
|
-
const dist4 = distance3(firstPoint,
|
|
139851
|
+
const path31 = [...optimalPath2.path];
|
|
139852
|
+
const firstPoint = path31[0];
|
|
139853
|
+
const dist3 = distance3(firstPoint, path31[2]);
|
|
139854
|
+
const dist4 = distance3(firstPoint, path31[3]);
|
|
139802
139855
|
const closerIdx = dist3 < dist4 ? 2 : 3;
|
|
139803
|
-
if (dist3 < distance3(firstPoint,
|
|
139804
|
-
|
|
139856
|
+
if (dist3 < distance3(firstPoint, path31[1]) || dist4 < distance3(firstPoint, path31[1])) {
|
|
139857
|
+
path31.splice(1, closerIdx - 1);
|
|
139805
139858
|
}
|
|
139806
|
-
const lastPoint =
|
|
139807
|
-
const distM3 = distance3(lastPoint,
|
|
139808
|
-
const distM4 = distance3(lastPoint,
|
|
139809
|
-
const closerLastIdx = distM3 < distM4 ?
|
|
139810
|
-
if (distM3 < distance3(lastPoint,
|
|
139811
|
-
|
|
139859
|
+
const lastPoint = path31[path31.length - 1];
|
|
139860
|
+
const distM3 = distance3(lastPoint, path31[path31.length - 3]);
|
|
139861
|
+
const distM4 = distance3(lastPoint, path31[path31.length - 4]);
|
|
139862
|
+
const closerLastIdx = distM3 < distM4 ? path31.length - 3 : path31.length - 4;
|
|
139863
|
+
if (distM3 < distance3(lastPoint, path31[path31.length - 2]) || distM4 < distance3(lastPoint, path31[path31.length - 2])) {
|
|
139864
|
+
path31.splice(closerLastIdx + 1, path31.length - closerLastIdx - 2);
|
|
139812
139865
|
}
|
|
139813
139866
|
return {
|
|
139814
139867
|
index: optimalPath2.index,
|
|
139815
|
-
path:
|
|
139816
|
-
startsAt:
|
|
139817
|
-
goesTo:
|
|
139868
|
+
path: path31,
|
|
139869
|
+
startsAt: path31[0] === C2 ? "C" : "D",
|
|
139870
|
+
goesTo: path31[path31.length - 1] === C2 ? "C" : "D"
|
|
139818
139871
|
};
|
|
139819
139872
|
};
|
|
139820
139873
|
const optimalPath = findOptimalPath();
|
|
@@ -141234,9 +141287,9 @@ var ViaPossibilitiesSolver2 = class extends BaseSolver {
|
|
|
141234
141287
|
let closestIntersection = null;
|
|
141235
141288
|
let intersectedSegmentZ = null;
|
|
141236
141289
|
const checkIntersectionsWithPathMap = (pathMap) => {
|
|
141237
|
-
for (const
|
|
141238
|
-
for (let i = 0;i <
|
|
141239
|
-
const segment2 = [
|
|
141290
|
+
for (const path31 of pathMap.values()) {
|
|
141291
|
+
for (let i = 0;i < path31.length - 1; i++) {
|
|
141292
|
+
const segment2 = [path31[i], path31[i + 1]];
|
|
141240
141293
|
if (segment2[0].x === segment2[1].x && segment2[0].y === segment2[1].y) {
|
|
141241
141294
|
continue;
|
|
141242
141295
|
}
|
|
@@ -141366,11 +141419,11 @@ var ViaPossibilitiesSolver2 = class extends BaseSolver {
|
|
|
141366
141419
|
});
|
|
141367
141420
|
}
|
|
141368
141421
|
const drawPath = (pathMap, labelPrefix) => {
|
|
141369
|
-
for (const [connectionName,
|
|
141422
|
+
for (const [connectionName, path31] of pathMap.entries()) {
|
|
141370
141423
|
const color = colorMap[connectionName] ?? "black";
|
|
141371
|
-
for (let i = 0;i <
|
|
141372
|
-
const p12 =
|
|
141373
|
-
const p2 =
|
|
141424
|
+
for (let i = 0;i < path31.length - 1; i++) {
|
|
141425
|
+
const p12 = path31[i];
|
|
141426
|
+
const p2 = path31[i + 1];
|
|
141374
141427
|
if (p12.x === p2.x && p12.y === p2.y && p12.z !== p2.z) {
|
|
141375
141428
|
graphics.circles.push({
|
|
141376
141429
|
center: { x: p12.x, y: p12.y },
|
|
@@ -141968,10 +142021,10 @@ function detectMultiConnectionClosedFacesWithoutVias(polyLines, bounds) {
|
|
|
141968
142021
|
const allSegments = [];
|
|
141969
142022
|
const viaPoints = /* @__PURE__ */ new Map;
|
|
141970
142023
|
for (const polyLine of polyLines) {
|
|
141971
|
-
const
|
|
141972
|
-
for (let i = 0;i <
|
|
141973
|
-
const p12 =
|
|
141974
|
-
const p2 =
|
|
142024
|
+
const path31 = [polyLine.start, ...polyLine.mPoints, polyLine.end];
|
|
142025
|
+
for (let i = 0;i < path31.length - 1; i++) {
|
|
142026
|
+
const p12 = path31[i];
|
|
142027
|
+
const p2 = path31[i + 1];
|
|
141975
142028
|
const layer = p12.z2;
|
|
141976
142029
|
allSegments.push({
|
|
141977
142030
|
start: { x: p12.x, y: p12.y },
|
|
@@ -141989,7 +142042,7 @@ function detectMultiConnectionClosedFacesWithoutVias(polyLines, bounds) {
|
|
|
141989
142042
|
}
|
|
141990
142043
|
}
|
|
141991
142044
|
}
|
|
141992
|
-
const lastPoint =
|
|
142045
|
+
const lastPoint = path31[path31.length - 1];
|
|
141993
142046
|
if (lastPoint.z1 !== lastPoint.z2) {
|
|
141994
142047
|
const key = pointKey2(lastPoint);
|
|
141995
142048
|
if (!viaPoints.has(key)) {
|
|
@@ -142288,14 +142341,14 @@ var MultiHeadPolyLineIntraNodeSolver = class extends BaseSolver {
|
|
|
142288
142341
|
const polyLineVias = [];
|
|
142289
142342
|
for (let i = 0;i < polyLines.length; i++) {
|
|
142290
142343
|
const polyLine = polyLines[i];
|
|
142291
|
-
const
|
|
142344
|
+
const path31 = [polyLine.start, ...polyLine.mPoints, polyLine.end];
|
|
142292
142345
|
const segmentsByLayer = new Map(this.availableZ.map((z852) => [z852, []]));
|
|
142293
|
-
for (let i22 = 0;i22 <
|
|
142294
|
-
const segment2 = [
|
|
142346
|
+
for (let i22 = 0;i22 < path31.length - 1; i22++) {
|
|
142347
|
+
const segment2 = [path31[i22], path31[i22 + 1]];
|
|
142295
142348
|
segmentsByLayer.get(segment2[0].z2).push(segment2);
|
|
142296
142349
|
}
|
|
142297
142350
|
polyLineSegmentsByLayer.push(segmentsByLayer);
|
|
142298
|
-
polyLineVias.push(
|
|
142351
|
+
polyLineVias.push(path31.filter((p) => p.z1 !== p.z2));
|
|
142299
142352
|
}
|
|
142300
142353
|
for (let i = 0;i < polyLines.length; i++) {
|
|
142301
142354
|
const path1SegmentsByLayer = polyLineSegmentsByLayer[i];
|
|
@@ -146505,13 +146558,13 @@ var CapacityPathingSolver = class extends BaseSolver {
|
|
|
146505
146558
|
return this.getDistanceBetweenNodes(node, endGoal);
|
|
146506
146559
|
}
|
|
146507
146560
|
getBacktrackedPath(candidate) {
|
|
146508
|
-
const
|
|
146561
|
+
const path31 = [];
|
|
146509
146562
|
let currentCandidate = candidate;
|
|
146510
146563
|
while (currentCandidate) {
|
|
146511
|
-
|
|
146564
|
+
path31.push(currentCandidate.node);
|
|
146512
146565
|
currentCandidate = currentCandidate.prevCandidate;
|
|
146513
146566
|
}
|
|
146514
|
-
return
|
|
146567
|
+
return path31;
|
|
146515
146568
|
}
|
|
146516
146569
|
getNeighboringNodes(node) {
|
|
146517
146570
|
return this.nodeEdgeMap.get(node.capacityMeshNodeId).flatMap((edge) => edge.nodeIds.filter((n3) => n3 !== node.capacityMeshNodeId)).map((n3) => this.nodeMap.get(n3));
|
|
@@ -146519,12 +146572,12 @@ var CapacityPathingSolver = class extends BaseSolver {
|
|
|
146519
146572
|
getCapacityPaths() {
|
|
146520
146573
|
const capacityPaths = [];
|
|
146521
146574
|
for (const connection of this.connectionsWithNodes) {
|
|
146522
|
-
const
|
|
146523
|
-
if (
|
|
146575
|
+
const path31 = connection.path;
|
|
146576
|
+
if (path31) {
|
|
146524
146577
|
capacityPaths.push({
|
|
146525
146578
|
capacityPathId: connection.connection.name,
|
|
146526
146579
|
connectionName: connection.connection.name,
|
|
146527
|
-
nodeIds:
|
|
146580
|
+
nodeIds: path31.map((node) => node.capacityMeshNodeId)
|
|
146528
146581
|
});
|
|
146529
146582
|
}
|
|
146530
146583
|
}
|
|
@@ -147209,10 +147262,10 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
|
|
|
147209
147262
|
return this.getDistanceBetweenNodes(node, endGoal) + this.getNodeCapacityPenalty(node);
|
|
147210
147263
|
}
|
|
147211
147264
|
getBacktrackedPath(candidate) {
|
|
147212
|
-
const
|
|
147265
|
+
const path31 = [];
|
|
147213
147266
|
let currentCandidate = candidate;
|
|
147214
147267
|
while (currentCandidate) {
|
|
147215
|
-
|
|
147268
|
+
path31.push(currentCandidate.node);
|
|
147216
147269
|
if (this.nodeMap.has(currentCandidate.node.capacityMeshNodeId)) {
|
|
147217
147270
|
currentCandidate = currentCandidate.prevCandidate;
|
|
147218
147271
|
} else {
|
|
@@ -147220,7 +147273,7 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
|
|
|
147220
147273
|
break;
|
|
147221
147274
|
}
|
|
147222
147275
|
}
|
|
147223
|
-
return
|
|
147276
|
+
return path31.reverse();
|
|
147224
147277
|
}
|
|
147225
147278
|
getNeighboringNodes(node) {
|
|
147226
147279
|
if (!this.nodeMap.has(node.capacityMeshNodeId))
|
|
@@ -147235,8 +147288,8 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
|
|
|
147235
147288
|
doesNodeHaveCapacityForTrace(node, prevNode) {
|
|
147236
147289
|
return true;
|
|
147237
147290
|
}
|
|
147238
|
-
reduceCapacityAlongPath(
|
|
147239
|
-
for (const pathNode of
|
|
147291
|
+
reduceCapacityAlongPath(path31) {
|
|
147292
|
+
for (const pathNode of path31) {
|
|
147240
147293
|
if (this.usedNodeCapacityMap.has(pathNode.capacityMeshNodeId)) {
|
|
147241
147294
|
const nodeId = pathNode.capacityMeshNodeId;
|
|
147242
147295
|
const nodeInSection = this.nodeMap.get(nodeId);
|
|
@@ -147365,9 +147418,9 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
|
|
|
147365
147418
|
this.queuedNodes = null;
|
|
147366
147419
|
}
|
|
147367
147420
|
_handleGoalReached(currentCandidate, currentTerminal, endNode) {
|
|
147368
|
-
const
|
|
147369
|
-
currentTerminal.path =
|
|
147370
|
-
this.reduceCapacityAlongPath(
|
|
147421
|
+
const path31 = this.getBacktrackedPath(currentCandidate);
|
|
147422
|
+
currentTerminal.path = path31;
|
|
147423
|
+
this.reduceCapacityAlongPath(path31);
|
|
147371
147424
|
this.currentConnectionIndex++;
|
|
147372
147425
|
this.candidates = null;
|
|
147373
147426
|
this.visitedNodes = null;
|
|
@@ -147416,10 +147469,10 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
|
|
|
147416
147469
|
const connectionColor = this.colorMap[connectionName] ?? "purple";
|
|
147417
147470
|
topCandidates.forEach((candidate, index) => {
|
|
147418
147471
|
const opacity = 0.8 * (1 - index / 5);
|
|
147419
|
-
const
|
|
147420
|
-
if (
|
|
147472
|
+
const path31 = this.getBacktrackedPath(candidate);
|
|
147473
|
+
if (path31.length > 0) {
|
|
147421
147474
|
baseGraphics.lines.push({
|
|
147422
|
-
points:
|
|
147475
|
+
points: path31.map(({ center: { x, y } }) => ({ x, y })),
|
|
147423
147476
|
strokeColor: safeTransparentize(connectionColor, 1 - opacity),
|
|
147424
147477
|
strokeWidth: 0.05
|
|
147425
147478
|
});
|
|
@@ -148108,12 +148161,12 @@ var CapacityPathingMultiSectionSolver = class extends BaseSolver {
|
|
|
148108
148161
|
getCapacityPaths() {
|
|
148109
148162
|
const capacityPaths = [];
|
|
148110
148163
|
for (const connection of this.connectionsWithNodes) {
|
|
148111
|
-
const
|
|
148112
|
-
if (
|
|
148164
|
+
const path31 = connection.path;
|
|
148165
|
+
if (path31) {
|
|
148113
148166
|
capacityPaths.push({
|
|
148114
148167
|
capacityPathId: connection.connection.name,
|
|
148115
148168
|
connectionName: connection.connection.name,
|
|
148116
|
-
nodeIds:
|
|
148169
|
+
nodeIds: path31.map((node) => node.capacityMeshNodeId)
|
|
148117
148170
|
});
|
|
148118
148171
|
}
|
|
148119
148172
|
}
|
|
@@ -149134,22 +149187,22 @@ var SingleSimplifiedPathSolver5 = class extends SingleSimplifiedPathSolver {
|
|
|
149134
149187
|
return null;
|
|
149135
149188
|
}
|
|
149136
149189
|
const possiblePaths = calculate45DegreePaths({ x: start.x, y: start.y }, { x: end.x, y: end.y });
|
|
149137
|
-
for (const
|
|
149138
|
-
const fullPath =
|
|
149190
|
+
for (const path31 of possiblePaths) {
|
|
149191
|
+
const fullPath = path31.map((p) => ({ x: p.x, y: p.y, z: start.z }));
|
|
149139
149192
|
if (this.isValidPath(fullPath)) {
|
|
149140
149193
|
return fullPath;
|
|
149141
149194
|
}
|
|
149142
149195
|
}
|
|
149143
149196
|
return null;
|
|
149144
149197
|
}
|
|
149145
|
-
addPathToResult(
|
|
149146
|
-
if (
|
|
149198
|
+
addPathToResult(path31) {
|
|
149199
|
+
if (path31.length === 0)
|
|
149147
149200
|
return;
|
|
149148
|
-
for (let i = 0;i <
|
|
149149
|
-
if (i === 0 && this.newRoute.length > 0 && this.arePointsEqual(this.newRoute[this.newRoute.length - 1],
|
|
149201
|
+
for (let i = 0;i < path31.length; i++) {
|
|
149202
|
+
if (i === 0 && this.newRoute.length > 0 && this.arePointsEqual(this.newRoute[this.newRoute.length - 1], path31[i])) {
|
|
149150
149203
|
continue;
|
|
149151
149204
|
}
|
|
149152
|
-
this.newRoute.push(
|
|
149205
|
+
this.newRoute.push(path31[i]);
|
|
149153
149206
|
}
|
|
149154
149207
|
this.currentStepSize = this.maxStepSize;
|
|
149155
149208
|
}
|
|
@@ -176556,7 +176609,7 @@ var Trace_doInitialSchematicTraceRender = (trace) => {
|
|
|
176556
176609
|
for (let i = 0;i < portsWithPosition.length - 1; i++) {
|
|
176557
176610
|
const start = portsWithPosition[i];
|
|
176558
176611
|
const end = portsWithPosition[i + 1];
|
|
176559
|
-
const
|
|
176612
|
+
const path31 = calculateElbow({
|
|
176560
176613
|
x: start.position.x,
|
|
176561
176614
|
y: start.position.y,
|
|
176562
176615
|
facingDirection: convertFacingDirectionToElbowDirection(start.facingDirection)
|
|
@@ -176565,8 +176618,8 @@ var Trace_doInitialSchematicTraceRender = (trace) => {
|
|
|
176565
176618
|
y: end.position.y,
|
|
176566
176619
|
facingDirection: convertFacingDirectionToElbowDirection(end.facingDirection)
|
|
176567
176620
|
});
|
|
176568
|
-
for (let j4 = 0;j4 <
|
|
176569
|
-
elbowEdges.push({ from:
|
|
176621
|
+
for (let j4 = 0;j4 < path31.length - 1; j4++) {
|
|
176622
|
+
elbowEdges.push({ from: path31[j4], to: path31[j4 + 1] });
|
|
176570
176623
|
}
|
|
176571
176624
|
}
|
|
176572
176625
|
const doesSegmentIntersectRect = (edge, rect) => {
|
|
@@ -182755,7 +182808,7 @@ react/cjs/react-jsx-runtime.development.js:
|
|
|
182755
182808
|
|
|
182756
182809
|
// lib/import/import-component-from-jlcpcb.ts
|
|
182757
182810
|
import fs31 from "node:fs/promises";
|
|
182758
|
-
import
|
|
182811
|
+
import path31 from "node:path";
|
|
182759
182812
|
var importComponentFromJlcpcb = async (jlcpcbPartNumber, projectDir = process.cwd()) => {
|
|
182760
182813
|
const component = await fetchEasyEDAComponent(jlcpcbPartNumber);
|
|
182761
182814
|
const tsx = await convertRawEasyToTsx(component);
|
|
@@ -182763,9 +182816,9 @@ var importComponentFromJlcpcb = async (jlcpcbPartNumber, projectDir = process.cw
|
|
|
182763
182816
|
if (!fileName) {
|
|
182764
182817
|
throw new Error("Could not determine file name of converted component");
|
|
182765
182818
|
}
|
|
182766
|
-
const importsDir =
|
|
182819
|
+
const importsDir = path31.join(projectDir, "imports");
|
|
182767
182820
|
await fs31.mkdir(importsDir, { recursive: true });
|
|
182768
|
-
const filePath =
|
|
182821
|
+
const filePath = path31.join(importsDir, `${fileName}.tsx`);
|
|
182769
182822
|
await fs31.writeFile(filePath, tsx);
|
|
182770
182823
|
return { filePath };
|
|
182771
182824
|
};
|
|
@@ -182868,11 +182921,11 @@ var registerRemove = (program3) => {
|
|
|
182868
182921
|
};
|
|
182869
182922
|
|
|
182870
182923
|
// cli/build/register.ts
|
|
182871
|
-
import
|
|
182924
|
+
import path40 from "node:path";
|
|
182872
182925
|
import fs40 from "node:fs";
|
|
182873
182926
|
|
|
182874
182927
|
// cli/build/build-file.ts
|
|
182875
|
-
import
|
|
182928
|
+
import path32 from "node:path";
|
|
182876
182929
|
import fs32 from "node:fs";
|
|
182877
182930
|
|
|
182878
182931
|
// lib/shared/circuit-json-diagnostics.ts
|
|
@@ -182935,9 +182988,9 @@ var buildFile = async (input, output, projectDir, options) => {
|
|
|
182935
182988
|
filePath: input,
|
|
182936
182989
|
platformConfig: completePlatformConfig
|
|
182937
182990
|
});
|
|
182938
|
-
fs32.mkdirSync(
|
|
182991
|
+
fs32.mkdirSync(path32.dirname(output), { recursive: true });
|
|
182939
182992
|
fs32.writeFileSync(output, JSON.stringify(result.circuitJson, null, 2));
|
|
182940
|
-
console.log(`Circuit JSON written to ${
|
|
182993
|
+
console.log(`Circuit JSON written to ${path32.relative(projectDir, output)}`);
|
|
182941
182994
|
const { errors, warnings } = analyzeCircuitJson(result.circuitJson);
|
|
182942
182995
|
if (!options?.ignoreWarnings) {
|
|
182943
182996
|
for (const warn of warnings) {
|
|
@@ -182975,7 +183028,7 @@ var logTypeReexportHint = (error, entryFilePath) => {
|
|
|
182975
183028
|
if (!match)
|
|
182976
183029
|
return;
|
|
182977
183030
|
const [, exportName, fromSpecifier] = match;
|
|
182978
|
-
const entryFileName =
|
|
183031
|
+
const entryFileName = path32.basename(entryFilePath);
|
|
182979
183032
|
console.error([
|
|
182980
183033
|
"",
|
|
182981
183034
|
`It looks like "${entryFileName}" re-exports the type-only symbol "${exportName}" from "${fromSpecifier}" without the "type" modifier.`,
|
|
@@ -182989,19 +183042,19 @@ var logTypeReexportHint = (error, entryFilePath) => {
|
|
|
182989
183042
|
|
|
182990
183043
|
// cli/build/get-build-entrypoints.ts
|
|
182991
183044
|
import fs33 from "node:fs";
|
|
182992
|
-
import
|
|
183045
|
+
import path33 from "node:path";
|
|
182993
183046
|
var isSubPath2 = (maybeChild, maybeParent) => {
|
|
182994
|
-
const relative9 =
|
|
182995
|
-
return relative9 === "" || !relative9.startsWith("..") && !
|
|
183047
|
+
const relative9 = path33.relative(maybeParent, maybeChild);
|
|
183048
|
+
return relative9 === "" || !relative9.startsWith("..") && !path33.isAbsolute(relative9);
|
|
182996
183049
|
};
|
|
182997
183050
|
var findProjectRoot = (startDir) => {
|
|
182998
183051
|
let currentDir = startDir;
|
|
182999
|
-
while (currentDir !==
|
|
183000
|
-
const packageJsonPath =
|
|
183052
|
+
while (currentDir !== path33.dirname(currentDir)) {
|
|
183053
|
+
const packageJsonPath = path33.join(currentDir, "package.json");
|
|
183001
183054
|
if (fs33.existsSync(packageJsonPath)) {
|
|
183002
183055
|
return currentDir;
|
|
183003
183056
|
}
|
|
183004
|
-
currentDir =
|
|
183057
|
+
currentDir = path33.dirname(currentDir);
|
|
183005
183058
|
}
|
|
183006
183059
|
return startDir;
|
|
183007
183060
|
};
|
|
@@ -183009,7 +183062,7 @@ async function getBuildEntrypoints({
|
|
|
183009
183062
|
fileOrDir,
|
|
183010
183063
|
rootDir = process.cwd()
|
|
183011
183064
|
}) {
|
|
183012
|
-
const resolvedRoot =
|
|
183065
|
+
const resolvedRoot = path33.resolve(rootDir);
|
|
183013
183066
|
const includeBoardFiles = getBoardFilePatterns(resolvedRoot);
|
|
183014
183067
|
const buildFromProjectDir = async () => {
|
|
183015
183068
|
const files = findBoardFiles({ projectDir: resolvedRoot });
|
|
@@ -183041,7 +183094,7 @@ async function getBuildEntrypoints({
|
|
|
183041
183094
|
};
|
|
183042
183095
|
};
|
|
183043
183096
|
if (fileOrDir) {
|
|
183044
|
-
const resolved =
|
|
183097
|
+
const resolved = path33.resolve(resolvedRoot, fileOrDir);
|
|
183045
183098
|
if (fs33.existsSync(resolved) && fs33.statSync(resolved).isDirectory()) {
|
|
183046
183099
|
const circuitFiles = findBoardFiles({
|
|
183047
183100
|
projectDir: resolvedRoot,
|
|
@@ -183055,7 +183108,7 @@ async function getBuildEntrypoints({
|
|
|
183055
183108
|
circuitFiles
|
|
183056
183109
|
};
|
|
183057
183110
|
}
|
|
183058
|
-
const fileDir =
|
|
183111
|
+
const fileDir = path33.dirname(resolved);
|
|
183059
183112
|
const projectDir = findProjectRoot(fileDir);
|
|
183060
183113
|
return { projectDir, circuitFiles: [resolved] };
|
|
183061
183114
|
}
|
|
@@ -183092,7 +183145,7 @@ ${scriptBlock} <script src="https://cdn.tailwindcss.com"></script>
|
|
|
183092
183145
|
|
|
183093
183146
|
// cli/build/build-preview-images.ts
|
|
183094
183147
|
import fs34 from "node:fs";
|
|
183095
|
-
import
|
|
183148
|
+
import path34 from "node:path";
|
|
183096
183149
|
import {
|
|
183097
183150
|
convertCircuitJsonToPcbSvg as convertCircuitJsonToPcbSvg2,
|
|
183098
183151
|
convertCircuitJsonToSchematicSvg as convertCircuitJsonToSchematicSvg2
|
|
@@ -183137,7 +183190,7 @@ var generatePreviewAssets = async ({
|
|
|
183137
183190
|
outputDir,
|
|
183138
183191
|
distDir
|
|
183139
183192
|
}) => {
|
|
183140
|
-
const prefixRelative =
|
|
183193
|
+
const prefixRelative = path34.relative(distDir, outputDir) || ".";
|
|
183141
183194
|
const prefix = prefixRelative === "." ? "" : `[${prefixRelative}] `;
|
|
183142
183195
|
try {
|
|
183143
183196
|
const circuitJsonRaw = fs34.readFileSync(build.outputPath, "utf-8");
|
|
@@ -183157,11 +183210,11 @@ var generatePreviewAssets = async ({
|
|
|
183157
183210
|
lookAt: [0, 0, 0]
|
|
183158
183211
|
});
|
|
183159
183212
|
fs34.mkdirSync(outputDir, { recursive: true });
|
|
183160
|
-
fs34.writeFileSync(
|
|
183213
|
+
fs34.writeFileSync(path34.join(outputDir, "pcb.svg"), pcbSvg, "utf-8");
|
|
183161
183214
|
console.log(`${prefix}Written pcb.svg`);
|
|
183162
|
-
fs34.writeFileSync(
|
|
183215
|
+
fs34.writeFileSync(path34.join(outputDir, "schematic.svg"), schematicSvg, "utf-8");
|
|
183163
183216
|
console.log(`${prefix}Written schematic.svg`);
|
|
183164
|
-
fs34.writeFileSync(
|
|
183217
|
+
fs34.writeFileSync(path34.join(outputDir, "3d.png"), Buffer.from(normalizeToUint8Array(pngBuffer)));
|
|
183165
183218
|
console.log(`${prefix}Written 3d.png`);
|
|
183166
183219
|
} catch (error) {
|
|
183167
183220
|
console.error(`${prefix}Failed to generate preview images:`, error);
|
|
@@ -183174,14 +183227,14 @@ var buildPreviewImages = async ({
|
|
|
183174
183227
|
allImages
|
|
183175
183228
|
}) => {
|
|
183176
183229
|
const successfulBuilds = builtFiles.filter((file) => file.ok);
|
|
183177
|
-
const normalizedMainEntrypoint = mainEntrypoint ?
|
|
183230
|
+
const normalizedMainEntrypoint = mainEntrypoint ? path34.resolve(mainEntrypoint) : undefined;
|
|
183178
183231
|
if (allImages) {
|
|
183179
183232
|
if (successfulBuilds.length === 0) {
|
|
183180
183233
|
console.warn("No successful build output available for preview image generation.");
|
|
183181
183234
|
return;
|
|
183182
183235
|
}
|
|
183183
183236
|
for (const build of successfulBuilds) {
|
|
183184
|
-
const outputDir =
|
|
183237
|
+
const outputDir = path34.dirname(build.outputPath);
|
|
183185
183238
|
await generatePreviewAssets({
|
|
183186
183239
|
build,
|
|
183187
183240
|
outputDir,
|
|
@@ -183192,7 +183245,7 @@ var buildPreviewImages = async ({
|
|
|
183192
183245
|
}
|
|
183193
183246
|
const previewBuild = (() => {
|
|
183194
183247
|
if (normalizedMainEntrypoint) {
|
|
183195
|
-
const match = successfulBuilds.find((built) =>
|
|
183248
|
+
const match = successfulBuilds.find((built) => path34.resolve(built.sourcePath) === normalizedMainEntrypoint);
|
|
183196
183249
|
if (match)
|
|
183197
183250
|
return match;
|
|
183198
183251
|
}
|
|
@@ -183211,7 +183264,7 @@ var buildPreviewImages = async ({
|
|
|
183211
183264
|
|
|
183212
183265
|
// cli/build/generate-kicad-project.ts
|
|
183213
183266
|
import fs35 from "node:fs";
|
|
183214
|
-
import
|
|
183267
|
+
import path35 from "node:path";
|
|
183215
183268
|
var createKicadProContent = ({
|
|
183216
183269
|
projectName,
|
|
183217
183270
|
schematicFileName,
|
|
@@ -183252,9 +183305,9 @@ var generateKicadProject = async ({
|
|
|
183252
183305
|
});
|
|
183253
183306
|
if (writeFiles) {
|
|
183254
183307
|
fs35.mkdirSync(outputDir, { recursive: true });
|
|
183255
|
-
fs35.writeFileSync(
|
|
183256
|
-
fs35.writeFileSync(
|
|
183257
|
-
fs35.writeFileSync(
|
|
183308
|
+
fs35.writeFileSync(path35.join(outputDir, schematicFileName), schContent);
|
|
183309
|
+
fs35.writeFileSync(path35.join(outputDir, boardFileName), pcbContent);
|
|
183310
|
+
fs35.writeFileSync(path35.join(outputDir, projectFileName), proContent);
|
|
183258
183311
|
}
|
|
183259
183312
|
return {
|
|
183260
183313
|
pcbContent,
|
|
@@ -183267,7 +183320,7 @@ var generateKicadProject = async ({
|
|
|
183267
183320
|
|
|
183268
183321
|
// cli/build/generate-kicad-footprint-library.ts
|
|
183269
183322
|
import fs36 from "node:fs";
|
|
183270
|
-
import
|
|
183323
|
+
import path36 from "node:path";
|
|
183271
183324
|
import { At as At2, KicadPcb as KicadPcb2, parseKicadSexpr } from "kicadts";
|
|
183272
183325
|
var sanitizeLibraryAndFootprintName = (libraryLink) => {
|
|
183273
183326
|
if (!libraryLink) {
|
|
@@ -183327,7 +183380,7 @@ var generateKicadFootprintLibrary = async ({
|
|
|
183327
183380
|
projects,
|
|
183328
183381
|
distDir
|
|
183329
183382
|
}) => {
|
|
183330
|
-
const libraryRoot =
|
|
183383
|
+
const libraryRoot = path36.join(distDir, "kicad-footprints");
|
|
183331
183384
|
fs36.mkdirSync(libraryRoot, { recursive: true });
|
|
183332
183385
|
const uniqueFootprints = new Map;
|
|
183333
183386
|
for (const project of projects) {
|
|
@@ -183351,9 +183404,9 @@ var generateKicadFootprintLibrary = async ({
|
|
|
183351
183404
|
const libraryNames = new Set;
|
|
183352
183405
|
for (const entry of uniqueFootprints.values()) {
|
|
183353
183406
|
libraryNames.add(entry.libraryName);
|
|
183354
|
-
const libraryDir =
|
|
183407
|
+
const libraryDir = path36.join(libraryRoot, `${entry.libraryName}.pretty`);
|
|
183355
183408
|
fs36.mkdirSync(libraryDir, { recursive: true });
|
|
183356
|
-
const footprintPath =
|
|
183409
|
+
const footprintPath = path36.join(libraryDir, `${entry.footprintName}.kicad_mod`);
|
|
183357
183410
|
fs36.writeFileSync(footprintPath, `${entry.content}
|
|
183358
183411
|
`);
|
|
183359
183412
|
}
|
|
@@ -183364,12 +183417,12 @@ ${libTableEntries.join(`
|
|
|
183364
183417
|
`)}
|
|
183365
183418
|
)
|
|
183366
183419
|
`;
|
|
183367
|
-
fs36.writeFileSync(
|
|
183420
|
+
fs36.writeFileSync(path36.join(libraryRoot, "fp-lib-table"), libTableContent);
|
|
183368
183421
|
}
|
|
183369
183422
|
};
|
|
183370
183423
|
|
|
183371
183424
|
// cli/build/transpile/index.ts
|
|
183372
|
-
import
|
|
183425
|
+
import path38 from "node:path";
|
|
183373
183426
|
import fs38 from "node:fs";
|
|
183374
183427
|
import { rollup } from "rollup";
|
|
183375
183428
|
import typescript from "@rollup/plugin-typescript";
|
|
@@ -183380,10 +183433,10 @@ import dts from "rollup-plugin-dts";
|
|
|
183380
183433
|
|
|
183381
183434
|
// cli/build/transpile/static-asset-plugin.ts
|
|
183382
183435
|
import fs37 from "node:fs";
|
|
183383
|
-
import
|
|
183436
|
+
import path37 from "node:path";
|
|
183384
183437
|
import { createHash } from "node:crypto";
|
|
183385
183438
|
function normalizePathSeparators(filePath) {
|
|
183386
|
-
return filePath.split(
|
|
183439
|
+
return filePath.split(path37.sep).join("/");
|
|
183387
183440
|
}
|
|
183388
183441
|
var STATIC_ASSET_EXTENSIONS = new Set([
|
|
183389
183442
|
".glb",
|
|
@@ -183414,15 +183467,15 @@ var createStaticAssetPlugin = ({
|
|
|
183414
183467
|
return {
|
|
183415
183468
|
name: "tsci-static-assets",
|
|
183416
183469
|
resolveId(source, importer) {
|
|
183417
|
-
const ext =
|
|
183470
|
+
const ext = path37.extname(source).toLowerCase();
|
|
183418
183471
|
if (!STATIC_ASSET_EXTENSIONS.has(ext))
|
|
183419
183472
|
return null;
|
|
183420
|
-
if (
|
|
183473
|
+
if (path37.isAbsolute(source)) {
|
|
183421
183474
|
return fs37.existsSync(source) ? { id: normalizePathSeparators(source), external: true } : null;
|
|
183422
183475
|
}
|
|
183423
183476
|
if (importer) {
|
|
183424
|
-
const importerNative = importer.split("/").join(
|
|
183425
|
-
const resolvedFromImporter =
|
|
183477
|
+
const importerNative = importer.split("/").join(path37.sep);
|
|
183478
|
+
const resolvedFromImporter = path37.resolve(path37.dirname(importerNative), source);
|
|
183426
183479
|
if (fs37.existsSync(resolvedFromImporter)) {
|
|
183427
183480
|
return {
|
|
183428
183481
|
id: normalizePathSeparators(resolvedFromImporter),
|
|
@@ -183430,7 +183483,7 @@ var createStaticAssetPlugin = ({
|
|
|
183430
183483
|
};
|
|
183431
183484
|
}
|
|
183432
183485
|
}
|
|
183433
|
-
const resolvedFromProject =
|
|
183486
|
+
const resolvedFromProject = path37.resolve(resolvedBaseUrl, source);
|
|
183434
183487
|
if (fs37.existsSync(resolvedFromProject)) {
|
|
183435
183488
|
return {
|
|
183436
183489
|
id: normalizePathSeparators(resolvedFromProject),
|
|
@@ -183444,7 +183497,7 @@ var createStaticAssetPlugin = ({
|
|
|
183444
183497
|
const wildcard = isWildcard ? source.slice(patternPrefix.length) : "";
|
|
183445
183498
|
for (const target of targets) {
|
|
183446
183499
|
const targetPath = isWildcard ? target.replace("*", wildcard) : target;
|
|
183447
|
-
const resolvedTarget =
|
|
183500
|
+
const resolvedTarget = path37.resolve(resolvedBaseUrl, targetPath);
|
|
183448
183501
|
if (fs37.existsSync(resolvedTarget)) {
|
|
183449
183502
|
return {
|
|
183450
183503
|
id: normalizePathSeparators(resolvedTarget),
|
|
@@ -183471,17 +183524,17 @@ var createStaticAssetPlugin = ({
|
|
|
183471
183524
|
if (chunk.type !== "chunk")
|
|
183472
183525
|
continue;
|
|
183473
183526
|
for (const importedId of chunk.imports) {
|
|
183474
|
-
const ext =
|
|
183527
|
+
const ext = path37.extname(importedId).toLowerCase();
|
|
183475
183528
|
if (!STATIC_ASSET_EXTENSIONS.has(ext))
|
|
183476
183529
|
continue;
|
|
183477
183530
|
if (!copiedAssets.has(importedId)) {
|
|
183478
|
-
const assetDir =
|
|
183531
|
+
const assetDir = path37.join(outputDir, "assets");
|
|
183479
183532
|
fs37.mkdirSync(assetDir, { recursive: true });
|
|
183480
|
-
const nativePath = importedId.split("/").join(
|
|
183533
|
+
const nativePath = importedId.split("/").join(path37.sep);
|
|
183481
183534
|
const fileBuffer = fs37.readFileSync(nativePath);
|
|
183482
183535
|
const hash = createHash("sha1").update(fileBuffer).digest("hex").slice(0, 8);
|
|
183483
|
-
const fileName = `${
|
|
183484
|
-
const outputFilePath =
|
|
183536
|
+
const fileName = `${path37.basename(importedId, ext)}-${hash}${ext}`;
|
|
183537
|
+
const outputFilePath = path37.join(assetDir, fileName);
|
|
183485
183538
|
fs37.writeFileSync(outputFilePath, fileBuffer);
|
|
183486
183539
|
copiedAssets.set(importedId, `./assets/${fileName}`);
|
|
183487
183540
|
assetIdToOutputPath.set(importedId, `./assets/${fileName}`);
|
|
@@ -183504,7 +183557,7 @@ function escapeRegExp(string) {
|
|
|
183504
183557
|
|
|
183505
183558
|
// cli/build/transpile/index.ts
|
|
183506
183559
|
var createExternalFunction = (projectDir, tsconfigPath) => (id2) => {
|
|
183507
|
-
if (id2.startsWith(".") || id2.startsWith("/") ||
|
|
183560
|
+
if (id2.startsWith(".") || id2.startsWith("/") || path38.isAbsolute(id2)) {
|
|
183508
183561
|
return false;
|
|
183509
183562
|
}
|
|
183510
183563
|
let baseUrl = projectDir;
|
|
@@ -183514,7 +183567,7 @@ var createExternalFunction = (projectDir, tsconfigPath) => (id2) => {
|
|
|
183514
183567
|
const tsconfigContent = fs38.readFileSync(tsconfigPath, "utf-8");
|
|
183515
183568
|
const tsconfig = JSON.parse(tsconfigContent);
|
|
183516
183569
|
if (tsconfig.compilerOptions?.baseUrl) {
|
|
183517
|
-
baseUrl =
|
|
183570
|
+
baseUrl = path38.resolve(path38.dirname(tsconfigPath), tsconfig.compilerOptions.baseUrl);
|
|
183518
183571
|
}
|
|
183519
183572
|
if (tsconfig.compilerOptions?.paths) {
|
|
183520
183573
|
pathMappings = tsconfig.compilerOptions.paths;
|
|
@@ -183528,15 +183581,15 @@ var createExternalFunction = (projectDir, tsconfigPath) => (id2) => {
|
|
|
183528
183581
|
}
|
|
183529
183582
|
}
|
|
183530
183583
|
const potentialPaths = [
|
|
183531
|
-
|
|
183532
|
-
|
|
183533
|
-
|
|
183534
|
-
|
|
183535
|
-
|
|
183536
|
-
|
|
183537
|
-
|
|
183538
|
-
|
|
183539
|
-
|
|
183584
|
+
path38.join(baseUrl, id2),
|
|
183585
|
+
path38.join(baseUrl, `${id2}.ts`),
|
|
183586
|
+
path38.join(baseUrl, `${id2}.tsx`),
|
|
183587
|
+
path38.join(baseUrl, `${id2}.js`),
|
|
183588
|
+
path38.join(baseUrl, `${id2}.jsx`),
|
|
183589
|
+
path38.join(baseUrl, id2, "index.ts"),
|
|
183590
|
+
path38.join(baseUrl, id2, "index.tsx"),
|
|
183591
|
+
path38.join(baseUrl, id2, "index.js"),
|
|
183592
|
+
path38.join(baseUrl, id2, "index.jsx")
|
|
183540
183593
|
];
|
|
183541
183594
|
if (potentialPaths.some((p) => fs38.existsSync(p))) {
|
|
183542
183595
|
return false;
|
|
@@ -183550,7 +183603,7 @@ var transpileFile = async ({
|
|
|
183550
183603
|
}) => {
|
|
183551
183604
|
try {
|
|
183552
183605
|
fs38.mkdirSync(outputDir, { recursive: true });
|
|
183553
|
-
const tsconfigPath =
|
|
183606
|
+
const tsconfigPath = path38.join(projectDir, "tsconfig.json");
|
|
183554
183607
|
const hasTsConfig = fs38.existsSync(tsconfigPath);
|
|
183555
183608
|
let tsconfigBaseUrl = projectDir;
|
|
183556
183609
|
let tsconfigPathMappings;
|
|
@@ -183559,7 +183612,7 @@ var transpileFile = async ({
|
|
|
183559
183612
|
const tsconfigContent = fs38.readFileSync(tsconfigPath, "utf-8");
|
|
183560
183613
|
const tsconfig = JSON.parse(tsconfigContent);
|
|
183561
183614
|
if (tsconfig.compilerOptions?.baseUrl) {
|
|
183562
|
-
tsconfigBaseUrl =
|
|
183615
|
+
tsconfigBaseUrl = path38.resolve(path38.dirname(tsconfigPath), tsconfig.compilerOptions.baseUrl);
|
|
183563
183616
|
}
|
|
183564
183617
|
if (tsconfig.compilerOptions?.paths) {
|
|
183565
183618
|
tsconfigPathMappings = tsconfig.compilerOptions.paths;
|
|
@@ -183614,27 +183667,27 @@ var transpileFile = async ({
|
|
|
183614
183667
|
external: createExternalFunction(projectDir, hasTsConfig ? tsconfigPath : undefined),
|
|
183615
183668
|
plugins: getPlugins()
|
|
183616
183669
|
});
|
|
183617
|
-
const esmOutputPath =
|
|
183670
|
+
const esmOutputPath = path38.join(outputDir, "index.js");
|
|
183618
183671
|
await esmBundle.write({
|
|
183619
183672
|
file: esmOutputPath,
|
|
183620
183673
|
format: "es",
|
|
183621
183674
|
sourcemap: false
|
|
183622
183675
|
});
|
|
183623
|
-
console.log(`ESM bundle written to ${
|
|
183676
|
+
console.log(`ESM bundle written to ${path38.relative(projectDir, esmOutputPath)}`);
|
|
183624
183677
|
console.log("Building CommonJS bundle...");
|
|
183625
183678
|
const cjsBundle = await rollup({
|
|
183626
183679
|
input,
|
|
183627
183680
|
external: createExternalFunction(projectDir, hasTsConfig ? tsconfigPath : undefined),
|
|
183628
183681
|
plugins: getPlugins()
|
|
183629
183682
|
});
|
|
183630
|
-
const cjsOutputPath =
|
|
183683
|
+
const cjsOutputPath = path38.join(outputDir, "index.cjs");
|
|
183631
183684
|
console.log("Writing CJS bundle to:", cjsOutputPath);
|
|
183632
183685
|
await cjsBundle.write({
|
|
183633
183686
|
file: cjsOutputPath,
|
|
183634
183687
|
format: "cjs",
|
|
183635
183688
|
sourcemap: false
|
|
183636
183689
|
});
|
|
183637
|
-
console.log(`CommonJS bundle written to ${
|
|
183690
|
+
console.log(`CommonJS bundle written to ${path38.relative(projectDir, cjsOutputPath)}`);
|
|
183638
183691
|
console.log("Generating type declarations...");
|
|
183639
183692
|
const dtsBundle = await rollup({
|
|
183640
183693
|
input,
|
|
@@ -183659,9 +183712,9 @@ var transpileFile = async ({
|
|
|
183659
183712
|
dtsContent = dtsContent.replace(/import \* as [\w_]+ from ['"]react\/jsx-runtime['"];?\s*\n?/g, "");
|
|
183660
183713
|
dtsContent = dtsContent.replace(/[\w_]+\.JSX\.Element/g, "any");
|
|
183661
183714
|
dtsContent = dtsContent.replace(/export\s*{\s*};\s*$/gm, "").trim();
|
|
183662
|
-
const dtsOutputPath =
|
|
183715
|
+
const dtsOutputPath = path38.join(outputDir, "index.d.ts");
|
|
183663
183716
|
fs38.writeFileSync(dtsOutputPath, dtsContent);
|
|
183664
|
-
console.log(`Type declarations written to ${
|
|
183717
|
+
console.log(`Type declarations written to ${path38.relative(projectDir, dtsOutputPath)}`);
|
|
183665
183718
|
console.log(kleur_default.green("Transpilation complete!"));
|
|
183666
183719
|
return true;
|
|
183667
183720
|
} catch (err) {
|
|
@@ -183675,16 +183728,16 @@ var transpileFile = async ({
|
|
|
183675
183728
|
|
|
183676
183729
|
// cli/utils/validate-main-in-dist.ts
|
|
183677
183730
|
import fs39 from "node:fs";
|
|
183678
|
-
import
|
|
183731
|
+
import path39 from "node:path";
|
|
183679
183732
|
var validateMainInDist = (projectDir, distDir) => {
|
|
183680
|
-
const packageJsonPath =
|
|
183733
|
+
const packageJsonPath = path39.join(projectDir, "package.json");
|
|
183681
183734
|
if (!fs39.existsSync(packageJsonPath))
|
|
183682
183735
|
return;
|
|
183683
183736
|
const packageJson = JSON.parse(fs39.readFileSync(packageJsonPath, "utf-8"));
|
|
183684
183737
|
if (typeof packageJson.main !== "string")
|
|
183685
183738
|
return;
|
|
183686
|
-
const resolvedMainPath =
|
|
183687
|
-
const isMainInDist = resolvedMainPath === distDir || resolvedMainPath.startsWith(`${distDir}${
|
|
183739
|
+
const resolvedMainPath = path39.resolve(projectDir, packageJson.main);
|
|
183740
|
+
const isMainInDist = resolvedMainPath === distDir || resolvedMainPath.startsWith(`${distDir}${path39.sep}`);
|
|
183688
183741
|
if (!isMainInDist) {
|
|
183689
183742
|
throw new Error('When using transpilation, your package\'s "main" field should point inside the `dist/*` directory, usually to "dist/index.js"');
|
|
183690
183743
|
}
|
|
@@ -183709,7 +183762,7 @@ var registerBuild = (program3) => {
|
|
|
183709
183762
|
}
|
|
183710
183763
|
return config;
|
|
183711
183764
|
})();
|
|
183712
|
-
const distDir =
|
|
183765
|
+
const distDir = path40.join(projectDir, "dist");
|
|
183713
183766
|
fs40.mkdirSync(distDir, { recursive: true });
|
|
183714
183767
|
console.log(`Building ${circuitFiles.length} file(s)...`);
|
|
183715
183768
|
let hasErrors = false;
|
|
@@ -183718,10 +183771,10 @@ var registerBuild = (program3) => {
|
|
|
183718
183771
|
const kicadProjects = [];
|
|
183719
183772
|
const shouldGenerateKicad = options?.kicad || options?.kicadFootprintLibrary;
|
|
183720
183773
|
for (const filePath of circuitFiles) {
|
|
183721
|
-
const relative9 =
|
|
183774
|
+
const relative9 = path40.relative(projectDir, filePath);
|
|
183722
183775
|
console.log(`Building ${relative9}...`);
|
|
183723
183776
|
const outputDirName = relative9.replace(/(\.board|\.circuit)?\.tsx$/, "");
|
|
183724
|
-
const outputPath =
|
|
183777
|
+
const outputPath = path40.join(distDir, outputDirName, "circuit.json");
|
|
183725
183778
|
const buildOutcome = await buildFile(filePath, outputPath, projectDir, {
|
|
183726
183779
|
ignoreErrors: options?.ignoreErrors,
|
|
183727
183780
|
ignoreWarnings: options?.ignoreWarnings,
|
|
@@ -183735,17 +183788,17 @@ var registerBuild = (program3) => {
|
|
|
183735
183788
|
if (!buildOutcome.ok) {
|
|
183736
183789
|
hasErrors = true;
|
|
183737
183790
|
} else if (options?.site) {
|
|
183738
|
-
const normalizedSourcePath = relative9.split(
|
|
183739
|
-
const relativeOutputPath =
|
|
183740
|
-
const normalizedOutputPath = relativeOutputPath.split(
|
|
183791
|
+
const normalizedSourcePath = relative9.split(path40.sep).join("/");
|
|
183792
|
+
const relativeOutputPath = path40.join(outputDirName, "circuit.json");
|
|
183793
|
+
const normalizedOutputPath = relativeOutputPath.split(path40.sep).join("/");
|
|
183741
183794
|
staticFileReferences.push({
|
|
183742
183795
|
filePath: normalizedSourcePath,
|
|
183743
183796
|
fileStaticAssetUrl: `./${normalizedOutputPath}`
|
|
183744
183797
|
});
|
|
183745
183798
|
}
|
|
183746
183799
|
if (buildOutcome.ok && shouldGenerateKicad && buildOutcome.circuitJson) {
|
|
183747
|
-
const projectOutputDir =
|
|
183748
|
-
const projectName =
|
|
183800
|
+
const projectOutputDir = path40.join(distDir, outputDirName, "kicad");
|
|
183801
|
+
const projectName = path40.basename(outputDirName);
|
|
183749
183802
|
const project = await generateKicadProject({
|
|
183750
183803
|
circuitJson: buildOutcome.circuitJson,
|
|
183751
183804
|
outputDir: projectOutputDir,
|
|
@@ -183794,8 +183847,8 @@ var registerBuild = (program3) => {
|
|
|
183794
183847
|
files: staticFileReferences,
|
|
183795
183848
|
standaloneScriptSrc: "./standalone.min.js"
|
|
183796
183849
|
});
|
|
183797
|
-
fs40.writeFileSync(
|
|
183798
|
-
fs40.writeFileSync(
|
|
183850
|
+
fs40.writeFileSync(path40.join(distDir, "index.html"), indexHtml);
|
|
183851
|
+
fs40.writeFileSync(path40.join(distDir, "standalone.min.js"), standalone_min_default);
|
|
183799
183852
|
}
|
|
183800
183853
|
if (options?.kicadFootprintLibrary) {
|
|
183801
183854
|
if (kicadProjects.length === 0) {
|
|
@@ -183819,7 +183872,7 @@ var registerBuild = (program3) => {
|
|
|
183819
183872
|
|
|
183820
183873
|
// lib/shared/snapshot-project.ts
|
|
183821
183874
|
import fs42 from "node:fs";
|
|
183822
|
-
import
|
|
183875
|
+
import path41 from "node:path";
|
|
183823
183876
|
import looksSame2 from "looks-same";
|
|
183824
183877
|
import {
|
|
183825
183878
|
convertCircuitJsonToPcbSvg as convertCircuitJsonToPcbSvg3,
|
|
@@ -183871,7 +183924,7 @@ var snapshotProject = async ({
|
|
|
183871
183924
|
...DEFAULT_IGNORED_PATTERNS,
|
|
183872
183925
|
...ignored.map(normalizeIgnorePattern)
|
|
183873
183926
|
];
|
|
183874
|
-
const resolvedPaths = filePaths.map((f) =>
|
|
183927
|
+
const resolvedPaths = filePaths.map((f) => path41.resolve(projectDir, f));
|
|
183875
183928
|
const boardFiles = findBoardFiles({
|
|
183876
183929
|
projectDir,
|
|
183877
183930
|
ignore,
|
|
@@ -183885,7 +183938,7 @@ var snapshotProject = async ({
|
|
|
183885
183938
|
const mismatches = [];
|
|
183886
183939
|
let didUpdate = false;
|
|
183887
183940
|
for (const file of boardFiles) {
|
|
183888
|
-
const relativeFilePath =
|
|
183941
|
+
const relativeFilePath = path41.relative(projectDir, file);
|
|
183889
183942
|
let circuitJson;
|
|
183890
183943
|
let pcbSvg;
|
|
183891
183944
|
let schSvg;
|
|
@@ -183940,17 +183993,17 @@ var snapshotProject = async ({
|
|
|
183940
183993
|
} catch (error) {
|
|
183941
183994
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
183942
183995
|
if (errorMessage.includes("No pcb_board found in circuit JSON")) {
|
|
183943
|
-
const fileDir =
|
|
183944
|
-
const relativeDir =
|
|
183945
|
-
const snapDir2 = snapshotsDirName ?
|
|
183946
|
-
const base2 =
|
|
183947
|
-
const snap3dPath =
|
|
183996
|
+
const fileDir = path41.dirname(file);
|
|
183997
|
+
const relativeDir = path41.relative(projectDir, fileDir);
|
|
183998
|
+
const snapDir2 = snapshotsDirName ? path41.join(projectDir, snapshotsDirName, relativeDir) : path41.join(fileDir, "__snapshots__");
|
|
183999
|
+
const base2 = path41.basename(file).replace(/\.tsx$/, "");
|
|
184000
|
+
const snap3dPath = path41.join(snapDir2, `${base2}-3d.snap.png`);
|
|
183948
184001
|
const existing3dSnapshot = fs42.existsSync(snap3dPath);
|
|
183949
184002
|
if (existing3dSnapshot) {
|
|
183950
184003
|
onError(kleur_default.red(`
|
|
183951
184004
|
❌ Failed to generate 3D snapshot for ${relativeFilePath}:
|
|
183952
184005
|
`) + kleur_default.red(` No pcb_board found in circuit JSON
|
|
183953
|
-
`) + kleur_default.red(` Existing snapshot: ${
|
|
184006
|
+
`) + kleur_default.red(` Existing snapshot: ${path41.relative(projectDir, snap3dPath)}
|
|
183954
184007
|
`));
|
|
183955
184008
|
return onExit(1);
|
|
183956
184009
|
} else {
|
|
@@ -183966,9 +184019,9 @@ var snapshotProject = async ({
|
|
|
183966
184019
|
}
|
|
183967
184020
|
}
|
|
183968
184021
|
}
|
|
183969
|
-
const snapDir = snapshotsDirName ?
|
|
184022
|
+
const snapDir = snapshotsDirName ? path41.join(projectDir, snapshotsDirName, path41.relative(projectDir, path41.dirname(file))) : path41.join(path41.dirname(file), "__snapshots__");
|
|
183970
184023
|
fs42.mkdirSync(snapDir, { recursive: true });
|
|
183971
|
-
const base =
|
|
184024
|
+
const base = path41.basename(file).replace(/\.tsx$/, "");
|
|
183972
184025
|
const snapshots = [];
|
|
183973
184026
|
if (pcbOnly || !schematicOnly) {
|
|
183974
184027
|
snapshots.push({ type: "pcb", content: pcbSvg, isBinary: false });
|
|
@@ -183986,13 +184039,13 @@ var snapshotProject = async ({
|
|
|
183986
184039
|
for (const snapshot of snapshots) {
|
|
183987
184040
|
const { type } = snapshot;
|
|
183988
184041
|
const is3d = type === "3d";
|
|
183989
|
-
const snapPath =
|
|
184042
|
+
const snapPath = path41.join(snapDir, `${base}-${type}.snap.${is3d ? "png" : "svg"}`);
|
|
183990
184043
|
const existing = fs42.existsSync(snapPath);
|
|
183991
184044
|
const newContentBuffer = snapshot.isBinary ? snapshot.content : Buffer.from(snapshot.content, "utf8");
|
|
183992
184045
|
const newContentForFile = snapshot.content;
|
|
183993
184046
|
if (!existing) {
|
|
183994
184047
|
fs42.writeFileSync(snapPath, newContentForFile);
|
|
183995
|
-
console.log("✅", kleur_default.gray(
|
|
184048
|
+
console.log("✅", kleur_default.gray(path41.relative(projectDir, snapPath)));
|
|
183996
184049
|
didUpdate = true;
|
|
183997
184050
|
continue;
|
|
183998
184051
|
}
|
|
@@ -184001,16 +184054,16 @@ var snapshotProject = async ({
|
|
|
184001
184054
|
const { equal: equal2 } = await compareAndCreateDiff(oldContentBuffer, newContentBuffer, diffPath);
|
|
184002
184055
|
if (update) {
|
|
184003
184056
|
if (!forceUpdate && equal2) {
|
|
184004
|
-
console.log("✅", kleur_default.gray(
|
|
184057
|
+
console.log("✅", kleur_default.gray(path41.relative(projectDir, snapPath)));
|
|
184005
184058
|
} else {
|
|
184006
184059
|
fs42.writeFileSync(snapPath, newContentForFile);
|
|
184007
|
-
console.log("✅", kleur_default.gray(
|
|
184060
|
+
console.log("✅", kleur_default.gray(path41.relative(projectDir, snapPath)));
|
|
184008
184061
|
didUpdate = true;
|
|
184009
184062
|
}
|
|
184010
184063
|
} else if (!equal2) {
|
|
184011
184064
|
mismatches.push(`${snapPath} (diff: ${diffPath})`);
|
|
184012
184065
|
} else {
|
|
184013
|
-
console.log("✅", kleur_default.gray(
|
|
184066
|
+
console.log("✅", kleur_default.gray(path41.relative(projectDir, snapPath)));
|
|
184014
184067
|
}
|
|
184015
184068
|
}
|
|
184016
184069
|
}
|
|
@@ -184050,20 +184103,20 @@ var registerSnapshot = (program3) => {
|
|
|
184050
184103
|
|
|
184051
184104
|
// lib/shared/setup-github-actions.ts
|
|
184052
184105
|
import fs43 from "node:fs";
|
|
184053
|
-
import
|
|
184106
|
+
import path42 from "node:path";
|
|
184054
184107
|
var setupGithubActions = (projectDir = process.cwd()) => {
|
|
184055
184108
|
const findGitRoot = (startDir) => {
|
|
184056
|
-
let dir =
|
|
184057
|
-
while (dir !==
|
|
184058
|
-
if (fs43.existsSync(
|
|
184109
|
+
let dir = path42.resolve(startDir);
|
|
184110
|
+
while (dir !== path42.parse(dir).root) {
|
|
184111
|
+
if (fs43.existsSync(path42.join(dir, ".git"))) {
|
|
184059
184112
|
return dir;
|
|
184060
184113
|
}
|
|
184061
|
-
dir =
|
|
184114
|
+
dir = path42.dirname(dir);
|
|
184062
184115
|
}
|
|
184063
184116
|
return null;
|
|
184064
184117
|
};
|
|
184065
184118
|
const gitRoot = findGitRoot(projectDir) ?? projectDir;
|
|
184066
|
-
const workflowsDir =
|
|
184119
|
+
const workflowsDir = path42.join(gitRoot, ".github", "workflows");
|
|
184067
184120
|
fs43.mkdirSync(workflowsDir, { recursive: true });
|
|
184068
184121
|
const buildWorkflow = `name: tscircuit Build
|
|
184069
184122
|
|
|
@@ -184103,8 +184156,8 @@ jobs:
|
|
|
184103
184156
|
- run: bun install
|
|
184104
184157
|
- run: bunx tsci snapshot
|
|
184105
184158
|
`;
|
|
184106
|
-
writeFileIfNotExists(
|
|
184107
|
-
writeFileIfNotExists(
|
|
184159
|
+
writeFileIfNotExists(path42.join(workflowsDir, "tscircuit-build.yml"), buildWorkflow);
|
|
184160
|
+
writeFileIfNotExists(path42.join(workflowsDir, "tscircuit-snapshot.yml"), snapshotWorkflow);
|
|
184108
184161
|
};
|
|
184109
184162
|
|
|
184110
184163
|
// cli/setup/register.ts
|
|
@@ -184131,7 +184184,7 @@ var registerSetup = (program3) => {
|
|
|
184131
184184
|
|
|
184132
184185
|
// cli/convert/register.ts
|
|
184133
184186
|
import fs44 from "node:fs/promises";
|
|
184134
|
-
import
|
|
184187
|
+
import path43 from "node:path";
|
|
184135
184188
|
import { parseKicadModToCircuitJson } from "kicad-component-converter";
|
|
184136
184189
|
|
|
184137
184190
|
// node_modules/@tscircuit/mm/dist/index.js
|
|
@@ -184251,14 +184304,14 @@ var convertCircuitJsonToTscircuit = (circuitJson, opts) => {
|
|
|
184251
184304
|
var registerConvert = (program3) => {
|
|
184252
184305
|
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) => {
|
|
184253
184306
|
try {
|
|
184254
|
-
const inputPath =
|
|
184307
|
+
const inputPath = path43.resolve(file);
|
|
184255
184308
|
const modContent = await fs44.readFile(inputPath, "utf-8");
|
|
184256
184309
|
const circuitJson = await parseKicadModToCircuitJson(modContent);
|
|
184257
|
-
const componentName = options.name ??
|
|
184310
|
+
const componentName = options.name ?? path43.basename(inputPath, ".kicad_mod");
|
|
184258
184311
|
const tsx = convertCircuitJsonToTscircuit(circuitJson, {
|
|
184259
184312
|
componentName
|
|
184260
184313
|
});
|
|
184261
|
-
const outputPath = options.output ?
|
|
184314
|
+
const outputPath = options.output ? path43.resolve(options.output) : path43.join(path43.dirname(inputPath), `${componentName}.tsx`);
|
|
184262
184315
|
await fs44.writeFile(outputPath, tsx);
|
|
184263
184316
|
console.log(kleur_default.green(`Converted ${outputPath}`));
|
|
184264
184317
|
} catch (error) {
|
|
@@ -184356,11 +184409,11 @@ var registerSimulate = (program3) => {
|
|
|
184356
184409
|
|
|
184357
184410
|
// lib/shared/install-project-dependencies.ts
|
|
184358
184411
|
import fs46 from "node:fs";
|
|
184359
|
-
import
|
|
184412
|
+
import path45 from "node:path";
|
|
184360
184413
|
|
|
184361
184414
|
// lib/shared/collect-tsci-dependencies.ts
|
|
184362
184415
|
import fs45 from "node:fs";
|
|
184363
|
-
import
|
|
184416
|
+
import path44 from "node:path";
|
|
184364
184417
|
var DEFAULT_PATTERNS = ["**/*.{ts,tsx,js,jsx}"];
|
|
184365
184418
|
var DEFAULT_IGNORES = [
|
|
184366
184419
|
"**/node_modules/**",
|
|
@@ -184375,7 +184428,7 @@ function collectTsciDependencies({
|
|
|
184375
184428
|
patterns = DEFAULT_PATTERNS,
|
|
184376
184429
|
ignore = DEFAULT_IGNORES
|
|
184377
184430
|
} = {}) {
|
|
184378
|
-
const searchRoot =
|
|
184431
|
+
const searchRoot = path44.resolve(cwd);
|
|
184379
184432
|
const files = globbySync(patterns, {
|
|
184380
184433
|
cwd: searchRoot,
|
|
184381
184434
|
absolute: true,
|
|
@@ -184402,9 +184455,9 @@ function collectTsciDependencies({
|
|
|
184402
184455
|
async function installProjectDependencies({
|
|
184403
184456
|
cwd = process.cwd()
|
|
184404
184457
|
} = {}) {
|
|
184405
|
-
const projectRoot =
|
|
184406
|
-
const packageJsonPath =
|
|
184407
|
-
const npmrcPath =
|
|
184458
|
+
const projectRoot = path45.resolve(cwd);
|
|
184459
|
+
const packageJsonPath = path45.join(projectRoot, "package.json");
|
|
184460
|
+
const npmrcPath = path45.join(projectRoot, ".npmrc");
|
|
184408
184461
|
const packageManager = getPackageManager();
|
|
184409
184462
|
if (!fs46.existsSync(projectRoot)) {
|
|
184410
184463
|
throw new Error(`Directory not found: ${projectRoot}`);
|
|
@@ -184470,14 +184523,14 @@ var registerInstall = (program3) => {
|
|
|
184470
184523
|
};
|
|
184471
184524
|
|
|
184472
184525
|
// cli/transpile/register.ts
|
|
184473
|
-
import
|
|
184526
|
+
import path46 from "node:path";
|
|
184474
184527
|
var registerTranspile = (program3) => {
|
|
184475
184528
|
program3.command("transpile").description("Transpile TypeScript/TSX to JavaScript (ESM, CommonJS, and type declarations)").argument("[file]", "Path to the entry file").action(async (file) => {
|
|
184476
184529
|
try {
|
|
184477
184530
|
const { projectDir, circuitFiles, mainEntrypoint } = await getBuildEntrypoints({
|
|
184478
184531
|
fileOrDir: file
|
|
184479
184532
|
});
|
|
184480
|
-
const distDir =
|
|
184533
|
+
const distDir = path46.join(projectDir, "dist");
|
|
184481
184534
|
validateMainInDist(projectDir, distDir);
|
|
184482
184535
|
console.log("Transpiling entry file...");
|
|
184483
184536
|
const entryFile = mainEntrypoint || circuitFiles[0];
|