@morojs/engine 1.1.1 → 1.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.
package/README.md CHANGED
@@ -64,6 +64,7 @@ optional-dependency lockfile bug ([npm/cli#4828](https://github.com/npm/cli/issu
64
64
  | `@morojs/engine-linux-x64-gnu` | linux | x64 | glibc |
65
65
  | `@morojs/engine-linux-arm64-gnu` | linux | arm64 | glibc |
66
66
  | `@morojs/engine-linux-x64-musl` | linux | x64 | musl |
67
+ | `@morojs/engine-linux-arm64-musl` | linux | arm64 | musl |
67
68
 
68
69
  Node ABIs: 115/127/131/137/141/147 (Node 20/22/23/24/25/26). Any other
69
70
  platform/ABI (including Windows, until an MSVC build lands) falls back to
package/index.d.ts CHANGED
@@ -7,7 +7,8 @@ export interface EngineCapabilities {
7
7
  limits: boolean;
8
8
  /** In-process TLS termination via ServeOptions.ssl. */
9
9
  tls: boolean;
10
- /** ALPN-negotiated HTTP/2 alongside HTTP/1.1 via ServeOptions.http2. */
10
+ /** ALPN-negotiated HTTP/2 alongside HTTP/1.1 — reserved for a future
11
+ * release; not yet configurable (no ServeOptions field). */
11
12
  http2: boolean;
12
13
  /** WebSocket permessage-deflate (RFC 7692) via ServeOptions.wsDeflate. */
13
14
  wsDeflate: boolean;
@@ -98,6 +99,11 @@ export interface ServeOptions {
98
99
  ca?: string | ArrayBuffer | Uint8Array;
99
100
  /** Decrypts an encrypted private key */
100
101
  passphrase?: string;
102
+ /** Session-ticket keys, Node tls.Server-compatible: exactly 48 bytes
103
+ * (16-byte key name + 16-byte HMAC secret + 16-byte AES key). Share the
104
+ * same buffer across reusePort workers / processes so TLS sessions
105
+ * resume across all of them. Rotation is the caller's job. */
106
+ ticketKeys?: string | ArrayBuffer | Uint8Array;
101
107
  /** Protocol floor. Default 'TLSv1.2'. */
102
108
  minVersion?: 'TLSv1.2' | 'TLSv1.3';
103
109
  /** Request a client certificate (mutual TLS) */
@@ -119,6 +125,15 @@ export interface ServeOptions {
119
125
  /** Hard cap on an inflated message (zip-bomb defense).
120
126
  * Default: wsMaxMessageSize. */
121
127
  maxDecompressedSize?: number;
128
+ /** Share ONE server-owned deflate stream (reset per message) across
129
+ * all permessage-deflate connections instead of ~262 KB of deflate
130
+ * state per connection. Trades per-message compression ratio (no
131
+ * cross-message context) for memory; forces
132
+ * server_no_context_takeover in the negotiated response (RFC 7692
133
+ * §7.1.1.1 permits this even when the client didn't offer it).
134
+ * Clients that cap server_max_window_bits below serverMaxWindowBits
135
+ * fall back to a per-connection compressor. Default false. */
136
+ sharedCompressor?: boolean;
122
137
  };
123
138
  }
124
139
 
package/index.js CHANGED
@@ -21,11 +21,25 @@ const { version: ENGINE_VERSION } = require('./package.json');
21
21
 
22
22
  function libcSuffix() {
23
23
  if (process.platform !== 'linux') return '';
24
+ // Fast path: Alpine (by far the common musl host) marks itself on disk —
25
+ // far cheaper than generating a process report.
26
+ if (existsSync('/etc/alpine-release')) return '-musl';
24
27
  // glibc exposes its version in the process report; musl does not. When the
25
28
  // report API is unavailable entirely, assume glibc (the overwhelmingly
26
29
  // common case) rather than musl.
27
30
  try {
28
- const report = process.report && process.report.getReport();
31
+ let report = null;
32
+ if (process.report) {
33
+ // Skip env serialization while generating the report — we only need the
34
+ // header — then restore whatever the app had configured.
35
+ const prevExcludeEnv = process.report.excludeEnv;
36
+ process.report.excludeEnv = true;
37
+ try {
38
+ report = process.report.getReport();
39
+ } finally {
40
+ process.report.excludeEnv = prevExcludeEnv;
41
+ }
42
+ }
29
43
  if (!report) return '-gnu';
30
44
  if (report.header && report.header.glibcVersionRuntime) return '-gnu';
31
45
  return '-musl';
@@ -126,5 +140,14 @@ module.exports = new Proxy(
126
140
  const binding = loadBinding();
127
141
  return binding[prop];
128
142
  },
143
+ has(target, prop) {
144
+ // Keep `in` consistent with the get trap (so `'serve' in engine` works
145
+ // for feature detection) without forcing a native load: `then` and
146
+ // symbols read as undefined there, so report them absent here; every
147
+ // other string key is served from the binding on first touch.
148
+ if (prop in target) return true;
149
+ if (typeof prop === 'symbol' || prop === 'then') return false;
150
+ return typeof prop === 'string';
151
+ },
129
152
  }
130
153
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morojs/engine",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "MoroJS native HTTP engine - Moro-authored C++ core with per-platform prebuilt binaries and automatic Node.js fallback in MoroJS",
5
5
  "license": "MIT",
6
6
  "author": "CM Ventures Inc.",
@@ -38,12 +38,13 @@
38
38
  "provenance": true
39
39
  },
40
40
  "optionalDependencies": {
41
- "@morojs/engine-darwin-arm64": "1.1.1",
42
- "@morojs/engine-darwin-x64": "1.1.1",
43
- "@morojs/engine-linux-x64-gnu": "1.1.1",
44
- "@morojs/engine-linux-arm64-gnu": "1.1.1",
45
- "@morojs/engine-linux-x64-musl": "1.1.1",
46
- "@morojs/engine-win32-x64": "1.1.1"
41
+ "@morojs/engine-darwin-arm64": "1.1.3",
42
+ "@morojs/engine-darwin-x64": "1.1.3",
43
+ "@morojs/engine-linux-x64-gnu": "1.1.3",
44
+ "@morojs/engine-linux-arm64-gnu": "1.1.3",
45
+ "@morojs/engine-linux-x64-musl": "1.1.3",
46
+ "@morojs/engine-linux-arm64-musl": "1.1.3",
47
+ "@morojs/engine-win32-x64": "1.1.3"
47
48
  },
48
49
  "keywords": [
49
50
  "morojs",