fluxion-ts 0.1.6 → 0.3.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.
- package/README.md +115 -0
- package/dist/index.cjs +2517 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +37 -8
- package/dist/index.mjs +2519 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -288,6 +288,11 @@ interface FluxionOptions {
|
|
|
288
288
|
logger?: 'one-line' | 'json-line' | InjectionConfig;
|
|
289
289
|
apiExts?: string[];
|
|
290
290
|
routerExclude?: string[];
|
|
291
|
+
https?: {
|
|
292
|
+
key: string | Buffer;
|
|
293
|
+
cert: string | Buffer;
|
|
294
|
+
ca?: string | Buffer | Array<string | Buffer>;
|
|
295
|
+
};
|
|
291
296
|
}
|
|
292
297
|
```
|
|
293
298
|
|
|
@@ -382,6 +387,116 @@ interface WorkerOptions {
|
|
|
382
387
|
|
|
383
388
|
Current implementation uses `maxWorkerCount` for process count and reports CPU/memory telemetry from workers.
|
|
384
389
|
|
|
390
|
+
### `https`
|
|
391
|
+
|
|
392
|
+
HTTPS server configuration. When provided, Fluxion creates an HTTPS server instead of HTTP.
|
|
393
|
+
|
|
394
|
+
```ts
|
|
395
|
+
fluxion({
|
|
396
|
+
dir: './dynamicDirectory',
|
|
397
|
+
host: '127.0.0.1',
|
|
398
|
+
port: 9443,
|
|
399
|
+
https: {
|
|
400
|
+
key: './certs/private-key.pem', // 私钥文件路径或内容
|
|
401
|
+
cert: './certs/certificate.pem', // 证书文件路径或内容
|
|
402
|
+
ca: './certs/ca-bundle.crt', // 可选:CA 证书链
|
|
403
|
+
},
|
|
404
|
+
});
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
Relative paths are resolved relative to `moduleDir`. PEM content can be passed directly as strings.
|
|
408
|
+
|
|
409
|
+
### `dir`
|
|
410
|
+
|
|
411
|
+
Dynamic directory root. Created automatically if missing.
|
|
412
|
+
|
|
413
|
+
### `host`
|
|
414
|
+
|
|
415
|
+
Host passed to `server.listen`.
|
|
416
|
+
|
|
417
|
+
### `port`
|
|
418
|
+
|
|
419
|
+
Business server port.
|
|
420
|
+
|
|
421
|
+
### `metaPort`
|
|
422
|
+
|
|
423
|
+
Primary meta API port. Defaults to `port + 1` and must be different from `port`.
|
|
424
|
+
|
|
425
|
+
### `reloadDelay`
|
|
426
|
+
|
|
427
|
+
Debounce delay for file re-registration. Defaults to `300` and must be at least `50`.
|
|
428
|
+
|
|
429
|
+
### `apiExts`
|
|
430
|
+
|
|
431
|
+
Extensions registered as API handlers. Defaults to:
|
|
432
|
+
|
|
433
|
+
```ts
|
|
434
|
+
['.ts']
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
Example:
|
|
438
|
+
|
|
439
|
+
```ts
|
|
440
|
+
fluxion({
|
|
441
|
+
dir: './dynamicDirectory',
|
|
442
|
+
host: '127.0.0.1',
|
|
443
|
+
port: 3000,
|
|
444
|
+
apiExts: ['.ts', '.mjs'],
|
|
445
|
+
});
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
### `routerExclude`
|
|
449
|
+
|
|
450
|
+
Extensions excluded from both API and static registration.
|
|
451
|
+
|
|
452
|
+
Example:
|
|
453
|
+
|
|
454
|
+
```ts
|
|
455
|
+
routerExclude: ['.map']
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
### `maxRequestBytes`
|
|
459
|
+
|
|
460
|
+
Maximum accepted request body size. Defaults to `8_000_000`.
|
|
461
|
+
|
|
462
|
+
### `logger`
|
|
463
|
+
|
|
464
|
+
Built-in modes:
|
|
465
|
+
|
|
466
|
+
- `one-line`
|
|
467
|
+
- `json-line`
|
|
468
|
+
|
|
469
|
+
A custom logger can be loaded through an injection config object whose module exports a function.
|
|
470
|
+
|
|
471
|
+
### `injections`
|
|
472
|
+
|
|
473
|
+
Worker startup injections. Each item is loaded with `require(modulePath)` and called as a factory. The resulting instances are stored on:
|
|
474
|
+
|
|
475
|
+
```ts
|
|
476
|
+
globalThis[Symbol.for('fluxion.injection')]
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
### `workerOptions`
|
|
480
|
+
|
|
481
|
+
Runtime tuning options:
|
|
482
|
+
|
|
483
|
+
```ts
|
|
484
|
+
interface WorkerOptions {
|
|
485
|
+
maxWorkerCount: number;
|
|
486
|
+
requestTimeoutMs: number;
|
|
487
|
+
maxInflight: number;
|
|
488
|
+
memorySoftLimitMb: number;
|
|
489
|
+
memoryHardLimitMb: number;
|
|
490
|
+
memorySampleIntervalMs: number;
|
|
491
|
+
maxOldGenerationSizeMb: number;
|
|
492
|
+
maxYoungGenerationSizeMb: number;
|
|
493
|
+
stackSizeMb: number;
|
|
494
|
+
maxResponseBytes: number;
|
|
495
|
+
}
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
Current implementation uses `maxWorkerCount` for process count and reports CPU/memory telemetry from workers.
|
|
499
|
+
|
|
385
500
|
## Build and Test
|
|
386
501
|
|
|
387
502
|
```bash
|