@ryanatkn/gro 0.138.2 → 0.139.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"gro_plugin_gen.d.ts","sourceRoot":"../src/lib/","sources":["gro_plugin_gen.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAKpC,OAAO,KAAK,EAAC,WAAW,EAAE,OAAO,EAAC,MAAM,WAAW,CAAC;AACpD,OAAO,KAAK,EAAgB,WAAW,EAAC,MAAM,YAAY,CAAC;AAK3D,MAAM,WAAW,SAAU,SAAQ,IAAI;IACtC,KAAK,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,OAAO;IACvB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,eAAO,MAAM,cAAc,uDAIxB,OAAO,KAAkB,MA8E3B,CAAC;AAEF,eAAO,MAAM,iBAAiB,gBAChB,WAAW,aACb,CAAC,EAAE,EAAE,OAAO,KAAK,WAAW,GAAG,SAAS,WAC1C,WAAW,YACX,GAAG,CAAC,MAAM,CAAC,aACV,GAAG,CAAC,MAAM,CAAC,KACnB,GAAG,CAAC,MAAM,CAYZ,CAAC"}
1
+ {"version":3,"file":"gro_plugin_gen.d.ts","sourceRoot":"../src/lib/","sources":["gro_plugin_gen.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAIpC,OAAO,KAAK,EAAC,WAAW,EAAE,OAAO,EAAC,MAAM,WAAW,CAAC;AACpD,OAAO,KAAK,EAAgB,WAAW,EAAC,MAAM,YAAY,CAAC;AAI3D,MAAM,WAAW,SAAU,SAAQ,IAAI;IACtC,KAAK,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,OAAO;IACvB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,eAAO,MAAM,cAAc,uDAIxB,OAAO,KAAkB,MAiF3B,CAAC;AAEF,eAAO,MAAM,iBAAiB,gBAChB,WAAW,aACb,CAAC,EAAE,EAAE,OAAO,KAAK,WAAW,GAAG,SAAS,WAC1C,WAAW,YACX,GAAG,CAAC,MAAM,CAAC,aACV,GAAG,CAAC,MAAM,CAAC,KACnB,GAAG,CAAC,MAAM,CAYZ,CAAC"}
@@ -1,9 +1,9 @@
1
1
  import { EMPTY_OBJECT } from '@ryanatkn/belt/object.js';
2
+ import { throttle } from '@ryanatkn/belt/throttle.js';
3
+ import { Unreachable_Error } from '@ryanatkn/belt/error.js';
2
4
  import { paths } from './paths.js';
3
5
  import { find_genfiles, is_gen_path } from './gen.js';
4
- import { throttle } from './throttle.js';
5
6
  import { spawn_cli } from './cli.js';
6
- import { Unreachable_Error } from '@ryanatkn/belt/error.js';
7
7
  const FLUSH_DEBOUNCE_DELAY = 500;
8
8
  export const gro_plugin_gen = ({ input_paths = [paths.source], root_dirs = [paths.source], flush_debounce_delay = FLUSH_DEBOUNCE_DELAY, } = EMPTY_OBJECT) => {
9
9
  let flushing_timeout;
@@ -21,7 +21,7 @@ export const gro_plugin_gen = ({ input_paths = [paths.source], root_dirs = [path
21
21
  const files = Array.from(queued_files);
22
22
  queued_files.clear();
23
23
  await gen(files);
24
- }, flush_debounce_delay);
24
+ }, { delay: flush_debounce_delay });
25
25
  const gen = (files = []) => spawn_cli('gro', ['gen', ...files]);
26
26
  let cleanup;
27
27
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"gro_plug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M,CAAC;IACrB;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;CACd;AAED,MAAM,WAAW,QAAQ;IACxB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK,QAAQ,CAAC;AAEzD,eAAO,MAAM,iBAAiB,yJAgB3B,OAAO,KAAQ,MAwJjB,CAAC"}
@@ -4,6 +4,7 @@ import { join, resolve } from 'node:path';
4
4
  import { identity } from '@ryanatkn/belt/function.js';
5
5
  import { strip_before, strip_end } from '@ryanatkn/belt/string.js';
6
6
  import { existsSync } from 'node:fs';
7
+ import { throttle } from '@ryanatkn/belt/throttle.js';
7
8
  import { base_path_to_path_id, LIB_DIRNAME, paths } from './paths.js';
8
9
  import { GRO_DEV_DIRNAME, SERVER_DIST_PATH } from './path_constants.js';
9
10
  import { watch_dir } from './watch_dir.js';
@@ -15,7 +16,6 @@ import { esbuild_plugin_sveltekit_shim_alias } from './esbuild_plugin_sveltekit_
15
16
  import { esbuild_plugin_external_worker } from './esbuild_plugin_external_worker.js';
16
17
  import { esbuild_plugin_sveltekit_local_imports } from './esbuild_plugin_sveltekit_local_imports.js';
17
18
  import { esbuild_plugin_svelte } from './esbuild_plugin_svelte.js';
18
- import { throttle } from './throttle.js';
19
19
  // TODO sourcemap as a hoisted option? disable for production by default - or like `outpaths`, passed a `dev` param
20
20
  export const SERVER_SOURCE_ID = base_path_to_path_id(LIB_DIRNAME + '/server/server.ts');
21
21
  export const has_server = (path = SERVER_SOURCE_ID) => {
@@ -112,7 +112,7 @@ export const gro_plugin_server = ({ entry_points = [SERVER_SOURCE_ID], dir = pro
112
112
  print_build_result(log, build_result);
113
113
  deps = parse_deps(metafile.inputs, dir);
114
114
  server_process?.restart();
115
- }, rebuild_throttle_delay);
115
+ }, { delay: rebuild_throttle_delay });
116
116
  await rebuild();
117
117
  // uses chokidar instead of esbuild's watcher for efficiency
118
118
  if (watch) {
package/dist/package.d.ts CHANGED
@@ -417,10 +417,6 @@ export declare const package_json: {
417
417
  types: string;
418
418
  default: string;
419
419
  };
420
- './throttle.js': {
421
- types: string;
422
- default: string;
423
- };
424
420
  './typecheck.task.js': {
425
421
  types: string;
426
422
  default: string;
@@ -1001,13 +997,6 @@ export declare const src_json: {
1001
997
  kind: string;
1002
998
  }[];
1003
999
  };
1004
- './throttle.js': {
1005
- path: string;
1006
- declarations: {
1007
- name: string;
1008
- kind: string;
1009
- }[];
1010
- };
1011
1000
  './typecheck.task.js': {
1012
1001
  path: string;
1013
1002
  declarations: {
@@ -1 +1 @@
1
- {"version":3,"file":"package.d.ts","sourceRoot":"../src/lib/","sources":["package.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuQD,CAAC;AAEzB,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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CAsQD,CAAC;AAEzB,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6vBD,CAAC"}
package/dist/package.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // generated by src/lib/package.gen.ts
2
2
  export const package_json = {
3
3
  name: '@ryanatkn/gro',
4
- version: '0.138.2',
4
+ version: '0.139.0',
5
5
  description: 'task runner and toolkit extending SvelteKit',
6
6
  motto: 'generate, run, optimize',
7
7
  glyph: '🌰',
@@ -39,7 +39,7 @@ export const package_json = {
39
39
  'typescript',
40
40
  ],
41
41
  dependencies: {
42
- '@ryanatkn/belt': '^0.25.0',
42
+ '@ryanatkn/belt': '^0.25.3',
43
43
  chokidar: '^4.0.1',
44
44
  dotenv: '^16.4.5',
45
45
  'es-module-lexer': '^1.5.4',
@@ -253,7 +253,6 @@ export const package_json = {
253
253
  './task_logging.js': { types: './dist/task_logging.d.ts', default: './dist/task_logging.js' },
254
254
  './task.js': { types: './dist/task.d.ts', default: './dist/task.js' },
255
255
  './test.task.js': { types: './dist/test.task.d.ts', default: './dist/test.task.js' },
256
- './throttle.js': { types: './dist/throttle.d.ts', default: './dist/throttle.js' },
257
256
  './typecheck.task.js': {
258
257
  types: './dist/typecheck.task.d.ts',
259
258
  default: './dist/typecheck.task.js',
@@ -264,7 +263,7 @@ export const package_json = {
264
263
  };
265
264
  export const src_json = {
266
265
  name: '@ryanatkn/gro',
267
- version: '0.138.2',
266
+ version: '0.139.0',
268
267
  modules: {
269
268
  '.': {
270
269
  path: 'index.ts',
@@ -1001,7 +1000,6 @@ export const src_json = {
1001
1000
  { name: 'task', kind: 'variable' },
1002
1001
  ],
1003
1002
  },
1004
- './throttle.js': { path: 'throttle.ts', declarations: [{ name: 'throttle', kind: 'function' }] },
1005
1003
  './typecheck.task.js': {
1006
1004
  path: 'typecheck.task.ts',
1007
1005
  declarations: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryanatkn/gro",
3
- "version": "0.138.2",
3
+ "version": "0.139.0",
4
4
  "description": "task runner and toolkit extending SvelteKit",
5
5
  "motto": "generate, run, optimize",
6
6
  "glyph": "🌰",
@@ -49,7 +49,7 @@
49
49
  "typescript"
50
50
  ],
51
51
  "dependencies": {
52
- "@ryanatkn/belt": "^0.25.0",
52
+ "@ryanatkn/belt": "^0.25.3",
53
53
  "chokidar": "^4.0.1",
54
54
  "dotenv": "^16.4.5",
55
55
  "es-module-lexer": "^1.5.4",
@@ -438,10 +438,6 @@
438
438
  "types": "./dist/test.task.d.ts",
439
439
  "default": "./dist/test.task.js"
440
440
  },
441
- "./throttle.js": {
442
- "types": "./dist/throttle.d.ts",
443
- "default": "./dist/throttle.js"
444
- },
445
441
  "./typecheck.task.js": {
446
442
  "types": "./dist/typecheck.task.d.ts",
447
443
  "default": "./dist/typecheck.task.js"
@@ -1,14 +1,14 @@
1
1
  import {EMPTY_OBJECT} from '@ryanatkn/belt/object.js';
2
+ import {throttle} from '@ryanatkn/belt/throttle.js';
3
+ import {Unreachable_Error} from '@ryanatkn/belt/error.js';
2
4
 
3
5
  import type {Plugin} from './plugin.js';
4
6
  import type {Args} from './args.js';
5
7
  import {paths} from './paths.js';
6
8
  import {find_genfiles, is_gen_path} from './gen.js';
7
- import {throttle} from './throttle.js';
8
9
  import {spawn_cli} from './cli.js';
9
10
  import type {File_Filter, Path_Id} from './path.js';
10
11
  import type {Cleanup_Watch, Source_File} from './filer.js';
11
- import {Unreachable_Error} from '@ryanatkn/belt/error.js';
12
12
 
13
13
  const FLUSH_DEBOUNCE_DELAY = 500;
14
14
 
@@ -38,11 +38,14 @@ export const gro_plugin_gen = ({
38
38
  }); // the timeout batches synchronously
39
39
  }
40
40
  };
41
- const flush_gen_queue = throttle(async () => {
42
- const files = Array.from(queued_files);
43
- queued_files.clear();
44
- await gen(files);
45
- }, flush_debounce_delay);
41
+ const flush_gen_queue = throttle(
42
+ async () => {
43
+ const files = Array.from(queued_files);
44
+ queued_files.clear();
45
+ await gen(files);
46
+ },
47
+ {delay: flush_debounce_delay},
48
+ );
46
49
  const gen = (files: string[] = []) => spawn_cli('gro', ['gen', ...files]);
47
50
 
48
51
  let cleanup: Cleanup_Watch | undefined;
@@ -6,6 +6,7 @@ import {identity} from '@ryanatkn/belt/function.js';
6
6
  import {strip_before, strip_end} from '@ryanatkn/belt/string.js';
7
7
  import type {Result} from '@ryanatkn/belt/result.js';
8
8
  import {existsSync} from 'node:fs';
9
+ import {throttle} from '@ryanatkn/belt/throttle.js';
9
10
 
10
11
  import type {Plugin} from './plugin.js';
11
12
  import {base_path_to_path_id, LIB_DIRNAME, paths} from './paths.js';
@@ -20,7 +21,6 @@ import {esbuild_plugin_sveltekit_shim_alias} from './esbuild_plugin_sveltekit_sh
20
21
  import {esbuild_plugin_external_worker} from './esbuild_plugin_external_worker.js';
21
22
  import {esbuild_plugin_sveltekit_local_imports} from './esbuild_plugin_sveltekit_local_imports.js';
22
23
  import {esbuild_plugin_svelte} from './esbuild_plugin_svelte.js';
23
- import {throttle} from './throttle.js';
24
24
 
25
25
  // TODO sourcemap as a hoisted option? disable for production by default - or like `outpaths`, passed a `dev` param
26
26
 
@@ -208,20 +208,23 @@ export const gro_plugin_server = ({
208
208
 
209
209
  timing_to_esbuild_create_context();
210
210
 
211
- const rebuild = throttle(async () => {
212
- let build_result;
213
- try {
214
- build_result = await build_ctx!.rebuild();
215
- } catch (err) {
216
- log.error('[gro_plugin_server] build failed', err);
217
- return;
218
- }
219
- const {metafile} = build_result;
220
- if (!metafile) return;
221
- print_build_result(log, build_result);
222
- deps = parse_deps(metafile.inputs, dir);
223
- server_process?.restart();
224
- }, rebuild_throttle_delay);
211
+ const rebuild = throttle(
212
+ async () => {
213
+ let build_result;
214
+ try {
215
+ build_result = await build_ctx!.rebuild();
216
+ } catch (err) {
217
+ log.error('[gro_plugin_server] build failed', err);
218
+ return;
219
+ }
220
+ const {metafile} = build_result;
221
+ if (!metafile) return;
222
+ print_build_result(log, build_result);
223
+ deps = parse_deps(metafile.inputs, dir);
224
+ server_process?.restart();
225
+ },
226
+ {delay: rebuild_throttle_delay},
227
+ );
225
228
 
226
229
  await rebuild();
227
230
 
@@ -5,7 +5,7 @@ import type {Src_Json} from './src_json.js';
5
5
 
6
6
  export const package_json = {
7
7
  name: '@ryanatkn/gro',
8
- version: '0.138.2',
8
+ version: '0.139.0',
9
9
  description: 'task runner and toolkit extending SvelteKit',
10
10
  motto: 'generate, run, optimize',
11
11
  glyph: '🌰',
@@ -44,7 +44,7 @@ export const package_json = {
44
44
  'typescript',
45
45
  ],
46
46
  dependencies: {
47
- '@ryanatkn/belt': '^0.25.0',
47
+ '@ryanatkn/belt': '^0.25.3',
48
48
  chokidar: '^4.0.1',
49
49
  dotenv: '^16.4.5',
50
50
  'es-module-lexer': '^1.5.4',
@@ -258,7 +258,6 @@ export const package_json = {
258
258
  './task_logging.js': {types: './dist/task_logging.d.ts', default: './dist/task_logging.js'},
259
259
  './task.js': {types: './dist/task.d.ts', default: './dist/task.js'},
260
260
  './test.task.js': {types: './dist/test.task.d.ts', default: './dist/test.task.js'},
261
- './throttle.js': {types: './dist/throttle.d.ts', default: './dist/throttle.js'},
262
261
  './typecheck.task.js': {
263
262
  types: './dist/typecheck.task.d.ts',
264
263
  default: './dist/typecheck.task.js',
@@ -270,7 +269,7 @@ export const package_json = {
270
269
 
271
270
  export const src_json = {
272
271
  name: '@ryanatkn/gro',
273
- version: '0.138.2',
272
+ version: '0.139.0',
274
273
  modules: {
275
274
  '.': {
276
275
  path: 'index.ts',
@@ -1007,7 +1006,6 @@ export const src_json = {
1007
1006
  {name: 'task', kind: 'variable'},
1008
1007
  ],
1009
1008
  },
1010
- './throttle.js': {path: 'throttle.ts', declarations: [{name: 'throttle', kind: 'function'}]},
1011
1009
  './typecheck.task.js': {
1012
1010
  path: 'typecheck.task.ts',
1013
1011
  declarations: [
@@ -1,19 +0,0 @@
1
- /**
2
- * Throttles calls to a callback that returns a void promise.
3
- * Immediately invokes the callback on the first call.
4
- * If the throttled function is called while the promise is already pending,
5
- * the call is queued to run after the pending promise completes plus `delay`,
6
- * and only the last call is invoked.
7
- * In other words, all calls and their args are discarded
8
- * during the pending window except for the most recent.
9
- * Unlike debouncing, this calls the throttled callback
10
- * both on the leading and trailing edges of the delay window,
11
- * and this can be customized by setting `leading` to `false`.
12
- * It also differs from a queue where every call to the throttled callback eventually runs.
13
- * @param cb - any function that returns a void promise
14
- * @param delay - delay this many milliseconds between the pending call finishing and the next starting
15
- * @param leading - if `true`, the default, the callback is called immediately
16
- * @returns same as `cb`
17
- */
18
- export declare const throttle: <T extends (...args: any[]) => Promise<void>>(cb: T, delay?: number, leading?: boolean) => T;
19
- //# sourceMappingURL=throttle.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"throttle.d.ts","sourceRoot":"../src/lib/","sources":["throttle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,MAC/D,CAAC,wCAGH,CA0CF,CAAC"}
package/dist/throttle.js DELETED
@@ -1,58 +0,0 @@
1
- /**
2
- * Throttles calls to a callback that returns a void promise.
3
- * Immediately invokes the callback on the first call.
4
- * If the throttled function is called while the promise is already pending,
5
- * the call is queued to run after the pending promise completes plus `delay`,
6
- * and only the last call is invoked.
7
- * In other words, all calls and their args are discarded
8
- * during the pending window except for the most recent.
9
- * Unlike debouncing, this calls the throttled callback
10
- * both on the leading and trailing edges of the delay window,
11
- * and this can be customized by setting `leading` to `false`.
12
- * It also differs from a queue where every call to the throttled callback eventually runs.
13
- * @param cb - any function that returns a void promise
14
- * @param delay - delay this many milliseconds between the pending call finishing and the next starting
15
- * @param leading - if `true`, the default, the callback is called immediately
16
- * @returns same as `cb`
17
- */
18
- export const throttle = (cb, delay = 0, leading = true) => {
19
- let pending_promise = null;
20
- let next_args = null;
21
- let next_promise = null;
22
- let next_promise_resolve = null;
23
- const defer = (args) => {
24
- next_args = args;
25
- if (!next_promise) {
26
- next_promise = new Promise((resolve) => {
27
- next_promise_resolve = resolve;
28
- });
29
- setTimeout(flush, delay);
30
- }
31
- return next_promise;
32
- };
33
- const flush = async () => {
34
- if (!next_promise_resolve)
35
- return;
36
- const result = await call(next_args);
37
- next_args = null;
38
- next_promise = null;
39
- const resolve = next_promise_resolve;
40
- next_promise_resolve = null;
41
- resolve(result); // resolve last to prevent synchronous call issues
42
- };
43
- const call = (args) => {
44
- pending_promise = cb(...args);
45
- void pending_promise.then(() => {
46
- pending_promise = null;
47
- });
48
- return pending_promise;
49
- };
50
- return ((...args) => {
51
- if (pending_promise || !leading) {
52
- return defer(args);
53
- }
54
- else {
55
- return call(args);
56
- }
57
- });
58
- };
@@ -1,64 +0,0 @@
1
- /**
2
- * Throttles calls to a callback that returns a void promise.
3
- * Immediately invokes the callback on the first call.
4
- * If the throttled function is called while the promise is already pending,
5
- * the call is queued to run after the pending promise completes plus `delay`,
6
- * and only the last call is invoked.
7
- * In other words, all calls and their args are discarded
8
- * during the pending window except for the most recent.
9
- * Unlike debouncing, this calls the throttled callback
10
- * both on the leading and trailing edges of the delay window,
11
- * and this can be customized by setting `leading` to `false`.
12
- * It also differs from a queue where every call to the throttled callback eventually runs.
13
- * @param cb - any function that returns a void promise
14
- * @param delay - delay this many milliseconds between the pending call finishing and the next starting
15
- * @param leading - if `true`, the default, the callback is called immediately
16
- * @returns same as `cb`
17
- */
18
- export const throttle = <T extends (...args: any[]) => Promise<void>>(
19
- cb: T,
20
- delay = 0,
21
- leading = true,
22
- ): T => {
23
- let pending_promise: Promise<void> | null = null;
24
- let next_args: any[] | null = null;
25
- let next_promise: Promise<void> | null = null;
26
- let next_promise_resolve: ((value: any) => void) | null = null;
27
-
28
- const defer = (args: any[]): Promise<void> => {
29
- next_args = args;
30
- if (!next_promise) {
31
- next_promise = new Promise((resolve) => {
32
- next_promise_resolve = resolve;
33
- });
34
- setTimeout(flush, delay);
35
- }
36
- return next_promise;
37
- };
38
-
39
- const flush = async (): Promise<void> => {
40
- if (!next_promise_resolve) return;
41
- const result = await call(next_args!);
42
- next_args = null;
43
- next_promise = null;
44
- const resolve = next_promise_resolve;
45
- next_promise_resolve = null;
46
- resolve(result); // resolve last to prevent synchronous call issues
47
- };
48
-
49
- const call = (args: any[]): Promise<any> => {
50
- pending_promise = cb(...args);
51
- void pending_promise.then(() => {
52
- pending_promise = null;
53
- });
54
- return pending_promise;
55
- };
56
-
57
- return ((...args) => {
58
- if (pending_promise || !leading) {
59
- return defer(args);
60
- } else {
61
- return call(args);
62
- }
63
- }) as T;
64
- };