@shuji-bonji/rxjs-mcp 0.1.2 → 0.1.3

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 (37) hide show
  1. package/dist/data/cleanup-examples.d.ts +9 -0
  2. package/dist/data/cleanup-examples.d.ts.map +1 -0
  3. package/dist/data/cleanup-examples.js +87 -0
  4. package/dist/data/cleanup-examples.js.map +1 -0
  5. package/dist/data/creation-functions.d.ts +7 -0
  6. package/dist/data/creation-functions.d.ts.map +1 -0
  7. package/dist/data/creation-functions.js +135 -0
  8. package/dist/data/creation-functions.js.map +1 -0
  9. package/dist/data/operators.d.ts +7 -0
  10. package/dist/data/operators.d.ts.map +1 -0
  11. package/dist/data/operators.js +500 -0
  12. package/dist/data/operators.js.map +1 -0
  13. package/dist/data/patterns.d.ts +10 -0
  14. package/dist/data/patterns.d.ts.map +1 -0
  15. package/dist/data/patterns.js +482 -0
  16. package/dist/data/patterns.js.map +1 -0
  17. package/dist/data/rxjs-context.d.ts +169 -0
  18. package/dist/data/rxjs-context.d.ts.map +1 -0
  19. package/dist/data/rxjs-context.js +209 -0
  20. package/dist/data/rxjs-context.js.map +1 -0
  21. package/dist/tools/analyze-operators.d.ts.map +1 -1
  22. package/dist/tools/analyze-operators.js +2 -121
  23. package/dist/tools/analyze-operators.js.map +1 -1
  24. package/dist/tools/execute-stream-worker.js +7 -149
  25. package/dist/tools/execute-stream-worker.js.map +1 -1
  26. package/dist/tools/execute-stream.d.ts.map +1 -1
  27. package/dist/tools/execute-stream.js +33 -67
  28. package/dist/tools/execute-stream.js.map +1 -1
  29. package/dist/tools/memory-leak.d.ts.map +1 -1
  30. package/dist/tools/memory-leak.js +2 -82
  31. package/dist/tools/memory-leak.js.map +1 -1
  32. package/dist/tools/suggest-pattern.d.ts.map +1 -1
  33. package/dist/tools/suggest-pattern.js +1 -477
  34. package/dist/tools/suggest-pattern.js.map +1 -1
  35. package/dist/types.d.ts +40 -0
  36. package/dist/types.d.ts.map +1 -1
  37. package/package.json +1 -1
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Framework-specific cleanup examples for memory leak detection
3
+ */
4
+ export declare const cleanupExamples: Record<string, string>;
5
+ /**
6
+ * Get cleanup example for a specific framework/lifecycle
7
+ */
8
+ export declare function getCleanupExample(lifecycle: string): string;
9
+ //# sourceMappingURL=cleanup-examples.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cleanup-examples.d.ts","sourceRoot":"","sources":["../../src/data/cleanup-examples.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA+ElD,CAAC;AAEF;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE3D"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Framework-specific cleanup examples for memory leak detection
3
+ */
4
+ export const cleanupExamples = {
5
+ angular: `
6
+ // Angular Component with proper cleanup
7
+ export class MyComponent implements OnDestroy {
8
+ private destroy$ = new Subject<void>();
9
+
10
+ ngOnInit() {
11
+ // Method 1: takeUntil pattern
12
+ this.myService.getData()
13
+ .pipe(takeUntil(this.destroy$))
14
+ .subscribe(data => console.log(data));
15
+
16
+ // Method 2: Async pipe in template
17
+ this.data$ = this.myService.getData();
18
+ // Template: {{ data$ | async }}
19
+ }
20
+
21
+ ngOnDestroy() {
22
+ this.destroy$.next();
23
+ this.destroy$.complete();
24
+ }
25
+ }`,
26
+ react: `
27
+ // React Hook with proper cleanup
28
+ function MyComponent() {
29
+ useEffect(() => {
30
+ const subscription = dataStream$
31
+ .pipe(/* operators */)
32
+ .subscribe(data => setData(data));
33
+
34
+ // Cleanup function
35
+ return () => {
36
+ subscription.unsubscribe();
37
+ };
38
+ }, [/* dependencies */]);
39
+ }`,
40
+ vue: `
41
+ // Vue 3 Composition API with proper cleanup
42
+ import { onBeforeUnmount } from 'vue';
43
+
44
+ export default {
45
+ setup() {
46
+ const destroy$ = new Subject();
47
+
48
+ // Subscribe with takeUntil
49
+ dataStream$
50
+ .pipe(takeUntil(destroy$))
51
+ .subscribe(data => state.data = data);
52
+
53
+ onBeforeUnmount(() => {
54
+ destroy$.next();
55
+ destroy$.complete();
56
+ });
57
+ }
58
+ }`,
59
+ none: `
60
+ // Generic cleanup pattern
61
+ class StreamManager {
62
+ private subscriptions = new Subscription();
63
+
64
+ init() {
65
+ // Add subscriptions to composite
66
+ this.subscriptions.add(
67
+ stream1$.subscribe(/* ... */)
68
+ );
69
+
70
+ this.subscriptions.add(
71
+ stream2$.subscribe(/* ... */)
72
+ );
73
+ }
74
+
75
+ cleanup() {
76
+ // Unsubscribe all at once
77
+ this.subscriptions.unsubscribe();
78
+ }
79
+ }`,
80
+ };
81
+ /**
82
+ * Get cleanup example for a specific framework/lifecycle
83
+ */
84
+ export function getCleanupExample(lifecycle) {
85
+ return cleanupExamples[lifecycle] || cleanupExamples.none;
86
+ }
87
+ //# sourceMappingURL=cleanup-examples.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cleanup-examples.js","sourceRoot":"","sources":["../../src/data/cleanup-examples.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAA2B;IACrD,OAAO,EAAE;;;;;;;;;;;;;;;;;;;;EAoBT;IAEA,KAAK,EAAE;;;;;;;;;;;;;EAaP;IAEA,GAAG,EAAE;;;;;;;;;;;;;;;;;;EAkBL;IAEA,IAAI,EAAE;;;;;;;;;;;;;;;;;;;;EAoBN;CACD,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,SAAiB;IACjD,OAAO,eAAe,CAAC,SAAS,CAAC,IAAI,eAAe,CAAC,IAAI,CAAC;AAC5D,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { CreationFunctionInfo } from '../types.js';
2
+ /**
3
+ * RxJS Creation Functions Database
4
+ * Based on https://shuji-bonji.github.io/RxJS-with-TypeScript/
5
+ */
6
+ export declare const creationFunctionDatabase: Record<string, CreationFunctionInfo>;
7
+ //# sourceMappingURL=creation-functions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"creation-functions.d.ts","sourceRoot":"","sources":["../../src/data/creation-functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAgB,MAAM,aAAa,CAAC;AAEjE;;;GAGG;AACH,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAsIzE,CAAC"}
@@ -0,0 +1,135 @@
1
+ import { DOC_BASE_URL } from '../types.js';
2
+ /**
3
+ * RxJS Creation Functions Database
4
+ * Based on https://shuji-bonji.github.io/RxJS-with-TypeScript/
5
+ */
6
+ export const creationFunctionDatabase = {
7
+ // basic
8
+ 'of': {
9
+ name: 'of',
10
+ category: 'basic',
11
+ description: 'Emits the arguments you provide, then completes',
12
+ docUrl: `${DOC_BASE_URL}/creation-functions/basic/of`,
13
+ },
14
+ 'from': {
15
+ name: 'from',
16
+ category: 'basic',
17
+ description: 'Creates an Observable from an Array, Promise, or Iterable',
18
+ docUrl: `${DOC_BASE_URL}/creation-functions/basic/from`,
19
+ },
20
+ 'fromEvent': {
21
+ name: 'fromEvent',
22
+ category: 'basic',
23
+ description: 'Creates an Observable from DOM events',
24
+ docUrl: `${DOC_BASE_URL}/creation-functions/basic/fromEvent`,
25
+ },
26
+ 'interval': {
27
+ name: 'interval',
28
+ category: 'basic',
29
+ description: 'Emits incremental numbers at specified intervals',
30
+ docUrl: `${DOC_BASE_URL}/creation-functions/basic/interval`,
31
+ },
32
+ 'timer': {
33
+ name: 'timer',
34
+ category: 'basic',
35
+ description: 'Emits after a delay, then optionally at intervals',
36
+ docUrl: `${DOC_BASE_URL}/creation-functions/basic/timer`,
37
+ },
38
+ // loop
39
+ 'range': {
40
+ name: 'range',
41
+ category: 'loop',
42
+ description: 'Emits a sequence of numbers within a range',
43
+ docUrl: `${DOC_BASE_URL}/creation-functions/loop/range`,
44
+ },
45
+ 'generate': {
46
+ name: 'generate',
47
+ category: 'loop',
48
+ description: 'Creates an Observable with custom iteration logic',
49
+ docUrl: `${DOC_BASE_URL}/creation-functions/loop/generate`,
50
+ },
51
+ // http
52
+ 'ajax': {
53
+ name: 'ajax',
54
+ category: 'http',
55
+ description: 'Creates an Observable for AJAX requests',
56
+ docUrl: `${DOC_BASE_URL}/creation-functions/http/ajax`,
57
+ },
58
+ 'fromFetch': {
59
+ name: 'fromFetch',
60
+ category: 'http',
61
+ description: 'Creates an Observable from Fetch API',
62
+ docUrl: `${DOC_BASE_URL}/creation-functions/http/fromFetch`,
63
+ },
64
+ // combination
65
+ 'concat': {
66
+ name: 'concat',
67
+ category: 'combination',
68
+ description: 'Concatenates Observables in sequence',
69
+ docUrl: `${DOC_BASE_URL}/creation-functions/combination/concat`,
70
+ },
71
+ 'merge': {
72
+ name: 'merge',
73
+ category: 'combination',
74
+ description: 'Combines multiple Observables, emitting all values',
75
+ docUrl: `${DOC_BASE_URL}/creation-functions/combination/merge`,
76
+ },
77
+ 'combineLatest': {
78
+ name: 'combineLatest',
79
+ category: 'combination',
80
+ description: 'Combines latest values from all Observables',
81
+ docUrl: `${DOC_BASE_URL}/creation-functions/combination/combineLatest`,
82
+ },
83
+ 'zip': {
84
+ name: 'zip',
85
+ category: 'combination',
86
+ description: 'Combines values by index into arrays',
87
+ docUrl: `${DOC_BASE_URL}/creation-functions/combination/zip`,
88
+ },
89
+ 'forkJoin': {
90
+ name: 'forkJoin',
91
+ category: 'combination',
92
+ description: 'Waits for all to complete, emits final values',
93
+ docUrl: `${DOC_BASE_URL}/creation-functions/combination/forkJoin`,
94
+ },
95
+ // selection
96
+ 'race': {
97
+ name: 'race',
98
+ category: 'selection',
99
+ description: 'Emits from the Observable that emits first',
100
+ docUrl: `${DOC_BASE_URL}/creation-functions/selection/race`,
101
+ },
102
+ 'partition': {
103
+ name: 'partition',
104
+ category: 'selection',
105
+ description: 'Splits Observable into two based on predicate',
106
+ docUrl: `${DOC_BASE_URL}/creation-functions/selection/partition`,
107
+ },
108
+ // conditional
109
+ 'iif': {
110
+ name: 'iif',
111
+ category: 'conditional',
112
+ description: 'Subscribes to one of two Observables based on condition',
113
+ docUrl: `${DOC_BASE_URL}/creation-functions/conditional/iif`,
114
+ },
115
+ 'defer': {
116
+ name: 'defer',
117
+ category: 'conditional',
118
+ description: 'Creates Observable lazily at subscription time',
119
+ docUrl: `${DOC_BASE_URL}/creation-functions/conditional/defer`,
120
+ },
121
+ // control
122
+ 'scheduled': {
123
+ name: 'scheduled',
124
+ category: 'control',
125
+ description: 'Creates an Observable with a specific scheduler',
126
+ docUrl: `${DOC_BASE_URL}/creation-functions/control/scheduled`,
127
+ },
128
+ 'using': {
129
+ name: 'using',
130
+ category: 'control',
131
+ description: 'Creates Observable with resource management',
132
+ docUrl: `${DOC_BASE_URL}/creation-functions/control/using`,
133
+ },
134
+ };
135
+ //# sourceMappingURL=creation-functions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"creation-functions.js","sourceRoot":"","sources":["../../src/data/creation-functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,YAAY,EAAE,MAAM,aAAa,CAAC;AAEjE;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAyC;IAC5E,QAAQ;IACR,IAAI,EAAE;QACJ,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,OAAO;QACjB,WAAW,EAAE,iDAAiD;QAC9D,MAAM,EAAE,GAAG,YAAY,8BAA8B;KACtD;IACD,MAAM,EAAE;QACN,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,OAAO;QACjB,WAAW,EAAE,2DAA2D;QACxE,MAAM,EAAE,GAAG,YAAY,gCAAgC;KACxD;IACD,WAAW,EAAE;QACX,IAAI,EAAE,WAAW;QACjB,QAAQ,EAAE,OAAO;QACjB,WAAW,EAAE,uCAAuC;QACpD,MAAM,EAAE,GAAG,YAAY,qCAAqC;KAC7D;IACD,UAAU,EA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ators Database
4
+ * Based on https://shuji-bonji.github.io/RxJS-with-TypeScript/
5
+ */
6
+ export declare const operatorDatabase: Record<string, OperatorInfo>;
7
+ //# sourceMappingURL=operators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operators.d.ts","sourceRoot":"","sources":["../../src/data/operators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAgB,MAAM,aAAa,CAAC;AAEzD;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAofzD,CAAC"}