@node-core/utils 7.3.1 → 7.4.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 (41) hide show
  1. package/bin/ncu-ci.js +39 -0
  2. package/lib/ci/availability.js +24 -0
  3. package/lib/ci/ci_utils.js +13 -0
  4. package/lib/ci/failure_file_scanner.js +72 -21
  5. package/lib/ci/jenkins.js +23 -0
  6. package/lib/ci/resumable_build.js +86 -0
  7. package/lib/ci/resume_ci.js +64 -25
  8. package/lib/ci/run_ci.js +39 -9
  9. package/lib/ci/workload.js +72 -0
  10. package/lib/update-v8/deps.js +4 -1
  11. package/node_modules/branch-diff/.github/dependabot.yml +14 -2
  12. package/node_modules/branch-diff/.github/workflows/test-and-release.yml +4 -15
  13. package/node_modules/branch-diff/CHANGELOG.md +24 -0
  14. package/node_modules/branch-diff/package.json +35 -3
  15. package/node_modules/js-yaml/dist/browser/js-yaml.esm.min.mjs +2 -2
  16. package/node_modules/js-yaml/dist/browser/js-yaml.esm.min.mjs.map +1 -1
  17. package/node_modules/js-yaml/dist/browser/js-yaml.umd.min.js +1 -1
  18. package/node_modules/js-yaml/dist/browser/js-yaml.umd.min.js.map +1 -1
  19. package/node_modules/js-yaml/dist/js-yaml.cjs.js +2 -1
  20. package/node_modules/js-yaml/dist/js-yaml.cjs.js.map +1 -1
  21. package/node_modules/js-yaml/dist/js-yaml.mjs +2 -1
  22. package/node_modules/js-yaml/dist/js-yaml.mjs.map +1 -1
  23. package/node_modules/js-yaml/package.json +1 -1
  24. package/node_modules/smol-toml/README.md +460 -273
  25. package/node_modules/smol-toml/dist/date.js +50 -21
  26. package/node_modules/smol-toml/dist/error.d.ts +1 -2
  27. package/node_modules/smol-toml/dist/error.js +6 -2
  28. package/node_modules/smol-toml/dist/extract.js +240 -20
  29. package/node_modules/smol-toml/dist/index.cjs +409 -373
  30. package/node_modules/smol-toml/dist/index.d.ts +5 -4
  31. package/node_modules/smol-toml/dist/index.js +2 -1
  32. package/node_modules/smol-toml/dist/parse.d.ts +38 -1
  33. package/node_modules/smol-toml/dist/parse.js +52 -37
  34. package/node_modules/smol-toml/dist/primitive.js +23 -110
  35. package/node_modules/smol-toml/dist/stringify.d.ts +2 -1
  36. package/node_modules/smol-toml/dist/stringify.js +74 -36
  37. package/node_modules/smol-toml/dist/struct.js +76 -99
  38. package/node_modules/smol-toml/dist/util.d.ts +6 -1
  39. package/node_modules/smol-toml/dist/util.js +4 -36
  40. package/node_modules/smol-toml/package.json +8 -8
  41. package/package.json +1 -1
@@ -27,85 +27,69 @@
27
27
  */
28
28
  import { parseString } from './primitive.js';
29
29
  import { extractValue } from './extract.js';
30
- import { indexOfNewline, skipVoid } from './util.js';
30
+ import { skipVoid } from './util.js';
31
31
  import { TomlError } from './error.js';
32
- let KEY_PART_RE = /^[a-zA-Z0-9-_]+[ \t]*$/;
33
32
  /** @internal */
34
- export function parseKey(ctx, end = '=') {
35
- let start = ctx.p;
36
- let dot = start - 1;
33
+ export function parseKey(ctx, end = 0x3d /* = */) {
34
+ // States:
35
+ // 0: before first char
36
+ // 1: parsing bare key
37
+ // 2: after key component
38
+ let startPtr;
39
+ let state = 0;
37
40
  let parsed = [];
38
- let endPtr = ctx.s.indexOf(end, start);
39
- if (endPtr < 0) {
40
- throw new TomlError('incomplete key-value: cannot find end of key', {
41
- toml: ctx.s,
42
- ptr: start,
43
- });
44
- }
41
+ let sliceStart;
42
+ let c = ctx.s.charCodeAt(startPtr = ctx.p);
45
43
  do {
46
- let c = ctx.s.charCodeAt(ctx.p = ++dot);
47
- // If it's whitespace, ignore
48
- if (c !== 0x20 && c !== 0x9 /* \t */) {
49
- // If it's a string
50
- if (c === 0x22 /* " */ || c === 0x27 /* ' */) {
51
- if (c === ctx.s.charCodeAt(ctx.p + 1) && c === ctx.s.charCodeAt(ctx.p + 2)) {
52
- throw new TomlError('multiline strings are not allowed in keys', {
53
- toml: ctx.s,
54
- ptr: ctx.p,
55
- });
56
- }
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);
60
- let newLine = indexOfNewline(strEnd);
61
- if (newLine > -1) {
62
- throw new TomlError('newlines are not allowed in keys', {
63
- toml: ctx.s,
64
- ptr: newLine,
65
- });
66
- }
67
- if (strEnd.trimStart()) {
68
- throw new TomlError('found extra tokens after the string part', {
69
- toml: ctx.s,
70
- ptr: ctx.p,
71
- });
72
- }
73
- if (endPtr < ctx.p) {
74
- endPtr = ctx.s.indexOf(end, ctx.p);
75
- if (endPtr < 0) {
76
- throw new TomlError('incomplete key-value: cannot find end of key', {
77
- toml: ctx.s,
78
- ptr: start,
79
- });
80
- }
81
- }
82
- parsed.push(part);
83
- }
84
- else {
85
- // Normal raw key part consumption and validation
86
- dot = ctx.s.indexOf('.', ctx.p);
87
- let part = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
88
- if (!KEY_PART_RE.test(part)) {
89
- throw new TomlError('only letter, numbers, dashes and underscores are allowed in keys', {
90
- toml: ctx.s,
91
- ptr: ctx.p,
92
- });
93
- }
94
- parsed.push(part.trimEnd());
44
+ // End of key
45
+ if (c === end) {
46
+ if (!state)
47
+ TomlError.x('unexpected end of key', ctx);
48
+ if (state === 1)
49
+ parsed.push(ctx.s.slice(sliceStart, ctx.p));
50
+ return ctx.p++, parsed;
51
+ }
52
+ // Dotted key separator
53
+ else if (c === 0x2e /* . */) {
54
+ if (!state)
55
+ TomlError.x('illegal empty bare key', ctx);
56
+ if (state === 1)
57
+ parsed.push(ctx.s.slice(sliceStart, ctx.p));
58
+ state = 0;
59
+ }
60
+ // Quoted key
61
+ else if (!state && (c === 0x22 /* " */ || c === 0x27 /* ' */)) {
62
+ if (c === ctx.s.charCodeAt(ctx.p + 1) && c === ctx.s.charCodeAt(ctx.p + 2))
63
+ TomlError.x('illegal quoted key: multiline strings are not allowed', ctx);
64
+ parsed.push(parseString(ctx));
65
+ state = 2;
66
+ ctx.p--;
67
+ }
68
+ // Whitespace; no-op in state 0 and 2, end of bare key in state 1
69
+ else if (c === 0x20 || c === 0x9 /* \t */) {
70
+ if (state === 1) {
71
+ parsed.push(ctx.s.slice(sliceStart, ctx.p));
72
+ state = 2;
95
73
  }
96
74
  }
97
- // Until there's no more dot
98
- } while (dot + 1 && dot < endPtr);
99
- ctx.p = endPtr + 1;
100
- skipVoid(ctx, true, true);
101
- return parsed;
75
+ // If state is post-key, no character is allowed; otherwise ensure it's a bare-key component
76
+ else if (state === 2 || (c < 0x30 && c !== 0x2d /* - */) || (c > 0x39 && c < 0x41) || (c > 0x5a && c < 0x61 && c !== 0x5f /* _ */) || c > 0x7a) {
77
+ TomlError.x('illegal character in key', ctx);
78
+ }
79
+ // Illegal character
80
+ else if (!state) {
81
+ state = 1;
82
+ sliceStart = ctx.p;
83
+ }
84
+ } while (c = ctx.s.charCodeAt(++ctx.p));
85
+ TomlError.x('incomplete key-value: cannot find end of key', ctx, startPtr);
102
86
  }
103
87
  /** @internal */
104
- export function parseInlineTable(ctx, integersAsBigInt) {
105
- let res = {};
88
+ export function parseInlineTable(ctx) {
89
+ let startPtr = ctx.p++;
90
+ let res = Object.create(null);
106
91
  let seen = new Set();
107
92
  let c;
108
- ctx.p++;
109
93
  while (ctx.p < ctx.s.length) {
110
94
  skipVoid(ctx);
111
95
  if ((c = ctx.s.charCodeAt(ctx.p)) === 0x7d /* } */) {
@@ -115,65 +99,58 @@ export function parseInlineTable(ctx, integersAsBigInt) {
115
99
  let k;
116
100
  let t = res;
117
101
  let hasOwn = false;
118
- let p = ctx.p;
102
+ let errPtr = ctx.p;
119
103
  let key = parseKey(ctx);
120
104
  for (let i = 0; i < key.length; i++) {
121
105
  if (i)
122
- t = hasOwn ? t[k] : (t[k] = {});
106
+ t = hasOwn ? t[k] : (t[k] = Object.create(null));
123
107
  k = key[i];
124
108
  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: ctx.s,
127
- ptr: p,
128
- });
109
+ TomlError.x('trying to redefine an already defined value', ctx, errPtr);
110
+ }
111
+ let unsafe = k === '__proto__';
112
+ if (ctx.uk && (unsafe || k === 'constructor')) {
113
+ t = ctx.uk !== 1 && TomlError.x('document contains an unsafe property', ctx, errPtr);
114
+ break;
129
115
  }
130
- if (!hasOwn && k === '__proto__') {
116
+ if (!hasOwn && unsafe) {
131
117
  Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
132
118
  }
133
119
  }
134
120
  if (hasOwn) {
135
- throw new TomlError('trying to redefine an already defined value', {
136
- toml: ctx.s,
137
- ptr: ctx.p,
138
- });
121
+ TomlError.x('trying to redefine an already defined value', ctx, errPtr);
139
122
  }
140
- let value = extractValue(ctx, 0x7d /* } */, integersAsBigInt);
141
- seen.add(t[k] = value);
123
+ skipVoid(ctx, true, true);
124
+ let value = extractValue(ctx, 0x7d /* } */);
125
+ if (t && typeof (t[k] = value) === 'object')
126
+ seen.add(value);
142
127
  skipVoid(ctx);
143
128
  if ((c = ctx.s.charCodeAt(ctx.p++)) === 0x7d /* } */) {
144
129
  return res;
145
130
  }
146
- if (c !== 0x2c /* , */) {
147
- throw new TomlError('expected comma or end of structure', { toml: ctx.s, ptr: ctx.p - 1 });
148
- }
131
+ if (c !== 0x2c /* , */)
132
+ TomlError.x('expected comma or end of structure', ctx, ctx.p - 1);
149
133
  }
150
- throw new TomlError('unfinished table encountered', {
151
- toml: ctx.s,
152
- ptr: ctx.p,
153
- });
134
+ TomlError.x('unfinished table', ctx, startPtr);
154
135
  }
155
136
  /** @internal */
156
- export function parseArray(ctx, integersAsBigInt) {
137
+ export function parseArray(ctx) {
138
+ let startPtr = ctx.p++;
157
139
  let res = [];
158
140
  let c;
159
- ctx.p++;
160
141
  while (ctx.p < ctx.s.length) {
161
142
  skipVoid(ctx);
162
143
  if ((c = ctx.s.charCodeAt(ctx.p)) === 0x5d /* ] */) {
163
144
  ctx.p++;
164
145
  return res;
165
146
  }
166
- res.push(extractValue(ctx, 0x5d /* ] */, integersAsBigInt));
147
+ res.push(extractValue(ctx, 0x5d /* ] */));
167
148
  skipVoid(ctx);
168
149
  if ((c = ctx.s.charCodeAt(ctx.p++)) === 0x5d /* ] */) {
169
150
  return res;
170
151
  }
171
- if (c !== 0x2c /* , */) {
172
- throw new TomlError('expected comma or end of structure', { toml: ctx.s, ptr: ctx.p - 1 });
173
- }
152
+ if (c !== 0x2c /* , */)
153
+ TomlError.x('expected comma or end of structure', ctx, ctx.p - 1);
174
154
  }
175
- throw new TomlError('unfinished array encountered', {
176
- toml: ctx.s,
177
- ptr: ctx.p,
178
- });
155
+ TomlError.x('unfinished array', ctx, startPtr);
179
156
  }
@@ -26,8 +26,12 @@
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
+ type _Temporal = typeof globalThis extends {
30
+ Temporal: infer T;
31
+ } ? T : never;
32
+ type AnyTemporalDateTime = InstanceType<_Temporal['Instant']> | InstanceType<_Temporal['PlainDate']> | InstanceType<_Temporal['PlainDateTime']> | InstanceType<_Temporal['PlainTime']> | InstanceType<_Temporal['ZonedDateTime']>;
29
33
  export type IntegersAsBigInt = undefined | boolean | 'asNeeded';
30
- export type TomlPrimitive = string | number | bigint | boolean | TomlDate;
34
+ export type TomlPrimitive = string | number | bigint | boolean | TomlDate | AnyTemporalDateTime;
31
35
  export type TomlTable = {
32
36
  [key: string]: TomlValue;
33
37
  };
@@ -36,3 +40,4 @@ export type TomlTableWithoutBigInt = {
36
40
  [key: string]: TomlValueWithoutBigInt;
37
41
  };
38
42
  export type TomlValueWithoutBigInt = Exclude<TomlPrimitive, bigint> | TomlValueWithoutBigInt[] | TomlTableWithoutBigInt;
43
+ export {};
@@ -27,13 +27,6 @@
27
27
  */
28
28
  import { TomlError } from './error.js';
29
29
  /** @internal */
30
- export function indexOfNewline(str, start = 0) {
31
- let idx = str.indexOf('\n', start);
32
- if (str.charCodeAt(idx - 1) === 0xd /* \r */)
33
- idx--;
34
- return idx;
35
- }
36
- /** @internal */
37
30
  export function skipComment(ctx) {
38
31
  for (; ctx.p < ctx.s.length; ctx.p++) {
39
32
  let c = ctx.s.charCodeAt(ctx.p);
@@ -44,46 +37,21 @@ export function skipComment(ctx) {
44
37
  break;
45
38
  }
46
39
  if ((c < 0x20 && c !== 0x9 /* \t */) || c === 0x7f) {
47
- throw new TomlError('control characters are not allowed in comments', {
48
- toml: ctx.s,
49
- ptr: ctx.p,
50
- });
40
+ TomlError.x('control characters are not allowed in comments', ctx);
51
41
  }
52
42
  }
53
43
  }
54
44
  /** @internal */
55
45
  export function skipVoid(ctx, banNewLines, banComments) {
56
46
  let c;
57
- while (1) {
58
- while ((c = ctx.s.charCodeAt(ctx.p)) === 0x20 ||
47
+ while (ctx.p < ctx.s.length) {
48
+ while (ctx.p < ctx.s.length && ((c = ctx.s.charCodeAt(ctx.p)) === 0x20 ||
59
49
  c === 0x9 /* \t */ ||
60
50
  (!banNewLines &&
61
- (c === 0xa /* \n */ || (c === 0xd /* \r */ && ctx.s.charCodeAt(ctx.p + 1) === 0xa /* \n */))))
51
+ (c === 0xa /* \n */ || (c === 0xd /* \r */ && ctx.s.charCodeAt(ctx.p + 1) === 0xa /* \n */)))))
62
52
  ctx.p++;
63
53
  if (banComments || c !== 0x23 /* # */)
64
54
  break;
65
55
  skipComment(ctx);
66
56
  }
67
57
  }
68
- /** @internal */
69
- export function skipUntil(ctx, sep, end) {
70
- let ptr = ctx.p;
71
- if (!end) {
72
- ptr = indexOfNewline(ctx.s, ptr);
73
- ctx.p = ptr < 0 ? ctx.s.length : ptr;
74
- return;
75
- }
76
- for (; ctx.p < ctx.s.length; ctx.p++) {
77
- let c = ctx.s.charCodeAt(ctx.p);
78
- if (c === 0x23 /* # */) {
79
- skipComment(ctx);
80
- }
81
- else if (c === end || c === sep) {
82
- return;
83
- }
84
- }
85
- throw new TomlError('cannot find end of structure', {
86
- toml: ctx.s,
87
- ptr,
88
- });
89
- }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smol-toml",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "description": "A small, fast, and correct TOML parser/serializer",
5
5
  "keywords": [
6
6
  "parser",
@@ -35,21 +35,21 @@
35
35
  },
36
36
  "devDependencies": {
37
37
  "@mitata/counters": "^0.0.8",
38
- "@tsconfig/node-lts": "^24.0.0",
38
+ "@tsconfig/node-lts": "^24.0.1",
39
39
  "@tsconfig/node-ts": "^23.6.4",
40
40
  "@tsconfig/strictest": "^2.0.8",
41
- "@types/node": "^26.2.0",
41
+ "@types/node": "^26.6.2",
42
42
  "mitata": "^1.0.34",
43
- "pin-github-action": "^3.5.1",
44
- "rolldown": "^1.2.3",
43
+ "pin-github-action": "^3.5.2",
44
+ "rolldown": "^1.2.9",
45
45
  "typescript": "^7.0.2",
46
- "vite": "^7.3.6",
47
- "vitest": "^4.1.10"
46
+ "vite": "^8.3.0",
47
+ "vitest": "^5.0.1"
48
48
  },
49
49
  "devEngines": {
50
50
  "packageManager": {
51
51
  "name": "pnpm",
52
- "version": "11.21.0",
52
+ "version": "12.5.1",
53
53
  "onFail": "error"
54
54
  },
55
55
  "runtime": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node-core/utils",
3
- "version": "7.3.1",
3
+ "version": "7.4.1",
4
4
  "description": "Utilities for Node.js core collaborators",
5
5
  "type": "module",
6
6
  "engines": {