@modular-circuit/transpiler 0.0.58 → 0.0.59
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/build/builder/graph_to_kicad/do_convert_graph_to_kicad_project.js +19 -106
- package/build/builder/graph_to_kicad/index.js +4 -59
- package/build/converter/graph_to_netlist/graph_converter.js +51 -171
- package/build/converter/kicad_sexpr/eeschema/drawing_sheet/sch_default_drawing_sheet.js +1 -1
- package/build/converter/kicad_sexpr/eeschema/printer.js +228 -281
- package/build/converter/link_to_netlist/converter.js +77 -135
- package/build/converter/link_to_netlist/links/converter_base.js +38 -131
- package/build/converter/link_to_netlist/links/converters.js +316 -554
- package/build/converter/netlist_to_kicad/layout.js +19 -23
- package/build/converter/netlist_to_kicad/netlist_converter.js +74 -167
- package/build/kicad/constraints/index.js +1 -1
- package/build/kicad/label/net_label.js +2 -2
- package/build/kicad/label/sheet_pin.js +11 -19
- package/build/kicad/project/kicad_prl.js +3 -3
- package/build/kicad/project/kicad_pro.js +4 -4
- package/build/kicad/project/kicad_project_achieve.js +31 -45
- package/build/kicad/project/wildcards_and_files_ext.js +61 -61
- package/build/kicad/sheet/sheet.js +3 -3
- package/build/kicad/symbols/lib_symbol/gnd.js +6 -6
- package/build/kicad/symbols/lib_symbol/vcc.js +7 -7
- package/build/kicad/symbols/sch_symbol/gnd.js +9 -9
- package/build/kicad/symbols/sch_symbol/vcc.js +9 -9
- package/build/kicad/symbols/symbol_utils.js +1 -1
- package/build/utils/collect_sub_sheets.js +32 -146
- package/build/utils/constraints.js +6 -6
- package/build/utils/filter_null_undefined.js +2 -31
- package/build/utils/string_formatter.js +23 -29
- package/package.json +5 -5
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
export
|
|
22
|
-
export
|
|
23
|
-
export
|
|
24
|
-
export
|
|
25
|
-
export
|
|
26
|
-
export
|
|
27
|
-
export
|
|
28
|
-
export
|
|
29
|
-
export
|
|
30
|
-
export
|
|
31
|
-
export
|
|
32
|
-
export
|
|
33
|
-
export
|
|
34
|
-
export
|
|
35
|
-
export
|
|
36
|
-
export
|
|
37
|
-
export
|
|
38
|
-
export
|
|
39
|
-
export
|
|
40
|
-
export
|
|
41
|
-
export
|
|
42
|
-
export
|
|
43
|
-
export
|
|
44
|
-
export
|
|
45
|
-
export
|
|
46
|
-
export
|
|
47
|
-
export
|
|
48
|
-
export
|
|
49
|
-
export
|
|
50
|
-
export
|
|
51
|
-
export
|
|
52
|
-
export
|
|
53
|
-
export
|
|
54
|
-
export
|
|
55
|
-
export
|
|
56
|
-
export
|
|
57
|
-
export
|
|
58
|
-
export
|
|
59
|
-
export
|
|
60
|
-
export
|
|
61
|
-
export
|
|
1
|
+
export const KiCadSymbolLibFileExtension = 'kicad_sym';
|
|
2
|
+
export const SchematicSymbolFileExtension = 'sym';
|
|
3
|
+
export const LegacySymbolLibFileExtension = 'lib';
|
|
4
|
+
export const LegacySymbolDocumentFileExtension = 'dcm';
|
|
5
|
+
export const VrmlFileExtension = 'wrl';
|
|
6
|
+
export const ProjectFileExtension = 'kicad_pro';
|
|
7
|
+
export const LegacyProjectFileExtension = 'pro';
|
|
8
|
+
export const ProjectLocalSettingsFileExtension = 'kicad_prl';
|
|
9
|
+
export const LegacySchematicFileExtension = 'sch';
|
|
10
|
+
export const CadstarSchematicFileExtension = 'csa';
|
|
11
|
+
export const CadstarPartsLibraryFileExtension = 'lib';
|
|
12
|
+
export const KiCadSchematicFileExtension = 'kicad_sch';
|
|
13
|
+
export const SpiceFileExtension = 'cir';
|
|
14
|
+
export const CadstarNetlistFileExtension = 'frp';
|
|
15
|
+
export const OrCadPcb2NetlistFileExtension = 'net';
|
|
16
|
+
export const NetlistFileExtension = 'net';
|
|
17
|
+
export const AllegroNetlistFileExtension = 'txt';
|
|
18
|
+
export const FootprintAssignmentFileExtension = 'cmp';
|
|
19
|
+
export const GerberFileExtension = 'gbr';
|
|
20
|
+
export const GerberJobFileExtension = 'gbrjob';
|
|
21
|
+
export const HtmlFileExtension = 'html';
|
|
22
|
+
export const EquFileExtension = 'equ';
|
|
23
|
+
export const HotkeyFileExtension = 'hotkeys';
|
|
24
|
+
export const DatabaseLibraryFileExtension = 'kicad_dbl';
|
|
25
|
+
export const HTTPLibraryFileExtension = 'kicad_httplib';
|
|
26
|
+
export const ArchiveFileExtension = 'zip';
|
|
27
|
+
export const LegacyPcbFileExtension = 'brd';
|
|
28
|
+
export const EaglePcbFileExtension = 'brd';
|
|
29
|
+
export const CadstarPcbFileExtension = 'cpa';
|
|
30
|
+
export const KiCadPcbFileExtension = 'kicad_pcb';
|
|
31
|
+
export const DrawingSheetFileExtension = 'kicad_wks';
|
|
32
|
+
export const DesignRulesFileExtension = 'kicad_dru';
|
|
33
|
+
export const PdfFileExtension = 'pdf';
|
|
34
|
+
export const MacrosFileExtension = 'mcr';
|
|
35
|
+
export const DrillFileExtension = 'drl';
|
|
36
|
+
export const SVGFileExtension = 'svg';
|
|
37
|
+
export const ReportFileExtension = 'rpt';
|
|
38
|
+
export const FootprintPlaceFileExtension = 'pos';
|
|
39
|
+
export const KiCadFootprintLibPathExtension = 'pretty'; // this is a directory
|
|
40
|
+
export const LegacyFootprintLibPathExtension = 'mod'; // this is a file
|
|
41
|
+
export const AltiumFootprintLibPathExtension = 'PcbLib'; // this is a file
|
|
42
|
+
export const CadstarFootprintLibPathExtension = 'cpa'; // this is a file
|
|
43
|
+
export const EagleFootprintLibPathExtension = 'lbr'; // this is a file
|
|
44
|
+
export const GedaPcbFootprintLibFileExtension = 'fp'; // this is a file
|
|
45
|
+
export const KiCadFootprintFileExtension = 'kicad_mod';
|
|
46
|
+
export const SpecctraDsnFileExtension = 'dsn';
|
|
47
|
+
export const SpecctraSessionFileExtension = 'ses';
|
|
48
|
+
export const IpcD356FileExtension = 'd356';
|
|
49
|
+
export const Ipc2581FileExtension = 'xml';
|
|
50
|
+
export const WorkbookFileExtension = 'wbk';
|
|
51
|
+
export const PngFileExtension = 'png';
|
|
52
|
+
export const JpegFileExtension = 'jpg';
|
|
53
|
+
export const TextFileExtension = 'txt';
|
|
54
|
+
export const MarkdownFileExtension = 'md';
|
|
55
|
+
export const CsvFileExtension = 'csv';
|
|
56
|
+
export const XmlFileExtension = 'xml';
|
|
57
|
+
export const JsonFileExtension = 'json';
|
|
58
|
+
export const StepFileExtension = 'step';
|
|
59
|
+
export const StepFileAbrvExtension = 'stp';
|
|
60
|
+
export const GltfBinaryFileExtension = 'glb';
|
|
61
|
+
export const GerberFileExtensionsRegex = /(gbr|gko|pho|(g[tb][alops])|(gm?\\d\\d*)|(gp[tb]))/;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { gen_uuid } from '@modular-circuit/utils';
|
|
2
2
|
import { DEFAULT_FONT_SIZE } from '../constraints';
|
|
3
|
-
|
|
4
|
-
export
|
|
3
|
+
const TEXT_MARGIN = 0.7116;
|
|
4
|
+
export const gen_sch_sheet = (rect, pins, fields) => ({
|
|
5
5
|
// NOTE no rotation in the sheet
|
|
6
6
|
at: { position: rect.pos },
|
|
7
7
|
size: rect.size,
|
|
@@ -41,4 +41,4 @@ export var gen_sch_sheet = function (rect, pins, fields) { return ({
|
|
|
41
41
|
color: { r: 0, g: 0, b: 0, a: 0.0 },
|
|
42
42
|
},
|
|
43
43
|
uuid: gen_uuid(),
|
|
44
|
-
});
|
|
44
|
+
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ELECTRICAL_PINTYPE, GRAPHIC_PINSHAPE } from '@modular-circuit/electronics-model';
|
|
2
2
|
import { SHAPE_T } from '@modular-circuit/ir';
|
|
3
3
|
import { DEFAULT_FONT_SIZE } from '../../constraints';
|
|
4
|
-
export
|
|
5
|
-
name:
|
|
4
|
+
export const gen_lib_gnd = (value) => ({
|
|
5
|
+
name: `power:${value}`,
|
|
6
6
|
pin_numbers: {
|
|
7
7
|
offset: 0,
|
|
8
8
|
hide: true,
|
|
@@ -26,7 +26,7 @@ export var gen_lib_gnd = function (value) { return ({
|
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
28
|
name: 'Value',
|
|
29
|
-
text:
|
|
29
|
+
text: `${value}`,
|
|
30
30
|
at: { position: { x: 0, y: -3.81 }, rotation: 0 },
|
|
31
31
|
effects: {
|
|
32
32
|
font: { size: DEFAULT_FONT_SIZE },
|
|
@@ -71,7 +71,7 @@ export var gen_lib_gnd = function (value) { return ({
|
|
|
71
71
|
],
|
|
72
72
|
children: [
|
|
73
73
|
{
|
|
74
|
-
name:
|
|
74
|
+
name: `${value}_0_1`,
|
|
75
75
|
drawings: [
|
|
76
76
|
{
|
|
77
77
|
shape: SHAPE_T.POLY,
|
|
@@ -94,7 +94,7 @@ export var gen_lib_gnd = function (value) { return ({
|
|
|
94
94
|
],
|
|
95
95
|
},
|
|
96
96
|
{
|
|
97
|
-
name:
|
|
97
|
+
name: `${value}_0_1`,
|
|
98
98
|
pins: [
|
|
99
99
|
{
|
|
100
100
|
type: ELECTRICAL_PINTYPE.PT_POWER_IN,
|
|
@@ -118,4 +118,4 @@ export var gen_lib_gnd = function (value) { return ({
|
|
|
118
118
|
],
|
|
119
119
|
},
|
|
120
120
|
],
|
|
121
|
-
});
|
|
121
|
+
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ELECTRICAL_PINTYPE, GRAPHIC_PINSHAPE } from '@modular-circuit/electronics-model';
|
|
2
2
|
import { SHAPE_T } from '@modular-circuit/ir';
|
|
3
3
|
import { DEFAULT_FONT_SIZE } from '../../constraints';
|
|
4
|
-
export
|
|
5
|
-
name:
|
|
4
|
+
export const gen_lib_vcc = (value) => ({
|
|
5
|
+
name: `power:${value}`,
|
|
6
6
|
power: true,
|
|
7
7
|
pin_numbers: {
|
|
8
8
|
offset: 0,
|
|
@@ -27,7 +27,7 @@ export var gen_lib_vcc = function (value) { return ({
|
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
29
|
name: 'Value',
|
|
30
|
-
text:
|
|
30
|
+
text: `${value}`,
|
|
31
31
|
at: { position: { x: 0, y: 3.556 }, rotation: 0 },
|
|
32
32
|
effects: {
|
|
33
33
|
font: { size: DEFAULT_FONT_SIZE },
|
|
@@ -53,7 +53,7 @@ export var gen_lib_vcc = function (value) { return ({
|
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
55
|
name: 'Description',
|
|
56
|
-
text:
|
|
56
|
+
text: `Power symbol creates a global label with name \\"${value}\\"`,
|
|
57
57
|
at: { position: { x: 0, y: 0 }, rotation: 0 },
|
|
58
58
|
effects: {
|
|
59
59
|
font: { size: DEFAULT_FONT_SIZE },
|
|
@@ -72,7 +72,7 @@ export var gen_lib_vcc = function (value) { return ({
|
|
|
72
72
|
],
|
|
73
73
|
children: [
|
|
74
74
|
{
|
|
75
|
-
name:
|
|
75
|
+
name: `${value}_0_1`,
|
|
76
76
|
drawings: [
|
|
77
77
|
{
|
|
78
78
|
shape: SHAPE_T.POLY,
|
|
@@ -92,7 +92,7 @@ export var gen_lib_vcc = function (value) { return ({
|
|
|
92
92
|
],
|
|
93
93
|
},
|
|
94
94
|
{
|
|
95
|
-
name:
|
|
95
|
+
name: `${value}_1_1`,
|
|
96
96
|
pins: [
|
|
97
97
|
{
|
|
98
98
|
type: ELECTRICAL_PINTYPE.PT_POWER_IN,
|
|
@@ -116,4 +116,4 @@ export var gen_lib_vcc = function (value) { return ({
|
|
|
116
116
|
],
|
|
117
117
|
},
|
|
118
118
|
],
|
|
119
|
-
});
|
|
119
|
+
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { gen_uuid } from '@modular-circuit/utils';
|
|
2
2
|
import { DEFAULT_FONT_SIZE } from '../../constraints';
|
|
3
3
|
import { gen_pwr_ref } from '../symbol_utils';
|
|
4
|
-
export
|
|
5
|
-
lib_id:
|
|
6
|
-
at: { position
|
|
4
|
+
export const gen_sch_gnd = (value, pwr_number, port_id, position) => ({
|
|
5
|
+
lib_id: `power:${value}`,
|
|
6
|
+
at: { position, rotation: 0 },
|
|
7
7
|
unit: 1,
|
|
8
8
|
exclude_from_sim: false,
|
|
9
9
|
in_bom: true,
|
|
@@ -23,7 +23,7 @@ export var gen_sch_gnd = function (value, pwr_number, port_id, position) { retur
|
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
25
|
name: 'Value',
|
|
26
|
-
text:
|
|
26
|
+
text: `${value}`,
|
|
27
27
|
at: { position: { x: position.x, y: position.y + 5.08 }, rotation: 0 },
|
|
28
28
|
effects: {
|
|
29
29
|
font: { size: DEFAULT_FONT_SIZE },
|
|
@@ -32,7 +32,7 @@ export var gen_sch_gnd = function (value, pwr_number, port_id, position) { retur
|
|
|
32
32
|
{
|
|
33
33
|
name: 'Footprint',
|
|
34
34
|
text: '',
|
|
35
|
-
at: { position
|
|
35
|
+
at: { position, rotation: 0 },
|
|
36
36
|
effects: {
|
|
37
37
|
font: { size: DEFAULT_FONT_SIZE },
|
|
38
38
|
hide: true,
|
|
@@ -41,7 +41,7 @@ export var gen_sch_gnd = function (value, pwr_number, port_id, position) { retur
|
|
|
41
41
|
{
|
|
42
42
|
name: 'Datasheet',
|
|
43
43
|
text: '',
|
|
44
|
-
at: { position
|
|
44
|
+
at: { position, rotation: 0 },
|
|
45
45
|
effects: {
|
|
46
46
|
font: { size: DEFAULT_FONT_SIZE },
|
|
47
47
|
hide: true,
|
|
@@ -49,8 +49,8 @@ export var gen_sch_gnd = function (value, pwr_number, port_id, position) { retur
|
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
51
|
name: 'Description',
|
|
52
|
-
text:
|
|
53
|
-
at: { position
|
|
52
|
+
text: `Power symbol creates a global label with name \\"${value}\\" , ground`,
|
|
53
|
+
at: { position, rotation: 0 },
|
|
54
54
|
effects: {
|
|
55
55
|
font: { size: DEFAULT_FONT_SIZE },
|
|
56
56
|
hide: true,
|
|
@@ -63,4 +63,4 @@ export var gen_sch_gnd = function (value, pwr_number, port_id, position) { retur
|
|
|
63
63
|
number: '1',
|
|
64
64
|
},
|
|
65
65
|
],
|
|
66
|
-
});
|
|
66
|
+
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { gen_uuid } from '@modular-circuit/utils';
|
|
2
2
|
import { DEFAULT_FONT_SIZE } from '../../constraints';
|
|
3
3
|
import { gen_pwr_ref } from '../symbol_utils';
|
|
4
|
-
export
|
|
5
|
-
lib_id:
|
|
6
|
-
at: { position
|
|
4
|
+
export const gen_sch_vcc = (value, pwr_number, port_id, position) => ({
|
|
5
|
+
lib_id: `power:${value}`,
|
|
6
|
+
at: { position, rotation: 0 },
|
|
7
7
|
unit: 1,
|
|
8
8
|
exclude_from_sim: false,
|
|
9
9
|
in_bom: true,
|
|
@@ -23,7 +23,7 @@ export var gen_sch_vcc = function (value, pwr_number, port_id, position) { retur
|
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
25
|
name: 'Value',
|
|
26
|
-
text:
|
|
26
|
+
text: `${value}`,
|
|
27
27
|
at: { position: { x: position.x, y: position.y - 5.08 }, rotation: 0 },
|
|
28
28
|
effects: {
|
|
29
29
|
font: { size: DEFAULT_FONT_SIZE },
|
|
@@ -32,7 +32,7 @@ export var gen_sch_vcc = function (value, pwr_number, port_id, position) { retur
|
|
|
32
32
|
{
|
|
33
33
|
name: 'Footprint',
|
|
34
34
|
text: '',
|
|
35
|
-
at: { position
|
|
35
|
+
at: { position, rotation: 0 },
|
|
36
36
|
effects: {
|
|
37
37
|
font: { size: DEFAULT_FONT_SIZE },
|
|
38
38
|
hide: true,
|
|
@@ -41,7 +41,7 @@ export var gen_sch_vcc = function (value, pwr_number, port_id, position) { retur
|
|
|
41
41
|
{
|
|
42
42
|
name: 'Datasheet',
|
|
43
43
|
text: '',
|
|
44
|
-
at: { position
|
|
44
|
+
at: { position, rotation: 0 },
|
|
45
45
|
effects: {
|
|
46
46
|
font: { size: DEFAULT_FONT_SIZE },
|
|
47
47
|
hide: true,
|
|
@@ -49,8 +49,8 @@ export var gen_sch_vcc = function (value, pwr_number, port_id, position) { retur
|
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
51
|
name: 'Description',
|
|
52
|
-
text:
|
|
53
|
-
at: { position
|
|
52
|
+
text: `Power symbol creates a global label with name \\"${value}\\"`,
|
|
53
|
+
at: { position, rotation: 0 },
|
|
54
54
|
effects: {
|
|
55
55
|
font: { size: DEFAULT_FONT_SIZE },
|
|
56
56
|
hide: true,
|
|
@@ -63,4 +63,4 @@ export var gen_sch_vcc = function (value, pwr_number, port_id, position) { retur
|
|
|
63
63
|
uuid: port_id,
|
|
64
64
|
},
|
|
65
65
|
],
|
|
66
|
-
});
|
|
66
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export const gen_pwr_ref = (pwr_num) => `#PWR${pwr_num}`;
|
|
@@ -1,150 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
-
default:
|
|
36
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
-
if (t[2]) _.ops.pop();
|
|
41
|
-
_.trys.pop(); continue;
|
|
1
|
+
import { parse_module_name, remove_filename_path_prefix, unzipFile } from '@modular-circuit/utils';
|
|
2
|
+
export async function collect_sub_sheets(dependencies, module_resolver) {
|
|
3
|
+
const sheets = {};
|
|
4
|
+
const module_main_sheet = {};
|
|
5
|
+
const modules = {};
|
|
6
|
+
for (const [k, v] of Object.entries(dependencies)) {
|
|
7
|
+
// Get the URL for the ZIP archive
|
|
8
|
+
const zip_achieve_url = await module_resolver.get_module_achieve({
|
|
9
|
+
...parse_module_name(k),
|
|
10
|
+
version: v,
|
|
11
|
+
});
|
|
12
|
+
const module = await module_resolver.get_module_circuit({
|
|
13
|
+
...parse_module_name(k),
|
|
14
|
+
version: v,
|
|
15
|
+
});
|
|
16
|
+
if (!zip_achieve_url || !module)
|
|
17
|
+
throw new Error(`Module ${k}/${v} not found`);
|
|
18
|
+
if (!module.main)
|
|
19
|
+
throw new Error(`Missing main entry in module ${k}/${v}`);
|
|
20
|
+
module_main_sheet[k] = module.main;
|
|
21
|
+
modules[k] = module;
|
|
22
|
+
// Fetch the ZIP archive
|
|
23
|
+
const zip_achieve = await fetch(zip_achieve_url).then((res) => res.arrayBuffer());
|
|
24
|
+
const files = await unzipFile(zip_achieve);
|
|
25
|
+
for (const [name, content] of Object.entries(files)) {
|
|
26
|
+
if (name.endsWith('.kicad_sch')) {
|
|
27
|
+
const fileName = remove_filename_path_prefix(name);
|
|
28
|
+
// FIXME
|
|
29
|
+
if (fileName in sheets)
|
|
30
|
+
throw new Error(`Duplicate sheet name: ${fileName}`);
|
|
31
|
+
sheets[fileName] = content;
|
|
42
32
|
}
|
|
43
|
-
op = body.call(thisArg, _);
|
|
44
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
var __values = (this && this.__values) || function(o) {
|
|
49
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
50
|
-
if (m) return m.call(o);
|
|
51
|
-
if (o && typeof o.length === "number") return {
|
|
52
|
-
next: function () {
|
|
53
|
-
if (o && i >= o.length) o = void 0;
|
|
54
|
-
return { value: o && o[i++], done: !o };
|
|
55
33
|
}
|
|
56
|
-
};
|
|
57
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
58
|
-
};
|
|
59
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
60
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
61
|
-
if (!m) return o;
|
|
62
|
-
var i = m.call(o), r, ar = [], e;
|
|
63
|
-
try {
|
|
64
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
65
34
|
}
|
|
66
|
-
|
|
67
|
-
finally {
|
|
68
|
-
try {
|
|
69
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
70
|
-
}
|
|
71
|
-
finally { if (e) throw e.error; }
|
|
72
|
-
}
|
|
73
|
-
return ar;
|
|
74
|
-
};
|
|
75
|
-
import { parse_module_name, remove_filename_path_prefix, unzipFile } from '@modular-circuit/utils';
|
|
76
|
-
export function collect_sub_sheets(dependencies, module_resolver) {
|
|
77
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
78
|
-
var sheets, module_main_sheet, modules, _a, _b, _c, k, v, zip_achieve_url, module_1, zip_achieve, files, _d, _e, _f, name, content, fileName, e_1_1;
|
|
79
|
-
var e_1, _g, e_2, _h;
|
|
80
|
-
return __generator(this, function (_j) {
|
|
81
|
-
switch (_j.label) {
|
|
82
|
-
case 0:
|
|
83
|
-
sheets = {};
|
|
84
|
-
module_main_sheet = {};
|
|
85
|
-
modules = {};
|
|
86
|
-
_j.label = 1;
|
|
87
|
-
case 1:
|
|
88
|
-
_j.trys.push([1, 9, 10, 11]);
|
|
89
|
-
_a = __values(Object.entries(dependencies)), _b = _a.next();
|
|
90
|
-
_j.label = 2;
|
|
91
|
-
case 2:
|
|
92
|
-
if (!!_b.done) return [3 /*break*/, 8];
|
|
93
|
-
_c = __read(_b.value, 2), k = _c[0], v = _c[1];
|
|
94
|
-
return [4 /*yield*/, module_resolver.get_module_achieve(__assign(__assign({}, parse_module_name(k)), { version: v }))];
|
|
95
|
-
case 3:
|
|
96
|
-
zip_achieve_url = _j.sent();
|
|
97
|
-
return [4 /*yield*/, module_resolver.get_module_circuit(__assign(__assign({}, parse_module_name(k)), { version: v }))];
|
|
98
|
-
case 4:
|
|
99
|
-
module_1 = _j.sent();
|
|
100
|
-
if (!zip_achieve_url || !module_1)
|
|
101
|
-
throw new Error("Module ".concat(k, "/").concat(v, " not found"));
|
|
102
|
-
if (!module_1.main)
|
|
103
|
-
throw new Error("Missing main entry in module ".concat(k, "/").concat(v));
|
|
104
|
-
module_main_sheet[k] = module_1.main;
|
|
105
|
-
modules[k] = module_1;
|
|
106
|
-
return [4 /*yield*/, fetch(zip_achieve_url).then(function (res) { return res.arrayBuffer(); })];
|
|
107
|
-
case 5:
|
|
108
|
-
zip_achieve = _j.sent();
|
|
109
|
-
return [4 /*yield*/, unzipFile(zip_achieve)];
|
|
110
|
-
case 6:
|
|
111
|
-
files = _j.sent();
|
|
112
|
-
try {
|
|
113
|
-
for (_d = (e_2 = void 0, __values(Object.entries(files))), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
114
|
-
_f = __read(_e.value, 2), name = _f[0], content = _f[1];
|
|
115
|
-
if (name.endsWith('.kicad_sch')) {
|
|
116
|
-
fileName = remove_filename_path_prefix(name);
|
|
117
|
-
// FIXME
|
|
118
|
-
if (fileName in sheets)
|
|
119
|
-
throw new Error("Duplicate sheet name: ".concat(fileName));
|
|
120
|
-
sheets[fileName] = content;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
125
|
-
finally {
|
|
126
|
-
try {
|
|
127
|
-
if (_e && !_e.done && (_h = _d.return)) _h.call(_d);
|
|
128
|
-
}
|
|
129
|
-
finally { if (e_2) throw e_2.error; }
|
|
130
|
-
}
|
|
131
|
-
_j.label = 7;
|
|
132
|
-
case 7:
|
|
133
|
-
_b = _a.next();
|
|
134
|
-
return [3 /*break*/, 2];
|
|
135
|
-
case 8: return [3 /*break*/, 11];
|
|
136
|
-
case 9:
|
|
137
|
-
e_1_1 = _j.sent();
|
|
138
|
-
e_1 = { error: e_1_1 };
|
|
139
|
-
return [3 /*break*/, 11];
|
|
140
|
-
case 10:
|
|
141
|
-
try {
|
|
142
|
-
if (_b && !_b.done && (_g = _a.return)) _g.call(_a);
|
|
143
|
-
}
|
|
144
|
-
finally { if (e_1) throw e_1.error; }
|
|
145
|
-
return [7 /*endfinally*/];
|
|
146
|
-
case 11: return [2 /*return*/, { sheets: sheets, module_main_sheet: module_main_sheet, modules: modules }];
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
});
|
|
35
|
+
return { sheets, module_main_sheet, modules };
|
|
150
36
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// millimeters
|
|
2
|
-
export
|
|
2
|
+
export const PAPER_SIZE = {
|
|
3
3
|
A0: { width: 841, height: 1189 },
|
|
4
4
|
A1: { width: 594, height: 841 },
|
|
5
5
|
A2: { width: 420, height: 594 },
|
|
@@ -10,8 +10,8 @@ export var PAPER_SIZE = {
|
|
|
10
10
|
A7: { width: 74, height: 105 },
|
|
11
11
|
A8: { width: 52, height: 74 },
|
|
12
12
|
};
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
13
|
+
export const DEFAULT_PAPER_SIZE = PAPER_SIZE.A4;
|
|
14
|
+
export const GENERATOR_NAME = 'modular_circuit';
|
|
15
|
+
export const SCH_VERSION = 20231120;
|
|
16
|
+
export const PAPER = 'A4';
|
|
17
|
+
export const GENERATOR_VERSION = '8.0';
|
|
@@ -1,38 +1,9 @@
|
|
|
1
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
2
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
3
|
-
if (!m) return o;
|
|
4
|
-
var i = m.call(o), r, ar = [], e;
|
|
5
|
-
try {
|
|
6
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
7
|
-
}
|
|
8
|
-
catch (error) { e = { error: error }; }
|
|
9
|
-
finally {
|
|
10
|
-
try {
|
|
11
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
12
|
-
}
|
|
13
|
-
finally { if (e) throw e.error; }
|
|
14
|
-
}
|
|
15
|
-
return ar;
|
|
16
|
-
};
|
|
17
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
18
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
19
|
-
if (ar || !(i in from)) {
|
|
20
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
21
|
-
ar[i] = from[i];
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
25
|
-
};
|
|
26
1
|
export function filterNullOrUndefined(originalMethod, _context) {
|
|
27
|
-
function replacementMethod() {
|
|
28
|
-
var args = [];
|
|
29
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
30
|
-
args[_i] = arguments[_i];
|
|
31
|
-
}
|
|
2
|
+
function replacementMethod(...args) {
|
|
32
3
|
if (args.length === 0 || (args.length === 1 && (args[0] === undefined || args[0] === null)))
|
|
33
4
|
return '';
|
|
34
5
|
// @ts-ignore
|
|
35
|
-
|
|
6
|
+
const result = originalMethod.call(this, ...args);
|
|
36
7
|
return result;
|
|
37
8
|
}
|
|
38
9
|
return replacementMethod;
|