@layerzerolabs/dependency-graph 0.2.106 → 0.2.108

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.
@@ -1,5 +1,4 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
1
+ import { __name } from './VUOMXK5T.js';
3
2
 
4
3
  // src/dependencyNode.ts
5
4
  var DependencyNode = class {
@@ -30,5 +29,5 @@ var withDependencies = /* @__PURE__ */ __name((node, extraDeps) => {
30
29
  }, "withDependencies");
31
30
 
32
31
  export { DependencyNode, withDependencies };
33
- //# sourceMappingURL=WWFEJOTN.js.map
34
- //# sourceMappingURL=WWFEJOTN.js.map
32
+ //# sourceMappingURL=4J3OQXBQ.js.map
33
+ //# sourceMappingURL=4J3OQXBQ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/dependencyNode.ts"],"names":["DependencyNode","name","dependencies","withDependencies","node","extraDeps","mergedDeps","Object","fromEntries","map","dep","i","descriptors","getOwnPropertyDescriptors","value","create","getPrototypeOf"],"mappings":";;;AAUO,IAAeA,iBAAf,MAAeA;EAVtB;;;AAcoBC,EAAAA,IAAAA;AACAC,EAAAA,YAAAA;AAChB,EAAA,WAAA,CAAY,EACRD,IAAAA,EACAC,YAAAA,GAAe,IAAmB,EAInC;AACC,IAAA,IAAA,CAAKD,IAAAA,GAAOA,IAAAA;AACZ,IAAA,IAAA,CAAKC,YAAAA,GAAeA,YAAAA;AACxB,EAAA;AACJ;AAQO,IAAMC,gBAAAA,mBAAmB,MAAA,CAAA,CAI5BC,IAAAA,EACAC,SAAAA,KAAAA;AAEA,EAAA,MAAMC,UAAAA,GAAa;AACf,IAAA,GAAGF,IAAAA,CAAKF,YAAAA;AACR,IAAA,GAAGK,OAAOC,WAAAA,CAAYH,SAAAA,CAAUI,GAAAA,CAAI,CAACC,KAAKC,CAAAA,KAAM;AAAC,MAAA,CAAA,OAAA,EAAUA,CAAAA,CAAAA,CAAAA;AAAKD,MAAAA;KAAI,CAAA;AACxE,GAAA;AACA,EAAA,MAAME,WAAAA,GAAqCL,MAAAA,CAAOM,yBAAAA,CAA0BT,IAAAA,CAAAA;AAC5EQ,EAAAA,WAAAA,CAAYV,YAAAA,GAAe;AAAE,IAAA,GAAGU,WAAAA,CAAYV,YAAAA;IAAcY,KAAAA,EAAOR;AAAW,GAAA;AAC5E,EAAA,OAAOC,OAAOQ,MAAAA,CAAOR,MAAAA,CAAOS,cAAAA,CAAeZ,IAAAA,GAAOQ,WAAAA,CAAAA;AACtD,CAAA,EAdgC,kBAAA","file":"4J3OQXBQ.js","sourcesContent":["/**\n * <!-- anchor:DependencyNode -->\n * Dependency nodes are abstract nodes in the dependency graph. They're used to build the graph,\n * but as an abstract class, lacks the required information to actually be resolved to anything.\n * If you want to implement a new dependency node, see ObjectDefinition or FactoryDefinition\n * @param name the name of this node. It should be unique across the entire graph.\n * @param dependencies a map of other nodes that this node depends on. These children will be resolved first.\n * The key of the dependencies map should be some arbitrary name within the context of *this* node. It does\n * not have to be unique.\n */\nexport abstract class DependencyNode<\n Name extends string = string,\n _Dependencies extends Dependencies = Dependencies,\n> {\n public readonly name: Name;\n public readonly dependencies: _Dependencies;\n constructor({\n name,\n dependencies = {} as _Dependencies,\n }: {\n name: Name;\n dependencies?: _Dependencies;\n }) {\n this.name = name;\n this.dependencies = dependencies;\n }\n}\n\nexport type Dependencies = { [key: string]: DependencyNode<any, any> };\n\ntype IndexedDeps<Extra extends readonly DependencyNode[]> = {\n [K in keyof Extra as K extends `${number}` ? `__extra${K}` : never]: Extra[K];\n};\n\nexport const withDependencies = <\n N extends DependencyNode,\n const Extra extends readonly DependencyNode[],\n>(\n node: N,\n extraDeps: Extra,\n): N & { dependencies: N['dependencies'] & IndexedDeps<Extra> } => {\n const mergedDeps = {\n ...node.dependencies,\n ...Object.fromEntries(extraDeps.map((dep, i) => [`__extra${i}`, dep])),\n };\n const descriptors: PropertyDescriptorMap = Object.getOwnPropertyDescriptors(node);\n descriptors.dependencies = { ...descriptors.dependencies, value: mergedDeps };\n return Object.create(Object.getPrototypeOf(node), descriptors);\n};\n"]}
@@ -0,0 +1,20 @@
1
+ import { __name } from './VUOMXK5T.js';
2
+
3
+ // src/collectNodes.ts
4
+ var collectNodes = /* @__PURE__ */ __name((root) => {
5
+ const nodes = /* @__PURE__ */ new Map();
6
+ const queue = [
7
+ root
8
+ ];
9
+ while (queue.length > 0) {
10
+ const node = queue.shift();
11
+ if (nodes.has(node.name)) continue;
12
+ nodes.set(node.name, node);
13
+ for (const dep of Object.values(node.dependencies)) queue.push(dep);
14
+ }
15
+ return nodes;
16
+ }, "collectNodes");
17
+
18
+ export { collectNodes };
19
+ //# sourceMappingURL=JUZWVO32.js.map
20
+ //# sourceMappingURL=JUZWVO32.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/collectNodes.ts"],"names":["collectNodes","root","nodes","Map","queue","length","node","shift","has","name","set","dep","Object","values","dependencies","push"],"mappings":";;;AAEO,IAAMA,YAAAA,2BAAgBC,IAAAA,KAAAA;AACzB,EAAA,MAAMC,KAAAA,uBAAYC,GAAAA,EAAAA;AAClB,EAAA,MAAMC,KAAAA,GAAQ;AAACH,IAAAA;;AACf,EAAA,OAAOG,KAAAA,CAAMC,SAAS,CAAA,EAAG;AACrB,IAAA,MAAMC,IAAAA,GAAOF,MAAMG,KAAAA,EAAK;AACxB,IAAA,IAAIL,KAAAA,CAAMM,GAAAA,CAAIF,IAAAA,CAAKG,IAAI,CAAA,EAAG;AAC1BP,IAAAA,KAAAA,CAAMQ,GAAAA,CAAIJ,IAAAA,CAAKG,IAAAA,EAAMH,IAAAA,CAAAA;AACrB,IAAA,KAAA,MAAWK,GAAAA,IAAOC,OAAOC,MAAAA,CAAOP,IAAAA,CAAKQ,YAAY,CAAA,EAAGV,KAAAA,CAAMW,KAAKJ,GAAAA,CAAAA;AACnE,EAAA;AACA,EAAA,OAAOT,KAAAA;AACX,CAAA,EAV4B,cAAA","file":"JUZWVO32.js","sourcesContent":["import { type DependencyNode } from './dependencyNode';\n\nexport const collectNodes = (root: DependencyNode): Map<string, DependencyNode> => {\n const nodes = new Map<string, DependencyNode>();\n const queue = [root];\n while (queue.length > 0) {\n const node = queue.shift()!;\n if (nodes.has(node.name)) continue;\n nodes.set(node.name, node);\n for (const dep of Object.values(node.dependencies)) queue.push(dep);\n }\n return nodes;\n};\n"]}
@@ -0,0 +1,6 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ export { __name };
5
+ //# sourceMappingURL=VUOMXK5T.js.map
6
+ //# sourceMappingURL=VUOMXK5T.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"VUOMXK5T.js"}
@@ -0,0 +1,3 @@
1
+ import { type DependencyNode } from './dependencyNode';
2
+ export declare const collectNodes: (root: DependencyNode) => Map<string, DependencyNode>;
3
+ //# sourceMappingURL=collectNodes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collectNodes.d.ts","sourceRoot":"","sources":["../src/collectNodes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,eAAO,MAAM,YAAY,GAAI,MAAM,cAAc,KAAG,GAAG,CAAC,MAAM,EAAE,cAAc,CAU7E,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { collectNodes } from './JUZWVO32.js';
2
+ import './VUOMXK5T.js';
3
+ //# sourceMappingURL=collectNodes.js.map
4
+ //# sourceMappingURL=collectNodes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"collectNodes.js"}
@@ -1,3 +1,4 @@
1
- export { DependencyNode, withDependencies } from './WWFEJOTN.js';
1
+ export { DependencyNode, withDependencies } from './4J3OQXBQ.js';
2
+ import './VUOMXK5T.js';
2
3
  //# sourceMappingURL=dependencyNode.js.map
3
4
  //# sourceMappingURL=dependencyNode.js.map
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
+ export * from './collectNodes';
1
2
  export * from './dependencyNode';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC"}
package/dist/index.js CHANGED
@@ -1,3 +1,5 @@
1
- export { DependencyNode, withDependencies } from './WWFEJOTN.js';
1
+ export { collectNodes } from './JUZWVO32.js';
2
+ export { DependencyNode, withDependencies } from './4J3OQXBQ.js';
3
+ import './VUOMXK5T.js';
2
4
  //# sourceMappingURL=index.js.map
3
5
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@layerzerolabs/dependency-graph",
3
- "version": "0.2.106",
3
+ "version": "0.2.108",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -17,8 +17,8 @@
17
17
  ],
18
18
  "devDependencies": {
19
19
  "tsup": "^8.4.0",
20
- "@layerzerolabs/tsup-configuration": "0.2.106",
21
- "@layerzerolabs/typescript-configuration": "0.2.106"
20
+ "@layerzerolabs/tsup-configuration": "0.2.108",
21
+ "@layerzerolabs/typescript-configuration": "0.2.108"
22
22
  },
23
23
  "publishConfig": {
24
24
  "access": "public",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/dependencyNode.ts"],"names":["DependencyNode","name","dependencies","withDependencies","node","extraDeps","mergedDeps","Object","fromEntries","map","dep","i","descriptors","getOwnPropertyDescriptors","value","create","getPrototypeOf"],"mappings":";;;;AAUO,IAAeA,iBAAf,MAAeA;EAVtB;;;AAcoBC,EAAAA,IAAAA;AACAC,EAAAA,YAAAA;AAChB,EAAA,WAAA,CAAY,EACRD,IAAAA,EACAC,YAAAA,GAAe,IAAmB,EAInC;AACC,IAAA,IAAA,CAAKD,IAAAA,GAAOA,IAAAA;AACZ,IAAA,IAAA,CAAKC,YAAAA,GAAeA,YAAAA;AACxB,EAAA;AACJ;AAQO,IAAMC,gBAAAA,mBAAmB,MAAA,CAAA,CAI5BC,IAAAA,EACAC,SAAAA,KAAAA;AAEA,EAAA,MAAMC,UAAAA,GAAa;AACf,IAAA,GAAGF,IAAAA,CAAKF,YAAAA;AACR,IAAA,GAAGK,OAAOC,WAAAA,CAAYH,SAAAA,CAAUI,GAAAA,CAAI,CAACC,KAAKC,CAAAA,KAAM;AAAC,MAAA,CAAA,OAAA,EAAUA,CAAAA,CAAAA,CAAAA;AAAKD,MAAAA;KAAI,CAAA;AACxE,GAAA;AACA,EAAA,MAAME,WAAAA,GAAqCL,MAAAA,CAAOM,yBAAAA,CAA0BT,IAAAA,CAAAA;AAC5EQ,EAAAA,WAAAA,CAAYV,YAAAA,GAAe;AAAE,IAAA,GAAGU,WAAAA,CAAYV,YAAAA;IAAcY,KAAAA,EAAOR;AAAW,GAAA;AAC5E,EAAA,OAAOC,OAAOQ,MAAAA,CAAOR,MAAAA,CAAOS,cAAAA,CAAeZ,IAAAA,GAAOQ,WAAAA,CAAAA;AACtD,CAAA,EAdgC,kBAAA","file":"WWFEJOTN.js","sourcesContent":["/**\n * <!-- anchor:DependencyNode -->\n * Dependency nodes are abstract nodes in the dependency graph. They're used to build the graph,\n * but as an abstract class, lacks the required information to actually be resolved to anything.\n * If you want to implement a new dependency node, see ObjectDefinition or FactoryDefinition\n * @param name the name of this node. It should be unique across the entire graph.\n * @param dependencies a map of other nodes that this node depends on. These children will be resolved first.\n * The key of the dependencies map should be some arbitrary name within the context of *this* node. It does\n * not have to be unique.\n */\nexport abstract class DependencyNode<\n Name extends string = string,\n _Dependencies extends Dependencies = Dependencies,\n> {\n public readonly name: Name;\n public readonly dependencies: _Dependencies;\n constructor({\n name,\n dependencies = {} as _Dependencies,\n }: {\n name: Name;\n dependencies?: _Dependencies;\n }) {\n this.name = name;\n this.dependencies = dependencies;\n }\n}\n\nexport type Dependencies = { [key: string]: DependencyNode<any, any> };\n\ntype IndexedDeps<Extra extends readonly DependencyNode[]> = {\n [K in keyof Extra as K extends `${number}` ? `__extra${K}` : never]: Extra[K];\n};\n\nexport const withDependencies = <\n N extends DependencyNode,\n const Extra extends readonly DependencyNode[],\n>(\n node: N,\n extraDeps: Extra,\n): N & { dependencies: N['dependencies'] & IndexedDeps<Extra> } => {\n const mergedDeps = {\n ...node.dependencies,\n ...Object.fromEntries(extraDeps.map((dep, i) => [`__extra${i}`, dep])),\n };\n const descriptors: PropertyDescriptorMap = Object.getOwnPropertyDescriptors(node);\n descriptors.dependencies = { ...descriptors.dependencies, value: mergedDeps };\n return Object.create(Object.getPrototypeOf(node), descriptors);\n};\n"]}