Commit Graph

15199 Commits

Author SHA1 Message Date
italo jose
aa92b92a2b Meteor version to 3.5-beta.7 ☄️ 2026-03-12 13:48:08 -03:00
italo jose
19992de576 chore: update bundle and rate-limit package versions 2026-03-12 11:13:37 -03:00
Italo José
bf3f82cd5a Merge pull request #14205 from mvogttech/ejson-optimize_equals
perf(ejson): early bail-out on key count mismatch in EJSON.equals
2026-03-12 10:50:25 -03:00
Italo José
f5e1bdbc48 Merge pull request #14197 from mvogttech/accounts-base-optional-chaining
refactor(accounts-base): use optional chaining for callbacks
2026-03-12 10:44:52 -03:00
Italo José
f7ccf32942 Merge branch 'release-3.5' into feature/real-disable-sockjs 2026-03-12 09:53:06 -03:00
Italo José
9d847aa718 Merge branch 'release-3.5' into fix_ddp_client_for_mirror_domains 2026-03-11 18:01:25 -03:00
Italo José
ac43aa3be1 Merge branch 'release-3.5' into accounts-base-optional-chaining 2026-03-11 17:58:50 -03:00
Italo José
aacd556228 Merge branch 'release-3.5' into feature/real-disable-sockjs 2026-03-11 17:57:15 -03:00
Italo José
932d3a9006 Merge pull request #14021 from OleksandrChekhovskyi/fix-minimongo-forEachAsync-and-mapAsync
Fix forEachAsync and mapAsync behavior in minimongo to match the server
2026-03-11 17:46:29 -03:00
italo jose
e3606b55cb Meteor version to 3.5-beta.6 ☄️ 2026-03-10 13:47:43 -03:00
Italo José
45adcf7903 Merge pull request #14217 from meteor/changeStream/reactivity-order
[3.5] set changeStreams as dafault reactivity mechanism
2026-03-10 11:15:07 -03:00
Italo José
a90cf8d1d3 Merge pull request #14201 from mvogttech/accounts-base-registerLinkCallback
refactor(accounts-base): DRY link callback registration methods
2026-03-10 11:13:58 -03:00
italo jose
f5a64d1391 edit reactivity order 2026-03-10 11:13:02 -03:00
Italo José
90e7b32bf1 Merge pull request #14209 from mvogttech/ejson-optimize_toJSONValues
perf(ejson): copy-on-write toJSONValue/fromJSONValue to reduce alloca…
2026-03-10 10:48:28 -03:00
Italo José
cb5c9e757d Merge pull request #14196 from mvogttech/hasOwnProperty-removal
refactor(accounts-base): replace hasOwnProperty.call with Object.hasOwn
2026-03-10 10:45:22 -03:00
Italo José
c20c4a5d19 Merge pull request #14198 from mvogttech/accounts-base-spread-refactor
refactor(accounts-base): use spread operator instead of .push.apply()
2026-03-10 10:45:02 -03:00
Italo José
2b6570058d Merge pull request #14200 from mvogttech/accounts-base-replace_arguments_implicit
refactor(accounts-base): use rest params instead of arguments object
2026-03-10 10:43:27 -03:00
Italo José
9dbc7cd2fe Merge branch 'release-3.5' into accounts-base-registerLinkCallback 2026-03-10 10:42:49 -03:00
Italo José
28a4fd220f Merge branch 'release-3.5' into fix-minimongo-forEachAsync-and-mapAsync 2026-03-10 10:01:25 -03:00
dupontbertrand
122e81c4a0 Revert version bumps and add tests for DISABLE_SOCKJS mode
Revert ddp-server (3.1.3→3.1.2) and socket-stream-client (0.6.2→0.6.1)
version bumps per reviewer request. Add server-side tests covering both
SockJS and raw WebSocket transports: DDP connectivity, method calls,
HTTP rejection on /websocket, /sockjs/info availability, and connection
shape validation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 01:17:39 +01:00
alexta
2ac9cc4615 apply review comments 2026-03-10 00:58:43 +03:00
Italo José
51523a11b1 Merge pull request #14208 from mvogttech/ejson-optimize_equals_check_order
perf(ejson): fast-path primitive comparisons in EJSON.equals
2026-03-09 15:26:56 -03:00
Italo José
0270cbb54d Merge branch 'release-3.5' into ejson-optimize_toJSONValues 2026-03-09 15:22:43 -03:00
Michael Vogt
2dde09404d EJSON copy-on-write tests 2026-03-09 11:06:51 -05:00
Michael Vogt
e5ee99e71c add early exit tests 2026-03-09 09:33:42 -05:00
Michael Vogt
59277e7f67 perf(ejson): copy-on-write toJSONValue/fromJSONValue to reduce allocations 2026-03-08 22:24:40 -05:00
Michael Vogt
18164ec0ae perf(ejson): fast-path primitive comparisons in EJSON.equals 2026-03-08 21:55:48 -05:00
dupontbertrand
37c949840e Merge branch 'devel' into feature/real-disable-sockjs 2026-03-08 16:00:29 +01:00
dupontbertrand
939edf1fea Make DISABLE_SOCKJS=1 fully functional end-to-end (client + server)
Context:
PR #12007 (Meteor 2.7.2) introduced the DISABLE_SOCKJS env var but only
implemented the client side: switching new SockJS() → new WebSocket().
The server continued to create a SockJS server, install HTTP handlers,
and serve /sockjs/info. The flag was effectively a half-measure.

This has been a recurring community pain point:
- forums.meteor.com/t/state-of-sockjs-in-meteor/51841 — SockJS is a
  copy-fork of v0.3.4 from 2012, bundled unconditionally (57 KB)
- Previous attempts at conditional loading (PRs #9353, #9985) were
  reverted due to dynamic-import issues
- PR #14190 proposes uWebSockets as alternative, but adds a new runtime
  dependency and a separate port — our approach is simpler

What this commit does:

1. Server (ddp-server/stream_server.js):
   - Extract _onConnection() into a shared method (was inline in constructor)
   - Move SockJS setup into _setupSockJS() (code moved verbatim)
   - Add _setupRawWebSocket() for DISABLE_SOCKJS=1 mode:
     * Uses faye-websocket (already a transitive dep via SockJS) to handle
       WebSocket upgrades on /websocket
     * RawWebSocketConnection class wraps faye-websocket with the same
       interface as SockJS connections (headers, send/write/close,
       setWebsocketTimeout, _session.recv.connection, EventEmitter events)
     * Takes over 'upgrade' listeners (same pattern as SockJS's
       overshadowListeners) and delegates non-/websocket upgrades to
       existing handlers (HMR, etc.)
     * Rejects plain HTTP to /websocket with 400 "Not a valid websocket
       request" (same behavior as SockJS mode)
   - Guard setWebsocketTimeout and send with if(!socket.X) checks so
     RawWebSocketConnection's own implementations aren't overwritten

2. Client (socket-stream-client/browser.js):
   - Replace static `import SockJS from "./sockjs-1.6.1-min-.js"` with
     dynamic `import()` inside _launchConnection()
   - SockJS (57 KB) is now a lazy chunk, only fetched when needed
   - When DISABLE_SOCKJS=1: native WebSocket, zero SockJS code loaded
   - _launchConnection() becomes async (fire-and-forget from constructor
     and _retryNow — safe, no callers await it)

3. Dependencies (ddp-server/package.js):
   - Add faye-websocket 0.11.4 as explicit Npm dependency (was already
     a transitive dep of sockjs; now needed directly for raw WS mode)

What is NOT changed:
- Default behavior (without DISABLE_SOCKJS) is 100% identical
- No code modernization on untouched lines (var style preserved)
- No test modifications — all 44 existing tinytests pass in both modes
- register(), all_sockets(), _redirectWebsocketEndpoint() untouched

Benchmarks (production build, Chrome, localhost):

  DDP connection time:
  - Hard refresh / first load: ~300ms WITH vs ~253ms WITHOUT
    (modest difference — both must load and parse all JS)
  - Warm refreshes: ~300ms WITH vs ~150ms WITHOUT — 2x faster
    The 300ms floor WITH SockJS is structural: SockJS always makes
    a /sockjs/info XHR before opening the WebSocket. This roundtrip
    happens on every connection, even with cached assets. Without
    SockJS, the WebSocket connects directly — no pre-flight, no
    transport negotiation.

  Bundle size:
  - Main JS bundle: 152 KB raw (identical in both modes)
  - SockJS dynamic chunk: 56 KB raw / ~16 KB gzip — only loaded
    in default mode, completely absent with DISABLE_SOCKJS=1
  - Net savings: 1 fewer JS chunk + 1 fewer XHR (/sockjs/info)

  Network tab (WITH → WITHOUT):
  - /sockjs/info?t=... XHR (0.4 KB) → gone
  - /sockjs/010/<session>/websocket → /websocket (direct)
  - dynamic-import fetch for SockJS chunk → gone

  WITH SockJS (10 runs):  300, 300, 301, 300, 300, 300, 302, 300, 300, 300 ms
  WITHOUT SockJS (11 runs): 253, 151, 150, 150, 145, 150, 153, 188, 163, 149, 164 ms

Tested:
- Tinytests: 44/44 pass WITH SockJS, WITHOUT SockJS,
  and WITHOUT + ROOT_URL_PATH_PREFIX
- HMR: works correctly in DISABLE_SOCKJS mode
- Fresh Blaze apps: clean operation in both modes, clean Network tab

Note: package.js version bumps (ddp-server 3.0.3→3.1.3,
socket-stream-client 0.5.3→0.6.2) are provisional — core team
should verify and adjust for the target release.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 14:57:16 +01:00
Michael Vogt
6835e78280 perf(ejson): early bail-out on key count mismatch in EJSON.equals 2026-03-07 22:25:03 -06:00
alexta
6f151840a8 review 2026-03-07 10:26:37 +03:00
alexta
4d43fc63ac add tests 2026-03-07 10:22:36 +03:00
alexta
ac7bb465a0 Merge branch 'release-3.5' into fix_ddp_client_for_mirror_domains 2026-03-07 09:59:12 +03:00
9Morello
ab7126a8de Merge branch 'release-3.5' into refactor-ddp-rate-limiter-to-support-async-rule-matchers 2026-03-06 21:46:32 -03:00
Michael Vogt
3417f0e80b Fixed tests by defaulting both args to [] when not provided 2026-03-06 16:16:57 -06:00
Michael Vogt
944a95b106 add JSDoc comment for consistency 2026-03-06 14:29:53 -06:00
Michael Vogt
a25a233c39 refactor(accounts-base): DRY link callback registration methods 2026-03-06 14:20:27 -06:00
Italo José
c6e752b355 Merge branch 'release-3.5' into fix-minimongo-forEachAsync-and-mapAsync 2026-03-06 17:12:06 -03:00
Michael Vogt
d110a490c4 refactor(accounts-base): use rest params instead of arguments object 2026-03-06 14:10:35 -06:00
Michael Vogt
9c8cbea78e refactor(accounts-base): use spread operator instead of .push.apply() 2026-03-06 14:01:14 -06:00
Michael Pfeiffer
720567f88b Merge branch 'meteor:devel' into accounts-base-optional-chaining 2026-03-06 13:50:29 -06:00
Michael Vogt
310904767d refactor(accounts-base): use optional chaining for callbacks 2026-03-06 13:49:54 -06:00
Italo José
80f5149e92 Merge branch 'release-3.5' into fix-minimongo-forEachAsync-and-mapAsync 2026-03-06 16:43:50 -03:00
Michael Vogt
8364aa87b7 refactor(accounts-base): replace hasOwnProperty.call with Object.hasOwn 2026-03-06 13:43:46 -06:00
Italo José
298193543a Merge branch 'release-3.5' into fix/email-example 2026-03-06 16:43:32 -03:00
Italo José
6386d9115d Merge branch 'release-3.5' into refactor-ddp-rate-limiter-to-support-async-rule-matchers 2026-03-06 16:12:16 -03:00
Italo José
15ab49a1e5 Merge branch 'release-3.5' into fix/email-example 2026-03-06 16:11:20 -03:00
Italo José
cfb8bbe44e Merge branch 'release-3.5' into fix-minimongo-forEachAsync-and-mapAsync 2026-03-06 16:11:15 -03:00
Italo José
e9f0e19d5e Merge branch 'release-3.5' into feature/ddp-resumptions-rebased 2026-03-06 15:56:52 -03:00
Italo José
7c7368e704 Merge branch 'devel' into release-3.5 2026-03-06 15:41:14 -03:00