@gjsify/resolve-npm 0.3.3 → 0.3.5
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/lib/globals-map.mjs +9 -0
- package/lib/index.mjs +16 -0
- package/package.json +1 -1
package/lib/globals-map.mjs
CHANGED
|
@@ -46,6 +46,7 @@ export const GJS_GLOBALS_GROUPS = {
|
|
|
46
46
|
'MouseEvent', 'PointerEvent', 'KeyboardEvent', 'WheelEvent', 'FocusEvent',
|
|
47
47
|
'EventSource',
|
|
48
48
|
'WebSocket',
|
|
49
|
+
'WebAssembly',
|
|
49
50
|
'DOMException',
|
|
50
51
|
'performance', 'PerformanceObserver',
|
|
51
52
|
'XMLHttpRequest',
|
|
@@ -144,6 +145,14 @@ export const GJS_GLOBALS_MAP = {
|
|
|
144
145
|
// runs first installs it; both guard with typeof === 'undefined'.
|
|
145
146
|
WebSocket: 'websocket/register',
|
|
146
147
|
|
|
148
|
+
// --- WebAssembly Promise APIs ------------------------------------------
|
|
149
|
+
// Reach via marker (see METHOD_MARKERS in detect-free-globals.ts):
|
|
150
|
+
// bare `WebAssembly.compile(...)` / `.instantiate(...)` etc. trigger
|
|
151
|
+
// injection of the Promise polyfill. The synchronous `new WebAssembly.{Module,Instance}`
|
|
152
|
+
// path also free-references `WebAssembly` and ends up here, but the
|
|
153
|
+
// register module is a no-op when the natives already work.
|
|
154
|
+
WebAssembly: 'webassembly/register/promise',
|
|
155
|
+
|
|
147
156
|
// --- Performance -------------------------------------------------------
|
|
148
157
|
performance: '@gjsify/web-globals/register/performance',
|
|
149
158
|
PerformanceObserver: '@gjsify/web-globals/register/performance',
|
package/lib/index.mjs
CHANGED
|
@@ -228,6 +228,13 @@ export const ALIASES_WEB_FOR_GJS = {
|
|
|
228
228
|
'webrtc/register/error': '@gjsify/webrtc/register/error',
|
|
229
229
|
'webrtc/register/media': '@gjsify/webrtc/register/media',
|
|
230
230
|
'webrtc/register/media-devices': '@gjsify/webrtc/register/media-devices',
|
|
231
|
+
|
|
232
|
+
// WebAssembly Promise APIs polyfill — wraps the synchronous Module/Instance
|
|
233
|
+
// constructors so WebAssembly.{compile,instantiate,validate,...} resolve
|
|
234
|
+
// instead of throwing the SpiderMonkey 128 stub error.
|
|
235
|
+
'webassembly': '@gjsify/webassembly',
|
|
236
|
+
'webassembly/register': '@gjsify/webassembly/register',
|
|
237
|
+
'webassembly/register/promise': '@gjsify/webassembly/register/promise',
|
|
231
238
|
}
|
|
232
239
|
|
|
233
240
|
/** General record of modules for Node */
|
|
@@ -356,4 +363,13 @@ export const ALIASES_WEB_FOR_NODE = {
|
|
|
356
363
|
'@gjsify/webrtc/register/error': '@gjsify/empty',
|
|
357
364
|
'@gjsify/webrtc/register/media': '@gjsify/empty',
|
|
358
365
|
'@gjsify/webrtc/register/media-devices': '@gjsify/empty',
|
|
366
|
+
|
|
367
|
+
// WebAssembly Promise APIs — native on Node (no polyfill needed); the
|
|
368
|
+
// bare `webassembly` specifier maps to /globals so consumers can import
|
|
369
|
+
// typed helpers without dragging the polyfill into the bundle.
|
|
370
|
+
'webassembly': '@gjsify/webassembly/globals',
|
|
371
|
+
'webassembly/register': '@gjsify/empty',
|
|
372
|
+
'webassembly/register/promise': '@gjsify/empty',
|
|
373
|
+
'@gjsify/webassembly/register': '@gjsify/empty',
|
|
374
|
+
'@gjsify/webassembly/register/promise': '@gjsify/empty',
|
|
359
375
|
}
|