@gtkx/utils 1.0.0-rc.3 → 1.0.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 (256) hide show
  1. package/README.md +8 -9
  2. package/dist/array/index-before-or-end.d.ts +0 -12
  3. package/dist/array/index-before-or-end.d.ts.map +1 -1
  4. package/dist/array/index-before-or-end.js +0 -12
  5. package/dist/array/index-before-or-end.js.map +1 -1
  6. package/dist/array/index.d.ts +5 -5
  7. package/dist/array/index.js.map +1 -1
  8. package/dist/array/remove.d.ts +0 -11
  9. package/dist/array/remove.d.ts.map +1 -1
  10. package/dist/array/remove.js +0 -11
  11. package/dist/array/remove.js.map +1 -1
  12. package/dist/array/sort-strings-by.d.ts +0 -12
  13. package/dist/array/sort-strings-by.d.ts.map +1 -1
  14. package/dist/array/sort-strings-by.js +0 -12
  15. package/dist/array/sort-strings-by.js.map +1 -1
  16. package/dist/array/sort-strings.d.ts +0 -9
  17. package/dist/array/sort-strings.d.ts.map +1 -1
  18. package/dist/array/sort-strings.js +0 -9
  19. package/dist/array/sort-strings.js.map +1 -1
  20. package/dist/array/uniq-by.d.ts +0 -15
  21. package/dist/array/uniq-by.d.ts.map +1 -1
  22. package/dist/array/uniq-by.js +0 -15
  23. package/dist/array/uniq-by.js.map +1 -1
  24. package/dist/class/any-class.d.ts +2 -3
  25. package/dist/class/any-class.d.ts.map +1 -1
  26. package/dist/class/any-class.js.map +1 -1
  27. package/dist/class/get-parent-class.d.ts +1 -7
  28. package/dist/class/get-parent-class.d.ts.map +1 -1
  29. package/dist/class/get-parent-class.js +0 -6
  30. package/dist/class/get-parent-class.js.map +1 -1
  31. package/dist/class/index.d.ts +3 -3
  32. package/dist/class/index.js.map +1 -1
  33. package/dist/class/walk-class-chain.d.ts +1 -10
  34. package/dist/class/walk-class-chain.d.ts.map +1 -1
  35. package/dist/class/walk-class-chain.js +0 -9
  36. package/dist/class/walk-class-chain.js.map +1 -1
  37. package/dist/error/error-like.js.map +1 -1
  38. package/dist/error/error-message.d.ts +0 -10
  39. package/dist/error/error-message.d.ts.map +1 -1
  40. package/dist/error/error-message.js +0 -10
  41. package/dist/error/error-message.js.map +1 -1
  42. package/dist/error/format-child-process-error.d.ts +0 -9
  43. package/dist/error/format-child-process-error.d.ts.map +1 -1
  44. package/dist/error/format-child-process-error.js +0 -9
  45. package/dist/error/format-child-process-error.js.map +1 -1
  46. package/dist/error/index.d.ts +3 -3
  47. package/dist/error/index.js.map +1 -1
  48. package/dist/error/normalize-error.d.ts +0 -10
  49. package/dist/error/normalize-error.d.ts.map +1 -1
  50. package/dist/error/normalize-error.js +0 -10
  51. package/dist/error/normalize-error.js.map +1 -1
  52. package/dist/index.d.ts +12 -13
  53. package/dist/index.d.ts.map +1 -1
  54. package/dist/index.js +0 -1
  55. package/dist/index.js.map +1 -1
  56. package/dist/log/create-logger.d.ts +1 -12
  57. package/dist/log/create-logger.d.ts.map +1 -1
  58. package/dist/log/create-logger.js +0 -11
  59. package/dist/log/create-logger.js.map +1 -1
  60. package/dist/log/default-logger.d.ts +4 -30
  61. package/dist/log/default-logger.d.ts.map +1 -1
  62. package/dist/log/default-logger.js +3 -29
  63. package/dist/log/default-logger.js.map +1 -1
  64. package/dist/log/index.d.ts +5 -3
  65. package/dist/log/index.d.ts.map +1 -1
  66. package/dist/log/index.js +3 -1
  67. package/dist/log/index.js.map +1 -1
  68. package/dist/log/logger.d.ts +2 -43
  69. package/dist/log/logger.d.ts.map +1 -1
  70. package/dist/log/logger.js +3 -34
  71. package/dist/log/logger.js.map +1 -1
  72. package/dist/map/get-or-insert.d.ts +1 -16
  73. package/dist/map/get-or-insert.d.ts.map +1 -1
  74. package/dist/map/get-or-insert.js +0 -15
  75. package/dist/map/get-or-insert.js.map +1 -1
  76. package/dist/map/index.d.ts +1 -1
  77. package/dist/map/index.js.map +1 -1
  78. package/dist/object/index.d.ts +3 -3
  79. package/dist/object/index.js.map +1 -1
  80. package/dist/object/omit.d.ts +0 -12
  81. package/dist/object/omit.d.ts.map +1 -1
  82. package/dist/object/omit.js +0 -12
  83. package/dist/object/omit.js.map +1 -1
  84. package/dist/object/pick-by.d.ts +0 -12
  85. package/dist/object/pick-by.d.ts.map +1 -1
  86. package/dist/object/pick-by.js +0 -12
  87. package/dist/object/pick-by.js.map +1 -1
  88. package/dist/object/structured-clone.d.ts +0 -16
  89. package/dist/object/structured-clone.d.ts.map +1 -1
  90. package/dist/object/structured-clone.js +0 -16
  91. package/dist/object/structured-clone.js.map +1 -1
  92. package/dist/predicate/index.d.ts +6 -6
  93. package/dist/predicate/index.js.map +1 -1
  94. package/dist/predicate/is-deep-equal.d.ts.map +1 -1
  95. package/dist/predicate/is-deep-equal.js +0 -13
  96. package/dist/predicate/is-deep-equal.js.map +1 -1
  97. package/dist/predicate/is-plain-object.d.ts +0 -14
  98. package/dist/predicate/is-plain-object.d.ts.map +1 -1
  99. package/dist/predicate/is-plain-object.js +0 -14
  100. package/dist/predicate/is-plain-object.js.map +1 -1
  101. package/dist/predicate/is-record.d.ts +0 -11
  102. package/dist/predicate/is-record.d.ts.map +1 -1
  103. package/dist/predicate/is-record.js +0 -11
  104. package/dist/predicate/is-record.js.map +1 -1
  105. package/dist/predicate/is-same-array-by.d.ts +0 -12
  106. package/dist/predicate/is-same-array-by.d.ts.map +1 -1
  107. package/dist/predicate/is-same-array-by.js +0 -12
  108. package/dist/predicate/is-same-array-by.js.map +1 -1
  109. package/dist/predicate/is-same-array.d.ts +0 -12
  110. package/dist/predicate/is-same-array.d.ts.map +1 -1
  111. package/dist/predicate/is-same-array.js +0 -12
  112. package/dist/predicate/is-same-array.js.map +1 -1
  113. package/dist/predicate/is-shallow-equal.d.ts.map +1 -1
  114. package/dist/predicate/is-shallow-equal.js +0 -14
  115. package/dist/predicate/is-shallow-equal.js.map +1 -1
  116. package/dist/process/exit-code-for-signal.d.ts +0 -11
  117. package/dist/process/exit-code-for-signal.d.ts.map +1 -1
  118. package/dist/process/exit-code-for-signal.js +0 -11
  119. package/dist/process/exit-code-for-signal.js.map +1 -1
  120. package/dist/process/index.d.ts +4 -3
  121. package/dist/process/index.d.ts.map +1 -1
  122. package/dist/process/index.js +2 -1
  123. package/dist/process/index.js.map +1 -1
  124. package/dist/process/install-graceful-shutdown.d.ts +1 -7
  125. package/dist/process/install-graceful-shutdown.d.ts.map +1 -1
  126. package/dist/process/install-graceful-shutdown.js +7 -13
  127. package/dist/process/install-graceful-shutdown.js.map +1 -1
  128. package/dist/process/kill-marked-processes.d.ts +4 -0
  129. package/dist/process/kill-marked-processes.d.ts.map +1 -0
  130. package/dist/process/kill-marked-processes.js +38 -0
  131. package/dist/process/kill-marked-processes.js.map +1 -0
  132. package/dist/process/process-guard.d.ts +2 -0
  133. package/dist/process/process-guard.d.ts.map +1 -0
  134. package/dist/process/process-guard.js +16 -0
  135. package/dist/process/process-guard.js.map +1 -0
  136. package/dist/process/resolve-executable.d.ts +2 -12
  137. package/dist/process/resolve-executable.d.ts.map +1 -1
  138. package/dist/process/resolve-executable.js +6 -14
  139. package/dist/process/resolve-executable.js.map +1 -1
  140. package/dist/process/spawn-with-parent-death-signal.d.ts +8 -0
  141. package/dist/process/spawn-with-parent-death-signal.d.ts.map +1 -0
  142. package/dist/process/spawn-with-parent-death-signal.js +50 -0
  143. package/dist/process/spawn-with-parent-death-signal.js.map +1 -0
  144. package/dist/set/drain.d.ts +0 -8
  145. package/dist/set/drain.d.ts.map +1 -1
  146. package/dist/set/drain.js +0 -8
  147. package/dist/set/drain.js.map +1 -1
  148. package/dist/set/index.d.ts +1 -1
  149. package/dist/set/index.js.map +1 -1
  150. package/dist/source/index.d.ts +3 -3
  151. package/dist/source/index.js.map +1 -1
  152. package/dist/source/sanitize-identifier.d.ts +0 -11
  153. package/dist/source/sanitize-identifier.d.ts.map +1 -1
  154. package/dist/source/sanitize-identifier.js +0 -11
  155. package/dist/source/sanitize-identifier.js.map +1 -1
  156. package/dist/source/source-string-literal.d.ts +0 -10
  157. package/dist/source/source-string-literal.d.ts.map +1 -1
  158. package/dist/source/source-string-literal.js +0 -10
  159. package/dist/source/source-string-literal.js.map +1 -1
  160. package/dist/source/to-camel-identifier.d.ts +0 -10
  161. package/dist/source/to-camel-identifier.d.ts.map +1 -1
  162. package/dist/source/to-camel-identifier.js +0 -10
  163. package/dist/source/to-camel-identifier.js.map +1 -1
  164. package/dist/string/camel-case.d.ts +0 -14
  165. package/dist/string/camel-case.d.ts.map +1 -1
  166. package/dist/string/camel-case.js +0 -14
  167. package/dist/string/camel-case.js.map +1 -1
  168. package/dist/string/index.d.ts +5 -5
  169. package/dist/string/index.js.map +1 -1
  170. package/dist/string/kebab-case.d.ts +0 -11
  171. package/dist/string/kebab-case.d.ts.map +1 -1
  172. package/dist/string/kebab-case.js +0 -11
  173. package/dist/string/kebab-case.js.map +1 -1
  174. package/dist/string/lower-first.d.ts +0 -10
  175. package/dist/string/lower-first.d.ts.map +1 -1
  176. package/dist/string/lower-first.js +0 -10
  177. package/dist/string/lower-first.js.map +1 -1
  178. package/dist/string/pascal-case.d.ts +0 -13
  179. package/dist/string/pascal-case.d.ts.map +1 -1
  180. package/dist/string/pascal-case.js +0 -13
  181. package/dist/string/pascal-case.js.map +1 -1
  182. package/dist/string/upper-first.d.ts +0 -10
  183. package/dist/string/upper-first.d.ts.map +1 -1
  184. package/dist/string/upper-first.js +0 -10
  185. package/dist/string/upper-first.js.map +1 -1
  186. package/dist/util/index.d.ts +1 -1
  187. package/dist/util/index.js.map +1 -1
  188. package/dist/util/package-version.d.ts +1 -10
  189. package/dist/util/package-version.d.ts.map +1 -1
  190. package/dist/util/package-version.js +2 -11
  191. package/dist/util/package-version.js.map +1 -1
  192. package/package.json +1 -1
  193. package/src/array/index-before-or-end.ts +0 -12
  194. package/src/array/index.ts +5 -5
  195. package/src/array/remove.ts +0 -11
  196. package/src/array/sort-strings-by.ts +0 -12
  197. package/src/array/sort-strings.ts +0 -9
  198. package/src/array/uniq-by.ts +0 -15
  199. package/src/class/any-class.ts +2 -3
  200. package/src/class/get-parent-class.ts +1 -7
  201. package/src/class/index.ts +3 -3
  202. package/src/class/walk-class-chain.ts +2 -11
  203. package/src/error/error-like.ts +1 -1
  204. package/src/error/error-message.ts +1 -11
  205. package/src/error/format-child-process-error.ts +2 -11
  206. package/src/error/index.ts +3 -3
  207. package/src/error/normalize-error.ts +2 -12
  208. package/src/index.ts +12 -13
  209. package/src/log/create-logger.ts +1 -12
  210. package/src/log/default-logger.ts +4 -30
  211. package/src/log/index.ts +5 -3
  212. package/src/log/logger.ts +4 -45
  213. package/src/map/get-or-insert.ts +1 -16
  214. package/src/map/index.ts +1 -1
  215. package/src/object/index.ts +3 -3
  216. package/src/object/omit.ts +0 -12
  217. package/src/object/pick-by.ts +0 -12
  218. package/src/object/structured-clone.ts +1 -17
  219. package/src/predicate/index.ts +6 -6
  220. package/src/predicate/is-deep-equal.ts +2 -15
  221. package/src/predicate/is-plain-object.ts +0 -14
  222. package/src/predicate/is-record.ts +0 -11
  223. package/src/predicate/is-same-array-by.ts +0 -12
  224. package/src/predicate/is-same-array.ts +1 -13
  225. package/src/predicate/is-shallow-equal.ts +2 -16
  226. package/src/process/exit-code-for-signal.ts +0 -11
  227. package/src/process/index.ts +4 -3
  228. package/src/process/install-graceful-shutdown.ts +12 -18
  229. package/src/process/kill-marked-processes.ts +44 -0
  230. package/src/process/process-guard.ts +20 -0
  231. package/src/process/resolve-executable.ts +7 -14
  232. package/src/process/spawn-with-parent-death-signal.ts +74 -0
  233. package/src/set/drain.ts +0 -8
  234. package/src/set/index.ts +1 -1
  235. package/src/source/index.ts +3 -3
  236. package/src/source/sanitize-identifier.ts +0 -11
  237. package/src/source/source-string-literal.ts +0 -10
  238. package/src/source/to-camel-identifier.ts +2 -12
  239. package/src/string/camel-case.ts +2 -16
  240. package/src/string/index.ts +5 -5
  241. package/src/string/kebab-case.ts +0 -11
  242. package/src/string/lower-first.ts +0 -10
  243. package/src/string/pascal-case.ts +2 -15
  244. package/src/string/upper-first.ts +0 -10
  245. package/src/util/index.ts +1 -1
  246. package/src/util/package-version.ts +2 -11
  247. package/dist/function/call-method.d.ts +0 -3
  248. package/dist/function/call-method.d.ts.map +0 -1
  249. package/dist/function/call-method.js +0 -19
  250. package/dist/function/call-method.js.map +0 -1
  251. package/dist/function/index.d.ts +0 -2
  252. package/dist/function/index.d.ts.map +0 -1
  253. package/dist/function/index.js +0 -2
  254. package/dist/function/index.js.map +0 -1
  255. package/src/function/call-method.ts +0 -22
  256. package/src/function/index.ts +0 -1
@@ -1,14 +1,4 @@
1
- /**
2
- * Resolves an executable to an absolute path, searching `PATH` only for a bare command name, so
3
- * spawning it never re-runs a lookup against a `PATH` that may have changed.
4
- *
5
- * @param command - An executable name, or a path to one.
6
- * @returns The absolute path of the executable.
7
- * @throws When a bare command name is not found on `PATH`.
8
- *
9
- * @example
10
- * resolveExecutable("weston"); // "/usr/bin/weston"
11
- */
1
+ declare function tryResolveExecutable(command: string): string | undefined;
12
2
  declare function resolveExecutable(command: string): string;
13
- export { resolveExecutable };
3
+ export { resolveExecutable, tryResolveExecutable };
14
4
  //# sourceMappingURL=resolve-executable.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolve-executable.d.ts","sourceRoot":"","sources":["../../src/process/resolve-executable.ts"],"names":[],"mappings":"AA2BA;;;;;;;;;;GAUG;AACH,iBAAS,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAgBlD;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
1
+ {"version":3,"file":"resolve-executable.d.ts","sourceRoot":"","sources":["../../src/process/resolve-executable.ts"],"names":[],"mappings":"AA2BA,iBAAS,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAUjE;AAED,iBAAS,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAQlD;AAED,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,CAAC"}
@@ -19,29 +19,21 @@ const findOnPath = (command) => {
19
19
  }
20
20
  return undefined;
21
21
  };
22
- /**
23
- * Resolves an executable to an absolute path, searching `PATH` only for a bare command name, so
24
- * spawning it never re-runs a lookup against a `PATH` that may have changed.
25
- *
26
- * @param command - An executable name, or a path to one.
27
- * @returns The absolute path of the executable.
28
- * @throws When a bare command name is not found on `PATH`.
29
- *
30
- * @example
31
- * resolveExecutable("weston"); // "/usr/bin/weston"
32
- */
33
- function resolveExecutable(command) {
22
+ function tryResolveExecutable(command) {
34
23
  if (isAbsolute(command)) {
35
24
  return command;
36
25
  }
37
26
  if (command.includes("/")) {
38
27
  return resolve(command);
39
28
  }
40
- const found = findOnPath(command);
29
+ return findOnPath(command);
30
+ }
31
+ function resolveExecutable(command) {
32
+ const found = tryResolveExecutable(command);
41
33
  if (found === undefined) {
42
34
  throw new Error(`Cannot find the "${command}" executable on PATH`);
43
35
  }
44
36
  return found;
45
37
  }
46
- export { resolveExecutable };
38
+ export { resolveExecutable, tryResolveExecutable };
47
39
  //# sourceMappingURL=resolve-executable.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolve-executable.js","sourceRoot":"","sources":["../../src/process/resolve-executable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEjE,MAAM,YAAY,GAAG,CAAC,IAAY,EAAW,EAAE;IAC3C,IAAI,CAAC;QACD,UAAU,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;QAEjC,OAAO,IAAI,CAAC;IAChB,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,KAAK,CAAC;IACjB,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,UAAU,GAAG,CAAC,OAAe,EAAsB,EAAE;IACvD,MAAM,WAAW,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAElG,KAAK,MAAM,SAAS,IAAI,WAAW,EAAE,CAAC;QAClC,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAE3C,IAAI,YAAY,CAAC,SAAS,CAAC,EAAE,CAAC;YAC1B,OAAO,SAAS,CAAC;QACrB,CAAC;IACL,CAAC;IAED,OAAO,SAAS,CAAC;AACrB,CAAC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,SAAS,iBAAiB,CAAC,OAAe;IACtC,IAAI,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACtB,OAAO,OAAO,CAAC;IACnB,CAAC;IAED,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACxB,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;IAED,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IAElC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,oBAAoB,OAAO,sBAAsB,CAAC,CAAC;IACvE,CAAC;IAED,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC","sourcesContent":["import { accessSync, constants } from \"node:fs\";\nimport { delimiter, isAbsolute, join, resolve } from \"node:path\";\n\nconst isExecutable = (path: string): boolean => {\n try {\n accessSync(path, constants.X_OK);\n\n return true;\n } catch {\n return false;\n }\n};\n\nconst findOnPath = (command: string): string | undefined => {\n const searchPaths = (process.env.PATH ?? \"\").split(delimiter).filter((entry) => entry.length > 0);\n\n for (const directory of searchPaths) {\n const candidate = join(directory, command);\n\n if (isExecutable(candidate)) {\n return candidate;\n }\n }\n\n return undefined;\n};\n\n/**\n * Resolves an executable to an absolute path, searching `PATH` only for a bare command name, so\n * spawning it never re-runs a lookup against a `PATH` that may have changed.\n *\n * @param command - An executable name, or a path to one.\n * @returns The absolute path of the executable.\n * @throws When a bare command name is not found on `PATH`.\n *\n * @example\n * resolveExecutable(\"weston\"); // \"/usr/bin/weston\"\n */\nfunction resolveExecutable(command: string): string {\n if (isAbsolute(command)) {\n return command;\n }\n\n if (command.includes(\"/\")) {\n return resolve(command);\n }\n\n const found = findOnPath(command);\n\n if (found === undefined) {\n throw new Error(`Cannot find the \"${command}\" executable on PATH`);\n }\n\n return found;\n}\n\nexport { resolveExecutable };\n"]}
1
+ {"version":3,"file":"resolve-executable.js","sourceRoot":"","sources":["../../src/process/resolve-executable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEjE,MAAM,YAAY,GAAG,CAAC,IAAY,EAAW,EAAE;IAC3C,IAAI,CAAC;QACD,UAAU,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;QAEjC,OAAO,IAAI,CAAC;IAChB,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,KAAK,CAAC;IACjB,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,UAAU,GAAG,CAAC,OAAe,EAAsB,EAAE;IACvD,MAAM,WAAW,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAElG,KAAK,MAAM,SAAS,IAAI,WAAW,EAAE,CAAC;QAClC,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAE3C,IAAI,YAAY,CAAC,SAAS,CAAC,EAAE,CAAC;YAC1B,OAAO,SAAS,CAAC;QACrB,CAAC;IACL,CAAC;IAED,OAAO,SAAS,CAAC;AACrB,CAAC,CAAC;AAEF,SAAS,oBAAoB,CAAC,OAAe;IACzC,IAAI,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACtB,OAAO,OAAO,CAAC;IACnB,CAAC;IAED,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACxB,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;IAED,OAAO,UAAU,CAAC,OAAO,CAAC,CAAC;AAC/B,CAAC;AAED,SAAS,iBAAiB,CAAC,OAAe;IACtC,MAAM,KAAK,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAE5C,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,oBAAoB,OAAO,sBAAsB,CAAC,CAAC;IACvE,CAAC;IAED,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,CAAC","sourcesContent":["import { accessSync, constants } from \"node:fs\";\nimport { delimiter, isAbsolute, join, resolve } from \"node:path\";\n\nconst isExecutable = (path: string): boolean => {\n try {\n accessSync(path, constants.X_OK);\n\n return true;\n } catch {\n return false;\n }\n};\n\nconst findOnPath = (command: string): string | undefined => {\n const searchPaths = (process.env.PATH ?? \"\").split(delimiter).filter((entry) => entry.length > 0);\n\n for (const directory of searchPaths) {\n const candidate = join(directory, command);\n\n if (isExecutable(candidate)) {\n return candidate;\n }\n }\n\n return undefined;\n};\n\nfunction tryResolveExecutable(command: string): string | undefined {\n if (isAbsolute(command)) {\n return command;\n }\n\n if (command.includes(\"/\")) {\n return resolve(command);\n }\n\n return findOnPath(command);\n}\n\nfunction resolveExecutable(command: string): string {\n const found = tryResolveExecutable(command);\n\n if (found === undefined) {\n throw new Error(`Cannot find the \"${command}\" executable on PATH`);\n }\n\n return found;\n}\n\nexport { resolveExecutable, tryResolveExecutable };\n"]}
@@ -0,0 +1,8 @@
1
+ import { type ChildProcess, type StdioOptions } from "node:child_process";
2
+ type ParentDeathSpawnOptions = {
3
+ stdio?: StdioOptions;
4
+ env?: NodeJS.ProcessEnv;
5
+ };
6
+ declare function spawnWithParentDeathSignal(command: string, args: string[], options?: ParentDeathSpawnOptions): ChildProcess;
7
+ export { spawnWithParentDeathSignal };
8
+ //# sourceMappingURL=spawn-with-parent-death-signal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spawn-with-parent-death-signal.d.ts","sourceRoot":"","sources":["../../src/process/spawn-with-parent-death-signal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAS,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAQjF,KAAK,uBAAuB,GAAG;IAC3B,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CAC3B,CAAC;AAuCF,iBAAS,0BAA0B,CAC/B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,GAAE,uBAA4B,GACtC,YAAY,CAiBd;AAED,OAAO,EAAE,0BAA0B,EAAE,CAAC"}
@@ -0,0 +1,50 @@
1
+ import { spawn } from "node:child_process";
2
+ import { randomBytes } from "node:crypto";
3
+ import { Socket } from "node:net";
4
+ import { dirname, extname, join } from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+ import { killMarkedProcesses, PROCESS_MARKER } from "./kill-marked-processes.js";
7
+ import { resolveExecutable } from "./resolve-executable.js";
8
+ const MODULE_PATH = fileURLToPath(import.meta.url);
9
+ const GUARD_PATH = join(dirname(MODULE_PATH), `process-guard${extname(MODULE_PATH)}`);
10
+ const RUN_ID = randomBytes(8).toString("hex");
11
+ const RUN_PREFIX = `${PROCESS_MARKER}=${RUN_ID}/`;
12
+ const guard = {};
13
+ const releaseGuard = (child) => {
14
+ child.unref();
15
+ const { stdin } = child;
16
+ if (stdin instanceof Socket) {
17
+ stdin.unref();
18
+ }
19
+ };
20
+ const startGuard = () => {
21
+ if (guard.child) {
22
+ return;
23
+ }
24
+ const child = spawn(process.execPath, [GUARD_PATH, RUN_PREFIX], {
25
+ detached: true,
26
+ stdio: ["pipe", "ignore", "ignore"],
27
+ });
28
+ child.on("error", () => {
29
+ guard.child = undefined;
30
+ });
31
+ guard.child = child;
32
+ releaseGuard(child);
33
+ };
34
+ function spawnWithParentDeathSignal(command, args, options = {}) {
35
+ const executable = resolveExecutable(command);
36
+ const setpriv = resolveExecutable("setpriv");
37
+ const jobValue = `${RUN_ID}/${randomBytes(4).toString("hex")}`;
38
+ startGuard();
39
+ const child = spawn(setpriv, ["--pdeathsig", "SIGKILL", executable, ...args], {
40
+ detached: true,
41
+ stdio: options.stdio ?? "ignore",
42
+ env: { ...(options.env ?? process.env), [PROCESS_MARKER]: jobValue },
43
+ });
44
+ child.on("exit", () => {
45
+ killMarkedProcesses(`${PROCESS_MARKER}=${jobValue}`);
46
+ });
47
+ return child;
48
+ }
49
+ export { spawnWithParentDeathSignal };
50
+ //# sourceMappingURL=spawn-with-parent-death-signal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spawn-with-parent-death-signal.js","sourceRoot":"","sources":["../../src/process/spawn-with-parent-death-signal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,EAAqB,MAAM,oBAAoB,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAW5D,MAAM,WAAW,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACnD,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,gBAAgB,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;AACtF,MAAM,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC9C,MAAM,UAAU,GAAG,GAAG,cAAc,IAAI,MAAM,GAAG,CAAC;AAClD,MAAM,KAAK,GAAe,EAAE,CAAC;AAE7B,MAAM,YAAY,GAAG,CAAC,KAAmB,EAAQ,EAAE;IAC/C,KAAK,CAAC,KAAK,EAAE,CAAC;IACd,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IAExB,IAAI,KAAK,YAAY,MAAM,EAAE,CAAC;QAC1B,KAAK,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,UAAU,GAAG,GAAS,EAAE;IAC1B,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IAED,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,UAAU,EAAE,UAAU,CAAC,EAAE;QAC5D,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC;KACtC,CAAC,CAAC;IAEH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;QACnB,KAAK,CAAC,KAAK,GAAG,SAAS,CAAC;IAC5B,CAAC,CAAC,CAAC;IAEH,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;IACpB,YAAY,CAAC,KAAK,CAAC,CAAC;AACxB,CAAC,CAAC;AAEF,SAAS,0BAA0B,CAC/B,OAAe,EACf,IAAc,EACd,UAAmC,EAAE;IAErC,MAAM,UAAU,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAC9C,MAAM,OAAO,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAC;IAC7C,MAAM,QAAQ,GAAG,GAAG,MAAM,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;IAC/D,UAAU,EAAE,CAAC;IAEb,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,EAAE;QAC1E,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,QAAQ;QAChC,GAAG,EAAE,EAAE,GAAG,CAAC,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,cAAc,CAAC,EAAE,QAAQ,EAAE;KACvE,CAAC,CAAC;IAEH,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;QAClB,mBAAmB,CAAC,GAAG,cAAc,IAAI,QAAQ,EAAE,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,OAAO,EAAE,0BAA0B,EAAE,CAAC","sourcesContent":["import { type ChildProcess, spawn, type StdioOptions } from \"node:child_process\";\nimport { randomBytes } from \"node:crypto\";\nimport { Socket } from \"node:net\";\nimport { dirname, extname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { killMarkedProcesses, PROCESS_MARKER } from \"./kill-marked-processes.ts\";\nimport { resolveExecutable } from \"./resolve-executable.ts\";\n\ntype ParentDeathSpawnOptions = {\n stdio?: StdioOptions;\n env?: NodeJS.ProcessEnv;\n};\n\ntype GuardState = {\n child?: ChildProcess | undefined;\n};\n\nconst MODULE_PATH = fileURLToPath(import.meta.url);\nconst GUARD_PATH = join(dirname(MODULE_PATH), `process-guard${extname(MODULE_PATH)}`);\nconst RUN_ID = randomBytes(8).toString(\"hex\");\nconst RUN_PREFIX = `${PROCESS_MARKER}=${RUN_ID}/`;\nconst guard: GuardState = {};\n\nconst releaseGuard = (child: ChildProcess): void => {\n child.unref();\n const { stdin } = child;\n\n if (stdin instanceof Socket) {\n stdin.unref();\n }\n};\n\nconst startGuard = (): void => {\n if (guard.child) {\n return;\n }\n\n const child = spawn(process.execPath, [GUARD_PATH, RUN_PREFIX], {\n detached: true,\n stdio: [\"pipe\", \"ignore\", \"ignore\"],\n });\n\n child.on(\"error\", () => {\n guard.child = undefined;\n });\n\n guard.child = child;\n releaseGuard(child);\n};\n\nfunction spawnWithParentDeathSignal(\n command: string,\n args: string[],\n options: ParentDeathSpawnOptions = {},\n): ChildProcess {\n const executable = resolveExecutable(command);\n const setpriv = resolveExecutable(\"setpriv\");\n const jobValue = `${RUN_ID}/${randomBytes(4).toString(\"hex\")}`;\n startGuard();\n\n const child = spawn(setpriv, [\"--pdeathsig\", \"SIGKILL\", executable, ...args], {\n detached: true,\n stdio: options.stdio ?? \"ignore\",\n env: { ...(options.env ?? process.env), [PROCESS_MARKER]: jobValue },\n });\n\n child.on(\"exit\", () => {\n killMarkedProcesses(`${PROCESS_MARKER}=${jobValue}`);\n });\n\n return child;\n}\n\nexport { spawnWithParentDeathSignal };\n"]}
@@ -1,11 +1,3 @@
1
- /**
2
- * Iterates every item currently in `set`, then clears it. Use it to drain a set of pending work
3
- * accumulated since the last drain.
4
- *
5
- * @template T - The set item type.
6
- * @param set - The set to drain and clear.
7
- * @param visit - Called with each item before the set is cleared.
8
- */
9
1
  declare const drain: <T>(set: Set<T>, visit: (item: T) => void) => void;
10
2
  export { drain };
11
3
  //# sourceMappingURL=drain.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"drain.d.ts","sourceRoot":"","sources":["../../src/set/drain.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,QAAA,MAAM,KAAK,GAAI,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,KAAG,IAMzD,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,CAAC"}
1
+ {"version":3,"file":"drain.d.ts","sourceRoot":"","sources":["../../src/set/drain.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,KAAK,GAAI,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,KAAG,IAMzD,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,CAAC"}
package/dist/set/drain.js CHANGED
@@ -1,11 +1,3 @@
1
- /**
2
- * Iterates every item currently in `set`, then clears it. Use it to drain a set of pending work
3
- * accumulated since the last drain.
4
- *
5
- * @template T - The set item type.
6
- * @param set - The set to drain and clear.
7
- * @param visit - Called with each item before the set is cleared.
8
- */
9
1
  const drain = (set, visit) => {
10
2
  for (const item of set) {
11
3
  visit(item);
@@ -1 +1 @@
1
- {"version":3,"file":"drain.js","sourceRoot":"","sources":["../../src/set/drain.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,KAAK,GAAG,CAAI,GAAW,EAAE,KAAwB,EAAQ,EAAE;IAC7D,KAAK,MAAM,IAAI,IAAI,GAAG,EAAE,CAAC;QACrB,KAAK,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;IAED,GAAG,CAAC,KAAK,EAAE,CAAC;AAChB,CAAC,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,CAAC","sourcesContent":["/**\n * Iterates every item currently in `set`, then clears it. Use it to drain a set of pending work\n * accumulated since the last drain.\n *\n * @template T - The set item type.\n * @param set - The set to drain and clear.\n * @param visit - Called with each item before the set is cleared.\n */\nconst drain = <T>(set: Set<T>, visit: (item: T) => void): void => {\n for (const item of set) {\n visit(item);\n }\n\n set.clear();\n};\n\nexport { drain };\n"]}
1
+ {"version":3,"file":"drain.js","sourceRoot":"","sources":["../../src/set/drain.ts"],"names":[],"mappings":"AAAA,MAAM,KAAK,GAAG,CAAI,GAAW,EAAE,KAAwB,EAAQ,EAAE;IAC7D,KAAK,MAAM,IAAI,IAAI,GAAG,EAAE,CAAC;QACrB,KAAK,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;IAED,GAAG,CAAC,KAAK,EAAE,CAAC;AAChB,CAAC,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,CAAC","sourcesContent":["const drain = <T>(set: Set<T>, visit: (item: T) => void): void => {\n for (const item of set) {\n visit(item);\n }\n\n set.clear();\n};\n\nexport { drain };\n"]}
@@ -1,2 +1,2 @@
1
- export { drain } from "./drain.js";
1
+ export { drain } from "./drain.ts";
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/set/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC","sourcesContent":["export { drain } from \"./drain.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/set/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC","sourcesContent":["export { drain } from \"./drain.ts\";\n"]}
@@ -1,4 +1,4 @@
1
- export { sanitizeIdentifier } from "./sanitize-identifier.js";
2
- export { sourceStringLiteral } from "./source-string-literal.js";
3
- export { toCamelIdentifier } from "./to-camel-identifier.js";
1
+ export { sanitizeIdentifier } from "./sanitize-identifier.ts";
2
+ export { sourceStringLiteral } from "./source-string-literal.ts";
3
+ export { toCamelIdentifier } from "./to-camel-identifier.ts";
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/source/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC","sourcesContent":["export { sanitizeIdentifier } from \"./sanitize-identifier.js\";\nexport { sourceStringLiteral } from \"./source-string-literal.js\";\nexport { toCamelIdentifier } from \"./to-camel-identifier.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/source/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC","sourcesContent":["export { sanitizeIdentifier } from \"./sanitize-identifier.ts\";\nexport { sourceStringLiteral } from \"./source-string-literal.ts\";\nexport { toCamelIdentifier } from \"./to-camel-identifier.ts\";\n"]}
@@ -1,14 +1,3 @@
1
- /**
2
- * Returns the name unchanged, or with a trailing underscore when it collides with a reserved word,
3
- * so it is safe to emit as a JavaScript identifier.
4
- *
5
- * @param name - The candidate identifier.
6
- * @returns The name, suffixed with `_` when it is a reserved word.
7
- *
8
- * @example
9
- * sanitizeIdentifier("iconName"); // "iconName"
10
- * sanitizeIdentifier("class"); // "class_"
11
- */
12
1
  declare function sanitizeIdentifier(name: string): string;
13
2
  export { sanitizeIdentifier };
14
3
  //# sourceMappingURL=sanitize-identifier.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sanitize-identifier.d.ts","sourceRoot":"","sources":["../../src/source/sanitize-identifier.ts"],"names":[],"mappings":"AAkDA;;;;;;;;;;GAUG;AACH,iBAAS,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
1
+ {"version":3,"file":"sanitize-identifier.d.ts","sourceRoot":"","sources":["../../src/source/sanitize-identifier.ts"],"names":[],"mappings":"AAkDA,iBAAS,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
@@ -47,17 +47,6 @@ const RESERVED = new Set([
47
47
  "with",
48
48
  "yield",
49
49
  ]);
50
- /**
51
- * Returns the name unchanged, or with a trailing underscore when it collides with a reserved word,
52
- * so it is safe to emit as a JavaScript identifier.
53
- *
54
- * @param name - The candidate identifier.
55
- * @returns The name, suffixed with `_` when it is a reserved word.
56
- *
57
- * @example
58
- * sanitizeIdentifier("iconName"); // "iconName"
59
- * sanitizeIdentifier("class"); // "class_"
60
- */
61
50
  function sanitizeIdentifier(name) {
62
51
  return RESERVED.has(name) ? `${name}_` : name;
63
52
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sanitize-identifier.js","sourceRoot":"","sources":["../../src/source/sanitize-identifier.ts"],"names":[],"mappings":"AAAA,MAAM,QAAQ,GAAgB,IAAI,GAAG,CAAC;IAClC,WAAW;IACX,OAAO;IACP,OAAO;IACP,MAAM;IACN,OAAO;IACP,OAAO;IACP,OAAO;IACP,UAAU;IACV,UAAU;IACV,SAAS;IACT,QAAQ;IACR,IAAI;IACJ,MAAM;IACN,MAAM;IACN,MAAM;IACN,QAAQ;IACR,SAAS;IACT,OAAO;IACP,SAAS;IACT,KAAK;IACL,UAAU;IACV,IAAI;IACJ,QAAQ;IACR,IAAI;IACJ,YAAY;IACZ,WAAW;IACX,KAAK;IACL,KAAK;IACL,MAAM;IACN,SAAS;IACT,SAAS;IACT,WAAW;IACX,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,MAAM;IACN,OAAO;IACP,MAAM;IACN,KAAK;IACL,QAAQ;IACR,KAAK;IACL,MAAM;IACN,OAAO;IACP,MAAM;IACN,OAAO;CACV,CAAC,CAAC;AAEH;;;;;;;;;;GAUG;AACH,SAAS,kBAAkB,CAAC,IAAY;IACpC,OAAO,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AAClD,CAAC;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAC","sourcesContent":["const RESERVED: Set<string> = new Set([\n \"arguments\",\n \"await\",\n \"break\",\n \"case\",\n \"catch\",\n \"class\",\n \"const\",\n \"continue\",\n \"debugger\",\n \"default\",\n \"delete\",\n \"do\",\n \"else\",\n \"enum\",\n \"eval\",\n \"export\",\n \"extends\",\n \"false\",\n \"finally\",\n \"for\",\n \"function\",\n \"if\",\n \"import\",\n \"in\",\n \"instanceof\",\n \"interface\",\n \"let\",\n \"new\",\n \"null\",\n \"package\",\n \"private\",\n \"protected\",\n \"public\",\n \"return\",\n \"static\",\n \"super\",\n \"switch\",\n \"this\",\n \"throw\",\n \"true\",\n \"try\",\n \"typeof\",\n \"var\",\n \"void\",\n \"while\",\n \"with\",\n \"yield\",\n]);\n\n/**\n * Returns the name unchanged, or with a trailing underscore when it collides with a reserved word,\n * so it is safe to emit as a JavaScript identifier.\n *\n * @param name - The candidate identifier.\n * @returns The name, suffixed with `_` when it is a reserved word.\n *\n * @example\n * sanitizeIdentifier(\"iconName\"); // \"iconName\"\n * sanitizeIdentifier(\"class\"); // \"class_\"\n */\nfunction sanitizeIdentifier(name: string): string {\n return RESERVED.has(name) ? `${name}_` : name;\n}\n\nexport { sanitizeIdentifier };\n"]}
1
+ {"version":3,"file":"sanitize-identifier.js","sourceRoot":"","sources":["../../src/source/sanitize-identifier.ts"],"names":[],"mappings":"AAAA,MAAM,QAAQ,GAAgB,IAAI,GAAG,CAAC;IAClC,WAAW;IACX,OAAO;IACP,OAAO;IACP,MAAM;IACN,OAAO;IACP,OAAO;IACP,OAAO;IACP,UAAU;IACV,UAAU;IACV,SAAS;IACT,QAAQ;IACR,IAAI;IACJ,MAAM;IACN,MAAM;IACN,MAAM;IACN,QAAQ;IACR,SAAS;IACT,OAAO;IACP,SAAS;IACT,KAAK;IACL,UAAU;IACV,IAAI;IACJ,QAAQ;IACR,IAAI;IACJ,YAAY;IACZ,WAAW;IACX,KAAK;IACL,KAAK;IACL,MAAM;IACN,SAAS;IACT,SAAS;IACT,WAAW;IACX,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,MAAM;IACN,OAAO;IACP,MAAM;IACN,KAAK;IACL,QAAQ;IACR,KAAK;IACL,MAAM;IACN,OAAO;IACP,MAAM;IACN,OAAO;CACV,CAAC,CAAC;AAEH,SAAS,kBAAkB,CAAC,IAAY;IACpC,OAAO,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AAClD,CAAC;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAC","sourcesContent":["const RESERVED: Set<string> = new Set([\n \"arguments\",\n \"await\",\n \"break\",\n \"case\",\n \"catch\",\n \"class\",\n \"const\",\n \"continue\",\n \"debugger\",\n \"default\",\n \"delete\",\n \"do\",\n \"else\",\n \"enum\",\n \"eval\",\n \"export\",\n \"extends\",\n \"false\",\n \"finally\",\n \"for\",\n \"function\",\n \"if\",\n \"import\",\n \"in\",\n \"instanceof\",\n \"interface\",\n \"let\",\n \"new\",\n \"null\",\n \"package\",\n \"private\",\n \"protected\",\n \"public\",\n \"return\",\n \"static\",\n \"super\",\n \"switch\",\n \"this\",\n \"throw\",\n \"true\",\n \"try\",\n \"typeof\",\n \"var\",\n \"void\",\n \"while\",\n \"with\",\n \"yield\",\n]);\n\nfunction sanitizeIdentifier(name: string): string {\n return RESERVED.has(name) ? `${name}_` : name;\n}\n\nexport { sanitizeIdentifier };\n"]}
@@ -1,13 +1,3 @@
1
- /**
2
- * Encodes a string as a JavaScript string literal, additionally escaping characters that are unsafe
3
- * to embed in generated source (angle brackets and the line and paragraph separators).
4
- *
5
- * @param value - The string to encode.
6
- * @returns The quoted, source-safe string literal.
7
- *
8
- * @example
9
- * sourceStringLiteral("hello"); // '"hello"'
10
- */
11
1
  declare function sourceStringLiteral(value: string): string;
12
2
  export { sourceStringLiteral };
13
3
  //# sourceMappingURL=source-string-literal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"source-string-literal.d.ts","sourceRoot":"","sources":["../../src/source/source-string-literal.ts"],"names":[],"mappings":"AAYA;;;;;;;;;GASG;AACH,iBAAS,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
1
+ {"version":3,"file":"source-string-literal.d.ts","sourceRoot":"","sources":["../../src/source/source-string-literal.ts"],"names":[],"mappings":"AAYA,iBAAS,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
@@ -7,16 +7,6 @@ const SOURCE_ESCAPES = {
7
7
  [PARAGRAPH_SEPARATOR]: String.raw `\u2029`,
8
8
  };
9
9
  const UNSAFE_SOURCE_CHARS = new RegExp(`[${Object.keys(SOURCE_ESCAPES).join("")}]`, "g");
10
- /**
11
- * Encodes a string as a JavaScript string literal, additionally escaping characters that are unsafe
12
- * to embed in generated source (angle brackets and the line and paragraph separators).
13
- *
14
- * @param value - The string to encode.
15
- * @returns The quoted, source-safe string literal.
16
- *
17
- * @example
18
- * sourceStringLiteral("hello"); // '"hello"'
19
- */
20
10
  function sourceStringLiteral(value) {
21
11
  return JSON.stringify(value).replaceAll(UNSAFE_SOURCE_CHARS, (char) => SOURCE_ESCAPES[char] ?? char);
22
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"source-string-literal.js","sourceRoot":"","sources":["../../src/source/source-string-literal.ts"],"names":[],"mappings":"AAAA,MAAM,cAAc,GAAG,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AACrD,MAAM,mBAAmB,GAAG,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AAE1D,MAAM,cAAc,GAA2B;IAC3C,GAAG,EAAE,MAAM,CAAC,GAAG,CAAA,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAC,GAAG,CAAA,QAAQ;IACvB,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC,GAAG,CAAA,QAAQ;IACpC,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC,GAAG,CAAA,QAAQ;CAC5C,CAAC;AAEF,MAAM,mBAAmB,GAAG,IAAI,MAAM,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAEzF;;;;;;;;;GASG;AACH,SAAS,mBAAmB,CAAC,KAAa;IACtC,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,mBAAmB,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC;AACzG,CAAC;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAC","sourcesContent":["const LINE_SEPARATOR = String.fromCodePoint(0x20_28);\nconst PARAGRAPH_SEPARATOR = String.fromCodePoint(0x20_29);\n\nconst SOURCE_ESCAPES: Record<string, string> = {\n \"<\": String.raw`\\u003C`,\n \">\": String.raw`\\u003E`,\n [LINE_SEPARATOR]: String.raw`\\u2028`,\n [PARAGRAPH_SEPARATOR]: String.raw`\\u2029`,\n};\n\nconst UNSAFE_SOURCE_CHARS = new RegExp(`[${Object.keys(SOURCE_ESCAPES).join(\"\")}]`, \"g\");\n\n/**\n * Encodes a string as a JavaScript string literal, additionally escaping characters that are unsafe\n * to embed in generated source (angle brackets and the line and paragraph separators).\n *\n * @param value - The string to encode.\n * @returns The quoted, source-safe string literal.\n *\n * @example\n * sourceStringLiteral(\"hello\"); // '\"hello\"'\n */\nfunction sourceStringLiteral(value: string): string {\n return JSON.stringify(value).replaceAll(UNSAFE_SOURCE_CHARS, (char) => SOURCE_ESCAPES[char] ?? char);\n}\n\nexport { sourceStringLiteral };\n"]}
1
+ {"version":3,"file":"source-string-literal.js","sourceRoot":"","sources":["../../src/source/source-string-literal.ts"],"names":[],"mappings":"AAAA,MAAM,cAAc,GAAG,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AACrD,MAAM,mBAAmB,GAAG,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AAE1D,MAAM,cAAc,GAA2B;IAC3C,GAAG,EAAE,MAAM,CAAC,GAAG,CAAA,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAC,GAAG,CAAA,QAAQ;IACvB,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC,GAAG,CAAA,QAAQ;IACpC,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC,GAAG,CAAA,QAAQ;CAC5C,CAAC;AAEF,MAAM,mBAAmB,GAAG,IAAI,MAAM,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAEzF,SAAS,mBAAmB,CAAC,KAAa;IACtC,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,mBAAmB,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC;AACzG,CAAC;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAC","sourcesContent":["const LINE_SEPARATOR = String.fromCodePoint(0x20_28);\nconst PARAGRAPH_SEPARATOR = String.fromCodePoint(0x20_29);\n\nconst SOURCE_ESCAPES: Record<string, string> = {\n \"<\": String.raw`\\u003C`,\n \">\": String.raw`\\u003E`,\n [LINE_SEPARATOR]: String.raw`\\u2028`,\n [PARAGRAPH_SEPARATOR]: String.raw`\\u2029`,\n};\n\nconst UNSAFE_SOURCE_CHARS = new RegExp(`[${Object.keys(SOURCE_ESCAPES).join(\"\")}]`, \"g\");\n\nfunction sourceStringLiteral(value: string): string {\n return JSON.stringify(value).replaceAll(UNSAFE_SOURCE_CHARS, (char) => SOURCE_ESCAPES[char] ?? char);\n}\n\nexport { sourceStringLiteral };\n"]}
@@ -1,13 +1,3 @@
1
- /**
2
- * Converts a name to camel case and sanitizes it into a valid JavaScript identifier.
3
- *
4
- * @param name - The name to convert.
5
- * @returns The camel-cased, reserved-word-safe identifier.
6
- *
7
- * @example
8
- * toCamelIdentifier("icon_name"); // "iconName"
9
- * toCamelIdentifier("class"); // "class_"
10
- */
11
1
  declare function toCamelIdentifier(name: string): string;
12
2
  export { toCamelIdentifier };
13
3
  //# sourceMappingURL=to-camel-identifier.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"to-camel-identifier.d.ts","sourceRoot":"","sources":["../../src/source/to-camel-identifier.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,iBAAS,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
1
+ {"version":3,"file":"to-camel-identifier.d.ts","sourceRoot":"","sources":["../../src/source/to-camel-identifier.ts"],"names":[],"mappings":"AAGA,iBAAS,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
@@ -1,15 +1,5 @@
1
1
  import { camelCase } from "../string/camel-case.js";
2
2
  import { sanitizeIdentifier } from "./sanitize-identifier.js";
3
- /**
4
- * Converts a name to camel case and sanitizes it into a valid JavaScript identifier.
5
- *
6
- * @param name - The name to convert.
7
- * @returns The camel-cased, reserved-word-safe identifier.
8
- *
9
- * @example
10
- * toCamelIdentifier("icon_name"); // "iconName"
11
- * toCamelIdentifier("class"); // "class_"
12
- */
13
3
  function toCamelIdentifier(name) {
14
4
  return sanitizeIdentifier(camelCase(name));
15
5
  }
@@ -1 +1 @@
1
- {"version":3,"file":"to-camel-identifier.js","sourceRoot":"","sources":["../../src/source/to-camel-identifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D;;;;;;;;;GASG;AACH,SAAS,iBAAiB,CAAC,IAAY;IACnC,OAAO,kBAAkB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;AAC/C,CAAC;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC","sourcesContent":["import { camelCase } from \"../string/camel-case.js\";\nimport { sanitizeIdentifier } from \"./sanitize-identifier.js\";\n\n/**\n * Converts a name to camel case and sanitizes it into a valid JavaScript identifier.\n *\n * @param name - The name to convert.\n * @returns The camel-cased, reserved-word-safe identifier.\n *\n * @example\n * toCamelIdentifier(\"icon_name\"); // \"iconName\"\n * toCamelIdentifier(\"class\"); // \"class_\"\n */\nfunction toCamelIdentifier(name: string): string {\n return sanitizeIdentifier(camelCase(name));\n}\n\nexport { toCamelIdentifier };\n"]}
1
+ {"version":3,"file":"to-camel-identifier.js","sourceRoot":"","sources":["../../src/source/to-camel-identifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,SAAS,iBAAiB,CAAC,IAAY;IACnC,OAAO,kBAAkB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;AAC/C,CAAC;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC","sourcesContent":["import { camelCase } from \"../string/camel-case.ts\";\nimport { sanitizeIdentifier } from \"./sanitize-identifier.ts\";\n\nfunction toCamelIdentifier(name: string): string {\n return sanitizeIdentifier(camelCase(name));\n}\n\nexport { toCamelIdentifier };\n"]}
@@ -1,17 +1,3 @@
1
- /**
2
- * Converts an underscore- or hyphen-delimited string to camel case.
3
- *
4
- * Unlike a general-purpose converter, this splits only on `_` and `-` and keeps the first segment
5
- * verbatim, so GObject acronyms are preserved (`camelCase("GLArea")` stays `"GLArea"`).
6
- *
7
- * @param str - The string to convert.
8
- * @returns The camel-cased string.
9
- *
10
- * @example
11
- * camelCase("icon_name"); // "iconName"
12
- * camelCase("start-widget"); // "startWidget"
13
- * camelCase("Box"); // "Box"
14
- */
15
1
  declare function camelCase(str: string): string;
16
2
  export { camelCase };
17
3
  //# sourceMappingURL=camel-case.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"camel-case.d.ts","sourceRoot":"","sources":["../../src/string/camel-case.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;GAaG;AACH,iBAAS,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEtC;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
1
+ {"version":3,"file":"camel-case.d.ts","sourceRoot":"","sources":["../../src/string/camel-case.ts"],"names":[],"mappings":"AAGA,iBAAS,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEtC;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -1,19 +1,5 @@
1
1
  import { upperFirst } from "./upper-first.js";
2
2
  import { mapWordSegments } from "./word-segments.js";
3
- /**
4
- * Converts an underscore- or hyphen-delimited string to camel case.
5
- *
6
- * Unlike a general-purpose converter, this splits only on `_` and `-` and keeps the first segment
7
- * verbatim, so GObject acronyms are preserved (`camelCase("GLArea")` stays `"GLArea"`).
8
- *
9
- * @param str - The string to convert.
10
- * @returns The camel-cased string.
11
- *
12
- * @example
13
- * camelCase("icon_name"); // "iconName"
14
- * camelCase("start-widget"); // "startWidget"
15
- * camelCase("Box"); // "Box"
16
- */
17
3
  function camelCase(str) {
18
4
  return mapWordSegments(str, (part, index) => (index === 0 ? part : upperFirst(part)));
19
5
  }
@@ -1 +1 @@
1
- {"version":3,"file":"camel-case.js","sourceRoot":"","sources":["../../src/string/camel-case.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;;;;;;;;;GAaG;AACH,SAAS,SAAS,CAAC,GAAW;IAC1B,OAAO,eAAe,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC1F,CAAC;AAED,OAAO,EAAE,SAAS,EAAE,CAAC","sourcesContent":["import { upperFirst } from \"./upper-first.js\";\nimport { mapWordSegments } from \"./word-segments.js\";\n\n/**\n * Converts an underscore- or hyphen-delimited string to camel case.\n *\n * Unlike a general-purpose converter, this splits only on `_` and `-` and keeps the first segment\n * verbatim, so GObject acronyms are preserved (`camelCase(\"GLArea\")` stays `\"GLArea\"`).\n *\n * @param str - The string to convert.\n * @returns The camel-cased string.\n *\n * @example\n * camelCase(\"icon_name\"); // \"iconName\"\n * camelCase(\"start-widget\"); // \"startWidget\"\n * camelCase(\"Box\"); // \"Box\"\n */\nfunction camelCase(str: string): string {\n return mapWordSegments(str, (part, index) => (index === 0 ? part : upperFirst(part)));\n}\n\nexport { camelCase };\n"]}
1
+ {"version":3,"file":"camel-case.js","sourceRoot":"","sources":["../../src/string/camel-case.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,SAAS,SAAS,CAAC,GAAW;IAC1B,OAAO,eAAe,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC1F,CAAC;AAED,OAAO,EAAE,SAAS,EAAE,CAAC","sourcesContent":["import { upperFirst } from \"./upper-first.ts\";\nimport { mapWordSegments } from \"./word-segments.ts\";\n\nfunction camelCase(str: string): string {\n return mapWordSegments(str, (part, index) => (index === 0 ? part : upperFirst(part)));\n}\n\nexport { camelCase };\n"]}
@@ -1,6 +1,6 @@
1
- export { camelCase } from "./camel-case.js";
2
- export { kebabCase } from "./kebab-case.js";
3
- export { lowerFirst } from "./lower-first.js";
4
- export { pascalCase } from "./pascal-case.js";
5
- export { upperFirst } from "./upper-first.js";
1
+ export { camelCase } from "./camel-case.ts";
2
+ export { kebabCase } from "./kebab-case.ts";
3
+ export { lowerFirst } from "./lower-first.ts";
4
+ export { pascalCase } from "./pascal-case.ts";
5
+ export { upperFirst } from "./upper-first.ts";
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/string/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["export { camelCase } from \"./camel-case.js\";\nexport { kebabCase } from \"./kebab-case.js\";\nexport { lowerFirst } from \"./lower-first.js\";\nexport { pascalCase } from \"./pascal-case.js\";\nexport { upperFirst } from \"./upper-first.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/string/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["export { camelCase } from \"./camel-case.ts\";\nexport { kebabCase } from \"./kebab-case.ts\";\nexport { lowerFirst } from \"./lower-first.ts\";\nexport { pascalCase } from \"./pascal-case.ts\";\nexport { upperFirst } from \"./upper-first.ts\";\n"]}
@@ -1,14 +1,3 @@
1
- /**
2
- * Converts a camelCase or PascalCase string to kebab case by lower-casing uppercase letters and
3
- * inserting hyphens before interior ones.
4
- *
5
- * @param str - The string to convert.
6
- * @returns The kebab-cased string.
7
- *
8
- * @example
9
- * kebabCase("iconName"); // "icon-name"
10
- * kebabCase("Title"); // "title"
11
- */
12
1
  declare function kebabCase(str: string): string;
13
2
  export { kebabCase };
14
3
  //# sourceMappingURL=kebab-case.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"kebab-case.d.ts","sourceRoot":"","sources":["../../src/string/kebab-case.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,iBAAS,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAItC;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
1
+ {"version":3,"file":"kebab-case.d.ts","sourceRoot":"","sources":["../../src/string/kebab-case.ts"],"names":[],"mappings":"AAAA,iBAAS,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAItC;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -1,14 +1,3 @@
1
- /**
2
- * Converts a camelCase or PascalCase string to kebab case by lower-casing uppercase letters and
3
- * inserting hyphens before interior ones.
4
- *
5
- * @param str - The string to convert.
6
- * @returns The kebab-cased string.
7
- *
8
- * @example
9
- * kebabCase("iconName"); // "icon-name"
10
- * kebabCase("Title"); // "title"
11
- */
12
1
  function kebabCase(str) {
13
2
  return str.replaceAll(/[A-Z]/g, (char, index) => index === 0 ? char.toLowerCase() : `-${char.toLowerCase()}`);
14
3
  }
@@ -1 +1 @@
1
- {"version":3,"file":"kebab-case.js","sourceRoot":"","sources":["../../src/string/kebab-case.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,SAAS,SAAS,CAAC,GAAW;IAC1B,OAAO,GAAG,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,KAAa,EAAE,EAAE,CACpD,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE,CAC9D,CAAC;AACN,CAAC;AAED,OAAO,EAAE,SAAS,EAAE,CAAC","sourcesContent":["/**\n * Converts a camelCase or PascalCase string to kebab case by lower-casing uppercase letters and\n * inserting hyphens before interior ones.\n *\n * @param str - The string to convert.\n * @returns The kebab-cased string.\n *\n * @example\n * kebabCase(\"iconName\"); // \"icon-name\"\n * kebabCase(\"Title\"); // \"title\"\n */\nfunction kebabCase(str: string): string {\n return str.replaceAll(/[A-Z]/g, (char, index: number) =>\n index === 0 ? char.toLowerCase() : `-${char.toLowerCase()}`,\n );\n}\n\nexport { kebabCase };\n"]}
1
+ {"version":3,"file":"kebab-case.js","sourceRoot":"","sources":["../../src/string/kebab-case.ts"],"names":[],"mappings":"AAAA,SAAS,SAAS,CAAC,GAAW;IAC1B,OAAO,GAAG,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,KAAa,EAAE,EAAE,CACpD,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE,CAC9D,CAAC;AACN,CAAC;AAED,OAAO,EAAE,SAAS,EAAE,CAAC","sourcesContent":["function kebabCase(str: string): string {\n return str.replaceAll(/[A-Z]/g, (char, index: number) =>\n index === 0 ? char.toLowerCase() : `-${char.toLowerCase()}`,\n );\n}\n\nexport { kebabCase };\n"]}
@@ -1,13 +1,3 @@
1
- /**
2
- * Converts the first character of a string to lower case.
3
- *
4
- * @param str - The string to transform.
5
- * @returns The string with its first character lower-cased.
6
- *
7
- * @example
8
- * lowerFirst("Fred"); // "fred"
9
- * lowerFirst("FRED"); // "fRED"
10
- */
11
1
  declare function lowerFirst(str: string): string;
12
2
  export { lowerFirst };
13
3
  //# sourceMappingURL=lower-first.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lower-first.d.ts","sourceRoot":"","sources":["../../src/string/lower-first.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,iBAAS,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEvC;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
1
+ {"version":3,"file":"lower-first.d.ts","sourceRoot":"","sources":["../../src/string/lower-first.ts"],"names":[],"mappings":"AAAA,iBAAS,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEvC;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -1,13 +1,3 @@
1
- /**
2
- * Converts the first character of a string to lower case.
3
- *
4
- * @param str - The string to transform.
5
- * @returns The string with its first character lower-cased.
6
- *
7
- * @example
8
- * lowerFirst("Fred"); // "fred"
9
- * lowerFirst("FRED"); // "fRED"
10
- */
11
1
  function lowerFirst(str) {
12
2
  return str.charAt(0).toLowerCase() + str.slice(1);
13
3
  }
@@ -1 +1 @@
1
- {"version":3,"file":"lower-first.js","sourceRoot":"","sources":["../../src/string/lower-first.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,SAAS,UAAU,CAAC,GAAW;IAC3B,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACtD,CAAC;AAED,OAAO,EAAE,UAAU,EAAE,CAAC","sourcesContent":["/**\n * Converts the first character of a string to lower case.\n *\n * @param str - The string to transform.\n * @returns The string with its first character lower-cased.\n *\n * @example\n * lowerFirst(\"Fred\"); // \"fred\"\n * lowerFirst(\"FRED\"); // \"fRED\"\n */\nfunction lowerFirst(str: string): string {\n return str.charAt(0).toLowerCase() + str.slice(1);\n}\n\nexport { lowerFirst };\n"]}
1
+ {"version":3,"file":"lower-first.js","sourceRoot":"","sources":["../../src/string/lower-first.ts"],"names":[],"mappings":"AAAA,SAAS,UAAU,CAAC,GAAW;IAC3B,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACtD,CAAC;AAED,OAAO,EAAE,UAAU,EAAE,CAAC","sourcesContent":["function lowerFirst(str: string): string {\n return str.charAt(0).toLowerCase() + str.slice(1);\n}\n\nexport { lowerFirst };\n"]}
@@ -1,16 +1,3 @@
1
- /**
2
- * Converts an underscore- or hyphen-delimited string to Pascal case.
3
- *
4
- * Splits only on `_` and `-` and capitalizes each segment's first character, so GObject acronyms
5
- * are preserved (`pascalCase("GLArea")` stays `"GLArea"`).
6
- *
7
- * @param str - The string to convert.
8
- * @returns The Pascal-cased string.
9
- *
10
- * @example
11
- * pascalCase("icon_name"); // "IconName"
12
- * pascalCase("scrolled-window"); // "ScrolledWindow"
13
- */
14
1
  declare function pascalCase(str: string): string;
15
2
  export { pascalCase };
16
3
  //# sourceMappingURL=pascal-case.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pascal-case.d.ts","sourceRoot":"","sources":["../../src/string/pascal-case.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;GAYG;AACH,iBAAS,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEvC;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
1
+ {"version":3,"file":"pascal-case.d.ts","sourceRoot":"","sources":["../../src/string/pascal-case.ts"],"names":[],"mappings":"AAGA,iBAAS,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEvC;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -1,18 +1,5 @@
1
1
  import { upperFirst } from "./upper-first.js";
2
2
  import { mapWordSegments } from "./word-segments.js";
3
- /**
4
- * Converts an underscore- or hyphen-delimited string to Pascal case.
5
- *
6
- * Splits only on `_` and `-` and capitalizes each segment's first character, so GObject acronyms
7
- * are preserved (`pascalCase("GLArea")` stays `"GLArea"`).
8
- *
9
- * @param str - The string to convert.
10
- * @returns The Pascal-cased string.
11
- *
12
- * @example
13
- * pascalCase("icon_name"); // "IconName"
14
- * pascalCase("scrolled-window"); // "ScrolledWindow"
15
- */
16
3
  function pascalCase(str) {
17
4
  return mapWordSegments(str, upperFirst);
18
5
  }
@@ -1 +1 @@
1
- {"version":3,"file":"pascal-case.js","sourceRoot":"","sources":["../../src/string/pascal-case.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;;;;;;;;GAYG;AACH,SAAS,UAAU,CAAC,GAAW;IAC3B,OAAO,eAAe,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;AAC5C,CAAC;AAED,OAAO,EAAE,UAAU,EAAE,CAAC","sourcesContent":["import { upperFirst } from \"./upper-first.js\";\nimport { mapWordSegments } from \"./word-segments.js\";\n\n/**\n * Converts an underscore- or hyphen-delimited string to Pascal case.\n *\n * Splits only on `_` and `-` and capitalizes each segment's first character, so GObject acronyms\n * are preserved (`pascalCase(\"GLArea\")` stays `\"GLArea\"`).\n *\n * @param str - The string to convert.\n * @returns The Pascal-cased string.\n *\n * @example\n * pascalCase(\"icon_name\"); // \"IconName\"\n * pascalCase(\"scrolled-window\"); // \"ScrolledWindow\"\n */\nfunction pascalCase(str: string): string {\n return mapWordSegments(str, upperFirst);\n}\n\nexport { pascalCase };\n"]}
1
+ {"version":3,"file":"pascal-case.js","sourceRoot":"","sources":["../../src/string/pascal-case.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,SAAS,UAAU,CAAC,GAAW;IAC3B,OAAO,eAAe,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;AAC5C,CAAC;AAED,OAAO,EAAE,UAAU,EAAE,CAAC","sourcesContent":["import { upperFirst } from \"./upper-first.ts\";\nimport { mapWordSegments } from \"./word-segments.ts\";\n\nfunction pascalCase(str: string): string {\n return mapWordSegments(str, upperFirst);\n}\n\nexport { pascalCase };\n"]}
@@ -1,13 +1,3 @@
1
- /**
2
- * Converts the first character of a string to upper case.
3
- *
4
- * @param str - The string to transform.
5
- * @returns The string with its first character upper-cased.
6
- *
7
- * @example
8
- * upperFirst("fred"); // "Fred"
9
- * upperFirst("Fred"); // "Fred"
10
- */
11
1
  declare function upperFirst(str: string): string;
12
2
  export { upperFirst };
13
3
  //# sourceMappingURL=upper-first.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"upper-first.d.ts","sourceRoot":"","sources":["../../src/string/upper-first.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,iBAAS,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEvC;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
1
+ {"version":3,"file":"upper-first.d.ts","sourceRoot":"","sources":["../../src/string/upper-first.ts"],"names":[],"mappings":"AAAA,iBAAS,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEvC;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -1,13 +1,3 @@
1
- /**
2
- * Converts the first character of a string to upper case.
3
- *
4
- * @param str - The string to transform.
5
- * @returns The string with its first character upper-cased.
6
- *
7
- * @example
8
- * upperFirst("fred"); // "Fred"
9
- * upperFirst("Fred"); // "Fred"
10
- */
11
1
  function upperFirst(str) {
12
2
  return str.charAt(0).toUpperCase() + str.slice(1);
13
3
  }