totally-tubular 0.4.0 → 0.4.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.
- package/README.md +38 -36
- package/dist/types.d.ts +2 -2
- package/package.json +16 -12
package/README.md
CHANGED
|
@@ -168,53 +168,55 @@ handler or as a dependency to `useEffect`.
|
|
|
168
168
|
|
|
169
169
|
## Performance benchmarks
|
|
170
170
|
|
|
171
|
+
All benchmarks were run with Node.js 26.5.0 using the `tsx` TypeScript interpreter.
|
|
172
|
+
|
|
171
173
|
### Apple M3 Max · 36 GB RAM · macOS Sequoia 15.5
|
|
172
174
|
|
|
173
175
|
```
|
|
174
176
|
-----shallow state object-----
|
|
175
177
|
|
|
176
|
-
1,000 updates to "name" string val with 10 observers: 0.
|
|
177
|
-
1,000 updates to "name" string val with 100 observers: 0.
|
|
178
|
-
1,000 updates to "name" string val with 1000 observers: 0.
|
|
179
|
-
10,000 updates to "name" string val with 10 observers: 0.
|
|
180
|
-
10,000 updates to "name" string val with 100 observers: 0.
|
|
181
|
-
10,000 updates to "name" string val with 1000 observers: 0.
|
|
182
|
-
100,000 updates to "name" string val with 10 observers: 0.
|
|
183
|
-
100,000 updates to "name" string val with 100 observers: 0.
|
|
184
|
-
100,000 updates to "name" string val with 1000 observers: 0.
|
|
185
|
-
1,000,000 updates to "name" string val with 10 observers: 0.
|
|
186
|
-
1,000,000 updates to "name" string val with 100 observers: 0.
|
|
187
|
-
1,000,000 updates to "name" string val with 1000 observers:
|
|
178
|
+
1,000 updates to "name" string val with 10 observers: 0.0005343750000000114s
|
|
179
|
+
1,000 updates to "name" string val with 100 observers: 0.0006880840000000035s
|
|
180
|
+
1,000 updates to "name" string val with 1000 observers: 0.002814292000000023s
|
|
181
|
+
10,000 updates to "name" string val with 10 observers: 0.0007928750000000377s
|
|
182
|
+
10,000 updates to "name" string val with 100 observers: 0.0017347500000000195s
|
|
183
|
+
10,000 updates to "name" string val with 1000 observers: 0.007635916000000009s
|
|
184
|
+
100,000 updates to "name" string val with 10 observers: 0.01587337500000001s
|
|
185
|
+
100,000 updates to "name" string val with 100 observers: 0.020373334s
|
|
186
|
+
100,000 updates to "name" string val with 1000 observers: 0.12892133400000005s
|
|
187
|
+
1,000,000 updates to "name" string val with 10 observers: 0.14660462499999993s
|
|
188
|
+
1,000,000 updates to "name" string val with 100 observers: 0.20982341600000007s
|
|
189
|
+
1,000,000 updates to "name" string val with 1000 observers: 0.8595329590000002s
|
|
188
190
|
|
|
189
191
|
-----medium state object-----
|
|
190
192
|
|
|
191
|
-
1,000 updates to "user.settings.theme" string val with 10 observers: 0.
|
|
192
|
-
1,000 updates to "user.settings.theme" string val with 100 observers: 0.
|
|
193
|
-
1,000 updates to "user.settings.theme" string val with 1000 observers: 0.
|
|
194
|
-
10,000 updates to "user.settings.theme" string val with 10 observers: 0.
|
|
195
|
-
10,000 updates to "user.settings.theme" string val with 100 observers: 0.
|
|
196
|
-
10,000 updates to "user.settings.theme" string val with 1000 observers: 0.
|
|
197
|
-
100,000 updates to "user.settings.theme" string val with 10 observers: 0.
|
|
198
|
-
100,000 updates to "user.settings.theme" string val with 100 observers: 0.
|
|
199
|
-
100,000 updates to "user.settings.theme" string val with 1000 observers: 0.
|
|
200
|
-
1,000,000 updates to "user.settings.theme" string val with 10 observers: 0.
|
|
201
|
-
1,000,000 updates to "user.settings.theme" string val with 100 observers: 0.
|
|
202
|
-
1,000,000 updates to "user.settings.theme" string val with 1000 observers:
|
|
193
|
+
1,000 updates to "user.settings.theme" string val with 10 observers: 0.0011529580000001261s
|
|
194
|
+
1,000 updates to "user.settings.theme" string val with 100 observers: 0.002206040999999914s
|
|
195
|
+
1,000 updates to "user.settings.theme" string val with 1000 observers: 0.006846457999999984s
|
|
196
|
+
10,000 updates to "user.settings.theme" string val with 10 observers: 0.01919616700000006s
|
|
197
|
+
10,000 updates to "user.settings.theme" string val with 100 observers: 0.007707957999999963s
|
|
198
|
+
10,000 updates to "user.settings.theme" string val with 1000 observers: 0.014114458000000014s
|
|
199
|
+
100,000 updates to "user.settings.theme" string val with 10 observers: 0.012900958000000174s
|
|
200
|
+
100,000 updates to "user.settings.theme" string val with 100 observers: 0.018197167000000035s
|
|
201
|
+
100,000 updates to "user.settings.theme" string val with 1000 observers: 0.09116387499999973s
|
|
202
|
+
1,000,000 updates to "user.settings.theme" string val with 10 observers: 0.18448416599999973s
|
|
203
|
+
1,000,000 updates to "user.settings.theme" string val with 100 observers: 0.24980879200000028s
|
|
204
|
+
1,000,000 updates to "user.settings.theme" string val with 1000 observers: 0.8701055419999998s
|
|
203
205
|
|
|
204
206
|
-----deep state object-----
|
|
205
207
|
|
|
206
|
-
1,000 updates to "zdeepSettings.level1.level2.level3.level4.level5.level6.currentValue" string val with 10 observers: 0.
|
|
207
|
-
1,000 updates to "zdeepSettings.level1.level2.level3.level4.level5.level6.currentValue" string val with 100 observers: 0.
|
|
208
|
-
1,000 updates to "zdeepSettings.level1.level2.level3.level4.level5.level6.currentValue" string val with 1000 observers: 0.
|
|
209
|
-
10,000 updates to "zdeepSettings.level1.level2.level3.level4.level5.level6.currentValue" string val with 10 observers: 0.
|
|
210
|
-
10,000 updates to "zdeepSettings.level1.level2.level3.level4.level5.level6.currentValue" string val with 100 observers: 0.
|
|
211
|
-
10,000 updates to "zdeepSettings.level1.level2.level3.level4.level5.level6.currentValue" string val with 1000 observers: 0.
|
|
212
|
-
100,000 updates to "zdeepSettings.level1.level2.level3.level4.level5.level6.currentValue" string val with 10 observers: 0.
|
|
213
|
-
100,000 updates to "zdeepSettings.level1.level2.level3.level4.level5.level6.currentValue" string val with 100 observers: 0.
|
|
214
|
-
100,000 updates to "zdeepSettings.level1.level2.level3.level4.level5.level6.currentValue" string val with 1000 observers: 0.
|
|
215
|
-
1,000,000 updates to "zdeepSettings.level1.level2.level3.level4.level5.level6.currentValue" string val with 10 observers: 0.
|
|
216
|
-
1,000,000 updates to "zdeepSettings.level1.level2.level3.level4.level5.level6.currentValue" string val with 100 observers: 0.
|
|
217
|
-
1,000,000 updates to "zdeepSettings.level1.level2.level3.level4.level5.level6.currentValue" string val with 1000 observers:
|
|
208
|
+
1,000 updates to "zdeepSettings.level1.level2.level3.level4.level5.level6.currentValue" string val with 10 observers: 0.0002052080000003116s
|
|
209
|
+
1,000 updates to "zdeepSettings.level1.level2.level3.level4.level5.level6.currentValue" string val with 100 observers: 0.0002497920000000704s
|
|
210
|
+
1,000 updates to "zdeepSettings.level1.level2.level3.level4.level5.level6.currentValue" string val with 1000 observers: 0.001332209000000148s
|
|
211
|
+
10,000 updates to "zdeepSettings.level1.level2.level3.level4.level5.level6.currentValue" string val with 10 observers: 0.0018820000000000618s
|
|
212
|
+
10,000 updates to "zdeepSettings.level1.level2.level3.level4.level5.level6.currentValue" string val with 100 observers: 0.0024639170000000377s
|
|
213
|
+
10,000 updates to "zdeepSettings.level1.level2.level3.level4.level5.level6.currentValue" string val with 1000 observers: 0.014082249999999932s
|
|
214
|
+
100,000 updates to "zdeepSettings.level1.level2.level3.level4.level5.level6.currentValue" string val with 10 observers: 0.021280209000000015s
|
|
215
|
+
100,000 updates to "zdeepSettings.level1.level2.level3.level4.level5.level6.currentValue" string val with 100 observers: 0.02714695800000027s
|
|
216
|
+
100,000 updates to "zdeepSettings.level1.level2.level3.level4.level5.level6.currentValue" string val with 1000 observers: 0.09046704200000022s
|
|
217
|
+
1,000,000 updates to "zdeepSettings.level1.level2.level3.level4.level5.level6.currentValue" string val with 10 observers: 0.2687363329999998s
|
|
218
|
+
1,000,000 updates to "zdeepSettings.level1.level2.level3.level4.level5.level6.currentValue" string val with 100 observers: 0.3244868329999999s
|
|
219
|
+
1,000,000 updates to "zdeepSettings.level1.level2.level3.level4.level5.level6.currentValue" string val with 1000 observers: 0.9486893330000002s
|
|
218
220
|
```
|
|
219
221
|
|
|
220
222
|
### Intel i9-13900HX · 32 GB RAM · Windows 11
|
package/dist/types.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ type IsCollection<T> = T extends readonly any[] | Map<any, any> | Set<any> ? tru
|
|
|
8
8
|
/**
|
|
9
9
|
* Produces every dot-separated key path into T as a string union.
|
|
10
10
|
*
|
|
11
|
-
* - The `Depth` tuple acts as a recursion counter: when its length reaches
|
|
11
|
+
* - The `Depth` tuple acts as a recursion counter: when its length reaches 10 the
|
|
12
12
|
* type resolves to `never`, which caps the union size and prevents the language
|
|
13
13
|
* server from hanging on deeply-nested or self-referential shapes.
|
|
14
14
|
* - Top-level keys are included as bare strings (`K`), so this type supersedes
|
|
@@ -18,7 +18,7 @@ type IsCollection<T> = T extends readonly any[] | Map<any, any> | Set<any> ? tru
|
|
|
18
18
|
* - Returning `never` (not `''`) from every terminal branch avoids the need for
|
|
19
19
|
* a secondary `Extract<D, string>` pass over the full union.
|
|
20
20
|
*/
|
|
21
|
-
export type DotNestedKeys<T, Depth extends 1[] = []> = Depth['length'] extends
|
|
21
|
+
export type DotNestedKeys<T, Depth extends 1[] = []> = Depth['length'] extends 10 ? never : T extends object ? IsCollection<T> extends true ? never : {
|
|
22
22
|
[K in keyof T & string]: IsCollection<T[K]> extends true ? K : T[K] extends object ? K | `${K}.${DotNestedKeys<T[K], [...Depth, 1]>}` : K;
|
|
23
23
|
}[keyof T & string] : never;
|
|
24
24
|
/**
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "A completely framework-agnostic, JavaScript / TypeScript state management and update broadcasting library wit zero dependencies, solid performance and a micro file size.",
|
|
4
4
|
"name": "totally-tubular",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"version": "0.4.
|
|
6
|
+
"version": "0.4.1",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"state",
|
|
9
9
|
"management",
|
|
@@ -26,27 +26,24 @@
|
|
|
26
26
|
"files": [
|
|
27
27
|
"dist/"
|
|
28
28
|
],
|
|
29
|
-
"scripts": {
|
|
30
|
-
"build": "rm -rf dist/ && tsc --project ./tsconfig.build.json",
|
|
31
|
-
"clean": "rm -rf dist/",
|
|
32
|
-
"test": "bun test",
|
|
33
|
-
"test:watch": "bun test --watch"
|
|
34
|
-
},
|
|
35
29
|
"devDependencies": {
|
|
36
30
|
"@better-builds/lets-version": "^1.6.0",
|
|
37
31
|
"@biomejs/biome": "^2.4.16",
|
|
38
32
|
"@commitlint/cli": "^20.5.3",
|
|
39
33
|
"@commitlint/config-conventional": "^20.5.3",
|
|
40
|
-
"@happy-dom/global-registrator": "^20.10.2",
|
|
41
34
|
"@testing-library/react": "^16.3.2",
|
|
42
35
|
"@testing-library/user-event": "^14.6.1",
|
|
43
|
-
"@types/bun": "latest",
|
|
44
36
|
"@types/react": "^19.2.17",
|
|
37
|
+
"@types/node": "^26.1.1",
|
|
45
38
|
"@types/react-dom": "^19.2.3",
|
|
39
|
+
"@vitejs/plugin-react": "^6.0.3",
|
|
46
40
|
"happy-dom": "^20.10.2",
|
|
47
|
-
"react-dom": "^19.2.7",
|
|
48
41
|
"react": "^19.2.7",
|
|
49
|
-
"
|
|
42
|
+
"react-dom": "^19.2.7",
|
|
43
|
+
"tsx": "^4.23.0",
|
|
44
|
+
"typescript": "^5.9.3",
|
|
45
|
+
"vite": "^8.1.4",
|
|
46
|
+
"vitest": "^4.1.10"
|
|
50
47
|
},
|
|
51
48
|
"peerDependencies": {
|
|
52
49
|
"react": ">=18"
|
|
@@ -74,5 +71,12 @@
|
|
|
74
71
|
"default": "./dist/types.js"
|
|
75
72
|
},
|
|
76
73
|
"./package.json": "./package.json"
|
|
74
|
+
},
|
|
75
|
+
"scripts": {
|
|
76
|
+
"build": "rm -rf dist/ && tsc --project ./tsconfig.build.json",
|
|
77
|
+
"clean": "rm -rf dist/",
|
|
78
|
+
"test": "vitest test",
|
|
79
|
+
"test:performance": "tsx ./performanceTests.ts",
|
|
80
|
+
"test:watch": "vitest test --watch"
|
|
77
81
|
}
|
|
78
|
-
}
|
|
82
|
+
}
|