@gjsify/resolve-npm 0.51.1 → 0.53.0

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.
@@ -40,6 +40,7 @@ export const GJS_GLOBALS_GROUPS = {
40
40
  'atob',
41
41
  'URL',
42
42
  'URLSearchParams',
43
+ 'navigator',
43
44
  ],
44
45
  web: [
45
46
  'fetch',
@@ -79,6 +80,9 @@ export const GJS_GLOBALS_GROUPS = {
79
80
  'KeyboardEvent',
80
81
  'WheelEvent',
81
82
  'FocusEvent',
83
+ 'addEventListener',
84
+ 'removeEventListener',
85
+ 'dispatchEvent',
82
86
  'EventSource',
83
87
  'WebSocket',
84
88
  'WebAssembly',
@@ -118,7 +122,6 @@ export const GJS_GLOBALS_GROUPS = {
118
122
  'FontFace',
119
123
  'matchMedia',
120
124
  'location',
121
- 'navigator',
122
125
  ],
123
126
  };
124
127
 
@@ -142,6 +145,9 @@ export const GJS_GLOBALS_MAP = {
142
145
  structuredClone: '@gjsify/node-globals/register/structured-clone',
143
146
  btoa: '@gjsify/node-globals/register/encoding',
144
147
  atob: '@gjsify/node-globals/register/encoding',
148
+ // Node ≥21 has a DOM-less `navigator`; @gjsify/dom-elements/register/navigator re-exports it.
149
+ navigator: '@gjsify/node-globals/register/navigator',
150
+ Navigator: '@gjsify/node-globals/register/navigator',
145
151
 
146
152
  // --- URL (shared Node + Web) -------------------------------------------
147
153
  URL: '@gjsify/node-globals/register/url',
@@ -199,6 +205,11 @@ export const GJS_GLOBALS_MAP = {
199
205
  KeyboardEvent: 'dom-events/register/ui-events',
200
206
  WheelEvent: 'dom-events/register/ui-events',
201
207
  FocusEvent: 'dom-events/register/ui-events',
208
+ // GJS's global IS a `window` (GJS defines it, non-configurable), so browser branches call
209
+ // `window.addEventListener`; a window is an EventTarget (ADR 0079).
210
+ addEventListener: 'dom-events/register/global-event-target',
211
+ removeEventListener: 'dom-events/register/global-event-target',
212
+ dispatchEvent: 'dom-events/register/global-event-target',
202
213
  EventSource: 'eventsource/register',
203
214
 
204
215
  // --- WebSocket ---------------------------------------------------------
@@ -264,7 +275,6 @@ export const GJS_GLOBALS_MAP = {
264
275
  FontFace: '@gjsify/dom-elements/register/font-face',
265
276
  matchMedia: '@gjsify/dom-elements/register/match-media',
266
277
  location: '@gjsify/dom-elements/register/location',
267
- navigator: '@gjsify/dom-elements/register/navigator',
268
278
 
269
279
  // --- Canvas 2D + IFrame + WebGL (GTK/WebKit-backed DOM classes) --------
270
280
  //
@@ -386,7 +396,7 @@ export const GJS_GI_BACKED_REGISTERS = {
386
396
  * Drawn from `GJS_GLOBALS_GROUPS.web` and `.dom` (every entry there is
387
397
  * browser-native) plus a small set of shared identifiers from `.node`
388
398
  * (`queueMicrotask`, `structuredClone`, `btoa`, `atob`, `URL`,
389
- * `URLSearchParams`, and the unprefixed timer family).
399
+ * `URLSearchParams`, `navigator`/`Navigator`, and the unprefixed timer family).
390
400
  */
391
401
  export const BROWSER_NATIVE_IDENTS = new Set([
392
402
  // Web group — all browser-native
@@ -429,6 +439,9 @@ export const BROWSER_NATIVE_IDENTS = new Set([
429
439
  'KeyboardEvent',
430
440
  'WheelEvent',
431
441
  'FocusEvent',
442
+ 'addEventListener',
443
+ 'removeEventListener',
444
+ 'dispatchEvent',
432
445
  'EventSource',
433
446
  'WebSocket',
434
447
  'WebAssembly',
@@ -467,7 +480,6 @@ export const BROWSER_NATIVE_IDENTS = new Set([
467
480
  'FontFace',
468
481
  'matchMedia',
469
482
  'location',
470
- 'navigator',
471
483
  // Shared Node-group identifiers that are also browser-native
472
484
  'queueMicrotask',
473
485
  'structuredClone',
@@ -475,6 +487,8 @@ export const BROWSER_NATIVE_IDENTS = new Set([
475
487
  'atob',
476
488
  'URL',
477
489
  'URLSearchParams',
490
+ 'navigator',
491
+ 'Navigator',
478
492
  'setTimeout',
479
493
  'setInterval',
480
494
  'clearTimeout',
package/lib/index.mjs CHANGED
@@ -61,7 +61,7 @@ import { getDerivedAliasesSync as _getDerivedAliasesSync } from './runtime-alias
61
61
  * statement (no slot policy duplicated into it), and `aliasPlugin` keeps its
62
62
  * one-hop `skipSelf: true` contract. Composing a table is therefore an
63
63
  * explicit, per-table decision; `ALIASES_NODE_FOR_NATIVESCRIPT` is
64
- * deliberately NOT composed (see the status/open-todos.md entry on the `native` slot's
64
+ * deliberately NOT composed (see the status/open-todos/README.md entry on the `native` slot's
65
65
  * double meaning for the bridge packages).
66
66
  *
67
67
  * Evaluated LAZILY (on property read) and cached: `getDerivedAliasesSync` walks
@@ -424,7 +424,7 @@ export const ALIASES_NODE_FOR_BROWSER = withDerivedSlotRouting(ALIASES_NODE_FOR_
424
424
  * `native` means "the RUNTIME provides it, route to `<pkg>/globals`" — a file
425
425
  * the bridge does not ship, so the composed value degrades to
426
426
  * `@gjsify/empty`. Settle the bridge packages' slot declarations first (see
427
- * status/open-todos.md), then compose. An import by PACKAGE NAME does route
427
+ * status/open-todos/README.md), then compose. An import by PACKAGE NAME does route
428
428
  * per the declared slot (plain key hit in the merged map) — which is why the
429
429
  * bridges are ALREADY emptied on that path today, same TODO.
430
430
  * - **`ws` / `isomorphic-ws` → `@gjsify/empty`.** NS apps use `WebSocket`
@@ -521,6 +521,7 @@ export const ALIASES_WEB_FOR_GJS = {
521
521
  'dom-events/register/event-target': '@gjsify/dom-events/register/event-target',
522
522
  'dom-events/register/custom-events': '@gjsify/dom-events/register/custom-events',
523
523
  'dom-events/register/ui-events': '@gjsify/dom-events/register/ui-events',
524
+ 'dom-events/register/global-event-target': '@gjsify/dom-events/register/global-event-target',
524
525
  'dom-exception/register': '@gjsify/dom-exception/register',
525
526
  'message-channel/register': '@gjsify/message-channel/register',
526
527
  'eventsource/register': '@gjsify/eventsource/register',
@@ -580,6 +581,7 @@ export const ALIASES_GENERAL_FOR_NODE = {
580
581
  '@gjsify/node-globals/register/url': '@gjsify/empty',
581
582
  '@gjsify/node-globals/register/structured-clone': '@gjsify/empty',
582
583
  '@gjsify/node-globals/register/microtask': '@gjsify/empty',
584
+ '@gjsify/node-globals/register/navigator': '@gjsify/empty',
583
585
  '@gjsify/web-globals': '@gjsify/empty',
584
586
  '@gjsify/web-globals/register': '@gjsify/empty',
585
587
  '@gjsify/web-globals/register/performance': '@gjsify/empty',
@@ -661,6 +663,7 @@ export const ALIASES_WEB_FOR_NODE = {
661
663
  'dom-events/register/event-target': '@gjsify/empty',
662
664
  'dom-events/register/custom-events': '@gjsify/empty',
663
665
  'dom-events/register/ui-events': '@gjsify/empty',
666
+ 'dom-events/register/global-event-target': '@gjsify/empty',
664
667
  'dom-exception/register': '@gjsify/empty',
665
668
  'message-channel/register': '@gjsify/empty',
666
669
  'eventsource/register': '@gjsify/empty',
@@ -681,6 +684,7 @@ export const ALIASES_WEB_FOR_NODE = {
681
684
  '@gjsify/dom-events/register/event-target': '@gjsify/empty',
682
685
  '@gjsify/dom-events/register/custom-events': '@gjsify/empty',
683
686
  '@gjsify/dom-events/register/ui-events': '@gjsify/empty',
687
+ '@gjsify/dom-events/register/global-event-target': '@gjsify/empty',
684
688
  '@gjsify/dom-exception/register': '@gjsify/empty',
685
689
  '@gjsify/message-channel/register': '@gjsify/empty',
686
690
  '@gjsify/eventsource/register': '@gjsify/empty',
@@ -202,7 +202,7 @@ export const REGISTER_GLOBALS_CLOSURE = {
202
202
  "setTimeout",
203
203
  "structuredClone"
204
204
  ],
205
- "@gjsify/dom-elements/register/navigator": [
205
+ "@gjsify/dom-elements/register/observers": [
206
206
  "AbortController",
207
207
  "AbortSignal",
208
208
  "Blob",
@@ -218,14 +218,13 @@ export const REGISTER_GLOBALS_CLOSURE = {
218
218
  "WritableStream",
219
219
  "atob",
220
220
  "btoa",
221
- "navigator",
222
221
  "performance",
223
222
  "process",
224
223
  "queueMicrotask",
225
224
  "setTimeout",
226
225
  "structuredClone"
227
226
  ],
228
- "@gjsify/dom-elements/register/observers": [
227
+ "@gjsify/domparser/register": [
229
228
  "AbortController",
230
229
  "AbortSignal",
231
230
  "Blob",
@@ -247,7 +246,7 @@ export const REGISTER_GLOBALS_CLOSURE = {
247
246
  "setTimeout",
248
247
  "structuredClone"
249
248
  ],
250
- "@gjsify/domparser/register": [
249
+ "@gjsify/gamepad/register": [
251
250
  "AbortController",
252
251
  "AbortSignal",
253
252
  "Blob",
@@ -256,6 +255,7 @@ export const REGISTER_GLOBALS_CLOSURE = {
256
255
  "CountQueuingStrategy",
257
256
  "DOMException",
258
257
  "File",
258
+ "Navigator",
259
259
  "ReadableStream",
260
260
  "TextDecoderStream",
261
261
  "TextEncoderStream",
@@ -263,13 +263,16 @@ export const REGISTER_GLOBALS_CLOSURE = {
263
263
  "WritableStream",
264
264
  "atob",
265
265
  "btoa",
266
+ "clearTimeout",
267
+ "dispatchEvent",
268
+ "navigator",
266
269
  "performance",
267
270
  "process",
268
271
  "queueMicrotask",
269
272
  "setTimeout",
270
273
  "structuredClone"
271
274
  ],
272
- "@gjsify/gamepad/register": [
275
+ "@gjsify/iframe/register": [
273
276
  "AbortController",
274
277
  "AbortSignal",
275
278
  "Blob",
@@ -278,6 +281,9 @@ export const REGISTER_GLOBALS_CLOSURE = {
278
281
  "CountQueuingStrategy",
279
282
  "DOMException",
280
283
  "File",
284
+ "HTMLCanvasElement",
285
+ "HTMLIFrameElement",
286
+ "Path2D",
281
287
  "ReadableStream",
282
288
  "TextDecoderStream",
283
289
  "TextEncoderStream",
@@ -285,13 +291,15 @@ export const REGISTER_GLOBALS_CLOSURE = {
285
291
  "WritableStream",
286
292
  "atob",
287
293
  "btoa",
294
+ "clearTimeout",
295
+ "document",
288
296
  "performance",
289
297
  "process",
290
298
  "queueMicrotask",
291
299
  "setTimeout",
292
300
  "structuredClone"
293
301
  ],
294
- "@gjsify/iframe/register": [
302
+ "@gjsify/node-globals/register/buffer": [
295
303
  "AbortController",
296
304
  "AbortSignal",
297
305
  "Blob",
@@ -300,9 +308,6 @@ export const REGISTER_GLOBALS_CLOSURE = {
300
308
  "CountQueuingStrategy",
301
309
  "DOMException",
302
310
  "File",
303
- "HTMLCanvasElement",
304
- "HTMLIFrameElement",
305
- "Path2D",
306
311
  "ReadableStream",
307
312
  "TextDecoderStream",
308
313
  "TextEncoderStream",
@@ -311,14 +316,13 @@ export const REGISTER_GLOBALS_CLOSURE = {
311
316
  "atob",
312
317
  "btoa",
313
318
  "clearTimeout",
314
- "document",
315
319
  "performance",
316
320
  "process",
317
321
  "queueMicrotask",
318
322
  "setTimeout",
319
323
  "structuredClone"
320
324
  ],
321
- "@gjsify/node-globals/register/buffer": [
325
+ "@gjsify/node-globals/register/encoding": [
322
326
  "AbortController",
323
327
  "AbortSignal",
324
328
  "Blob",
@@ -334,14 +338,13 @@ export const REGISTER_GLOBALS_CLOSURE = {
334
338
  "WritableStream",
335
339
  "atob",
336
340
  "btoa",
337
- "clearTimeout",
338
341
  "performance",
339
342
  "process",
340
343
  "queueMicrotask",
341
344
  "setTimeout",
342
345
  "structuredClone"
343
346
  ],
344
- "@gjsify/node-globals/register/encoding": [
347
+ "@gjsify/node-globals/register/microtask": [
345
348
  "AbortController",
346
349
  "AbortSignal",
347
350
  "Blob",
@@ -363,7 +366,7 @@ export const REGISTER_GLOBALS_CLOSURE = {
363
366
  "setTimeout",
364
367
  "structuredClone"
365
368
  ],
366
- "@gjsify/node-globals/register/microtask": [
369
+ "@gjsify/node-globals/register/navigator": [
367
370
  "AbortController",
368
371
  "AbortSignal",
369
372
  "Blob",
@@ -372,6 +375,7 @@ export const REGISTER_GLOBALS_CLOSURE = {
372
375
  "CountQueuingStrategy",
373
376
  "DOMException",
374
377
  "File",
378
+ "Navigator",
375
379
  "ReadableStream",
376
380
  "TextDecoderStream",
377
381
  "TextEncoderStream",
@@ -379,6 +383,8 @@ export const REGISTER_GLOBALS_CLOSURE = {
379
383
  "WritableStream",
380
384
  "atob",
381
385
  "btoa",
386
+ "clearTimeout",
387
+ "navigator",
382
388
  "performance",
383
389
  "process",
384
390
  "queueMicrotask",
@@ -660,6 +666,7 @@ export const REGISTER_GLOBALS_CLOSURE = {
660
666
  "File",
661
667
  "MediaStream",
662
668
  "MediaStreamTrack",
669
+ "Navigator",
663
670
  "ReadableStream",
664
671
  "TextDecoderStream",
665
672
  "TextEncoderStream",
@@ -667,6 +674,8 @@ export const REGISTER_GLOBALS_CLOSURE = {
667
674
  "WritableStream",
668
675
  "atob",
669
676
  "btoa",
677
+ "clearTimeout",
678
+ "navigator",
670
679
  "performance",
671
680
  "process",
672
681
  "queueMicrotask",
@@ -696,6 +705,7 @@ export const REGISTER_GLOBALS_CLOSURE = {
696
705
  "atob",
697
706
  "btoa",
698
707
  "clearTimeout",
708
+ "crypto",
699
709
  "performance",
700
710
  "process",
701
711
  "queueMicrotask",
@@ -794,6 +804,28 @@ export const REGISTER_GLOBALS_CLOSURE = {
794
804
  "setTimeout",
795
805
  "structuredClone"
796
806
  ],
807
+ "dom-events/register/global-event-target": [
808
+ "AbortController",
809
+ "AbortSignal",
810
+ "Blob",
811
+ "Buffer",
812
+ "ByteLengthQueuingStrategy",
813
+ "CountQueuingStrategy",
814
+ "DOMException",
815
+ "File",
816
+ "ReadableStream",
817
+ "TextDecoderStream",
818
+ "TextEncoderStream",
819
+ "TransformStream",
820
+ "WritableStream",
821
+ "atob",
822
+ "btoa",
823
+ "performance",
824
+ "process",
825
+ "queueMicrotask",
826
+ "setTimeout",
827
+ "structuredClone"
828
+ ],
797
829
  "dom-events/register/ui-events": [
798
830
  "AbortController",
799
831
  "AbortSignal",
@@ -434,7 +434,7 @@ function resolveSlot(rec, target) {
434
434
  // in this state, so `--app nativescript` could not build ANY of them,
435
435
  // unnoticed because no CI job built them (`tests/e2e/ns-bridge-bundles`).
436
436
  // The warn-once stays — the DECLARATION is still wrong, and settling
437
- // that vocabulary is its own change (`status/open-todos.md`).
437
+ // that vocabulary is its own change (`status/open-todos/README.md`).
438
438
  warnOnce(
439
439
  `${rec.name}-${target}-native-missing-globals`,
440
440
  `${rec.name} declares runtimes.${target}="native" but ships no globals.mjs — resolving it normally for --app ${target} builds.`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/resolve-npm",
3
- "version": "0.51.1",
3
+ "version": "0.53.0",
4
4
  "description": "Resolve NPM package aliases",
5
5
  "type": "module",
6
6
  "main": "lib/index.mjs",