@node-core/utils 7.2.0 → 7.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (182) hide show
  1. package/lib/ci/build-types/test_build.js +3 -3
  2. package/lib/ci/failure_aggregator.js +2 -2
  3. package/lib/ci/run_ci.js +3 -2
  4. package/lib/cli.js +6 -6
  5. package/lib/figures.js +6 -6
  6. package/lib/update-v8/backport.js +3 -4
  7. package/lib/verbosity.js +2 -4
  8. package/node_modules/@listr2/{prompt-adapter-enquirer → prompt-adapter-inquirer}/README.md +4 -4
  9. package/node_modules/@listr2/prompt-adapter-inquirer/dist/index.d.mts +21 -0
  10. package/node_modules/@listr2/prompt-adapter-inquirer/dist/index.mjs +46 -0
  11. package/node_modules/@listr2/prompt-adapter-inquirer/node_modules/@inquirer/type/LICENSE +22 -0
  12. package/node_modules/@listr2/prompt-adapter-inquirer/node_modules/@inquirer/type/dist/index.d.ts +2 -0
  13. package/node_modules/@listr2/prompt-adapter-inquirer/node_modules/@inquirer/type/dist/index.js +2 -0
  14. package/node_modules/@listr2/prompt-adapter-inquirer/node_modules/@inquirer/type/dist/inquirer.d.ts +35 -0
  15. package/node_modules/@listr2/prompt-adapter-inquirer/node_modules/@inquirer/type/dist/inquirer.js +1 -0
  16. package/node_modules/@listr2/prompt-adapter-inquirer/node_modules/@inquirer/type/dist/utils.d.ts +34 -0
  17. package/node_modules/@listr2/prompt-adapter-inquirer/node_modules/@inquirer/type/dist/utils.js +2 -0
  18. package/node_modules/@listr2/prompt-adapter-inquirer/node_modules/@inquirer/type/package.json +88 -0
  19. package/node_modules/@listr2/{prompt-adapter-enquirer → prompt-adapter-inquirer}/package.json +25 -20
  20. package/node_modules/{log-update/node_modules/ansi-escapes → ansi-escapes}/base.d.ts +48 -3
  21. package/node_modules/{log-update/node_modules/ansi-escapes → ansi-escapes}/base.js +58 -19
  22. package/node_modules/{log-update/node_modules/ansi-escapes → ansi-escapes}/package.json +1 -1
  23. package/node_modules/{log-update/node_modules/ansi-escapes → ansi-escapes}/readme.md +36 -1
  24. package/node_modules/ansi-regex/index.js +9 -4
  25. package/node_modules/ansi-regex/package.json +1 -1
  26. package/node_modules/ansi-regex/readme.md +6 -0
  27. package/node_modules/ansi-styles/index.d.ts +12 -12
  28. package/node_modules/ansi-styles/index.js +3 -3
  29. package/node_modules/ansi-styles/package.json +4 -4
  30. package/node_modules/cli-truncate/index.d.ts +3 -3
  31. package/node_modules/cli-truncate/index.js +40 -14
  32. package/node_modules/cli-truncate/node_modules/string-width/index.js +133 -15
  33. package/node_modules/cli-truncate/node_modules/string-width/package.json +4 -4
  34. package/node_modules/cli-truncate/node_modules/string-width/readme.md +1 -1
  35. package/node_modules/cli-truncate/package.json +7 -7
  36. package/node_modules/cli-truncate/readme.md +2 -3
  37. package/node_modules/ghauth/.github/dependabot.yml +11 -3
  38. package/node_modules/ghauth/.github/workflows/depsound.yml +33 -0
  39. package/node_modules/ghauth/.github/workflows/test-and-release.yml +4 -4
  40. package/node_modules/ghauth/CHANGELOG.md +60 -0
  41. package/node_modules/ghauth/package.json +30 -6
  42. package/node_modules/js-yaml/README.md +20 -187
  43. package/node_modules/js-yaml/dist/browser/js-yaml.esm.min.mjs +1008 -946
  44. package/node_modules/js-yaml/dist/browser/js-yaml.esm.min.mjs.map +1 -1
  45. package/node_modules/js-yaml/dist/browser/js-yaml.umd.min.js +29 -23
  46. package/node_modules/js-yaml/dist/browser/js-yaml.umd.min.js.map +1 -1
  47. package/node_modules/js-yaml/dist/js-yaml.cjs.js +1043 -583
  48. package/node_modules/js-yaml/dist/js-yaml.cjs.js.map +1 -1
  49. package/node_modules/js-yaml/dist/js-yaml.d.ts +877 -133
  50. package/node_modules/js-yaml/dist/js-yaml.mjs +995 -556
  51. package/node_modules/js-yaml/dist/js-yaml.mjs.map +1 -1
  52. package/node_modules/js-yaml/package.json +8 -7
  53. package/node_modules/listr2/dist/{index.d.cts → index.d.mts} +90 -60
  54. package/node_modules/listr2/dist/{index.js → index.mjs} +496 -373
  55. package/node_modules/listr2/node_modules/string-width/index.d.ts +39 -0
  56. package/node_modules/listr2/node_modules/string-width/index.js +207 -0
  57. package/node_modules/listr2/node_modules/string-width/package.json +65 -0
  58. package/node_modules/listr2/node_modules/string-width/readme.md +66 -0
  59. package/node_modules/listr2/node_modules/wrap-ansi/index.d.ts +1 -1
  60. package/node_modules/listr2/node_modules/wrap-ansi/index.js +544 -116
  61. package/node_modules/listr2/node_modules/wrap-ansi/package.json +10 -13
  62. package/node_modules/listr2/node_modules/wrap-ansi/readme.md +2 -0
  63. package/node_modules/listr2/package.json +16 -19
  64. package/node_modules/log-update/index.d.ts +64 -1
  65. package/node_modules/log-update/index.js +268 -18
  66. package/node_modules/log-update/node_modules/string-width/index.d.ts +39 -0
  67. package/node_modules/log-update/node_modules/string-width/index.js +207 -0
  68. package/node_modules/log-update/node_modules/string-width/package.json +65 -0
  69. package/node_modules/log-update/node_modules/string-width/readme.md +66 -0
  70. package/node_modules/log-update/node_modules/wrap-ansi/index.d.ts +1 -1
  71. package/node_modules/log-update/node_modules/wrap-ansi/index.js +544 -116
  72. package/node_modules/log-update/node_modules/wrap-ansi/package.json +10 -13
  73. package/node_modules/log-update/node_modules/wrap-ansi/readme.md +2 -0
  74. package/node_modules/log-update/package.json +14 -12
  75. package/node_modules/log-update/readme.md +61 -0
  76. package/node_modules/slice-ansi/index.d.ts +2 -2
  77. package/node_modules/slice-ansi/index.js +260 -112
  78. package/node_modules/slice-ansi/package.json +10 -9
  79. package/node_modules/slice-ansi/readme.md +3 -2
  80. package/node_modules/slice-ansi/tokenize-ansi.js +752 -0
  81. package/node_modules/smol-toml/README.md +205 -191
  82. package/node_modules/smol-toml/dist/date.d.ts +0 -1
  83. package/node_modules/smol-toml/dist/date.js +0 -1
  84. package/node_modules/smol-toml/dist/error.d.ts +0 -1
  85. package/node_modules/smol-toml/dist/error.js +0 -1
  86. package/node_modules/smol-toml/dist/extract.js +32 -65
  87. package/node_modules/smol-toml/dist/index.cjs +302 -288
  88. package/node_modules/smol-toml/dist/index.d.ts +0 -1
  89. package/node_modules/smol-toml/dist/index.js +0 -1
  90. package/node_modules/smol-toml/dist/parse.d.ts +1 -3
  91. package/node_modules/smol-toml/dist/parse.js +22 -21
  92. package/node_modules/smol-toml/dist/primitive.js +75 -76
  93. package/node_modules/smol-toml/dist/stringify.d.ts +0 -1
  94. package/node_modules/smol-toml/dist/stringify.js +43 -30
  95. package/node_modules/smol-toml/dist/struct.js +90 -93
  96. package/node_modules/smol-toml/dist/util.d.ts +1 -1
  97. package/node_modules/smol-toml/dist/util.js +36 -39
  98. package/node_modules/smol-toml/package.json +6 -6
  99. package/node_modules/strip-ansi/index.js +5 -0
  100. package/node_modules/strip-ansi/package.json +5 -5
  101. package/package.json +3 -5
  102. package/node_modules/@listr2/prompt-adapter-enquirer/dist/index.cjs +0 -127
  103. package/node_modules/@listr2/prompt-adapter-enquirer/dist/index.d.cts +0 -152
  104. package/node_modules/@listr2/prompt-adapter-enquirer/dist/index.d.ts +0 -152
  105. package/node_modules/@listr2/prompt-adapter-enquirer/dist/index.js +0 -92
  106. package/node_modules/chalk/package.json +0 -92
  107. package/node_modules/chalk/readme.md +0 -331
  108. package/node_modules/chalk/source/index.d.ts +0 -437
  109. package/node_modules/chalk/source/index.js +0 -261
  110. package/node_modules/chalk/source/utilities.js +0 -33
  111. package/node_modules/chalk/source/vendor/ansi-styles/index.d.ts +0 -299
  112. package/node_modules/chalk/source/vendor/ansi-styles/index.js +0 -261
  113. package/node_modules/chalk/source/vendor/supports-color/browser.d.ts +0 -1
  114. package/node_modules/chalk/source/vendor/supports-color/browser.js +0 -32
  115. package/node_modules/chalk/source/vendor/supports-color/index.d.ts +0 -55
  116. package/node_modules/chalk/source/vendor/supports-color/index.js +0 -206
  117. package/node_modules/colorette/LICENSE.md +0 -7
  118. package/node_modules/colorette/README.md +0 -134
  119. package/node_modules/colorette/index.cjs +0 -218
  120. package/node_modules/colorette/index.d.ts +0 -93
  121. package/node_modules/colorette/index.js +0 -150
  122. package/node_modules/colorette/package.json +0 -40
  123. package/node_modules/eventemitter3/LICENSE +0 -21
  124. package/node_modules/eventemitter3/README.md +0 -94
  125. package/node_modules/eventemitter3/dist/eventemitter3.esm.js +0 -347
  126. package/node_modules/eventemitter3/dist/eventemitter3.esm.min.js +0 -1
  127. package/node_modules/eventemitter3/dist/eventemitter3.esm.min.js.map +0 -1
  128. package/node_modules/eventemitter3/dist/eventemitter3.umd.js +0 -355
  129. package/node_modules/eventemitter3/dist/eventemitter3.umd.min.js +0 -1
  130. package/node_modules/eventemitter3/dist/eventemitter3.umd.min.js.map +0 -1
  131. package/node_modules/eventemitter3/index.d.ts +0 -135
  132. package/node_modules/eventemitter3/index.js +0 -336
  133. package/node_modules/eventemitter3/index.mjs +0 -4
  134. package/node_modules/eventemitter3/package.json +0 -67
  135. package/node_modules/figures/index.d.ts +0 -279
  136. package/node_modules/figures/index.js +0 -292
  137. package/node_modules/figures/package.json +0 -49
  138. package/node_modules/figures/readme.md +0 -337
  139. package/node_modules/listr2/dist/index.cjs +0 -2189
  140. package/node_modules/listr2/dist/index.d.ts +0 -1528
  141. package/node_modules/rfdc/.github/workflows/ci.yml +0 -21
  142. package/node_modules/rfdc/LICENSE +0 -15
  143. package/node_modules/rfdc/default.js +0 -3
  144. package/node_modules/rfdc/index.d.ts +0 -13
  145. package/node_modules/rfdc/index.js +0 -198
  146. package/node_modules/rfdc/index.test-d.ts +0 -13
  147. package/node_modules/rfdc/package.json +0 -73
  148. package/node_modules/rfdc/readme.md +0 -181
  149. package/node_modules/rfdc/test/index.js +0 -306
  150. package/node_modules/smol-toml/dist/date.d.ts.map +0 -1
  151. package/node_modules/smol-toml/dist/date.js.map +0 -1
  152. package/node_modules/smol-toml/dist/error.d.ts.map +0 -1
  153. package/node_modules/smol-toml/dist/error.js.map +0 -1
  154. package/node_modules/smol-toml/dist/extract.js.map +0 -1
  155. package/node_modules/smol-toml/dist/index.cjs.map +0 -1
  156. package/node_modules/smol-toml/dist/index.d.ts.map +0 -1
  157. package/node_modules/smol-toml/dist/index.js.map +0 -1
  158. package/node_modules/smol-toml/dist/parse.d.ts.map +0 -1
  159. package/node_modules/smol-toml/dist/parse.js.map +0 -1
  160. package/node_modules/smol-toml/dist/primitive.d.ts +0 -29
  161. package/node_modules/smol-toml/dist/primitive.d.ts.map +0 -1
  162. package/node_modules/smol-toml/dist/primitive.js.map +0 -1
  163. package/node_modules/smol-toml/dist/stringify.d.ts.map +0 -1
  164. package/node_modules/smol-toml/dist/stringify.js.map +0 -1
  165. package/node_modules/smol-toml/dist/struct.js.map +0 -1
  166. package/node_modules/smol-toml/dist/util.d.ts.map +0 -1
  167. package/node_modules/smol-toml/dist/util.js.map +0 -1
  168. package/node_modules/smol-toml/src/date.ts +0 -152
  169. package/node_modules/smol-toml/src/error.ts +0 -77
  170. package/node_modules/smol-toml/src/extract.ts +0 -113
  171. package/node_modules/smol-toml/src/index.ts +0 -42
  172. package/node_modules/smol-toml/src/parse.ts +0 -184
  173. package/node_modules/smol-toml/src/primitive.ts +0 -249
  174. package/node_modules/smol-toml/src/stringify.ts +0 -191
  175. package/node_modules/smol-toml/src/struct.ts +0 -202
  176. package/node_modules/smol-toml/src/util.ts +0 -106
  177. /package/node_modules/@listr2/{prompt-adapter-enquirer → prompt-adapter-inquirer}/LICENSE +0 -0
  178. /package/node_modules/{log-update/node_modules/ansi-escapes → ansi-escapes}/index.d.ts +0 -0
  179. /package/node_modules/{log-update/node_modules/ansi-escapes → ansi-escapes}/index.js +0 -0
  180. /package/node_modules/{chalk → ansi-escapes}/license +0 -0
  181. /package/node_modules/{figures → listr2/node_modules/string-width}/license +0 -0
  182. /package/node_modules/log-update/node_modules/{ansi-escapes → string-width}/license +0 -0
@@ -27,54 +27,55 @@
27
27
  */
28
28
  import { parseString } from './primitive.js';
29
29
  import { extractValue } from './extract.js';
30
- import { indexOfNewline, skipComment, skipVoid } from './util.js';
30
+ import { indexOfNewline, skipVoid } from './util.js';
31
31
  import { TomlError } from './error.js';
32
32
  let KEY_PART_RE = /^[a-zA-Z0-9-_]+[ \t]*$/;
33
33
  /** @internal */
34
- export function parseKey(str, ptr, end = '=') {
35
- let dot = ptr - 1;
34
+ export function parseKey(ctx, end = '=') {
35
+ let start = ctx.p;
36
+ let dot = start - 1;
36
37
  let parsed = [];
37
- let endPtr = str.indexOf(end, ptr);
38
+ let endPtr = ctx.s.indexOf(end, start);
38
39
  if (endPtr < 0) {
39
40
  throw new TomlError('incomplete key-value: cannot find end of key', {
40
- toml: str,
41
- ptr: ptr,
41
+ toml: ctx.s,
42
+ ptr: start,
42
43
  });
43
44
  }
44
45
  do {
45
- let c = str[(ptr = ++dot)];
46
+ let c = ctx.s.charCodeAt(ctx.p = ++dot);
46
47
  // If it's whitespace, ignore
47
- if (c !== ' ' && c !== '\t') {
48
+ if (c !== 0x20 && c !== 0x9 /* \t */) {
48
49
  // If it's a string
49
- if (c === '"' || c === "'") {
50
- if (c === str[ptr + 1] && c === str[ptr + 2]) {
50
+ if (c === 0x22 /* " */ || c === 0x27 /* ' */) {
51
+ if (c === ctx.s.charCodeAt(ctx.p + 1) && c === ctx.s.charCodeAt(ctx.p + 2)) {
51
52
  throw new TomlError('multiline strings are not allowed in keys', {
52
- toml: str,
53
- ptr: ptr,
53
+ toml: ctx.s,
54
+ ptr: ctx.p,
54
55
  });
55
56
  }
56
- let [part, eos] = parseString(str, ptr);
57
- dot = str.indexOf('.', eos);
58
- let strEnd = str.slice(eos, dot < 0 || dot > endPtr ? endPtr : dot);
57
+ let part = parseString(ctx);
58
+ dot = ctx.s.indexOf('.', ctx.p);
59
+ let strEnd = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
59
60
  let newLine = indexOfNewline(strEnd);
60
61
  if (newLine > -1) {
61
62
  throw new TomlError('newlines are not allowed in keys', {
62
- toml: str,
63
- ptr: ptr + dot + newLine,
63
+ toml: ctx.s,
64
+ ptr: newLine,
64
65
  });
65
66
  }
66
67
  if (strEnd.trimStart()) {
67
68
  throw new TomlError('found extra tokens after the string part', {
68
- toml: str,
69
- ptr: eos,
69
+ toml: ctx.s,
70
+ ptr: ctx.p,
70
71
  });
71
72
  }
72
- if (endPtr < eos) {
73
- endPtr = str.indexOf(end, eos);
73
+ if (endPtr < ctx.p) {
74
+ endPtr = ctx.s.indexOf(end, ctx.p);
74
75
  if (endPtr < 0) {
75
76
  throw new TomlError('incomplete key-value: cannot find end of key', {
76
- toml: str,
77
- ptr: ptr,
77
+ toml: ctx.s,
78
+ ptr: start,
78
79
  });
79
80
  }
80
81
  }
@@ -82,12 +83,12 @@ export function parseKey(str, ptr, end = '=') {
82
83
  }
83
84
  else {
84
85
  // Normal raw key part consumption and validation
85
- dot = str.indexOf('.', ptr);
86
- let part = str.slice(ptr, dot < 0 || dot > endPtr ? endPtr : dot);
86
+ dot = ctx.s.indexOf('.', ctx.p);
87
+ let part = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
87
88
  if (!KEY_PART_RE.test(part)) {
88
89
  throw new TomlError('only letter, numbers, dashes and underscores are allowed in keys', {
89
- toml: str,
90
- ptr: ptr,
90
+ toml: ctx.s,
91
+ ptr: ctx.p,
91
92
  });
92
93
  }
93
94
  parsed.push(part.trimEnd());
@@ -95,88 +96,84 @@ export function parseKey(str, ptr, end = '=') {
95
96
  }
96
97
  // Until there's no more dot
97
98
  } while (dot + 1 && dot < endPtr);
98
- return [parsed, skipVoid(str, endPtr + 1, true, true)];
99
+ ctx.p = endPtr + 1;
100
+ skipVoid(ctx, true, true);
101
+ return parsed;
99
102
  }
100
103
  /** @internal */
101
- export function parseInlineTable(str, ptr, depth, integersAsBigInt) {
104
+ export function parseInlineTable(ctx, integersAsBigInt) {
102
105
  let res = {};
103
106
  let seen = new Set();
104
107
  let c;
105
- ptr++;
106
- while ((c = str[ptr++]) !== '}' && c) {
107
- if (c === ',') {
108
- throw new TomlError('expected value, found comma', {
109
- toml: str,
110
- ptr: ptr - 1,
111
- });
108
+ ctx.p++;
109
+ while (ctx.p < ctx.s.length) {
110
+ skipVoid(ctx);
111
+ if ((c = ctx.s.charCodeAt(ctx.p)) === 0x7d /* } */) {
112
+ ctx.p++;
113
+ return res;
112
114
  }
113
- else if (c === '#')
114
- ptr = skipComment(str, ptr);
115
- else if (c !== ' ' && c !== '\t' && c !== '\n' && c !== '\r') {
116
- let k;
117
- let t = res;
118
- let hasOwn = false;
119
- let [key, keyEndPtr] = parseKey(str, ptr - 1);
120
- for (let i = 0; i < key.length; i++) {
121
- if (i)
122
- t = hasOwn ? t[k] : (t[k] = {});
123
- k = key[i];
124
- if ((hasOwn = Object.hasOwn(t, k)) && (typeof t[k] !== 'object' || seen.has(t[k]))) {
125
- throw new TomlError('trying to redefine an already defined value', {
126
- toml: str,
127
- ptr: ptr,
128
- });
129
- }
130
- if (!hasOwn && k === '__proto__') {
131
- Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
132
- }
133
- }
134
- if (hasOwn) {
115
+ let k;
116
+ let t = res;
117
+ let hasOwn = false;
118
+ let p = ctx.p;
119
+ let key = parseKey(ctx);
120
+ for (let i = 0; i < key.length; i++) {
121
+ if (i)
122
+ t = hasOwn ? t[k] : (t[k] = {});
123
+ k = key[i];
124
+ if ((hasOwn = Object.hasOwn(t, k)) && (typeof t[k] !== 'object' || seen.has(t[k]))) {
135
125
  throw new TomlError('trying to redefine an already defined value', {
136
- toml: str,
137
- ptr: ptr,
126
+ toml: ctx.s,
127
+ ptr: p,
138
128
  });
139
129
  }
140
- let [value, valueEndPtr] = extractValue(str, keyEndPtr, '}', depth - 1, integersAsBigInt);
141
- seen.add(value);
142
- t[k] = value;
143
- ptr = valueEndPtr;
130
+ if (!hasOwn && k === '__proto__') {
131
+ Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
132
+ }
133
+ }
134
+ if (hasOwn) {
135
+ throw new TomlError('trying to redefine an already defined value', {
136
+ toml: ctx.s,
137
+ ptr: ctx.p,
138
+ });
139
+ }
140
+ let value = extractValue(ctx, 0x7d /* } */, integersAsBigInt);
141
+ seen.add(t[k] = value);
142
+ skipVoid(ctx);
143
+ if ((c = ctx.s.charCodeAt(ctx.p++)) === 0x7d /* } */) {
144
+ return res;
145
+ }
146
+ if (c !== 0x2c /* , */) {
147
+ throw new TomlError('expected comma or end of structure', { toml: ctx.s, ptr: ctx.p - 1 });
144
148
  }
145
149
  }
146
- if (!c) {
147
- throw new TomlError('unfinished table encountered', {
148
- toml: str,
149
- ptr: ptr,
150
- });
151
- }
152
- return [res, ptr];
150
+ throw new TomlError('unfinished table encountered', {
151
+ toml: ctx.s,
152
+ ptr: ctx.p,
153
+ });
153
154
  }
154
155
  /** @internal */
155
- export function parseArray(str, ptr, depth, integersAsBigInt) {
156
+ export function parseArray(ctx, integersAsBigInt) {
156
157
  let res = [];
157
158
  let c;
158
- ptr++;
159
- while ((c = str[ptr++]) !== ']' && c) {
160
- if (c === ',') {
161
- throw new TomlError('expected value, found comma', {
162
- toml: str,
163
- ptr: ptr - 1,
164
- });
159
+ ctx.p++;
160
+ while (ctx.p < ctx.s.length) {
161
+ skipVoid(ctx);
162
+ if ((c = ctx.s.charCodeAt(ctx.p)) === 0x5d /* ] */) {
163
+ ctx.p++;
164
+ return res;
165
165
  }
166
- else if (c === '#')
167
- ptr = skipComment(str, ptr);
168
- else if (c !== ' ' && c !== '\t' && c !== '\n' && c !== '\r') {
169
- let e = extractValue(str, ptr - 1, ']', depth - 1, integersAsBigInt);
170
- res.push(e[0]);
171
- ptr = e[1];
166
+ res.push(extractValue(ctx, 0x5d /* ] */, integersAsBigInt));
167
+ skipVoid(ctx);
168
+ if ((c = ctx.s.charCodeAt(ctx.p++)) === 0x5d /* ] */) {
169
+ return res;
170
+ }
171
+ if (c !== 0x2c /* , */) {
172
+ throw new TomlError('expected comma or end of structure', { toml: ctx.s, ptr: ctx.p - 1 });
172
173
  }
173
174
  }
174
- if (!c) {
175
- throw new TomlError('unfinished array encountered', {
176
- toml: str,
177
- ptr: ptr,
178
- });
179
- }
180
- return [res, ptr];
175
+ throw new TomlError('unfinished array encountered', {
176
+ toml: ctx.s,
177
+ ptr: ctx.p,
178
+ });
181
179
  }
182
- //# sourceMappingURL=struct.js.map
@@ -26,6 +26,7 @@
26
26
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
27
  */
28
28
  import type { TomlDate } from './date.js';
29
+ export type IntegersAsBigInt = undefined | boolean | 'asNeeded';
29
30
  export type TomlPrimitive = string | number | bigint | boolean | TomlDate;
30
31
  export type TomlTable = {
31
32
  [key: string]: TomlValue;
@@ -35,4 +36,3 @@ export type TomlTableWithoutBigInt = {
35
36
  [key: string]: TomlValueWithoutBigInt;
36
37
  };
37
38
  export type TomlValueWithoutBigInt = Exclude<TomlPrimitive, bigint> | TomlValueWithoutBigInt[] | TomlTableWithoutBigInt;
38
- //# sourceMappingURL=util.d.ts.map
@@ -27,66 +27,63 @@
27
27
  */
28
28
  import { TomlError } from './error.js';
29
29
  /** @internal */
30
- export function indexOfNewline(str, start = 0, end = str.length) {
30
+ export function indexOfNewline(str, start = 0) {
31
31
  let idx = str.indexOf('\n', start);
32
- if (str[idx - 1] === '\r')
32
+ if (str.charCodeAt(idx - 1) === 0xd /* \r */)
33
33
  idx--;
34
- return idx <= end ? idx : -1;
34
+ return idx;
35
35
  }
36
36
  /** @internal */
37
- export function skipComment(str, ptr) {
38
- for (let i = ptr; i < str.length; i++) {
39
- let c = str[i];
40
- if (c === '\n')
41
- return i;
42
- if (c === '\r' && str[i + 1] === '\n')
43
- return i + 1;
44
- if ((c < '\x20' && c !== '\t') || c === '\x7f') {
37
+ export function skipComment(ctx) {
38
+ for (; ctx.p < ctx.s.length; ctx.p++) {
39
+ let c = ctx.s.charCodeAt(ctx.p);
40
+ if (c === 0xa /* \n */)
41
+ break;
42
+ if (c === 0xd /* \r */ && ctx.s.charCodeAt(ctx.p + 1) === 0xa /* \n */) {
43
+ ctx.p++;
44
+ break;
45
+ }
46
+ if ((c < 0x20 && c !== 0x9 /* \t */) || c === 0x7f) {
45
47
  throw new TomlError('control characters are not allowed in comments', {
46
- toml: str,
47
- ptr: ptr,
48
+ toml: ctx.s,
49
+ ptr: ctx.p,
48
50
  });
49
51
  }
50
52
  }
51
- return str.length;
52
53
  }
53
54
  /** @internal */
54
- export function skipVoid(str, ptr, banNewLines, banComments) {
55
+ export function skipVoid(ctx, banNewLines, banComments) {
55
56
  let c;
56
57
  while (1) {
57
- while ((c = str[ptr]) === ' ' || c === '\t' || (!banNewLines && (c === '\n' || (c === '\r' && str[ptr + 1] === '\n'))))
58
- ptr++;
59
- // Tucking the return statement here would save 5 characters >:)
60
- // But TypeScript fails to detect there is no way to exit the loop so it complains about the lack of final return
61
- if (banComments || c !== '#')
58
+ while ((c = ctx.s.charCodeAt(ctx.p)) === 0x20 ||
59
+ c === 0x9 /* \t */ ||
60
+ (!banNewLines &&
61
+ (c === 0xa /* \n */ || (c === 0xd /* \r */ && ctx.s.charCodeAt(ctx.p + 1) === 0xa /* \n */))))
62
+ ctx.p++;
63
+ if (banComments || c !== 0x23 /* # */)
62
64
  break;
63
- ptr = skipComment(str, ptr);
65
+ skipComment(ctx);
64
66
  }
65
- return ptr;
66
67
  }
67
68
  /** @internal */
68
- export function skipUntil(str, ptr, sep, end, banNewLines = false) {
69
+ export function skipUntil(ctx, sep, end) {
70
+ let ptr = ctx.p;
69
71
  if (!end) {
70
- ptr = indexOfNewline(str, ptr);
71
- return ptr < 0 ? str.length : ptr;
72
+ ptr = indexOfNewline(ctx.s, ptr);
73
+ ctx.p = ptr < 0 ? ctx.s.length : ptr;
74
+ return;
72
75
  }
73
- for (let i = ptr; i < str.length; i++) {
74
- let c = str[i];
75
- if (c === '#') {
76
- i = indexOfNewline(str, i);
77
- if (i < 0)
78
- break;
79
- }
80
- else if (c === sep) {
81
- return i + 1;
76
+ for (; ctx.p < ctx.s.length; ctx.p++) {
77
+ let c = ctx.s.charCodeAt(ctx.p);
78
+ if (c === 0x23 /* # */) {
79
+ skipComment(ctx);
82
80
  }
83
- else if (c === end || (banNewLines && (c === '\n' || (c === '\r' && str[i + 1] === '\n')))) {
84
- return i;
81
+ else if (c === end || c === sep) {
82
+ return;
85
83
  }
86
84
  }
87
85
  throw new TomlError('cannot find end of structure', {
88
- toml: str,
89
- ptr: ptr,
86
+ toml: ctx.s,
87
+ ptr,
90
88
  });
91
89
  }
92
- //# sourceMappingURL=util.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smol-toml",
3
- "version": "1.7.1",
3
+ "version": "1.8.0",
4
4
  "description": "A small, fast, and correct TOML parser/serializer",
5
5
  "keywords": [
6
6
  "parser",
@@ -18,7 +18,6 @@
18
18
  "files": [
19
19
  "README.md",
20
20
  "LICENSE",
21
- "src",
22
21
  "dist"
23
22
  ],
24
23
  "type": "module",
@@ -37,19 +36,20 @@
37
36
  "devDependencies": {
38
37
  "@mitata/counters": "^0.0.8",
39
38
  "@tsconfig/node-lts": "^24.0.0",
39
+ "@tsconfig/node-ts": "^23.6.4",
40
40
  "@tsconfig/strictest": "^2.0.8",
41
- "@types/node": "^26.1.1",
41
+ "@types/node": "^26.2.0",
42
42
  "mitata": "^1.0.34",
43
43
  "pin-github-action": "^3.5.1",
44
- "rolldown": "^1.2.0",
44
+ "rolldown": "^1.2.3",
45
45
  "typescript": "^7.0.2",
46
- "vite": "^7.3.5",
46
+ "vite": "^7.3.6",
47
47
  "vitest": "^4.1.10"
48
48
  },
49
49
  "devEngines": {
50
50
  "packageManager": {
51
51
  "name": "pnpm",
52
- "version": "11.17.0",
52
+ "version": "11.21.0",
53
53
  "onFail": "error"
54
54
  },
55
55
  "runtime": {
@@ -7,6 +7,11 @@ export default function stripAnsi(string) {
7
7
  throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
8
8
  }
9
9
 
10
+ // Fast path: ANSI codes require ESC (7-bit) or CSI (8-bit) introducer
11
+ if (!string.includes('\u001B') && !string.includes('\u009B')) {
12
+ return string;
13
+ }
14
+
10
15
  // Even though the regex is global, we don't need to reset the `.lastIndex`
11
16
  // because unlike `.exec()` and `.test()`, `.replace()` does it automatically
12
17
  // and doing it manually has a performance penalty.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "strip-ansi",
3
- "version": "7.1.2",
3
+ "version": "7.2.0",
4
4
  "description": "Strip ANSI escape codes from a string",
5
5
  "license": "MIT",
6
6
  "repository": "chalk/strip-ansi",
@@ -49,11 +49,11 @@
49
49
  "text"
50
50
  ],
51
51
  "dependencies": {
52
- "ansi-regex": "^6.0.1"
52
+ "ansi-regex": "^6.2.2"
53
53
  },
54
54
  "devDependencies": {
55
- "ava": "^3.15.0",
56
- "tsd": "^0.17.0",
57
- "xo": "^0.44.0"
55
+ "ava": "^6.4.1",
56
+ "tsd": "^0.33.0",
57
+ "xo": "^1.2.3"
58
58
  }
59
59
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node-core/utils",
3
- "version": "7.2.0",
3
+ "version": "7.2.1",
4
4
  "description": "Utilities for Node.js core collaborators",
5
5
  "type": "module",
6
6
  "engines": {
@@ -35,19 +35,17 @@
35
35
  "bundleDependencies": true,
36
36
  "dependencies": {
37
37
  "@inquirer/prompts": "^7.4.1",
38
- "@listr2/prompt-adapter-enquirer": "^2.0.12",
38
+ "@listr2/prompt-adapter-inquirer": "^4.2.7",
39
39
  "@node-core/caritat": "^1.6.0",
40
40
  "@pkgjs/nv": "^0.3.0",
41
41
  "branch-diff": "^3.1.1",
42
- "chalk": "^6.0.0",
43
42
  "changelog-maker": "^4.4.1",
44
43
  "cheerio": "^1.0.0",
45
44
  "core-validate-commit": "^6.0.0",
46
- "figures": "^6.1.0",
47
45
  "ghauth": "^7.0.1",
48
46
  "git-secure-tag": "^2.3.1",
49
47
  "js-yaml": "^5.2.1",
50
- "listr2": "^9.0.5",
48
+ "listr2": "^11.1.0",
51
49
  "ora": "^9.0.0",
52
50
  "semver": "^7.7.1",
53
51
  "smol-toml": "^1.7.0",
@@ -1,127 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
- var __export = (target, all) => {
10
- for (var name in all)
11
- __defProp(target, name, { get: all[name], enumerable: true });
12
- };
13
- var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from))
16
- if (!__hasOwnProp.call(to, key) && key !== except)
17
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
- }
19
- return to;
20
- };
21
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
- // If the importer is in node compatibility mode or this is not an ESM
23
- // file that has been converted to a CommonJS file using a Babel-
24
- // compatible transform (i.e. "__esModule" has not been set), then set
25
- // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
- mod
28
- ));
29
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
-
31
- // src/index.ts
32
- var src_exports = {};
33
- __export(src_exports, {
34
- ListrEnquirerPromptAdapter: () => ListrEnquirerPromptAdapter
35
- });
36
- module.exports = __toCommonJS(src_exports);
37
-
38
- // src/prompt.ts
39
- var import_listr2 = require("listr2");
40
- var ListrEnquirerPromptAdapter = class extends import_listr2.ListrPromptAdapter {
41
- static {
42
- __name(this, "ListrEnquirerPromptAdapter");
43
- }
44
- error;
45
- prompt;
46
- /**
47
- * Get the current running instance of `enquirer`.
48
- */
49
- get instance() {
50
- return this.prompt;
51
- }
52
- /**
53
- * Create a new prompt with `enquirer`.
54
- *
55
- * `enquirer` is a peer dependency that must be installed seperately.
56
- */
57
- async run(options, settings) {
58
- if (!Array.isArray(options)) {
59
- options = [{ ...options, name: "default" }];
60
- } else if (options.length === 1) {
61
- options = options.map((option) => {
62
- return { ...option, name: "default" };
63
- });
64
- }
65
- options = options.map((option) => {
66
- return {
67
- onCancel: /* @__PURE__ */ __name(() => {
68
- this.error = new import_listr2.PromptError("Cancelled prompt.");
69
- return true;
70
- }, "onCancel"),
71
- ...option,
72
- stdout: settings?.stdout ?? this.wrapper.stdout(import_listr2.ListrTaskEventType.PROMPT)
73
- };
74
- });
75
- let enquirer;
76
- if (settings?.enquirer) {
77
- enquirer = settings.enquirer;
78
- } else {
79
- try {
80
- enquirer = await import("enquirer").then((imported) => imported.default ? new imported.default() : new imported());
81
- } catch {
82
- this.reportFailed();
83
- throw new import_listr2.PromptError("Enquirer is a optional peer dependency that must be installed separately.");
84
- }
85
- }
86
- this.reportStarted();
87
- this.task.on(import_listr2.ListrTaskEventType.STATE, (event) => {
88
- if (event === import_listr2.ListrTaskState.SKIPPED && this.prompt && !this.error) {
89
- this.cancel({ throw: false });
90
- }
91
- });
92
- let response;
93
- try {
94
- response = await enquirer.once("prompt", (prompt) => this.prompt = prompt).prompt(options);
95
- } catch (e) {
96
- this.reportFailed();
97
- if (this.error) {
98
- throw this.error;
99
- }
100
- throw e;
101
- }
102
- this.reportCompleted();
103
- if (options.length === 1) {
104
- return response.default;
105
- } else {
106
- return response;
107
- }
108
- }
109
- /**
110
- * Cancel the ongoing prompt.
111
- */
112
- cancel(options) {
113
- if (!this.prompt || this.error) {
114
- return;
115
- }
116
- if (options?.throw) {
117
- this.prompt.cancel();
118
- } else {
119
- this.prompt.submit();
120
- }
121
- this.reportFailed();
122
- }
123
- };
124
- // Annotate the CommonJS export names for ESM import in node:
125
- 0 && (module.exports = {
126
- ListrEnquirerPromptAdapter
127
- });