@gjsify/timers 0.4.30 → 0.4.32

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/globals.mjs ADDED
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Re-exports native `node:timers` for use in Node.js builds.
3
+ *
4
+ * On Node, `node:timers` is built into the runtime — so a Node-target
5
+ * bundle that imports `@gjsify/timers` is routed here by the
6
+ * resolver's `gjsify.runtimes.node === "native"` rule. This avoids dragging
7
+ * the GJS polyfill into Node bundles entirely.
8
+ *
9
+ * GJS bundles do NOT consult this file; they route to `@gjsify/timers`'s
10
+ * own `lib/esm/index.js` (the polyfill).
11
+ */
12
+ export * from 'node:timers';
13
+ export { default } from 'node:timers';
@@ -4,7 +4,7 @@ export { Timeout, Immediate };
4
4
  * Schedule a callback to be called after `delay` milliseconds.
5
5
  * Returns a Timeout object with ref/unref/refresh methods.
6
6
  */
7
- declare function _setTimeout<T extends any[]>(callback: (...args: T) => void, delay?: number, ...args: T): Timeout;
7
+ declare function _setTimeout<T extends unknown[]>(callback: (...args: T) => void, delay?: number, ...args: T): Timeout;
8
8
  /**
9
9
  * Cancel a timeout created by setTimeout.
10
10
  */
@@ -13,7 +13,7 @@ declare function _clearTimeout(timeout: Timeout | number | undefined): void;
13
13
  * Schedule a callback to be called repeatedly every `delay` milliseconds.
14
14
  * Returns a Timeout object with ref/unref/refresh methods.
15
15
  */
16
- declare function _setInterval<T extends any[]>(callback: (...args: T) => void, delay?: number, ...args: T): Timeout;
16
+ declare function _setInterval<T extends unknown[]>(callback: (...args: T) => void, delay?: number, ...args: T): Timeout;
17
17
  /**
18
18
  * Cancel an interval created by setInterval.
19
19
  */
@@ -22,7 +22,7 @@ declare function _clearInterval(timeout: Timeout | number | undefined): void;
22
22
  * Schedule a callback to be called on the next iteration of the event loop.
23
23
  * Returns an Immediate object with ref/unref methods.
24
24
  */
25
- declare function _setImmediate<T extends any[]>(callback: (...args: T) => void, ...args: T): Immediate;
25
+ declare function _setImmediate<T extends unknown[]>(callback: (...args: T) => void, ...args: T): Immediate;
26
26
  /**
27
27
  * Cancel an immediate created by setImmediate.
28
28
  */
@@ -5,7 +5,7 @@ export declare class Timeout {
5
5
  private _delay;
6
6
  private _args;
7
7
  private _isInterval;
8
- constructor(callback: (...args: any[]) => void, delay: number, args: any[], isInterval: boolean);
8
+ constructor(callback: (...args: unknown[]) => void, delay: number, args: unknown[], isInterval: boolean);
9
9
  /**
10
10
  * Mark this timeout as referenced (default).
11
11
  * Referenced timers keep the event loop alive.
@@ -31,7 +31,7 @@ export declare class Immediate {
31
31
  private _id;
32
32
  private _ref;
33
33
  private _cancelled;
34
- constructor(callback: (...args: any[]) => void, args: any[]);
34
+ constructor(callback: (...args: unknown[]) => void, args: unknown[]);
35
35
  ref(): this;
36
36
  unref(): this;
37
37
  hasRef(): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/timers",
3
- "version": "0.4.30",
3
+ "version": "0.4.32",
4
4
  "description": "Node.js timers module for Gjs",
5
5
  "type": "module",
6
6
  "module": "lib/esm/index.js",
@@ -13,10 +13,12 @@
13
13
  "./promises": {
14
14
  "types": "./lib/types/promises.d.ts",
15
15
  "default": "./lib/esm/promises.js"
16
- }
16
+ },
17
+ "./globals": "./globals.mjs"
17
18
  },
18
19
  "files": [
19
- "lib"
20
+ "lib",
21
+ "globals.mjs"
20
22
  ],
21
23
  "scripts": {
22
24
  "clear": "rm -rf lib tsconfig.tsbuildinfo tsconfig.types.tsbuildinfo test.gjs.mjs test.node.mjs || exit 0",
@@ -37,9 +39,16 @@
37
39
  "timers"
38
40
  ],
39
41
  "devDependencies": {
40
- "@gjsify/cli": "^0.4.30",
41
- "@gjsify/unit": "^0.4.30",
42
+ "@gjsify/cli": "^0.4.32",
43
+ "@gjsify/unit": "^0.4.32",
42
44
  "@types/node": "^25.9.1",
43
45
  "typescript": "^6.0.3"
46
+ },
47
+ "gjsify": {
48
+ "runtimes": {
49
+ "gjs": "polyfill",
50
+ "node": "native",
51
+ "browser": "polyfill"
52
+ }
44
53
  }
45
54
  }