@modular-circuit/transpiler 0.0.61 → 0.0.64

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.
Files changed (49) hide show
  1. package/build/builder/graph_to_kicad/do_convert_graph_to_kicad_project.js +109 -25
  2. package/build/builder/graph_to_kicad/index.js +61 -9
  3. package/build/builder/index.js +1 -5
  4. package/build/converter/graph_to_netlist/context.js +0 -2
  5. package/build/converter/graph_to_netlist/graph_converter.js +173 -57
  6. package/build/converter/graph_to_netlist/index.js +2 -18
  7. package/build/converter/index.js +3 -19
  8. package/build/converter/kicad_sexpr/eeschema/drawing_sheet/index.js +4 -7
  9. package/build/converter/kicad_sexpr/eeschema/drawing_sheet/sch_default_drawing_sheet.js +1 -4
  10. package/build/converter/kicad_sexpr/eeschema/index.js +2 -18
  11. package/build/converter/kicad_sexpr/eeschema/printer.js +281 -232
  12. package/build/converter/kicad_sexpr/index.js +2 -18
  13. package/build/converter/kicad_sexpr/pcb/index.js +1 -2
  14. package/build/converter/link_to_netlist/context.js +0 -2
  15. package/build/converter/link_to_netlist/converter.js +138 -84
  16. package/build/converter/link_to_netlist/index.js +2 -18
  17. package/build/converter/link_to_netlist/links/converter_base.js +131 -44
  18. package/build/converter/link_to_netlist/links/converters.js +556 -333
  19. package/build/converter/link_to_netlist/links/index.js +2 -18
  20. package/build/converter/netlist_to_kicad/context.js +0 -2
  21. package/build/converter/netlist_to_kicad/index.js +3 -19
  22. package/build/converter/netlist_to_kicad/layout.js +25 -26
  23. package/build/converter/netlist_to_kicad/netlist_converter.js +182 -93
  24. package/build/index.js +5 -21
  25. package/build/kicad/constraints/index.js +1 -4
  26. package/build/kicad/label/index.js +2 -18
  27. package/build/kicad/label/net_label.js +6 -10
  28. package/build/kicad/label/sheet_pin.js +23 -19
  29. package/build/kicad/project/index.js +2 -18
  30. package/build/kicad/project/kicad_prl.js +3 -7
  31. package/build/kicad/project/kicad_pro.js +5 -9
  32. package/build/kicad/project/kicad_project_achieve.js +50 -40
  33. package/build/kicad/project/wildcards_and_files_ext.js +61 -65
  34. package/build/kicad/sheet/index.js +1 -17
  35. package/build/kicad/sheet/sheet.js +8 -12
  36. package/build/kicad/symbols/index.js +2 -18
  37. package/build/kicad/symbols/lib_symbol/gnd.js +20 -24
  38. package/build/kicad/symbols/lib_symbol/index.js +2 -18
  39. package/build/kicad/symbols/lib_symbol/vcc.js +21 -25
  40. package/build/kicad/symbols/sch_symbol/gnd.js +19 -23
  41. package/build/kicad/symbols/sch_symbol/index.js +2 -18
  42. package/build/kicad/symbols/sch_symbol/vcc.js +19 -23
  43. package/build/kicad/symbols/symbol_utils.js +1 -5
  44. package/build/utils/collect_sub_sheets.js +146 -35
  45. package/build/utils/constraints.js +6 -9
  46. package/build/utils/filter_null_undefined.js +32 -6
  47. package/build/utils/index.js +4 -20
  48. package/build/utils/string_formatter.js +29 -27
  49. package/package.json +5 -5
@@ -1,61 +1,58 @@
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 },
1
+ import { gen_uuid } from '@modular-circuit/utils';
2
+ import { DEFAULT_FONT_SIZE } from '../../constraints';
3
+ import { gen_pwr_ref } from '../symbol_utils';
4
+ export var gen_sch_gnd = function (value, pwr_number, port_id, position) { return ({
5
+ lib_id: "power:".concat(value),
6
+ at: { position: position, rotation: 0 },
10
7
  unit: 1,
11
8
  exclude_from_sim: false,
12
9
  in_bom: true,
13
10
  on_board: true,
14
11
  dnp: false,
15
12
  fields_autoplaced: true,
16
- uuid: (0, utils_1.gen_uuid)(),
13
+ uuid: gen_uuid(),
17
14
  properties: [
18
15
  {
19
16
  name: 'Reference',
20
- text: (0, symbol_utils_1.gen_pwr_ref)(pwr_number),
17
+ text: gen_pwr_ref(pwr_number),
21
18
  at: { position: { x: position.x, y: position.y + 6.35 }, rotation: 0 },
22
19
  effects: {
23
- font: { size: constraints_1.DEFAULT_FONT_SIZE },
20
+ font: { size: DEFAULT_FONT_SIZE },
24
21
  hide: true,
25
22
  },
26
23
  },
27
24
  {
28
25
  name: 'Value',
29
- text: `${value}`,
26
+ text: "".concat(value),
30
27
  at: { position: { x: position.x, y: position.y + 5.08 }, rotation: 0 },
31
28
  effects: {
32
- font: { size: constraints_1.DEFAULT_FONT_SIZE },
29
+ font: { size: DEFAULT_FONT_SIZE },
33
30
  },
34
31
  },
35
32
  {
36
33
  name: 'Footprint',
37
34
  text: '',
38
- at: { position, rotation: 0 },
35
+ at: { position: position, rotation: 0 },
39
36
  effects: {
40
- font: { size: constraints_1.DEFAULT_FONT_SIZE },
37
+ font: { size: DEFAULT_FONT_SIZE },
41
38
  hide: true,
42
39
  },
43
40
  },
44
41
  {
45
42
  name: 'Datasheet',
46
43
  text: '',
47
- at: { position, rotation: 0 },
44
+ at: { position: position, rotation: 0 },
48
45
  effects: {
49
- font: { size: constraints_1.DEFAULT_FONT_SIZE },
46
+ font: { size: DEFAULT_FONT_SIZE },
50
47
  hide: true,
51
48
  },
52
49
  },
53
50
  {
54
51
  name: 'Description',
55
- text: `Power symbol creates a global label with name \\"${value}\\" , ground`,
56
- at: { position, rotation: 0 },
52
+ text: "Power symbol creates a global label with name \\\"".concat(value, "\\\" , ground"),
53
+ at: { position: position, rotation: 0 },
57
54
  effects: {
58
- font: { size: constraints_1.DEFAULT_FONT_SIZE },
55
+ font: { size: DEFAULT_FONT_SIZE },
59
56
  hide: true,
60
57
  },
61
58
  },
@@ -66,5 +63,4 @@ const gen_sch_gnd = (value, pwr_number, port_id, position) => ({
66
63
  number: '1',
67
64
  },
68
65
  ],
69
- });
70
- exports.gen_sch_gnd = gen_sch_gnd;
66
+ }); };
@@ -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
+ export * from './gnd';
2
+ export * from './vcc';
@@ -1,61 +1,58 @@
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 },
1
+ import { gen_uuid } from '@modular-circuit/utils';
2
+ import { DEFAULT_FONT_SIZE } from '../../constraints';
3
+ import { gen_pwr_ref } from '../symbol_utils';
4
+ export var gen_sch_vcc = function (value, pwr_number, port_id, position) { return ({
5
+ lib_id: "power:".concat(value),
6
+ at: { position: position, rotation: 0 },
10
7
  unit: 1,
11
8
  exclude_from_sim: false,
12
9
  in_bom: true,
13
10
  on_board: true,
14
11
  dnp: false,
15
12
  fields_autoplaced: true,
16
- uuid: (0, utils_1.gen_uuid)(),
13
+ uuid: gen_uuid(),
17
14
  properties: [
18
15
  {
19
16
  name: 'Reference',
20
- text: (0, symbol_utils_1.gen_pwr_ref)(pwr_number),
17
+ text: gen_pwr_ref(pwr_number),
21
18
  at: { position: { x: position.x, y: position.y + 3.81 }, rotation: 0 },
22
19
  effects: {
23
- font: { size: constraints_1.DEFAULT_FONT_SIZE },
20
+ font: { size: DEFAULT_FONT_SIZE },
24
21
  hide: true,
25
22
  },
26
23
  },
27
24
  {
28
25
  name: 'Value',
29
- text: `${value}`,
26
+ text: "".concat(value),
30
27
  at: { position: { x: position.x, y: position.y - 5.08 }, rotation: 0 },
31
28
  effects: {
32
- font: { size: constraints_1.DEFAULT_FONT_SIZE },
29
+ font: { size: DEFAULT_FONT_SIZE },
33
30
  },
34
31
  },
35
32
  {
36
33
  name: 'Footprint',
37
34
  text: '',
38
- at: { position, rotation: 0 },
35
+ at: { position: position, rotation: 0 },
39
36
  effects: {
40
- font: { size: constraints_1.DEFAULT_FONT_SIZE },
37
+ font: { size: DEFAULT_FONT_SIZE },
41
38
  hide: true,
42
39
  },
43
40
  },
44
41
  {
45
42
  name: 'Datasheet',
46
43
  text: '',
47
- at: { position, rotation: 0 },
44
+ at: { position: position, rotation: 0 },
48
45
  effects: {
49
- font: { size: constraints_1.DEFAULT_FONT_SIZE },
46
+ font: { size: DEFAULT_FONT_SIZE },
50
47
  hide: true,
51
48
  },
52
49
  },
53
50
  {
54
51
  name: 'Description',
55
- text: `Power symbol creates a global label with name \\"${value}\\"`,
56
- at: { position, rotation: 0 },
52
+ text: "Power symbol creates a global label with name \\\"".concat(value, "\\\""),
53
+ at: { position: position, rotation: 0 },
57
54
  effects: {
58
- font: { size: constraints_1.DEFAULT_FONT_SIZE },
55
+ font: { size: DEFAULT_FONT_SIZE },
59
56
  hide: true,
60
57
  },
61
58
  },
@@ -66,5 +63,4 @@ const gen_sch_vcc = (value, pwr_number, port_id, position) => ({
66
63
  uuid: port_id,
67
64
  },
68
65
  ],
69
- });
70
- exports.gen_sch_vcc = gen_sch_vcc;
66
+ }); };
@@ -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
+ export var gen_pwr_ref = function (pwr_num) { return "#PWR".concat(pwr_num); };
@@ -1,39 +1,150 @@
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;
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
23
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
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;
35
42
  }
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 };
36
55
  }
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);
37
65
  }
38
- return { sheets, module_main_sheet, modules };
66
+ catch (error) { e = { error: error }; }
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
+ });
39
150
  }
@@ -1,8 +1,5 @@
1
- "use strict";
2
1
  // millimeters
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 = {
2
+ export var PAPER_SIZE = {
6
3
  A0: { width: 841, height: 1189 },
7
4
  A1: { width: 594, height: 841 },
8
5
  A2: { width: 420, height: 594 },
@@ -13,8 +10,8 @@ exports.PAPER_SIZE = {
13
10
  A7: { width: 74, height: 105 },
14
11
  A8: { width: 52, height: 74 },
15
12
  };
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';
13
+ export var DEFAULT_PAPER_SIZE = PAPER_SIZE.A4;
14
+ export var GENERATOR_NAME = 'modular_circuit';
15
+ export var SCH_VERSION = 20231120;
16
+ export var PAPER = 'A4';
17
+ export var GENERATOR_VERSION = '8.0';
@@ -1,12 +1,38 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.filterNullOrUndefined = filterNullOrUndefined;
4
- function filterNullOrUndefined(originalMethod, _context) {
5
- function replacementMethod(...args) {
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
+ 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
+ }
6
32
  if (args.length === 0 || (args.length === 1 && (args[0] === undefined || args[0] === null)))
7
33
  return '';
8
34
  // @ts-ignore
9
- const result = originalMethod.call(this, ...args);
35
+ var result = originalMethod.call.apply(originalMethod, __spreadArray([this], __read(args), false));
10
36
  return result;
11
37
  }
12
38
  return replacementMethod;
@@ -1,20 +1,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
+ export * from './collect_sub_sheets';
2
+ export * from './constraints';
3
+ export * from './filter_null_undefined';
4
+ export * from './string_formatter';
@@ -1,33 +1,35 @@
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) {
1
+ export var tab = '\t';
2
+ var StringFormatter = /** @class */ (function () {
3
+ function StringFormatter(intend) {
4
+ if (intend === void 0) { intend = 0; }
9
5
  this.intend = intend;
6
+ this.content = '';
10
7
  }
11
- toString() {
8
+ StringFormatter.prototype.toString = function () {
12
9
  return this.content;
13
- }
14
- get intend_level() {
15
- return this.intend;
16
- }
17
- enter_scope() {
10
+ };
11
+ Object.defineProperty(StringFormatter.prototype, "intend_level", {
12
+ get: function () {
13
+ return this.intend;
14
+ },
15
+ enumerable: false,
16
+ configurable: true
17
+ });
18
+ StringFormatter.prototype.enter_scope = function () {
18
19
  this.intend += 1;
19
- }
20
- exit_scope() {
20
+ };
21
+ StringFormatter.prototype.exit_scope = function () {
21
22
  this.intend -= 1;
22
- }
23
- append(str) {
23
+ };
24
+ StringFormatter.prototype.append = function (str) {
24
25
  this.content += str;
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;
26
+ };
27
+ StringFormatter.prototype.append_line = function (str) {
28
+ this.content += "".concat(tab.repeat(this.intend)).concat(str);
29
+ };
30
+ StringFormatter.prototype.append_quote = function (str) {
31
+ this.append("\"".concat(str, "\""));
32
+ };
33
+ return StringFormatter;
34
+ }());
35
+ export { StringFormatter };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modular-circuit/transpiler",
3
- "version": "0.0.61",
3
+ "version": "0.0.64",
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.54",
30
- "@modular-circuit/perc": "0.0.54",
31
- "@modular-circuit/electronics-model": "0.0.46",
32
- "@modular-circuit/utils": "0.0.32"
29
+ "@modular-circuit/ir": "0.0.57",
30
+ "@modular-circuit/electronics-model": "0.0.49",
31
+ "@modular-circuit/perc": "0.0.57",
32
+ "@modular-circuit/utils": "0.0.35"
33
33
  },
34
34
  "scripts": {
35
35
  "clean": "rimraf build",