composed-di 0.2.6 → 0.2.8-ts4

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/utils.js CHANGED
@@ -1,115 +1,116 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createDotGraph = createDotGraph;
4
- exports.printDotGraph = printDotGraph;
5
- /**
6
- * Escapes special characters in strings for DOT notation
7
- */
8
- function escapeDotString(str) {
9
- return str.replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\n/g, '\\n');
10
- }
11
- /**
12
- * Generates a DOT notation graph from a ServiceModule.
13
- * The output can be visualized using Graphviz tools or online viewers like:
14
- * - https://dreampuf.github.io/GraphvizOnline/
15
- * - https://edotor.net/
16
- *
17
- * Arrows point from dependencies to dependents (from what is needed to what needs it).
18
- *
19
- * @param {ServiceModule} module - The ServiceModule to convert to DOT notation
20
- * @param {DotGraphOptions} options - Optional configuration for the graph appearance
21
- * @returns {string} A string containing the DOT notation graph
22
- */
23
- function createDotGraph(module, { direction, title, highlightLeaves, highlightRoots } = {
24
- direction: 'TB',
25
- title: 'Service Dependency Graph',
26
- highlightLeaves: true,
27
- highlightRoots: true,
28
- }) {
29
- const factories = module.factories;
30
- const lines = [];
31
- // Start the digraph
32
- lines.push('digraph ServiceDependencies {');
33
- lines.push(` label="${title}";`);
34
- lines.push(' labelloc="t";');
35
- lines.push(' fontsize=16;');
36
- lines.push(` rankdir=${direction};`);
37
- lines.push('');
38
- // Default node styling
39
- lines.push(' node [');
40
- lines.push(' shape=box,');
41
- lines.push(' style="rounded,filled",');
42
- lines.push(' fillcolor="#e1f5ff",');
43
- lines.push(' color="#0288d1",');
44
- lines.push(' fontname="Arial",');
45
- lines.push(' fontsize=12');
46
- lines.push(' ];');
47
- lines.push('');
48
- // Default edge styling
49
- lines.push(' edge [');
50
- lines.push(' color="#666666",');
51
- lines.push(' arrowsize=0.8');
52
- lines.push(' ];');
53
- lines.push('');
54
- // Build dependency maps to identify leaves and roots
55
- const hasDependencies = new Set();
56
- const hasDependents = new Set();
57
- factories.forEach((factory) => {
58
- const serviceName = factory.provides.name;
59
- if (factory.dependsOn.length > 0) {
60
- hasDependencies.add(serviceName);
61
- }
62
- factory.dependsOn.forEach((dependency) => {
63
- hasDependents.add(dependency.name);
64
- });
65
- });
66
- // Define nodes with special styling for leaves and roots
67
- const nodeIds = new Map();
68
- let nodeCounter = 0;
69
- factories.forEach((factory) => {
70
- const serviceName = factory.provides.name;
71
- const nodeId = `node${nodeCounter++}`;
72
- nodeIds.set(serviceName, nodeId);
73
- const isLeaf = !hasDependencies.has(serviceName);
74
- const isRoot = !hasDependents.has(serviceName);
75
- let nodeStyle = '';
76
- if (highlightLeaves && isLeaf) {
77
- nodeStyle = ' [fillcolor="#c8e6c9", color="#388e3c"]';
78
- }
79
- else if (highlightRoots && isRoot) {
80
- nodeStyle = ' [fillcolor="#ffccbc", color="#d84315"]';
81
- }
82
- lines.push(` ${nodeId} [label="${escapeDotString(serviceName)}"]${nodeStyle};`);
83
- });
84
- lines.push('');
85
- // Define edges (dependencies)
86
- factories.forEach((factory) => {
87
- const serviceName = factory.provides.name;
88
- const serviceNodeId = nodeIds.get(serviceName);
89
- factory.dependsOn.forEach((dependency) => {
90
- const depName = dependency.name;
91
- const depNodeId = nodeIds.get(depName);
92
- if (depNodeId) {
93
- // Arrow points from dependent to dependency (what needs it -> what provides it)
94
- lines.push(` ${serviceNodeId} -> ${depNodeId};`);
95
- }
96
- });
97
- });
98
- // Close the digraph
99
- lines.push('}');
100
- return lines.join('\n');
101
- }
102
- /**
103
- * Prints a DOT representation of a service module graph to the console.
104
- * The output can be used to visualize the graph using online graph visualization tools.
105
- *
106
- * @param {ServiceModule} module - The service module representing the graph to be converted into DOT format.
107
- * @param {DotGraphOptions} [options] - Optional configurations to customize the output of the DOT graph.
108
- * @return {void} - This function does not return a value.
109
- */
110
- function printDotGraph(module, options) {
111
- console.log(createDotGraph(module, options));
112
- console.log('\n\nCopy the DOT output above and paste it into:');
113
- console.log('https://dreampuf.github.io/GraphvizOnline/');
114
- }
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.printDotGraph = exports.createDotGraph = void 0;
4
+ /**
5
+ * Escapes special characters in strings for DOT notation
6
+ */
7
+ function escapeDotString(str) {
8
+ return str.replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\n/g, '\\n');
9
+ }
10
+ /**
11
+ * Generates a DOT notation graph from a ServiceModule.
12
+ * The output can be visualized using Graphviz tools or online viewers like:
13
+ * - https://dreampuf.github.io/GraphvizOnline/
14
+ * - https://edotor.net/
15
+ *
16
+ * Arrows point from dependencies to dependents (from what is needed to what needs it).
17
+ *
18
+ * @param {ServiceModule} module - The ServiceModule to convert to DOT notation
19
+ * @param {DotGraphOptions} options - Optional configuration for the graph appearance
20
+ * @returns {string} A string containing the DOT notation graph
21
+ */
22
+ function createDotGraph(module, { direction, title, highlightLeaves, highlightRoots } = {
23
+ direction: 'TB',
24
+ title: 'Service Dependency Graph',
25
+ highlightLeaves: true,
26
+ highlightRoots: true,
27
+ }) {
28
+ const factories = module.factories;
29
+ const lines = [];
30
+ // Start the digraph
31
+ lines.push('digraph ServiceDependencies {');
32
+ lines.push(` label="${title}";`);
33
+ lines.push(' labelloc="t";');
34
+ lines.push(' fontsize=16;');
35
+ lines.push(` rankdir=${direction};`);
36
+ lines.push('');
37
+ // Default node styling
38
+ lines.push(' node [');
39
+ lines.push(' shape=box,');
40
+ lines.push(' style="rounded,filled",');
41
+ lines.push(' fillcolor="#e1f5ff",');
42
+ lines.push(' color="#0288d1",');
43
+ lines.push(' fontname="Arial",');
44
+ lines.push(' fontsize=12');
45
+ lines.push(' ];');
46
+ lines.push('');
47
+ // Default edge styling
48
+ lines.push(' edge [');
49
+ lines.push(' color="#666666",');
50
+ lines.push(' arrowsize=0.8');
51
+ lines.push(' ];');
52
+ lines.push('');
53
+ // Build dependency maps to identify leaves and roots
54
+ const hasDependencies = new Set();
55
+ const hasDependents = new Set();
56
+ factories.forEach((factory) => {
57
+ const serviceName = factory.provides.name;
58
+ if (factory.dependsOn.length > 0) {
59
+ hasDependencies.add(serviceName);
60
+ }
61
+ factory.dependsOn.forEach((dependency) => {
62
+ hasDependents.add(dependency.name);
63
+ });
64
+ });
65
+ // Define nodes with special styling for leaves and roots
66
+ const nodeIds = new Map();
67
+ let nodeCounter = 0;
68
+ factories.forEach((factory) => {
69
+ const serviceName = factory.provides.name;
70
+ const nodeId = `node${nodeCounter++}`;
71
+ nodeIds.set(serviceName, nodeId);
72
+ const isLeaf = !hasDependencies.has(serviceName);
73
+ const isRoot = !hasDependents.has(serviceName);
74
+ let nodeStyle = '';
75
+ if (highlightLeaves && isLeaf) {
76
+ nodeStyle = ' [fillcolor="#c8e6c9", color="#388e3c"]';
77
+ }
78
+ else if (highlightRoots && isRoot) {
79
+ nodeStyle = ' [fillcolor="#ffccbc", color="#d84315"]';
80
+ }
81
+ lines.push(` ${nodeId} [label="${escapeDotString(serviceName)}"]${nodeStyle};`);
82
+ });
83
+ lines.push('');
84
+ // Define edges (dependencies)
85
+ factories.forEach((factory) => {
86
+ const serviceName = factory.provides.name;
87
+ const serviceNodeId = nodeIds.get(serviceName);
88
+ factory.dependsOn.forEach((dependency) => {
89
+ const depName = dependency.name;
90
+ const depNodeId = nodeIds.get(depName);
91
+ if (depNodeId) {
92
+ // Arrow points from dependent to dependency (what needs it -> what provides it)
93
+ lines.push(` ${serviceNodeId} -> ${depNodeId};`);
94
+ }
95
+ });
96
+ });
97
+ // Close the digraph
98
+ lines.push('}');
99
+ return lines.join('\n');
100
+ }
101
+ exports.createDotGraph = createDotGraph;
102
+ /**
103
+ * Prints a DOT representation of a service module graph to the console.
104
+ * The output can be used to visualize the graph using online graph visualization tools.
105
+ *
106
+ * @param {ServiceModule} module - The service module representing the graph to be converted into DOT format.
107
+ * @param {DotGraphOptions} [options] - Optional configurations to customize the output of the DOT graph.
108
+ * @return {void} - This function does not return a value.
109
+ */
110
+ function printDotGraph(module, options) {
111
+ console.log(createDotGraph(module, options));
112
+ console.log('\n\nCopy the DOT output above and paste it into:');
113
+ console.log('https://dreampuf.github.io/GraphvizOnline/');
114
+ }
115
+ exports.printDotGraph = printDotGraph;
115
116
  //# sourceMappingURL=utils.js.map
package/dist/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;AAiCA,wCAqGC;AAUD,sCAOC;AAzID;;GAEG;AACH,SAAS,eAAe,CAAC,GAAW;IAClC,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAC/E,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAgB,cAAc,CAC5B,MAAqB,EACrB,EAAE,SAAS,EAAE,KAAK,EAAE,eAAe,EAAE,cAAc,KAAsB;IACvE,SAAS,EAAE,IAAI;IACf,KAAK,EAAE,0BAA0B;IACjC,eAAe,EAAE,IAAI;IACrB,cAAc,EAAE,IAAI;CACrB;IAED,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;IACnC,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,oBAAoB;IACpB,KAAK,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;IAC5C,KAAK,CAAC,IAAI,CAAC,YAAY,KAAK,IAAI,CAAC,CAAC;IAClC,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAC9B,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAC7B,KAAK,CAAC,IAAI,CAAC,aAAa,SAAS,GAAG,CAAC,CAAC;IACtC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEf,uBAAuB;IACvB,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,C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,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAE,CAAC;QAEhD,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,UAA+B,EAAE,EAAE;YAC5D,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC;YAChC,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YAEvC,IAAI,SAAS,EAAE;gBACb,gFAAgF;gBAChF,KAAK,CAAC,IAAI,CAAC,KAAK,aAAa,OAAO,SAAS,GAAG,CAAC,CAAC;aACnD;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,oBAAoB;IACpB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAEhB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AArGD,wCAqGC;AAED;;;;;;;GAOG;AACH,SAAgB,aAAa,CAC3B,MAAqB,EACrB,OAAyB;IAEzB,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC7C,OAAO,CAAC,GAAG,CAAC,kDAAkD,CAAC,CAAC;IAChE,OAAO,CAAC,GAAG,CAAC,4CAA4C,CAAC,CAAC;AAC5D,CAAC;AAPD,sCAOC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "composed-di",
3
3
  "private": false,
4
- "version": "0.2.6",
4
+ "version": "0.2.8-ts4",
5
5
  "author": "Juan Herrera juanhr454@gmail.com",
6
6
  "type": "commonjs",
7
7
  "main": "./dist/index.js",
@@ -9,7 +9,8 @@
9
9
  "exports": {
10
10
  ".": {
11
11
  "types": "./dist/index.d.ts",
12
- "require": "./dist/index.js"
12
+ "require": "./dist/index.js",
13
+ "default": "./dist/index.js"
13
14
  }
14
15
  },
15
16
  "files": [
@@ -24,7 +25,7 @@
24
25
  "license": "MIT",
25
26
  "repository": {
26
27
  "type": "git",
27
- "url": "https://github.com/imherrera/composed-di"
28
+ "url": "git+https://github.com/imherrera/composed-di.git"
28
29
  },
29
30
  "scripts": {
30
31
  "build": "tsc --build",
@@ -34,6 +35,6 @@
34
35
  "@tsconfig/recommended": "^1.0.10",
35
36
  "@types/node": "24.0.10",
36
37
  "prettier": "^3.3.1",
37
- "typescript": "^5.2.2"
38
+ "typescript": "4.9.3"
38
39
  }
39
40
  }
@@ -10,8 +10,8 @@ type DependencyTypes<T extends readonly ServiceKey<unknown>[]> = {
10
10
  };
11
11
 
12
12
  export abstract class ServiceFactory<
13
- const T,
14
- const D extends readonly ServiceKey<unknown>[] = [],
13
+ T,
14
+ D extends readonly ServiceKey<unknown>[] = [],
15
15
  > {
16
16
  abstract provides: ServiceKey<T>;
17
17
  abstract dependsOn: D;
@@ -24,8 +24,8 @@ export abstract class ServiceFactory<
24
24
  * and used throughout the scope lifecycle.
25
25
  */
26
26
  static singleton<
27
- const T,
28
- const D extends readonly ServiceKey<unknown>[] = [],
27
+ T,
28
+ D extends readonly ServiceKey<unknown>[] = [],
29
29
  >({
30
30
  scope,
31
31
  provides,
@@ -65,7 +65,7 @@ export abstract class ServiceFactory<
65
65
  * Creates a one-shot service factory that initializes a new instance of the provided service
66
66
  * every time it is requested.
67
67
  */
68
- static oneShot<const T, const D extends readonly ServiceKey<unknown>[] = []>({
68
+ static oneShot<T, D extends readonly ServiceKey<unknown>[] = []>({
69
69
  provides,
70
70
  dependsOn,
71
71
  initialize,
@@ -2,8 +2,8 @@ import { ServiceKey } from './ServiceKey';
2
2
  import { ServiceFactory } from './ServiceFactory';
3
3
  import { ServiceScope } from './ServiceScope';
4
4
 
5
- type GenericFactory = ServiceFactory<unknown, readonly ServiceKey<unknown>[]>;
6
- type GenericKey = ServiceKey<unknown>;
5
+ type GenericFactory = ServiceFactory<any, readonly ServiceKey<any>[]>;
6
+ type GenericKey = ServiceKey<any>;
7
7
 
8
8
  export class ServiceModule {
9
9
  private constructor(readonly factories: GenericFactory[]) {