@tscircuit/cli 0.1.100 → 0.1.101
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 +273 -59
- package/package.json +2 -2
package/dist/main.js
CHANGED
|
@@ -336132,14 +336132,14 @@ Expected ` + (val42.length + 1) + " quasis but got " + node2.quasis.length);
|
|
|
336132
336132
|
return path22.slice(0, index2 + 1);
|
|
336133
336133
|
}
|
|
336134
336134
|
function mergePaths(url, base) {
|
|
336135
|
-
|
|
336135
|
+
normalizePath3(base, base.type);
|
|
336136
336136
|
if (url.path === "/") {
|
|
336137
336137
|
url.path = base.path;
|
|
336138
336138
|
} else {
|
|
336139
336139
|
url.path = stripPathFilename(base.path) + url.path;
|
|
336140
336140
|
}
|
|
336141
336141
|
}
|
|
336142
|
-
function
|
|
336142
|
+
function normalizePath3(url, type2) {
|
|
336143
336143
|
var rel = type2 <= 4;
|
|
336144
336144
|
var pieces = url.path.split("/");
|
|
336145
336145
|
var pointer = 1;
|
|
@@ -336202,7 +336202,7 @@ Expected ` + (val42.length + 1) + " quasis but got " + node2.quasis.length);
|
|
|
336202
336202
|
if (baseType > inputType)
|
|
336203
336203
|
inputType = baseType;
|
|
336204
336204
|
}
|
|
336205
|
-
|
|
336205
|
+
normalizePath3(url, inputType);
|
|
336206
336206
|
var queryHash = url.query + url.hash;
|
|
336207
336207
|
switch (inputType) {
|
|
336208
336208
|
case 2:
|
|
@@ -433425,7 +433425,7 @@ import readline from "node:readline";
|
|
|
433425
433425
|
import { execSync as execSync2 } from "node:child_process";
|
|
433426
433426
|
var import_semver = __toESM2(require_semver2(), 1);
|
|
433427
433427
|
// package.json
|
|
433428
|
-
var version = "0.1.
|
|
433428
|
+
var version = "0.1.100";
|
|
433429
433429
|
var package_default = {
|
|
433430
433430
|
name: "@tscircuit/cli",
|
|
433431
433431
|
version,
|
|
@@ -433436,7 +433436,7 @@ var package_default = {
|
|
|
433436
433436
|
"@tscircuit/core": "^0.0.353",
|
|
433437
433437
|
"@tscircuit/eval": "^0.0.152",
|
|
433438
433438
|
"@tscircuit/fake-snippets": "^0.0.23",
|
|
433439
|
-
"@tscircuit/file-server": "^0.0.
|
|
433439
|
+
"@tscircuit/file-server": "^0.0.23",
|
|
433440
433440
|
"@tscircuit/runframe": "^0.0.341",
|
|
433441
433441
|
"@types/bun": "^1.2.2",
|
|
433442
433442
|
"@types/configstore": "^6.0.2",
|
|
@@ -434398,6 +434398,8 @@ init_lib();
|
|
|
434398
434398
|
init_lib();
|
|
434399
434399
|
init_lib();
|
|
434400
434400
|
init_lib();
|
|
434401
|
+
init_lib();
|
|
434402
|
+
init_lib();
|
|
434401
434403
|
var fileSchema = z.object({
|
|
434402
434404
|
file_id: z.string(),
|
|
434403
434405
|
file_path: z.string(),
|
|
@@ -434406,28 +434408,56 @@ var fileSchema = z.object({
|
|
|
434406
434408
|
});
|
|
434407
434409
|
var eventSchema = z.object({
|
|
434408
434410
|
event_id: z.string(),
|
|
434409
|
-
event_type: z.
|
|
434411
|
+
event_type: z.union([
|
|
434412
|
+
z.literal("FILE_UPDATED"),
|
|
434413
|
+
z.literal("FILE_DELETED"),
|
|
434414
|
+
z.literal("FILE_CREATED")
|
|
434415
|
+
]),
|
|
434410
434416
|
file_path: z.string(),
|
|
434411
|
-
created_at: z.string()
|
|
434417
|
+
created_at: z.string(),
|
|
434418
|
+
initiator: z.string().optional()
|
|
434412
434419
|
});
|
|
434413
434420
|
var databaseSchema = z.object({
|
|
434414
434421
|
idCounter: z.number().default(0),
|
|
434415
434422
|
files: z.array(fileSchema).default([]),
|
|
434416
434423
|
events: z.array(eventSchema).default([])
|
|
434417
434424
|
});
|
|
434425
|
+
function normalizePath(path7) {
|
|
434426
|
+
if (!path7 || path7 === "/")
|
|
434427
|
+
return "";
|
|
434428
|
+
let normalized = path7.replace(/\\+/g, "/").replace(/\/\/+/, "/");
|
|
434429
|
+
if (normalized.startsWith("/")) {
|
|
434430
|
+
normalized = normalized.slice(1);
|
|
434431
|
+
}
|
|
434432
|
+
if (normalized.length > 1 && normalized.endsWith("/")) {
|
|
434433
|
+
normalized = normalized.slice(0, -1);
|
|
434434
|
+
}
|
|
434435
|
+
return normalized;
|
|
434436
|
+
}
|
|
434418
434437
|
var createDatabase = () => {
|
|
434419
434438
|
return hoist(createStore(initializer));
|
|
434420
434439
|
};
|
|
434421
434440
|
var initializer = combine(databaseSchema.parse({}), (set, get) => ({
|
|
434422
434441
|
upsertFile: (file, opts) => {
|
|
434442
|
+
const file_path = normalizePath(file.file_path);
|
|
434423
434443
|
set((state) => {
|
|
434424
|
-
const existingFileIndex = state.files.findIndex((f) => f.file_path ===
|
|
434444
|
+
const existingFileIndex = state.files.findIndex((f) => normalizePath(f.file_path) === file_path);
|
|
434425
434445
|
const newFile = {
|
|
434426
434446
|
...file,
|
|
434447
|
+
file_path,
|
|
434427
434448
|
file_id: existingFileIndex >= 0 ? state.files[existingFileIndex].file_id : state.idCounter.toString(),
|
|
434428
434449
|
created_at: existingFileIndex >= 0 ? state.files[existingFileIndex].created_at : (/* @__PURE__ */ new Date()).toISOString()
|
|
434429
434450
|
};
|
|
434430
|
-
|
|
434451
|
+
let files;
|
|
434452
|
+
if (existingFileIndex >= 0) {
|
|
434453
|
+
files = [
|
|
434454
|
+
...state.files.slice(0, existingFileIndex),
|
|
434455
|
+
newFile,
|
|
434456
|
+
...state.files.slice(existingFileIndex + 1)
|
|
434457
|
+
];
|
|
434458
|
+
} else {
|
|
434459
|
+
files = [...state.files, newFile];
|
|
434460
|
+
}
|
|
434431
434461
|
return {
|
|
434432
434462
|
files,
|
|
434433
434463
|
idCounter: existingFileIndex >= 0 ? state.idCounter : state.idCounter + 1
|
|
@@ -434435,15 +434465,88 @@ var initializer = combine(databaseSchema.parse({}), (set, get) => ({
|
|
|
434435
434465
|
});
|
|
434436
434466
|
get().createEvent({
|
|
434437
434467
|
event_type: "FILE_UPDATED",
|
|
434438
|
-
file_path
|
|
434468
|
+
file_path,
|
|
434439
434469
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
434440
434470
|
initiator: opts.initiator
|
|
434441
434471
|
});
|
|
434442
|
-
return get().files.find((f) => f.file_path ===
|
|
434472
|
+
return get().files.find((f) => normalizePath(f.file_path) === file_path);
|
|
434443
434473
|
},
|
|
434444
434474
|
getFile: (query) => {
|
|
434445
434475
|
const state = get();
|
|
434446
|
-
return state.files.find((f) => query.file_id && f.file_id === query.file_id || query.file_path && f.file_path === query.file_path);
|
|
434476
|
+
return state.files.find((f) => query.file_id && f.file_id === query.file_id || query.file_path && normalizePath(f.file_path) === normalizePath(query.file_path));
|
|
434477
|
+
},
|
|
434478
|
+
getFileByPath: (file_path) => {
|
|
434479
|
+
const state = get();
|
|
434480
|
+
const norm = normalizePath(file_path);
|
|
434481
|
+
return state.files.find((f) => normalizePath(f.file_path) === norm);
|
|
434482
|
+
},
|
|
434483
|
+
renameFile: (old_file_path, new_file_path, opts) => {
|
|
434484
|
+
let renamedFile;
|
|
434485
|
+
const normOld = normalizePath(old_file_path);
|
|
434486
|
+
const normNew = normalizePath(new_file_path);
|
|
434487
|
+
set((state) => {
|
|
434488
|
+
const fileIndex = state.files.findIndex((f) => normalizePath(f.file_path) === normOld);
|
|
434489
|
+
if (fileIndex === -1)
|
|
434490
|
+
return state;
|
|
434491
|
+
const file = state.files[fileIndex];
|
|
434492
|
+
renamedFile = {
|
|
434493
|
+
...file,
|
|
434494
|
+
file_path: normNew
|
|
434495
|
+
};
|
|
434496
|
+
const files = [
|
|
434497
|
+
...state.files.slice(0, fileIndex),
|
|
434498
|
+
renamedFile,
|
|
434499
|
+
...state.files.slice(fileIndex + 1)
|
|
434500
|
+
];
|
|
434501
|
+
state.events.push({
|
|
434502
|
+
event_id: (state.idCounter + 0).toString(),
|
|
434503
|
+
event_type: "FILE_CREATED",
|
|
434504
|
+
file_path: normNew,
|
|
434505
|
+
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
434506
|
+
initiator: opts.initiator
|
|
434507
|
+
});
|
|
434508
|
+
state.events.push({
|
|
434509
|
+
event_id: (state.idCounter + 1).toString(),
|
|
434510
|
+
event_type: "FILE_DELETED",
|
|
434511
|
+
file_path: normOld,
|
|
434512
|
+
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
434513
|
+
initiator: opts.initiator
|
|
434514
|
+
});
|
|
434515
|
+
return {
|
|
434516
|
+
files,
|
|
434517
|
+
events: state.events,
|
|
434518
|
+
idCounter: state.idCounter + 2
|
|
434519
|
+
};
|
|
434520
|
+
});
|
|
434521
|
+
return renamedFile;
|
|
434522
|
+
},
|
|
434523
|
+
deleteFile: (query, opts) => {
|
|
434524
|
+
let deletedFile;
|
|
434525
|
+
set((state) => {
|
|
434526
|
+
const initialLength = state.files.length;
|
|
434527
|
+
const files = state.files.filter((f) => {
|
|
434528
|
+
const match = query.file_id && f.file_id === query.file_id || query.file_path && normalizePath(f.file_path) === normalizePath(query.file_path);
|
|
434529
|
+
if (match) {
|
|
434530
|
+
deletedFile = f;
|
|
434531
|
+
}
|
|
434532
|
+
return !match;
|
|
434533
|
+
});
|
|
434534
|
+
if (files.length === initialLength) {
|
|
434535
|
+
return state;
|
|
434536
|
+
}
|
|
434537
|
+
return {
|
|
434538
|
+
files
|
|
434539
|
+
};
|
|
434540
|
+
});
|
|
434541
|
+
if (deletedFile) {
|
|
434542
|
+
get().createEvent({
|
|
434543
|
+
event_type: "FILE_DELETED",
|
|
434544
|
+
file_path: normalizePath(deletedFile.file_path),
|
|
434545
|
+
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
434546
|
+
initiator: opts.initiator
|
|
434547
|
+
});
|
|
434548
|
+
}
|
|
434549
|
+
return deletedFile;
|
|
434447
434550
|
},
|
|
434448
434551
|
createEvent: (event) => {
|
|
434449
434552
|
set((state) => ({
|
|
@@ -434760,6 +434863,25 @@ var reset_default = withRouteSpec({
|
|
|
434760
434863
|
ctx.db.resetEvents();
|
|
434761
434864
|
return ctx.json({ ok: true });
|
|
434762
434865
|
});
|
|
434866
|
+
var delete_default = withRouteSpec({
|
|
434867
|
+
methods: ["POST", "DELETE"],
|
|
434868
|
+
commonParams: z.object({
|
|
434869
|
+
file_id: z.string().optional(),
|
|
434870
|
+
file_path: z.string().optional(),
|
|
434871
|
+
initiator: z.string().optional()
|
|
434872
|
+
}),
|
|
434873
|
+
jsonResponse: z.union([z.null(), z.object({ error: z.string() })])
|
|
434874
|
+
})(async (req, ctx) => {
|
|
434875
|
+
const { file_id, file_path, initiator } = req.commonParams;
|
|
434876
|
+
if (!file_id && !file_path) {
|
|
434877
|
+
return ctx.json({ error: "Either file_id or file_path must be provided" }, { status: 400 });
|
|
434878
|
+
}
|
|
434879
|
+
const deletedFile = ctx.db.deleteFile({ file_id, file_path }, { initiator });
|
|
434880
|
+
if (!deletedFile) {
|
|
434881
|
+
return ctx.json({ error: "File not found" }, { status: 404 });
|
|
434882
|
+
}
|
|
434883
|
+
return ctx.json(null, { status: 204 });
|
|
434884
|
+
});
|
|
434763
434885
|
var download_default = withRouteSpec({
|
|
434764
434886
|
methods: ["GET"],
|
|
434765
434887
|
queryParams: z.object({
|
|
@@ -434832,6 +434954,39 @@ var list_default4 = withRouteSpec({
|
|
|
434832
434954
|
}))
|
|
434833
434955
|
});
|
|
434834
434956
|
});
|
|
434957
|
+
var rename_default = withRouteSpec({
|
|
434958
|
+
methods: ["POST"],
|
|
434959
|
+
jsonBody: z.object({
|
|
434960
|
+
old_file_path: z.string(),
|
|
434961
|
+
new_file_path: z.string(),
|
|
434962
|
+
initiator: z.string().optional()
|
|
434963
|
+
}),
|
|
434964
|
+
jsonResponse: z.object({
|
|
434965
|
+
file: z.object({
|
|
434966
|
+
file_id: z.string(),
|
|
434967
|
+
file_path: z.string(),
|
|
434968
|
+
text_content: z.string(),
|
|
434969
|
+
created_at: z.string()
|
|
434970
|
+
}).nullable()
|
|
434971
|
+
})
|
|
434972
|
+
})(async (req, ctx) => {
|
|
434973
|
+
const body = await req.json();
|
|
434974
|
+
const oldFile = ctx.db.getFileByPath(body.old_file_path);
|
|
434975
|
+
if (!oldFile) {
|
|
434976
|
+
return ctx.json({ file: null }, { status: 404 });
|
|
434977
|
+
}
|
|
434978
|
+
const existingFile = ctx.db.getFileByPath(body.new_file_path);
|
|
434979
|
+
if (existingFile) {
|
|
434980
|
+
return ctx.json({ file: null }, { status: 409 });
|
|
434981
|
+
}
|
|
434982
|
+
const file = ctx.db.renameFile(body.old_file_path, body.new_file_path, {
|
|
434983
|
+
initiator: body.initiator
|
|
434984
|
+
});
|
|
434985
|
+
if (!file) {
|
|
434986
|
+
return ctx.json({ file: null }, { status: 500 });
|
|
434987
|
+
}
|
|
434988
|
+
return ctx.json({ file });
|
|
434989
|
+
});
|
|
434835
434990
|
var upsert_default = withRouteSpec({
|
|
434836
434991
|
methods: ["POST"],
|
|
434837
434992
|
jsonBody: z.object({
|
|
@@ -434964,10 +435119,12 @@ var routeMapWithHandlers = {
|
|
|
434964
435119
|
"/events/create": create_default2,
|
|
434965
435120
|
"/events/list": list_default3,
|
|
434966
435121
|
"/events/reset": reset_default,
|
|
435122
|
+
"/files/delete": delete_default,
|
|
434967
435123
|
"/files/download": download_default,
|
|
434968
435124
|
"/files/download/[[file_path]]": file_path_default,
|
|
434969
435125
|
"/files/get": get_default2,
|
|
434970
435126
|
"/files/list": list_default4,
|
|
435127
|
+
"/files/rename": rename_default,
|
|
434971
435128
|
"/files/upsert": upsert_default,
|
|
434972
435129
|
"/health": health_default,
|
|
434973
435130
|
"/proxy": proxy_default,
|
|
@@ -436075,7 +436232,7 @@ function createPattern(matcher) {
|
|
|
436075
436232
|
}
|
|
436076
436233
|
return () => false;
|
|
436077
436234
|
}
|
|
436078
|
-
function
|
|
436235
|
+
function normalizePath2(path7) {
|
|
436079
436236
|
if (typeof path7 !== "string")
|
|
436080
436237
|
throw new Error("string expected");
|
|
436081
436238
|
path7 = sysPath2.normalize(path7);
|
|
@@ -436091,7 +436248,7 @@ function normalizePath(path7) {
|
|
|
436091
436248
|
return path7;
|
|
436092
436249
|
}
|
|
436093
436250
|
function matchPatterns(patterns, testString, stats) {
|
|
436094
|
-
const path7 =
|
|
436251
|
+
const path7 = normalizePath2(testString);
|
|
436095
436252
|
for (let index = 0;index < patterns.length; index++) {
|
|
436096
436253
|
const pattern = patterns[index];
|
|
436097
436254
|
if (pattern(path7, stats)) {
|
|
@@ -439037,6 +439194,9 @@ async function addPackage(componentPath, projectDir = process.cwd()) {
|
|
|
439037
439194
|
}
|
|
439038
439195
|
|
|
439039
439196
|
// cli/dev/DevServer.ts
|
|
439197
|
+
var import_debug2 = __toESM2(require_src(), 1);
|
|
439198
|
+
var debug2 = import_debug2.default("tscircuit:devserver");
|
|
439199
|
+
|
|
439040
439200
|
class DevServer {
|
|
439041
439201
|
port;
|
|
439042
439202
|
componentFilePath;
|
|
@@ -439073,6 +439233,9 @@ class DevServer {
|
|
|
439073
439233
|
});
|
|
439074
439234
|
this.filesystemWatcher.on("change", (filePath) => this.handleFileChangedOnFilesystem(filePath));
|
|
439075
439235
|
this.filesystemWatcher.on("add", (filePath) => this.handleFileChangedOnFilesystem(filePath));
|
|
439236
|
+
this.filesystemWatcher.on("unlink", (filePath) => this.handleFileRemovedFromFilesystem(filePath));
|
|
439237
|
+
this.filesystemWatcher.on("unlinkDir", (filePath) => this.handleFileRemovedFromFilesystem(filePath));
|
|
439238
|
+
this.filesystemWatcher.on("rename", (oldPath, newPath) => this.handleFileRename(oldPath, newPath));
|
|
439076
439239
|
await this.upsertInitialFiles();
|
|
439077
439240
|
this.typesHandler?.handleInitialTypeDependencies(this.componentFilePath);
|
|
439078
439241
|
}
|
|
@@ -439101,6 +439264,56 @@ class DevServer {
|
|
|
439101
439264
|
}
|
|
439102
439265
|
}).json();
|
|
439103
439266
|
}
|
|
439267
|
+
async handleFileRemovedFromFilesystem(absoluteFilePath) {
|
|
439268
|
+
const relativeFilePath = path18.relative(this.projectDir, absoluteFilePath);
|
|
439269
|
+
if (!relativeFilePath || relativeFilePath.trim() === "") {
|
|
439270
|
+
debug2("Skipping delete for empty file path");
|
|
439271
|
+
return;
|
|
439272
|
+
}
|
|
439273
|
+
debug2(`Deleting file ${relativeFilePath} from server`);
|
|
439274
|
+
const deleteFile = async () => {
|
|
439275
|
+
return await this.fsKy.post("api/files/delete", {
|
|
439276
|
+
json: {
|
|
439277
|
+
file_path: relativeFilePath,
|
|
439278
|
+
initiator: "filesystem_change"
|
|
439279
|
+
},
|
|
439280
|
+
throwHttpErrors: false,
|
|
439281
|
+
timeout: 5000,
|
|
439282
|
+
retry: {
|
|
439283
|
+
limit: 3,
|
|
439284
|
+
methods: ["POST"],
|
|
439285
|
+
statusCodes: [408, 413, 429, 500, 502, 503, 504]
|
|
439286
|
+
}
|
|
439287
|
+
}).json();
|
|
439288
|
+
};
|
|
439289
|
+
const response = await Promise.resolve(deleteFile()).catch((error) => {
|
|
439290
|
+
console.error(`Network error deleting ${relativeFilePath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
439291
|
+
return { error: "Connection error" };
|
|
439292
|
+
});
|
|
439293
|
+
if (response && response.error) {
|
|
439294
|
+
if (response.error.includes("File not found")) {
|
|
439295
|
+
debug2(`File not found: ${relativeFilePath}`);
|
|
439296
|
+
} else {
|
|
439297
|
+
console.error(`Failed to delete file ${relativeFilePath}: ${response.error}`);
|
|
439298
|
+
}
|
|
439299
|
+
return;
|
|
439300
|
+
}
|
|
439301
|
+
debug2(`Successfully deleted file ${relativeFilePath} from server`);
|
|
439302
|
+
}
|
|
439303
|
+
async handleFileRename(oldPath, newPath) {
|
|
439304
|
+
const oldRelativePath = path18.relative(this.projectDir, oldPath);
|
|
439305
|
+
const newRelativePath = path18.relative(this.projectDir, newPath);
|
|
439306
|
+
await this.handleFileRemovedFromFilesystem(oldPath);
|
|
439307
|
+
const fileContent = fs18.readFileSync(newPath, "utf-8");
|
|
439308
|
+
await this.fsKy.post("api/files/upsert", {
|
|
439309
|
+
json: {
|
|
439310
|
+
file_path: newRelativePath,
|
|
439311
|
+
text_content: fileContent,
|
|
439312
|
+
initiator: "filesystem_change"
|
|
439313
|
+
}
|
|
439314
|
+
});
|
|
439315
|
+
debug2(`File renamed from ${oldRelativePath} to ${newRelativePath}`);
|
|
439316
|
+
}
|
|
439104
439317
|
async upsertInitialFiles() {
|
|
439105
439318
|
const filePaths = getPackageFilePaths(this.projectDir);
|
|
439106
439319
|
for (const filePath of filePaths) {
|
|
@@ -439134,6 +439347,7 @@ class DevServer {
|
|
|
439134
439347
|
async stop() {
|
|
439135
439348
|
this.httpServer?.close();
|
|
439136
439349
|
this.eventsWatcher?.stop();
|
|
439350
|
+
await this.filesystemWatcher?.close();
|
|
439137
439351
|
}
|
|
439138
439352
|
async handleInstallPackage(full_package_name) {
|
|
439139
439353
|
const postEvent = async (event, message) => {
|
|
@@ -439942,33 +440156,33 @@ init_dist4();
|
|
|
439942
440156
|
var import_transformation_matrix38 = __toESM2(require_build_commonjs(), 1);
|
|
439943
440157
|
init_dist2();
|
|
439944
440158
|
init_dist2();
|
|
439945
|
-
var
|
|
440159
|
+
var import_debug3 = __toESM2(require_src(), 1);
|
|
439946
440160
|
init_dist2();
|
|
439947
440161
|
var import_transformation_matrix39 = __toESM2(require_build_commonjs(), 1);
|
|
439948
440162
|
init_dist2();
|
|
439949
|
-
var
|
|
440163
|
+
var import_debug4 = __toESM2(require_src(), 1);
|
|
439950
440164
|
init_dist2();
|
|
439951
440165
|
var import_transformation_matrix40 = __toESM2(require_build_commonjs(), 1);
|
|
439952
440166
|
var import_transformation_matrix41 = __toESM2(require_build_commonjs(), 1);
|
|
439953
440167
|
var import_transformation_matrix42 = __toESM2(require_build_commonjs(), 1);
|
|
439954
|
-
var
|
|
440168
|
+
var import_debug5 = __toESM2(require_src(), 1);
|
|
439955
440169
|
var import_transformation_matrix43 = __toESM2(require_build_commonjs(), 1);
|
|
439956
440170
|
var import_transformation_matrix44 = __toESM2(require_build_commonjs(), 1);
|
|
439957
440171
|
var import_transformation_matrix45 = __toESM2(require_build_commonjs(), 1);
|
|
439958
|
-
var import_debug5 = __toESM2(require_src(), 1);
|
|
439959
440172
|
var import_debug6 = __toESM2(require_src(), 1);
|
|
439960
|
-
var import_transformation_matrix46 = __toESM2(require_build_commonjs(), 1);
|
|
439961
440173
|
var import_debug7 = __toESM2(require_src(), 1);
|
|
440174
|
+
var import_transformation_matrix46 = __toESM2(require_build_commonjs(), 1);
|
|
440175
|
+
var import_debug8 = __toESM2(require_src(), 1);
|
|
439962
440176
|
var import_transformation_matrix47 = __toESM2(require_build_commonjs(), 1);
|
|
439963
440177
|
init_dist2();
|
|
439964
440178
|
var import_transformation_matrix48 = __toESM2(require_build_commonjs(), 1);
|
|
439965
|
-
var
|
|
440179
|
+
var import_debug9 = __toESM2(require_src(), 1);
|
|
439966
440180
|
var import_transformation_matrix49 = __toESM2(require_build_commonjs(), 1);
|
|
439967
440181
|
var import_transformation_matrix50 = __toESM2(require_build_commonjs(), 1);
|
|
439968
440182
|
init_dist2();
|
|
439969
|
-
var import_debug9 = __toESM2(require_src(), 1);
|
|
439970
440183
|
var import_debug10 = __toESM2(require_src(), 1);
|
|
439971
440184
|
var import_debug11 = __toESM2(require_src(), 1);
|
|
440185
|
+
var import_debug12 = __toESM2(require_src(), 1);
|
|
439972
440186
|
function getComponentValue(sourceComponent) {
|
|
439973
440187
|
if (!sourceComponent)
|
|
439974
440188
|
return "";
|
|
@@ -440369,7 +440583,7 @@ function getCombinedSourcePortName(circuitElements, connectedSourcePortIds) {
|
|
|
440369
440583
|
}
|
|
440370
440584
|
return portInfos.map((p) => p.displayName).join("--");
|
|
440371
440585
|
}
|
|
440372
|
-
var
|
|
440586
|
+
var debug3 = import_debug3.default("dsn-converter:processPcbTraces");
|
|
440373
440587
|
var DEFAULT_VIA_DIAMETER = 600;
|
|
440374
440588
|
var DEFAULT_VIA_HOLE = 300;
|
|
440375
440589
|
function createWire(opts) {
|
|
@@ -440393,7 +440607,7 @@ function processPcbTraces(circuitElements, pcb) {
|
|
|
440393
440607
|
source_trace_id: pcbTrace.source_trace_id
|
|
440394
440608
|
});
|
|
440395
440609
|
const source_net2 = source_trace2 && su_default(circuitElements).source_net.list().find((n2) => source_trace2.connected_source_net_ids.includes(n2.source_net_id));
|
|
440396
|
-
|
|
440610
|
+
debug3(`PCB TRACE
|
|
440397
440611
|
----------
|
|
440398
440612
|
`, pcbTrace);
|
|
440399
440613
|
const sourceTraceConnectedPortIds = getCombinedSourcePortName(circuitElements, source_trace2?.connected_source_port_ids || []);
|
|
@@ -440402,7 +440616,7 @@ function processPcbTraces(circuitElements, pcb) {
|
|
|
440402
440616
|
let currentWire = null;
|
|
440403
440617
|
for (let i = 0;i < pcbTrace.route.length; i++) {
|
|
440404
440618
|
const point2 = pcbTrace.route[i];
|
|
440405
|
-
|
|
440619
|
+
debug3(`POINT
|
|
440406
440620
|
------
|
|
440407
440621
|
`, point2);
|
|
440408
440622
|
if (point2.route_type === "wire") {
|
|
@@ -440444,7 +440658,7 @@ function processPcbTraces(circuitElements, pcb) {
|
|
|
440444
440658
|
continue;
|
|
440445
440659
|
}
|
|
440446
440660
|
if (point2.route_type === "via") {
|
|
440447
|
-
|
|
440661
|
+
debug3(`VIA
|
|
440448
440662
|
----
|
|
440449
440663
|
`, point2);
|
|
440450
440664
|
if (currentWire) {
|
|
@@ -440453,7 +440667,7 @@ function processPcbTraces(circuitElements, pcb) {
|
|
|
440453
440667
|
currentWire = null;
|
|
440454
440668
|
}
|
|
440455
440669
|
const viaPadstackName = findOrCreateViaPadstack(dsnWrapper, DEFAULT_VIA_DIAMETER, DEFAULT_VIA_HOLE);
|
|
440456
|
-
|
|
440670
|
+
debug3("VIA PADSTACK NAME:", viaPadstackName);
|
|
440457
440671
|
if (dsnWrapper.getStructure() && !dsnWrapper.getStructure()?.via) {
|
|
440458
440672
|
dsnWrapper.getStructure().via = viaPadstackName;
|
|
440459
440673
|
}
|
|
@@ -440475,7 +440689,7 @@ function processPcbTraces(circuitElements, pcb) {
|
|
|
440475
440689
|
}
|
|
440476
440690
|
}
|
|
440477
440691
|
}
|
|
440478
|
-
|
|
440692
|
+
debug3("PCB WIRING/NETWORK_OUT AT END", JSON.stringify(pcb.is_dsn_pcb ? pcb.wiring : pcb.routes.network_out.nets, null, 2));
|
|
440479
440693
|
}
|
|
440480
440694
|
var transformMmToUm2 = import_transformation_matrix39.scale(1000);
|
|
440481
440695
|
function processPlatedHoles(componentGroups, circuitElements, pcb) {
|
|
@@ -440753,7 +440967,7 @@ function groupComponents(circuitElements) {
|
|
|
440753
440967
|
}
|
|
440754
440968
|
return Array.from(componentMap.values());
|
|
440755
440969
|
}
|
|
440756
|
-
var debug22 =
|
|
440970
|
+
var debug22 = import_debug4.default("dsn-converter:mergeDsnSessionIntoDsnPcb");
|
|
440757
440971
|
var stringifyDsnJson = (dsnJson) => {
|
|
440758
440972
|
const indent = " ";
|
|
440759
440973
|
let result = "";
|
|
@@ -440942,14 +441156,14 @@ var convertCircuitJsonToDsnString = (circuitJson) => {
|
|
|
440942
441156
|
const dsnJson = convertCircuitJsonToDsnJson(circuitJson);
|
|
440943
441157
|
return stringifyDsnJson(dsnJson);
|
|
440944
441158
|
};
|
|
440945
|
-
var
|
|
440946
|
-
var debug4 =
|
|
440947
|
-
var debug5 =
|
|
440948
|
-
var debug6 =
|
|
440949
|
-
var debug7 =
|
|
440950
|
-
var debug8 =
|
|
440951
|
-
var debug9 =
|
|
440952
|
-
var debug10 =
|
|
441159
|
+
var debug32 = import_debug5.default("dsn-converter:convertPadstacksToSmtpads");
|
|
441160
|
+
var debug4 = import_debug6.default("dsn-converter:convertWiringPathToPcbTraces");
|
|
441161
|
+
var debug5 = import_debug8.default("dsn-converter:convertWiringViaToPcbVias");
|
|
441162
|
+
var debug6 = import_debug7.default("dsn-converter:convertWiresToPcbTraces");
|
|
441163
|
+
var debug7 = import_debug9.default("dsn-converter");
|
|
441164
|
+
var debug8 = import_debug11.default("dsn-converter:getPinNum");
|
|
441165
|
+
var debug9 = import_debug12.default("dsn-converter:getViaCoords");
|
|
441166
|
+
var debug10 = import_debug10.default("dsn-converter:parse-dsn-to-dsn-json");
|
|
440953
441167
|
|
|
440954
441168
|
// node_modules/@tscircuit/eval/dist/eval/chunk-7SIVWFC6.js
|
|
440955
441169
|
function normalizeFilePath(filePath) {
|
|
@@ -444707,25 +444921,25 @@ var fp = footprinter;
|
|
|
444707
444921
|
|
|
444708
444922
|
// node_modules/@tscircuit/core/dist/index.js
|
|
444709
444923
|
init_dist();
|
|
444710
|
-
var
|
|
444924
|
+
var import_debug16 = __toESM2(require_src(), 1);
|
|
444711
444925
|
var import_react = __toESM2(require_react(), 1);
|
|
444712
444926
|
var import_react_reconciler = __toESM2(require_react_reconciler(), 1);
|
|
444713
444927
|
var import_react_reconciler_18 = __toESM2(require_react_reconciler_18(), 1);
|
|
444714
444928
|
var import_constants12 = __toESM2(require_constants5(), 1);
|
|
444715
|
-
var
|
|
444929
|
+
var import_debug17 = __toESM2(require_src(), 1);
|
|
444716
444930
|
var import_transformation_matrix54 = __toESM2(require_build_commonjs(), 1);
|
|
444717
444931
|
init_dist();
|
|
444718
|
-
var
|
|
444932
|
+
var import_debug18 = __toESM2(require_src(), 1);
|
|
444719
444933
|
init_dist3();
|
|
444720
444934
|
var import_transformation_matrix55 = __toESM2(require_build_commonjs(), 1);
|
|
444721
444935
|
init_lib();
|
|
444722
444936
|
init_lib();
|
|
444723
444937
|
|
|
444724
444938
|
// node_modules/@tscircuit/infgrid-ijump-astar/dist/index.js
|
|
444725
|
-
var import_debug12 = __toESM2(require_src(), 1);
|
|
444726
|
-
init_dist();
|
|
444727
444939
|
var import_debug13 = __toESM2(require_src(), 1);
|
|
444940
|
+
init_dist();
|
|
444728
444941
|
var import_debug14 = __toESM2(require_src(), 1);
|
|
444942
|
+
var import_debug15 = __toESM2(require_src(), 1);
|
|
444729
444943
|
init_dist2();
|
|
444730
444944
|
var import_performance_now = __toESM2(require_performance_now(), 1);
|
|
444731
444945
|
|
|
@@ -445033,7 +445247,7 @@ function addViasWhenLayerChanges(route) {
|
|
|
445033
445247
|
newRoute.push(route[route.length - 1]);
|
|
445034
445248
|
return newRoute;
|
|
445035
445249
|
}
|
|
445036
|
-
var debug11 =
|
|
445250
|
+
var debug11 = import_debug14.default("autorouter:shortenPathWithShortcuts");
|
|
445037
445251
|
function shortenPathWithShortcuts(route, checkIfObstacleBetweenPoints) {
|
|
445038
445252
|
if (route.length <= 2) {
|
|
445039
445253
|
return route;
|
|
@@ -445138,7 +445352,7 @@ function shortenPathWithShortcuts(route, checkIfObstacleBetweenPoints) {
|
|
|
445138
445352
|
}
|
|
445139
445353
|
return shortened;
|
|
445140
445354
|
}
|
|
445141
|
-
var debug23 =
|
|
445355
|
+
var debug23 = import_debug13.default("autorouting-dataset:astar");
|
|
445142
445356
|
var GeneralizedAstarAutorouter = class {
|
|
445143
445357
|
openSet = [];
|
|
445144
445358
|
closedSet = /* @__PURE__ */ new Set;
|
|
@@ -445492,7 +445706,7 @@ var GeneralizedAstarAutorouter = class {
|
|
|
445492
445706
|
}
|
|
445493
445707
|
}
|
|
445494
445708
|
};
|
|
445495
|
-
var
|
|
445709
|
+
var debug33 = import_debug15.default("autorouting-dataset:infinite-grid-ijump-astar:get-distance-to-overcome-obstacle");
|
|
445496
445710
|
function getDistanceToOvercomeObstacle({
|
|
445497
445711
|
node,
|
|
445498
445712
|
travelDir,
|
|
@@ -445530,7 +445744,7 @@ function getDistanceToOvercomeObstacle({
|
|
|
445530
445744
|
const o1OrthoDim = extendingAlongXAxis ? obstacle.height : obstacle.width;
|
|
445531
445745
|
const o2OrthoDim = extendingAlongXAxis ? obstacleAtEnd.height : obstacleAtEnd.width;
|
|
445532
445746
|
if (o2OrthoDim > o1OrthoDim) {
|
|
445533
|
-
|
|
445747
|
+
debug33("next obstacle on path is bigger, not trying to overcome it");
|
|
445534
445748
|
return distToOvercomeObstacle;
|
|
445535
445749
|
}
|
|
445536
445750
|
const endObstacleDistToOvercome = getDistanceToOvercomeObstacle({
|
|
@@ -448157,7 +448371,7 @@ class Row {
|
|
|
448157
448371
|
_constant;
|
|
448158
448372
|
}
|
|
448159
448373
|
// node_modules/@tscircuit/core/dist/index.js
|
|
448160
|
-
var
|
|
448374
|
+
var import_debug19 = __toESM2(require_src(), 1);
|
|
448161
448375
|
init_dist();
|
|
448162
448376
|
|
|
448163
448377
|
// node_modules/@tscircuit/math-utils/dist/index.js
|
|
@@ -456412,7 +456626,7 @@ var CapacityMeshSolver = class extends BaseSolver {
|
|
|
456412
456626
|
|
|
456413
456627
|
// node_modules/@tscircuit/core/dist/index.js
|
|
456414
456628
|
init_dist();
|
|
456415
|
-
var
|
|
456629
|
+
var import_debug20 = __toESM2(require_src(), 1);
|
|
456416
456630
|
var import_transformation_matrix61 = __toESM2(require_build_commonjs(), 1);
|
|
456417
456631
|
init_dist2();
|
|
456418
456632
|
init_dist2();
|
|
@@ -456512,7 +456726,7 @@ __export4(components_exports, {
|
|
|
456512
456726
|
Transistor: () => Transistor,
|
|
456513
456727
|
Via: () => Via
|
|
456514
456728
|
});
|
|
456515
|
-
var debug13 =
|
|
456729
|
+
var debug13 = import_debug17.default("tscircuit:renderable");
|
|
456516
456730
|
var orderedRenderPhases = [
|
|
456517
456731
|
"ReactSubtreesRender",
|
|
456518
456732
|
"InitializePortsFromChildren",
|
|
@@ -456965,7 +457179,7 @@ function isMatchingSelector(component, selector) {
|
|
|
456965
457179
|
return component.props[prop].toString() === value2;
|
|
456966
457180
|
});
|
|
456967
457181
|
}
|
|
456968
|
-
var debugSelectAll =
|
|
457182
|
+
var debugSelectAll = import_debug18.default("tscircuit:primitive-component:selectAll");
|
|
456969
457183
|
var PrimitiveComponent = class extends Renderable {
|
|
456970
457184
|
parent = null;
|
|
456971
457185
|
children;
|
|
@@ -458800,7 +459014,7 @@ var getAllDimensionsForSchematicBox = (params2) => {
|
|
|
458800
459014
|
pinCount
|
|
458801
459015
|
};
|
|
458802
459016
|
};
|
|
458803
|
-
var debug24 =
|
|
459017
|
+
var debug24 = import_debug19.default("tscircuit:core:footprint");
|
|
458804
459018
|
var Footprint = class extends PrimitiveComponent {
|
|
458805
459019
|
get config() {
|
|
458806
459020
|
return {
|
|
@@ -460288,7 +460502,7 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
|
|
|
460288
460502
|
this.schematic_trace_id = trace.schematic_trace_id;
|
|
460289
460503
|
}
|
|
460290
460504
|
};
|
|
460291
|
-
var
|
|
460505
|
+
var debug34 = import_debug16.default("tscircuit:core");
|
|
460292
460506
|
var rotation3 = z.object({
|
|
460293
460507
|
x: rotation,
|
|
460294
460508
|
y: rotation,
|
|
@@ -460677,7 +460891,7 @@ var NormalComponent = class extends PrimitiveComponent {
|
|
|
460677
460891
|
const existingPorts = this.children.filter((c) => c.componentName === "Port");
|
|
460678
460892
|
const conflictingPort = existingPorts.find((p) => p.isMatchingAnyOf(component.getNameAndAliases()));
|
|
460679
460893
|
if (conflictingPort) {
|
|
460680
|
-
|
|
460894
|
+
debug34(`Similar ports added. Port 1: ${conflictingPort}, Port 2: ${component}`);
|
|
460681
460895
|
}
|
|
460682
460896
|
}
|
|
460683
460897
|
super.add(component);
|
|
@@ -461414,14 +461628,14 @@ var Group = class extends NormalComponent {
|
|
|
461414
461628
|
return false;
|
|
461415
461629
|
}
|
|
461416
461630
|
_hasTracesToRoute() {
|
|
461417
|
-
const debug42 =
|
|
461631
|
+
const debug42 = import_debug20.default("tscircuit:core:_hasTracesToRoute");
|
|
461418
461632
|
const traces = this.selectAll("trace");
|
|
461419
461633
|
debug42(`[${this.getString()}] has ${traces.length} traces to route`);
|
|
461420
461634
|
return traces.length > 0;
|
|
461421
461635
|
}
|
|
461422
461636
|
async _runEffectMakeHttpAutoroutingRequest() {
|
|
461423
461637
|
const { db } = this.root;
|
|
461424
|
-
const debug42 =
|
|
461638
|
+
const debug42 = import_debug20.default("tscircuit:core:_runEffectMakeHttpAutoroutingRequest");
|
|
461425
461639
|
const props = this._parsedProps;
|
|
461426
461640
|
const autorouterConfig2 = this._getAutorouterConfig();
|
|
461427
461641
|
const serverUrl = autorouterConfig2.serverUrl;
|
|
@@ -461519,7 +461733,7 @@ var Group = class extends NormalComponent {
|
|
|
461519
461733
|
async _runLocalAutorouting() {
|
|
461520
461734
|
const { db } = this.root;
|
|
461521
461735
|
const props = this._parsedProps;
|
|
461522
|
-
const debug42 =
|
|
461736
|
+
const debug42 = import_debug20.default("tscircuit:core:_runLocalAutorouting");
|
|
461523
461737
|
debug42(`[${this.getString()}] starting local autorouting`);
|
|
461524
461738
|
const autorouterConfig2 = this._getAutorouterConfig();
|
|
461525
461739
|
const { simpleRouteJson, connMap } = getSimpleRouteJsonFromCircuitJson({
|
|
@@ -461595,7 +461809,7 @@ var Group = class extends NormalComponent {
|
|
|
461595
461809
|
}
|
|
461596
461810
|
}
|
|
461597
461811
|
doInitialPcbTraceRender() {
|
|
461598
|
-
const debug42 =
|
|
461812
|
+
const debug42 = import_debug20.default("tscircuit:core:doInitialPcbTraceRender");
|
|
461599
461813
|
if (!this.isSubcircuit)
|
|
461600
461814
|
return;
|
|
461601
461815
|
if (this.root?.pcbDisabled)
|
|
@@ -461614,7 +461828,7 @@ var Group = class extends NormalComponent {
|
|
|
461614
461828
|
this._startAsyncAutorouting();
|
|
461615
461829
|
}
|
|
461616
461830
|
updatePcbTraceRender() {
|
|
461617
|
-
const debug42 =
|
|
461831
|
+
const debug42 = import_debug20.default("tscircuit:core:updatePcbTraceRender");
|
|
461618
461832
|
debug42(`[${this.getString()}] updating...`);
|
|
461619
461833
|
if (!this.isSubcircuit)
|
|
461620
461834
|
return;
|
|
@@ -464204,10 +464418,10 @@ var CircuitRunner = class {
|
|
|
464204
464418
|
|
|
464205
464419
|
// lib/shared/generate-circuit-json.ts
|
|
464206
464420
|
var import_make_vfs2 = __toESM2(require_dist8(), 1);
|
|
464207
|
-
var
|
|
464421
|
+
var import_debug21 = __toESM2(require_src(), 1);
|
|
464208
464422
|
import path21 from "node:path";
|
|
464209
464423
|
import fs21 from "node:fs";
|
|
464210
|
-
var debug14 =
|
|
464424
|
+
var debug14 = import_debug21.default("tsci:generate-circuit-json");
|
|
464211
464425
|
var ALLOWED_FILE_EXTENSIONS = [
|
|
464212
464426
|
".tsx",
|
|
464213
464427
|
".ts",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.101",
|
|
4
4
|
"main": "dist/main.js",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@babel/standalone": "^7.26.9",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"@tscircuit/core": "^0.0.353",
|
|
9
9
|
"@tscircuit/eval": "^0.0.152",
|
|
10
10
|
"@tscircuit/fake-snippets": "^0.0.23",
|
|
11
|
-
"@tscircuit/file-server": "^0.0.
|
|
11
|
+
"@tscircuit/file-server": "^0.0.23",
|
|
12
12
|
"@tscircuit/runframe": "^0.0.341",
|
|
13
13
|
"@types/bun": "^1.2.2",
|
|
14
14
|
"@types/configstore": "^6.0.2",
|