@ls-stack/utils 3.17.1 → 3.19.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 (114) hide show
  1. package/README.md +1 -15
  2. package/docs/README.md +72 -0
  3. package/docs/_media/modules.md +52 -0
  4. package/docs/arrayUtils/-internal-.md +17 -0
  5. package/docs/arrayUtils/README.md +423 -0
  6. package/docs/assertions/-internal-.md +63 -0
  7. package/docs/assertions/README.md +565 -0
  8. package/docs/asyncQueue/-internal-.md +815 -0
  9. package/docs/asyncQueue/README.md +75 -0
  10. package/docs/awaitDebounce.md +66 -0
  11. package/docs/cache/-internal-.md +168 -0
  12. package/docs/cache/README.md +360 -0
  13. package/docs/castValues.md +47 -0
  14. package/docs/concurrentCalls/-internal-.md +416 -0
  15. package/docs/concurrentCalls/README.md +77 -0
  16. package/docs/consoleFmt.md +91 -0
  17. package/docs/conversions.md +27 -0
  18. package/docs/createThrottleController/-internal-.md +73 -0
  19. package/docs/createThrottleController/README.md +31 -0
  20. package/docs/debounce.md +188 -0
  21. package/docs/dedent.md +117 -0
  22. package/docs/deepEqual.md +94 -0
  23. package/docs/enhancedMap.md +358 -0
  24. package/docs/exhaustiveMatch/-internal-.md +39 -0
  25. package/docs/exhaustiveMatch/README.md +146 -0
  26. package/docs/getAutoIncrementId.md +93 -0
  27. package/docs/getCompositeKey.md +39 -0
  28. package/docs/getValueStableKey.md +57 -0
  29. package/docs/hash.md +31 -0
  30. package/docs/interpolate/-internal-.md +61 -0
  31. package/docs/interpolate/README.md +62 -0
  32. package/docs/levenshtein.md +93 -0
  33. package/docs/main.md +21 -0
  34. package/docs/mathUtils.md +137 -0
  35. package/docs/modules.md +52 -0
  36. package/docs/objUtils.md +237 -0
  37. package/docs/parallelAsyncCalls/-internal-.md +347 -0
  38. package/docs/parallelAsyncCalls/README.md +45 -0
  39. package/docs/promiseUtils/-internal-.md +69 -0
  40. package/docs/promiseUtils/README.md +31 -0
  41. package/docs/retryOnError.md +67 -0
  42. package/docs/runShellCmd/-internal-.md +111 -0
  43. package/docs/runShellCmd/README.md +201 -0
  44. package/docs/safeJson.md +51 -0
  45. package/docs/saferTyping.md +228 -0
  46. package/docs/serializeXML.md +100 -0
  47. package/docs/shallowEqual.md +33 -0
  48. package/docs/sleep.md +27 -0
  49. package/docs/stringUtils/-internal-.md +17 -0
  50. package/docs/stringUtils/README.md +166 -0
  51. package/docs/testUtils.md +315 -0
  52. package/docs/throttle/-internal-.md +47 -0
  53. package/docs/throttle/README.md +178 -0
  54. package/docs/time.md +274 -0
  55. package/docs/timers.md +256 -0
  56. package/docs/tsResult/-internal-.md +327 -0
  57. package/docs/tsResult/README.md +696 -0
  58. package/docs/typeGuards.md +399 -0
  59. package/docs/typingFnUtils/-internal-.md +27 -0
  60. package/docs/typingFnUtils/README.md +293 -0
  61. package/docs/typingTestUtils.md +172 -0
  62. package/docs/typingUtils.md +111 -0
  63. package/docs/yamlStringify.md +45 -0
  64. package/lib/arrayUtils.js +3 -3
  65. package/lib/assertions.js +2 -2
  66. package/lib/awaitDebounce.cjs +106 -0
  67. package/lib/awaitDebounce.d.cts +38 -0
  68. package/lib/awaitDebounce.d.ts +38 -0
  69. package/lib/awaitDebounce.js +28 -0
  70. package/lib/cache.js +2 -2
  71. package/lib/{chunk-NH2LCAQS.js → chunk-6FIBVC2P.js} +1 -1
  72. package/lib/{chunk-GKOTKAIV.js → chunk-7CQPOM5I.js} +1 -1
  73. package/lib/{chunk-WS4WEVHU.js → chunk-C2SVCIWE.js} +1 -1
  74. package/lib/{chunk-SSKW673U.js → chunk-JF2MDHOJ.js} +5 -1
  75. package/lib/chunk-NW5H5EW7.js +100 -0
  76. package/lib/{chunk-DMW5Q4T2.js → chunk-SRVMMYSW.js} +1 -1
  77. package/lib/concurrentCalls.js +3 -3
  78. package/lib/createThrottleController.js +3 -3
  79. package/lib/debounce.js +4 -95
  80. package/lib/enhancedMap.js +3 -3
  81. package/lib/getAutoIncrementId.cjs +44 -0
  82. package/lib/getAutoIncrementId.d.cts +44 -0
  83. package/lib/getAutoIncrementId.d.ts +44 -0
  84. package/lib/getAutoIncrementId.js +18 -0
  85. package/lib/getCompositeKey.js +3 -3
  86. package/lib/getValueStableKey.js +3 -3
  87. package/lib/interpolate.js +2 -2
  88. package/lib/parallelAsyncCalls.js +2 -2
  89. package/lib/runShellCmd.d.cts +50 -0
  90. package/lib/runShellCmd.d.ts +50 -0
  91. package/lib/serializeXML.cjs +7 -2
  92. package/lib/serializeXML.d.cts +1 -1
  93. package/lib/serializeXML.d.ts +1 -1
  94. package/lib/serializeXML.js +7 -5
  95. package/lib/testUtils.js +3 -3
  96. package/lib/throttle.cjs +250 -0
  97. package/lib/throttle.d.cts +89 -0
  98. package/lib/throttle.d.ts +89 -0
  99. package/lib/throttle.js +38 -0
  100. package/lib/timers.cjs +93 -0
  101. package/lib/timers.d.cts +110 -0
  102. package/lib/timers.d.ts +110 -0
  103. package/lib/timers.js +65 -0
  104. package/lib/tsResult.js +2 -2
  105. package/lib/typeGuards.cjs +7 -2
  106. package/lib/typeGuards.d.cts +2 -1
  107. package/lib/typeGuards.d.ts +2 -1
  108. package/lib/typeGuards.js +5 -3
  109. package/lib/typingFnUtils.cjs +5 -1
  110. package/lib/typingFnUtils.d.cts +1 -1
  111. package/lib/typingFnUtils.d.ts +1 -1
  112. package/lib/typingFnUtils.js +5 -1
  113. package/lib/yamlStringify.js +5 -5
  114. package/package.json +26 -12
@@ -0,0 +1,100 @@
1
+ // src/debounce.ts
2
+ function debounce(func, wait, options) {
3
+ let lastArgs;
4
+ let lastThis;
5
+ let maxWait;
6
+ let result;
7
+ let timerId;
8
+ let lastCallTime;
9
+ let lastInvokeTime = 0;
10
+ let leading = false;
11
+ let maxing = false;
12
+ let trailing = true;
13
+ if (options) {
14
+ leading = !!options.leading;
15
+ maxing = "maxWait" in options;
16
+ maxWait = maxing ? Math.max(options.maxWait || 0, wait) : maxWait;
17
+ trailing = "trailing" in options ? !!options.trailing : trailing;
18
+ }
19
+ function invokeFunc(time) {
20
+ const args = lastArgs;
21
+ const thisArg = lastThis;
22
+ lastArgs = lastThis = void 0;
23
+ lastInvokeTime = time;
24
+ result = func.apply(thisArg, args);
25
+ return result;
26
+ }
27
+ function leadingEdge(time) {
28
+ lastInvokeTime = time;
29
+ timerId = setTimeout(timerExpired, wait);
30
+ return leading ? invokeFunc(time) : result;
31
+ }
32
+ function remainingWait(time) {
33
+ const timeSinceLastCall = time - (lastCallTime ?? 0);
34
+ const timeSinceLastInvoke = time - lastInvokeTime;
35
+ const timeWaiting = wait - timeSinceLastCall;
36
+ return maxing ? Math.min(timeWaiting, (maxWait ?? 0) - timeSinceLastInvoke) : timeWaiting;
37
+ }
38
+ function shouldInvoke(time) {
39
+ const timeSinceLastCall = time - (lastCallTime ?? 0);
40
+ const timeSinceLastInvoke = time - lastInvokeTime;
41
+ return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= (maxWait ?? 0);
42
+ }
43
+ function timerExpired() {
44
+ const time = Date.now();
45
+ if (shouldInvoke(time)) {
46
+ return trailingEdge(time);
47
+ }
48
+ timerId = setTimeout(timerExpired, remainingWait(time));
49
+ }
50
+ function trailingEdge(time) {
51
+ timerId = void 0;
52
+ if (trailing && lastArgs) {
53
+ return invokeFunc(time);
54
+ }
55
+ lastArgs = lastThis = void 0;
56
+ return result;
57
+ }
58
+ function cancel() {
59
+ if (timerId !== void 0) {
60
+ clearTimeout(timerId);
61
+ }
62
+ lastInvokeTime = 0;
63
+ lastArgs = lastCallTime = lastThis = timerId = void 0;
64
+ }
65
+ function flush() {
66
+ return timerId === void 0 ? result : trailingEdge(Date.now());
67
+ }
68
+ function debounced() {
69
+ const time = Date.now();
70
+ const isInvoking = shouldInvoke(time);
71
+ lastArgs = arguments;
72
+ lastThis = this;
73
+ lastCallTime = time;
74
+ if (isInvoking) {
75
+ if (timerId === void 0) {
76
+ return leadingEdge(lastCallTime);
77
+ }
78
+ if (maxing) {
79
+ clearTimeout(timerId);
80
+ timerId = setTimeout(timerExpired, wait);
81
+ return invokeFunc(lastCallTime);
82
+ }
83
+ }
84
+ if (timerId === void 0) {
85
+ timerId = setTimeout(timerExpired, wait);
86
+ }
87
+ return result;
88
+ }
89
+ debounced.cancel = cancel;
90
+ debounced.flush = flush;
91
+ return debounced;
92
+ }
93
+ function isDebouncedFn(fn) {
94
+ return typeof fn === "function" && "cancel" in fn && "flush" in fn;
95
+ }
96
+
97
+ export {
98
+ debounce,
99
+ isDebouncedFn
100
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isFunction
3
- } from "./chunk-WS4WEVHU.js";
3
+ } from "./chunk-C2SVCIWE.js";
4
4
 
5
5
  // src/arrayUtils.ts
6
6
  function filterAndMap(array, mapFilter) {
@@ -6,12 +6,12 @@ import {
6
6
  } from "./chunk-5DZT3Z5Z.js";
7
7
  import {
8
8
  truncateArray
9
- } from "./chunk-DMW5Q4T2.js";
9
+ } from "./chunk-SRVMMYSW.js";
10
10
  import {
11
11
  invariant,
12
12
  isPromise
13
- } from "./chunk-WS4WEVHU.js";
14
- import "./chunk-SSKW673U.js";
13
+ } from "./chunk-C2SVCIWE.js";
14
+ import "./chunk-JF2MDHOJ.js";
15
15
 
16
16
  // src/concurrentCalls.ts
17
17
  import { Result, resultify, unknownToError } from "t-result";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  EnhancedMap
3
- } from "./chunk-GKOTKAIV.js";
3
+ } from "./chunk-7CQPOM5I.js";
4
4
  import {
5
5
  durationObjToMs
6
6
  } from "./chunk-5MNYPLZI.js";
7
7
  import "./chunk-HTCYUMDR.js";
8
8
  import "./chunk-II4R3VVX.js";
9
- import "./chunk-WS4WEVHU.js";
10
- import "./chunk-SSKW673U.js";
9
+ import "./chunk-C2SVCIWE.js";
10
+ import "./chunk-JF2MDHOJ.js";
11
11
 
12
12
  // src/createThrottleController.ts
13
13
  function createThrottleController({
package/lib/debounce.js CHANGED
@@ -1,98 +1,7 @@
1
- // src/debounce.ts
2
- function debounce(func, wait, options) {
3
- let lastArgs;
4
- let lastThis;
5
- let maxWait;
6
- let result;
7
- let timerId;
8
- let lastCallTime;
9
- let lastInvokeTime = 0;
10
- let leading = false;
11
- let maxing = false;
12
- let trailing = true;
13
- if (options) {
14
- leading = !!options.leading;
15
- maxing = "maxWait" in options;
16
- maxWait = maxing ? Math.max(options.maxWait || 0, wait) : maxWait;
17
- trailing = "trailing" in options ? !!options.trailing : trailing;
18
- }
19
- function invokeFunc(time) {
20
- const args = lastArgs;
21
- const thisArg = lastThis;
22
- lastArgs = lastThis = void 0;
23
- lastInvokeTime = time;
24
- result = func.apply(thisArg, args);
25
- return result;
26
- }
27
- function leadingEdge(time) {
28
- lastInvokeTime = time;
29
- timerId = setTimeout(timerExpired, wait);
30
- return leading ? invokeFunc(time) : result;
31
- }
32
- function remainingWait(time) {
33
- const timeSinceLastCall = time - (lastCallTime ?? 0);
34
- const timeSinceLastInvoke = time - lastInvokeTime;
35
- const timeWaiting = wait - timeSinceLastCall;
36
- return maxing ? Math.min(timeWaiting, (maxWait ?? 0) - timeSinceLastInvoke) : timeWaiting;
37
- }
38
- function shouldInvoke(time) {
39
- const timeSinceLastCall = time - (lastCallTime ?? 0);
40
- const timeSinceLastInvoke = time - lastInvokeTime;
41
- return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= (maxWait ?? 0);
42
- }
43
- function timerExpired() {
44
- const time = Date.now();
45
- if (shouldInvoke(time)) {
46
- return trailingEdge(time);
47
- }
48
- timerId = setTimeout(timerExpired, remainingWait(time));
49
- }
50
- function trailingEdge(time) {
51
- timerId = void 0;
52
- if (trailing && lastArgs) {
53
- return invokeFunc(time);
54
- }
55
- lastArgs = lastThis = void 0;
56
- return result;
57
- }
58
- function cancel() {
59
- if (timerId !== void 0) {
60
- clearTimeout(timerId);
61
- }
62
- lastInvokeTime = 0;
63
- lastArgs = lastCallTime = lastThis = timerId = void 0;
64
- }
65
- function flush() {
66
- return timerId === void 0 ? result : trailingEdge(Date.now());
67
- }
68
- function debounced() {
69
- const time = Date.now();
70
- const isInvoking = shouldInvoke(time);
71
- lastArgs = arguments;
72
- lastThis = this;
73
- lastCallTime = time;
74
- if (isInvoking) {
75
- if (timerId === void 0) {
76
- return leadingEdge(lastCallTime);
77
- }
78
- if (maxing) {
79
- clearTimeout(timerId);
80
- timerId = setTimeout(timerExpired, wait);
81
- return invokeFunc(lastCallTime);
82
- }
83
- }
84
- if (timerId === void 0) {
85
- timerId = setTimeout(timerExpired, wait);
86
- }
87
- return result;
88
- }
89
- debounced.cancel = cancel;
90
- debounced.flush = flush;
91
- return debounced;
92
- }
93
- function isDebouncedFn(fn) {
94
- return typeof fn === "function" && "cancel" in fn && "flush" in fn;
95
- }
1
+ import {
2
+ debounce,
3
+ isDebouncedFn
4
+ } from "./chunk-NW5H5EW7.js";
96
5
  export {
97
6
  debounce,
98
7
  isDebouncedFn
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  EnhancedMap,
3
3
  enhancedMapReject
4
- } from "./chunk-GKOTKAIV.js";
5
- import "./chunk-WS4WEVHU.js";
6
- import "./chunk-SSKW673U.js";
4
+ } from "./chunk-7CQPOM5I.js";
5
+ import "./chunk-C2SVCIWE.js";
6
+ import "./chunk-JF2MDHOJ.js";
7
7
  export {
8
8
  EnhancedMap,
9
9
  enhancedMapReject
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/getAutoIncrementId.ts
21
+ var getAutoIncrementId_exports = {};
22
+ __export(getAutoIncrementId_exports, {
23
+ getAutoIncrementId: () => getAutoIncrementId,
24
+ getLocalAutoIncrementIdGenerator: () => getLocalAutoIncrementIdGenerator
25
+ });
26
+ module.exports = __toCommonJS(getAutoIncrementId_exports);
27
+ var id = 1;
28
+ function getAutoIncrementId() {
29
+ return id++;
30
+ }
31
+ function getLocalAutoIncrementIdGenerator({
32
+ prefix,
33
+ suffix
34
+ }) {
35
+ let localId = 1;
36
+ return () => {
37
+ return `${prefix || ""}${localId++}${suffix || ""}`;
38
+ };
39
+ }
40
+ // Annotate the CommonJS export names for ESM import in node:
41
+ 0 && (module.exports = {
42
+ getAutoIncrementId,
43
+ getLocalAutoIncrementIdGenerator
44
+ });
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Returns a unique auto-incrementing number each time it's called.
3
+ * This is useful for generating simple unique identifiers within a single session/process.
4
+ *
5
+ * **Note:** This is not suitable for distributed systems or persistent storage.
6
+ * For cryptographically secure or collision-resistant IDs, use `nanoid()` instead.
7
+ *
8
+ * @returns A unique incrementing number starting from 1
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * const id1 = getAutoIncrementId(); // 1
13
+ * const id2 = getAutoIncrementId(); // 2
14
+ * const id3 = getAutoIncrementId(); // 3
15
+ * ```
16
+ */
17
+ declare function getAutoIncrementId(): number;
18
+ /**
19
+ * Creates a local auto-increment ID generator with optional prefix and suffix.
20
+ * Each generator maintains its own independent counter starting from 1.
21
+ * This is useful when you need multiple independent ID sequences or formatted IDs.
22
+ *
23
+ * @param options - Configuration object
24
+ * @param options.prefix - Optional prefix to prepend to each generated ID
25
+ * @param options.suffix - Optional suffix to append to each generated ID
26
+ * @returns A function that generates formatted auto-increment IDs
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * const userIdGen = getLocalAutoIncrementIdGenerator({ prefix: 'user-' });
31
+ * const postIdGen = getLocalAutoIncrementIdGenerator({ prefix: 'post-', suffix: '-draft' });
32
+ *
33
+ * console.log(userIdGen()); // "user-1"
34
+ * console.log(userIdGen()); // "user-2"
35
+ * console.log(postIdGen()); // "post-1-draft"
36
+ * console.log(postIdGen()); // "post-2-draft"
37
+ * ```
38
+ */
39
+ declare function getLocalAutoIncrementIdGenerator({ prefix, suffix, }: {
40
+ prefix?: string;
41
+ suffix?: string;
42
+ }): () => string;
43
+
44
+ export { getAutoIncrementId, getLocalAutoIncrementIdGenerator };
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Returns a unique auto-incrementing number each time it's called.
3
+ * This is useful for generating simple unique identifiers within a single session/process.
4
+ *
5
+ * **Note:** This is not suitable for distributed systems or persistent storage.
6
+ * For cryptographically secure or collision-resistant IDs, use `nanoid()` instead.
7
+ *
8
+ * @returns A unique incrementing number starting from 1
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * const id1 = getAutoIncrementId(); // 1
13
+ * const id2 = getAutoIncrementId(); // 2
14
+ * const id3 = getAutoIncrementId(); // 3
15
+ * ```
16
+ */
17
+ declare function getAutoIncrementId(): number;
18
+ /**
19
+ * Creates a local auto-increment ID generator with optional prefix and suffix.
20
+ * Each generator maintains its own independent counter starting from 1.
21
+ * This is useful when you need multiple independent ID sequences or formatted IDs.
22
+ *
23
+ * @param options - Configuration object
24
+ * @param options.prefix - Optional prefix to prepend to each generated ID
25
+ * @param options.suffix - Optional suffix to append to each generated ID
26
+ * @returns A function that generates formatted auto-increment IDs
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * const userIdGen = getLocalAutoIncrementIdGenerator({ prefix: 'user-' });
31
+ * const postIdGen = getLocalAutoIncrementIdGenerator({ prefix: 'post-', suffix: '-draft' });
32
+ *
33
+ * console.log(userIdGen()); // "user-1"
34
+ * console.log(userIdGen()); // "user-2"
35
+ * console.log(postIdGen()); // "post-1-draft"
36
+ * console.log(postIdGen()); // "post-2-draft"
37
+ * ```
38
+ */
39
+ declare function getLocalAutoIncrementIdGenerator({ prefix, suffix, }: {
40
+ prefix?: string;
41
+ suffix?: string;
42
+ }): () => string;
43
+
44
+ export { getAutoIncrementId, getLocalAutoIncrementIdGenerator };
@@ -0,0 +1,18 @@
1
+ // src/getAutoIncrementId.ts
2
+ var id = 1;
3
+ function getAutoIncrementId() {
4
+ return id++;
5
+ }
6
+ function getLocalAutoIncrementIdGenerator({
7
+ prefix,
8
+ suffix
9
+ }) {
10
+ let localId = 1;
11
+ return () => {
12
+ return `${prefix || ""}${localId++}${suffix || ""}`;
13
+ };
14
+ }
15
+ export {
16
+ getAutoIncrementId,
17
+ getLocalAutoIncrementIdGenerator
18
+ };
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  getCompositeKey
3
- } from "./chunk-NH2LCAQS.js";
4
- import "./chunk-WS4WEVHU.js";
5
- import "./chunk-SSKW673U.js";
3
+ } from "./chunk-6FIBVC2P.js";
4
+ import "./chunk-C2SVCIWE.js";
5
+ import "./chunk-JF2MDHOJ.js";
6
6
  export {
7
7
  getCompositeKey
8
8
  };
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  getCompositeKey
3
- } from "./chunk-NH2LCAQS.js";
4
- import "./chunk-WS4WEVHU.js";
5
- import "./chunk-SSKW673U.js";
3
+ } from "./chunk-6FIBVC2P.js";
4
+ import "./chunk-C2SVCIWE.js";
5
+ import "./chunk-JF2MDHOJ.js";
6
6
 
7
7
  // src/getValueStableKey.ts
8
8
  var getValueStableKey = getCompositeKey;
@@ -5,8 +5,8 @@ import {
5
5
  } from "./chunk-HTCYUMDR.js";
6
6
  import {
7
7
  invariant
8
- } from "./chunk-WS4WEVHU.js";
9
- import "./chunk-SSKW673U.js";
8
+ } from "./chunk-C2SVCIWE.js";
9
+ import "./chunk-JF2MDHOJ.js";
10
10
 
11
11
  // src/interpolate.ts
12
12
  function mod(n, m) {
@@ -4,8 +4,8 @@ import {
4
4
  import {
5
5
  invariant,
6
6
  isObject
7
- } from "./chunk-WS4WEVHU.js";
8
- import "./chunk-SSKW673U.js";
7
+ } from "./chunk-C2SVCIWE.js";
8
+ import "./chunk-JF2MDHOJ.js";
9
9
 
10
10
  // src/parallelAsyncCalls.ts
11
11
  import { Result, unknownToError } from "t-result";
@@ -12,12 +12,62 @@ type RunCmdOptions = {
12
12
  throwOnError?: boolean;
13
13
  noCiColorForce?: boolean;
14
14
  };
15
+ /**
16
+ * @deprecated This utility has been moved to @ls-stack/node-utils. Please update your imports:
17
+ * ```
18
+ * // Old (deprecated)
19
+ * import { runCmd } from '@ls-stack/utils/runShellCmd';
20
+ *
21
+ * // New (preferred)
22
+ * import { runCmd } from '@ls-stack/node-utils/runShellCmd';
23
+ * ```
24
+ */
15
25
  declare function runCmd(label: string | null, command: string | string[], { mock, silent, throwOnError, cwd, noCiColorForce, }?: RunCmdOptions): Promise<CmdResult>;
26
+ /**
27
+ * @deprecated This utility has been moved to @ls-stack/node-utils. Please update your imports:
28
+ * ```
29
+ * // Old (deprecated)
30
+ * import { concurrentCmd } from '@ls-stack/utils/runShellCmd';
31
+ *
32
+ * // New (preferred)
33
+ * import { concurrentCmd } from '@ls-stack/node-utils/runShellCmd';
34
+ * ```
35
+ */
16
36
  declare function concurrentCmd(label: string, cmd: string | string[], onResult: (result: CmdResult) => void): Promise<() => void>;
37
+ /**
38
+ * @deprecated This utility has been moved to @ls-stack/node-utils. Please update your imports:
39
+ * ```
40
+ * // Old (deprecated)
41
+ * import { runCmdUnwrap } from '@ls-stack/utils/runShellCmd';
42
+ *
43
+ * // New (preferred)
44
+ * import { runCmdUnwrap } from '@ls-stack/node-utils/runShellCmd';
45
+ * ```
46
+ */
17
47
  declare function runCmdUnwrap(label: string | null, command: string | string[], { silent, }?: {
18
48
  silent?: boolean | 'timeOnly';
19
49
  }): Promise<string>;
50
+ /**
51
+ * @deprecated This utility has been moved to @ls-stack/node-utils. Please update your imports:
52
+ * ```
53
+ * // Old (deprecated)
54
+ * import { runCmdSilent } from '@ls-stack/utils/runShellCmd';
55
+ *
56
+ * // New (preferred)
57
+ * import { runCmdSilent } from '@ls-stack/node-utils/runShellCmd';
58
+ * ```
59
+ */
20
60
  declare function runCmdSilent(command: string | string[]): Promise<CmdResult>;
61
+ /**
62
+ * @deprecated This utility has been moved to @ls-stack/node-utils. Please update your imports:
63
+ * ```
64
+ * // Old (deprecated)
65
+ * import { runCmdSilentUnwrap } from '@ls-stack/utils/runShellCmd';
66
+ *
67
+ * // New (preferred)
68
+ * import { runCmdSilentUnwrap } from '@ls-stack/node-utils/runShellCmd';
69
+ * ```
70
+ */
21
71
  declare function runCmdSilentUnwrap(command: string | string[]): Promise<string>;
22
72
 
23
73
  export { concurrentCmd, runCmd, runCmdSilent, runCmdSilentUnwrap, runCmdUnwrap };
@@ -12,12 +12,62 @@ type RunCmdOptions = {
12
12
  throwOnError?: boolean;
13
13
  noCiColorForce?: boolean;
14
14
  };
15
+ /**
16
+ * @deprecated This utility has been moved to @ls-stack/node-utils. Please update your imports:
17
+ * ```
18
+ * // Old (deprecated)
19
+ * import { runCmd } from '@ls-stack/utils/runShellCmd';
20
+ *
21
+ * // New (preferred)
22
+ * import { runCmd } from '@ls-stack/node-utils/runShellCmd';
23
+ * ```
24
+ */
15
25
  declare function runCmd(label: string | null, command: string | string[], { mock, silent, throwOnError, cwd, noCiColorForce, }?: RunCmdOptions): Promise<CmdResult>;
26
+ /**
27
+ * @deprecated This utility has been moved to @ls-stack/node-utils. Please update your imports:
28
+ * ```
29
+ * // Old (deprecated)
30
+ * import { concurrentCmd } from '@ls-stack/utils/runShellCmd';
31
+ *
32
+ * // New (preferred)
33
+ * import { concurrentCmd } from '@ls-stack/node-utils/runShellCmd';
34
+ * ```
35
+ */
16
36
  declare function concurrentCmd(label: string, cmd: string | string[], onResult: (result: CmdResult) => void): Promise<() => void>;
37
+ /**
38
+ * @deprecated This utility has been moved to @ls-stack/node-utils. Please update your imports:
39
+ * ```
40
+ * // Old (deprecated)
41
+ * import { runCmdUnwrap } from '@ls-stack/utils/runShellCmd';
42
+ *
43
+ * // New (preferred)
44
+ * import { runCmdUnwrap } from '@ls-stack/node-utils/runShellCmd';
45
+ * ```
46
+ */
17
47
  declare function runCmdUnwrap(label: string | null, command: string | string[], { silent, }?: {
18
48
  silent?: boolean | 'timeOnly';
19
49
  }): Promise<string>;
50
+ /**
51
+ * @deprecated This utility has been moved to @ls-stack/node-utils. Please update your imports:
52
+ * ```
53
+ * // Old (deprecated)
54
+ * import { runCmdSilent } from '@ls-stack/utils/runShellCmd';
55
+ *
56
+ * // New (preferred)
57
+ * import { runCmdSilent } from '@ls-stack/node-utils/runShellCmd';
58
+ * ```
59
+ */
20
60
  declare function runCmdSilent(command: string | string[]): Promise<CmdResult>;
61
+ /**
62
+ * @deprecated This utility has been moved to @ls-stack/node-utils. Please update your imports:
63
+ * ```
64
+ * // Old (deprecated)
65
+ * import { runCmdSilentUnwrap } from '@ls-stack/utils/runShellCmd';
66
+ *
67
+ * // New (preferred)
68
+ * import { runCmdSilentUnwrap } from '@ls-stack/node-utils/runShellCmd';
69
+ * ```
70
+ */
21
71
  declare function runCmdSilentUnwrap(command: string | string[]): Promise<string>;
22
72
 
23
73
  export { concurrentCmd, runCmd, runCmdSilent, runCmdSilentUnwrap, runCmdUnwrap };
@@ -24,6 +24,11 @@ __export(serializeXML_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(serializeXML_exports);
26
26
 
27
+ // src/typeGuards.ts
28
+ function isTruthy(value) {
29
+ return !!value;
30
+ }
31
+
27
32
  // src/arrayUtils.ts
28
33
  function filterAndMap(array, mapFilter) {
29
34
  const result = [];
@@ -52,12 +57,12 @@ var XML_ESCAPE_REGEX = /[&<>"']/g;
52
57
  function serializeXML(node, options) {
53
58
  if (Array.isArray(node)) {
54
59
  const EMPTY_LINE_MARKER = "\0EMPTY_LINE\0";
55
- return node.map((n) => {
60
+ return node.filter(isTruthy).map((n) => {
56
61
  if (n.type === "emptyLine") {
57
62
  return EMPTY_LINE_MARKER;
58
63
  }
59
64
  return serializeWithLevel(n, options, 0);
60
- }).filter(Boolean).join(options?.indent ? "\n" : "").replace(new RegExp(EMPTY_LINE_MARKER, "g"), "");
65
+ }).filter(isTruthy).join(options?.indent ? "\n" : "").replace(new RegExp(EMPTY_LINE_MARKER, "g"), "");
61
66
  }
62
67
  return serializeWithLevel(node, options, 0);
63
68
  }
@@ -17,6 +17,6 @@ type SerializeOptions = {
17
17
  validateTagName?: boolean;
18
18
  invalidNodes?: 'throw' | 'reject';
19
19
  };
20
- declare function serializeXML(node: XMLNode | XMLNode[], options?: SerializeOptions): string;
20
+ declare function serializeXML(node: XMLNode | (XMLNode | null | undefined | false)[], options?: SerializeOptions): string;
21
21
 
22
22
  export { type SerializeOptions, type XMLNode, serializeXML };
@@ -17,6 +17,6 @@ type SerializeOptions = {
17
17
  validateTagName?: boolean;
18
18
  invalidNodes?: 'throw' | 'reject';
19
19
  };
20
- declare function serializeXML(node: XMLNode | XMLNode[], options?: SerializeOptions): string;
20
+ declare function serializeXML(node: XMLNode | (XMLNode | null | undefined | false)[], options?: SerializeOptions): string;
21
21
 
22
22
  export { type SerializeOptions, type XMLNode, serializeXML };
@@ -1,8 +1,10 @@
1
1
  import {
2
2
  filterAndMap
3
- } from "./chunk-DMW5Q4T2.js";
4
- import "./chunk-WS4WEVHU.js";
5
- import "./chunk-SSKW673U.js";
3
+ } from "./chunk-SRVMMYSW.js";
4
+ import "./chunk-C2SVCIWE.js";
5
+ import {
6
+ isTruthy
7
+ } from "./chunk-JF2MDHOJ.js";
6
8
 
7
9
  // src/serializeXML.ts
8
10
  var XML_TAG_NAME_REGEX = /^[a-zA-Z_][a-zA-Z0-9._-]*$/;
@@ -18,12 +20,12 @@ var XML_ESCAPE_REGEX = /[&<>"']/g;
18
20
  function serializeXML(node, options) {
19
21
  if (Array.isArray(node)) {
20
22
  const EMPTY_LINE_MARKER = "\0EMPTY_LINE\0";
21
- return node.map((n) => {
23
+ return node.filter(isTruthy).map((n) => {
22
24
  if (n.type === "emptyLine") {
23
25
  return EMPTY_LINE_MARKER;
24
26
  }
25
27
  return serializeWithLevel(n, options, 0);
26
- }).filter(Boolean).join(options?.indent ? "\n" : "").replace(new RegExp(EMPTY_LINE_MARKER, "g"), "");
28
+ }).filter(isTruthy).join(options?.indent ? "\n" : "").replace(new RegExp(EMPTY_LINE_MARKER, "g"), "");
27
29
  }
28
30
  return serializeWithLevel(node, options, 0);
29
31
  }