@types/gimloader 1.10.0 → 1.10.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.
gimloader/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for gimloader (https://github.com/Gimload
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/gimloader.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Mon, 15 Dec 2025 19:03:39 GMT
11
+ * Last updated: Tue, 30 Dec 2025 21:02:09 GMT
12
12
  * Dependencies: [@dimforge/rapier2d-compat](https://npmjs.com/package/@dimforge/rapier2d-compat), [@types/react](https://npmjs.com/package/@types/react), [@types/react-dom](https://npmjs.com/package/@types/react-dom), [eventemitter2](https://npmjs.com/package/eventemitter2), [phaser](https://npmjs.com/package/phaser)
13
13
 
14
14
  # Credits
gimloader/index.d.ts CHANGED
@@ -2305,7 +2305,7 @@ declare global {
2305
2305
  /** Gets the headers of a plugin, such as version, author, and description */
2306
2306
  getHeaders(name: string): ScriptHeaders;
2307
2307
  /** Gets the exported values of a plugin, if it has been enabled */
2308
- get(name: string): any;
2308
+ get<T extends keyof Gimloader.Plugins>(name: T): Gimloader.Plugins[T];
2309
2309
  /**
2310
2310
  * @deprecated Use {@link get} instead
2311
2311
  * @hidden
@@ -2342,7 +2342,7 @@ declare global {
2342
2342
  /** Gets the headers of a library, such as version, author, and description */
2343
2343
  getHeaders(name: string): ScriptHeaders;
2344
2344
  /** Gets the exported values of a library */
2345
- get(name: string): any;
2345
+ get<T extends keyof Gimloader.Libraries>(name: T): Gimloader.Libraries[T];
2346
2346
  }
2347
2347
 
2348
2348
  class ScopedCommandsApi {
@@ -2415,6 +2415,23 @@ declare global {
2415
2415
  createShared(id: string, value: any): string;
2416
2416
  /** Removes the shared value with a certain id created by {@link createShared} */
2417
2417
  removeSharedById(id: string): void;
2418
+ /**
2419
+ * Runs code in the scope of modules when they are loaded, or when runInScope is called with them already loaded.
2420
+ * Returning true from the callback will remove the hook.
2421
+ */
2422
+ runInScope(prefix: string | boolean, callback: RunInScopeCallback): () => void;
2423
+ /** A utility function that exposes a variable based on regex to get its name. */
2424
+ exposeVar(prefix: string | boolean, exposer: Exposer): () => void;
2425
+ }
2426
+
2427
+ // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
2428
+ type RunInScopeCallback = (code: string, run: (evalCode: string) => void) => true | void;
2429
+
2430
+ interface Exposer {
2431
+ check?: string;
2432
+ find: RegExp;
2433
+ callback: (val: any) => void;
2434
+ multiple?: boolean;
2418
2435
  }
2419
2436
 
2420
2437
  class RewriterApi {
@@ -2425,10 +2442,10 @@ declare global {
2425
2442
  * @param pluginName The name of the plugin creating the hook.
2426
2443
  * @param prefix Limits the hook to only running on scripts beginning with this prefix.
2427
2444
  * Passing `true` will only run on the index script, and passing `false` will run on all scripts.
2428
- * @param callback The function that will modify the code. Should return the modified code. Cannot have side effects.
2445
+ * @param callback A function that will modify the code, which should return the modified code.
2429
2446
  */
2430
- addParseHook(pluginName: string, prefix: string | boolean, callback: (code: string) => string): () => void;
2431
- /** Removes all hooks created by a certain plugin */
2447
+ addParseHook(pluginName: string, prefix: string | boolean, modifier: (code: string) => string): () => void;
2448
+ /** Removes all parse hooks created by a certain plugin */
2432
2449
  removeParseHooks(pluginName: string): void;
2433
2450
  /**
2434
2451
  * Creates a shared value that can be accessed from any script.
@@ -2442,6 +2459,15 @@ declare global {
2442
2459
  removeShared(pluginName: string): void;
2443
2460
  /** Removes the shared value with a certain id created by {@link createShared} */
2444
2461
  removeSharedById(pluginName: string, id: string): void;
2462
+ /**
2463
+ * Runs code in the scope of modules when they are loaded, or when runInScope is called with them already loaded.
2464
+ * Returning true from the callback will remove the hook.
2465
+ */
2466
+ runInScope(pluginName: string, prefix: string | boolean, callback: RunInScopeCallback): () => void;
2467
+ /** Stops all hooks created by {@link runInScope} */
2468
+ removeRunInScope(pluginName: string): void;
2469
+ /** A utility function that exposes a variable based on regex to get its name. */
2470
+ exposeVar(pluginName: string, prefix: string | boolean, exposer: Exposer): () => void;
2445
2471
  }
2446
2472
 
2447
2473
  class ScopedPatcherApi {
@@ -2836,11 +2862,11 @@ declare global {
2836
2862
  /** Methods for getting info on libraries */
2837
2863
  static libs: Readonly<LibsApi>;
2838
2864
  /** Gets the exported values of a library */
2839
- static lib: (name: string) => any;
2865
+ static lib: <T extends keyof Gimloader.Libraries>(name: T) => Gimloader.Libraries[T];
2840
2866
  /** Methods for getting info on plugins */
2841
2867
  static plugins: Readonly<PluginsApi>;
2842
2868
  /** Gets the exported values of a plugin, if it has been enabled */
2843
- static plugin: (name: string) => any;
2869
+ static plugin: <T extends keyof Gimloader.Plugins>(name: T) => Gimloader.Plugins[T];
2844
2870
  /** Gimkit's internal react instance */
2845
2871
  static get React(): typeof import("react");
2846
2872
  /** Gimkit's internal reactDom instance */
@@ -2909,11 +2935,11 @@ declare global {
2909
2935
  /** Methods for getting info on libraries */
2910
2936
  libs: Readonly<LibsApi>;
2911
2937
  /** Gets the exported values of a library */
2912
- lib: (name: string) => any;
2938
+ lib: <T extends keyof Gimloader.Libraries>(name: T) => Gimloader.Libraries[T];
2913
2939
  /** Methods for getting info on plugins */
2914
2940
  plugins: Readonly<PluginsApi>;
2915
2941
  /** Gets the exported values of a plugin, if it has been enabled */
2916
- plugin: (name: string) => any;
2942
+ plugin: <T extends keyof Gimloader.Plugins>(name: T) => Gimloader.Plugins[T];
2917
2943
  /** Gimkit's internal react instance */
2918
2944
  get React(): typeof import("react");
2919
2945
  /** Gimkit's internal reactDom instance */
@@ -2935,6 +2961,14 @@ declare global {
2935
2961
  */
2936
2962
  openSettingsMenu: (callback: () => void) => void;
2937
2963
  }
2964
+
2965
+ interface Plugins {
2966
+ [name: string]: any;
2967
+ }
2968
+
2969
+ interface Libraries {
2970
+ [name: string]: any;
2971
+ }
2938
2972
  }
2939
2973
  const api: Gimloader.Api;
2940
2974
  const GL: typeof Gimloader.Api;
gimloader/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/gimloader",
3
- "version": "1.10.0",
3
+ "version": "1.10.1",
4
4
  "description": "TypeScript definitions for gimloader",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/gimloader",
6
6
  "license": "MIT",
@@ -32,6 +32,6 @@
32
32
  "eventemitter2": "~6.4.9"
33
33
  },
34
34
  "peerDependencies": {},
35
- "typesPublisherContentHash": "f02db9aa2ef4ef0f05c873f062356c8789b9173e27e9bfcf2547f84f98f74f7d",
35
+ "typesPublisherContentHash": "cdd790249028d82ee8a23815e563ddf7acc6203d81d2f22ed3358a17b78232ee",
36
36
  "typeScriptVersion": "5.2"
37
37
  }