@modular-circuit/transpiler 0.0.109 → 0.1.0

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 (162) hide show
  1. package/dist/index.d.mts +479 -0
  2. package/dist/index.d.ts +479 -0
  3. package/dist/index.js +3031 -0
  4. package/dist/index.mjs +2927 -0
  5. package/package.json +15 -12
  6. package/build/builder/graph_to_kicad/do_convert_graph_to_kicad_project.d.ts +0 -3
  7. package/build/builder/graph_to_kicad/do_convert_graph_to_kicad_project.d.ts.map +0 -1
  8. package/build/builder/graph_to_kicad/do_convert_graph_to_kicad_project.js +0 -115
  9. package/build/builder/graph_to_kicad/index.d.ts +0 -3
  10. package/build/builder/graph_to_kicad/index.d.ts.map +0 -1
  11. package/build/builder/graph_to_kicad/index.js +0 -63
  12. package/build/builder/index.d.ts +0 -2
  13. package/build/builder/index.d.ts.map +0 -1
  14. package/build/builder/index.js +0 -1
  15. package/build/converter/graph_to_netlist/context.d.ts +0 -13
  16. package/build/converter/graph_to_netlist/context.d.ts.map +0 -1
  17. package/build/converter/graph_to_netlist/context.js +0 -0
  18. package/build/converter/graph_to_netlist/graph_converter.d.ts +0 -8
  19. package/build/converter/graph_to_netlist/graph_converter.d.ts.map +0 -1
  20. package/build/converter/graph_to_netlist/graph_converter.js +0 -192
  21. package/build/converter/graph_to_netlist/index.d.ts +0 -3
  22. package/build/converter/graph_to_netlist/index.d.ts.map +0 -1
  23. package/build/converter/graph_to_netlist/index.js +0 -2
  24. package/build/converter/index.d.ts +0 -4
  25. package/build/converter/index.d.ts.map +0 -1
  26. package/build/converter/index.js +0 -3
  27. package/build/converter/kicad_sexpr/eeschema/drawing_sheet/index.d.ts +0 -2
  28. package/build/converter/kicad_sexpr/eeschema/drawing_sheet/index.d.ts.map +0 -1
  29. package/build/converter/kicad_sexpr/eeschema/drawing_sheet/index.js +0 -5
  30. package/build/converter/kicad_sexpr/eeschema/drawing_sheet/sch_default_drawing_sheet.d.ts +0 -2
  31. package/build/converter/kicad_sexpr/eeschema/drawing_sheet/sch_default_drawing_sheet.d.ts.map +0 -1
  32. package/build/converter/kicad_sexpr/eeschema/drawing_sheet/sch_default_drawing_sheet.js +0 -1
  33. package/build/converter/kicad_sexpr/eeschema/index.d.ts +0 -3
  34. package/build/converter/kicad_sexpr/eeschema/index.d.ts.map +0 -1
  35. package/build/converter/kicad_sexpr/eeschema/index.js +0 -2
  36. package/build/converter/kicad_sexpr/eeschema/printer.d.ts +0 -38
  37. package/build/converter/kicad_sexpr/eeschema/printer.d.ts.map +0 -1
  38. package/build/converter/kicad_sexpr/eeschema/printer.js +0 -296
  39. package/build/converter/kicad_sexpr/index.d.ts +0 -3
  40. package/build/converter/kicad_sexpr/index.d.ts.map +0 -1
  41. package/build/converter/kicad_sexpr/index.js +0 -2
  42. package/build/converter/kicad_sexpr/pcb/index.d.ts +0 -2
  43. package/build/converter/kicad_sexpr/pcb/index.d.ts.map +0 -1
  44. package/build/converter/kicad_sexpr/pcb/index.js +0 -1
  45. package/build/converter/link_to_netlist/context.d.ts +0 -12
  46. package/build/converter/link_to_netlist/context.d.ts.map +0 -1
  47. package/build/converter/link_to_netlist/context.js +0 -0
  48. package/build/converter/link_to_netlist/converter.d.ts +0 -13
  49. package/build/converter/link_to_netlist/converter.d.ts.map +0 -1
  50. package/build/converter/link_to_netlist/converter.js +0 -154
  51. package/build/converter/link_to_netlist/index.d.ts +0 -3
  52. package/build/converter/link_to_netlist/index.d.ts.map +0 -1
  53. package/build/converter/link_to_netlist/index.js +0 -2
  54. package/build/converter/link_to_netlist/links/converter_base.d.ts +0 -30
  55. package/build/converter/link_to_netlist/links/converter_base.d.ts.map +0 -1
  56. package/build/converter/link_to_netlist/links/converter_base.js +0 -156
  57. package/build/converter/link_to_netlist/links/converters.d.ts +0 -51
  58. package/build/converter/link_to_netlist/links/converters.d.ts.map +0 -1
  59. package/build/converter/link_to_netlist/links/converters.js +0 -1190
  60. package/build/converter/link_to_netlist/links/index.d.ts +0 -3
  61. package/build/converter/link_to_netlist/links/index.d.ts.map +0 -1
  62. package/build/converter/link_to_netlist/links/index.js +0 -2
  63. package/build/converter/netlist_to_kicad/context.d.ts +0 -10
  64. package/build/converter/netlist_to_kicad/context.d.ts.map +0 -1
  65. package/build/converter/netlist_to_kicad/context.js +0 -0
  66. package/build/converter/netlist_to_kicad/index.d.ts +0 -4
  67. package/build/converter/netlist_to_kicad/index.d.ts.map +0 -1
  68. package/build/converter/netlist_to_kicad/index.js +0 -3
  69. package/build/converter/netlist_to_kicad/layout.d.ts +0 -38
  70. package/build/converter/netlist_to_kicad/layout.d.ts.map +0 -1
  71. package/build/converter/netlist_to_kicad/layout.js +0 -194
  72. package/build/converter/netlist_to_kicad/netlist_converter.d.ts +0 -28
  73. package/build/converter/netlist_to_kicad/netlist_converter.d.ts.map +0 -1
  74. package/build/converter/netlist_to_kicad/netlist_converter.js +0 -398
  75. package/build/converter/netlist_to_kicad/place_blocks.d.ts +0 -6
  76. package/build/converter/netlist_to_kicad/place_blocks.d.ts.map +0 -1
  77. package/build/converter/netlist_to_kicad/place_blocks.js +0 -59
  78. package/build/index.d.ts +0 -6
  79. package/build/index.d.ts.map +0 -1
  80. package/build/index.js +0 -5
  81. package/build/kicad/constraints/index.d.ts +0 -5
  82. package/build/kicad/constraints/index.d.ts.map +0 -1
  83. package/build/kicad/constraints/index.js +0 -4
  84. package/build/kicad/index.d.ts +0 -1
  85. package/build/kicad/index.d.ts.map +0 -1
  86. package/build/kicad/index.js +0 -1
  87. package/build/kicad/label/index.d.ts +0 -3
  88. package/build/kicad/label/index.d.ts.map +0 -1
  89. package/build/kicad/label/index.js +0 -2
  90. package/build/kicad/label/net_label.d.ts +0 -4
  91. package/build/kicad/label/net_label.d.ts.map +0 -1
  92. package/build/kicad/label/net_label.js +0 -14
  93. package/build/kicad/label/sheet_pin.d.ts +0 -5
  94. package/build/kicad/label/sheet_pin.d.ts.map +0 -1
  95. package/build/kicad/label/sheet_pin.js +0 -25
  96. package/build/kicad/project/index.d.ts +0 -3
  97. package/build/kicad/project/index.d.ts.map +0 -1
  98. package/build/kicad/project/index.js +0 -2
  99. package/build/kicad/project/kicad_prl.d.ts +0 -48
  100. package/build/kicad/project/kicad_prl.d.ts.map +0 -1
  101. package/build/kicad/project/kicad_prl.js +0 -50
  102. package/build/kicad/project/kicad_pro.d.ts +0 -176
  103. package/build/kicad/project/kicad_pro.d.ts.map +0 -1
  104. package/build/kicad/project/kicad_pro.js +0 -224
  105. package/build/kicad/project/kicad_project_archive.d.ts +0 -237
  106. package/build/kicad/project/kicad_project_archive.d.ts.map +0 -1
  107. package/build/kicad/project/kicad_project_archive.js +0 -53
  108. package/build/kicad/project/wildcards_and_files_ext.d.ts +0 -62
  109. package/build/kicad/project/wildcards_and_files_ext.d.ts.map +0 -1
  110. package/build/kicad/project/wildcards_and_files_ext.js +0 -61
  111. package/build/kicad/sheet/index.d.ts +0 -2
  112. package/build/kicad/sheet/index.d.ts.map +0 -1
  113. package/build/kicad/sheet/index.js +0 -1
  114. package/build/kicad/sheet/sheet.d.ts +0 -8
  115. package/build/kicad/sheet/sheet.d.ts.map +0 -1
  116. package/build/kicad/sheet/sheet.js +0 -44
  117. package/build/kicad/symbols/index.d.ts +0 -3
  118. package/build/kicad/symbols/index.d.ts.map +0 -1
  119. package/build/kicad/symbols/index.js +0 -2
  120. package/build/kicad/symbols/lib_symbol/gnd.d.ts +0 -3
  121. package/build/kicad/symbols/lib_symbol/gnd.d.ts.map +0 -1
  122. package/build/kicad/symbols/lib_symbol/gnd.js +0 -121
  123. package/build/kicad/symbols/lib_symbol/index.d.ts +0 -3
  124. package/build/kicad/symbols/lib_symbol/index.d.ts.map +0 -1
  125. package/build/kicad/symbols/lib_symbol/index.js +0 -2
  126. package/build/kicad/symbols/lib_symbol/vcc.d.ts +0 -3
  127. package/build/kicad/symbols/lib_symbol/vcc.d.ts.map +0 -1
  128. package/build/kicad/symbols/lib_symbol/vcc.js +0 -119
  129. package/build/kicad/symbols/sch_symbol/gnd.d.ts +0 -4
  130. package/build/kicad/symbols/sch_symbol/gnd.d.ts.map +0 -1
  131. package/build/kicad/symbols/sch_symbol/gnd.js +0 -66
  132. package/build/kicad/symbols/sch_symbol/index.d.ts +0 -3
  133. package/build/kicad/symbols/sch_symbol/index.d.ts.map +0 -1
  134. package/build/kicad/symbols/sch_symbol/index.js +0 -2
  135. package/build/kicad/symbols/sch_symbol/vcc.d.ts +0 -4
  136. package/build/kicad/symbols/sch_symbol/vcc.d.ts.map +0 -1
  137. package/build/kicad/symbols/sch_symbol/vcc.js +0 -66
  138. package/build/kicad/symbols/symbol_utils.d.ts +0 -2
  139. package/build/kicad/symbols/symbol_utils.d.ts.map +0 -1
  140. package/build/kicad/symbols/symbol_utils.js +0 -1
  141. package/build/kicad/wire/gen_wire.d.ts +0 -4
  142. package/build/kicad/wire/gen_wire.d.ts.map +0 -1
  143. package/build/kicad/wire/gen_wire.js +0 -12
  144. package/build/tsconfig.build.tsbuildinfo +0 -1
  145. package/build/utils/collect_sub_sheets.d.ts +0 -7
  146. package/build/utils/collect_sub_sheets.d.ts.map +0 -1
  147. package/build/utils/collect_sub_sheets.js +0 -156
  148. package/build/utils/collect_sub_sheets_by_id.d.ts +0 -7
  149. package/build/utils/collect_sub_sheets_by_id.d.ts.map +0 -1
  150. package/build/utils/collect_sub_sheets_by_id.js +0 -150
  151. package/build/utils/constraints.d.ts +0 -11
  152. package/build/utils/constraints.d.ts.map +0 -1
  153. package/build/utils/constraints.js +0 -17
  154. package/build/utils/filter_null_undefined.d.ts +0 -2
  155. package/build/utils/filter_null_undefined.d.ts.map +0 -1
  156. package/build/utils/filter_null_undefined.js +0 -39
  157. package/build/utils/index.d.ts +0 -6
  158. package/build/utils/index.d.ts.map +0 -1
  159. package/build/utils/index.js +0 -5
  160. package/build/utils/string_formatter.d.ts +0 -14
  161. package/build/utils/string_formatter.d.ts.map +0 -1
  162. package/build/utils/string_formatter.js +0 -35
@@ -1,66 +0,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 },
7
- unit: 1,
8
- exclude_from_sim: false,
9
- in_bom: true,
10
- on_board: true,
11
- dnp: false,
12
- fields_autoplaced: true,
13
- uuid: gen_uuid(),
14
- properties: [
15
- {
16
- name: 'Reference',
17
- text: gen_pwr_ref(pwr_number),
18
- at: { position: { x: position.x, y: position.y + 3.81 }, rotation: 0 },
19
- effects: {
20
- font: { size: DEFAULT_FONT_SIZE },
21
- hide: true,
22
- },
23
- },
24
- {
25
- name: 'Value',
26
- text: "".concat(value),
27
- at: { position: { x: position.x, y: position.y - 5.08 }, rotation: 0 },
28
- effects: {
29
- font: { size: DEFAULT_FONT_SIZE },
30
- },
31
- },
32
- {
33
- name: 'Footprint',
34
- text: '',
35
- at: { position: position, rotation: 0 },
36
- effects: {
37
- font: { size: DEFAULT_FONT_SIZE },
38
- hide: true,
39
- },
40
- },
41
- {
42
- name: 'Datasheet',
43
- text: '',
44
- at: { position: position, rotation: 0 },
45
- effects: {
46
- font: { size: DEFAULT_FONT_SIZE },
47
- hide: true,
48
- },
49
- },
50
- {
51
- name: 'Description',
52
- text: "Power symbol creates a global label with name \\\"".concat(value, "\\\""),
53
- at: { position: position, rotation: 0 },
54
- effects: {
55
- font: { size: DEFAULT_FONT_SIZE },
56
- hide: true,
57
- },
58
- },
59
- ],
60
- pins: [
61
- {
62
- number: '1',
63
- uuid: port_id,
64
- },
65
- ],
66
- }); };
@@ -1,2 +0,0 @@
1
- export declare const gen_pwr_ref: (pwr_num: number) => string;
2
- //# sourceMappingURL=symbol_utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"symbol_utils.d.ts","sourceRoot":"","sources":["../../../src/kicad/symbols/symbol_utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,GAAI,SAAS,MAAM,WAAqB,CAAA"}
@@ -1 +0,0 @@
1
- export var gen_pwr_ref = function (pwr_num) { return "#PWR".concat(pwr_num); };
@@ -1,4 +0,0 @@
1
- import type { VECTOR2 } from '@modular-circuit/electronics-model';
2
- import type { SCH_LINE } from '@modular-circuit/ir';
3
- export declare const gen_wire: (start: VECTOR2, end: VECTOR2) => SCH_LINE;
4
- //# sourceMappingURL=gen_wire.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"gen_wire.d.ts","sourceRoot":"","sources":["../../../src/kicad/wire/gen_wire.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAA;AAEjE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAGnD,eAAO,MAAM,QAAQ,GAAI,OAAO,OAAO,EAAE,KAAK,OAAO,KAAG,QAStD,CAAA"}
@@ -1,12 +0,0 @@
1
- import { GS_SCH_ITEM_TYPE } from '@modular-circuit/electronics-model';
2
- import { gen_uuid } from '@modular-circuit/utils';
3
- export var gen_wire = function (start, end) { return ({
4
- stroke: {
5
- type: 'default',
6
- width: 0,
7
- },
8
- start: start,
9
- end: end,
10
- uuid: gen_uuid(),
11
- type: GS_SCH_ITEM_TYPE.LINE,
12
- }); };
@@ -1 +0,0 @@
1
- {"root":["../src/index.ts","../src/builder/index.ts","../src/builder/graph_to_kicad/do_convert_graph_to_kicad_project.ts","../src/builder/graph_to_kicad/index.ts","../src/converter/index.ts","../src/converter/graph_to_netlist/context.ts","../src/converter/graph_to_netlist/graph_converter.ts","../src/converter/graph_to_netlist/index.ts","../src/converter/kicad_sexpr/index.ts","../src/converter/kicad_sexpr/eeschema/index.ts","../src/converter/kicad_sexpr/eeschema/printer.ts","../src/converter/kicad_sexpr/eeschema/drawing_sheet/index.ts","../src/converter/kicad_sexpr/eeschema/drawing_sheet/sch_default_drawing_sheet.ts","../src/converter/kicad_sexpr/pcb/index.ts","../src/converter/link_to_netlist/context.ts","../src/converter/link_to_netlist/converter.ts","../src/converter/link_to_netlist/index.ts","../src/converter/link_to_netlist/links/converter_base.ts","../src/converter/link_to_netlist/links/converters.ts","../src/converter/link_to_netlist/links/index.ts","../src/converter/netlist_to_kicad/context.ts","../src/converter/netlist_to_kicad/index.ts","../src/converter/netlist_to_kicad/layout.ts","../src/converter/netlist_to_kicad/netlist_converter.ts","../src/converter/netlist_to_kicad/place_blocks.ts","../src/kicad/index.ts","../src/kicad/constraints/index.ts","../src/kicad/label/index.ts","../src/kicad/label/net_label.ts","../src/kicad/label/sheet_pin.ts","../src/kicad/project/index.ts","../src/kicad/project/kicad_prl.ts","../src/kicad/project/kicad_pro.ts","../src/kicad/project/kicad_project_archive.ts","../src/kicad/project/wildcards_and_files_ext.ts","../src/kicad/sheet/index.ts","../src/kicad/sheet/sheet.ts","../src/kicad/symbols/index.ts","../src/kicad/symbols/symbol_utils.ts","../src/kicad/symbols/lib_symbol/gnd.ts","../src/kicad/symbols/lib_symbol/index.ts","../src/kicad/symbols/lib_symbol/vcc.ts","../src/kicad/symbols/sch_symbol/gnd.ts","../src/kicad/symbols/sch_symbol/index.ts","../src/kicad/symbols/sch_symbol/vcc.ts","../src/kicad/wire/gen_wire.ts","../src/utils/collect_sub_sheets.ts","../src/utils/collect_sub_sheets_by_id.ts","../src/utils/constraints.ts","../src/utils/filter_null_undefined.ts","../src/utils/index.ts","../src/utils/string_formatter.ts"],"version":"5.8.3"}
@@ -1,7 +0,0 @@
1
- import type { ModuleCircuit, ModuleResolver } from '@modular-circuit/ir';
2
- export declare function collect_sub_sheets(dependencies: Record<string, string>, module_resolver: ModuleResolver): Promise<{
3
- sheets: Record<string, string>;
4
- module_main_sheet: Record<string, string>;
5
- modules: Record<string, ModuleCircuit>;
6
- }>;
7
- //# sourceMappingURL=collect_sub_sheets.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"collect_sub_sheets.d.ts","sourceRoot":"","sources":["../../src/utils/collect_sub_sheets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAGxE,wBAAsB,kBAAkB,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,eAAe,EAAE,cAAc;;;;GA+C7G"}
@@ -1,156 +0,0 @@
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;
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 };
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);
65
- }
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 { KICAD_SHC_FILE_EXT, 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_archive_url, module_1, zip_archive, 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_archive(__assign(__assign({}, parse_module_name(k)), { version: v }))];
95
- case 3:
96
- zip_archive_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_archive_url || !module_1) {
101
- console.error("Module ".concat(k, "/").concat(v, " not found"));
102
- return [3 /*break*/, 7];
103
- }
104
- if (!module_1.main) {
105
- console.error("Missing main entry in module ".concat(k, "/").concat(v));
106
- return [3 /*break*/, 7];
107
- }
108
- module_main_sheet[k] = module_1.main;
109
- modules[k] = module_1;
110
- return [4 /*yield*/, fetch(zip_archive_url).then(function (res) { return res.arrayBuffer(); })];
111
- case 5:
112
- zip_archive = _j.sent();
113
- return [4 /*yield*/, unzipFile(zip_archive)];
114
- case 6:
115
- files = _j.sent();
116
- try {
117
- for (_d = (e_2 = void 0, __values(Object.entries(files))), _e = _d.next(); !_e.done; _e = _d.next()) {
118
- _f = __read(_e.value, 2), name = _f[0], content = _f[1];
119
- if (name.endsWith(KICAD_SHC_FILE_EXT)) {
120
- fileName = remove_filename_path_prefix(name);
121
- // FIXME : Should auto rename the sheets and remapping them
122
- if (fileName in sheets) {
123
- console.error("Duplicate sheet name: ".concat(fileName));
124
- continue;
125
- }
126
- sheets[fileName] = content;
127
- }
128
- }
129
- }
130
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
131
- finally {
132
- try {
133
- if (_e && !_e.done && (_h = _d.return)) _h.call(_d);
134
- }
135
- finally { if (e_2) throw e_2.error; }
136
- }
137
- _j.label = 7;
138
- case 7:
139
- _b = _a.next();
140
- return [3 /*break*/, 2];
141
- case 8: return [3 /*break*/, 11];
142
- case 9:
143
- e_1_1 = _j.sent();
144
- e_1 = { error: e_1_1 };
145
- return [3 /*break*/, 11];
146
- case 10:
147
- try {
148
- if (_b && !_b.done && (_g = _a.return)) _g.call(_a);
149
- }
150
- finally { if (e_1) throw e_1.error; }
151
- return [7 /*endfinally*/];
152
- case 11: return [2 /*return*/, { sheets: sheets, module_main_sheet: module_main_sheet, modules: modules }];
153
- }
154
- });
155
- });
156
- }
@@ -1,7 +0,0 @@
1
- import type { ModuleCircuit, ModuleResolver } from '@modular-circuit/ir';
2
- export declare function collect_sub_sheets_by_id(module_ids: string[], module_resolver: ModuleResolver): Promise<{
3
- sheets: Record<string, string>;
4
- module_main_sheet: Record<string, string>;
5
- modules: Record<string, ModuleCircuit>;
6
- }>;
7
- //# sourceMappingURL=collect_sub_sheets_by_id.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"collect_sub_sheets_by_id.d.ts","sourceRoot":"","sources":["../../src/utils/collect_sub_sheets_by_id.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AASxE,wBAAsB,wBAAwB,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,eAAe,EAAE,cAAc;;;;GA+CnG"}
@@ -1,150 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- var __generator = (this && this.__generator) || function (thisArg, body) {
11
- 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);
12
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
- function verb(n) { return function (v) { return step([n, v]); }; }
14
- function step(op) {
15
- if (f) throw new TypeError("Generator is already executing.");
16
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
- 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;
18
- if (y = 0, t) op = [op[0] & 2, t.value];
19
- switch (op[0]) {
20
- case 0: case 1: t = op; break;
21
- case 4: _.label++; return { value: op[1], done: false };
22
- case 5: _.label++; y = op[1]; op = [0]; continue;
23
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
- default:
25
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
- if (t[2]) _.ops.pop();
30
- _.trys.pop(); continue;
31
- }
32
- op = body.call(thisArg, _);
33
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
- }
36
- };
37
- var __values = (this && this.__values) || function(o) {
38
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
39
- if (m) return m.call(o);
40
- if (o && typeof o.length === "number") return {
41
- next: function () {
42
- if (o && i >= o.length) o = void 0;
43
- return { value: o && o[i++], done: !o };
44
- }
45
- };
46
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
47
- };
48
- var __read = (this && this.__read) || function (o, n) {
49
- var m = typeof Symbol === "function" && o[Symbol.iterator];
50
- if (!m) return o;
51
- var i = m.call(o), r, ar = [], e;
52
- try {
53
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
54
- }
55
- catch (error) { e = { error: error }; }
56
- finally {
57
- try {
58
- if (r && !r.done && (m = i["return"])) m.call(i);
59
- }
60
- finally { if (e) throw e.error; }
61
- }
62
- return ar;
63
- };
64
- import { fmt_module_name, KICAD_SHC_FILE_EXT, parse_module_name, remove_filename_path_prefix, unzipFile, } from '@modular-circuit/utils';
65
- export function collect_sub_sheets_by_id(module_ids, module_resolver) {
66
- return __awaiter(this, void 0, void 0, function () {
67
- var sheets, module_main_sheet, modules, module_ids_1, module_ids_1_1, id, zip_archive_url, module_circuit, k, zip_archive, files, _a, _b, _c, name, content, fileName, e_1_1;
68
- var e_1, _d, e_2, _e;
69
- return __generator(this, function (_f) {
70
- switch (_f.label) {
71
- case 0:
72
- sheets = {};
73
- module_main_sheet = {};
74
- modules = {};
75
- _f.label = 1;
76
- case 1:
77
- _f.trys.push([1, 9, 10, 11]);
78
- module_ids_1 = __values(module_ids), module_ids_1_1 = module_ids_1.next();
79
- _f.label = 2;
80
- case 2:
81
- if (!!module_ids_1_1.done) return [3 /*break*/, 8];
82
- id = module_ids_1_1.value;
83
- return [4 /*yield*/, module_resolver.get_module_archive_by_id(id)];
84
- case 3:
85
- zip_archive_url = _f.sent();
86
- return [4 /*yield*/, module_resolver.get_module_circuit_by_id(id)];
87
- case 4:
88
- module_circuit = _f.sent();
89
- if (!module_circuit) {
90
- console.error("Module ".concat(id, " not found"));
91
- return [3 /*break*/, 7];
92
- }
93
- if (!zip_archive_url || !module_circuit) {
94
- console.error("Module ".concat(module_circuit.author, "/").concat(module_circuit.name, " not found"));
95
- return [3 /*break*/, 7];
96
- }
97
- if (!module_circuit.main) {
98
- console.error("Missing main entry in module".concat(module_circuit.author, "/").concat(module_circuit.name));
99
- return [3 /*break*/, 7];
100
- }
101
- k = fmt_module_name(module_circuit);
102
- module_main_sheet[k] = module_circuit.main;
103
- modules[k] = module_circuit;
104
- return [4 /*yield*/, fetch(zip_archive_url).then(function (res) { return res.arrayBuffer(); })];
105
- case 5:
106
- zip_archive = _f.sent();
107
- return [4 /*yield*/, unzipFile(zip_archive)];
108
- case 6:
109
- files = _f.sent();
110
- try {
111
- for (_a = (e_2 = void 0, __values(Object.entries(files))), _b = _a.next(); !_b.done; _b = _a.next()) {
112
- _c = __read(_b.value, 2), name = _c[0], content = _c[1];
113
- if (name.endsWith(KICAD_SHC_FILE_EXT)) {
114
- fileName = remove_filename_path_prefix(name);
115
- // FIXME : Should auto rename the sheets and remapping them
116
- if (fileName in sheets) {
117
- console.error("Duplicate sheet name: ".concat(fileName));
118
- continue;
119
- }
120
- sheets[fileName] = content;
121
- }
122
- }
123
- }
124
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
125
- finally {
126
- try {
127
- if (_b && !_b.done && (_e = _a.return)) _e.call(_a);
128
- }
129
- finally { if (e_2) throw e_2.error; }
130
- }
131
- _f.label = 7;
132
- case 7:
133
- module_ids_1_1 = module_ids_1.next();
134
- return [3 /*break*/, 2];
135
- case 8: return [3 /*break*/, 11];
136
- case 9:
137
- e_1_1 = _f.sent();
138
- e_1 = { error: e_1_1 };
139
- return [3 /*break*/, 11];
140
- case 10:
141
- try {
142
- if (module_ids_1_1 && !module_ids_1_1.done && (_d = module_ids_1.return)) _d.call(module_ids_1);
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
- });
150
- }
@@ -1,11 +0,0 @@
1
- export interface Size {
2
- height: number;
3
- width: number;
4
- }
5
- export declare const PAPER_SIZE: Record<string, Size>;
6
- export declare const DEFAULT_PAPER_SIZE: Size;
7
- export declare const GENERATOR_NAME = "modular_circuit";
8
- export declare const SCH_VERSION = 20231120;
9
- export declare const PAPER = "A4";
10
- export declare const GENERATOR_VERSION = "8.0";
11
- //# sourceMappingURL=constraints.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constraints.d.ts","sourceRoot":"","sources":["../../src/utils/constraints.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,IAAI;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;CACd;AAED,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAU3C,CAAA;AAED,eAAO,MAAM,kBAAkB,MAAgB,CAAA;AAE/C,eAAO,MAAM,cAAc,oBAAoB,CAAA;AAE/C,eAAO,MAAM,WAAW,WAAW,CAAA;AAEnC,eAAO,MAAM,KAAK,OAAO,CAAA;AAEzB,eAAO,MAAM,iBAAiB,QAAQ,CAAA"}
@@ -1,17 +0,0 @@
1
- // millimeters
2
- export var PAPER_SIZE = {
3
- A0: { width: 841, height: 1189 },
4
- A1: { width: 594, height: 841 },
5
- A2: { width: 420, height: 594 },
6
- A3: { width: 297, height: 420 },
7
- A4: { width: 210, height: 297 },
8
- A5: { width: 148, height: 210 },
9
- A6: { width: 105, height: 148 },
10
- A7: { width: 74, height: 105 },
11
- A8: { width: 52, height: 74 },
12
- };
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,2 +0,0 @@
1
- export declare function filterNullOrUndefined(originalMethod: unknown, _context: ClassMethodDecoratorContext): (this: unknown, ...args: unknown[]) => any;
2
- //# sourceMappingURL=filter_null_undefined.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"filter_null_undefined.d.ts","sourceRoot":"","sources":["../../src/utils/filter_null_undefined.ts"],"names":[],"mappings":"AAAA,wBAAgB,qBAAqB,CAAC,cAAc,EAAE,OAAO,EAAE,QAAQ,EAAE,2BAA2B,UACjE,OAAO,WAAW,OAAO,EAAE,SAQ7D"}
@@ -1,39 +0,0 @@
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
- }
32
- if (args.length === 0 || (args.length === 1 && (args[0] === undefined || args[0] === null)))
33
- return '';
34
- // @ts-ignore
35
- var result = originalMethod.call.apply(originalMethod, __spreadArray([this], __read(args), false));
36
- return result;
37
- }
38
- return replacementMethod;
39
- }
@@ -1,6 +0,0 @@
1
- export * from './collect_sub_sheets';
2
- export * from './constraints';
3
- export * from './filter_null_undefined';
4
- export * from './string_formatter';
5
- export * from './collect_sub_sheets_by_id';
6
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,eAAe,CAAA;AAC7B,cAAc,yBAAyB,CAAA;AACvC,cAAc,oBAAoB,CAAA;AAClC,cAAc,4BAA4B,CAAA"}
@@ -1,5 +0,0 @@
1
- export * from './collect_sub_sheets';
2
- export * from './constraints';
3
- export * from './filter_null_undefined';
4
- export * from './string_formatter';
5
- export * from './collect_sub_sheets_by_id';
@@ -1,14 +0,0 @@
1
- export declare const tab = "\t";
2
- export declare class StringFormatter {
3
- private intend;
4
- private content;
5
- constructor(intend?: number);
6
- toString(): string;
7
- get intend_level(): number;
8
- enter_scope(): void;
9
- exit_scope(): void;
10
- append(str: string): void;
11
- append_line(str: string): void;
12
- append_quote(str: string): void;
13
- }
14
- //# sourceMappingURL=string_formatter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"string_formatter.d.ts","sourceRoot":"","sources":["../../src/utils/string_formatter.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,GAAG,OAAO,CAAA;AAEvB,qBAAa,eAAe;IAEP,OAAO,CAAC,MAAM;IADjC,OAAO,CAAC,OAAO,CAAK;gBACO,MAAM,SAAI;IAE9B,QAAQ;IAIf,IAAW,YAAY,WAEtB;IAEM,WAAW;IAIX,UAAU;IAIV,MAAM,CAAC,GAAG,EAAE,MAAM;IAIlB,WAAW,CAAC,GAAG,EAAE,MAAM;IAIvB,YAAY,CAAC,GAAG,EAAE,MAAM;CAGhC"}
@@ -1,35 +0,0 @@
1
- export var tab = '\t';
2
- var StringFormatter = /** @class */ (function () {
3
- function StringFormatter(intend) {
4
- if (intend === void 0) { intend = 0; }
5
- this.intend = intend;
6
- this.content = '';
7
- }
8
- StringFormatter.prototype.toString = function () {
9
- return this.content;
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 () {
19
- this.intend += 1;
20
- };
21
- StringFormatter.prototype.exit_scope = function () {
22
- this.intend -= 1;
23
- };
24
- StringFormatter.prototype.append = function (str) {
25
- this.content += str;
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 };