@peachy/polyfills 0.0.12

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 ADDED
@@ -0,0 +1,23 @@
1
+ # @peachy/polyfills
2
+
3
+ This package includes polyfills for modern JavaScript features to GJS.
4
+
5
+ ## Usage
6
+
7
+ Import the polyfill package at the top of your entry file (usually `src/index.ts` or `src/index.js`).
8
+
9
+ ```js
10
+ // This will load all polyfills
11
+ import "@peachy/polyfills";
12
+
13
+ // you can also import individual polyfills
14
+ import "@peachy/polyfills/performance";
15
+ ```
16
+
17
+ ## Available Polyfills
18
+
19
+ ### Performance/High Resolution Time
20
+
21
+ Docs: https://developer.mozilla.org/en-US/docs/Web/API/Performance
22
+
23
+ For now, only `performance.now()` is supported.
@@ -0,0 +1 @@
1
+ export { };
package/dist/index.mjs ADDED
@@ -0,0 +1,2 @@
1
+ import "./performance.mjs";
2
+ export {};
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,11 @@
1
+ import GLib from "gi://GLib?version=2.0";
2
+ //#region src/performance.ts
3
+ if ("performance" in globalThis == false) globalThis.performance = {};
4
+ if ("now" in globalThis.performance == false) {
5
+ var nowOffset = GLib.get_monotonic_time();
6
+ globalThis.performance.now = function now() {
7
+ return GLib.get_monotonic_time() - nowOffset;
8
+ };
9
+ }
10
+ //#endregion
11
+ export {};
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@peachy/polyfills",
3
+ "version": "0.0.12",
4
+ "description": "Polyfills for Peachy",
5
+ "license": "MIT",
6
+ "author": "Angelo Verlain <hey@vixalien.com>",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "main": "./dist/index.mjs",
11
+ "exports": {
12
+ ".": {
13
+ "import": "./dist/index.mjs",
14
+ "types": "./dist/index.d.mts"
15
+ },
16
+ "./*": {
17
+ "import": "./dist/*.mjs",
18
+ "types": "./dist/*.d.mts"
19
+ }
20
+ },
21
+ "devDependencies": {
22
+ "tsdown": "0.21.0",
23
+ "typescript": "^5.9.3"
24
+ },
25
+ "scripts": {
26
+ "build": "tsdown"
27
+ },
28
+ "types": "./dist/index.d.mts"
29
+ }