Introduction
Complete TypeScript type definitions for ee-core. All public interface and configuration types are centralized here, referenced by framework modules and business code for type safety. These types are also exported from the main ee-core entry point via export type.
Import
// ESM (type-only import)
import type { ElectronEggOptions, Config } from 'ee-core/types';
import type { ElectronEggOptions, Config } from 'ee-core';
// CJS (type-only, via ts-ignore for runtime)
// TypeScript types are not available at runtime in CJS
// Use JSDoc or .d.ts files for type annotationsApp Types
ElectronEggOptions
Framework startup options, constructed during initialization. Values do not change throughout the application lifecycle.
| Field | Type | Description |
|---|---|---|
env | string | Runtime environment ('dev', 'prod', 'test') |
baseDir | string | Project root directory |
electronDir | string | Electron source directory |
appName | string | Application name from package.json |
userHome | string | User home directory (os.homedir()) |
appData | string | System app data directory |
appUserData | string | Electron user data directory (appData/appName) |
appVersion | string | Application version from package.json |
isPackaged | boolean | Whether packaged as installer |
execDir | string | Executable directory |
AppInfo
Application metadata, passed as parameter to configuration functions.
| Field | Type | Description |
|---|---|---|
name | string | Application name |
baseDir | string | Project root directory |
electronDir | string | Electron source directory |
env | string | Runtime environment |
root | string | Log/data root directory (usually appUserData) |
Example:
// config.default.js
module.exports = (appInfo) => {
const config = {};
config.logger.dir = path.join(appInfo.root, 'logs');
return config;
};See also: config
Config Types
Config
Main framework configuration interface. The type definition for the object exported by config.default.js.
| Field | Type | Description |
|---|---|---|
[key: string] | unknown | Dynamic properties for user-defined config |
openDevTools | boolean | OpenDevToolsOptions | DevTools configuration |
singleLock | boolean | Single instance lock |
windowsOption | BrowserWindowConstructorOptions | BrowserWindow constructor options |
logger | LoggerConfig | Logger configuration |
socketServer | SocketServerConfig | Socket.IO configuration |
httpServer | HttpServerConfig | HTTP service configuration |
remote | RemoteConfig | Remote service configuration |
mainServer | MainServerConfig | Main window service configuration |
exception | ExceptionConfig | Exception handling configuration |
jobs | JobsConfig | Background jobs configuration |
cross | CrossConfig | Cross-process configuration |
See also: config
RemoteConfig
| Field | Type | Description |
|---|---|---|
enable | boolean | Whether to enable remote service |
url | string | Remote service address |
MainServerConfig
| Field | Type | Description |
|---|---|---|
protocol | string | 'file://' for local file, 'http://'/'https://' for remote |
indexPath | string | Entry file/URL path |
options | Record<string, unknown> | Extra options for protocol handling |
takeover | string | Loading strategy: 'start' or 'ready' |
loadingPage | string | Preload page path for splash screens |
channelSeparator | string | IPC channel separator, default '/' |
SocketServerConfig
| Field | Type | Description |
|---|---|---|
enable | boolean | Whether to enable Socket service |
port | number | Listening port |
path | string | Socket.IO path |
connectTimeout | number | Connection timeout (ms) |
pingTimeout | number | Heartbeat timeout (ms) |
pingInterval | number | Heartbeat interval (ms) |
maxHttpBufferSize | number | Max HTTP message body bytes |
transports | ('polling' | 'websocket')[] | Transport list |
cors | object | CORS configuration |
channel | string | Custom communication channel name |
HttpsConfig
| Field | Type | Description |
|---|---|---|
enable | boolean | Whether to enable HTTPS |
key | string | SSL private key file path |
cert | string | SSL certificate file path |
HttpServerConfig
| Field | Type | Description |
|---|---|---|
enable | boolean | Whether to enable HTTP service |
https | HttpsConfig | HTTPS certificate config |
protocol | string | 'http' or 'https' |
host | string | Listening host, default '127.0.0.1' |
port | number | Listening port |
cors | { origin: string } | CORS configuration |
body | object | Request body parsing config |
filterRequest | { uris: string[], returnData: string } | Request filter config |
koaConfig | KoaConfig | Koa middleware extension |
KoaConfig
| Field | Type | Description |
|---|---|---|
preMiddleware | Function[] | Pre-middleware list |
postMiddleware | Function[] | Post-middleware list |
errorHandler | Function | null | Custom error handler |
LoggerConfig
| Field | Type | Description |
|---|---|---|
dir | string | Log file directory (default: appUserData/logs) |
level | string | Minimum log level |
prettyPrint | boolean | Enable pino-pretty (dev only) |
dateFormat | string | Timestamp date format |
appLogName | string | Application log filename |
coreLogName | string | Core log filename |
errorLogName | string | Error log filename |
rotator | string | Rotation period ('daily' or 'hourly') |
redact | string[] | Fields to redact |
redactCensor | string | Function | Redaction replacement |
timestamp | boolean | Include timestamps |
timezone | string | IANA timezone (default 'UTC') |
name | string | Logger name |
maxSize | number | string | Max single log file size |
serializers | object | Custom serializers |
customLevels | object | Custom level mapping |
depthLimit | number | Object serialization depth limit |
safe | boolean | Safe mode (no exception on write failure) |
enabled | boolean | Enable/disable logging |
ExceptionConfig
| Field | Type | Description |
|---|---|---|
mainExit | boolean | Main process exception exits app |
childExit | boolean | Child process exit terminates main |
rendererExit | boolean | Renderer process exit strategy |
JobsConfig
| Field | Type | Description |
|---|---|---|
messageLog | boolean | Log child process IPC messages |
CrossTargetConfig
| Field | Type | Description |
|---|---|---|
name | string | Target process identifier |
enable | boolean | Whether to enable |
args | string[] | Command line arguments |
cmd | string | Startup command |
directory | string | Working directory |
windowsExtname | boolean | Auto-add .exe on Windows |
stdio | string[] | Child process stdio config |
appExit | boolean | Exit main when child exits |
port | number | Child process HTTP port |
url | string | Child process service URL |
CrossConfig
Dynamic key map where each value is CrossTargetConfig.
interface CrossConfig {
[key: string]: CrossTargetConfig;
}Jobs Types
JobChildOptions
| Field | Type | Description |
|---|---|---|
name | string | Job name identifier |
script | string | Child process entry script path |
args | string[] | Command line arguments |
env | ProcessEnv | Child process environment variables |
port | number | HTTP service port |
ChildPoolOptions
| Field | Type | Description |
|---|---|---|
weights | number[] | Weight configuration for pool members |
LoadBalancerTarget
| Field | Type | Description |
|---|---|---|
id | string | number | Target identifier |
weight | number | Weight value |
LoadBalancerOptions
| Field | Type | Description |
|---|---|---|
targets | LoadBalancerTarget[] | Target list |
algorithm | string | Algorithm name |
AlgorithmType
| Key | Value | Description |
|---|---|---|
polling | 'polling' | Round-robin |
weights | 'weights' | Weighted round-robin |
random | 'random' | Random selection |
specify | 'specify' | Specified target |
weightsPolling | 'weightsPolling' | Smooth weighted round-robin |
weightsRandom | 'weightsRandom' | Weighted random |
minimumConnection | 'minimumConnection' | Least connections |
weightsMinimumConnection | 'weightsMinimumConnection' | Weighted least connections |
JobProcessOptions
| Field | Type | Description |
|---|---|---|
processArgs | Record<string, unknown> | Arguments for child_process.fork |
processOptions | ForkOptions | Fork options |
[key: string] | unknown | Custom properties |
Dev Types
DevConfig
| Field | Type | Description |
|---|---|---|
frontend | DevFrontendConfig | Frontend dev config |
electron | DevElectronConfig | Electron dev config |
DevFrontendConfig
| Field | Type | Description |
|---|---|---|
directory | string | Frontend directory |
cmd | string | Command |
args | string[] | Arguments |
protocol | string | Frontend protocol |
hostname | string | Hostname |
port | number | Port |
indexPath | string | Index page |
force | boolean | Force refresh |
sync | boolean | Sync mode |
DevElectronConfig
| Field | Type | Description |
|---|---|---|
directory | string | Directory |
cmd | string | Command |
args | string[] | Arguments |
loadingPage | string | Loading page path |
watch | boolean | Watch mode |
sync | boolean | Sync mode |
delay | number | Debounce delay (ms) |
Loader Types
FileLoaderOptions
| Field | Type | Description |
|---|---|---|
caseStyle | 'lower' | 'upper' | 'camel' | Function | Property naming style. 'lower' = first letter lowercase (controllers) |
directory | string | Directory path(s) to scan |
initializer | Function | null | Custom initializer for file exports |
call | boolean | Auto-call function-type exports |
override | boolean | Override same-name properties |
inject | unknown | Injection parameters for auto-called functions |
match | string | string[] | Function | File match pattern |
ignore | string | string[] | Function | File ignore pattern |
registry | RegistryEntry[] | Pre-registry entries (bundle mode) |
RegistryEntry
| Field | Type | Description |
|---|---|---|
fullpath | string | Full file path |
properties | string[] | Property path array from file path |
module | unknown | Lazily loaded module |
TimingItem
| Field | Type | Description |
|---|---|---|
name | string | Stage name |
start | number | Start time (ms) |
end | number | undefined | End time (ms) |
duration | number | undefined | Duration (ms) |
pid | number | Process PID |
index | number | Execution order index |
Message Types
MessageData
| Field | Type | Description |
|---|---|---|
channel | string | Communication channel identifier |
event | string | Event name |
data | unknown | Message payload |
ProcessExitEventData
| Field | Type | Description |
|---|---|---|
pid | number | undefined | PID of exited process |
Utils Types
ExtendOptions
| Field | Type | Description |
|---|---|---|
deep | boolean | Whether to deep merge |
JsonWriteOptions
| Field | Type | Description |
|---|---|---|
space | number | Number of indent spaces (default: 2) |
replacer | Function | JSON.stringify replacer |
GetPortOptions
| Field | Type | Description |
|---|---|---|
port | number | number[] | Preferred port or range |
host | string | Bound host address |
Cross Types
CrossRunOptions
Partial<CrossTargetConfig> — Options when running a cross-process service.
CrossProcessOptions
| Field | Type | Description |
|---|---|---|
targetConf | CrossTargetConfig | Target configuration |
port | number | Allocated port |
CrossHost
| Field | Type | Description |
|---|---|---|
emitter | EventEmitter | undefined | Event emitter |
Log Types
EeLogger
Unified log interface (Pino-based).
interface EeLogger {
trace(msg: string, ...args: unknown[]): void;
debug(msg: string, ...args: unknown[]): void;
info(msg: string, ...args: unknown[]): void;
warn(msg: string, ...args: unknown[]): void;
error(msg: string, ...args: unknown[]): void;
fatal(msg: string, ...args: unknown[]): void;
child(bindings: Record<string, unknown>): EeLogger;
}PinoLoggers
| Field | Type | Description |
|---|---|---|
logger | pino.Logger | Application logger instance |
coreLogger | pino.Logger | Framework core logger |
errorLogger | pino.Logger | Error-only logger |
