@kirill.konshin/utils 0.0.7 → 0.0.9

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.
Files changed (101) hide show
  1. package/.ctirc +10 -0
  2. package/.storybook/main.ts +21 -0
  3. package/.storybook/preview.ts +17 -0
  4. package/.turbo/turbo-build.log +67 -0
  5. package/.turbo/turbo-test.log +118 -0
  6. package/CHANGELOG.md +12 -0
  7. package/README.md +59 -0
  8. package/builders/.swcrc +18 -0
  9. package/builders/build.config.ts +11 -0
  10. package/builders/bun.build.js +23 -0
  11. package/builders/package.json +209 -0
  12. package/builders/perf.mjs +63 -0
  13. package/builders/rollup.config.mjs +50 -0
  14. package/builders/rslib.config.ts +26 -0
  15. package/builders/tsconfig.json +21 -0
  16. package/builders/tsup.config.ts +20 -0
  17. package/builders/turbo.json +24 -0
  18. package/builders/vite.config.ts +37 -0
  19. package/demo/cache-demo.ts +2 -1
  20. package/package.json +166 -21
  21. package/src/bootstrap/adaptiveContainer.tsx +12 -0
  22. package/src/bootstrap/controls.stories.tsx +62 -0
  23. package/src/bootstrap/controls.tsx +119 -0
  24. package/src/bootstrap/error.stories.tsx +34 -0
  25. package/src/bootstrap/error.tsx +40 -0
  26. package/src/bootstrap/field.stories.tsx +42 -0
  27. package/src/bootstrap/field.tsx +35 -0
  28. package/src/bootstrap/footer.tsx +49 -0
  29. package/src/bootstrap/globalLoading.stories.tsx +25 -0
  30. package/src/bootstrap/globalLoading.tsx +17 -0
  31. package/src/bootstrap/index.ts +12 -0
  32. package/src/bootstrap/loading.stories.tsx +35 -0
  33. package/src/bootstrap/loading.tsx +22 -0
  34. package/src/bootstrap/main.scss +86 -0
  35. package/src/bootstrap/responsiveHelper.tsx +50 -0
  36. package/src/bootstrap/screen.stories.tsx +160 -0
  37. package/src/bootstrap/screen.tsx +144 -0
  38. package/src/bootstrap/toaster.stories.tsx +32 -0
  39. package/src/bootstrap/toaster.tsx +38 -0
  40. package/src/bootstrap/useModal.stories.tsx +51 -0
  41. package/src/bootstrap/useModal.tsx +88 -0
  42. package/src/bootstrap/useWrappedForm.ts +40 -0
  43. package/src/core/cache.test.ts +121 -0
  44. package/src/{cache.ts → core/cache.ts} +29 -10
  45. package/src/electron/README.md +13 -0
  46. package/src/electron/createWindow.ts +234 -0
  47. package/src/electron/index.ts +2 -0
  48. package/src/electron/updater.ts +54 -0
  49. package/src/electron-builder/builder.ts +150 -0
  50. package/src/electron-builder/images.ts +33 -0
  51. package/src/electron-builder/index.ts +2 -0
  52. package/src/mui/README.md +3 -0
  53. package/src/mui/formControlFieldset.stories.tsx +71 -0
  54. package/src/mui/formControlFieldset.tsx +26 -0
  55. package/src/mui/formLabelLegend.tsx +11 -0
  56. package/src/mui/genericControl.tsx +20 -0
  57. package/src/mui/index.ts +4 -0
  58. package/src/mui/readOnly.tsx +6 -0
  59. package/src/next/appLink.tsx +39 -0
  60. package/src/next/index.ts +5 -0
  61. package/src/next/measure.ts +7 -0
  62. package/src/next/noSSR.tsx +17 -0
  63. package/src/next/redirect.tsx +13 -0
  64. package/src/next/useIsInner.ts +13 -0
  65. package/src/react/apiCall.ts +25 -0
  66. package/src/react/form/client.tsx +62 -0
  67. package/src/react/form/form.tsx +109 -0
  68. package/src/react/form/index.ts +2 -0
  69. package/src/react/index.ts +4 -0
  70. package/src/react/useFetch.ts +29 -0
  71. package/src/react/useFetcher.ts +49 -0
  72. package/src/react-native/index.ts +3 -0
  73. package/src/react-native/share.ts +31 -0
  74. package/src/react-native/update.tsx +40 -0
  75. package/src/react-native/useAppState.ts +18 -0
  76. package/src/tailwind/fullpage.tsx +11 -0
  77. package/src/tailwind/index.ts +2 -0
  78. package/src/tailwind/responsiveHelper.tsx +16 -0
  79. package/src-todo/auth0.tsx +177 -0
  80. package/tsconfig.json +15 -18
  81. package/turbo.json +2 -11
  82. package/vite.config.ts +47 -0
  83. package/vite.exports.ts +121 -0
  84. package/build/cache.d.ts +0 -119
  85. package/build/cache.js +0 -176
  86. package/build/errors.d.ts +0 -1
  87. package/build/errors.js +0 -14
  88. package/build/index.d.ts +0 -5
  89. package/build/index.js +0 -5
  90. package/build/measure.d.ts +0 -34
  91. package/build/measure.js +0 -48
  92. package/build/mutex.d.ts +0 -5
  93. package/build/mutex.js +0 -23
  94. package/build/worker.d.ts +0 -83
  95. package/build/worker.js +0 -250
  96. package/tsconfig.tsbuildinfo +0 -1
  97. package/src/{errors.ts → core/errors.ts} +0 -0
  98. package/src/{index.ts → core/index.ts} +1 -1
  99. /package/src/{measure.ts → core/measure.ts} +0 -0
  100. /package/src/{mutex.ts → core/mutex.ts} +0 -0
  101. /package/src/{worker.ts → core/worker.ts} +0 -0
package/.ctirc ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "addNewline": true,
3
+ "fileExcludePatterns": [
4
+ "*.stories.*",
5
+ "*.test.*"
6
+ ],
7
+ "verbose": false,
8
+ "withoutBackupFile": true,
9
+ "withoutComment": true
10
+ }
@@ -0,0 +1,21 @@
1
+ import { join, dirname } from 'node:path';
2
+ import type { StorybookConfig } from '@storybook/react-vite';
3
+
4
+ const getAbsolutePath = (value: string) => dirname(require.resolve(join(value, 'package.json')));
5
+
6
+ //TODO https://github.com/tuchk4/storybook-readme
7
+ const config: StorybookConfig = {
8
+ stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
9
+ addons: [
10
+ getAbsolutePath('@storybook/addon-onboarding'),
11
+ getAbsolutePath('@storybook/addon-essentials'),
12
+ getAbsolutePath('@chromatic-com/storybook'),
13
+ getAbsolutePath('@storybook/addon-interactions'),
14
+ ],
15
+ framework: {
16
+ name: getAbsolutePath('@storybook/react-vite'),
17
+ options: {},
18
+ },
19
+ };
20
+
21
+ export default config;
@@ -0,0 +1,17 @@
1
+ import type { Preview } from '@storybook/react';
2
+
3
+ import 'bootstrap-icons/font/bootstrap-icons.css';
4
+ import '../src/bootstrap/main.scss';
5
+
6
+ const preview: Preview = {
7
+ parameters: {
8
+ controls: {
9
+ matchers: {
10
+ color: /(background|color)$/i,
11
+ date: /Date$/i,
12
+ },
13
+ },
14
+ },
15
+ };
16
+
17
+ export default preview;
@@ -0,0 +1,67 @@
1
+ vite v6.0.11 building SSR bundle for production...
2
+ create succeeded: /home/runner/work/utils/utils/packages/utils/src/core
3
+ create succeeded: /home/runner/work/utils/utils/packages/utils/src/electron-builder
4
+ create succeeded: /home/runner/work/utils/utils/packages/utils/src/electron
5
+ create succeeded: /home/runner/work/utils/utils/packages/utils/src/bootstrap
6
+ create succeeded: /home/runner/work/utils/utils/packages/utils/src/mui
7
+ create succeeded: /home/runner/work/utils/utils/packages/utils/src/next
8
+ create succeeded: /home/runner/work/utils/utils/packages/utils/src/react-native
9
+ create succeeded: /home/runner/work/utils/utils/packages/utils/src/tailwind
10
+ create succeeded: /home/runner/work/utils/utils/packages/utils/src/react
11
+ transforming...
12
+ ✓ 50 modules transformed.
13
+ rendering chunks...
14
+
15
+ [vite:dts] Start generate declaration files...
16
+ dist/electron-builder/index.js 0.17 kB │ map: 0.09 kB
17
+ dist/tailwind/index.js 0.18 kB │ map: 0.09 kB
18
+ dist/react-native/index.js 0.21 kB │ map: 0.09 kB
19
+ dist/electron/index.js 0.21 kB │ map: 0.09 kB
20
+ dist/mui/readOnly.js 0.31 kB │ map: 0.55 kB
21
+ dist/mui/index.js 0.33 kB │ map: 0.09 kB
22
+ dist/next/index.js 0.34 kB │ map: 0.10 kB
23
+ dist/core/errors.js 0.35 kB │ map: 0.86 kB
24
+ dist/tailwind/fullpage.js 0.35 kB │ map: 0.61 kB
25
+ dist/next/useIsInner.js 0.36 kB │ map: 0.62 kB
26
+ dist/next/measure.js 0.38 kB │ map: 0.55 kB
27
+ dist/mui/formLabelLegend.js 0.38 kB │ map: 0.67 kB
28
+ dist/bootstrap/adaptiveContainer.js 0.40 kB │ map: 0.66 kB
29
+ dist/bootstrap/globalLoading.js 0.43 kB │ map: 0.82 kB
30
+ dist/next/noSSR.js 0.44 kB │ map: 0.89 kB
31
+ dist/react-native/useAppState.js 0.47 kB │ map: 0.84 kB
32
+ dist/react/index.js 0.48 kB │ map: 0.09 kB
33
+ dist/mui/genericControl.js 0.50 kB │ map: 1.02 kB
34
+ dist/bootstrap/loading.js 0.54 kB │ map: 1.01 kB
35
+ dist/core/index.js 0.56 kB │ map: 0.09 kB
36
+ dist/react/useFetch.js 0.56 kB │ map: 1.70 kB
37
+ dist/mui/formControlFieldset.js 0.64 kB │ map: 1.23 kB
38
+ dist/next/appLink.js 0.75 kB │ map: 1.55 kB
39
+ dist/core/mutex.js 0.76 kB │ map: 1.19 kB
40
+ dist/bootstrap/error.js 0.78 kB │ map: 1.66 kB
41
+ dist/bootstrap/field.js 0.79 kB │ map: 1.56 kB
42
+ dist/tailwind/responsiveHelper.js 0.82 kB │ map: 1.14 kB
43
+ dist/react-native/share.js 0.85 kB │ map: 1.75 kB
44
+ dist/react/apiCall.js 0.85 kB │ map: 1.47 kB
45
+ dist/bootstrap/useWrappedForm.js 0.90 kB │ map: 2.22 kB
46
+ dist/bootstrap/index.js 0.95 kB │ map: 0.10 kB
47
+ dist/electron-builder/images.js 1.02 kB │ map: 1.95 kB
48
+ dist/react-native/update.js 1.03 kB │ map: 1.97 kB
49
+ dist/react/useFetcher.js 1.20 kB │ map: 2.47 kB
50
+ dist/bootstrap/toaster.js 1.23 kB │ map: 2.08 kB
51
+ dist/core/measure.js 1.43 kB │ map: 2.88 kB
52
+ dist/electron/updater.js 1.44 kB │ map: 2.61 kB
53
+ dist/bootstrap/footer.js 1.53 kB │ map: 2.57 kB
54
+ dist/react/form/client.js 1.56 kB │ map: 3.36 kB
55
+ dist/bootstrap/responsiveHelper.js 1.77 kB │ map: 2.87 kB
56
+ dist/bootstrap/useModal.js 2.09 kB │ map: 4.75 kB
57
+ dist/react/form/form.js 2.57 kB │ map: 5.74 kB
58
+ dist/bootstrap/controls.js 2.74 kB │ map: 5.81 kB
59
+ dist/core/cache.js 3.02 kB │ map: 9.95 kB
60
+ dist/electron-builder/builder.js 3.09 kB │ map: 6.76 kB
61
+ dist/bootstrap/screen.js 3.37 kB │ map: 7.04 kB
62
+ dist/electron/createWindow.js 5.39 kB │ map: 10.88 kB
63
+ dist/core/worker.js 7.45 kB │ map: 15.67 kB
64
+ [vite:dts] Declaration files built in 5402ms.
65
+
66
+ ✓ built in 5.68s
67
+ Updated package.json with exports
@@ -0,0 +1,118 @@
1
+ [?25lcreate succeeded: /home/runner/work/utils/utils/packages/utils/src/bootstrap
2
+ create succeeded: /home/runner/work/utils/utils/packages/utils/src/core
3
+ create succeeded: /home/runner/work/utils/utils/packages/utils/src/electron
4
+ create succeeded: /home/runner/work/utils/utils/packages/utils/src/mui
5
+ create succeeded: /home/runner/work/utils/utils/packages/utils/src/react-native
6
+ create succeeded: /home/runner/work/utils/utils/packages/utils/src/electron-builder
7
+ create succeeded: /home/runner/work/utils/utils/packages/utils/src/next
8
+ create succeeded: /home/runner/work/utils/utils/packages/utils/src/tailwind
9
+ create succeeded: /home/runner/work/utils/utils/packages/utils/src/react
10
+
11
+  RUN  v3.0.4 /home/runner/work/utils/utils/packages/utils
12
+ Coverage enabled with v8
13
+
14
+ stderr | src/core/cache.test.ts > TransformerMap > simple
15
+ CREATE cache test
16
+
17
+ stderr | src/core/cache.test.ts > TransformerMap > key transform
18
+ CREATE cache test
19
+
20
+ stdout | src/core/cache.test.ts > TransformerMap > key transform
21
+ CLEAR cache test
22
+
23
+ ✓ src/core/cache.test.ts (4 tests) 10ms
24
+
25
+  Test Files  1 passed (1)
26
+  Tests  4 passed (4)
27
+  Start at  05:36:42
28
+  Duration  904ms (transform 50ms, setup 0ms, collect 44ms, tests 10ms, environment 0ms, prepare 76ms)
29
+
30
+  % Coverage report from v8
31
+ -------------------|---------|----------|---------|---------|-------------------
32
+ File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
33
+ -------------------|---------|----------|---------|---------|-------------------
34
+ All files | 3.28 | 63.82 | 53.08 | 3.28 |
35
+ utils | 0 | 0 | 0 | 0 |
36
+ vite.exports.ts | 0 | 0 | 0 | 0 | 1-121
37
+ utils/builders | 0 | 0 | 0 | 0 |
38
+ bun.build.js | 0 | 0 | 0 | 0 | 1-23
39
+ perf.mjs | 0 | 0 | 0 | 0 | 1-63
40
+ rslib.config.ts | 0 | 0 | 0 | 0 | 1-26
41
+ utils/demo | 0 | 50 | 50 | 0 |
42
+ ...demo-clean.ts | 0 | 0 | 0 | 0 | 1-73
43
+ cache-demo.ts | 0 | 100 | 100 | 0 | 3-343
44
+ utils/src-todo | 0 | 0 | 0 | 0 |
45
+ auth0.tsx | 0 | 0 | 0 | 0 |
46
+ .../src/bootstrap | 0 | 71.42 | 71.42 | 0 |
47
+ ...Container.tsx | 0 | 100 | 100 | 0 | 2-12
48
+ ...s.stories.tsx | 0 | 0 | 0 | 0 | 1-62
49
+ controls.tsx | 0 | 0 | 0 | 0 | 1-119
50
+ ...r.stories.tsx | 0 | 100 | 100 | 0 | 2-34
51
+ error.tsx | 0 | 100 | 100 | 0 | 4-40
52
+ ...d.stories.tsx | 0 | 100 | 100 | 0 | 3-42
53
+ field.tsx | 0 | 100 | 100 | 0 | 2-35
54
+ footer.tsx | 0 | 100 | 100 | 0 | 2-49
55
+ ...g.stories.tsx | 0 | 100 | 100 | 0 | 3-25
56
+ ...alLoading.tsx | 0 | 100 | 100 | 0 | 3-17
57
+ index.ts | 0 | 0 | 0 | 0 | 1-12
58
+ ...g.stories.tsx | 0 | 100 | 100 | 0 | 3-35
59
+ loading.tsx | 0 | 0 | 0 | 0 | 1-22
60
+ ...iveHelper.tsx | 0 | 100 | 100 | 0 | 3-50
61
+ ...n.stories.tsx | 0 | 100 | 100 | 0 | 3-160
62
+ screen.tsx | 0 | 100 | 100 | 0 | 2-144
63
+ ...r.stories.tsx | 0 | 100 | 100 | 0 | 2-32
64
+ toaster.tsx | 0 | 100 | 100 | 0 | 3-38
65
+ ...l.stories.tsx | 0 | 100 | 100 | 0 | 3-51
66
+ useModal.tsx | 0 | 0 | 0 | 0 | 1-88
67
+ ...rappedForm.ts | 0 | 0 | 0 | 0 | 1-40
68
+ utils/src/core | 20.2 | 82.35 | 52.38 | 20.2 |
69
+ cache.ts | 81.25 | 89.65 | 56.25 | 81.25 | ...98-199,218-219
70
+ errors.ts | 0 | 100 | 100 | 0 | 2-14
71
+ index.ts | 0 | 0 | 0 | 0 | 1-5
72
+ measure.ts | 0 | 0 | 0 | 0 | 1-61
73
+ mutex.ts | 0 | 100 | 100 | 0 | 3-22
74
+ worker.ts | 0 | 0 | 0 | 0 | 1-327
75
+ ...s/src/electron | 0 | 33.33 | 33.33 | 0 |
76
+ createWindow.ts | 0 | 0 | 0 | 0 | 1-234
77
+ index.ts | 0 | 0 | 0 | 0 | 1-2
78
+ updater.ts | 0 | 100 | 100 | 0 | 2-54
79
+ ...ectron-builder | 0 | 33.33 | 33.33 | 0 |
80
+ builder.ts | 0 | 100 | 100 | 0 | 4-150
81
+ images.ts | 0 | 0 | 0 | 0 | 1-33
82
+ index.ts | 0 | 0 | 0 | 0 | 1-2
83
+ utils/src/mui | 0 | 83.33 | 83.33 | 0 |
84
+ ...t.stories.tsx | 0 | 100 | 100 | 0 | 4-71
85
+ ...lFieldset.tsx | 0 | 100 | 100 | 0 | 2-26
86
+ ...belLegend.tsx | 0 | 100 | 100 | 0 | 2-11
87
+ ...icControl.tsx | 0 | 100 | 100 | 0 | 2-19
88
+ index.ts | 0 | 0 | 0 | 0 | 1-4
89
+ readOnly.tsx | 0 | 100 | 100 | 0 | 2-5
90
+ utils/src/next | 0 | 66.66 | 66.66 | 0 |
91
+ appLink.tsx | 0 | 100 | 100 | 0 | 4-39
92
+ index.ts | 0 | 0 | 0 | 0 | 1-5
93
+ measure.ts | 0 | 0 | 0 | 0 | 1-7
94
+ noSSR.tsx | 0 | 100 | 100 | 0 | 3-17
95
+ redirect.tsx | 0 | 100 | 100 | 0 | 3-13
96
+ useIsInner.ts | 0 | 100 | 100 | 0 | 3-13
97
+ utils/src/react | 0 | 25 | 25 | 0 |
98
+ apiCall.ts | 0 | 0 | 0 | 0 | 1-25
99
+ index.ts | 0 | 0 | 0 | 0 | 1-4
100
+ useFetch.ts | 0 | 100 | 100 | 0 | 3-29
101
+ useFetcher.ts | 0 | 0 | 0 | 0 | 1-49
102
+ ...c/react-native | 0 | 0 | 0 | 0 |
103
+ index.ts | 0 | 0 | 0 | 0 | 1-3
104
+ share.ts | 0 | 0 | 0 | 0 | 1-31
105
+ update.tsx | 0 | 0 | 0 | 0 | 1-40
106
+ useAppState.ts | 0 | 0 | 0 | 0 | 1-18
107
+ ...src/react/form | 0 | 33.33 | 33.33 | 0 |
108
+ client.tsx | 0 | 100 | 100 | 0 | 3-62
109
+ form.tsx | 0 | 0 | 0 | 0 | 1-109
110
+ index.ts | 0 | 0 | 0 | 0 | 1-2
111
+ ...s/src/tailwind | 0 | 66.66 | 66.66 | 0 |
112
+ fullpage.tsx | 0 | 100 | 100 | 0 | 3-10
113
+ index.ts | 0 | 0 | 0 | 0 | 1-2
114
+ ...iveHelper.tsx | 0 | 100 | 100 | 0 | 5-16
115
+ -------------------|---------|----------|---------|---------|-------------------
116
+ Updated package.json with exports
117
+ Updated package.json with exports
118
+ [?25h
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @kirill.konshin/utils
2
2
 
3
+ ## 0.0.9
4
+
5
+ ### Patch Changes
6
+
7
+ - 89690b2: Demos, consolidated packages, tests, Vite, perf tests
8
+
9
+ ## 0.0.8
10
+
11
+ ### Patch Changes
12
+
13
+ - Cache fixes
14
+
3
15
  ## 0.0.7
4
16
 
5
17
  ### Patch Changes
package/README.md ADDED
@@ -0,0 +1,59 @@
1
+ # Installation
2
+
3
+ ```bash
4
+ $ npm install @kirill.konshin/utils
5
+ ```
6
+
7
+ ```ts
8
+ // moduleResoliution: nodenext
9
+ import { createWindow } from '@kirill.konshin/utils/electron';
10
+
11
+ // moduleResoliution: node
12
+ import { createWindow } from '@kirill.konshin/utils/dist/electron';
13
+ ```
14
+
15
+ # Building
16
+
17
+ https://jakeginnivan.medium.com/options-for-publishing-typescript-libraries-9c37bec28fe
18
+
19
+ ```
20
+ 'yarn build:bare': '4.7',
21
+ 'yarn build:vite': '4.0',
22
+ 'yarn build:rollup': '4.0',
23
+ 'yarn build:tsup': '10.1',
24
+ 'yarn build:unbuild': '4.5'
25
+ 'yarn build:rslib': '3.9'
26
+ ```
27
+
28
+ - `tsup`
29
+ - slow
30
+ - ✅ Minimal config
31
+ - `swc` + `tsc`
32
+ - ❌ A bit slower than rollup/vite
33
+ - ⚠️ Lots of configs
34
+ - `rollup+swc`
35
+ - ⚠️ Quirks with watch mode
36
+ - ⚠️ Seem to reemit all files all the time
37
+ - `vite`
38
+ - ✅ Fast
39
+ - ✅ Comes with `vitest`
40
+ - ✅ Comes with Storybook plugin
41
+ - ⚠️ Based on Rollup, inherits its quirks
42
+ - ⚠️ Awkward configuration, half Vite half Rollup
43
+ - `rslib` aka `rsbuild`, from MF authors
44
+ - ✅ Fast
45
+ - ✅ Minimal config
46
+ - ⚠️ Something wrong with the types
47
+ - `unbuild`
48
+ - ❌ Slower than vite/rollup+swc
49
+ - ⚠️ Based on Rollup, inherits its quirks
50
+ - ✅ Minimal config
51
+ - `bun`
52
+ - ❌ DTS is slow
53
+ - ❌ Build failed
54
+ - ❌ Does not work as standalone bundler
55
+ - `turbopack`
56
+ - ❌ Not yet available outside Next.js https://turbo.build/pack/docs#quickstart
57
+ - https://qwik.dev/
58
+ - https://tsdx.io/ Jared Palmer, I know him
59
+ - ❌ Dead project
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://swc.rs/schema.json",
3
+ "jsc": {
4
+ "parser": {
5
+ "syntax": "typescript",
6
+ "tsx": true
7
+ },
8
+ "target": "es2020",
9
+ "keepClassNames": true
10
+ },
11
+ "module": {
12
+ "type": "es6",
13
+ "strict": true,
14
+ "preserveImportMeta": true
15
+ },
16
+ "sourceMaps": true,
17
+ "exclude": [".*\\.stories\\.ts$", ".*\\.stories\\.tsx$", ".*\\.test\\.ts$"]
18
+ }
@@ -0,0 +1,11 @@
1
+ import { BuildConfig } from 'unbuild';
2
+ import { entry, entryGlob, external, fixExports, formats, includeGlob } from './exports.mjs';
3
+
4
+ export default {
5
+ entries: entry,
6
+ declaration: true,
7
+ clean: true,
8
+ outDir: 'dist-unbuild',
9
+ externals: external,
10
+ failOnWarn: false,
11
+ } satisfies BuildConfig;
@@ -0,0 +1,23 @@
1
+ import { Glob, build } from 'bun';
2
+ import dts from 'bun-plugin-dts';
3
+ import { entry, external } from './exports.mjs';
4
+
5
+ const results = await build({
6
+ entrypoints: entry,
7
+ publicPath: '',
8
+ sourcemap: 'linked',
9
+ outdir: 'dist-bun',
10
+ plugins: [dts({})],
11
+ target: 'node',
12
+ external,
13
+ format: 'esm',
14
+ });
15
+
16
+ if (results.success == false) {
17
+ console.error('Build failed');
18
+ for (const message of results.logs) {
19
+ console.error(message);
20
+ }
21
+ } else {
22
+ console.log('Compiled ' + results.outputs.length + ' javascript files...');
23
+ }
@@ -0,0 +1,209 @@
1
+ {
2
+ "name": "@kirill.konshin/utils",
3
+ "description": "Utilities",
4
+ "version": "0.0.8",
5
+ "type": "module",
6
+ "scripts": {
7
+ "clean": "rm -rf dist .tscache tsconfig.tsbuildinfo",
8
+ "----- BUILD -----": "",
9
+ "build": "echo Done",
10
+ "build:tsup": "tsup",
11
+ "build:vite": "vite build",
12
+ "build:rollup": "rollup --config rollup.config.mjs",
13
+ "build:unbuild": "unbuild",
14
+ "build:bare": "yarn clean && yarn build:swc && yarn build:tsc",
15
+ "build:swc": "swc src --out-dir dist-bare --strip-leading-paths",
16
+ "build:tsc": "tsc --declaration --emitDeclarationOnly --outDir dist-bare",
17
+ "build:rslib": "rslib build",
18
+ "build:check-types": "attw --pack .",
19
+ "build:index": "cti create ./src/*",
20
+ "build:exports": "FIX=true node exports.mjs",
21
+ "----- TURBO -----": "",
22
+ "x-start": "yarn build --watch",
23
+ "start": "turbo run start:swc start:tsc",
24
+ "start:swc": "yarn build:swc --watch",
25
+ "start:tsc": "yarn build:tsc --watch --preserveWatchOutput",
26
+ "----- TEST & UTILS -----": "",
27
+ "wait": "wait-on ./dist/core/index.mjs",
28
+ "test": "vitest run --coverage",
29
+ "test:watch": "vitest watch --coverage",
30
+ "storybook:start": "storybook dev -p 6006",
31
+ "storybook:build": "storybook build"
32
+ },
33
+ "dependencies": {
34
+ "clsx": "^2.1.1",
35
+ "colors": "^1.4.0",
36
+ "expo-file-system": "^18.0.7",
37
+ "expo-sharing": "^13.0.1",
38
+ "expo-updates": "^0.26.13",
39
+ "many-keys-map": "^2.0.1",
40
+ "psd": "^3.4.0",
41
+ "react-hook-form": "^7.54.2",
42
+ "sharp": "^0.33.5"
43
+ },
44
+ "devDependencies": {
45
+ "@arethetypeswrong/cli": "^0.17.3",
46
+ "@chromatic-com/storybook": "^3.2.4",
47
+ "@emotion/react": "^11.14.0",
48
+ "@emotion/styled": "^11.14.0",
49
+ "@microsoft/api-extractor": "^7.49.2",
50
+ "@mui/material": "^6.4.2",
51
+ "@mui/styled-engine": "^6.4.2",
52
+ "@rollup/plugin-commonjs": "^28.0.2",
53
+ "@rollup/plugin-multi-entry": "^6.0.1",
54
+ "@rollup/plugin-node-resolve": "^16.0.0",
55
+ "@rollup/plugin-swc": "^0.4.0",
56
+ "@rslib/core": "^0.4.0",
57
+ "@storybook/addon-essentials": "^8.5.2",
58
+ "@storybook/addon-interactions": "^8.5.2",
59
+ "@storybook/addon-onboarding": "^8.5.2",
60
+ "@storybook/blocks": "^8.5.2",
61
+ "@storybook/react": "^8.5.2",
62
+ "@storybook/react-vite": "^8.5.2",
63
+ "@storybook/test": "^8.5.2",
64
+ "@swc/cli": "^0.6.0",
65
+ "@swc/core": "^1.10.11",
66
+ "@types/bun": "^1.2.1",
67
+ "@types/psd": "^3.4.3",
68
+ "@vitest/coverage-v8": "^3.0.4",
69
+ "bootstrap": "^5.3.3",
70
+ "bootstrap-icons": "^1.11.3",
71
+ "bun": "^1.2.1",
72
+ "bun-plugin-dts": "^0.3.0",
73
+ "chokidar": "^4.0.3",
74
+ "create-ts-index": "^1.14.0",
75
+ "electron": "^34.0.1",
76
+ "electron-builder": "^25.1.8",
77
+ "electron-default-menu": "^1.0.2",
78
+ "electron-store": "^10.0.1",
79
+ "electron-updater": "^6.4.0",
80
+ "glob": "^11.0.1",
81
+ "next": "^15.1.6",
82
+ "react-bootstrap": "^2.10.8",
83
+ "react-native": "^0.77.0",
84
+ "rollup": "^4.32.1",
85
+ "rollup-plugin-delete": "^2.1.0",
86
+ "sass-embedded": "^1.83.4",
87
+ "storybook": "^8.5.2",
88
+ "tailwindcss": "^4.0.1",
89
+ "tsup": "^8.3.6",
90
+ "unbuild": "^3.3.1",
91
+ "vite": "^6.0.11",
92
+ "vitest": "^3.0.4",
93
+ "zod": "^3.24.1"
94
+ },
95
+ "peerDependencies": {
96
+ "@mui/material": "^6",
97
+ "bootstrap": "^5",
98
+ "bootstrap-icons": "^1",
99
+ "electron": "^34",
100
+ "next": "^15",
101
+ "react": "^19",
102
+ "react-bootstrap": "^2",
103
+ "react-native": "^0.77",
104
+ "tailwindcss": "^4.0.0",
105
+ "zod": "^3"
106
+ },
107
+ "peerDependenciesMeta": {
108
+ "@mui/material": {
109
+ "optional": true
110
+ },
111
+ "bootstrap": {
112
+ "optional": true
113
+ },
114
+ "bootstrap-icons": {
115
+ "optional": true
116
+ },
117
+ "electron": {
118
+ "optional": true
119
+ },
120
+ "next": {
121
+ "optional": true
122
+ },
123
+ "react": {
124
+ "optional": true
125
+ },
126
+ "react-bootstrap": {
127
+ "optional": true
128
+ },
129
+ "react-native": {
130
+ "optional": true
131
+ },
132
+ "tailwind": {
133
+ "optional": true
134
+ },
135
+ "zod": {
136
+ "optional": true
137
+ }
138
+ },
139
+ "publishConfig": {
140
+ "access": "public"
141
+ },
142
+ "author": "Kirill Konshin <kirill@konshin.org> (https://konshin.org)",
143
+ "license": "MIT",
144
+ "exports": {
145
+ "./tailwind": {
146
+ "import": {
147
+ "import": "./dist/tailwind/index.mjs",
148
+ "types": "./dist/tailwind/index.d.ts"
149
+ }
150
+ },
151
+ "./react-native": {
152
+ "import": {
153
+ "import": "./dist/react-native/index.mjs",
154
+ "types": "./dist/react-native/index.d.ts"
155
+ }
156
+ },
157
+ "./react": {
158
+ "import": {
159
+ "import": "./dist/react/index.mjs",
160
+ "types": "./dist/react/index.d.ts"
161
+ }
162
+ },
163
+ "./next": {
164
+ "import": {
165
+ "import": "./dist/next/index.mjs",
166
+ "types": "./dist/next/index.d.ts"
167
+ }
168
+ },
169
+ "./mui": {
170
+ "import": {
171
+ "import": "./dist/mui/index.mjs",
172
+ "types": "./dist/mui/index.d.ts"
173
+ }
174
+ },
175
+ "./electron-builder": {
176
+ "import": {
177
+ "import": "./dist/electron-builder/index.mjs",
178
+ "types": "./dist/electron-builder/index.d.ts"
179
+ }
180
+ },
181
+ "./electron": {
182
+ "import": {
183
+ "import": "./dist/electron/index.mjs",
184
+ "types": "./dist/electron/index.d.ts"
185
+ }
186
+ },
187
+ "./core": {
188
+ "import": {
189
+ "import": "./dist/core/index.mjs",
190
+ "types": "./dist/core/index.d.ts"
191
+ }
192
+ },
193
+ "./bootstrap": {
194
+ "import": {
195
+ "import": "./dist/bootstrap/index.mjs",
196
+ "types": "./dist/bootstrap/index.d.ts"
197
+ }
198
+ },
199
+ ".": {
200
+ "import": {
201
+ "import": "./dist/core/index.mjs",
202
+ "types": "./dist/core/index.d.ts"
203
+ }
204
+ }
205
+ },
206
+ "main": "./dist/core/index.mjs",
207
+ "module": "./dist/core/index.mjs",
208
+ "types": "./dist/core/index.d.ts"
209
+ }
@@ -0,0 +1,63 @@
1
+ import { execSync } from 'child_process';
2
+
3
+ const toSeconds = (ms) => (ms / 1000).toFixed(1);
4
+
5
+ function run(cmd) {
6
+ const t1 = performance.now();
7
+ execSync(`time (${cmd})`, { stdio: 'ignore' }); // inherit
8
+ return performance.now() - t1;
9
+ }
10
+
11
+ function sleep(s) {
12
+ const waitTill = performance.now() + s * 1000;
13
+ while (waitTill > performance.now()) {
14
+ // do nothing
15
+ }
16
+ }
17
+
18
+ const mean = (arr) => arr.reduce((sum, num) => sum + num, 0) / arr.length;
19
+
20
+ const geometricMean = (arr) =>
21
+ Math.pow(
22
+ arr.reduce((prod, num) => prod * num, 1),
23
+ 1 / arr.length,
24
+ );
25
+
26
+ const harmonicMean = (arr) => arr.length / arr.reduce((sum, num) => sum + 1 / num, 0);
27
+
28
+ const quadraticMean = (arr) => Math.sqrt(arr.reduce((sum, num) => sum + num ** 2, 0) / arr.length);
29
+
30
+ function perf(cmd, n = 5) {
31
+ const res = [];
32
+ for (let i = 0; i < n; i++) {
33
+ res.push(run(cmd));
34
+ console.log('Iteration', i, toSeconds(res.at(-1)), cmd);
35
+ sleep(1);
36
+ }
37
+ const avg = toSeconds(harmonicMean(res));
38
+ console.log();
39
+ console.log('Average', avg, cmd);
40
+ console.log();
41
+ return avg;
42
+ }
43
+
44
+ const cmds = [
45
+ // 'yarn build:index && yarn build:bare && yarn build:exports',
46
+ // 'yarn build:index && yarn build:vite && yarn build:exports',
47
+ // 'yarn build:index && yarn build:rollup && yarn build:exports',
48
+ // 'yarn build:index && yarn build:tsup && yarn build:exports',
49
+ // 'yarn build:bare',
50
+ // 'yarn build:vite',
51
+ // 'yarn build:rollup',
52
+ // 'yarn build:tsup',
53
+ // 'yarn build:unbuild',
54
+ 'yarn build:rslib',
55
+ ];
56
+
57
+ let results = {};
58
+
59
+ for (const cmd of cmds) {
60
+ results[cmd] = perf(cmd, 3);
61
+ }
62
+
63
+ console.log(results);