@oazmi/superbuild 0.1.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.
Files changed (118) hide show
  1. package/esm/_dnt.shims.d.ts +2 -0
  2. package/esm/_dnt.shims.d.ts.map +1 -0
  3. package/esm/_dnt.shims.js +57 -0
  4. package/esm/deps/jsr.io/@oazmi/esbuild-types/0.28.0/src/mod.d.ts +598 -0
  5. package/esm/deps/jsr.io/@oazmi/esbuild-types/0.28.0/src/mod.d.ts.map +1 -0
  6. package/esm/deps/jsr.io/@oazmi/esbuild-types/0.28.0/src/mod.js +1 -0
  7. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/alias.d.ts +617 -0
  8. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/alias.d.ts.map +1 -0
  9. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/alias.js +671 -0
  10. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/array1d.d.ts +487 -0
  11. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/array1d.d.ts.map +1 -0
  12. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/array1d.js +536 -0
  13. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/array2d.d.ts +266 -0
  14. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/array2d.d.ts.map +1 -0
  15. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/array2d.js +318 -0
  16. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/binder.d.ts +368 -0
  17. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/binder.d.ts.map +1 -0
  18. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/binder.js +380 -0
  19. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/crossenv.d.ts +711 -0
  20. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/crossenv.d.ts.map +1 -0
  21. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/crossenv.js +1173 -0
  22. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/cryptoman.d.ts +171 -0
  23. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/cryptoman.d.ts.map +1 -0
  24. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/cryptoman.js +308 -0
  25. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/deps.d.ts +10 -0
  26. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/deps.d.ts.map +1 -0
  27. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/deps.js +10 -0
  28. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/eightpack.d.ts +168 -0
  29. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/eightpack.d.ts.map +1 -0
  30. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/eightpack.js +236 -0
  31. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/eightpack_varint.d.ts +90 -0
  32. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/eightpack_varint.d.ts.map +1 -0
  33. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/eightpack_varint.js +237 -0
  34. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/numericarray.d.ts +213 -0
  35. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/numericarray.d.ts.map +1 -0
  36. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/numericarray.js +363 -0
  37. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/numericmethods.d.ts +233 -0
  38. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/numericmethods.d.ts.map +1 -0
  39. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/numericmethods.js +256 -0
  40. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/pathman.d.ts +1436 -0
  41. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/pathman.d.ts.map +1 -0
  42. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/pathman.js +1730 -0
  43. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/promiseman.d.ts +647 -0
  44. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/promiseman.d.ts.map +1 -0
  45. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/promiseman.js +762 -0
  46. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/stringman.d.ts +538 -0
  47. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/stringman.d.ts.map +1 -0
  48. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/stringman.js +626 -0
  49. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/struct.d.ts +734 -0
  50. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/struct.d.ts.map +1 -0
  51. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/struct.js +764 -0
  52. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/typedbuffer.d.ts +137 -0
  53. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/typedbuffer.d.ts.map +1 -0
  54. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/typedbuffer.js +234 -0
  55. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/typedefs.d.ts +391 -0
  56. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/typedefs.d.ts.map +1 -0
  57. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/typedefs.js +8 -0
  58. package/esm/deps.d.ts +56 -0
  59. package/esm/deps.d.ts.map +1 -0
  60. package/esm/deps.js +37 -0
  61. package/esm/esbuild/metafile.d.ts +90 -0
  62. package/esm/esbuild/metafile.d.ts.map +1 -0
  63. package/esm/esbuild/metafile.js +275 -0
  64. package/esm/esbuild/native.d.ts +95 -0
  65. package/esm/esbuild/native.d.ts.map +1 -0
  66. package/esm/esbuild/native.js +127 -0
  67. package/esm/esbuild/outputfile.d.ts +86 -0
  68. package/esm/esbuild/outputfile.d.ts.map +1 -0
  69. package/esm/esbuild/outputfile.js +221 -0
  70. package/esm/esbuild/strongtypes.d.ts +90 -0
  71. package/esm/esbuild/strongtypes.d.ts.map +1 -0
  72. package/esm/esbuild/strongtypes.js +8 -0
  73. package/esm/esbuild/typedefs.d.ts +121 -0
  74. package/esm/esbuild/typedefs.d.ts.map +1 -0
  75. package/esm/esbuild/typedefs.js +55 -0
  76. package/esm/esbuild/weaktypes.d.ts +46 -0
  77. package/esm/esbuild/weaktypes.d.ts.map +1 -0
  78. package/esm/esbuild/weaktypes.js +8 -0
  79. package/esm/funcdefs.d.ts +89 -0
  80. package/esm/funcdefs.d.ts.map +1 -0
  81. package/esm/funcdefs.js +145 -0
  82. package/esm/mod.d.ts +4 -0
  83. package/esm/mod.d.ts.map +1 -0
  84. package/esm/mod.js +2 -0
  85. package/esm/package.json +3 -0
  86. package/esm/plugins/emissions_driver.d.ts +33 -0
  87. package/esm/plugins/emissions_driver.d.ts.map +1 -0
  88. package/esm/plugins/emissions_driver.js +260 -0
  89. package/esm/plugins/long_build.d.ts +138 -0
  90. package/esm/plugins/long_build.d.ts.map +1 -0
  91. package/esm/plugins/long_build.js +288 -0
  92. package/esm/plugins/native_replica.d.ts +48 -0
  93. package/esm/plugins/native_replica.d.ts.map +1 -0
  94. package/esm/plugins/native_replica.js +122 -0
  95. package/esm/super/build.d.ts +53 -0
  96. package/esm/super/build.d.ts.map +1 -0
  97. package/esm/super/build.js +39 -0
  98. package/esm/super/build_context.d.ts +83 -0
  99. package/esm/super/build_context.d.ts.map +1 -0
  100. package/esm/super/build_context.js +124 -0
  101. package/esm/super/mod.d.ts +12 -0
  102. package/esm/super/mod.d.ts.map +1 -0
  103. package/esm/super/mod.js +9 -0
  104. package/esm/super/plugin.d.ts +23 -0
  105. package/esm/super/plugin.d.ts.map +1 -0
  106. package/esm/super/plugin.js +31 -0
  107. package/esm/super/plugin_build.d.ts +38 -0
  108. package/esm/super/plugin_build.d.ts.map +1 -0
  109. package/esm/super/plugin_build.js +198 -0
  110. package/esm/super/typedefs.d.ts +323 -0
  111. package/esm/super/typedefs.d.ts.map +1 -0
  112. package/esm/super/typedefs.js +10 -0
  113. package/esm/typedefs.d.ts +21 -0
  114. package/esm/typedefs.d.ts.map +1 -0
  115. package/esm/typedefs.js +5 -0
  116. package/license.md +37 -0
  117. package/package.json +88 -0
  118. package/readme.md +181 -0
@@ -0,0 +1,671 @@
1
+ /** a huge collection of aliases for built-in javascript objects and functions.
2
+ * using the exports from this submodule will let you greatly minify your code,
3
+ * and also reduce the number of dynamic function dispatches on built-in class's static methods.
4
+ *
5
+ * > [!warning]
6
+ * > micro-optimization is **BAD** - _people of the old_. <br>
7
+ * > micro-optimization might result in poorer JIT performance - _some old timer_. <br>
8
+ * > micro-optimization is what you do as a bad programmer - _linus torvalds (not)_. <br>
9
+ * > micro-optimization costs millions to revert - _linus tech tips (not)_.
10
+ *
11
+ * ## export naming convention
12
+ *
13
+ * the objects/functions exported by this submodule follow the following naming convention:
14
+ * - the name starts with a lowercase version of the built-in class/object.
15
+ * so for instance, `Math` becomes `math`.
16
+ * - followed by an underscore (`"_"`)
17
+ * - followed by the name of the method/property of that object.
18
+ *
19
+ * ### examples
20
+ *
21
+ * - `ThingName.MethodName` -> `thingname_MethodName`
22
+ * - `Math.max` -> `math_max`
23
+ * - `Object.fromEntries` -> `object_fromEntries`
24
+ * - `Array.isArray` -> `array_isArray`
25
+ * - `performance.now` -> `performance_now`
26
+ * - `console.log` -> `console_log`
27
+ *
28
+ * ## minifiablility
29
+ *
30
+ * this submodule needs esbuild's intelligent minifier to shrink it down in it size.
31
+ *
32
+ * each export is declared separately for two reasons:
33
+ * - using destructuring, such as `export const { from, isArray, of } = Array`, is not tree-shakable by esbuild,
34
+ * because destructuring _may_ have property-accessor side effects (even though it isn't the case here).
35
+ * as such, it is impossible to instruct esbuild that a statement is "pure" (i.e. free of side effects).
36
+ * and so, we will be left with a ton of unused exported baggage that will end up in the final bundle.
37
+ * - we cannot add documentation comment to destructured variables, and so, our documentation coverage score will drastically drop.
38
+ *
39
+ * the only way to tell esbuild that an expression is "pure" is when a `"@__PURE__"` multiline comment is added before a
40
+ * _function call_ (yes, it has to be a function call). this way, esbuild will tree shake the assigned variable if it is not used.
41
+ *
42
+ * moreover, esbuild will also evaluate simple iife (immediately invoked function expression), such as the following:
43
+ *
44
+ * ```ts
45
+ * // unminified iife
46
+ * const a = (() => 5 * 2)() // a = 10
47
+ * ```
48
+ *
49
+ * ```ts
50
+ * // minified expression generated by esbuild:
51
+ * const a = 10
52
+ * ```
53
+ *
54
+ * using a combination of the "pure" annotation and the iife evaluatation feature of esbuild, we can create minifiable and tree-shakable aliases:
55
+ *
56
+ * ```ts ignore
57
+ * // unminified iife
58
+ * const math_constructor = Math
59
+ * export const math_max = /* @__PURE__ *\/ (() => math_constructor.max)()
60
+ * export const math_min = /* @__PURE__ *\/ (() => math_constructor.min)()
61
+ * ```
62
+ *
63
+ * ```ts ignore
64
+ * // resulting minified and tree-shakable expression generated by esbuild:
65
+ * const
66
+ * a = Math,
67
+ * b = a.max,
68
+ * c = a.min
69
+ * export { b as math_max, c as math_min }
70
+ * ```
71
+ *
72
+ * ## aliases used by this library (`@oazmi/kitchensink`)
73
+ *
74
+ * the following static method aliases are used internally by this library.
75
+ * so importing any these aliases will likely not add any additional size to your minified scripts.
76
+ *
77
+ * ### `Array`
78
+ * - `from`
79
+ * - `fromAsync`
80
+ * - `isArray`
81
+ * - `of`
82
+ *
83
+ * ### `Date`
84
+ * - `now`
85
+ *
86
+ * ### `Math`
87
+ * - `max`
88
+ * - `min`
89
+ * - `random`
90
+ *
91
+ * ### `Number`
92
+ * - `MAX_VALUE`
93
+ * - `isInteger`
94
+ * - `parseInt`
95
+ *
96
+ * ### `Object`
97
+ * - `assign`
98
+ * - `defineProperty`
99
+ * - `entries`
100
+ * - `getPrototypeOf`
101
+ *
102
+ * ### `Promise`
103
+ * - `resolve`
104
+ *
105
+ * ### `String`
106
+ * - `fromCharCode`
107
+ *
108
+ * ### `Symbol`
109
+ * - `iterator`
110
+ * - `toStringTag`
111
+ *
112
+ * ### `console`
113
+ * - `assert`
114
+ * - `error`
115
+ * - `log`
116
+ * - `table`
117
+ *
118
+ * ### `performance`
119
+ * - `now`
120
+ *
121
+ * ### built-in `window` functions
122
+ * - `clearInterval`
123
+ * - `clearTimeout`
124
+ * - `decodeURI`
125
+ * - `encodeURI`
126
+ * - `setInterval`
127
+ * - `setTimeout`
128
+ *
129
+ * @module
130
+ */
131
+ const array_constructor = Array, bigint_constructor = BigInt, date_constructor = Date, json_constructor = JSON, math_constructor = Math, number_constructor = Number, object_constructor = Object, promise_constructor = Promise, response_constructor = Response, string_constructor = String, symbol_constructor = Symbol, console_object = console, performance_object = performance;
132
+ /** a no-operation function */
133
+ export const noop = () => { };
134
+ // `Array` aliases
135
+ /** test if an array is empty */
136
+ export const array_isEmpty = (array) => (array.length === 0);
137
+ /** alias for `Array.from`. */
138
+ export const array_from = /*@__PURE__*/ (() => array_constructor.from)();
139
+ /** alias for `Array.fromAsync`. */
140
+ export const array_fromAsync = /*@__PURE__*/ (() => array_constructor.fromAsync)();
141
+ /** alias for `Array.isArray`. but I'd recommend using {@link isArray} instead. */
142
+ export const array_isArray = /*@__PURE__*/ (() => array_constructor.isArray)();
143
+ /** alias for `Array.of`. */
144
+ export const array_of = /*@__PURE__*/ (() => array_constructor.of)();
145
+ // `BigInt` aliases
146
+ /** alias for `BigInt.asIntN`. */
147
+ export const bigint_asIntN = /*@__PURE__*/ (() => bigint_constructor.asIntN)();
148
+ /** alias for `BigInt.asUintN`. */
149
+ export const bigint_asUintN = /*@__PURE__*/ (() => bigint_constructor.asUintN)();
150
+ // `Date` aliases
151
+ /** alias for `Date.UTC`. */
152
+ export const date_UTC = /*@__PURE__*/ (() => date_constructor.UTC)();
153
+ /** alias for `Date.now`. */
154
+ export const date_now = /*@__PURE__*/ (() => date_constructor.now)();
155
+ /** alias for `Date.parse`. */
156
+ export const date_parse = /*@__PURE__*/ (() => date_constructor.parse)();
157
+ // `JSON` aliases
158
+ /** alias for `JSON.parse`. */
159
+ export const json_parse = /*@__PURE__*/ (() => json_constructor.parse)();
160
+ /** alias for `JSON.stringify`. */
161
+ export const json_stringify = /*@__PURE__*/ (() => json_constructor.stringify)();
162
+ // `Math` aliases
163
+ // numeric comparison functions
164
+ /** alias for `Math.max`. */
165
+ export const math_max = /*@__PURE__*/ (() => math_constructor.max)();
166
+ /** alias for `Math.min`. */
167
+ export const math_min = /*@__PURE__*/ (() => math_constructor.min)();
168
+ /** alias for `Math.sign`. */
169
+ export const math_sign = /*@__PURE__*/ (() => math_constructor.sign)();
170
+ // numeric rounding functions
171
+ /** alias for `Math.ceil`. */
172
+ export const math_ceil = /*@__PURE__*/ (() => math_constructor.ceil)();
173
+ /** alias for `Math.floor`. */
174
+ export const math_floor = /*@__PURE__*/ (() => math_constructor.floor)();
175
+ /** alias for `Math.fround`. */
176
+ export const math_fround = /*@__PURE__*/ (() => math_constructor.fround)();
177
+ /** alias for `Math.round`. */
178
+ export const math_round = /*@__PURE__*/ (() => math_constructor.round)();
179
+ /** alias for `Math.trunc`. but I'd recommend using `const my_int = my_float | 0` for truncating a float. */
180
+ export const math_trunc = /*@__PURE__*/ (() => math_constructor.trunc)();
181
+ // triginometric functions
182
+ /** alias for `Math.acos`. */
183
+ export const math_acos = /*@__PURE__*/ (() => math_constructor.acos)();
184
+ /** alias for `Math.acosh`. */
185
+ export const math_acosh = /*@__PURE__*/ (() => math_constructor.acosh)();
186
+ /** alias for `Math.asin`. */
187
+ export const math_asin = /*@__PURE__*/ (() => math_constructor.asin)();
188
+ /** alias for `Math.asinh`. */
189
+ export const math_asinh = /*@__PURE__*/ (() => math_constructor.asinh)();
190
+ /** alias for `Math.atan`. */
191
+ export const math_atan = /*@__PURE__*/ (() => math_constructor.atan)();
192
+ /** alias for `Math.atan2`. */
193
+ export const math_atan2 = /*@__PURE__*/ (() => math_constructor.atan2)();
194
+ /** alias for `Math.atanh`. */
195
+ export const math_atanh = /*@__PURE__*/ (() => math_constructor.atanh)();
196
+ /** alias for `Math.cos`. */
197
+ export const math_cos = /*@__PURE__*/ (() => math_constructor.cos)();
198
+ /** alias for `Math.cosh`. */
199
+ export const math_cosh = /*@__PURE__*/ (() => math_constructor.cosh)();
200
+ /** alias for `Math.sin`. */
201
+ export const math_sin = /*@__PURE__*/ (() => math_constructor.sin)();
202
+ /** alias for `Math.sinh`. */
203
+ export const math_sinh = /*@__PURE__*/ (() => math_constructor.sinh)();
204
+ /** alias for `Math.tan`. */
205
+ export const math_tan = /*@__PURE__*/ (() => math_constructor.tan)();
206
+ /** alias for `Math.tanh`. */
207
+ export const math_tanh = /*@__PURE__*/ (() => math_constructor.tanh)();
208
+ // math functions
209
+ /** alias for `Math.abs`. */
210
+ export const math_abs = /*@__PURE__*/ (() => math_constructor.abs)();
211
+ /** alias for `Math.cbrt`. */
212
+ export const math_cbrt = /*@__PURE__*/ (() => math_constructor.cbrt)();
213
+ /** alias for `Math.exp`. */
214
+ export const math_exp = /*@__PURE__*/ (() => math_constructor.exp)();
215
+ /** alias for `Math.expm1`. */
216
+ export const math_expm1 = /*@__PURE__*/ (() => math_constructor.expm1)();
217
+ /** alias for `Math.log`. */
218
+ export const math_log = /*@__PURE__*/ (() => math_constructor.log)();
219
+ /** alias for `Math.log10`. */
220
+ export const math_log10 = /*@__PURE__*/ (() => math_constructor.log10)();
221
+ /** alias for `Math.log1p`. */
222
+ export const math_log1p = /*@__PURE__*/ (() => math_constructor.log1p)();
223
+ /** alias for `Math.log2`. */
224
+ export const math_log2 = /*@__PURE__*/ (() => math_constructor.log2)();
225
+ /** alias for `Math.pow`. */
226
+ export const math_pow = /*@__PURE__*/ (() => math_constructor.pow)();
227
+ /** alias for `Math.sqrt`. */
228
+ export const math_sqrt = /*@__PURE__*/ (() => math_constructor.sqrt)();
229
+ // integer math
230
+ /** alias for `Math.clz32`. */
231
+ export const math_clz32 = /*@__PURE__*/ (() => math_constructor.clz32)();
232
+ /** alias for `Math.imul`. */
233
+ export const math_imul = /*@__PURE__*/ (() => math_constructor.imul)();
234
+ // multi-value functions
235
+ /** alias for `Math.hypot`. */
236
+ export const math_hypot = /*@__PURE__*/ (() => math_constructor.hypot)();
237
+ // randomization functions
238
+ /** alias for `Math.random`. */
239
+ export const math_random = /*@__PURE__*/ (() => math_constructor.random)();
240
+ // math constants
241
+ /** alias for `Math.E`. */
242
+ export const math_E = /*@__PURE__*/ (() => math_constructor.E)();
243
+ /** alias for `Math.LN10`. */
244
+ export const math_LN10 = /*@__PURE__*/ (() => math_constructor.LN10)();
245
+ /** alias for `Math.LN2`. */
246
+ export const math_LN2 = /*@__PURE__*/ (() => math_constructor.LN2)();
247
+ /** alias for `Math.LOG10E`. */
248
+ export const math_LOG10E = /*@__PURE__*/ (() => math_constructor.LOG10E)();
249
+ /** alias for `Math.LOG2E`. */
250
+ export const math_LOG2E = /*@__PURE__*/ (() => math_constructor.LOG2E)();
251
+ /** alias for `Math.PI`. */
252
+ export const math_PI = /*@__PURE__*/ (() => math_constructor.PI)();
253
+ /** alias for `Math.SQRT1_2`. */
254
+ export const math_SQRT1_2 = /*@__PURE__*/ (() => math_constructor.SQRT1_2)();
255
+ /** alias for `Math.SQRT2`. */
256
+ export const math_SQRT2 = /*@__PURE__*/ (() => math_constructor.SQRT2)();
257
+ // `Number` aliases
258
+ /** alias for `Number.EPSILON`. */
259
+ export const number_EPSILON = /*@__PURE__*/ (() => number_constructor.EPSILON)();
260
+ /** alias for `Number.MAX_SAFE_INTEGER`. */
261
+ export const number_MAX_SAFE_INTEGER = /*@__PURE__*/ (() => number_constructor.MAX_SAFE_INTEGER)();
262
+ /** alias for `Number.MAX_VALUE`. */
263
+ export const number_MAX_VALUE = /*@__PURE__*/ (() => number_constructor.MAX_VALUE)();
264
+ /** alias for `Number.MIN_SAFE_INTEGER`. */
265
+ export const number_MIN_SAFE_INTEGER = /*@__PURE__*/ (() => number_constructor.MIN_SAFE_INTEGER)();
266
+ /** alias for `Number.MIN_VALUE`. */
267
+ export const number_MIN_VALUE = /*@__PURE__*/ (() => number_constructor.MIN_VALUE)();
268
+ /** alias for `Number.NEGATIVE_INFINITY`. */
269
+ export const number_NEGATIVE_INFINITY = /*@__PURE__*/ (() => number_constructor.NEGATIVE_INFINITY)();
270
+ /** alias for `Number.NaN`. */
271
+ export const number_NaN = /*@__PURE__*/ (() => number_constructor.NaN)();
272
+ /** alias for `Number.POSITIVE_INFINITY`. */
273
+ export const number_POSITIVE_INFINITY = /*@__PURE__*/ (() => number_constructor.POSITIVE_INFINITY)();
274
+ /** alias for `Number.isFinite`. */
275
+ export const number_isFinite = /*@__PURE__*/ (() => number_constructor.isFinite)();
276
+ /** alias for `Number.isInteger`. */
277
+ export const number_isInteger = /*@__PURE__*/ (() => number_constructor.isInteger)();
278
+ /** alias for `Number.isNaN`. */
279
+ export const number_isNaN = /*@__PURE__*/ (() => number_constructor.isNaN)();
280
+ /** alias for `Number.isSafeInteger`. */
281
+ export const number_isSafeInteger = /*@__PURE__*/ (() => number_constructor.isSafeInteger)();
282
+ /** alias for `Number.parseFloat`. */
283
+ export const number_parseFloat = /*@__PURE__*/ (() => number_constructor.parseFloat)();
284
+ /** alias for `Number.parseInt`. */
285
+ export const number_parseInt = /*@__PURE__*/ (() => number_constructor.parseInt)();
286
+ // `Object` aliases
287
+ /** alias for `Object.assign`. */
288
+ export const object_assign = /*@__PURE__*/ (() => object_constructor.assign)();
289
+ /** alias for `Object.create`. */
290
+ export const object_create = /*@__PURE__*/ (() => object_constructor.create)();
291
+ /** alias for `Object.defineProperties`. */
292
+ export const object_defineProperties = /*@__PURE__*/ (() => object_constructor.defineProperties)();
293
+ /** alias for `Object.defineProperty`. */
294
+ export const object_defineProperty = /*@__PURE__*/ (() => object_constructor.defineProperty)();
295
+ /** alias for `Object.entries`. */
296
+ export const object_entries = /*@__PURE__*/ (() => object_constructor.entries)();
297
+ /** alias for `Object.freeze`. */
298
+ export const object_freeze = /*@__PURE__*/ (() => object_constructor.freeze)();
299
+ /** alias for `Object.fromEntries`. */
300
+ export const object_fromEntries = /*@__PURE__*/ (() => object_constructor.fromEntries)();
301
+ /** alias for `Object.getOwnPropertyDescriptor`. */
302
+ export const object_getOwnPropertyDescriptor = /*@__PURE__*/ (() => object_constructor.getOwnPropertyDescriptor)();
303
+ /** alias for `Object.getOwnPropertyDescriptors`. */
304
+ export const object_getOwnPropertyDescriptors = /*@__PURE__*/ (() => object_constructor.getOwnPropertyDescriptors)();
305
+ /** alias for `Object.getOwnPropertyNames`. */
306
+ export const object_getOwnPropertyNames = /*@__PURE__*/ (() => object_constructor.getOwnPropertyNames)();
307
+ /** alias for `Object.getOwnPropertySymbols`. */
308
+ export const object_getOwnPropertySymbols = /*@__PURE__*/ (() => object_constructor.getOwnPropertySymbols)();
309
+ /** alias for `Object.getPrototypeOf`. */
310
+ export const object_getPrototypeOf = /*@__PURE__*/ (() => object_constructor.getPrototypeOf)();
311
+ /** alias for `Object.groupBy`. */
312
+ export const object_groupBy = /*@__PURE__*/ (() => object_constructor.groupBy)();
313
+ /** alias for `Object.hasOwn`. */
314
+ export const object_hasOwn = /*@__PURE__*/ (() => object_constructor.hasOwn)();
315
+ /** alias for `Object.is`. */
316
+ export const object_is = /*@__PURE__*/ (() => object_constructor.is)();
317
+ /** alias for `Object.isExtensible`. */
318
+ export const object_isExtensible = /*@__PURE__*/ (() => object_constructor.isExtensible)();
319
+ /** alias for `Object.isFrozen`. */
320
+ export const object_isFrozen = /*@__PURE__*/ (() => object_constructor.isFrozen)();
321
+ /** alias for `Object.isSealed`. */
322
+ export const object_isSealed = /*@__PURE__*/ (() => object_constructor.isSealed)();
323
+ /** alias for `Object.keys`. */
324
+ export const object_keys = /*@__PURE__*/ (() => object_constructor.keys)();
325
+ /** alias for `Object.preventExtensions`. */
326
+ export const object_preventExtensions = /*@__PURE__*/ (() => object_constructor.preventExtensions)();
327
+ /** alias for `Object.seal`. */
328
+ export const object_seal = /*@__PURE__*/ (() => object_constructor.seal)();
329
+ /** alias for `Object.setPrototypeOf`. */
330
+ export const object_setPrototypeOf = /*@__PURE__*/ (() => object_constructor.setPrototypeOf)();
331
+ /** alias for `Object.values`. */
332
+ export const object_values = /*@__PURE__*/ (() => object_constructor.values)();
333
+ // `Promise` aliases
334
+ /** create a promise that never resolves. */
335
+ export const promise_forever = () => new Promise(noop);
336
+ /** create a promise with external (i.e. outside of scope) resolve and reject controls.
337
+ * this was created before the existence of {@link Promise.withResolvers}.
338
+ * if you'd like to use that instead, see the alias {@link promise_withResolvers}.
339
+ */
340
+ export const promise_outside = () => {
341
+ let resolve, reject;
342
+ const promise = new Promise((_resolve, _reject) => {
343
+ resolve = _resolve;
344
+ reject = _reject;
345
+ });
346
+ return [promise, resolve, reject];
347
+ };
348
+ /** alias for `Promise.all`. */
349
+ export const promise_all = /*@__PURE__*/ promise_constructor.all.bind(promise_constructor);
350
+ /** alias for `Promise.allSettled`. */
351
+ export const promise_allSettled = /*@__PURE__*/ promise_constructor.allSettled.bind(promise_constructor);
352
+ /** alias for `Promise.any`. */
353
+ export const promise_any = /*@__PURE__*/ promise_constructor.any.bind(promise_constructor);
354
+ /** alias for `Promise.race`. */
355
+ export const promise_race = /*@__PURE__*/ promise_constructor.race.bind(promise_constructor);
356
+ /** alias for `Promise.reject`. */
357
+ export const promise_reject = /*@__PURE__*/ promise_constructor.reject.bind(promise_constructor);
358
+ /** alias for `Promise.resolve`. */
359
+ export const promise_resolve = /*@__PURE__*/ promise_constructor.resolve.bind(promise_constructor);
360
+ /** alias for `Promise.withResolvers`.
361
+ * create a promise with external resolver and rejecter functions, provided in an object form.
362
+ *
363
+ * if you'd like a more minifiable version, consider using the array equivalent: {@link promise_outside}.
364
+ *
365
+ * > [!warning]
366
+ * > don't invoke this alias on `node <= 20`, since it isn't available there,
367
+ * > and the deno-to-node transformer does not polyfill this function for some reason.
368
+ * >
369
+ * > TODO: in the future, when this is no longer an issue, get rid of the optional chaining operator ("?").
370
+ */
371
+ export const promise_withResolvers = /*@__PURE__*/ promise_constructor.withResolvers?.bind(promise_constructor);
372
+ // `Response` aliases
373
+ /** alias for `Response.error`. */
374
+ export const response_error = /*@__PURE__*/ (() => response_constructor.error)();
375
+ /** alias for `Response.json`. */
376
+ export const response_json = /*@__PURE__*/ (() => response_constructor.json)();
377
+ /** alias for `Response.redirect`. */
378
+ export const response_redirect = /*@__PURE__*/ (() => response_constructor.redirect)();
379
+ // `String` aliases
380
+ /** turn a string to uppercase */
381
+ export const string_toUpperCase = (str) => str.toUpperCase();
382
+ /** turn a string to lowercase */
383
+ export const string_toLowerCase = (str) => str.toLowerCase();
384
+ /** this function provides a string representation of the given object, similar to how `console.log` would represent it.
385
+ *
386
+ * @example
387
+ * ```ts
388
+ * import { assertEquals } from "jsr:@std/assert"
389
+ *
390
+ * assertEquals(
391
+ * string_repr("a string"),
392
+ * `a string`
393
+ * )
394
+ *
395
+ * assertEquals(
396
+ * string_repr({ an: "object", with: ["an", "array"] }),
397
+ * `{ an: "object", with: [ "an", "array" ] }`
398
+ * )
399
+ *
400
+ * assertEquals(
401
+ * string_repr(new Map<any, any>([["a", 1], ["b", 2], [{ hello: "world" }, 3]])),
402
+ * `Map(3) { "a" => 1, "b" => 2, { hello: "world" } => 3 }`
403
+ * )
404
+ *
405
+ * class Person {
406
+ * name: string
407
+ * age: number
408
+ *
409
+ * constructor(name: string, age: number) {
410
+ * this.name = name
411
+ * this.age = age
412
+ * }
413
+ *
414
+ * greet() { return `Konichiwa! watashi no namae wa ${this.name}` }
415
+ * }
416
+ *
417
+ * assertEquals(
418
+ * string_repr(new Person("sekiro", 2000)),
419
+ * `Person { name: "sekiro", age: 2000 }`
420
+ * )
421
+ *
422
+ * const test_data = {
423
+ * num: 123,
424
+ * str: "text",
425
+ * bool: false,
426
+ * nil: null,
427
+ * undef: undefined,
428
+ * person: new Person("kenshiro", 99),
429
+ * func: function example() {},
430
+ * anon: () => {},
431
+ * arr: [1, "two", { three: 3 }],
432
+ * obj: { a: 1, b: { c: 2 }, self: undefined },
433
+ * sym: Symbol("sym"),
434
+ * bigInt: BigInt(200),
435
+ * set: new Set([1, 2, 3, "kakashi", { itachi: "zabuza" }])
436
+ * }
437
+ * test_data.obj.self = test_data as any
438
+ *
439
+ * assertEquals(string_repr(test_data),
440
+ * `{ ` +
441
+ * `num: 123, ` +
442
+ * `str: "text", ` +
443
+ * `bool: false, ` +
444
+ * `nil: null, ` +
445
+ * `undef: undefined, ` +
446
+ * `person: Person { name: "kenshiro", age: 99 }, ` +
447
+ * `func: [Function: example], ` +
448
+ * `anon: [Function: anon], ` +
449
+ * `arr: [ 1, "two", { three: 3 } ], ` +
450
+ * `obj: { a: 1, b: { c: 2 }, self: [Circular] }, ` +
451
+ * `sym: Symbol(sym), ` +
452
+ * `bigInt: 200n, ` +
453
+ * `set: Set(5) { 1, 2, 3, "kakashi", { itachi: "zabuza" } } ` +
454
+ * `}`
455
+ * )
456
+ * ```
457
+ */
458
+ export const string_repr = (value, seen_objects) => {
459
+ if (value === null) {
460
+ return "null";
461
+ }
462
+ switch (typeof value) {
463
+ case "number":
464
+ case "boolean":
465
+ case "symbol":
466
+ return value.toString();
467
+ case "bigint":
468
+ return value.toString() + "n";
469
+ case "string":
470
+ // we will only enclose the string in double quotes if there is a host object under which this string exists.
471
+ // how do we know that? `seen_objects` is only defined when a host object exists for the current `value`.
472
+ return seen_objects ? "\"" + value + "\"" : value;
473
+ case "function":
474
+ return "[Function" + (value.name ? (": " + value.name) : "") + "]";
475
+ case "undefined":
476
+ return "undefined";
477
+ }
478
+ // the `value` is a non-null `object`
479
+ seen_objects ??= new WeakSet();
480
+ if (seen_objects.has(value)) {
481
+ return "[Circular]";
482
+ }
483
+ seen_objects.add(value);
484
+ const class_name = object_getPrototypeOf(value)?.constructor?.name ?? "", is_array = array_isArray(value), is_typedarray = value instanceof object_getPrototypeOf(Uint8Array), is_set = value instanceof Set, is_weakset = value instanceof WeakSet, is_map = value instanceof Map, is_weakmap = value instanceof WeakMap, is_indexed_collection = is_array || is_typedarray || is_set, is_weak_collection = is_weakset || is_weakmap;
485
+ const items_repr = is_indexed_collection ? [...value].map((item) => string_repr(item, seen_objects))
486
+ : is_map ? [...value].map(([key, val]) => `${string_repr(key, seen_objects)} => ${string_repr(val, seen_objects)}`)
487
+ : !is_weak_collection ? object_entries(value).map(([key, val]) => `${key}: ${string_repr(val, seen_objects)}`)
488
+ : [];
489
+ const length = items_repr.length, items_str = items_repr.join(", "), class_name_and_length = (class_name === "Object" || class_name === "Array") ? ""
490
+ : ((is_indexed_collection || is_map)
491
+ ? `${class_name}(${length})`
492
+ : class_name) + " ";
493
+ seen_objects.delete(value);
494
+ return class_name_and_length + ((is_array || is_typedarray)
495
+ ? `[ ${items_str} ]`
496
+ : `{ ${items_str} }`);
497
+ };
498
+ /** this function prepares a string representation of the provided `args`, in a manner similar to how `console.log` would print them out.
499
+ *
500
+ * > [!important]
501
+ * > although the returned string is pretty close to `console.log` in terms or representation, there are still many inconsistencies,
502
+ * > in addition to the fact that no line breaks are added, nor are long enumerations of array items trimmed to fit in the preview.
503
+ * > see the documentation comment of {@link string_repr} to see how individual items would typical transform under this function.
504
+ *
505
+ * why would anyone have a need for such a function?
506
+ * well, for my use case, I need it for printing out prettified `Error` exceptions (via {@link throw_error}),
507
+ * since the `Error` constructor only takes in a single string parameter.
508
+ * and having to do string interpolation for each error, in addition to using a ton of `JSON.stringify`, gets tiresome really quickly.
509
+ */
510
+ export const string_log = (...args) => {
511
+ return args.map((item) => string_repr(item)).join(" ");
512
+ };
513
+ /** alias for `String.fromCharCode` */
514
+ export const string_fromCharCode = /*@__PURE__*/ (() => string_constructor.fromCharCode)();
515
+ /** alias for `String.fromCodePoint` */
516
+ export const string_fromCodePoint = /*@__PURE__*/ (() => string_constructor.fromCodePoint)();
517
+ /** alias for `String.raw` */
518
+ export const string_raw = /*@__PURE__*/ (() => string_constructor.raw)();
519
+ // `Symbol` aliases
520
+ /** alias for `Symbol.asyncDispose`. */
521
+ export const symbol_asyncDispose = /*@__PURE__*/ (() => symbol_constructor.asyncDispose)();
522
+ /** alias for `Symbol.asyncIterator`. */
523
+ export const symbol_asyncIterator = /*@__PURE__*/ (() => symbol_constructor.asyncIterator)();
524
+ /** alias for `Symbol.dispose`. */
525
+ export const symbol_dispose = /*@__PURE__*/ (() => symbol_constructor.dispose)();
526
+ /** alias for `Symbol.for`. */
527
+ export const symbol_for = /*@__PURE__*/ (() => symbol_constructor.for)();
528
+ /** alias for `Symbol.hasInstance`. */
529
+ export const symbol_hasInstance = /*@__PURE__*/ (() => symbol_constructor.hasInstance)();
530
+ /** alias for `Symbol.isConcatSpreadable`. */
531
+ export const symbol_isConcatSpreadable = /*@__PURE__*/ (() => symbol_constructor.isConcatSpreadable)();
532
+ /** alias for `Symbol.iterator`. */
533
+ export const symbol_iterator = /*@__PURE__*/ (() => symbol_constructor.iterator)();
534
+ /** alias for `Symbol.keyFor`. */
535
+ export const symbol_keyFor = /*@__PURE__*/ (() => symbol_constructor.keyFor)();
536
+ /** alias for `Symbol.match`. */
537
+ export const symbol_match = /*@__PURE__*/ (() => symbol_constructor.match)();
538
+ /** alias for `Symbol.matchAll`. */
539
+ export const symbol_matchAll = /*@__PURE__*/ (() => symbol_constructor.matchAll)();
540
+ /** alias for `Symbol.metadata`. */
541
+ export const symbol_metadata = /*@__PURE__*/ (() => symbol_constructor.metadata)();
542
+ /** alias for `Symbol.replace`. */
543
+ export const symbol_replace = /*@__PURE__*/ (() => symbol_constructor.replace)();
544
+ /** alias for `Symbol.search`. */
545
+ export const symbol_search = /*@__PURE__*/ (() => symbol_constructor.search)();
546
+ /** alias for `Symbol.species`. */
547
+ export const symbol_species = /*@__PURE__*/ (() => symbol_constructor.species)();
548
+ /** alias for `Symbol.split`. */
549
+ export const symbol_split = /*@__PURE__*/ (() => symbol_constructor.split)();
550
+ /** alias for `Symbol.toPrimitive`. */
551
+ export const symbol_toPrimitive = /*@__PURE__*/ (() => symbol_constructor.toPrimitive)();
552
+ /** alias for `Symbol.toStringTag`. */
553
+ export const symbol_toStringTag = /*@__PURE__*/ (() => symbol_constructor.toStringTag)();
554
+ /** alias for `Symbol.unscopables`. */
555
+ export const symbol_unscopables = /*@__PURE__*/ (() => symbol_constructor.unscopables)();
556
+ // `console` aliases
557
+ /** alias for `console.assert`. */
558
+ export const console_assert = /*@__PURE__*/ (() => console_object.assert)();
559
+ /** alias for `console.clear`. */
560
+ export const console_clear = /*@__PURE__*/ (() => console_object.clear)();
561
+ /** alias for `console.count`. */
562
+ export const console_count = /*@__PURE__*/ (() => console_object.count)();
563
+ /** alias for `console.countReset`. */
564
+ export const console_countReset = /*@__PURE__*/ (() => console_object.countReset)();
565
+ /** alias for `console.debug`. */
566
+ export const console_debug = /*@__PURE__*/ (() => console_object.debug)();
567
+ /** alias for `console.dir`. */
568
+ export const console_dir = /*@__PURE__*/ (() => console_object.dir)();
569
+ /** alias for `console.dirxml`. */
570
+ export const console_dirxml = /*@__PURE__*/ (() => console_object.dirxml)();
571
+ /** alias for `console.error`. */
572
+ export const console_error = /*@__PURE__*/ (() => console_object.error)();
573
+ /** alias for `console.group`. */
574
+ export const console_group = /*@__PURE__*/ (() => console_object.group)();
575
+ /** alias for `console.groupCollapsed`. */
576
+ export const console_groupCollapsed = /*@__PURE__*/ (() => console_object.groupCollapsed)();
577
+ /** alias for `console.groupEnd`. */
578
+ export const console_groupEnd = /*@__PURE__*/ (() => console_object.groupEnd)();
579
+ /** alias for `console.info`. */
580
+ export const console_info = /*@__PURE__*/ (() => console_object.info)();
581
+ /** alias for `console.log`. */
582
+ export const console_log = /*@__PURE__*/ (() => console_object.log)();
583
+ /** alias for `console.table`. */
584
+ export const console_table = /*@__PURE__*/ (() => console_object.table)();
585
+ /** alias for `console.time`. */
586
+ export const console_time = /*@__PURE__*/ (() => console_object.time)();
587
+ /** alias for `console.timeEnd`. */
588
+ export const console_timeEnd = /*@__PURE__*/ (() => console_object.timeEnd)();
589
+ /** alias for `console.timeLog`. */
590
+ export const console_timeLog = /*@__PURE__*/ (() => console_object.timeLog)();
591
+ /** alias for `console.timeStamp`. */
592
+ export const console_timeStamp = /*@__PURE__*/ (() => console_object.timeStamp)();
593
+ /** alias for `console.trace`. */
594
+ export const console_trace = /*@__PURE__*/ (() => console_object.trace)();
595
+ /** alias for `console.warn`. */
596
+ export const console_warn = /*@__PURE__*/ (() => console_object.warn)();
597
+ // `performance` aliases
598
+ /** get the current high-precision time in milliseconds. alias for `performance.now`. */
599
+ export const performance_now = /*@__PURE__*/ performance_object.now.bind(performance_object);
600
+ // built-in `window` function aliases
601
+ /** alias for the function `window.setTimeout`. */
602
+ export const dom_setTimeout = setTimeout;
603
+ /** alias for the function `window.clearTimeout`. */
604
+ export const dom_clearTimeout = clearTimeout;
605
+ /** alias for the function `window.setInterval`. */
606
+ export const dom_setInterval = setInterval;
607
+ /** alias for the function `window.clearInterval`. */
608
+ export const dom_clearInterval = clearInterval;
609
+ /** alias for the function `window.encodeURI`. */
610
+ export const dom_encodeURI = encodeURI;
611
+ /** alias for the function `window.encodeURIComponent`. */
612
+ export const dom_encodeURIComponent = encodeURIComponent;
613
+ /** alias for the function `window.decodeURI`. */
614
+ export const dom_decodeURI = decodeURI;
615
+ /** alias for the function `window.encodeURIComponent`. */
616
+ export const dom_decodeURIComponent = decodeURIComponent;
617
+ // error invocation related aliases
618
+ /** this function throws an error whenever called, and it logs the `messages` that you've provided it,
619
+ * in (almost) the same manner as `console.log` would do.
620
+ *
621
+ * > [!tip]
622
+ * > where is this function useful?
623
+ * >
624
+ * > suppose you want to ensure that the value returned by a function `my_fn: <T>() => (T | undefined)` is non-nullable.
625
+ * > and if it is `undefined`, then the your current function scope to throw an error, so that it exits.
626
+ * >
627
+ * > typically, you would have to do something like:
628
+ * > ```ts ignore
629
+ * > // example 1:
630
+ * > const my_var = my_fn()
631
+ * > if(my_var === undefined || my_var === null) {
632
+ * > throw Error("`my_var` was not supposed to be undefined")
633
+ * > }
634
+ * >
635
+ * > // example 2:
636
+ * > const my_path = normalizePath("path/to/file.ts")
637
+ * > if(!my_path.startsWith("./")) {
638
+ * > throw Error(`expected a relative path, instead found: ${my_path}`)
639
+ * > }
640
+ * > ```
641
+ * >
642
+ * > but with this function, you can write more concise inline statements for invoking errors conditionally:
643
+ * > ```ts ignore
644
+ * > // example 1:
645
+ * > const my_var = (my_fn() ?? throw_error("`my_var` was not supposed to be undefined"))!
646
+ * >
647
+ * > // example 2:
648
+ * > const
649
+ * > temp = normalizePath("path/to/file.ts"),
650
+ * > my_path = (temp.startsWith("./") ? temp : throw_error("expected a relative path, found:", temp))!
651
+ * > ```
652
+ *
653
+ * @example
654
+ * ```ts
655
+ * import { assertThrows } from "jsr:@std/assert"
656
+ *
657
+ * assertThrows(throw_error, "")
658
+ *
659
+ * assertThrows(() => {
660
+ * const my_fn = ((): string | undefined => (undefined))
661
+ * const my_var = (my_fn() ?? throw_error("`my_var` was not supposed to be undefined"))!
662
+ * typeof my_var satisfies string
663
+ * }, "`my_var` was not supposed to be undefined")
664
+ *
665
+ * assertThrows(
666
+ * () => throw_error("liar liar", { pants: new Set(["on", "fire"]) }),
667
+ * `liar liar { pants: Set(2) { "on", "fire" } }`
668
+ * )
669
+ * ```
670
+ */
671
+ export const throw_error = (...messages) => { throw new Error(string_log(...messages)); };