create-microact-app 1.0.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.
Files changed (213) hide show
  1. package/index.js +95 -0
  2. package/package.json +21 -0
  3. package/templates/vanilla/.github/workflows/deploy.yml +38 -0
  4. package/templates/vanilla/index.html +13 -0
  5. package/templates/vanilla/node_modules/.package-lock.json +207 -0
  6. package/templates/vanilla/node_modules/@esbuild/darwin-x64/README.md +3 -0
  7. package/templates/vanilla/node_modules/@esbuild/darwin-x64/bin/esbuild +0 -0
  8. package/templates/vanilla/node_modules/@esbuild/darwin-x64/package.json +17 -0
  9. package/templates/vanilla/node_modules/@monygroupcorp/microact/README.md +154 -0
  10. package/templates/vanilla/node_modules/@monygroupcorp/microact/dist/microact.cjs.js +1749 -0
  11. package/templates/vanilla/node_modules/@monygroupcorp/microact/dist/microact.cjs.js.map +1 -0
  12. package/templates/vanilla/node_modules/@monygroupcorp/microact/dist/microact.esm.js +1743 -0
  13. package/templates/vanilla/node_modules/@monygroupcorp/microact/dist/microact.esm.js.map +1 -0
  14. package/templates/vanilla/node_modules/@monygroupcorp/microact/dist/microact.umd.js +2 -0
  15. package/templates/vanilla/node_modules/@monygroupcorp/microact/dist/microact.umd.js.map +1 -0
  16. package/templates/vanilla/node_modules/@monygroupcorp/microact/example/index.html +13 -0
  17. package/templates/vanilla/node_modules/@monygroupcorp/microact/example/index.js +63 -0
  18. package/templates/vanilla/node_modules/@monygroupcorp/microact/package.json +38 -0
  19. package/templates/vanilla/node_modules/@monygroupcorp/microact/rollup.config.cjs +30 -0
  20. package/templates/vanilla/node_modules/@monygroupcorp/microact/src/Component.js +831 -0
  21. package/templates/vanilla/node_modules/@monygroupcorp/microact/src/DOMUpdater.js +320 -0
  22. package/templates/vanilla/node_modules/@monygroupcorp/microact/src/EventBus.js +123 -0
  23. package/templates/vanilla/node_modules/@monygroupcorp/microact/src/Router.js +253 -0
  24. package/templates/vanilla/node_modules/@monygroupcorp/microact/src/UpdateScheduler.js +218 -0
  25. package/templates/vanilla/node_modules/@monygroupcorp/microact/src/index.js +6 -0
  26. package/templates/vanilla/node_modules/esbuild/LICENSE.md +21 -0
  27. package/templates/vanilla/node_modules/esbuild/README.md +3 -0
  28. package/templates/vanilla/node_modules/esbuild/bin/esbuild +0 -0
  29. package/templates/vanilla/node_modules/esbuild/install.js +287 -0
  30. package/templates/vanilla/node_modules/esbuild/lib/main.d.ts +660 -0
  31. package/templates/vanilla/node_modules/esbuild/lib/main.js +2393 -0
  32. package/templates/vanilla/node_modules/esbuild/package.json +42 -0
  33. package/templates/vanilla/node_modules/nanoid/LICENSE +20 -0
  34. package/templates/vanilla/node_modules/nanoid/README.md +39 -0
  35. package/templates/vanilla/node_modules/nanoid/async/index.browser.cjs +69 -0
  36. package/templates/vanilla/node_modules/nanoid/async/index.browser.js +34 -0
  37. package/templates/vanilla/node_modules/nanoid/async/index.cjs +71 -0
  38. package/templates/vanilla/node_modules/nanoid/async/index.d.ts +56 -0
  39. package/templates/vanilla/node_modules/nanoid/async/index.js +35 -0
  40. package/templates/vanilla/node_modules/nanoid/async/index.native.js +26 -0
  41. package/templates/vanilla/node_modules/nanoid/async/package.json +12 -0
  42. package/templates/vanilla/node_modules/nanoid/bin/nanoid.cjs +55 -0
  43. package/templates/vanilla/node_modules/nanoid/index.browser.cjs +72 -0
  44. package/templates/vanilla/node_modules/nanoid/index.browser.js +34 -0
  45. package/templates/vanilla/node_modules/nanoid/index.cjs +85 -0
  46. package/templates/vanilla/node_modules/nanoid/index.d.cts +91 -0
  47. package/templates/vanilla/node_modules/nanoid/index.d.ts +91 -0
  48. package/templates/vanilla/node_modules/nanoid/index.js +45 -0
  49. package/templates/vanilla/node_modules/nanoid/nanoid.js +1 -0
  50. package/templates/vanilla/node_modules/nanoid/non-secure/index.cjs +34 -0
  51. package/templates/vanilla/node_modules/nanoid/non-secure/index.d.ts +33 -0
  52. package/templates/vanilla/node_modules/nanoid/non-secure/index.js +21 -0
  53. package/templates/vanilla/node_modules/nanoid/non-secure/package.json +6 -0
  54. package/templates/vanilla/node_modules/nanoid/package.json +89 -0
  55. package/templates/vanilla/node_modules/nanoid/url-alphabet/index.cjs +7 -0
  56. package/templates/vanilla/node_modules/nanoid/url-alphabet/index.js +3 -0
  57. package/templates/vanilla/node_modules/nanoid/url-alphabet/package.json +6 -0
  58. package/templates/vanilla/node_modules/picocolors/LICENSE +15 -0
  59. package/templates/vanilla/node_modules/picocolors/README.md +21 -0
  60. package/templates/vanilla/node_modules/picocolors/package.json +25 -0
  61. package/templates/vanilla/node_modules/picocolors/picocolors.browser.js +4 -0
  62. package/templates/vanilla/node_modules/picocolors/picocolors.d.ts +5 -0
  63. package/templates/vanilla/node_modules/picocolors/picocolors.js +75 -0
  64. package/templates/vanilla/node_modules/picocolors/types.d.ts +51 -0
  65. package/templates/vanilla/node_modules/postcss/LICENSE +20 -0
  66. package/templates/vanilla/node_modules/postcss/README.md +29 -0
  67. package/templates/vanilla/node_modules/postcss/lib/at-rule.d.ts +140 -0
  68. package/templates/vanilla/node_modules/postcss/lib/at-rule.js +25 -0
  69. package/templates/vanilla/node_modules/postcss/lib/comment.d.ts +68 -0
  70. package/templates/vanilla/node_modules/postcss/lib/comment.js +13 -0
  71. package/templates/vanilla/node_modules/postcss/lib/container.d.ts +483 -0
  72. package/templates/vanilla/node_modules/postcss/lib/container.js +447 -0
  73. package/templates/vanilla/node_modules/postcss/lib/css-syntax-error.d.ts +248 -0
  74. package/templates/vanilla/node_modules/postcss/lib/css-syntax-error.js +133 -0
  75. package/templates/vanilla/node_modules/postcss/lib/declaration.d.ts +151 -0
  76. package/templates/vanilla/node_modules/postcss/lib/declaration.js +24 -0
  77. package/templates/vanilla/node_modules/postcss/lib/document.d.ts +69 -0
  78. package/templates/vanilla/node_modules/postcss/lib/document.js +33 -0
  79. package/templates/vanilla/node_modules/postcss/lib/fromJSON.d.ts +9 -0
  80. package/templates/vanilla/node_modules/postcss/lib/fromJSON.js +54 -0
  81. package/templates/vanilla/node_modules/postcss/lib/input.d.ts +227 -0
  82. package/templates/vanilla/node_modules/postcss/lib/input.js +265 -0
  83. package/templates/vanilla/node_modules/postcss/lib/lazy-result.d.ts +190 -0
  84. package/templates/vanilla/node_modules/postcss/lib/lazy-result.js +550 -0
  85. package/templates/vanilla/node_modules/postcss/lib/list.d.ts +60 -0
  86. package/templates/vanilla/node_modules/postcss/lib/list.js +58 -0
  87. package/templates/vanilla/node_modules/postcss/lib/map-generator.js +368 -0
  88. package/templates/vanilla/node_modules/postcss/lib/no-work-result.d.ts +46 -0
  89. package/templates/vanilla/node_modules/postcss/lib/no-work-result.js +138 -0
  90. package/templates/vanilla/node_modules/postcss/lib/node.d.ts +556 -0
  91. package/templates/vanilla/node_modules/postcss/lib/node.js +449 -0
  92. package/templates/vanilla/node_modules/postcss/lib/parse.d.ts +9 -0
  93. package/templates/vanilla/node_modules/postcss/lib/parse.js +42 -0
  94. package/templates/vanilla/node_modules/postcss/lib/parser.js +611 -0
  95. package/templates/vanilla/node_modules/postcss/lib/postcss.d.mts +69 -0
  96. package/templates/vanilla/node_modules/postcss/lib/postcss.d.ts +458 -0
  97. package/templates/vanilla/node_modules/postcss/lib/postcss.js +101 -0
  98. package/templates/vanilla/node_modules/postcss/lib/postcss.mjs +30 -0
  99. package/templates/vanilla/node_modules/postcss/lib/previous-map.d.ts +81 -0
  100. package/templates/vanilla/node_modules/postcss/lib/previous-map.js +144 -0
  101. package/templates/vanilla/node_modules/postcss/lib/processor.d.ts +115 -0
  102. package/templates/vanilla/node_modules/postcss/lib/processor.js +67 -0
  103. package/templates/vanilla/node_modules/postcss/lib/result.d.ts +205 -0
  104. package/templates/vanilla/node_modules/postcss/lib/result.js +42 -0
  105. package/templates/vanilla/node_modules/postcss/lib/root.d.ts +87 -0
  106. package/templates/vanilla/node_modules/postcss/lib/root.js +61 -0
  107. package/templates/vanilla/node_modules/postcss/lib/rule.d.ts +126 -0
  108. package/templates/vanilla/node_modules/postcss/lib/rule.js +27 -0
  109. package/templates/vanilla/node_modules/postcss/lib/stringifier.d.ts +46 -0
  110. package/templates/vanilla/node_modules/postcss/lib/stringifier.js +353 -0
  111. package/templates/vanilla/node_modules/postcss/lib/stringify.d.ts +9 -0
  112. package/templates/vanilla/node_modules/postcss/lib/stringify.js +11 -0
  113. package/templates/vanilla/node_modules/postcss/lib/symbols.js +5 -0
  114. package/templates/vanilla/node_modules/postcss/lib/terminal-highlight.js +70 -0
  115. package/templates/vanilla/node_modules/postcss/lib/tokenize.js +266 -0
  116. package/templates/vanilla/node_modules/postcss/lib/warn-once.js +13 -0
  117. package/templates/vanilla/node_modules/postcss/lib/warning.d.ts +147 -0
  118. package/templates/vanilla/node_modules/postcss/lib/warning.js +37 -0
  119. package/templates/vanilla/node_modules/postcss/package.json +88 -0
  120. package/templates/vanilla/node_modules/rollup/LICENSE.md +695 -0
  121. package/templates/vanilla/node_modules/rollup/README.md +125 -0
  122. package/templates/vanilla/node_modules/rollup/dist/bin/rollup +1715 -0
  123. package/templates/vanilla/node_modules/rollup/dist/es/getLogFilter.js +64 -0
  124. package/templates/vanilla/node_modules/rollup/dist/es/package.json +1 -0
  125. package/templates/vanilla/node_modules/rollup/dist/es/rollup.js +17 -0
  126. package/templates/vanilla/node_modules/rollup/dist/es/shared/node-entry.js +27273 -0
  127. package/templates/vanilla/node_modules/rollup/dist/es/shared/watch.js +4857 -0
  128. package/templates/vanilla/node_modules/rollup/dist/getLogFilter.d.ts +5 -0
  129. package/templates/vanilla/node_modules/rollup/dist/getLogFilter.js +69 -0
  130. package/templates/vanilla/node_modules/rollup/dist/loadConfigFile.d.ts +20 -0
  131. package/templates/vanilla/node_modules/rollup/dist/loadConfigFile.js +29 -0
  132. package/templates/vanilla/node_modules/rollup/dist/rollup.d.ts +1012 -0
  133. package/templates/vanilla/node_modules/rollup/dist/rollup.js +31 -0
  134. package/templates/vanilla/node_modules/rollup/dist/shared/fsevents-importer.js +37 -0
  135. package/templates/vanilla/node_modules/rollup/dist/shared/index.js +4571 -0
  136. package/templates/vanilla/node_modules/rollup/dist/shared/loadConfigFile.js +546 -0
  137. package/templates/vanilla/node_modules/rollup/dist/shared/rollup.js +27351 -0
  138. package/templates/vanilla/node_modules/rollup/dist/shared/watch-cli.js +561 -0
  139. package/templates/vanilla/node_modules/rollup/dist/shared/watch-proxy.js +87 -0
  140. package/templates/vanilla/node_modules/rollup/dist/shared/watch.js +316 -0
  141. package/templates/vanilla/node_modules/rollup/package.json +181 -0
  142. package/templates/vanilla/node_modules/source-map-js/LICENSE +28 -0
  143. package/templates/vanilla/node_modules/source-map-js/README.md +765 -0
  144. package/templates/vanilla/node_modules/source-map-js/lib/array-set.js +121 -0
  145. package/templates/vanilla/node_modules/source-map-js/lib/base64-vlq.js +140 -0
  146. package/templates/vanilla/node_modules/source-map-js/lib/base64.js +67 -0
  147. package/templates/vanilla/node_modules/source-map-js/lib/binary-search.js +111 -0
  148. package/templates/vanilla/node_modules/source-map-js/lib/mapping-list.js +79 -0
  149. package/templates/vanilla/node_modules/source-map-js/lib/quick-sort.js +132 -0
  150. package/templates/vanilla/node_modules/source-map-js/lib/source-map-consumer.d.ts +1 -0
  151. package/templates/vanilla/node_modules/source-map-js/lib/source-map-consumer.js +1188 -0
  152. package/templates/vanilla/node_modules/source-map-js/lib/source-map-generator.d.ts +1 -0
  153. package/templates/vanilla/node_modules/source-map-js/lib/source-map-generator.js +444 -0
  154. package/templates/vanilla/node_modules/source-map-js/lib/source-node.d.ts +1 -0
  155. package/templates/vanilla/node_modules/source-map-js/lib/source-node.js +413 -0
  156. package/templates/vanilla/node_modules/source-map-js/lib/util.js +594 -0
  157. package/templates/vanilla/node_modules/source-map-js/package.json +71 -0
  158. package/templates/vanilla/node_modules/source-map-js/source-map.d.ts +104 -0
  159. package/templates/vanilla/node_modules/source-map-js/source-map.js +8 -0
  160. package/templates/vanilla/node_modules/vite/LICENSE.md +3396 -0
  161. package/templates/vanilla/node_modules/vite/README.md +20 -0
  162. package/templates/vanilla/node_modules/vite/bin/openChrome.applescript +95 -0
  163. package/templates/vanilla/node_modules/vite/bin/vite.js +61 -0
  164. package/templates/vanilla/node_modules/vite/client.d.ts +281 -0
  165. package/templates/vanilla/node_modules/vite/dist/client/client.mjs +725 -0
  166. package/templates/vanilla/node_modules/vite/dist/client/client.mjs.map +1 -0
  167. package/templates/vanilla/node_modules/vite/dist/client/env.mjs +30 -0
  168. package/templates/vanilla/node_modules/vite/dist/client/env.mjs.map +1 -0
  169. package/templates/vanilla/node_modules/vite/dist/node/chunks/dep-7ec6f216.js +914 -0
  170. package/templates/vanilla/node_modules/vite/dist/node/chunks/dep-827b23df.js +66713 -0
  171. package/templates/vanilla/node_modules/vite/dist/node/chunks/dep-c423598f.js +561 -0
  172. package/templates/vanilla/node_modules/vite/dist/node/chunks/dep-f0c7dae0.js +7930 -0
  173. package/templates/vanilla/node_modules/vite/dist/node/chunks/dep-f1e8587f.js +7646 -0
  174. package/templates/vanilla/node_modules/vite/dist/node/cli.js +929 -0
  175. package/templates/vanilla/node_modules/vite/dist/node/constants.js +130 -0
  176. package/templates/vanilla/node_modules/vite/dist/node/index.d.ts +3548 -0
  177. package/templates/vanilla/node_modules/vite/dist/node/index.js +158 -0
  178. package/templates/vanilla/node_modules/vite/dist/node-cjs/publicUtils.cjs +4555 -0
  179. package/templates/vanilla/node_modules/vite/index.cjs +34 -0
  180. package/templates/vanilla/node_modules/vite/package.json +173 -0
  181. package/templates/vanilla/node_modules/vite/types/customEvent.d.ts +35 -0
  182. package/templates/vanilla/node_modules/vite/types/hmrPayload.d.ts +61 -0
  183. package/templates/vanilla/node_modules/vite/types/hot.d.ts +32 -0
  184. package/templates/vanilla/node_modules/vite/types/importGlob.d.ts +97 -0
  185. package/templates/vanilla/node_modules/vite/types/importMeta.d.ts +26 -0
  186. package/templates/vanilla/node_modules/vite/types/metadata.d.ts +10 -0
  187. package/templates/vanilla/node_modules/vite/types/package.json +4 -0
  188. package/templates/vanilla/package-lock.json +589 -0
  189. package/templates/vanilla/package.json +17 -0
  190. package/templates/vanilla/src/components/App.js +60 -0
  191. package/templates/vanilla/src/components/Card.js +21 -0
  192. package/templates/vanilla/src/components/Hero.js +15 -0
  193. package/templates/vanilla/src/components/InteractiveDemo.js +59 -0
  194. package/templates/vanilla/src/main.js +9 -0
  195. package/templates/vanilla/src/style/main.css +172 -0
  196. package/templates/vanilla/vite.config.js +8 -0
  197. package/templates/web3/.env.example +15 -0
  198. package/templates/web3/.github/workflows/deploy.yml +38 -0
  199. package/templates/web3/README.md +33 -0
  200. package/templates/web3/contracts/foundry.toml +11 -0
  201. package/templates/web3/contracts/script/Deploy.s.sol +13 -0
  202. package/templates/web3/contracts/src/Counter.sol +21 -0
  203. package/templates/web3/index.html +13 -0
  204. package/templates/web3/package.json +25 -0
  205. package/templates/web3/scripts/chain-start.mjs +305 -0
  206. package/templates/web3/scripts/chain-stop.mjs +34 -0
  207. package/templates/web3/scripts/deploy.mjs +155 -0
  208. package/templates/web3/scripts/setup.mjs +42 -0
  209. package/templates/web3/src/components/App.js +49 -0
  210. package/templates/web3/src/components/CounterCard.js +111 -0
  211. package/templates/web3/src/main.js +54 -0
  212. package/templates/web3/src/style/main.css +345 -0
  213. package/templates/web3/vite.config.js +29 -0
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Generate secure URL-friendly unique ID.
3
+ *
4
+ * By default, the ID will have 21 symbols to have a collision probability
5
+ * similar to UUID v4.
6
+ *
7
+ * ```js
8
+ * import { nanoid } from 'nanoid'
9
+ * model.id = nanoid() //=> "Uakgb_J5m9g-0JDMbcJqL"
10
+ * ```
11
+ *
12
+ * @param size Size of the ID. The default size is 21.
13
+ * @returns A random string.
14
+ */
15
+ export function nanoid(size?: number): string
16
+
17
+ /**
18
+ * Generate secure unique ID with custom alphabet.
19
+ *
20
+ * Alphabet must contain 256 symbols or less. Otherwise, the generator
21
+ * will not be secure.
22
+ *
23
+ * @param alphabet Alphabet used to generate the ID.
24
+ * @param defaultSize Size of the ID. The default size is 21.
25
+ * @returns A random string generator.
26
+ *
27
+ * ```js
28
+ * const { customAlphabet } = require('nanoid')
29
+ * const nanoid = customAlphabet('0123456789абвгдеё', 5)
30
+ * nanoid() //=> "8ё56а"
31
+ * ```
32
+ */
33
+ export function customAlphabet(
34
+ alphabet: string,
35
+ defaultSize?: number
36
+ ): (size?: number) => string
37
+
38
+ /**
39
+ * Generate unique ID with custom random generator and alphabet.
40
+ *
41
+ * Alphabet must contain 256 symbols or less. Otherwise, the generator
42
+ * will not be secure.
43
+ *
44
+ * ```js
45
+ * import { customRandom } from 'nanoid/format'
46
+ *
47
+ * const nanoid = customRandom('abcdef', 5, size => {
48
+ * const random = []
49
+ * for (let i = 0; i < size; i++) {
50
+ * random.push(randomByte())
51
+ * }
52
+ * return random
53
+ * })
54
+ *
55
+ * nanoid() //=> "fbaef"
56
+ * ```
57
+ *
58
+ * @param alphabet Alphabet used to generate a random string.
59
+ * @param size Size of the random string.
60
+ * @param random A random bytes generator.
61
+ * @returns A random string generator.
62
+ */
63
+ export function customRandom(
64
+ alphabet: string,
65
+ size: number,
66
+ random: (bytes: number) => Uint8Array
67
+ ): () => string
68
+
69
+ /**
70
+ * URL safe symbols.
71
+ *
72
+ * ```js
73
+ * import { urlAlphabet } from 'nanoid'
74
+ * const nanoid = customAlphabet(urlAlphabet, 10)
75
+ * nanoid() //=> "Uakgb_J5m9"
76
+ * ```
77
+ */
78
+ export const urlAlphabet: string
79
+
80
+ /**
81
+ * Generate an array of random bytes collected from hardware noise.
82
+ *
83
+ * ```js
84
+ * import { customRandom, random } from 'nanoid'
85
+ * const nanoid = customRandom("abcdef", 5, random)
86
+ * ```
87
+ *
88
+ * @param bytes Size of the array.
89
+ * @returns An array of random bytes.
90
+ */
91
+ export function random(bytes: number): Uint8Array
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Generate secure URL-friendly unique ID.
3
+ *
4
+ * By default, the ID will have 21 symbols to have a collision probability
5
+ * similar to UUID v4.
6
+ *
7
+ * ```js
8
+ * import { nanoid } from 'nanoid'
9
+ * model.id = nanoid() //=> "Uakgb_J5m9g-0JDMbcJqL"
10
+ * ```
11
+ *
12
+ * @param size Size of the ID. The default size is 21.
13
+ * @returns A random string.
14
+ */
15
+ export function nanoid(size?: number): string
16
+
17
+ /**
18
+ * Generate secure unique ID with custom alphabet.
19
+ *
20
+ * Alphabet must contain 256 symbols or less. Otherwise, the generator
21
+ * will not be secure.
22
+ *
23
+ * @param alphabet Alphabet used to generate the ID.
24
+ * @param defaultSize Size of the ID. The default size is 21.
25
+ * @returns A random string generator.
26
+ *
27
+ * ```js
28
+ * const { customAlphabet } = require('nanoid')
29
+ * const nanoid = customAlphabet('0123456789абвгдеё', 5)
30
+ * nanoid() //=> "8ё56а"
31
+ * ```
32
+ */
33
+ export function customAlphabet(
34
+ alphabet: string,
35
+ defaultSize?: number
36
+ ): (size?: number) => string
37
+
38
+ /**
39
+ * Generate unique ID with custom random generator and alphabet.
40
+ *
41
+ * Alphabet must contain 256 symbols or less. Otherwise, the generator
42
+ * will not be secure.
43
+ *
44
+ * ```js
45
+ * import { customRandom } from 'nanoid/format'
46
+ *
47
+ * const nanoid = customRandom('abcdef', 5, size => {
48
+ * const random = []
49
+ * for (let i = 0; i < size; i++) {
50
+ * random.push(randomByte())
51
+ * }
52
+ * return random
53
+ * })
54
+ *
55
+ * nanoid() //=> "fbaef"
56
+ * ```
57
+ *
58
+ * @param alphabet Alphabet used to generate a random string.
59
+ * @param size Size of the random string.
60
+ * @param random A random bytes generator.
61
+ * @returns A random string generator.
62
+ */
63
+ export function customRandom(
64
+ alphabet: string,
65
+ size: number,
66
+ random: (bytes: number) => Uint8Array
67
+ ): () => string
68
+
69
+ /**
70
+ * URL safe symbols.
71
+ *
72
+ * ```js
73
+ * import { urlAlphabet } from 'nanoid'
74
+ * const nanoid = customAlphabet(urlAlphabet, 10)
75
+ * nanoid() //=> "Uakgb_J5m9"
76
+ * ```
77
+ */
78
+ export const urlAlphabet: string
79
+
80
+ /**
81
+ * Generate an array of random bytes collected from hardware noise.
82
+ *
83
+ * ```js
84
+ * import { customRandom, random } from 'nanoid'
85
+ * const nanoid = customRandom("abcdef", 5, random)
86
+ * ```
87
+ *
88
+ * @param bytes Size of the array.
89
+ * @returns An array of random bytes.
90
+ */
91
+ export function random(bytes: number): Uint8Array
@@ -0,0 +1,45 @@
1
+ import crypto from 'crypto'
2
+ import { urlAlphabet } from './url-alphabet/index.js'
3
+ const POOL_SIZE_MULTIPLIER = 128
4
+ let pool, poolOffset
5
+ let fillPool = bytes => {
6
+ if (!pool || pool.length < bytes) {
7
+ pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER)
8
+ crypto.randomFillSync(pool)
9
+ poolOffset = 0
10
+ } else if (poolOffset + bytes > pool.length) {
11
+ crypto.randomFillSync(pool)
12
+ poolOffset = 0
13
+ }
14
+ poolOffset += bytes
15
+ }
16
+ let random = bytes => {
17
+ fillPool((bytes |= 0))
18
+ return pool.subarray(poolOffset - bytes, poolOffset)
19
+ }
20
+ let customRandom = (alphabet, defaultSize, getRandom) => {
21
+ let mask = (2 << (31 - Math.clz32((alphabet.length - 1) | 1))) - 1
22
+ let step = Math.ceil((1.6 * mask * defaultSize) / alphabet.length)
23
+ return (size = defaultSize) => {
24
+ let id = ''
25
+ while (true) {
26
+ let bytes = getRandom(step)
27
+ let i = step
28
+ while (i--) {
29
+ id += alphabet[bytes[i] & mask] || ''
30
+ if (id.length === size) return id
31
+ }
32
+ }
33
+ }
34
+ }
35
+ let customAlphabet = (alphabet, size = 21) =>
36
+ customRandom(alphabet, size, random)
37
+ let nanoid = (size = 21) => {
38
+ fillPool((size |= 0))
39
+ let id = ''
40
+ for (let i = poolOffset - size; i < poolOffset; i++) {
41
+ id += urlAlphabet[pool[i] & 63]
42
+ }
43
+ return id
44
+ }
45
+ export { nanoid, customAlphabet, customRandom, urlAlphabet, random }
@@ -0,0 +1 @@
1
+ export let nanoid=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce(((t,e)=>t+=(e&=63)<36?e.toString(36):e<62?(e-26).toString(36).toUpperCase():e<63?"_":"-"),"");
@@ -0,0 +1,34 @@
1
+ // This alphabet uses `A-Za-z0-9_-` symbols.
2
+ // The order of characters is optimized for better gzip and brotli compression.
3
+ // References to the same file (works both for gzip and brotli):
4
+ // `'use`, `andom`, and `rict'`
5
+ // References to the brotli default dictionary:
6
+ // `-26T`, `1983`, `40px`, `75px`, `bush`, `jack`, `mind`, `very`, and `wolf`
7
+ let urlAlphabet =
8
+ 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'
9
+
10
+ let customAlphabet = (alphabet, defaultSize = 21) => {
11
+ return (size = defaultSize) => {
12
+ let id = ''
13
+ // A compact alternative for `for (var i = 0; i < step; i++)`.
14
+ let i = size | 0
15
+ while (i--) {
16
+ // `| 0` is more compact and faster than `Math.floor()`.
17
+ id += alphabet[(Math.random() * alphabet.length) | 0]
18
+ }
19
+ return id
20
+ }
21
+ }
22
+
23
+ let nanoid = (size = 21) => {
24
+ let id = ''
25
+ // A compact alternative for `for (var i = 0; i < step; i++)`.
26
+ let i = size | 0
27
+ while (i--) {
28
+ // `| 0` is more compact and faster than `Math.floor()`.
29
+ id += urlAlphabet[(Math.random() * 64) | 0]
30
+ }
31
+ return id
32
+ }
33
+
34
+ module.exports = { nanoid, customAlphabet }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Generate URL-friendly unique ID. This method uses the non-secure
3
+ * predictable random generator with bigger collision probability.
4
+ *
5
+ * ```js
6
+ * import { nanoid } from 'nanoid/non-secure'
7
+ * model.id = nanoid() //=> "Uakgb_J5m9g-0JDMbcJqL"
8
+ * ```
9
+ *
10
+ * @param size Size of the ID. The default size is 21.
11
+ * @returns A random string.
12
+ */
13
+ export function nanoid(size?: number): string
14
+
15
+ /**
16
+ * Generate a unique ID based on a custom alphabet.
17
+ * This method uses the non-secure predictable random generator
18
+ * with bigger collision probability.
19
+ *
20
+ * @param alphabet Alphabet used to generate the ID.
21
+ * @param defaultSize Size of the ID. The default size is 21.
22
+ * @returns A random string generator.
23
+ *
24
+ * ```js
25
+ * import { customAlphabet } from 'nanoid/non-secure'
26
+ * const nanoid = customAlphabet('0123456789абвгдеё', 5)
27
+ * model.id = //=> "8ё56а"
28
+ * ```
29
+ */
30
+ export function customAlphabet(
31
+ alphabet: string,
32
+ defaultSize?: number
33
+ ): (size?: number) => string
@@ -0,0 +1,21 @@
1
+ let urlAlphabet =
2
+ 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'
3
+ let customAlphabet = (alphabet, defaultSize = 21) => {
4
+ return (size = defaultSize) => {
5
+ let id = ''
6
+ let i = size | 0
7
+ while (i--) {
8
+ id += alphabet[(Math.random() * alphabet.length) | 0]
9
+ }
10
+ return id
11
+ }
12
+ }
13
+ let nanoid = (size = 21) => {
14
+ let id = ''
15
+ let i = size | 0
16
+ while (i--) {
17
+ id += urlAlphabet[(Math.random() * 64) | 0]
18
+ }
19
+ return id
20
+ }
21
+ export { nanoid, customAlphabet }
@@ -0,0 +1,6 @@
1
+ {
2
+ "type": "module",
3
+ "main": "index.cjs",
4
+ "module": "index.js",
5
+ "react-native": "index.js"
6
+ }
@@ -0,0 +1,89 @@
1
+ {
2
+ "name": "nanoid",
3
+ "version": "3.3.11",
4
+ "description": "A tiny (116 bytes), secure URL-friendly unique string ID generator",
5
+ "keywords": [
6
+ "uuid",
7
+ "random",
8
+ "id",
9
+ "url"
10
+ ],
11
+ "engines": {
12
+ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
13
+ },
14
+ "funding": [
15
+ {
16
+ "type": "github",
17
+ "url": "https://github.com/sponsors/ai"
18
+ }
19
+ ],
20
+ "author": "Andrey Sitnik <andrey@sitnik.ru>",
21
+ "license": "MIT",
22
+ "repository": "ai/nanoid",
23
+ "browser": {
24
+ "./index.js": "./index.browser.js",
25
+ "./async/index.js": "./async/index.browser.js",
26
+ "./async/index.cjs": "./async/index.browser.cjs",
27
+ "./index.cjs": "./index.browser.cjs"
28
+ },
29
+ "react-native": "index.js",
30
+ "bin": "./bin/nanoid.cjs",
31
+ "sideEffects": false,
32
+ "types": "./index.d.ts",
33
+ "type": "module",
34
+ "main": "index.cjs",
35
+ "module": "index.js",
36
+ "exports": {
37
+ ".": {
38
+ "react-native": "./index.browser.js",
39
+ "browser": "./index.browser.js",
40
+ "require": {
41
+ "types": "./index.d.cts",
42
+ "default": "./index.cjs"
43
+ },
44
+ "import": {
45
+ "types": "./index.d.ts",
46
+ "default": "./index.js"
47
+ },
48
+ "default": "./index.js"
49
+ },
50
+ "./package.json": "./package.json",
51
+ "./async/package.json": "./async/package.json",
52
+ "./async": {
53
+ "browser": "./async/index.browser.js",
54
+ "require": {
55
+ "types": "./index.d.cts",
56
+ "default": "./async/index.cjs"
57
+ },
58
+ "import": {
59
+ "types": "./index.d.ts",
60
+ "default": "./async/index.js"
61
+ },
62
+ "default": "./async/index.js"
63
+ },
64
+ "./non-secure/package.json": "./non-secure/package.json",
65
+ "./non-secure": {
66
+ "require": {
67
+ "types": "./index.d.cts",
68
+ "default": "./non-secure/index.cjs"
69
+ },
70
+ "import": {
71
+ "types": "./index.d.ts",
72
+ "default": "./non-secure/index.js"
73
+ },
74
+ "default": "./non-secure/index.js"
75
+ },
76
+ "./url-alphabet/package.json": "./url-alphabet/package.json",
77
+ "./url-alphabet": {
78
+ "require": {
79
+ "types": "./index.d.cts",
80
+ "default": "./url-alphabet/index.cjs"
81
+ },
82
+ "import": {
83
+ "types": "./index.d.ts",
84
+ "default": "./url-alphabet/index.js"
85
+ },
86
+ "default": "./url-alphabet/index.js"
87
+ }
88
+ }
89
+ }
@@ -0,0 +1,7 @@
1
+ // This alphabet uses `A-Za-z0-9_-` symbols.
2
+ // The order of characters is optimized for better gzip and brotli compression.
3
+ // Same as in non-secure/index.js
4
+ let urlAlphabet =
5
+ 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'
6
+
7
+ module.exports = { urlAlphabet }
@@ -0,0 +1,3 @@
1
+ let urlAlphabet =
2
+ 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'
3
+ export { urlAlphabet }
@@ -0,0 +1,6 @@
1
+ {
2
+ "type": "module",
3
+ "main": "index.cjs",
4
+ "module": "index.js",
5
+ "react-native": "index.js"
6
+ }
@@ -0,0 +1,15 @@
1
+ ISC License
2
+
3
+ Copyright (c) 2021-2024 Oleksii Raspopov, Kostiantyn Denysov, Anton Verinov
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted, provided that the above
7
+ copyright notice and this permission notice appear in all copies.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
@@ -0,0 +1,21 @@
1
+ # picocolors
2
+
3
+ The tiniest and the fastest library for terminal output formatting with ANSI colors.
4
+
5
+ ```javascript
6
+ import pc from "picocolors"
7
+
8
+ console.log(
9
+ pc.green(`How are ${pc.italic(`you`)} doing?`)
10
+ )
11
+ ```
12
+
13
+ - **No dependencies.**
14
+ - **14 times** smaller and **2 times** faster than chalk.
15
+ - Used by popular tools like PostCSS, SVGO, Stylelint, and Browserslist.
16
+ - Node.js v6+ & browsers support. Support for both CJS and ESM projects.
17
+ - TypeScript type declarations included.
18
+ - [`NO_COLOR`](https://no-color.org/) friendly.
19
+
20
+ ## Docs
21
+ Read **[full docs](https://github.com/alexeyraspopov/picocolors#readme)** on GitHub.
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "picocolors",
3
+ "version": "1.1.1",
4
+ "main": "./picocolors.js",
5
+ "types": "./picocolors.d.ts",
6
+ "browser": {
7
+ "./picocolors.js": "./picocolors.browser.js"
8
+ },
9
+ "sideEffects": false,
10
+ "description": "The tiniest and the fastest library for terminal output formatting with ANSI colors",
11
+ "files": [
12
+ "picocolors.*",
13
+ "types.d.ts"
14
+ ],
15
+ "keywords": [
16
+ "terminal",
17
+ "colors",
18
+ "formatting",
19
+ "cli",
20
+ "console"
21
+ ],
22
+ "author": "Alexey Raspopov",
23
+ "repository": "alexeyraspopov/picocolors",
24
+ "license": "ISC"
25
+ }
@@ -0,0 +1,4 @@
1
+ var x=String;
2
+ var create=function() {return {isColorSupported:false,reset:x,bold:x,dim:x,italic:x,underline:x,inverse:x,hidden:x,strikethrough:x,black:x,red:x,green:x,yellow:x,blue:x,magenta:x,cyan:x,white:x,gray:x,bgBlack:x,bgRed:x,bgGreen:x,bgYellow:x,bgBlue:x,bgMagenta:x,bgCyan:x,bgWhite:x,blackBright:x,redBright:x,greenBright:x,yellowBright:x,blueBright:x,magentaBright:x,cyanBright:x,whiteBright:x,bgBlackBright:x,bgRedBright:x,bgGreenBright:x,bgYellowBright:x,bgBlueBright:x,bgMagentaBright:x,bgCyanBright:x,bgWhiteBright:x}};
3
+ module.exports=create();
4
+ module.exports.createColors = create;
@@ -0,0 +1,5 @@
1
+ import { Colors } from "./types"
2
+
3
+ declare const picocolors: Colors & { createColors: (enabled?: boolean) => Colors }
4
+
5
+ export = picocolors
@@ -0,0 +1,75 @@
1
+ let p = process || {}, argv = p.argv || [], env = p.env || {}
2
+ let isColorSupported =
3
+ !(!!env.NO_COLOR || argv.includes("--no-color")) &&
4
+ (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || ((p.stdout || {}).isTTY && env.TERM !== "dumb") || !!env.CI)
5
+
6
+ let formatter = (open, close, replace = open) =>
7
+ input => {
8
+ let string = "" + input, index = string.indexOf(close, open.length)
9
+ return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close
10
+ }
11
+
12
+ let replaceClose = (string, close, replace, index) => {
13
+ let result = "", cursor = 0
14
+ do {
15
+ result += string.substring(cursor, index) + replace
16
+ cursor = index + close.length
17
+ index = string.indexOf(close, cursor)
18
+ } while (~index)
19
+ return result + string.substring(cursor)
20
+ }
21
+
22
+ let createColors = (enabled = isColorSupported) => {
23
+ let f = enabled ? formatter : () => String
24
+ return {
25
+ isColorSupported: enabled,
26
+ reset: f("\x1b[0m", "\x1b[0m"),
27
+ bold: f("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m"),
28
+ dim: f("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m"),
29
+ italic: f("\x1b[3m", "\x1b[23m"),
30
+ underline: f("\x1b[4m", "\x1b[24m"),
31
+ inverse: f("\x1b[7m", "\x1b[27m"),
32
+ hidden: f("\x1b[8m", "\x1b[28m"),
33
+ strikethrough: f("\x1b[9m", "\x1b[29m"),
34
+
35
+ black: f("\x1b[30m", "\x1b[39m"),
36
+ red: f("\x1b[31m", "\x1b[39m"),
37
+ green: f("\x1b[32m", "\x1b[39m"),
38
+ yellow: f("\x1b[33m", "\x1b[39m"),
39
+ blue: f("\x1b[34m", "\x1b[39m"),
40
+ magenta: f("\x1b[35m", "\x1b[39m"),
41
+ cyan: f("\x1b[36m", "\x1b[39m"),
42
+ white: f("\x1b[37m", "\x1b[39m"),
43
+ gray: f("\x1b[90m", "\x1b[39m"),
44
+
45
+ bgBlack: f("\x1b[40m", "\x1b[49m"),
46
+ bgRed: f("\x1b[41m", "\x1b[49m"),
47
+ bgGreen: f("\x1b[42m", "\x1b[49m"),
48
+ bgYellow: f("\x1b[43m", "\x1b[49m"),
49
+ bgBlue: f("\x1b[44m", "\x1b[49m"),
50
+ bgMagenta: f("\x1b[45m", "\x1b[49m"),
51
+ bgCyan: f("\x1b[46m", "\x1b[49m"),
52
+ bgWhite: f("\x1b[47m", "\x1b[49m"),
53
+
54
+ blackBright: f("\x1b[90m", "\x1b[39m"),
55
+ redBright: f("\x1b[91m", "\x1b[39m"),
56
+ greenBright: f("\x1b[92m", "\x1b[39m"),
57
+ yellowBright: f("\x1b[93m", "\x1b[39m"),
58
+ blueBright: f("\x1b[94m", "\x1b[39m"),
59
+ magentaBright: f("\x1b[95m", "\x1b[39m"),
60
+ cyanBright: f("\x1b[96m", "\x1b[39m"),
61
+ whiteBright: f("\x1b[97m", "\x1b[39m"),
62
+
63
+ bgBlackBright: f("\x1b[100m", "\x1b[49m"),
64
+ bgRedBright: f("\x1b[101m", "\x1b[49m"),
65
+ bgGreenBright: f("\x1b[102m", "\x1b[49m"),
66
+ bgYellowBright: f("\x1b[103m", "\x1b[49m"),
67
+ bgBlueBright: f("\x1b[104m", "\x1b[49m"),
68
+ bgMagentaBright: f("\x1b[105m", "\x1b[49m"),
69
+ bgCyanBright: f("\x1b[106m", "\x1b[49m"),
70
+ bgWhiteBright: f("\x1b[107m", "\x1b[49m"),
71
+ }
72
+ }
73
+
74
+ module.exports = createColors()
75
+ module.exports.createColors = createColors
@@ -0,0 +1,51 @@
1
+ export type Formatter = (input: string | number | null | undefined) => string
2
+
3
+ export interface Colors {
4
+ isColorSupported: boolean
5
+
6
+ reset: Formatter
7
+ bold: Formatter
8
+ dim: Formatter
9
+ italic: Formatter
10
+ underline: Formatter
11
+ inverse: Formatter
12
+ hidden: Formatter
13
+ strikethrough: Formatter
14
+
15
+ black: Formatter
16
+ red: Formatter
17
+ green: Formatter
18
+ yellow: Formatter
19
+ blue: Formatter
20
+ magenta: Formatter
21
+ cyan: Formatter
22
+ white: Formatter
23
+ gray: Formatter
24
+
25
+ bgBlack: Formatter
26
+ bgRed: Formatter
27
+ bgGreen: Formatter
28
+ bgYellow: Formatter
29
+ bgBlue: Formatter
30
+ bgMagenta: Formatter
31
+ bgCyan: Formatter
32
+ bgWhite: Formatter
33
+
34
+ blackBright: Formatter
35
+ redBright: Formatter
36
+ greenBright: Formatter
37
+ yellowBright: Formatter
38
+ blueBright: Formatter
39
+ magentaBright: Formatter
40
+ cyanBright: Formatter
41
+ whiteBright: Formatter
42
+
43
+ bgBlackBright: Formatter
44
+ bgRedBright: Formatter
45
+ bgGreenBright: Formatter
46
+ bgYellowBright: Formatter
47
+ bgBlueBright: Formatter
48
+ bgMagentaBright: Formatter
49
+ bgCyanBright: Formatter
50
+ bgWhiteBright: Formatter
51
+ }
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright 2013 Andrey Sitnik <andrey@sitnik.ru>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.