@gjsify/browser-node-polyfills 0.5.1
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/README.md +32 -0
- package/globals.mjs +21 -0
- package/package.json +58 -0
package/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# @gjsify/browser-node-polyfills
|
|
2
|
+
|
|
3
|
+
Browser-targeted aggregation of `@gjsify` Node.js polyfills. It is the browser counterpart to `@gjsify/node-polyfills`: an umbrella package that pulls in the subset of `@gjsify/*` Node.js polyfills that ship a browser-runnable build (assert, buffer, crypto, events, fs, http, path, stream, and more). Importing `@gjsify/browser-node-polyfills/globals` installs all contributing polyfills onto `globalThis` at once.
|
|
4
|
+
|
|
5
|
+
Part of the [gjsify](https://github.com/gjsify/gjsify) project — Node.js and Web APIs for GJS (GNOME JavaScript).
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
gjsify install @gjsify/browser-node-polyfills
|
|
11
|
+
|
|
12
|
+
# npm or yarn also work (e.g. adding it to an existing project):
|
|
13
|
+
npm install @gjsify/browser-node-polyfills
|
|
14
|
+
yarn add @gjsify/browser-node-polyfills
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
// Side-effect import — registers all contributing polyfills on globalThis
|
|
21
|
+
import '@gjsify/browser-node-polyfills/globals';
|
|
22
|
+
|
|
23
|
+
// Buffer is now available globally in the browser bundle
|
|
24
|
+
const buf = Buffer.from('hello');
|
|
25
|
+
console.log(buf.toString('hex'));
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
This package is primarily used by `create-app` templates and CLI scaffolds to bring a complete Node.js API surface to browser bundles. Individual polyfills can also be imported directly from their own packages.
|
|
29
|
+
|
|
30
|
+
## License
|
|
31
|
+
|
|
32
|
+
MIT
|
package/globals.mjs
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Meta package — `@gjsify/browser-node-polyfills` umbrella aggregator for the
|
|
3
|
+
* subset of `@gjsify/*` Node.js polyfills that ship a browser-runnable build.
|
|
4
|
+
*
|
|
5
|
+
* Browser-side side-effect entrypoint. Mirrors the `globals.mjs` contract
|
|
6
|
+
* documented in AGENTS.md `## Tree-shakeable globals — /register subpath
|
|
7
|
+
* convention`: every dependency below contributes a `/register` subpath that
|
|
8
|
+
* installs the polyfill onto `globalThis` (Buffer, Blob, File, …). Importing
|
|
9
|
+
* this module is equivalent to importing every contributing `/register`
|
|
10
|
+
* side-effect at once — convenient for browser-build smoke tests and the
|
|
11
|
+
* `tests/browser/` Playwright harness.
|
|
12
|
+
*
|
|
13
|
+
* Today only `@gjsify/buffer/register` is wired here. As the per-package
|
|
14
|
+
* browser polyfill wave (PRs #392 – #396, plus follow-ups) lands additional
|
|
15
|
+
* `/register` granular subpaths on `@gjsify/{process,timers,console,…}`,
|
|
16
|
+
* append the corresponding side-effect imports below. Each entry MUST be
|
|
17
|
+
* idempotent (`if (typeof globalThis.X === 'undefined')` guard inside the
|
|
18
|
+
* register module) — this aggregator is safe to import twice.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import '@gjsify/buffer/register';
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gjsify/browser-node-polyfills",
|
|
3
|
+
"version": "0.5.1",
|
|
4
|
+
"description": "Meta package: @gjsify Node.js polyfill packages that run in the browser",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"gjs",
|
|
8
|
+
"gjsify",
|
|
9
|
+
"node",
|
|
10
|
+
"browser",
|
|
11
|
+
"polyfills",
|
|
12
|
+
"meta"
|
|
13
|
+
],
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@gjsify/assert": "^0.5.0",
|
|
16
|
+
"@gjsify/async_hooks": "^0.5.0",
|
|
17
|
+
"@gjsify/buffer": "^0.5.0",
|
|
18
|
+
"@gjsify/console": "^0.5.0",
|
|
19
|
+
"@gjsify/constants": "^0.5.0",
|
|
20
|
+
"@gjsify/crypto": "^0.5.0",
|
|
21
|
+
"@gjsify/diagnostics_channel": "^0.5.0",
|
|
22
|
+
"@gjsify/domain": "^0.5.0",
|
|
23
|
+
"@gjsify/events": "^0.5.0",
|
|
24
|
+
"@gjsify/fs": "^0.5.0",
|
|
25
|
+
"@gjsify/http": "^0.5.0",
|
|
26
|
+
"@gjsify/https": "^0.5.0",
|
|
27
|
+
"@gjsify/module": "^0.5.0",
|
|
28
|
+
"@gjsify/os": "^0.5.0",
|
|
29
|
+
"@gjsify/path": "^0.5.0",
|
|
30
|
+
"@gjsify/perf_hooks": "^0.5.0",
|
|
31
|
+
"@gjsify/process": "^0.5.0",
|
|
32
|
+
"@gjsify/querystring": "^0.5.0",
|
|
33
|
+
"@gjsify/sqlite": "^0.5.0",
|
|
34
|
+
"@gjsify/stream": "^0.5.0",
|
|
35
|
+
"@gjsify/string_decoder": "^0.5.0",
|
|
36
|
+
"@gjsify/sys": "^0.5.0",
|
|
37
|
+
"@gjsify/timers": "^0.5.0",
|
|
38
|
+
"@gjsify/url": "^0.5.0",
|
|
39
|
+
"@gjsify/util": "^0.5.0",
|
|
40
|
+
"@gjsify/vm": "^0.5.0",
|
|
41
|
+
"@gjsify/worker_threads": "^0.5.0",
|
|
42
|
+
"@gjsify/zlib": "^0.5.0"
|
|
43
|
+
},
|
|
44
|
+
"gjsify": {
|
|
45
|
+
"runtimes": {
|
|
46
|
+
"gjs": "polyfill",
|
|
47
|
+
"node": "native",
|
|
48
|
+
"browser": "polyfill",
|
|
49
|
+
"nativescript": "polyfill"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"exports": {
|
|
53
|
+
"./globals": "./globals.mjs"
|
|
54
|
+
},
|
|
55
|
+
"files": [
|
|
56
|
+
"globals.mjs"
|
|
57
|
+
]
|
|
58
|
+
}
|