@gjsify/resolve-npm 0.4.32 → 0.4.33

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.
Files changed (2) hide show
  1. package/lib/index.mjs +25 -7
  2. package/package.json +1 -1
package/lib/index.mjs CHANGED
@@ -279,15 +279,33 @@ export const ALIASES_WEB_FOR_NODE = {
279
279
  // Bare specifiers → native re-exports (works for both named and side-effect imports)
280
280
  'abort-controller': '@gjsify/abort-controller/globals',
281
281
  'compression-streams': '@gjsify/compression-streams/globals',
282
- 'dom-events': '@gjsify/dom-events/globals',
282
+ // dom-events deliberately routes to the polyfill on Node — globals.mjs
283
+ // is browser-targeted (re-exports the full lib.dom event class hierarchy
284
+ // from globalThis), but Node 22 only ships Event/EventTarget/CustomEvent
285
+ // natively (no UIEvent / MouseEvent / KeyboardEvent / WheelEvent /
286
+ // PointerEvent / InputEvent / FocusEvent / …). Routing the bare specifier
287
+ // to the polyfill keeps the full class hierarchy available on Node; the
288
+ // polyfill subclasses native Event/EventTarget where present and supplies
289
+ // the rest. The `/globals` path remains reachable for browser builds via
290
+ // the dynamic per-runtimes-triplet resolver in `runtime-aliases.mjs`.
291
+ 'dom-events': '@gjsify/dom-events',
283
292
  'dom-exception': '@gjsify/dom-exception/globals',
284
293
  'message-channel': '@gjsify/message-channel/globals',
285
- 'eventsource': '@gjsify/eventsource/globals',
286
- // 'fetch' bare specifier is intentionally not aliased on Node:
287
- // fetch/Headers/Request/Response/FormData are native globals since Node 18,
288
- // so specs / app code should read them off globalThis. Users who need the
289
- // value form should `import { fetch } from '@gjsify/fetch'` explicitly.
290
- // 'fetch': '@gjsify/fetch/globals',
294
+ // eventsource deliberately routes to the polyfill on Node — globals.mjs
295
+ // re-exports `globalThis.EventSource`, but Node 24.x doesn't ship native
296
+ // EventSource at all (added experimentally in 22.3, requires the
297
+ // --experimental-eventsource flag on many distributions). The polyfill
298
+ // itself uses `fetch` + ReadableStream both native on Node 18+ — and
299
+ // works without any GJS deps; routing to it gives consumers a working
300
+ // EventSource on Node out of the box. Same fix pattern as the `dom-events`
301
+ // entry above.
302
+ 'eventsource': '@gjsify/eventsource',
303
+ // 'fetch' routes to @gjsify/fetch/globals on Node — the globals.mjs
304
+ // re-exports the native globalThis.{fetch,Request,Response,Headers,
305
+ // FormData} as named exports. The dynamic resolver routes
306
+ // @gjsify/fetch to the same /globals subpath via its runtimes
307
+ // triplet declaration (`node:"native"`), so both entry forms converge.
308
+ 'fetch': '@gjsify/fetch/globals',
291
309
  'formdata': '@gjsify/formdata/globals',
292
310
  'html-image-element': '@gjsify/html-image-element',
293
311
  'webcrypto': '@gjsify/webcrypto/globals',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/resolve-npm",
3
- "version": "0.4.32",
3
+ "version": "0.4.33",
4
4
  "description": "Resolve NPM package aliases",
5
5
  "type": "module",
6
6
  "main": "lib/index.mjs",