Shared library used across stackpress projects
npm install @stackpress/lib




Comprehensive API documentation for the Stackpress Library - a shared library used across Stackpress projects that standardizes type definitions and provides common utilities for developers.
``bash`
npm install @stackpress/lib
Key Features:
- Type-safe nested object manipulation
- Path-based data access with dot notation
- Built-in parsers for query strings, form data, and arguments
- Chainable API for fluent data operations
Key Features:
- Priority-based event listeners
- Type-safe event maps with TypeScript generics
- Before/after hooks for event execution
- Task queue management for event handling
Key Features:
- Template-based error messages
- Validation error aggregation
- Enhanced stack trace parsing
- HTTP status code integration
Key Features:
- Priority-based ordering (higher numbers execute first)
- FIFO ordering within same priority levels
- Task execution with before/after hooks
- Chainable API for queue operations
Key Features:
- Cross-platform request/response handling
- Parameter extraction from routes
- Event-driven architecture
- Generic type support for different mediums
Key Features:
- Cross-platform path resolution
- Node modules discovery
- Dynamic import support
- Project root (@/) path shortcuts
The library is built with TypeScript and provides comprehensive type definitions. All components support generic types for enhanced type safety:
`typescript
// Type-safe nested data
type ConfigMap = {
database: { host: string; port: number };
cache: { ttl: number };
};
const config = new Nest
// Type-safe event handling
type EventMap = {
'user-login': [string, Date];
'data-update': [object];
};
const emitter = new EventEmitter
// Type-safe queue operations
const queue = new TaskQueue<[number, string]>();
``
Most components work in both Node.js and browser environments:
- ✅ Nest - Full browser support
- ✅ EventEmitter - Full browser support
- ✅ Exception - Full browser support
- ✅ Queue - Full browser support
- ⚠️ FileLoader/NodeFS - Node.js only