@modular-circuit/perc 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +15 -8
- package/dist/index.mjs +15 -8
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -273,7 +273,7 @@ interface GRAPH_CONVERTER {
|
|
|
273
273
|
|
|
274
274
|
interface CONNECTION_GRAPH_BUILDER_CTX {
|
|
275
275
|
module_resolver: ModuleResolver;
|
|
276
|
-
dependencies
|
|
276
|
+
dependencies?: Record<string, string>;
|
|
277
277
|
schematics: Record<string, unknown>;
|
|
278
278
|
}
|
|
279
279
|
|
|
@@ -403,7 +403,7 @@ interface SCH_ERC_ITEM extends ERC_ITEM {
|
|
|
403
403
|
aux_item_sheet_path?: GS_SCH_SHEET_PATH;
|
|
404
404
|
}
|
|
405
405
|
|
|
406
|
-
interface ERC_CONTEXT
|
|
406
|
+
interface ERC_CONTEXT {
|
|
407
407
|
erc_setting: ERC_SETTING;
|
|
408
408
|
pp_erc_setting: Record<PP_ERROR, SEVERITY>;
|
|
409
409
|
connection_graph: ConnectionGraph;
|
|
@@ -460,7 +460,7 @@ declare function build_connection_graph(ctx: CONNECTION_GRAPH_BUILDER_CTX): Prom
|
|
|
460
460
|
pin_module_name_table: Record<string, string>;
|
|
461
461
|
}>;
|
|
462
462
|
|
|
463
|
-
type ERC_INPUT = CONNECTION_GRAPH_BUILDER_CTX & ERC_CONTEXT
|
|
463
|
+
type ERC_INPUT = CONNECTION_GRAPH_BUILDER_CTX & Omit<ERC_CONTEXT, 'connection_graph'>;
|
|
464
464
|
declare function graph_ecr(ctx: Omit<ERC_INPUT, 'schematics'> & {
|
|
465
465
|
schematics: Record<string, IR_Graph>;
|
|
466
466
|
}): Promise<{
|
package/dist/index.d.ts
CHANGED
|
@@ -273,7 +273,7 @@ interface GRAPH_CONVERTER {
|
|
|
273
273
|
|
|
274
274
|
interface CONNECTION_GRAPH_BUILDER_CTX {
|
|
275
275
|
module_resolver: ModuleResolver;
|
|
276
|
-
dependencies
|
|
276
|
+
dependencies?: Record<string, string>;
|
|
277
277
|
schematics: Record<string, unknown>;
|
|
278
278
|
}
|
|
279
279
|
|
|
@@ -403,7 +403,7 @@ interface SCH_ERC_ITEM extends ERC_ITEM {
|
|
|
403
403
|
aux_item_sheet_path?: GS_SCH_SHEET_PATH;
|
|
404
404
|
}
|
|
405
405
|
|
|
406
|
-
interface ERC_CONTEXT
|
|
406
|
+
interface ERC_CONTEXT {
|
|
407
407
|
erc_setting: ERC_SETTING;
|
|
408
408
|
pp_erc_setting: Record<PP_ERROR, SEVERITY>;
|
|
409
409
|
connection_graph: ConnectionGraph;
|
|
@@ -460,7 +460,7 @@ declare function build_connection_graph(ctx: CONNECTION_GRAPH_BUILDER_CTX): Prom
|
|
|
460
460
|
pin_module_name_table: Record<string, string>;
|
|
461
461
|
}>;
|
|
462
462
|
|
|
463
|
-
type ERC_INPUT = CONNECTION_GRAPH_BUILDER_CTX & ERC_CONTEXT
|
|
463
|
+
type ERC_INPUT = CONNECTION_GRAPH_BUILDER_CTX & Omit<ERC_CONTEXT, 'connection_graph'>;
|
|
464
464
|
declare function graph_ecr(ctx: Omit<ERC_INPUT, 'schematics'> & {
|
|
465
465
|
schematics: Record<string, IR_Graph>;
|
|
466
466
|
}): Promise<{
|
package/dist/index.js
CHANGED
|
@@ -1574,6 +1574,7 @@ var ERC_TESTER = class {
|
|
|
1574
1574
|
// src/tester/graph/ir_graph_converter.ts
|
|
1575
1575
|
var import_electronics_model8 = require("@modular-circuit/electronics-model");
|
|
1576
1576
|
var import_electronics_model9 = require("@modular-circuit/electronics-model");
|
|
1577
|
+
var import_ir = require("@modular-circuit/ir");
|
|
1577
1578
|
var import_utils = require("@modular-circuit/utils");
|
|
1578
1579
|
var IR_GRAPH_CONVERTER = class {
|
|
1579
1580
|
constructor(circuits) {
|
|
@@ -1597,7 +1598,7 @@ var IR_GRAPH_CONVERTER = class {
|
|
|
1597
1598
|
for (const [sch_name, design] of Object.entries(designs)) {
|
|
1598
1599
|
this.schematics[sch_name] = { uuid: design.uuid ?? (0, import_utils.gen_uuid)(), sheets: [], powers: [] };
|
|
1599
1600
|
for (const block of design.blocks ?? []) {
|
|
1600
|
-
const circuit = this.circuits[(0, import_utils.fmt_module_name)(block.type)];
|
|
1601
|
+
const circuit = this.circuits[(0, import_ir.block_is_associated_with_concrete_module)(block.type) ? block.type : (0, import_utils.fmt_module_name)(block.type)];
|
|
1601
1602
|
this.schematics[sch_name].sheets.push({
|
|
1602
1603
|
uuid: block.uuid,
|
|
1603
1604
|
sheet_name: design.name ?? circuit.name,
|
|
@@ -1615,7 +1616,7 @@ var IR_GRAPH_CONVERTER = class {
|
|
|
1615
1616
|
param,
|
|
1616
1617
|
label_shapes: (0, import_utils.get_port_labels)(param, circuit)
|
|
1617
1618
|
};
|
|
1618
|
-
this.reporter_context.pin_module_name_table[port.uuid] =
|
|
1619
|
+
this.reporter_context.pin_module_name_table[port.uuid] = circuit.name;
|
|
1619
1620
|
this.reporter_context.pin_name_table[port.uuid] = port.name;
|
|
1620
1621
|
}
|
|
1621
1622
|
}
|
|
@@ -1708,18 +1709,24 @@ var import_electronics_model10 = require("@modular-circuit/electronics-model");
|
|
|
1708
1709
|
var import_utils3 = require("@modular-circuit/utils");
|
|
1709
1710
|
|
|
1710
1711
|
// src/utils/get_dependent_modules_definition.ts
|
|
1712
|
+
var import_ir2 = require("@modular-circuit/ir");
|
|
1711
1713
|
var import_utils2 = require("@modular-circuit/utils");
|
|
1712
1714
|
async function get_dependent_modules_definition(ctx) {
|
|
1713
1715
|
const circuits = {};
|
|
1714
1716
|
for (const [, v] of Object.entries(ctx.schematics)) {
|
|
1715
1717
|
for (const block of v.blocks ?? []) {
|
|
1716
|
-
const module_name = (0, import_utils2.fmt_module_name)(block.type);
|
|
1717
|
-
|
|
1718
|
-
if (
|
|
1719
|
-
|
|
1720
|
-
|
|
1718
|
+
const module_name = (0, import_ir2.block_is_associated_with_concrete_module)(block.type) ? block.type : (0, import_utils2.fmt_module_name)(block.type);
|
|
1719
|
+
let def;
|
|
1720
|
+
if ((0, import_ir2.block_is_associated_with_concrete_module)(block.type)) {
|
|
1721
|
+
def = await ctx.module_resolver.get_module_circuit_by_id(block.type);
|
|
1722
|
+
} else if (ctx.dependencies) {
|
|
1723
|
+
const version = ctx.dependencies[module_name];
|
|
1724
|
+
if (version === void 0) {
|
|
1725
|
+
console.warn(`Module ${module_name} not found in dependencies`);
|
|
1726
|
+
continue;
|
|
1727
|
+
}
|
|
1728
|
+
def = await ctx.module_resolver.get_module_circuit({ ...block.type, version });
|
|
1721
1729
|
}
|
|
1722
|
-
const def = await ctx.module_resolver.get_module_circuit({ ...block.type, version });
|
|
1723
1730
|
if (def) circuits[module_name] = def;
|
|
1724
1731
|
}
|
|
1725
1732
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1535,6 +1535,7 @@ import {
|
|
|
1535
1535
|
import {
|
|
1536
1536
|
PowerShape
|
|
1537
1537
|
} from "@modular-circuit/electronics-model";
|
|
1538
|
+
import { block_is_associated_with_concrete_module } from "@modular-circuit/ir";
|
|
1538
1539
|
import { deep_copy, fmt_module_name, gen_uuid, get_circuit_ports, get_port_labels } from "@modular-circuit/utils";
|
|
1539
1540
|
var IR_GRAPH_CONVERTER = class {
|
|
1540
1541
|
constructor(circuits) {
|
|
@@ -1558,7 +1559,7 @@ var IR_GRAPH_CONVERTER = class {
|
|
|
1558
1559
|
for (const [sch_name, design] of Object.entries(designs)) {
|
|
1559
1560
|
this.schematics[sch_name] = { uuid: design.uuid ?? gen_uuid(), sheets: [], powers: [] };
|
|
1560
1561
|
for (const block of design.blocks ?? []) {
|
|
1561
|
-
const circuit = this.circuits[fmt_module_name(block.type)];
|
|
1562
|
+
const circuit = this.circuits[block_is_associated_with_concrete_module(block.type) ? block.type : fmt_module_name(block.type)];
|
|
1562
1563
|
this.schematics[sch_name].sheets.push({
|
|
1563
1564
|
uuid: block.uuid,
|
|
1564
1565
|
sheet_name: design.name ?? circuit.name,
|
|
@@ -1576,7 +1577,7 @@ var IR_GRAPH_CONVERTER = class {
|
|
|
1576
1577
|
param,
|
|
1577
1578
|
label_shapes: get_port_labels(param, circuit)
|
|
1578
1579
|
};
|
|
1579
|
-
this.reporter_context.pin_module_name_table[port.uuid] =
|
|
1580
|
+
this.reporter_context.pin_module_name_table[port.uuid] = circuit.name;
|
|
1580
1581
|
this.reporter_context.pin_name_table[port.uuid] = port.name;
|
|
1581
1582
|
}
|
|
1582
1583
|
}
|
|
@@ -1673,18 +1674,24 @@ import {
|
|
|
1673
1674
|
import { test_connected_components } from "@modular-circuit/utils";
|
|
1674
1675
|
|
|
1675
1676
|
// src/utils/get_dependent_modules_definition.ts
|
|
1677
|
+
import { block_is_associated_with_concrete_module as block_is_associated_with_concrete_module2 } from "@modular-circuit/ir";
|
|
1676
1678
|
import { fmt_module_name as fmt_module_name2 } from "@modular-circuit/utils";
|
|
1677
1679
|
async function get_dependent_modules_definition(ctx) {
|
|
1678
1680
|
const circuits = {};
|
|
1679
1681
|
for (const [, v] of Object.entries(ctx.schematics)) {
|
|
1680
1682
|
for (const block of v.blocks ?? []) {
|
|
1681
|
-
const module_name = fmt_module_name2(block.type);
|
|
1682
|
-
|
|
1683
|
-
if (
|
|
1684
|
-
|
|
1685
|
-
|
|
1683
|
+
const module_name = block_is_associated_with_concrete_module2(block.type) ? block.type : fmt_module_name2(block.type);
|
|
1684
|
+
let def;
|
|
1685
|
+
if (block_is_associated_with_concrete_module2(block.type)) {
|
|
1686
|
+
def = await ctx.module_resolver.get_module_circuit_by_id(block.type);
|
|
1687
|
+
} else if (ctx.dependencies) {
|
|
1688
|
+
const version = ctx.dependencies[module_name];
|
|
1689
|
+
if (version === void 0) {
|
|
1690
|
+
console.warn(`Module ${module_name} not found in dependencies`);
|
|
1691
|
+
continue;
|
|
1692
|
+
}
|
|
1693
|
+
def = await ctx.module_resolver.get_module_circuit({ ...block.type, version });
|
|
1686
1694
|
}
|
|
1687
|
-
const def = await ctx.module_resolver.get_module_circuit({ ...block.type, version });
|
|
1688
1695
|
if (def) circuits[module_name] = def;
|
|
1689
1696
|
}
|
|
1690
1697
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modular-circuit/perc",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Programmable Electronic Circuit Check",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@modular-circuit/electronics-model": "0.1.0",
|
|
31
|
-
"@modular-circuit/
|
|
32
|
-
"@modular-circuit/
|
|
31
|
+
"@modular-circuit/utils": "0.1.0",
|
|
32
|
+
"@modular-circuit/ir": "0.1.1"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"clean": "rimraf dist",
|