@gjsify/fetch 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/globals.mjs +17 -0
  2. package/package.json +15 -12
package/globals.mjs ADDED
@@ -0,0 +1,17 @@
1
+ // Re-exports native Fetch API globals for use in Node.js / browser builds.
2
+ // On Node 18+ fetch, Request, Response, Headers and FormData are native
3
+ // globals (the undici-backed implementation is enabled by default). On
4
+ // browsers all five have been native for a decade.
5
+ //
6
+ // The dynamic resolver in `@gjsify/resolve-npm/runtime-aliases.mjs` routes
7
+ // `@gjsify/fetch` here when the package's `gjsify.runtimes` triplet
8
+ // declares the non-GJS slot as `"native"`. The hardcoded bare `fetch`
9
+ // specifier in `ALIASES_WEB_FOR_NODE` previously skipped aliasing on
10
+ // Node entirely (consumers read `globalThis.fetch` directly); now both
11
+ // paths converge on this file.
12
+
13
+ export const fetch = globalThis.fetch;
14
+ export const Request = globalThis.Request;
15
+ export const Response = globalThis.Response;
16
+ export const Headers = globalThis.Headers;
17
+ export const FormData = globalThis.FormData;
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@gjsify/fetch",
3
- "version": "0.4.32",
3
+ "version": "0.4.33",
4
4
  "description": "Web and Node.js fetch module for Gjs",
5
5
  "module": "lib/esm/index.js",
6
6
  "types": "lib/index.d.ts",
7
7
  "files": [
8
- "lib"
8
+ "lib",
9
+ "globals.mjs"
9
10
  ],
10
11
  "type": "module",
11
12
  "exports": {
@@ -22,11 +23,13 @@
22
23
  },
23
24
  "./register/xhr": {
24
25
  "default": "./lib/esm/register/xhr.js"
25
- }
26
+ },
27
+ "./globals": "./globals.mjs"
26
28
  },
27
29
  "sideEffects": [
28
30
  "./lib/esm/register.js",
29
- "./lib/esm/register/*.js"
31
+ "./lib/esm/register/*.js",
32
+ "./globals.mjs"
30
33
  ],
31
34
  "scripts": {
32
35
  "clear": "rm -rf lib tsconfig.tsbuildinfo tsconfig.types.tsbuildinfo test.gjs.mjs test.node.mjs || exit 0",
@@ -48,8 +51,8 @@
48
51
  "fetch"
49
52
  ],
50
53
  "devDependencies": {
51
- "@gjsify/cli": "^0.4.32",
52
- "@gjsify/unit": "^0.4.32",
54
+ "@gjsify/cli": "^0.4.33",
55
+ "@gjsify/unit": "^0.4.33",
53
56
  "@types/node": "^25.9.1",
54
57
  "typescript": "^6.0.3"
55
58
  },
@@ -58,16 +61,16 @@
58
61
  "@girs/gjs": "4.0.1",
59
62
  "@girs/glib-2.0": "2.88.0-4.0.1",
60
63
  "@girs/soup-3.0": "3.6.6-4.0.1",
61
- "@gjsify/formdata": "^0.4.32",
62
- "@gjsify/http": "^0.4.32",
63
- "@gjsify/url": "^0.4.32",
64
- "@gjsify/utils": "^0.4.32"
64
+ "@gjsify/formdata": "^0.4.33",
65
+ "@gjsify/http": "^0.4.33",
66
+ "@gjsify/url": "^0.4.33",
67
+ "@gjsify/utils": "^0.4.33"
65
68
  },
66
69
  "gjsify": {
67
70
  "runtimes": {
68
71
  "gjs": "polyfill",
69
- "node": "none",
70
- "browser": "none"
72
+ "node": "native",
73
+ "browser": "native"
71
74
  }
72
75
  }
73
76
  }