@kubb/core 4.3.1 → 4.4.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 (128) hide show
  1. package/dist/{URLPath-BYceu_vY.js → URLPath-Bpc_OJmh.js} +2 -3
  2. package/dist/{URLPath-BYceu_vY.js.map → URLPath-Bpc_OJmh.js.map} +1 -1
  3. package/dist/{URLPath-8WVzHBnA.cjs → URLPath-Bu6Wkco7.cjs} +6 -7
  4. package/dist/{URLPath-8WVzHBnA.cjs.map → URLPath-Bu6Wkco7.cjs.map} +1 -1
  5. package/dist/{chunk-CZg_9w7l.cjs → chunk-CUT6urMc.cjs} +0 -23
  6. package/dist/{fs-RSVoUw3S.cjs → fs-CM7ohZSu.cjs} +2 -2
  7. package/dist/{fs-RSVoUw3S.cjs.map → fs-CM7ohZSu.cjs.map} +1 -1
  8. package/dist/fs.cjs +2 -2
  9. package/dist/fs.d.ts +1 -1
  10. package/dist/hooks.cjs +6 -6
  11. package/dist/hooks.cjs.map +1 -1
  12. package/dist/hooks.d.cts +1 -1
  13. package/dist/hooks.d.ts +4 -4
  14. package/dist/hooks.js +1 -1
  15. package/dist/hooks.js.map +1 -1
  16. package/dist/{index-BTe91LHd.d.ts → index-DdO15F70.d.ts} +2 -3
  17. package/dist/index.cjs +46 -53
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +15 -11
  20. package/dist/index.d.ts +18 -14
  21. package/dist/index.js +40 -48
  22. package/dist/index.js.map +1 -1
  23. package/dist/{logger-BXL0YCrv.cjs → logger-C7JFdYpj.cjs} +4 -4
  24. package/dist/{logger-BXL0YCrv.cjs.map → logger-C7JFdYpj.cjs.map} +1 -1
  25. package/dist/{logger-BA-za85-.d.ts → logger-D_jvWsUF.d.ts} +1 -1
  26. package/dist/{logger-CDxSrFkR.js → logger-khF_Lft4.js} +2 -2
  27. package/dist/{logger-CDxSrFkR.js.map → logger-khF_Lft4.js.map} +1 -1
  28. package/dist/logger.cjs +2 -2
  29. package/dist/logger.d.ts +1 -1
  30. package/dist/logger.js +1 -1
  31. package/dist/{prompt-DBVnG4Me.js → prompt-CIpZjUDy.js} +1 -1
  32. package/dist/{prompt-DBVnG4Me.js.map → prompt-CIpZjUDy.js.map} +1 -1
  33. package/dist/{prompt-DgONOpPH.cjs → prompt-CgJLZzbf.cjs} +2 -2
  34. package/dist/{prompt-DgONOpPH.cjs.map → prompt-CgJLZzbf.cjs.map} +1 -1
  35. package/dist/transformers-BN5jfIAt.js +339 -0
  36. package/dist/transformers-BN5jfIAt.js.map +1 -0
  37. package/dist/transformers-BpnIvSiH.cjs +443 -0
  38. package/dist/transformers-BpnIvSiH.cjs.map +1 -0
  39. package/dist/transformers.cjs +7 -6
  40. package/dist/transformers.js +1 -3
  41. package/dist/{types-DPeNK0FO.d.ts → types-CCUiy4jG.d.ts} +43 -45
  42. package/dist/{types-BzI9JlV8.d.ts → types-ClXc6HFo.d.ts} +1 -1
  43. package/dist/{types-DNxlynJr.d.cts → types-EV6-sImo.d.cts} +40 -42
  44. package/dist/utils.cjs +7 -7
  45. package/dist/utils.cjs.map +1 -1
  46. package/dist/utils.d.ts +1 -1
  47. package/dist/utils.js +4 -6
  48. package/dist/utils.js.map +1 -1
  49. package/dist/{write-BJfM7G1_.cjs → write-BsFt8M9e.cjs} +2 -2
  50. package/dist/{write-BJfM7G1_.cjs.map → write-BsFt8M9e.cjs.map} +1 -1
  51. package/package.json +8 -14
  52. package/src/PluginManager.ts +3 -7
  53. package/src/build.ts +37 -41
  54. package/src/hooks/useMode.ts +1 -1
  55. package/src/hooks/usePlugin.ts +1 -1
  56. package/src/hooks/usePluginManager.ts +1 -1
  57. package/src/plugin.ts +10 -5
  58. package/src/types.ts +2 -1
  59. package/dist/acorn-BAVXZMtK.cjs +0 -5082
  60. package/dist/acorn-BAVXZMtK.cjs.map +0 -1
  61. package/dist/acorn-D-VhIOLw.js +0 -5080
  62. package/dist/acorn-D-VhIOLw.js.map +0 -1
  63. package/dist/angular-Bp0XO9db.cjs +0 -3631
  64. package/dist/angular-Bp0XO9db.cjs.map +0 -1
  65. package/dist/angular-Czhp4eq5.js +0 -3629
  66. package/dist/angular-Czhp4eq5.js.map +0 -1
  67. package/dist/babel-DCR_B4Qn.js +0 -10033
  68. package/dist/babel-DCR_B4Qn.js.map +0 -1
  69. package/dist/babel-NI0v59ga.cjs +0 -10035
  70. package/dist/babel-NI0v59ga.cjs.map +0 -1
  71. package/dist/casing-BSeq_teY.js +0 -100
  72. package/dist/casing-BSeq_teY.js.map +0 -1
  73. package/dist/casing-CP-9GGdK.cjs +0 -112
  74. package/dist/casing-CP-9GGdK.cjs.map +0 -1
  75. package/dist/chunk-1SJ2vVWa.js +0 -35
  76. package/dist/estree-C3BZPlpU.cjs +0 -6930
  77. package/dist/estree-C3BZPlpU.cjs.map +0 -1
  78. package/dist/estree-DU2NummP.js +0 -6926
  79. package/dist/estree-DU2NummP.js.map +0 -1
  80. package/dist/flow-CWUBUkoi.cjs +0 -52252
  81. package/dist/flow-CWUBUkoi.cjs.map +0 -1
  82. package/dist/flow-JiEbweKj.js +0 -52250
  83. package/dist/flow-JiEbweKj.js.map +0 -1
  84. package/dist/glimmer-CX9OqG1j.cjs +0 -7275
  85. package/dist/glimmer-CX9OqG1j.cjs.map +0 -1
  86. package/dist/glimmer-t9nWn9aE.js +0 -7271
  87. package/dist/glimmer-t9nWn9aE.js.map +0 -1
  88. package/dist/graphql-DjErlIi5.js +0 -1897
  89. package/dist/graphql-DjErlIi5.js.map +0 -1
  90. package/dist/graphql-GOxQAKxM.cjs +0 -1902
  91. package/dist/graphql-GOxQAKxM.cjs.map +0 -1
  92. package/dist/html-CWrdYAhQ.cjs +0 -6560
  93. package/dist/html-CWrdYAhQ.cjs.map +0 -1
  94. package/dist/html-_apcbx34.js +0 -6555
  95. package/dist/html-_apcbx34.js.map +0 -1
  96. package/dist/markdown-ckUc3Q6q.js +0 -6750
  97. package/dist/markdown-ckUc3Q6q.js.map +0 -1
  98. package/dist/markdown-pzqiRmft.cjs +0 -6755
  99. package/dist/markdown-pzqiRmft.cjs.map +0 -1
  100. package/dist/meriyah-BjnGqpUs.js +0 -8928
  101. package/dist/meriyah-BjnGqpUs.js.map +0 -1
  102. package/dist/meriyah-D_x7itbT.cjs +0 -8930
  103. package/dist/meriyah-D_x7itbT.cjs.map +0 -1
  104. package/dist/mocks.cjs +0 -16830
  105. package/dist/mocks.cjs.map +0 -1
  106. package/dist/mocks.d.cts +0 -13
  107. package/dist/mocks.d.ts +0 -13
  108. package/dist/mocks.js +0 -16818
  109. package/dist/mocks.js.map +0 -1
  110. package/dist/postcss-B_c2wbFu.cjs +0 -6689
  111. package/dist/postcss-B_c2wbFu.cjs.map +0 -1
  112. package/dist/postcss-v7BP6SZ-.js +0 -6684
  113. package/dist/postcss-v7BP6SZ-.js.map +0 -1
  114. package/dist/transformers-BH0KLJJP.cjs +0 -804
  115. package/dist/transformers-BH0KLJJP.cjs.map +0 -1
  116. package/dist/transformers-DzHGqYO2.js +0 -702
  117. package/dist/transformers-DzHGqYO2.js.map +0 -1
  118. package/dist/typescript-6kMN6Wqz.cjs +0 -23014
  119. package/dist/typescript-6kMN6Wqz.cjs.map +0 -1
  120. package/dist/typescript-B_IBfKSe.js +0 -23002
  121. package/dist/typescript-B_IBfKSe.js.map +0 -1
  122. package/dist/typescript-C5hce4HG.cjs +0 -4
  123. package/dist/typescript-Cas1XcNz.js +0 -3
  124. package/dist/yaml-BfWM_B73.js +0 -5209
  125. package/dist/yaml-BfWM_B73.js.map +0 -1
  126. package/dist/yaml-DZs6MhV1.cjs +0 -5215
  127. package/dist/yaml-DZs6MhV1.cjs.map +0 -1
  128. package/src/mocks/index.ts +0 -82
@@ -1,702 +0,0 @@
1
- import { r as __toESM, t as __commonJS } from "./chunk-1SJ2vVWa.js";
2
- import { n as pascalCase, t as camelCase } from "./casing-BSeq_teY.js";
3
- import { merge, merge as merge$1 } from "remeda";
4
-
5
- //#region src/transformers/transformReservedWord.ts
6
- /**
7
- * @link https://github.com/jonschlinkert/reserved/blob/master/index.js
8
- */
9
- const reservedWords = [
10
- "abstract",
11
- "arguments",
12
- "boolean",
13
- "break",
14
- "byte",
15
- "case",
16
- "catch",
17
- "char",
18
- "class",
19
- "const",
20
- "continue",
21
- "debugger",
22
- "default",
23
- "delete",
24
- "do",
25
- "double",
26
- "else",
27
- "enum",
28
- "eval",
29
- "export",
30
- "extends",
31
- "false",
32
- "final",
33
- "finally",
34
- "float",
35
- "for",
36
- "function",
37
- "goto",
38
- "if",
39
- "implements",
40
- "import",
41
- "in",
42
- "instanceof",
43
- "int",
44
- "interface",
45
- "let",
46
- "long",
47
- "native",
48
- "new",
49
- "null",
50
- "package",
51
- "private",
52
- "protected",
53
- "public",
54
- "return",
55
- "short",
56
- "static",
57
- "super",
58
- "switch",
59
- "synchronized",
60
- "this",
61
- "throw",
62
- "throws",
63
- "transient",
64
- "true",
65
- "try",
66
- "typeof",
67
- "var",
68
- "void",
69
- "volatile",
70
- "while",
71
- "with",
72
- "yield",
73
- "Array",
74
- "Date",
75
- "eval",
76
- "function",
77
- "hasOwnProperty",
78
- "Infinity",
79
- "isFinite",
80
- "isNaN",
81
- "isPrototypeOf",
82
- "length",
83
- "Math",
84
- "name",
85
- "NaN",
86
- "Number",
87
- "Object",
88
- "prototype",
89
- "String",
90
- "toString",
91
- "undefined",
92
- "valueOf"
93
- ];
94
- function transformReservedWord(word) {
95
- if (word && reservedWords.includes(word) || word?.match(/^\d/)) return `_${word}`;
96
- return word;
97
- }
98
- function isValidVarName(name) {
99
- try {
100
- Function(`var ${name}`);
101
- } catch (_e) {
102
- return false;
103
- }
104
- return true;
105
- }
106
-
107
- //#endregion
108
- //#region src/transformers/trim.ts
109
- function trim(text) {
110
- return text.replaceAll(/\n/g, "").trim();
111
- }
112
- function trimQuotes(text) {
113
- if (text.match(/^"(.*)"$/)) return text.replace(/^"(.*)"$/, "$1");
114
- if (text.match(/^'(.*)'$/)) return text.replace(/^'(.*)'$/, "$1");
115
- if (text.match(/^`(.*)`$/)) return text.replace(/^`(.*)`$/, "$1");
116
- return text;
117
- }
118
-
119
- //#endregion
120
- //#region ../../node_modules/.pnpm/natural-orderby@5.0.0/node_modules/natural-orderby/dist/umd/natural-orderby.production.min.js
121
- var require_natural_orderby_production_min = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/natural-orderby@5.0.0/node_modules/natural-orderby/dist/umd/natural-orderby.production.min.js": ((exports, module) => {
122
- /**
123
- * natural-orderby v5.0.0
124
- *
125
- * Copyright (c) Olaf Ennen
126
- *
127
- * This source code is licensed under the MIT license found in the
128
- * LICENSE.md file in the root directory of this source tree.
129
- *
130
- * @license MIT
131
- */
132
- (function(r, n) {
133
- "object" == typeof exports && "undefined" != typeof module ? n(exports) : "function" == typeof define && define.amd ? define(["exports"], n) : n((r = "undefined" != typeof globalThis ? globalThis : r || self).naturalOrderBy = {});
134
- })(exports, (function(r) {
135
- var n = function(r$1, n$1) {
136
- return r$1 < n$1 ? -1 : r$1 > n$1 ? 1 : 0;
137
- }, e = function(r$1, n$1, e$1) {
138
- var t$1 = r$1.localeCompare(n$1, e$1);
139
- return t$1 ? t$1 / Math.abs(t$1) : 0;
140
- }, t = /(^0x[\da-fA-F]+$|^([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?(?!\.\d+)(?=\D|\s|$))|\d+)/g, i = /^\s+|\s+$/g, o = /\s+/g, u = /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/, a = /(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[/-]\d{1,4}[/-]\d{1,4}|^\w+, \w+ \d+, \d{4})/, s = /^0+[1-9]{1}[0-9]*$/, c = /[^\x00-\x80]/, f = function(r$1, n$1) {
141
- return r$1 < n$1 ? -1 : r$1 > n$1 ? 1 : 0;
142
- }, l = function(r$1, t$1, i$1) {
143
- return r$1.value === t$1.value ? 0 : void 0 !== r$1.parsedNumber && void 0 !== t$1.parsedNumber ? n(r$1.parsedNumber, t$1.parsedNumber) : r$1.chunks && t$1.chunks ? function(r$2, t$2, i$2) {
144
- for (var o$1 = r$2.length, u$1 = t$2.length, a$1 = Math.min(o$1, u$1), s$1 = 0; s$1 < a$1; s$1++) {
145
- var l$1 = r$2[s$1], d$1 = t$2[s$1];
146
- if (l$1.normalizedString !== d$1.normalizedString) {
147
- if ("" === l$1.normalizedString != ("" === d$1.normalizedString)) return "" === l$1.normalizedString ? -1 : 1;
148
- if (void 0 !== l$1.parsedNumber && void 0 !== d$1.parsedNumber) {
149
- var m$1 = n(l$1.parsedNumber, d$1.parsedNumber);
150
- return 0 === m$1 ? f(l$1.normalizedString, d$1.normalizedString) : m$1;
151
- }
152
- return void 0 !== l$1.parsedNumber || void 0 !== d$1.parsedNumber ? void 0 !== l$1.parsedNumber ? -1 : 1 : c.test(l$1.normalizedString + d$1.normalizedString) ? e(l$1.normalizedString, d$1.normalizedString, i$2) : f(l$1.normalizedString, d$1.normalizedString);
153
- }
154
- }
155
- return o$1 > a$1 || u$1 > a$1 ? o$1 <= a$1 ? -1 : 1 : 0;
156
- }(r$1.chunks, t$1.chunks, i$1) : function(r$2, n$1) {
157
- return (r$2.chunks ? !n$1.chunks : n$1.chunks) ? r$2.chunks ? -1 : 1 : (r$2.isNaN ? !n$1.isNaN : n$1.isNaN) ? r$2.isNaN ? -1 : 1 : (r$2.isSymbol ? !n$1.isSymbol : n$1.isSymbol) ? r$2.isSymbol ? -1 : 1 : (r$2.isObject ? !n$1.isObject : n$1.isObject) ? r$2.isObject ? -1 : 1 : (r$2.isArray ? !n$1.isArray : n$1.isArray) ? r$2.isArray ? -1 : 1 : (r$2.isFunction ? !n$1.isFunction : n$1.isFunction) ? r$2.isFunction ? -1 : 1 : (r$2.isNull ? !n$1.isNull : n$1.isNull) ? r$2.isNull ? -1 : 1 : 0;
158
- }(r$1, t$1);
159
- }, d = function(r$1) {
160
- return r$1.replace(o, " ").replace(i, "");
161
- }, m = function(r$1) {
162
- if (0 !== r$1.length) {
163
- var n$1 = Number(r$1.replace(/_/g, ""));
164
- if (!Number.isNaN(n$1)) return n$1;
165
- }
166
- }, p = function(r$1, n$1, e$1) {
167
- if (u.test(r$1) && (!s.test(r$1) || 0 === n$1 || "." !== e$1[n$1 - 1])) return m(r$1) || 0;
168
- }, y = function(r$1, n$1, e$1) {
169
- return {
170
- parsedNumber: p(r$1, n$1, e$1),
171
- normalizedString: d(r$1)
172
- };
173
- }, b = function(r$1) {
174
- return function(r$2) {
175
- return r$2.replace(t, "\0$1\0").replace(/\0$/, "").replace(/^\0/, "").split("\0");
176
- }(r$1).map(y);
177
- }, N = function(r$1) {
178
- return "function" == typeof r$1;
179
- }, v = function(r$1) {
180
- return Number.isNaN(r$1) || r$1 instanceof Number && Number.isNaN(r$1.valueOf());
181
- }, g = function(r$1) {
182
- return null === r$1;
183
- }, S = function(r$1) {
184
- return !(null === r$1 || "object" != typeof r$1 || Array.isArray(r$1) || r$1 instanceof Number || r$1 instanceof String || r$1 instanceof Boolean || r$1 instanceof Date);
185
- }, h = function(r$1) {
186
- return "symbol" == typeof r$1;
187
- }, A = function(r$1) {
188
- return void 0 === r$1;
189
- }, z = function(r$1) {
190
- var n$1 = m(r$1);
191
- return void 0 !== n$1 ? n$1 : function(r$2) {
192
- try {
193
- var n$2 = Date.parse(r$2);
194
- return !Number.isNaN(n$2) && a.test(r$2) ? n$2 : void 0;
195
- } catch (r$3) {
196
- return;
197
- }
198
- }(r$1);
199
- }, j = function(r$1) {
200
- if ("string" == typeof r$1 || r$1 instanceof String || ("number" == typeof r$1 || r$1 instanceof Number) && !v(r$1) || "boolean" == typeof r$1 || r$1 instanceof Boolean || r$1 instanceof Date) {
201
- var n$1 = function(r$2) {
202
- return "boolean" == typeof r$2 || r$2 instanceof Boolean ? Number(r$2).toString() : "number" == typeof r$2 || r$2 instanceof Number ? r$2.toString() : r$2 instanceof Date ? r$2.getTime().toString() : "string" == typeof r$2 || r$2 instanceof String ? r$2.toLowerCase().replace(i, "") : "";
203
- }(r$1), e$1 = z(n$1);
204
- return {
205
- parsedNumber: e$1,
206
- chunks: b(e$1 ? "" + e$1 : n$1),
207
- value: r$1
208
- };
209
- }
210
- return {
211
- isArray: Array.isArray(r$1),
212
- isFunction: N(r$1),
213
- isNaN: v(r$1),
214
- isNull: g(r$1),
215
- isObject: S(r$1),
216
- isSymbol: h(r$1),
217
- isUndefined: A(r$1),
218
- value: r$1
219
- };
220
- }, x = function(r$1) {
221
- return "string" == typeof r$1 && ("asc" === r$1 || "desc" === r$1);
222
- };
223
- var k = function(r$1) {
224
- return "function" == typeof r$1 ? r$1 : function(n$1) {
225
- if (Array.isArray(n$1)) {
226
- var e$1 = Number(r$1);
227
- if (Number.isInteger(e$1)) return n$1[e$1];
228
- } else if (n$1 && "object" == typeof n$1) {
229
- var t$1 = Object.getOwnPropertyDescriptor(n$1, r$1);
230
- return null == t$1 ? void 0 : t$1.value;
231
- }
232
- return n$1;
233
- };
234
- }, w = function(r$1, n$1, e$1, t$1) {
235
- var i$1 = n$1.length ? n$1.map(k) : [function(r$2) {
236
- return r$2;
237
- }], o$1 = r$1.map((function(r$2, n$2) {
238
- return {
239
- index: n$2,
240
- values: i$1.map((function(n$3) {
241
- return n$3(r$2);
242
- })).map(j)
243
- };
244
- }));
245
- return o$1.sort((function(r$2, n$2) {
246
- return function(r$3, n$3, e$2, t$2) {
247
- for (var i$2 = r$3.index, o$2 = r$3.values, u$1 = n$3.index, a$1 = n$3.values, s$1 = o$2.length, c$1 = e$2.length, f$1 = 0; f$1 < s$1; f$1++) {
248
- var d$1 = f$1 < c$1 ? e$2[f$1] : null;
249
- if (d$1 && "function" == typeof d$1) {
250
- var m$1 = d$1(o$2[f$1].value, a$1[f$1].value);
251
- if (m$1) return m$1;
252
- } else {
253
- var p$1 = l(o$2[f$1], a$1[f$1], t$2);
254
- if (p$1) return p$1 * ("desc" === d$1 ? -1 : 1);
255
- }
256
- }
257
- return i$2 - u$1;
258
- }(r$2, n$2, e$1, t$1);
259
- })), o$1.map((function(n$2) {
260
- return function(r$2, n$3) {
261
- return r$2[n$3];
262
- }(r$1, n$2.index);
263
- }));
264
- };
265
- r.compare = function(r$1) {
266
- var n$1, e$1, t$1;
267
- return function(r$2) {
268
- return function(n$2, e$2) {
269
- return l(j(n$2), j(e$2), r$2.locale) * ("desc" === r$2.order ? -1 : 1);
270
- };
271
- }((t$1 = "asc", "string" == typeof (n$1 = r$1) && x(n$1) ? t$1 = n$1 : n$1 && "object" == typeof n$1 && (n$1.order && x(n$1.order) && (t$1 = n$1.order), n$1.locale && n$1.locale.length > 0 && (e$1 = n$1.locale)), {
272
- order: t$1,
273
- locale: e$1
274
- }));
275
- }, r.orderBy = function(r$1, n$1, e$1, t$1) {
276
- if (!r$1 || !Array.isArray(r$1)) return [];
277
- return w(r$1, function(r$2) {
278
- if (!r$2) return [];
279
- var n$2 = Array.isArray(r$2) ? [].concat(r$2) : [r$2];
280
- return n$2.some((function(r$3) {
281
- return "string" != typeof r$3 && "number" != typeof r$3 && "function" != typeof r$3;
282
- })) ? [] : n$2;
283
- }(n$1), function(r$2) {
284
- if (!r$2) return [];
285
- var n$2 = Array.isArray(r$2) ? [].concat(r$2) : [r$2];
286
- return n$2.some((function(r$3) {
287
- return "asc" !== r$3 && "desc" !== r$3 && "function" != typeof r$3;
288
- })) ? [] : n$2;
289
- }(e$1), t$1);
290
- };
291
- }));
292
- }) });
293
-
294
- //#endregion
295
- //#region ../../node_modules/.pnpm/natural-orderby@5.0.0/node_modules/natural-orderby/dist/umd/natural-orderby.development.js
296
- var require_natural_orderby_development = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/natural-orderby@5.0.0/node_modules/natural-orderby/dist/umd/natural-orderby.development.js": ((exports, module) => {
297
- /**
298
- * natural-orderby v5.0.0
299
- *
300
- * Copyright (c) Olaf Ennen
301
- *
302
- * This source code is licensed under the MIT license found in the
303
- * LICENSE.md file in the root directory of this source tree.
304
- *
305
- * @license MIT
306
- */
307
- (function(global, factory) {
308
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.naturalOrderBy = {}));
309
- })(exports, (function(exports$1) {
310
- var compareNumbers = function compareNumbers$1(numberA, numberB) {
311
- if (numberA < numberB) return -1;
312
- if (numberA > numberB) return 1;
313
- return 0;
314
- };
315
- var compareUnicode = function compareUnicode$1(stringA, stringB, locale) {
316
- var result = stringA.localeCompare(stringB, locale);
317
- return result ? result / Math.abs(result) : 0;
318
- };
319
- var RE_NUMBERS = /(^0x[\da-fA-F]+$|^([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?(?!\.\d+)(?=\D|\s|$))|\d+)/g;
320
- var RE_LEADING_OR_TRAILING_WHITESPACES = /^\s+|\s+$/g;
321
- var RE_WHITESPACES = /\s+/g;
322
- var RE_INT_OR_FLOAT = /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/;
323
- var RE_DATE = /(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[/-]\d{1,4}[/-]\d{1,4}|^\w+, \w+ \d+, \d{4})/;
324
- var RE_LEADING_ZERO = /^0+[1-9]{1}[0-9]*$/;
325
- var RE_UNICODE_CHARACTERS = /[^\x00-\x80]/;
326
- var stringCompare = function stringCompare$1(stringA, stringB) {
327
- if (stringA < stringB) return -1;
328
- if (stringA > stringB) return 1;
329
- return 0;
330
- };
331
- var compareChunks = function compareChunks$1(chunksA, chunksB, locale) {
332
- var lengthA = chunksA.length;
333
- var lengthB = chunksB.length;
334
- var size = Math.min(lengthA, lengthB);
335
- for (var i = 0; i < size; i++) {
336
- var chunkA = chunksA[i];
337
- var chunkB = chunksB[i];
338
- if (chunkA.normalizedString !== chunkB.normalizedString) {
339
- if (chunkA.normalizedString === "" !== (chunkB.normalizedString === "")) return chunkA.normalizedString === "" ? -1 : 1;
340
- if (chunkA.parsedNumber !== void 0 && chunkB.parsedNumber !== void 0) {
341
- var result = compareNumbers(chunkA.parsedNumber, chunkB.parsedNumber);
342
- if (result === 0) return stringCompare(chunkA.normalizedString, chunkB.normalizedString);
343
- return result;
344
- } else if (chunkA.parsedNumber !== void 0 || chunkB.parsedNumber !== void 0) return chunkA.parsedNumber !== void 0 ? -1 : 1;
345
- else if (RE_UNICODE_CHARACTERS.test(chunkA.normalizedString + chunkB.normalizedString)) return compareUnicode(chunkA.normalizedString, chunkB.normalizedString, locale);
346
- else return stringCompare(chunkA.normalizedString, chunkB.normalizedString);
347
- }
348
- }
349
- if (lengthA > size || lengthB > size) return lengthA <= size ? -1 : 1;
350
- return 0;
351
- };
352
- var compareOtherTypes = function compareOtherTypes$1(valueA, valueB) {
353
- if (!valueA.chunks ? valueB.chunks : !valueB.chunks) return !valueA.chunks ? 1 : -1;
354
- if (valueA.isNaN ? !valueB.isNaN : valueB.isNaN) return valueA.isNaN ? -1 : 1;
355
- if (valueA.isSymbol ? !valueB.isSymbol : valueB.isSymbol) return valueA.isSymbol ? -1 : 1;
356
- if (valueA.isObject ? !valueB.isObject : valueB.isObject) return valueA.isObject ? -1 : 1;
357
- if (valueA.isArray ? !valueB.isArray : valueB.isArray) return valueA.isArray ? -1 : 1;
358
- if (valueA.isFunction ? !valueB.isFunction : valueB.isFunction) return valueA.isFunction ? -1 : 1;
359
- if (valueA.isNull ? !valueB.isNull : valueB.isNull) return valueA.isNull ? -1 : 1;
360
- return 0;
361
- };
362
- var compareValues = function compareValues$1(valueA, valueB, locale) {
363
- if (valueA.value === valueB.value) return 0;
364
- if (valueA.parsedNumber !== void 0 && valueB.parsedNumber !== void 0) return compareNumbers(valueA.parsedNumber, valueB.parsedNumber);
365
- if (valueA.chunks && valueB.chunks) return compareChunks(valueA.chunks, valueB.chunks, locale);
366
- return compareOtherTypes(valueA, valueB);
367
- };
368
- var normalizeAlphaChunk = function normalizeAlphaChunk$1(chunk) {
369
- return chunk.replace(RE_WHITESPACES, " ").replace(RE_LEADING_OR_TRAILING_WHITESPACES, "");
370
- };
371
- var parseNumber = function parseNumber$1(value) {
372
- if (value.length !== 0) {
373
- var parsedNumber = Number(value.replace(/_/g, ""));
374
- if (!Number.isNaN(parsedNumber)) return parsedNumber;
375
- }
376
- };
377
- var normalizeNumericChunk = function normalizeNumericChunk$1(chunk, index, chunks) {
378
- if (RE_INT_OR_FLOAT.test(chunk)) {
379
- if (!RE_LEADING_ZERO.test(chunk) || index === 0 || chunks[index - 1] !== ".") return parseNumber(chunk) || 0;
380
- }
381
- };
382
- var createChunkMap = function createChunkMap$1(chunk, index, chunks) {
383
- return {
384
- parsedNumber: normalizeNumericChunk(chunk, index, chunks),
385
- normalizedString: normalizeAlphaChunk(chunk)
386
- };
387
- };
388
- var createChunks = function createChunks$1(value) {
389
- return value.replace(RE_NUMBERS, "\0$1\0").replace(/\0$/, "").replace(/^\0/, "").split("\0");
390
- };
391
- var createChunkMaps = function createChunkMaps$1(value) {
392
- return createChunks(value).map(createChunkMap);
393
- };
394
- var isFunction = function isFunction$1(value) {
395
- return typeof value === "function";
396
- };
397
- var isNaN = function isNaN$1(value) {
398
- return Number.isNaN(value) || value instanceof Number && Number.isNaN(value.valueOf());
399
- };
400
- var isNull = function isNull$1(value) {
401
- return value === null;
402
- };
403
- var isObject = function isObject$1(value) {
404
- return value !== null && typeof value === "object" && !Array.isArray(value) && !(value instanceof Number) && !(value instanceof String) && !(value instanceof Boolean) && !(value instanceof Date);
405
- };
406
- var isSymbol = function isSymbol$1(value) {
407
- return typeof value === "symbol";
408
- };
409
- var isUndefined = function isUndefined$1(value) {
410
- return value === void 0;
411
- };
412
- var parseDate = function parseDate$1(value) {
413
- try {
414
- var parsedDate = Date.parse(value);
415
- if (!Number.isNaN(parsedDate)) {
416
- if (RE_DATE.test(value)) return parsedDate;
417
- }
418
- return;
419
- } catch (_unused) {
420
- return;
421
- }
422
- };
423
- var numberify = function numberify$1(value) {
424
- var parsedNumber = parseNumber(value);
425
- if (parsedNumber !== void 0) return parsedNumber;
426
- return parseDate(value);
427
- };
428
- var stringify$1 = function stringify$2(value) {
429
- if (typeof value === "boolean" || value instanceof Boolean) return Number(value).toString();
430
- if (typeof value === "number" || value instanceof Number) return value.toString();
431
- if (value instanceof Date) return value.getTime().toString();
432
- if (typeof value === "string" || value instanceof String) return value.toLowerCase().replace(RE_LEADING_OR_TRAILING_WHITESPACES, "");
433
- return "";
434
- };
435
- var getMappedValueRecord = function getMappedValueRecord$1(value) {
436
- if (typeof value === "string" || value instanceof String || (typeof value === "number" || value instanceof Number) && !isNaN(value) || typeof value === "boolean" || value instanceof Boolean || value instanceof Date) {
437
- var stringValue = stringify$1(value);
438
- var parsedNumber = numberify(stringValue);
439
- return {
440
- parsedNumber,
441
- chunks: createChunkMaps(parsedNumber ? "" + parsedNumber : stringValue),
442
- value
443
- };
444
- }
445
- return {
446
- isArray: Array.isArray(value),
447
- isFunction: isFunction(value),
448
- isNaN: isNaN(value),
449
- isNull: isNull(value),
450
- isObject: isObject(value),
451
- isSymbol: isSymbol(value),
452
- isUndefined: isUndefined(value),
453
- value
454
- };
455
- };
456
- var baseCompare = function baseCompare$1(options) {
457
- return function(valueA, valueB) {
458
- return compareValues(getMappedValueRecord(valueA), getMappedValueRecord(valueB), options.locale) * (options.order === "desc" ? -1 : 1);
459
- };
460
- };
461
- var isValidOrder = function isValidOrder$1(value) {
462
- return typeof value === "string" && (value === "asc" || value === "desc");
463
- };
464
- var getOptions = function getOptions$1(customOptions) {
465
- var order = "asc";
466
- var locale;
467
- if (typeof customOptions === "string" && isValidOrder(customOptions)) order = customOptions;
468
- else if (customOptions && typeof customOptions === "object") {
469
- if (customOptions.order && isValidOrder(customOptions.order)) order = customOptions.order;
470
- if (customOptions.locale && customOptions.locale.length > 0) locale = customOptions.locale;
471
- }
472
- return {
473
- order,
474
- locale
475
- };
476
- };
477
- /**
478
- * Creates a compare function that defines the natural sort order considering
479
- * the given `options` which may be passed to [`Array.prototype.sort()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort).
480
- */
481
- function compare(options) {
482
- return baseCompare(getOptions(options));
483
- }
484
- var compareMultiple = function compareMultiple$1(recordA, recordB, orders, locale) {
485
- var indexA = recordA.index, valuesA = recordA.values;
486
- var indexB = recordB.index, valuesB = recordB.values;
487
- var length = valuesA.length;
488
- var ordersLength = orders.length;
489
- for (var i = 0; i < length; i++) {
490
- var order = i < ordersLength ? orders[i] : null;
491
- if (order && typeof order === "function") {
492
- var result = order(valuesA[i].value, valuesB[i].value);
493
- if (result) return result;
494
- } else {
495
- var _result = compareValues(valuesA[i], valuesB[i], locale);
496
- if (_result) return _result * (order === "desc" ? -1 : 1);
497
- }
498
- }
499
- return indexA - indexB;
500
- };
501
- var createIdentifierFn = function createIdentifierFn$1(identifier) {
502
- if (typeof identifier === "function") return identifier;
503
- return function(value) {
504
- if (Array.isArray(value)) {
505
- var index = Number(identifier);
506
- if (Number.isInteger(index)) return value[index];
507
- } else if (value && typeof value === "object") {
508
- var result = Object.getOwnPropertyDescriptor(value, identifier);
509
- return result == null ? void 0 : result.value;
510
- }
511
- return value;
512
- };
513
- };
514
- var getElementByIndex = function getElementByIndex$1(collection, index) {
515
- return collection[index];
516
- };
517
- var getValueByIdentifier = function getValueByIdentifier$1(value, getValue) {
518
- return getValue(value);
519
- };
520
- var baseOrderBy = function baseOrderBy$1(collection, identifiers, orders, locale) {
521
- var identifierFns = identifiers.length ? identifiers.map(createIdentifierFn) : [function(value) {
522
- return value;
523
- }];
524
- var mappedCollection = collection.map(function(element, index) {
525
- return {
526
- index,
527
- values: identifierFns.map(function(identifier) {
528
- return getValueByIdentifier(element, identifier);
529
- }).map(getMappedValueRecord)
530
- };
531
- });
532
- mappedCollection.sort(function(recordA, recordB) {
533
- return compareMultiple(recordA, recordB, orders, locale);
534
- });
535
- return mappedCollection.map(function(element) {
536
- return getElementByIndex(collection, element.index);
537
- });
538
- };
539
- var getIdentifiers = function getIdentifiers$1(identifiers) {
540
- if (!identifiers) return [];
541
- var identifierList = !Array.isArray(identifiers) ? [identifiers] : [].concat(identifiers);
542
- if (identifierList.some(function(identifier) {
543
- return typeof identifier !== "string" && typeof identifier !== "number" && typeof identifier !== "function";
544
- })) return [];
545
- return identifierList;
546
- };
547
- var getOrders = function getOrders$1(orders) {
548
- if (!orders) return [];
549
- var orderList = !Array.isArray(orders) ? [orders] : [].concat(orders);
550
- if (orderList.some(function(order) {
551
- return order !== "asc" && order !== "desc" && typeof order !== "function";
552
- })) return [];
553
- return orderList;
554
- };
555
- /**
556
- * Creates an array of elements, natural sorted by specified identifiers and
557
- * the corresponding sort orders. This method implements a stable sort
558
- * algorithm, which means the original sort order of equal elements is
559
- * preserved.
560
- */
561
- function orderBy$2(collection, identifiers, orders, locale) {
562
- if (!collection || !Array.isArray(collection)) return [];
563
- return baseOrderBy(collection, getIdentifiers(identifiers), getOrders(orders), locale);
564
- }
565
- exports$1.compare = compare;
566
- exports$1.orderBy = orderBy$2;
567
- }));
568
- }) });
569
-
570
- //#endregion
571
- //#region ../../node_modules/.pnpm/natural-orderby@5.0.0/node_modules/natural-orderby/dist/main.js
572
- var require_main = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/natural-orderby@5.0.0/node_modules/natural-orderby/dist/main.js": ((exports, module) => {
573
- if (process.env.NODE_ENV === "production") module.exports = require_natural_orderby_production_min();
574
- else module.exports = require_natural_orderby_development();
575
- }) });
576
-
577
- //#endregion
578
- //#region src/transformers/combineCodes.ts
579
- function combineCodes(codes) {
580
- return codes.join("\n");
581
- }
582
-
583
- //#endregion
584
- //#region src/transformers/createJSDocBlockText.ts
585
- function createJSDocBlockText({ comments }) {
586
- const filteredComments = comments.filter(Boolean);
587
- if (!filteredComments.length) return "";
588
- return `/**\n * ${filteredComments.join("\n * ")}\n */`;
589
- }
590
-
591
- //#endregion
592
- //#region src/transformers/escape.ts
593
- function escape(text) {
594
- return text ? text.replaceAll("`", "\\`") : "";
595
- }
596
- /**
597
- * Escape all characters not included in SingleStringCharacters and DoubleStringCharacters on
598
- * @link http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.4
599
- * @link https://github.com/joliss/js-string-escape/blob/master/index.js
600
- */
601
- function jsStringEscape(input) {
602
- return `${input}`.replace(/["'\\\n\r\u2028\u2029]/g, (character) => {
603
- switch (character) {
604
- case "\"":
605
- case "'":
606
- case "\\": return `\\${character}`;
607
- case "\n": return "\\n";
608
- case "\r": return "\\r";
609
- case "\u2028": return "\\u2028";
610
- case "\u2029": return "\\u2029";
611
- default: return "";
612
- }
613
- });
614
- }
615
-
616
- //#endregion
617
- //#region src/transformers/indent.ts
618
- function createIndent(size) {
619
- return Array.from({ length: size + 1 }).join(" ");
620
- }
621
-
622
- //#endregion
623
- //#region src/transformers/nameSorter.ts
624
- function nameSorter(a, b) {
625
- if (a.name < b.name) return -1;
626
- if (a.name > b.name) return 1;
627
- return 0;
628
- }
629
-
630
- //#endregion
631
- //#region src/transformers/searchAndReplace.ts
632
- function searchAndReplace(options) {
633
- const { text, replaceBy, prefix = "", key } = options;
634
- return (options.searchValues?.(prefix, key) || [
635
- `${prefix}["${key}"]`,
636
- `${prefix}['${key}']`,
637
- `${prefix}[\`${key}\`]`,
638
- `${prefix}"${key}"`,
639
- `${prefix}'${key}'`,
640
- `${prefix}\`${key}\``,
641
- new RegExp(`${prefix}${key}`, "g")
642
- ]).reduce((prev, searchValue) => {
643
- return prev.toString().replaceAll(searchValue, replaceBy);
644
- }, text);
645
- }
646
-
647
- //#endregion
648
- //#region src/transformers/stringify.ts
649
- function stringify(value) {
650
- if (value === void 0 || value === null) return "\"\"";
651
- return JSON.stringify(trimQuotes(value.toString()));
652
- }
653
- function stringifyObject(value) {
654
- return Object.entries(value).map(([key, value$1]) => {
655
- if (typeof value$1 === "object") return `${key}: {
656
- ${stringifyObject(value$1)}
657
- }`;
658
- return `${key}: ${value$1}`;
659
- }).filter(Boolean).join(",\n");
660
- }
661
-
662
- //#endregion
663
- //#region src/transformers/toRegExp.ts
664
- function toRegExpString(text, func = "RegExp") {
665
- const raw = trimQuotes(text);
666
- const [, replacementTarget = "", matchedFlags] = raw.match(/^\^(\(\?([igmsuy]+)\))/i) ?? [];
667
- const cleaned = raw.replace(/^\\?\//, "").replace(/\\?\/$/, "").replace(replacementTarget, "");
668
- const regex = new RegExp(cleaned, matchedFlags);
669
- const source = regex.source;
670
- const flags = regex.flags;
671
- if (func === null) return `/${source}/${flags}`;
672
- return `new ${func}(${JSON.stringify(source)}${flags ? `, ${JSON.stringify(flags)}` : ""})`;
673
- }
674
-
675
- //#endregion
676
- //#region src/transformers/index.ts
677
- var import_main = /* @__PURE__ */ __toESM(require_main(), 1);
678
- var import_main$1 = /* @__PURE__ */ __toESM(require_main(), 1);
679
- var transformers_default = {
680
- combineCodes,
681
- escape,
682
- jsStringEscape,
683
- createIndent,
684
- transformReservedWord,
685
- isValidVarName,
686
- nameSorter,
687
- searchAndReplace,
688
- stringify,
689
- stringifyObject,
690
- toRegExpString,
691
- trim,
692
- trimQuotes,
693
- JSDoc: { createJSDocBlockText },
694
- orderBy: import_main.orderBy,
695
- merge,
696
- camelCase,
697
- pascalCase
698
- };
699
-
700
- //#endregion
701
- export { isValidVarName as _, stringify as a, nameSorter as c, jsStringEscape as d, createJSDocBlockText as f, trimQuotes as g, trim as h, toRegExpString as i, createIndent as l, require_main as m, merge$1 as n, stringifyObject as o, combineCodes as p, transformers_default as r, searchAndReplace as s, import_main$1 as t, escape as u, transformReservedWord as v };
702
- //# sourceMappingURL=transformers-DzHGqYO2.js.map