ctx-core 6.2.1 → 6.3.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.
package/README.md CHANGED
@@ -1,5 +1,119 @@
1
1
  # ctx-core
2
- ctx-core core (ctx-core^2) libraries...used by @ctx-core/* libraries. The development monorepo has been moved to @ctx-core/dev
3
2
 
4
- ## macropackage
3
+ The ctx-core library is a 0 dependency library with several exports to support general app development. This library has several exports to limit what is loaded into memory & to make tree-shaking less intensive. Some of the underlying functions are in multiple exports. The full list of exports is below. There is varying comprehensiveness & usage for these functions.
5
4
 
5
+
6
+
7
+ ## Development Monorepo
8
+
9
+ The [development monorepo](https://github.com/ctx-core/dev) used to have the ctx-core/ctx-core project name but has been moved to make room for this package.
10
+
11
+ ### ctx-core/all
12
+
13
+ A catch all export which includes all functions. ctx-core/all is used to verify that the source functions have unique names.
14
+
15
+ ### ctx-core/array
16
+
17
+ ### ctx-core/atob
18
+
19
+ ### ctx-core/base16
20
+
21
+ ### ctx-core/be
22
+
23
+ [ctx-core/be](https://github.com/ctx-core/be) is a general purpose, modular, & scalable context library. See it's Readme for more docs.
24
+
25
+ ### ctx-core/btoa
26
+
27
+ ### ctx-core/buffer
28
+
29
+ ### ctx-core/chain
30
+
31
+ ### ctx-core/class
32
+
33
+ ### ctx-core/cli-args
34
+
35
+ ### ctx-core/color
36
+
37
+ ### ctx-core/combinators
38
+
39
+ ### ctx-core/crypto
40
+
41
+ ### ctx-core/currency
42
+
43
+ ### ctx-core/data
44
+
45
+ ### ctx-core/date
46
+
47
+ ### ctx-core/debounce
48
+
49
+ ### ctx-core/deep_equal
50
+
51
+ ### ctx-core/dom
52
+
53
+ ### ctx-core/env
54
+
55
+ ### ctx-core/error
56
+
57
+ ### ctx-core/event_log
58
+
59
+ ### ctx-core/falsy
60
+
61
+ ### ctx-core/fetch
62
+
63
+ ### ctx-core/fibonacci
64
+
65
+ ### ctx-core/fs
66
+
67
+ ### ctx-core/function
68
+
69
+ ### ctx-core/functional
70
+
71
+ ### ctx-core/html
72
+
73
+ ### ctx-core/http
74
+
75
+ ### ctx-core/math
76
+
77
+ ### ctx-core/matrix
78
+
79
+ ### ctx-core/nullish
80
+
81
+ ### ctx-core/number
82
+
83
+ ### ctx-core/object
84
+
85
+ ### ctx-core/promise
86
+
87
+ ## ctx-core/queue
88
+
89
+ ## ctx-core/random
90
+
91
+ ## ctx-core/regex
92
+
93
+ ## ctx-core/rmemo
94
+
95
+ The docs for rmemo are in https://github.com/ctx-core/rmemo. Since the source for rmemo has 0 dependencies & is isomorphic, it lives in the ctx-core/rmemo export. This allows rmemo to be used within ctx-core without added a dependency.
96
+
97
+ ## ctx-core/run
98
+
99
+ ## ctx-core/set
100
+
101
+ ## ctx-core/sleep
102
+
103
+ ## ctx-core/stream
104
+
105
+ ## ctx-core/string
106
+
107
+ ## ctx-core/tempfile
108
+
109
+ ## ctx-core/test
110
+
111
+ ## ctx-core/time
112
+
113
+ ## ctx-core/tuple
114
+
115
+ ## ctx-core/types
116
+
117
+ ## ctx-core/uri
118
+
119
+ ## ctx-core/uuid
@@ -19,6 +19,7 @@ export declare function rmemo__add<val_T, listener_val_T, E = unknown>(
19
19
  ):()=>void
20
20
  export declare function rmemo__unset(rmemo:rmemo_T<unknown>):void
21
21
  export type rmemo_T<val_T, E = unknown> = memo_T<val_T, E>|sig_T<val_T, E>|lock_memosig_T<val_T, E>
22
+ export type rmemolike_T<val_T, E = unknown> = (()=>val_T)&E
22
23
  export type circular_rmemo_T<E = unknown> =
23
24
  (circular_memo_T|circular_sig_T|circular_lock_memosig_T)&E
24
25
  export type memo_T<val_T, E = unknown> = (()=>val_T)&{
@@ -1,13 +1,13 @@
1
- import { cancel_Promise } from '../promise/index.js'
2
- import type { memo_T, rmemo_T, rmemo_val_T } from '../rmemo/index.js'
1
+ import type { cancel_Promise } from '../promise/index.js'
2
+ import type { memo_T, rmemolike_T, rmemo_val_T } from '../rmemo/index.js'
3
3
  export declare function rmemo__wait<
4
- _rmemo_T extends rmemo_T<unknown> = rmemo_T<unknown>
4
+ _rmemolike_T extends rmemolike_T<unknown> = rmemolike_T<unknown>
5
5
  >(
6
- memo:_rmemo_T,
7
- condition_fn:(val:rmemo_val_T<_rmemo_T>)=>unknown,
6
+ memo:_rmemolike_T,
7
+ condition_fn:(val:rmemo_val_T<_rmemolike_T>)=>unknown,
8
8
  timeout?:number,
9
9
  error?:Error
10
- ):rmemo__wait_ret_T<rmemo_val_T<_rmemo_T>>
10
+ ):rmemo__wait_ret_T<rmemo_val_T<_rmemolike_T>>
11
11
  export type rmemo__wait_ret_T<R> =
12
12
  cancel_Promise<
13
13
  R,
@@ -2,7 +2,7 @@ import { test } from 'uvu'
2
2
  import { equal } from 'uvu/assert'
3
3
  import { sig_ } from '../rmemo/index.js'
4
4
  import { rmemo__wait } from './index.js'
5
- test('rmemo__wait', async ()=>{
5
+ test('rmemo__wait|rmemo', async ()=>{
6
6
  const subject$ = sig_(-1)
7
7
  const promise = rmemo__wait(
8
8
  subject$,
@@ -15,6 +15,19 @@ test('rmemo__wait', async ()=>{
15
15
  await promise
16
16
  equal(subject$(), 1)
17
17
  })
18
+ test('rmemo__wait|rmemolike', async ()=>{
19
+ const subject$ = sig_(-1)
20
+ const promise = rmemo__wait(
21
+ ()=>subject$(),
22
+ subject=>subject >= 0,
23
+ 10_000)
24
+ equal(promise.m.t, [])
25
+ equal(subject$(), -1)
26
+ subject$._ = 1
27
+ equal(subject$(), 1)
28
+ await promise
29
+ equal(subject$(), 1)
30
+ })
18
31
  test('rmemo__wait|cancel', async ()=>{
19
32
  const subject$ = sig_(-1)
20
33
  const promise = rmemo__wait(
@@ -25,7 +25,7 @@ export function timeout_promise(
25
25
  /** @type {cancel_Promise} */
26
26
  let ret_promise = Promise.race([
27
27
  typeof promise === 'function' ? promise() : promise,
28
- timeout,
28
+ ...(timeout ? [timeout] : []),
29
29
  cancel_promise,
30
30
  ]).finally(()=>clearTimeout(id))
31
31
  ret_promise.cancel = cancel_promise__resolve
@@ -15,6 +15,17 @@ test('timeout_promise|success', async ()=>{
15
15
  equal(await promise, true)
16
16
  equal(count, 1)
17
17
  })
18
+ test('timeout_promise|Infinity|success', async ()=>{
19
+ let count = 0
20
+ const promise = timeout_promise(run(async ()=>{
21
+ count++
22
+ await sleep(10)
23
+ return true
24
+ }), Infinity)
25
+ equal(count, 1)
26
+ equal(await promise, true)
27
+ equal(count, 1)
28
+ })
18
29
  test('timeout_promise|timeout', async ()=>{
19
30
  let count = 0
20
31
  let err:Error|undefined = undefined
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ctx-core",
3
- "version": "6.2.1",
3
+ "version": "6.3.0",
4
4
  "description": "ctx-core core library",
5
5
  "keywords": [
6
6
  "ctx-core",
@@ -292,7 +292,7 @@
292
292
  "./package.json": "./package.json"
293
293
  },
294
294
  "devDependencies": {
295
- "@arethetypeswrong/cli": "^0.13.9",
295
+ "@arethetypeswrong/cli": "^0.13.10",
296
296
  "@ctx-core/preprocess": "^0.1.2",
297
297
  "@size-limit/preset-small-lib": "^11.0.2",
298
298
  "@types/jsdom": "^21.1.6",