@modular-circuit/transpiler 0.2.1 → 0.2.2
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/index.js +18 -25
- package/dist/index.mjs +30 -32
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1534,6 +1534,7 @@ var Dvp8LinkTester = class extends CompositePortLinkConverterBase {
|
|
|
1534
1534
|
};
|
|
1535
1535
|
|
|
1536
1536
|
// src/converter/link_to_netlist/converter.ts
|
|
1537
|
+
var import_perc = require("@modular-circuit/perc");
|
|
1537
1538
|
var LINK_CONVERTER = class {
|
|
1538
1539
|
constructor(ctx) {
|
|
1539
1540
|
this.ctx = ctx;
|
|
@@ -1555,7 +1556,12 @@ var LINK_CONVERTER = class {
|
|
|
1555
1556
|
for (const p of ports) this.port_id.set(p.param, p.uuid);
|
|
1556
1557
|
for (const v of ports) {
|
|
1557
1558
|
const port = v.param;
|
|
1558
|
-
const
|
|
1559
|
+
const link_type = (0, import_electronics_model3.get_port_link_type)(port);
|
|
1560
|
+
if (link_type instanceof Error) {
|
|
1561
|
+
console.error(link_type.message);
|
|
1562
|
+
continue;
|
|
1563
|
+
}
|
|
1564
|
+
const arr = this.link_map[link_type];
|
|
1559
1565
|
if (this.port_is_composite_port(port)) {
|
|
1560
1566
|
arr.push(port);
|
|
1561
1567
|
} else {
|
|
@@ -2506,7 +2512,7 @@ var NetListConverter = class {
|
|
|
2506
2512
|
|
|
2507
2513
|
// src/builder/graph_to_kicad/convert_graph_to_sheets.ts
|
|
2508
2514
|
var import_ir5 = require("@modular-circuit/ir");
|
|
2509
|
-
var
|
|
2515
|
+
var import_perc2 = require("@modular-circuit/perc");
|
|
2510
2516
|
var import_utils15 = require("@modular-circuit/utils");
|
|
2511
2517
|
async function do_convert_graph_to_kicad_project(ctx) {
|
|
2512
2518
|
const module_ids = [];
|
|
@@ -2550,13 +2556,17 @@ async function do_convert_graph_to_kicad_project(ctx) {
|
|
|
2550
2556
|
async function convert_graph_to_sheets(ctx) {
|
|
2551
2557
|
return do_convert_graph_to_kicad_project({
|
|
2552
2558
|
...ctx,
|
|
2553
|
-
...await (0,
|
|
2559
|
+
...await (0, import_perc2.build_connection_graph)({
|
|
2554
2560
|
...ctx,
|
|
2555
2561
|
dependencies: ctx.project.dependencies
|
|
2556
2562
|
})
|
|
2557
2563
|
});
|
|
2558
2564
|
}
|
|
2559
2565
|
|
|
2566
|
+
// src/kicad/project/kicad_project_archive.ts
|
|
2567
|
+
var import_utils18 = require("@modular-circuit/utils");
|
|
2568
|
+
var import_jszip = __toESM(require("jszip"));
|
|
2569
|
+
|
|
2560
2570
|
// src/kicad/project/kicad_prl.ts
|
|
2561
2571
|
var kicad_prl = (prj_name) => ({
|
|
2562
2572
|
board: {
|
|
@@ -2869,8 +2879,6 @@ var kicad_pro = (project_name) => ({
|
|
|
2869
2879
|
});
|
|
2870
2880
|
|
|
2871
2881
|
// src/kicad/project/kicad_project_archive.ts
|
|
2872
|
-
var import_utils18 = require("@modular-circuit/utils");
|
|
2873
|
-
var import_jszip = __toESM(require("jszip"));
|
|
2874
2882
|
var KICAD_SCH_FRAME = get_sch_default_drawing_sheet();
|
|
2875
2883
|
var KiCadProjectArchive = class {
|
|
2876
2884
|
constructor(designBlock) {
|
|
@@ -2900,18 +2908,9 @@ var KiCadProjectArchive = class {
|
|
|
2900
2908
|
}
|
|
2901
2909
|
async toZip() {
|
|
2902
2910
|
const zip = new import_jszip.default();
|
|
2903
|
-
zip.file(
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
);
|
|
2907
|
-
zip.file(
|
|
2908
|
-
this.get_project_directive_file_name(import_utils18.ProjectFileExtension),
|
|
2909
|
-
JSON.stringify(this.kicad_pro)
|
|
2910
|
-
);
|
|
2911
|
-
zip.file(
|
|
2912
|
-
this.get_project_directive_file_name(import_utils18.DrawingSheetFileExtension),
|
|
2913
|
-
this.sch_frame
|
|
2914
|
-
);
|
|
2911
|
+
zip.file(this.get_project_directive_file_name(import_utils18.ProjectLocalSettingsFileExtension), JSON.stringify(this.kicad_prl));
|
|
2912
|
+
zip.file(this.get_project_directive_file_name(import_utils18.ProjectFileExtension), JSON.stringify(this.kicad_pro));
|
|
2913
|
+
zip.file(this.get_project_directive_file_name(import_utils18.DrawingSheetFileExtension), this.sch_frame);
|
|
2915
2914
|
for (const schematic of this.designBlock.schematics) {
|
|
2916
2915
|
zip.file(schematic.filename, schematic.content);
|
|
2917
2916
|
}
|
|
@@ -2936,16 +2935,10 @@ var KiCadProjectArchive = class {
|
|
|
2936
2935
|
if (component.footprints) {
|
|
2937
2936
|
for (const fp of component.footprints) {
|
|
2938
2937
|
const fpFilename = fp.footprint.filename;
|
|
2939
|
-
zip.file(
|
|
2940
|
-
`kicad_api_libs/kicad_api_lib.pretty/${fpFilename}`,
|
|
2941
|
-
fp.footprint.content
|
|
2942
|
-
);
|
|
2938
|
+
zip.file(`kicad_api_libs/kicad_api_lib.pretty/${fpFilename}`, fp.footprint.content);
|
|
2943
2939
|
if (fp.models) {
|
|
2944
2940
|
for (const model of fp.models) {
|
|
2945
|
-
zip.file(
|
|
2946
|
-
`kicad_api_libs/3d_models/${model.filename}`,
|
|
2947
|
-
model.content
|
|
2948
|
-
);
|
|
2941
|
+
zip.file(`kicad_api_libs/3d_models/${model.filename}`, model.content);
|
|
2949
2942
|
}
|
|
2950
2943
|
}
|
|
2951
2944
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -65,7 +65,12 @@ import {
|
|
|
65
65
|
import { gen_uuid as gen_uuid2 } from "@modular-circuit/utils";
|
|
66
66
|
|
|
67
67
|
// src/utils/collect_sub_sheets.ts
|
|
68
|
-
import {
|
|
68
|
+
import {
|
|
69
|
+
KiCadSchematicFileExtension,
|
|
70
|
+
parse_module_name,
|
|
71
|
+
remove_filename_path_prefix,
|
|
72
|
+
unzipFile
|
|
73
|
+
} from "@modular-circuit/utils";
|
|
69
74
|
async function collect_sub_sheets(dependencies, module_resolver) {
|
|
70
75
|
const sheets = {};
|
|
71
76
|
const module_main_sheet = {};
|
|
@@ -169,9 +174,9 @@ var StringFormatter = class {
|
|
|
169
174
|
|
|
170
175
|
// src/utils/collect_sub_sheets_by_id.ts
|
|
171
176
|
import {
|
|
172
|
-
fmt_module_name,
|
|
173
177
|
KiCadPcbFileExtension,
|
|
174
178
|
KiCadSchematicFileExtension as KiCadSchematicFileExtension2,
|
|
179
|
+
fmt_module_name,
|
|
175
180
|
remove_filename_path_prefix as remove_filename_path_prefix2,
|
|
176
181
|
unzipFile as unzipFile2
|
|
177
182
|
} from "@modular-circuit/utils";
|
|
@@ -1489,6 +1494,7 @@ var Dvp8LinkTester = class extends CompositePortLinkConverterBase {
|
|
|
1489
1494
|
};
|
|
1490
1495
|
|
|
1491
1496
|
// src/converter/link_to_netlist/converter.ts
|
|
1497
|
+
import "@modular-circuit/perc";
|
|
1492
1498
|
var LINK_CONVERTER = class {
|
|
1493
1499
|
constructor(ctx) {
|
|
1494
1500
|
this.ctx = ctx;
|
|
@@ -1510,7 +1516,12 @@ var LINK_CONVERTER = class {
|
|
|
1510
1516
|
for (const p of ports) this.port_id.set(p.param, p.uuid);
|
|
1511
1517
|
for (const v of ports) {
|
|
1512
1518
|
const port = v.param;
|
|
1513
|
-
const
|
|
1519
|
+
const link_type = get_port_link_type(port);
|
|
1520
|
+
if (link_type instanceof Error) {
|
|
1521
|
+
console.error(link_type.message);
|
|
1522
|
+
continue;
|
|
1523
|
+
}
|
|
1524
|
+
const arr = this.link_map[link_type];
|
|
1514
1525
|
if (this.port_is_composite_port(port)) {
|
|
1515
1526
|
arr.push(port);
|
|
1516
1527
|
} else {
|
|
@@ -2463,9 +2474,9 @@ var NetListConverter = class {
|
|
|
2463
2474
|
|
|
2464
2475
|
// src/builder/graph_to_kicad/convert_graph_to_sheets.ts
|
|
2465
2476
|
import {
|
|
2477
|
+
MODULAR_CIRCUIT_SCH_EXT as MODULAR_CIRCUIT_SCH_EXT2,
|
|
2466
2478
|
block_is_abstract,
|
|
2467
|
-
block_is_associated_with_concrete_module
|
|
2468
|
-
MODULAR_CIRCUIT_SCH_EXT as MODULAR_CIRCUIT_SCH_EXT2
|
|
2479
|
+
block_is_associated_with_concrete_module
|
|
2469
2480
|
} from "@modular-circuit/ir";
|
|
2470
2481
|
import { build_connection_graph } from "@modular-circuit/perc";
|
|
2471
2482
|
import { KiCadSchematicFileExtension as KiCadSchematicFileExtension3 } from "@modular-circuit/utils";
|
|
@@ -2518,6 +2529,15 @@ async function convert_graph_to_sheets(ctx) {
|
|
|
2518
2529
|
});
|
|
2519
2530
|
}
|
|
2520
2531
|
|
|
2532
|
+
// src/kicad/project/kicad_project_archive.ts
|
|
2533
|
+
import {
|
|
2534
|
+
DrawingSheetFileExtension as DrawingSheetFileExtension2,
|
|
2535
|
+
KiCadSchematicFileExtension as KiCadSchematicFileExtension4,
|
|
2536
|
+
ProjectFileExtension,
|
|
2537
|
+
ProjectLocalSettingsFileExtension
|
|
2538
|
+
} from "@modular-circuit/utils";
|
|
2539
|
+
import JSZip from "jszip";
|
|
2540
|
+
|
|
2521
2541
|
// src/kicad/project/kicad_prl.ts
|
|
2522
2542
|
var kicad_prl = (prj_name) => ({
|
|
2523
2543
|
board: {
|
|
@@ -2830,13 +2850,6 @@ var kicad_pro = (project_name) => ({
|
|
|
2830
2850
|
});
|
|
2831
2851
|
|
|
2832
2852
|
// src/kicad/project/kicad_project_archive.ts
|
|
2833
|
-
import {
|
|
2834
|
-
DrawingSheetFileExtension as DrawingSheetFileExtension2,
|
|
2835
|
-
KiCadSchematicFileExtension as KiCadSchematicFileExtension4,
|
|
2836
|
-
ProjectFileExtension,
|
|
2837
|
-
ProjectLocalSettingsFileExtension
|
|
2838
|
-
} from "@modular-circuit/utils";
|
|
2839
|
-
import JSZip from "jszip";
|
|
2840
2853
|
var KICAD_SCH_FRAME = get_sch_default_drawing_sheet();
|
|
2841
2854
|
var KiCadProjectArchive = class {
|
|
2842
2855
|
constructor(designBlock) {
|
|
@@ -2866,18 +2879,9 @@ var KiCadProjectArchive = class {
|
|
|
2866
2879
|
}
|
|
2867
2880
|
async toZip() {
|
|
2868
2881
|
const zip = new JSZip();
|
|
2869
|
-
zip.file(
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
);
|
|
2873
|
-
zip.file(
|
|
2874
|
-
this.get_project_directive_file_name(ProjectFileExtension),
|
|
2875
|
-
JSON.stringify(this.kicad_pro)
|
|
2876
|
-
);
|
|
2877
|
-
zip.file(
|
|
2878
|
-
this.get_project_directive_file_name(DrawingSheetFileExtension2),
|
|
2879
|
-
this.sch_frame
|
|
2880
|
-
);
|
|
2882
|
+
zip.file(this.get_project_directive_file_name(ProjectLocalSettingsFileExtension), JSON.stringify(this.kicad_prl));
|
|
2883
|
+
zip.file(this.get_project_directive_file_name(ProjectFileExtension), JSON.stringify(this.kicad_pro));
|
|
2884
|
+
zip.file(this.get_project_directive_file_name(DrawingSheetFileExtension2), this.sch_frame);
|
|
2881
2885
|
for (const schematic of this.designBlock.schematics) {
|
|
2882
2886
|
zip.file(schematic.filename, schematic.content);
|
|
2883
2887
|
}
|
|
@@ -2902,16 +2906,10 @@ var KiCadProjectArchive = class {
|
|
|
2902
2906
|
if (component.footprints) {
|
|
2903
2907
|
for (const fp of component.footprints) {
|
|
2904
2908
|
const fpFilename = fp.footprint.filename;
|
|
2905
|
-
zip.file(
|
|
2906
|
-
`kicad_api_libs/kicad_api_lib.pretty/${fpFilename}`,
|
|
2907
|
-
fp.footprint.content
|
|
2908
|
-
);
|
|
2909
|
+
zip.file(`kicad_api_libs/kicad_api_lib.pretty/${fpFilename}`, fp.footprint.content);
|
|
2909
2910
|
if (fp.models) {
|
|
2910
2911
|
for (const model of fp.models) {
|
|
2911
|
-
zip.file(
|
|
2912
|
-
`kicad_api_libs/3d_models/${model.filename}`,
|
|
2913
|
-
model.content
|
|
2914
|
-
);
|
|
2912
|
+
zip.file(`kicad_api_libs/3d_models/${model.filename}`, model.content);
|
|
2915
2913
|
}
|
|
2916
2914
|
}
|
|
2917
2915
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modular-circuit/transpiler",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Intermediate representation of the modular circuit",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"elkjs": "^0.11.0",
|
|
30
30
|
"js-base64": "^3.7.7",
|
|
31
31
|
"jszip": "^3.10.1",
|
|
32
|
-
"@modular-circuit/
|
|
33
|
-
"@modular-circuit/
|
|
34
|
-
"@modular-circuit/perc": "0.2.
|
|
35
|
-
"@modular-circuit/utils": "0.2.
|
|
32
|
+
"@modular-circuit/electronics-model": "0.2.4",
|
|
33
|
+
"@modular-circuit/ir": "0.2.2",
|
|
34
|
+
"@modular-circuit/perc": "0.2.7",
|
|
35
|
+
"@modular-circuit/utils": "0.2.2"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"clean": "rimraf dist",
|