@modular-circuit/transpiler 0.1.13 → 0.1.14
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 +21 -10
- package/dist/index.mjs +17 -2
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -2474,7 +2474,18 @@ var import_ir5 = require("@modular-circuit/ir");
|
|
|
2474
2474
|
var import_perc = require("@modular-circuit/perc");
|
|
2475
2475
|
var import_utils14 = require("@modular-circuit/utils");
|
|
2476
2476
|
async function do_convert_graph_to_kicad_project(ctx) {
|
|
2477
|
-
const
|
|
2477
|
+
const module_ids = [];
|
|
2478
|
+
for (const sch of Object.values(ctx.schematics)) {
|
|
2479
|
+
for (const mod of sch.blocks ?? []) {
|
|
2480
|
+
if (!(0, import_ir5.block_is_abstract)(mod) && (0, import_ir5.block_is_associated_with_concrete_module)(mod.type)) {
|
|
2481
|
+
module_ids.push(mod.type);
|
|
2482
|
+
}
|
|
2483
|
+
}
|
|
2484
|
+
}
|
|
2485
|
+
const { sheets } = {
|
|
2486
|
+
...await collect_sub_sheets(ctx.project.dependencies, ctx.module_resolver),
|
|
2487
|
+
...await collect_sub_sheets_by_id(module_ids, ctx.module_resolver)
|
|
2488
|
+
};
|
|
2478
2489
|
const netlist = new GraphConverter({
|
|
2479
2490
|
...ctx
|
|
2480
2491
|
}).convert_to_netlist();
|
|
@@ -2587,7 +2598,7 @@ var kicad_prl = (prj_name) => ({
|
|
|
2587
2598
|
});
|
|
2588
2599
|
|
|
2589
2600
|
// src/kicad/project/kicad_pro.ts
|
|
2590
|
-
var
|
|
2601
|
+
var import_utils16 = require("@modular-circuit/utils");
|
|
2591
2602
|
var kicad_pro = (project_name) => ({
|
|
2592
2603
|
board: {
|
|
2593
2604
|
"3dviewports": [],
|
|
@@ -2797,7 +2808,7 @@ var kicad_pro = (project_name) => ({
|
|
|
2797
2808
|
version: 1
|
|
2798
2809
|
},
|
|
2799
2810
|
net_format_name: "",
|
|
2800
|
-
page_layout_descr_file: `${project_name}.${
|
|
2811
|
+
page_layout_descr_file: `${project_name}.${import_utils16.DrawingSheetFileExtension}`,
|
|
2801
2812
|
plot_directory: "",
|
|
2802
2813
|
spice_current_sheet_as_root: false,
|
|
2803
2814
|
spice_external_command: 'spice "%I"',
|
|
@@ -2813,7 +2824,7 @@ var kicad_pro = (project_name) => ({
|
|
|
2813
2824
|
});
|
|
2814
2825
|
|
|
2815
2826
|
// src/kicad/project/kicad_project_archive.ts
|
|
2816
|
-
var
|
|
2827
|
+
var import_utils17 = require("@modular-circuit/utils");
|
|
2817
2828
|
var import_jszip = __toESM(require("jszip"));
|
|
2818
2829
|
var KICAD_SCH_FRAME = get_sch_default_drawing_sheet();
|
|
2819
2830
|
var KiCadProjectArchive = class {
|
|
@@ -2837,7 +2848,7 @@ var KiCadProjectArchive = class {
|
|
|
2837
2848
|
return kicad_pro(this.project_name);
|
|
2838
2849
|
}
|
|
2839
2850
|
get main_sch_name() {
|
|
2840
|
-
return this.get_project_directive_file_name(
|
|
2851
|
+
return this.get_project_directive_file_name(import_utils17.KiCadSchematicFileExtension);
|
|
2841
2852
|
}
|
|
2842
2853
|
get_project_directive_file_name(ext) {
|
|
2843
2854
|
return `${this.project_name}.${ext}`;
|
|
@@ -2845,15 +2856,15 @@ var KiCadProjectArchive = class {
|
|
|
2845
2856
|
async toZip() {
|
|
2846
2857
|
const zip = new import_jszip.default();
|
|
2847
2858
|
zip.file(
|
|
2848
|
-
this.get_project_directive_file_name(
|
|
2859
|
+
this.get_project_directive_file_name(import_utils17.ProjectLocalSettingsFileExtension),
|
|
2849
2860
|
JSON.stringify(this.kicad_prl)
|
|
2850
2861
|
);
|
|
2851
2862
|
zip.file(
|
|
2852
|
-
this.get_project_directive_file_name(
|
|
2863
|
+
this.get_project_directive_file_name(import_utils17.ProjectFileExtension),
|
|
2853
2864
|
JSON.stringify(this.kicad_pro)
|
|
2854
2865
|
);
|
|
2855
2866
|
zip.file(
|
|
2856
|
-
this.get_project_directive_file_name(
|
|
2867
|
+
this.get_project_directive_file_name(import_utils17.DrawingSheetFileExtension),
|
|
2857
2868
|
this.sch_frame
|
|
2858
2869
|
);
|
|
2859
2870
|
for (const schematic of this.designBlock.schematics) {
|
|
@@ -2909,9 +2920,9 @@ var KiCadProjectArchive = class {
|
|
|
2909
2920
|
};
|
|
2910
2921
|
|
|
2911
2922
|
// src/builder/graph_to_kicad/convert_graph_to_design_block.ts
|
|
2912
|
-
var
|
|
2923
|
+
var import_utils18 = require("@modular-circuit/utils");
|
|
2913
2924
|
async function convert_graph_to_design_block(ctx) {
|
|
2914
|
-
const root = ctx.project.main.replace(
|
|
2925
|
+
const root = ctx.project.main.replace(import_utils18.ModularCircuitFileExtension, import_utils18.KiCadSchematicFileExtension);
|
|
2915
2926
|
const sheets = await convert_graph_to_sheets(ctx);
|
|
2916
2927
|
if (!(root in sheets)) {
|
|
2917
2928
|
throw new Error(`Cannot find root sch file ${root}`);
|
package/dist/index.mjs
CHANGED
|
@@ -2430,11 +2430,26 @@ var NetListConverter = class {
|
|
|
2430
2430
|
};
|
|
2431
2431
|
|
|
2432
2432
|
// src/builder/graph_to_kicad/convert_graph_to_sheets.ts
|
|
2433
|
-
import {
|
|
2433
|
+
import {
|
|
2434
|
+
block_is_abstract,
|
|
2435
|
+
block_is_associated_with_concrete_module,
|
|
2436
|
+
MODULAR_CIRCUIT_SCH_EXT as MODULAR_CIRCUIT_SCH_EXT2
|
|
2437
|
+
} from "@modular-circuit/ir";
|
|
2434
2438
|
import { build_connection_graph } from "@modular-circuit/perc";
|
|
2435
2439
|
import { KiCadSchematicFileExtension as KiCadSchematicFileExtension3 } from "@modular-circuit/utils";
|
|
2436
2440
|
async function do_convert_graph_to_kicad_project(ctx) {
|
|
2437
|
-
const
|
|
2441
|
+
const module_ids = [];
|
|
2442
|
+
for (const sch of Object.values(ctx.schematics)) {
|
|
2443
|
+
for (const mod of sch.blocks ?? []) {
|
|
2444
|
+
if (!block_is_abstract(mod) && block_is_associated_with_concrete_module(mod.type)) {
|
|
2445
|
+
module_ids.push(mod.type);
|
|
2446
|
+
}
|
|
2447
|
+
}
|
|
2448
|
+
}
|
|
2449
|
+
const { sheets } = {
|
|
2450
|
+
...await collect_sub_sheets(ctx.project.dependencies, ctx.module_resolver),
|
|
2451
|
+
...await collect_sub_sheets_by_id(module_ids, ctx.module_resolver)
|
|
2452
|
+
};
|
|
2438
2453
|
const netlist = new GraphConverter({
|
|
2439
2454
|
...ctx
|
|
2440
2455
|
}).convert_to_netlist();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modular-circuit/transpiler",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.14",
|
|
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/ir": "0.1.4",
|
|
33
32
|
"@modular-circuit/electronics-model": "0.1.1",
|
|
34
|
-
"@modular-circuit/
|
|
35
|
-
"@modular-circuit/utils": "0.1.5"
|
|
33
|
+
"@modular-circuit/ir": "0.1.4",
|
|
34
|
+
"@modular-circuit/utils": "0.1.5",
|
|
35
|
+
"@modular-circuit/perc": "0.1.4"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"clean": "rimraf dist",
|