@modular-circuit/transpiler 0.0.58 → 0.0.61
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 +25 -109
- package/build/builder/graph_to_kicad/index.js +9 -61
- package/build/builder/index.js +5 -1
- package/build/converter/graph_to_netlist/context.js +2 -0
- package/build/converter/graph_to_netlist/graph_converter.js +57 -173
- package/build/converter/graph_to_netlist/index.js +18 -2
- package/build/converter/index.js +19 -3
- package/build/converter/kicad_sexpr/eeschema/drawing_sheet/index.js +7 -4
- package/build/converter/kicad_sexpr/eeschema/drawing_sheet/sch_default_drawing_sheet.js +4 -1
- package/build/converter/kicad_sexpr/eeschema/index.js +18 -2
- package/build/converter/kicad_sexpr/eeschema/printer.js +232 -281
- package/build/converter/kicad_sexpr/index.js +18 -2
- package/build/converter/kicad_sexpr/pcb/index.js +2 -1
- package/build/converter/link_to_netlist/context.js +2 -0
- package/build/converter/link_to_netlist/converter.js +84 -138
- package/build/converter/link_to_netlist/index.js +18 -2
- package/build/converter/link_to_netlist/links/converter_base.js +44 -131
- package/build/converter/link_to_netlist/links/converters.js +333 -556
- package/build/converter/link_to_netlist/links/index.js +18 -2
- package/build/converter/netlist_to_kicad/context.js +2 -0
- package/build/converter/netlist_to_kicad/index.js +19 -3
- package/build/converter/netlist_to_kicad/layout.js +26 -25
- package/build/converter/netlist_to_kicad/netlist_converter.js +93 -182
- package/build/index.js +21 -5
- package/build/kicad/constraints/index.js +4 -1
- package/build/kicad/label/index.js +18 -2
- package/build/kicad/label/net_label.js +10 -6
- package/build/kicad/label/sheet_pin.js +19 -23
- package/build/kicad/project/index.js +18 -2
- package/build/kicad/project/kicad_prl.js +7 -3
- package/build/kicad/project/kicad_pro.js +9 -5
- package/build/kicad/project/kicad_project_achieve.js +40 -50
- package/build/kicad/project/wildcards_and_files_ext.js +65 -61
- package/build/kicad/sheet/index.js +17 -1
- package/build/kicad/sheet/sheet.js +12 -8
- package/build/kicad/symbols/index.js +18 -2
- package/build/kicad/symbols/lib_symbol/gnd.js +24 -20
- package/build/kicad/symbols/lib_symbol/index.js +18 -2
- package/build/kicad/symbols/lib_symbol/vcc.js +25 -21
- package/build/kicad/symbols/sch_symbol/gnd.js +23 -19
- package/build/kicad/symbols/sch_symbol/index.js +18 -2
- package/build/kicad/symbols/sch_symbol/vcc.js +23 -19
- package/build/kicad/symbols/symbol_utils.js +5 -1
- package/build/utils/collect_sub_sheets.js +35 -146
- package/build/utils/constraints.js +9 -6
- package/build/utils/filter_null_undefined.js +6 -32
- package/build/utils/index.js +20 -4
- package/build/utils/string_formatter.js +27 -29
- package/package.json +5 -5
|
@@ -1,58 +1,61 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.gen_sch_gnd = void 0;
|
|
4
|
+
const utils_1 = require("@modular-circuit/utils");
|
|
5
|
+
const constraints_1 = require("../../constraints");
|
|
6
|
+
const symbol_utils_1 = require("../symbol_utils");
|
|
7
|
+
const gen_sch_gnd = (value, pwr_number, port_id, position) => ({
|
|
8
|
+
lib_id: `power:${value}`,
|
|
9
|
+
at: { position, rotation: 0 },
|
|
7
10
|
unit: 1,
|
|
8
11
|
exclude_from_sim: false,
|
|
9
12
|
in_bom: true,
|
|
10
13
|
on_board: true,
|
|
11
14
|
dnp: false,
|
|
12
15
|
fields_autoplaced: true,
|
|
13
|
-
uuid: gen_uuid(),
|
|
16
|
+
uuid: (0, utils_1.gen_uuid)(),
|
|
14
17
|
properties: [
|
|
15
18
|
{
|
|
16
19
|
name: 'Reference',
|
|
17
|
-
text: gen_pwr_ref(pwr_number),
|
|
20
|
+
text: (0, symbol_utils_1.gen_pwr_ref)(pwr_number),
|
|
18
21
|
at: { position: { x: position.x, y: position.y + 6.35 }, rotation: 0 },
|
|
19
22
|
effects: {
|
|
20
|
-
font: { size: DEFAULT_FONT_SIZE },
|
|
23
|
+
font: { size: constraints_1.DEFAULT_FONT_SIZE },
|
|
21
24
|
hide: true,
|
|
22
25
|
},
|
|
23
26
|
},
|
|
24
27
|
{
|
|
25
28
|
name: 'Value',
|
|
26
|
-
text:
|
|
29
|
+
text: `${value}`,
|
|
27
30
|
at: { position: { x: position.x, y: position.y + 5.08 }, rotation: 0 },
|
|
28
31
|
effects: {
|
|
29
|
-
font: { size: DEFAULT_FONT_SIZE },
|
|
32
|
+
font: { size: constraints_1.DEFAULT_FONT_SIZE },
|
|
30
33
|
},
|
|
31
34
|
},
|
|
32
35
|
{
|
|
33
36
|
name: 'Footprint',
|
|
34
37
|
text: '',
|
|
35
|
-
at: { position
|
|
38
|
+
at: { position, rotation: 0 },
|
|
36
39
|
effects: {
|
|
37
|
-
font: { size: DEFAULT_FONT_SIZE },
|
|
40
|
+
font: { size: constraints_1.DEFAULT_FONT_SIZE },
|
|
38
41
|
hide: true,
|
|
39
42
|
},
|
|
40
43
|
},
|
|
41
44
|
{
|
|
42
45
|
name: 'Datasheet',
|
|
43
46
|
text: '',
|
|
44
|
-
at: { position
|
|
47
|
+
at: { position, rotation: 0 },
|
|
45
48
|
effects: {
|
|
46
|
-
font: { size: DEFAULT_FONT_SIZE },
|
|
49
|
+
font: { size: constraints_1.DEFAULT_FONT_SIZE },
|
|
47
50
|
hide: true,
|
|
48
51
|
},
|
|
49
52
|
},
|
|
50
53
|
{
|
|
51
54
|
name: 'Description',
|
|
52
|
-
text:
|
|
53
|
-
at: { position
|
|
55
|
+
text: `Power symbol creates a global label with name \\"${value}\\" , ground`,
|
|
56
|
+
at: { position, rotation: 0 },
|
|
54
57
|
effects: {
|
|
55
|
-
font: { size: DEFAULT_FONT_SIZE },
|
|
58
|
+
font: { size: constraints_1.DEFAULT_FONT_SIZE },
|
|
56
59
|
hide: true,
|
|
57
60
|
},
|
|
58
61
|
},
|
|
@@ -63,4 +66,5 @@ export var gen_sch_gnd = function (value, pwr_number, port_id, position) { retur
|
|
|
63
66
|
number: '1',
|
|
64
67
|
},
|
|
65
68
|
],
|
|
66
|
-
});
|
|
69
|
+
});
|
|
70
|
+
exports.gen_sch_gnd = gen_sch_gnd;
|
|
@@ -1,2 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./gnd"), exports);
|
|
18
|
+
__exportStar(require("./vcc"), exports);
|
|
@@ -1,58 +1,61 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.gen_sch_vcc = void 0;
|
|
4
|
+
const utils_1 = require("@modular-circuit/utils");
|
|
5
|
+
const constraints_1 = require("../../constraints");
|
|
6
|
+
const symbol_utils_1 = require("../symbol_utils");
|
|
7
|
+
const gen_sch_vcc = (value, pwr_number, port_id, position) => ({
|
|
8
|
+
lib_id: `power:${value}`,
|
|
9
|
+
at: { position, rotation: 0 },
|
|
7
10
|
unit: 1,
|
|
8
11
|
exclude_from_sim: false,
|
|
9
12
|
in_bom: true,
|
|
10
13
|
on_board: true,
|
|
11
14
|
dnp: false,
|
|
12
15
|
fields_autoplaced: true,
|
|
13
|
-
uuid: gen_uuid(),
|
|
16
|
+
uuid: (0, utils_1.gen_uuid)(),
|
|
14
17
|
properties: [
|
|
15
18
|
{
|
|
16
19
|
name: 'Reference',
|
|
17
|
-
text: gen_pwr_ref(pwr_number),
|
|
20
|
+
text: (0, symbol_utils_1.gen_pwr_ref)(pwr_number),
|
|
18
21
|
at: { position: { x: position.x, y: position.y + 3.81 }, rotation: 0 },
|
|
19
22
|
effects: {
|
|
20
|
-
font: { size: DEFAULT_FONT_SIZE },
|
|
23
|
+
font: { size: constraints_1.DEFAULT_FONT_SIZE },
|
|
21
24
|
hide: true,
|
|
22
25
|
},
|
|
23
26
|
},
|
|
24
27
|
{
|
|
25
28
|
name: 'Value',
|
|
26
|
-
text:
|
|
29
|
+
text: `${value}`,
|
|
27
30
|
at: { position: { x: position.x, y: position.y - 5.08 }, rotation: 0 },
|
|
28
31
|
effects: {
|
|
29
|
-
font: { size: DEFAULT_FONT_SIZE },
|
|
32
|
+
font: { size: constraints_1.DEFAULT_FONT_SIZE },
|
|
30
33
|
},
|
|
31
34
|
},
|
|
32
35
|
{
|
|
33
36
|
name: 'Footprint',
|
|
34
37
|
text: '',
|
|
35
|
-
at: { position
|
|
38
|
+
at: { position, rotation: 0 },
|
|
36
39
|
effects: {
|
|
37
|
-
font: { size: DEFAULT_FONT_SIZE },
|
|
40
|
+
font: { size: constraints_1.DEFAULT_FONT_SIZE },
|
|
38
41
|
hide: true,
|
|
39
42
|
},
|
|
40
43
|
},
|
|
41
44
|
{
|
|
42
45
|
name: 'Datasheet',
|
|
43
46
|
text: '',
|
|
44
|
-
at: { position
|
|
47
|
+
at: { position, rotation: 0 },
|
|
45
48
|
effects: {
|
|
46
|
-
font: { size: DEFAULT_FONT_SIZE },
|
|
49
|
+
font: { size: constraints_1.DEFAULT_FONT_SIZE },
|
|
47
50
|
hide: true,
|
|
48
51
|
},
|
|
49
52
|
},
|
|
50
53
|
{
|
|
51
54
|
name: 'Description',
|
|
52
|
-
text:
|
|
53
|
-
at: { position
|
|
55
|
+
text: `Power symbol creates a global label with name \\"${value}\\"`,
|
|
56
|
+
at: { position, rotation: 0 },
|
|
54
57
|
effects: {
|
|
55
|
-
font: { size: DEFAULT_FONT_SIZE },
|
|
58
|
+
font: { size: constraints_1.DEFAULT_FONT_SIZE },
|
|
56
59
|
hide: true,
|
|
57
60
|
},
|
|
58
61
|
},
|
|
@@ -63,4 +66,5 @@ export var gen_sch_vcc = function (value, pwr_number, port_id, position) { retur
|
|
|
63
66
|
uuid: port_id,
|
|
64
67
|
},
|
|
65
68
|
],
|
|
66
|
-
});
|
|
69
|
+
});
|
|
70
|
+
exports.gen_sch_vcc = gen_sch_vcc;
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.gen_pwr_ref = void 0;
|
|
4
|
+
const gen_pwr_ref = (pwr_num) => `#PWR${pwr_num}`;
|
|
5
|
+
exports.gen_pwr_ref = gen_pwr_ref;
|
|
@@ -1,150 +1,39 @@
|
|
|
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
|
-
if (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.collect_sub_sheets = collect_sub_sheets;
|
|
4
|
+
const utils_1 = require("@modular-circuit/utils");
|
|
5
|
+
async function collect_sub_sheets(dependencies, module_resolver) {
|
|
6
|
+
const sheets = {};
|
|
7
|
+
const module_main_sheet = {};
|
|
8
|
+
const modules = {};
|
|
9
|
+
for (const [k, v] of Object.entries(dependencies)) {
|
|
10
|
+
// Get the URL for the ZIP archive
|
|
11
|
+
const zip_achieve_url = await module_resolver.get_module_achieve({
|
|
12
|
+
...(0, utils_1.parse_module_name)(k),
|
|
13
|
+
version: v,
|
|
14
|
+
});
|
|
15
|
+
const module = await module_resolver.get_module_circuit({
|
|
16
|
+
...(0, utils_1.parse_module_name)(k),
|
|
17
|
+
version: v,
|
|
18
|
+
});
|
|
19
|
+
if (!zip_achieve_url || !module)
|
|
20
|
+
throw new Error(`Module ${k}/${v} not found`);
|
|
21
|
+
if (!module.main)
|
|
22
|
+
throw new Error(`Missing main entry in module ${k}/${v}`);
|
|
23
|
+
module_main_sheet[k] = module.main;
|
|
24
|
+
modules[k] = module;
|
|
25
|
+
// Fetch the ZIP archive
|
|
26
|
+
const zip_achieve = await fetch(zip_achieve_url).then((res) => res.arrayBuffer());
|
|
27
|
+
const files = await (0, utils_1.unzipFile)(zip_achieve);
|
|
28
|
+
for (const [name, content] of Object.entries(files)) {
|
|
29
|
+
if (name.endsWith('.kicad_sch')) {
|
|
30
|
+
const fileName = (0, utils_1.remove_filename_path_prefix)(name);
|
|
31
|
+
// FIXME
|
|
32
|
+
if (fileName in sheets)
|
|
33
|
+
throw new Error(`Duplicate sheet name: ${fileName}`);
|
|
34
|
+
sheets[fileName] = content;
|
|
42
35
|
}
|
|
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
36
|
}
|
|
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
37
|
}
|
|
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
|
-
});
|
|
38
|
+
return { sheets, module_main_sheet, modules };
|
|
150
39
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
// millimeters
|
|
2
|
-
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.GENERATOR_VERSION = exports.PAPER = exports.SCH_VERSION = exports.GENERATOR_NAME = exports.DEFAULT_PAPER_SIZE = exports.PAPER_SIZE = void 0;
|
|
5
|
+
exports.PAPER_SIZE = {
|
|
3
6
|
A0: { width: 841, height: 1189 },
|
|
4
7
|
A1: { width: 594, height: 841 },
|
|
5
8
|
A2: { width: 420, height: 594 },
|
|
@@ -10,8 +13,8 @@ export var PAPER_SIZE = {
|
|
|
10
13
|
A7: { width: 74, height: 105 },
|
|
11
14
|
A8: { width: 52, height: 74 },
|
|
12
15
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
exports.DEFAULT_PAPER_SIZE = exports.PAPER_SIZE.A4;
|
|
17
|
+
exports.GENERATOR_NAME = 'modular_circuit';
|
|
18
|
+
exports.SCH_VERSION = 20231120;
|
|
19
|
+
exports.PAPER = 'A4';
|
|
20
|
+
exports.GENERATOR_VERSION = '8.0';
|
|
@@ -1,38 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
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
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.filterNullOrUndefined = filterNullOrUndefined;
|
|
4
|
+
function filterNullOrUndefined(originalMethod, _context) {
|
|
5
|
+
function replacementMethod(...args) {
|
|
32
6
|
if (args.length === 0 || (args.length === 1 && (args[0] === undefined || args[0] === null)))
|
|
33
7
|
return '';
|
|
34
8
|
// @ts-ignore
|
|
35
|
-
|
|
9
|
+
const result = originalMethod.call(this, ...args);
|
|
36
10
|
return result;
|
|
37
11
|
}
|
|
38
12
|
return replacementMethod;
|
package/build/utils/index.js
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./collect_sub_sheets"), exports);
|
|
18
|
+
__exportStar(require("./constraints"), exports);
|
|
19
|
+
__exportStar(require("./filter_null_undefined"), exports);
|
|
20
|
+
__exportStar(require("./string_formatter"), exports);
|
|
@@ -1,35 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StringFormatter = exports.tab = void 0;
|
|
4
|
+
exports.tab = '\t';
|
|
5
|
+
class StringFormatter {
|
|
6
|
+
intend;
|
|
7
|
+
content = '';
|
|
8
|
+
constructor(intend = 0) {
|
|
5
9
|
this.intend = intend;
|
|
6
|
-
this.content = '';
|
|
7
10
|
}
|
|
8
|
-
|
|
11
|
+
toString() {
|
|
9
12
|
return this.content;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
enumerable: false,
|
|
16
|
-
configurable: true
|
|
17
|
-
});
|
|
18
|
-
StringFormatter.prototype.enter_scope = function () {
|
|
13
|
+
}
|
|
14
|
+
get intend_level() {
|
|
15
|
+
return this.intend;
|
|
16
|
+
}
|
|
17
|
+
enter_scope() {
|
|
19
18
|
this.intend += 1;
|
|
20
|
-
}
|
|
21
|
-
|
|
19
|
+
}
|
|
20
|
+
exit_scope() {
|
|
22
21
|
this.intend -= 1;
|
|
23
|
-
}
|
|
24
|
-
|
|
22
|
+
}
|
|
23
|
+
append(str) {
|
|
25
24
|
this.content += str;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
this.content +=
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
this.append("
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
export { StringFormatter };
|
|
25
|
+
}
|
|
26
|
+
append_line(str) {
|
|
27
|
+
this.content += `${exports.tab.repeat(this.intend)}${str}`;
|
|
28
|
+
}
|
|
29
|
+
append_quote(str) {
|
|
30
|
+
this.append(`"${str}"`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.StringFormatter = StringFormatter;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modular-circuit/transpiler",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.61",
|
|
4
4
|
"description": "Intermediate representation of the modular circuit",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"files": [
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"js-base64": "^3.7.7",
|
|
28
28
|
"jszip": "^3.10.1",
|
|
29
|
-
"@modular-circuit/ir": "0.0.
|
|
30
|
-
"@modular-circuit/perc": "0.0.
|
|
31
|
-
"@modular-circuit/
|
|
32
|
-
"@modular-circuit/
|
|
29
|
+
"@modular-circuit/ir": "0.0.54",
|
|
30
|
+
"@modular-circuit/perc": "0.0.54",
|
|
31
|
+
"@modular-circuit/electronics-model": "0.0.46",
|
|
32
|
+
"@modular-circuit/utils": "0.0.32"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"clean": "rimraf build",
|