procxy 0.1.0-alpha.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.
Files changed (55) hide show
  1. package/CHANGELOG.md +125 -0
  2. package/README.md +936 -0
  3. package/dist/child/agent.d.ts +3 -0
  4. package/dist/child/agent.d.ts.map +1 -0
  5. package/dist/child/agent.js +126 -0
  6. package/dist/child/agent.js.map +1 -0
  7. package/dist/child/child-proxy.d.ts +23 -0
  8. package/dist/child/child-proxy.d.ts.map +1 -0
  9. package/dist/child/child-proxy.js +193 -0
  10. package/dist/child/child-proxy.js.map +1 -0
  11. package/dist/child/event-bridge.d.ts +15 -0
  12. package/dist/child/event-bridge.d.ts.map +1 -0
  13. package/dist/child/event-bridge.js +51 -0
  14. package/dist/child/event-bridge.js.map +1 -0
  15. package/dist/index.d.ts +11 -0
  16. package/dist/index.d.ts.map +1 -0
  17. package/dist/index.js +8 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/parent/ipc-client.d.ts +31 -0
  20. package/dist/parent/ipc-client.d.ts.map +1 -0
  21. package/dist/parent/ipc-client.js +316 -0
  22. package/dist/parent/ipc-client.js.map +1 -0
  23. package/dist/parent/parent-proxy.d.ts +4 -0
  24. package/dist/parent/parent-proxy.d.ts.map +1 -0
  25. package/dist/parent/parent-proxy.js +76 -0
  26. package/dist/parent/parent-proxy.js.map +1 -0
  27. package/dist/parent/procxy.d.ts +6 -0
  28. package/dist/parent/procxy.d.ts.map +1 -0
  29. package/dist/parent/procxy.js +120 -0
  30. package/dist/parent/procxy.js.map +1 -0
  31. package/dist/shared/errors.d.ts +31 -0
  32. package/dist/shared/errors.d.ts.map +1 -0
  33. package/dist/shared/errors.js +85 -0
  34. package/dist/shared/errors.js.map +1 -0
  35. package/dist/shared/module-resolver.d.ts +6 -0
  36. package/dist/shared/module-resolver.d.ts.map +1 -0
  37. package/dist/shared/module-resolver.js +99 -0
  38. package/dist/shared/module-resolver.js.map +1 -0
  39. package/dist/shared/protocol.d.ts +86 -0
  40. package/dist/shared/protocol.d.ts.map +1 -0
  41. package/dist/shared/protocol.js +2 -0
  42. package/dist/shared/protocol.js.map +1 -0
  43. package/dist/shared/serialization.d.ts +20 -0
  44. package/dist/shared/serialization.d.ts.map +1 -0
  45. package/dist/shared/serialization.js +96 -0
  46. package/dist/shared/serialization.js.map +1 -0
  47. package/dist/types/options.d.ts +9 -0
  48. package/dist/types/options.d.ts.map +1 -0
  49. package/dist/types/options.js +2 -0
  50. package/dist/types/options.js.map +1 -0
  51. package/dist/types/procxy.d.ts +50 -0
  52. package/dist/types/procxy.d.ts.map +1 -0
  53. package/dist/types/procxy.js +2 -0
  54. package/dist/types/procxy.js.map +1 -0
  55. package/package.json +87 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,125 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.1.0-alpha.1] - 2024-12-29
9
+
10
+ ### Added
11
+
12
+ - **Core Features**
13
+ - Process-based proxying for TypeScript/JavaScript classes
14
+ - Type-safe method invocation with full IntelliSense support
15
+ - Transparent IPC communication between parent and child processes
16
+ - Constructor arguments support for remote class instantiation
17
+
18
+ - **EventEmitter Support**
19
+ - Automatic event forwarding from child to parent process
20
+ - Full EventEmitter API compatibility
21
+ - Support for custom events and event listeners
22
+
23
+ - **Lifecycle Management**
24
+ - Manual termination via `$terminate()` method
25
+ - Automatic cleanup with ES2024 disposables (`using`/`await using`)
26
+ - Graceful process termination and resource cleanup
27
+ - Access to underlying child process via `$process` property
28
+
29
+ - **Configuration Options**
30
+ - Configurable timeouts per method call
31
+ - Automatic retry logic for failed operations
32
+ - Custom environment variables for child processes
33
+ - Working directory customization
34
+ - Command line arguments support
35
+
36
+ - **Error Handling**
37
+ - Complete error propagation from child to parent
38
+ - Stack trace preservation across process boundaries
39
+ - Specialized error types:
40
+ - `TimeoutError` for method call timeouts
41
+ - `ChildCrashedError` for unexpected process exits
42
+ - `ModuleResolutionError` for module loading failures
43
+ - `SerializationError` for non-JSON-serializable data
44
+ - `OptionsValidationError` for invalid configuration
45
+
46
+ - **Type Safety**
47
+ - Advanced mapped types with `Procxy<T>`
48
+ - Automatic filtering of non-serializable methods
49
+ - Support for optional parameters
50
+ - Full TypeScript 5.0+ compatibility
51
+
52
+ - **Performance**
53
+ - Method call overhead <10ms (average 0.04-0.06ms)
54
+ - No memory leaks after 1000+ sequential calls
55
+ - Efficient IPC message handling
56
+ - Minimal bundle size (~26KB unminified, ~6KB gzipped)
57
+
58
+ - **Documentation**
59
+ - Comprehensive README with examples
60
+ - API documentation via TypeDoc
61
+ - 4 detailed example files:
62
+ - `basic-usage.ts` - Fundamental usage patterns
63
+ - `event-emitter.ts` - Event forwarding examples
64
+ - `error-handling.ts` - Error handling strategies
65
+ - `lifecycle.ts` - Process lifecycle management
66
+ - Contributing guidelines
67
+
68
+ - **Testing**
69
+ - 223 tests with 88.57% code coverage
70
+ - Integration tests for all major features
71
+ - Unit tests for core components
72
+ - Performance benchmarks
73
+ - Memory leak detection tests
74
+
75
+ ### Performance Metrics
76
+
77
+ - Average method call overhead: **0.04-0.06ms**
78
+ - Memory growth after 1000 calls: **<3MB**
79
+ - Bundle size: **26KB** unminified, **6KB** gzipped
80
+ - Test coverage: **88.57%**
81
+ - Process initialization: **~150ms**
82
+
83
+ ### Requirements
84
+
85
+ - Node.js >= 20.0.0
86
+ - TypeScript >= 5.0.0 (for TypeScript projects)
87
+ - pnpm >= 9.0.0 (for development)
88
+
89
+ ### Architecture
90
+
91
+ - **Parent Process**: Manages proxy instances and IPC communication
92
+ - **Child Process**: Runs class instances in isolation
93
+ - **IPC Protocol**: JSON-based message protocol for method calls and events
94
+ - **Type System**: Advanced mapped types for type-safe proxy generation
95
+
96
+ ### Security
97
+
98
+ - Complete process isolation for untrusted code
99
+ - Configurable timeouts prevent runaway processes
100
+ - Validated serialization prevents code injection
101
+
102
+ ---
103
+
104
+ ## [Unreleased]
105
+
106
+ ### Future Plans
107
+
108
+ - Worker threads support (in addition to child_process)
109
+ - Worker pooling for high-throughput scenarios
110
+ - Transferable objects support for zero-copy data passing
111
+ - Browser support via Web Workers
112
+ - Performance optimizations
113
+ - Additional configuration options
114
+
115
+ ---
116
+
117
+ **Legend**:
118
+ - `Added` for new features
119
+ - `Changed` for changes in existing functionality
120
+ - `Deprecated` for soon-to-be removed features
121
+ - `Removed` for now removed features
122
+ - `Fixed` for any bug fixes
123
+ - `Security` for vulnerability fixes
124
+
125
+ [0.1.0-alpha.1]: https://github.com/pradeepmouli/procxy/releases/tag/v0.1.0-alpha.1