@modular-circuit/transpiler 0.2.1 → 0.2.3
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 +15 -23
- package/dist/index.mjs +29 -32
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1555,7 +1555,12 @@ var LINK_CONVERTER = class {
|
|
|
1555
1555
|
for (const p of ports) this.port_id.set(p.param, p.uuid);
|
|
1556
1556
|
for (const v of ports) {
|
|
1557
1557
|
const port = v.param;
|
|
1558
|
-
|
|
1558
|
+
let link_type = (0, import_electronics_model3.get_port_link_type)(port);
|
|
1559
|
+
if (link_type instanceof Error) {
|
|
1560
|
+
console.error(link_type.message);
|
|
1561
|
+
link_type = import_electronics_model3.LinkType.PassiveLink;
|
|
1562
|
+
}
|
|
1563
|
+
const arr = this.link_map[link_type];
|
|
1559
1564
|
if (this.port_is_composite_port(port)) {
|
|
1560
1565
|
arr.push(port);
|
|
1561
1566
|
} else {
|
|
@@ -2557,6 +2562,10 @@ async function convert_graph_to_sheets(ctx) {
|
|
|
2557
2562
|
});
|
|
2558
2563
|
}
|
|
2559
2564
|
|
|
2565
|
+
// src/kicad/project/kicad_project_archive.ts
|
|
2566
|
+
var import_utils18 = require("@modular-circuit/utils");
|
|
2567
|
+
var import_jszip = __toESM(require("jszip"));
|
|
2568
|
+
|
|
2560
2569
|
// src/kicad/project/kicad_prl.ts
|
|
2561
2570
|
var kicad_prl = (prj_name) => ({
|
|
2562
2571
|
board: {
|
|
@@ -2869,8 +2878,6 @@ var kicad_pro = (project_name) => ({
|
|
|
2869
2878
|
});
|
|
2870
2879
|
|
|
2871
2880
|
// src/kicad/project/kicad_project_archive.ts
|
|
2872
|
-
var import_utils18 = require("@modular-circuit/utils");
|
|
2873
|
-
var import_jszip = __toESM(require("jszip"));
|
|
2874
2881
|
var KICAD_SCH_FRAME = get_sch_default_drawing_sheet();
|
|
2875
2882
|
var KiCadProjectArchive = class {
|
|
2876
2883
|
constructor(designBlock) {
|
|
@@ -2900,18 +2907,9 @@ var KiCadProjectArchive = class {
|
|
|
2900
2907
|
}
|
|
2901
2908
|
async toZip() {
|
|
2902
2909
|
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
|
-
);
|
|
2910
|
+
zip.file(this.get_project_directive_file_name(import_utils18.ProjectLocalSettingsFileExtension), JSON.stringify(this.kicad_prl));
|
|
2911
|
+
zip.file(this.get_project_directive_file_name(import_utils18.ProjectFileExtension), JSON.stringify(this.kicad_pro));
|
|
2912
|
+
zip.file(this.get_project_directive_file_name(import_utils18.DrawingSheetFileExtension), this.sch_frame);
|
|
2915
2913
|
for (const schematic of this.designBlock.schematics) {
|
|
2916
2914
|
zip.file(schematic.filename, schematic.content);
|
|
2917
2915
|
}
|
|
@@ -2936,16 +2934,10 @@ var KiCadProjectArchive = class {
|
|
|
2936
2934
|
if (component.footprints) {
|
|
2937
2935
|
for (const fp of component.footprints) {
|
|
2938
2936
|
const fpFilename = fp.footprint.filename;
|
|
2939
|
-
zip.file(
|
|
2940
|
-
`kicad_api_libs/kicad_api_lib.pretty/${fpFilename}`,
|
|
2941
|
-
fp.footprint.content
|
|
2942
|
-
);
|
|
2937
|
+
zip.file(`kicad_api_libs/kicad_api_lib.pretty/${fpFilename}`, fp.footprint.content);
|
|
2943
2938
|
if (fp.models) {
|
|
2944
2939
|
for (const model of fp.models) {
|
|
2945
|
-
zip.file(
|
|
2946
|
-
`kicad_api_libs/3d_models/${model.filename}`,
|
|
2947
|
-
model.content
|
|
2948
|
-
);
|
|
2940
|
+
zip.file(`kicad_api_libs/3d_models/${model.filename}`, model.content);
|
|
2949
2941
|
}
|
|
2950
2942
|
}
|
|
2951
2943
|
}
|
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";
|
|
@@ -1510,7 +1515,12 @@ var LINK_CONVERTER = class {
|
|
|
1510
1515
|
for (const p of ports) this.port_id.set(p.param, p.uuid);
|
|
1511
1516
|
for (const v of ports) {
|
|
1512
1517
|
const port = v.param;
|
|
1513
|
-
|
|
1518
|
+
let link_type = get_port_link_type(port);
|
|
1519
|
+
if (link_type instanceof Error) {
|
|
1520
|
+
console.error(link_type.message);
|
|
1521
|
+
link_type = LinkType.PassiveLink;
|
|
1522
|
+
}
|
|
1523
|
+
const arr = this.link_map[link_type];
|
|
1514
1524
|
if (this.port_is_composite_port(port)) {
|
|
1515
1525
|
arr.push(port);
|
|
1516
1526
|
} else {
|
|
@@ -2463,9 +2473,9 @@ var NetListConverter = class {
|
|
|
2463
2473
|
|
|
2464
2474
|
// src/builder/graph_to_kicad/convert_graph_to_sheets.ts
|
|
2465
2475
|
import {
|
|
2476
|
+
MODULAR_CIRCUIT_SCH_EXT as MODULAR_CIRCUIT_SCH_EXT2,
|
|
2466
2477
|
block_is_abstract,
|
|
2467
|
-
block_is_associated_with_concrete_module
|
|
2468
|
-
MODULAR_CIRCUIT_SCH_EXT as MODULAR_CIRCUIT_SCH_EXT2
|
|
2478
|
+
block_is_associated_with_concrete_module
|
|
2469
2479
|
} from "@modular-circuit/ir";
|
|
2470
2480
|
import { build_connection_graph } from "@modular-circuit/perc";
|
|
2471
2481
|
import { KiCadSchematicFileExtension as KiCadSchematicFileExtension3 } from "@modular-circuit/utils";
|
|
@@ -2518,6 +2528,15 @@ async function convert_graph_to_sheets(ctx) {
|
|
|
2518
2528
|
});
|
|
2519
2529
|
}
|
|
2520
2530
|
|
|
2531
|
+
// src/kicad/project/kicad_project_archive.ts
|
|
2532
|
+
import {
|
|
2533
|
+
DrawingSheetFileExtension as DrawingSheetFileExtension2,
|
|
2534
|
+
KiCadSchematicFileExtension as KiCadSchematicFileExtension4,
|
|
2535
|
+
ProjectFileExtension,
|
|
2536
|
+
ProjectLocalSettingsFileExtension
|
|
2537
|
+
} from "@modular-circuit/utils";
|
|
2538
|
+
import JSZip from "jszip";
|
|
2539
|
+
|
|
2521
2540
|
// src/kicad/project/kicad_prl.ts
|
|
2522
2541
|
var kicad_prl = (prj_name) => ({
|
|
2523
2542
|
board: {
|
|
@@ -2830,13 +2849,6 @@ var kicad_pro = (project_name) => ({
|
|
|
2830
2849
|
});
|
|
2831
2850
|
|
|
2832
2851
|
// 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
2852
|
var KICAD_SCH_FRAME = get_sch_default_drawing_sheet();
|
|
2841
2853
|
var KiCadProjectArchive = class {
|
|
2842
2854
|
constructor(designBlock) {
|
|
@@ -2866,18 +2878,9 @@ var KiCadProjectArchive = class {
|
|
|
2866
2878
|
}
|
|
2867
2879
|
async toZip() {
|
|
2868
2880
|
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
|
-
);
|
|
2881
|
+
zip.file(this.get_project_directive_file_name(ProjectLocalSettingsFileExtension), JSON.stringify(this.kicad_prl));
|
|
2882
|
+
zip.file(this.get_project_directive_file_name(ProjectFileExtension), JSON.stringify(this.kicad_pro));
|
|
2883
|
+
zip.file(this.get_project_directive_file_name(DrawingSheetFileExtension2), this.sch_frame);
|
|
2881
2884
|
for (const schematic of this.designBlock.schematics) {
|
|
2882
2885
|
zip.file(schematic.filename, schematic.content);
|
|
2883
2886
|
}
|
|
@@ -2902,16 +2905,10 @@ var KiCadProjectArchive = class {
|
|
|
2902
2905
|
if (component.footprints) {
|
|
2903
2906
|
for (const fp of component.footprints) {
|
|
2904
2907
|
const fpFilename = fp.footprint.filename;
|
|
2905
|
-
zip.file(
|
|
2906
|
-
`kicad_api_libs/kicad_api_lib.pretty/${fpFilename}`,
|
|
2907
|
-
fp.footprint.content
|
|
2908
|
-
);
|
|
2908
|
+
zip.file(`kicad_api_libs/kicad_api_lib.pretty/${fpFilename}`, fp.footprint.content);
|
|
2909
2909
|
if (fp.models) {
|
|
2910
2910
|
for (const model of fp.models) {
|
|
2911
|
-
zip.file(
|
|
2912
|
-
`kicad_api_libs/3d_models/${model.filename}`,
|
|
2913
|
-
model.content
|
|
2914
|
-
);
|
|
2911
|
+
zip.file(`kicad_api_libs/3d_models/${model.filename}`, model.content);
|
|
2915
2912
|
}
|
|
2916
2913
|
}
|
|
2917
2914
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modular-circuit/transpiler",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
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/
|
|
35
|
-
"@modular-circuit/
|
|
32
|
+
"@modular-circuit/electronics-model": "0.2.5",
|
|
33
|
+
"@modular-circuit/perc": "0.2.8",
|
|
34
|
+
"@modular-circuit/utils": "0.2.3",
|
|
35
|
+
"@modular-circuit/ir": "0.2.3"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"clean": "rimraf dist",
|