@socketsecurity/lib 5.25.1 → 5.26.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 (147) hide show
  1. package/CHANGELOG.md +344 -1184
  2. package/README.md +1 -1
  3. package/dist/abort.js +7 -6
  4. package/dist/agent.js +16 -15
  5. package/dist/ansi.js +3 -2
  6. package/dist/archives.js +18 -17
  7. package/dist/argv/flags.js +29 -28
  8. package/dist/argv/parse.js +4 -3
  9. package/dist/arrays.js +3 -2
  10. package/dist/bin.js +12 -11
  11. package/dist/cacache.js +16 -11
  12. package/dist/cache-with-ttl.js +26 -21
  13. package/dist/colors.js +2 -1
  14. package/dist/constants/licenses.js +2 -1
  15. package/dist/constants/lifecycle-script-names.js +2 -1
  16. package/dist/constants/maintained-node-versions.js +2 -1
  17. package/dist/constants/node.js +4 -3
  18. package/dist/constants/package-default-socket-categories.js +2 -1
  19. package/dist/constants/packages.js +4 -3
  20. package/dist/constants/socket.js +1 -1
  21. package/dist/cover/code.js +9 -8
  22. package/dist/cover/formatters.js +12 -11
  23. package/dist/cover/type.js +5 -4
  24. package/dist/crypto.d.ts +36 -0
  25. package/dist/{effects/ultra.js → crypto.js} +33 -37
  26. package/dist/debug.js +12 -15
  27. package/dist/dlx/arborist.js +10 -9
  28. package/dist/dlx/binary.js +27 -24
  29. package/dist/dlx/cache.js +2 -10
  30. package/dist/dlx/detect.js +6 -5
  31. package/dist/dlx/integrity.js +13 -11
  32. package/dist/dlx/lockfile.js +7 -6
  33. package/dist/dlx/manifest.js +6 -5
  34. package/dist/dlx/package.js +17 -16
  35. package/dist/dlx/packages.js +6 -5
  36. package/dist/dlx/paths.d.ts +1 -1
  37. package/dist/dlx/paths.js +2 -1
  38. package/dist/effects/pulse-frames.js +4 -3
  39. package/dist/effects/shimmer-keyframes.d.ts +62 -0
  40. package/dist/effects/shimmer-keyframes.js +55 -0
  41. package/dist/effects/shimmer-terminal.d.ts +66 -0
  42. package/dist/effects/shimmer-terminal.js +57 -0
  43. package/dist/effects/shimmer.d.ts +293 -0
  44. package/dist/effects/shimmer.js +180 -0
  45. package/dist/env/rewire.js +4 -3
  46. package/dist/env.js +5 -4
  47. package/dist/errors.js +1 -1
  48. package/dist/external/@npmcli/package-json/lib/read-package.js +10 -10
  49. package/dist/external/@npmcli/package-json.js +372 -372
  50. package/dist/external/@npmcli/promise-spawn.js +24 -24
  51. package/dist/external/@socketregistry/packageurl-js.js +19 -18
  52. package/dist/external/@socketregistry/yocto-spinner.js +4 -3
  53. package/dist/external/@yarnpkg/extensions.js +2 -1
  54. package/dist/external/adm-zip.js +70 -70
  55. package/dist/external/debug.js +22 -22
  56. package/dist/external/external-pack.js +45 -45
  57. package/dist/external/fast-sort.js +5 -5
  58. package/dist/external/libnpmexec.js +4 -3
  59. package/dist/external/npm-pack.js +369 -369
  60. package/dist/external/p-map.js +9 -9
  61. package/dist/external/pico-pack.js +190 -190
  62. package/dist/external/pony-cause.js +2 -1
  63. package/dist/external/spdx-pack.js +11 -10
  64. package/dist/external/tar-fs.js +58 -58
  65. package/dist/external/which.js +13 -13
  66. package/dist/external/yargs-parser.js +71 -71
  67. package/dist/fs.js +19 -23
  68. package/dist/git.js +14 -13
  69. package/dist/github.d.ts +34 -0
  70. package/dist/github.js +248 -23
  71. package/dist/globs.d.ts +20 -0
  72. package/dist/globs.js +134 -25
  73. package/dist/http-request.d.ts +4 -3
  74. package/dist/http-request.js +39 -32
  75. package/dist/ipc-cli.js +2 -1
  76. package/dist/ipc.js +5 -4
  77. package/dist/json/edit.js +4 -3
  78. package/dist/json/format.js +3 -2
  79. package/dist/json/parse.js +7 -6
  80. package/dist/links.js +2 -1
  81. package/dist/logger.js +21 -14
  82. package/dist/memoization.js +16 -15
  83. package/dist/objects.js +2 -2
  84. package/dist/packages/edit.js +8 -7
  85. package/dist/packages/exports.js +17 -16
  86. package/dist/packages/isolation.js +20 -13
  87. package/dist/packages/licenses.js +6 -3
  88. package/dist/packages/manifest.js +2 -1
  89. package/dist/packages/normalize.js +8 -4
  90. package/dist/packages/operations.js +5 -4
  91. package/dist/packages/provenance.js +7 -6
  92. package/dist/packages/specs.js +2 -1
  93. package/dist/packages/validation.js +2 -1
  94. package/dist/paths/normalize.js +32 -40
  95. package/dist/paths/packages.js +2 -1
  96. package/dist/paths/rewire.js +3 -2
  97. package/dist/performance.js +19 -18
  98. package/dist/primordials.d.ts +9 -0
  99. package/dist/primordials.js +17 -0
  100. package/dist/process-lock.js +14 -13
  101. package/dist/promise-queue.js +17 -9
  102. package/dist/promises.d.ts +29 -6
  103. package/dist/promises.js +19 -15
  104. package/dist/regexps.js +9 -8
  105. package/dist/releases/github-api.d.ts +56 -0
  106. package/dist/releases/github-api.js +275 -0
  107. package/dist/releases/github-archives.d.ts +60 -0
  108. package/dist/releases/github-archives.js +136 -0
  109. package/dist/releases/github-assets.d.ts +21 -0
  110. package/dist/releases/github-assets.js +52 -0
  111. package/dist/releases/github-auth.d.ts +16 -0
  112. package/dist/releases/github-auth.js +51 -0
  113. package/dist/releases/github-downloads.d.ts +42 -0
  114. package/dist/releases/github-downloads.js +155 -0
  115. package/dist/releases/github-types.d.ts +66 -0
  116. package/dist/{effects/types.js → releases/github-types.js} +2 -2
  117. package/dist/releases/socket-btm.d.ts +1 -1
  118. package/dist/releases/socket-btm.js +17 -17
  119. package/dist/schema/parse.js +2 -1
  120. package/dist/schema/validate.js +6 -5
  121. package/dist/shadow.js +2 -1
  122. package/dist/signal-exit.js +2 -2
  123. package/dist/spawn.js +45 -35
  124. package/dist/spinner.d.ts +13 -6
  125. package/dist/spinner.js +75 -57
  126. package/dist/ssri.js +8 -7
  127. package/dist/stdio/footer.js +13 -12
  128. package/dist/stdio/header.js +5 -4
  129. package/dist/stdio/progress.js +13 -12
  130. package/dist/strings.js +19 -18
  131. package/dist/suppress-warnings.js +2 -2
  132. package/dist/tables.js +16 -13
  133. package/dist/temporary-executor.js +2 -1
  134. package/dist/themes/context.js +2 -1
  135. package/dist/themes/types.d.ts +1 -1
  136. package/dist/themes/utils.d.ts +8 -3
  137. package/dist/themes/utils.js +29 -5
  138. package/dist/url.js +4 -3
  139. package/package.json +44 -20
  140. package/dist/effects/text-shimmer.d.ts +0 -58
  141. package/dist/effects/text-shimmer.js +0 -192
  142. package/dist/effects/types.d.ts +0 -47
  143. package/dist/effects/ultra.d.ts +0 -22
  144. package/dist/releases/github.d.ts +0 -234
  145. package/dist/releases/github.js +0 -417
  146. package/dist/themes/index.d.ts +0 -49
  147. package/dist/themes/index.js +0 -60
@@ -39,6 +39,7 @@ var import_packages = require("../constants/packages");
39
39
  var import_make_fetch_happen = __toESM(require("../external/make-fetch-happen"));
40
40
  var import_abort = require("../abort");
41
41
  var import_url = require("../url");
42
+ var import_primordials = require("../primordials");
42
43
  const ArrayIsArray = Array.isArray;
43
44
  const SLSA_PROVENANCE_V0_2 = "https://slsa.dev/provenance/v0.2";
44
45
  const SLSA_PROVENANCE_V1_0 = "https://slsa.dev/provenance/v1";
@@ -50,11 +51,11 @@ function findProvenance(attestations) {
50
51
  let predicate = att.predicate;
51
52
  if (!predicate && att.bundle?.dsseEnvelope?.payload) {
52
53
  try {
53
- const decodedPayload = Buffer.from(
54
+ const decodedPayload = (0, import_primordials.BufferFrom)(
54
55
  att.bundle.dsseEnvelope.payload,
55
56
  "base64"
56
57
  ).toString("utf8");
57
- const statement = JSON.parse(decodedPayload);
58
+ const statement = (0, import_primordials.JSONParse)(decodedPayload);
58
59
  predicate = statement.predicate;
59
60
  } catch {
60
61
  continue;
@@ -101,8 +102,8 @@ function isTrustedPublisher(value) {
101
102
  }
102
103
  let url = (0, import_url.parseUrl)(value);
103
104
  let hostname = url?.hostname;
104
- if (!url && value.includes("@")) {
105
- const firstPart = value.split("@")[0];
105
+ if (!url && (0, import_primordials.StringPrototypeIncludes)(value, "@")) {
106
+ const firstPart = (0, import_primordials.StringPrototypeSplit)(value, "@")[0];
106
107
  if (firstPart) {
107
108
  url = (0, import_url.parseUrl)(firstPart);
108
109
  }
@@ -117,9 +118,9 @@ function isTrustedPublisher(value) {
117
118
  }
118
119
  }
119
120
  if (hostname) {
120
- return hostname === "github.com" || hostname.endsWith(".github.com") || hostname === "gitlab.com" || hostname.endsWith(".gitlab.com");
121
+ return hostname === "github.com" || (0, import_primordials.StringPrototypeEndsWith)(hostname, ".github.com") || hostname === "gitlab.com" || (0, import_primordials.StringPrototypeEndsWith)(hostname, ".gitlab.com");
121
122
  }
122
- return value.includes("github") || value.includes("gitlab");
123
+ return (0, import_primordials.StringPrototypeIncludes)(value, "github") || (0, import_primordials.StringPrototypeIncludes)(value, "gitlab");
123
124
  }
124
125
  // @__NO_SIDE_EFFECTS__
125
126
  async function fetchPackageProvenance(pkgName, pkgVersion, options) {
@@ -40,6 +40,7 @@ module.exports = __toCommonJS(specs_exports);
40
40
  var import_npm_package_arg = __toESM(require("../external/npm-package-arg"));
41
41
  var import_objects = require("../objects");
42
42
  var import_strings = require("../strings");
43
+ var import_primordials = require("../primordials");
43
44
  // @__NO_SIDE_EFFECTS__
44
45
  function getRepoUrlDetails(repoUrl = "") {
45
46
  const match = /^(?:[a-z][a-z+]*:\/\/)(?:[^/@]+@)?github\.com\/([^?#]+)(?:[?#]|$)/i.exec(
@@ -51,7 +52,7 @@ function getRepoUrlDetails(repoUrl = "") {
51
52
  const userAndRepo = match[1].split("/");
52
53
  const user = userAndRepo[0] || "";
53
54
  const rawProject = userAndRepo[1] ?? "";
54
- const project = rawProject.endsWith(".git") ? rawProject.slice(0, -4) : rawProject;
55
+ const project = (0, import_primordials.StringPrototypeEndsWith)(rawProject, ".git") ? rawProject.slice(0, -4) : rawProject;
55
56
  return { user, project };
56
57
  }
57
58
  // @__NO_SIDE_EFFECTS__
@@ -36,9 +36,10 @@ __export(validation_exports, {
36
36
  });
37
37
  module.exports = __toCommonJS(validation_exports);
38
38
  var import_validate_npm_package_name = __toESM(require("../external/validate-npm-package-name"));
39
+ var import_primordials = require("../primordials");
39
40
  // @__NO_SIDE_EFFECTS__
40
41
  function isBlessedPackageName(name) {
41
- return typeof name === "string" && (name === "sfw" || name === "socket" || name.startsWith("@socketoverride/") || name.startsWith("@socketregistry/") || name.startsWith("@socketsecurity/"));
42
+ return typeof name === "string" && (name === "sfw" || name === "socket" || (0, import_primordials.StringPrototypeStartsWith)(name, "@socketoverride/") || (0, import_primordials.StringPrototypeStartsWith)(name, "@socketregistry/") || (0, import_primordials.StringPrototypeStartsWith)(name, "@socketsecurity/"));
42
43
  }
43
44
  // @__NO_SIDE_EFFECTS__
44
45
  function isRegistryFetcherType(type) {
@@ -36,6 +36,7 @@ __export(normalize_exports, {
36
36
  module.exports = __toCommonJS(normalize_exports);
37
37
  var import_platform = require("../constants/platform");
38
38
  var import_strings = require("../strings");
39
+ var import_primordials = require("../primordials");
39
40
  const CHAR_BACKWARD_SLASH = 92;
40
41
  const CHAR_COLON = 58;
41
42
  const CHAR_FORWARD_SLASH = 47;
@@ -46,16 +47,8 @@ const CHAR_UPPERCASE_Z = 90;
46
47
  const msysDriveRegExp = /^\/([a-zA-Z])(\/|$)/;
47
48
  const slashRegExp = /[/\\]/;
48
49
  const nodeModulesPathRegExp = /(?:^|[/\\])node_modules(?:[/\\]|$)/;
49
- let _buffer;
50
50
  let _url;
51
51
  // @__NO_SIDE_EFFECTS__
52
- function getBuffer() {
53
- if (_buffer === void 0) {
54
- _buffer = require("node:buffer");
55
- }
56
- return _buffer;
57
- }
58
- // @__NO_SIDE_EFFECTS__
59
52
  function getUrl() {
60
53
  if (_url === void 0) {
61
54
  _url = require("node:url");
@@ -106,8 +99,8 @@ function relative(from, to) {
106
99
  let lastCommonSep = -1;
107
100
  let i = 0;
108
101
  for (; i < length; i += 1) {
109
- let fromCode = actualFrom.charCodeAt(fromStart + i);
110
- let toCode = actualTo.charCodeAt(toStart + i);
102
+ let fromCode = (0, import_primordials.StringPrototypeCharCodeAt)(actualFrom, fromStart + i);
103
+ let toCode = (0, import_primordials.StringPrototypeCharCodeAt)(actualTo, toStart + i);
111
104
  if (import_platform.WIN32) {
112
105
  if (fromCode >= CHAR_UPPERCASE_A && fromCode <= CHAR_UPPERCASE_Z) {
113
106
  fromCode += 32;
@@ -119,13 +112,13 @@ function relative(from, to) {
119
112
  if (fromCode !== toCode) {
120
113
  break;
121
114
  }
122
- if (/* @__PURE__ */ isPathSeparator(actualFrom.charCodeAt(fromStart + i))) {
115
+ if (/* @__PURE__ */ isPathSeparator((0, import_primordials.StringPrototypeCharCodeAt)(actualFrom, fromStart + i))) {
123
116
  lastCommonSep = i;
124
117
  }
125
118
  }
126
119
  if (i === length) {
127
120
  if (toLen > length) {
128
- const toCode = actualTo.charCodeAt(toStart + i);
121
+ const toCode = (0, import_primordials.StringPrototypeCharCodeAt)(actualTo, toStart + i);
129
122
  if (/* @__PURE__ */ isPathSeparator(toCode)) {
130
123
  return actualTo.slice(toStart + i + 1);
131
124
  }
@@ -133,7 +126,7 @@ function relative(from, to) {
133
126
  return actualTo.slice(toStart + i);
134
127
  }
135
128
  } else if (fromLen > length) {
136
- const fromCode = actualFrom.charCodeAt(fromStart + i);
129
+ const fromCode = (0, import_primordials.StringPrototypeCharCodeAt)(actualFrom, fromStart + i);
137
130
  if (/* @__PURE__ */ isPathSeparator(fromCode)) {
138
131
  lastCommonSep = i;
139
132
  } else if (i === 0) {
@@ -143,7 +136,7 @@ function relative(from, to) {
143
136
  }
144
137
  let out = "";
145
138
  for (i = fromStart + lastCommonSep + 1; i <= fromEnd; i += 1) {
146
- const code = actualFrom.charCodeAt(i);
139
+ const code = (0, import_primordials.StringPrototypeCharCodeAt)(actualFrom, i);
147
140
  if (i === fromEnd || /* @__PURE__ */ isPathSeparator(code)) {
148
141
  out += out.length === 0 ? ".." : "/..";
149
142
  }
@@ -183,7 +176,7 @@ function isAbsolute(pathLike) {
183
176
  if (length === 0) {
184
177
  return false;
185
178
  }
186
- const code = filepath.charCodeAt(0);
179
+ const code = (0, import_primordials.StringPrototypeCharCodeAt)(filepath, 0);
187
180
  if (code === CHAR_FORWARD_SLASH) {
188
181
  return true;
189
182
  }
@@ -191,7 +184,7 @@ function isAbsolute(pathLike) {
191
184
  return true;
192
185
  }
193
186
  if (import_platform.WIN32 && length > 2) {
194
- if (/* @__PURE__ */ isWindowsDeviceRoot(code) && filepath.charCodeAt(1) === CHAR_COLON && /* @__PURE__ */ isPathSeparator(filepath.charCodeAt(2))) {
187
+ if (/* @__PURE__ */ isWindowsDeviceRoot(code) && (0, import_primordials.StringPrototypeCharCodeAt)(filepath, 1) === CHAR_COLON && /* @__PURE__ */ isPathSeparator((0, import_primordials.StringPrototypeCharCodeAt)(filepath, 2))) {
195
188
  return true;
196
189
  }
197
190
  }
@@ -200,7 +193,7 @@ function isAbsolute(pathLike) {
200
193
  // @__NO_SIDE_EFFECTS__
201
194
  function isNodeModules(pathLike) {
202
195
  const filepath = /* @__PURE__ */ pathLikeToString(pathLike);
203
- return nodeModulesPathRegExp.test(filepath);
196
+ return (0, import_primordials.RegExpPrototypeTest)(nodeModulesPathRegExp, filepath);
204
197
  }
205
198
  // @__NO_SIDE_EFFECTS__
206
199
  function isPath(pathLike) {
@@ -218,7 +211,7 @@ function isPath(pathLike) {
218
211
  return true;
219
212
  }
220
213
  if (filepath.includes("/") || filepath.includes("\\")) {
221
- if (filepath.startsWith("@") && !filepath.startsWith("@/")) {
214
+ if ((0, import_primordials.StringPrototypeStartsWith)(filepath, "@") && !(0, import_primordials.StringPrototypeStartsWith)(filepath, "@/")) {
222
215
  const parts = filepath.split("/");
223
216
  if (parts.length <= 2 && !parts[1]?.includes("\\")) {
224
217
  return false;
@@ -242,7 +235,7 @@ function isRelative(pathLike) {
242
235
  // @__NO_SIDE_EFFECTS__
243
236
  function isUnixPath(pathLike) {
244
237
  const filepath = /* @__PURE__ */ pathLikeToString(pathLike);
245
- return typeof filepath === "string" && msysDriveRegExp.test(filepath);
238
+ return typeof filepath === "string" && (0, import_primordials.RegExpPrototypeTest)(msysDriveRegExp, filepath);
246
239
  }
247
240
  // @__NO_SIDE_EFFECTS__
248
241
  function normalizePath(pathLike) {
@@ -252,28 +245,28 @@ function normalizePath(pathLike) {
252
245
  return ".";
253
246
  }
254
247
  if (length < 2) {
255
- return length === 1 && filepath.charCodeAt(0) === 92 ? "/" : filepath;
248
+ return length === 1 && (0, import_primordials.StringPrototypeCharCodeAt)(filepath, 0) === 92 ? "/" : filepath;
256
249
  }
257
250
  let code = 0;
258
251
  let start = 0;
259
252
  let prefix = "";
260
- if (length > 4 && filepath.charCodeAt(3) === 92) {
261
- const code2 = filepath.charCodeAt(2);
262
- if ((code2 === 63 || code2 === 46) && filepath.charCodeAt(0) === 92 && filepath.charCodeAt(1) === 92) {
253
+ if (length > 4 && (0, import_primordials.StringPrototypeCharCodeAt)(filepath, 3) === 92) {
254
+ const code2 = (0, import_primordials.StringPrototypeCharCodeAt)(filepath, 2);
255
+ if ((code2 === 63 || code2 === 46) && (0, import_primordials.StringPrototypeCharCodeAt)(filepath, 0) === 92 && (0, import_primordials.StringPrototypeCharCodeAt)(filepath, 1) === 92) {
263
256
  start = 2;
264
257
  prefix = "//";
265
258
  }
266
259
  }
267
260
  if (start === 0) {
268
- if (length > 2 && (filepath.charCodeAt(0) === 92 && filepath.charCodeAt(1) === 92 && filepath.charCodeAt(2) !== 92 || filepath.charCodeAt(0) === 47 && filepath.charCodeAt(1) === 47 && filepath.charCodeAt(2) !== 47)) {
261
+ if (length > 2 && ((0, import_primordials.StringPrototypeCharCodeAt)(filepath, 0) === 92 && (0, import_primordials.StringPrototypeCharCodeAt)(filepath, 1) === 92 && (0, import_primordials.StringPrototypeCharCodeAt)(filepath, 2) !== 92 || (0, import_primordials.StringPrototypeCharCodeAt)(filepath, 0) === 47 && (0, import_primordials.StringPrototypeCharCodeAt)(filepath, 1) === 47 && (0, import_primordials.StringPrototypeCharCodeAt)(filepath, 2) !== 47)) {
269
262
  let firstSegmentEnd = -1;
270
263
  let hasSecondSegment = false;
271
264
  let i = 2;
272
- while (i < length && (filepath.charCodeAt(i) === 47 || filepath.charCodeAt(i) === 92)) {
265
+ while (i < length && ((0, import_primordials.StringPrototypeCharCodeAt)(filepath, i) === 47 || (0, import_primordials.StringPrototypeCharCodeAt)(filepath, i) === 92)) {
273
266
  i++;
274
267
  }
275
268
  while (i < length) {
276
- const char = filepath.charCodeAt(i);
269
+ const char = (0, import_primordials.StringPrototypeCharCodeAt)(filepath, i);
277
270
  if (char === 47 || char === 92) {
278
271
  firstSegmentEnd = i;
279
272
  break;
@@ -282,7 +275,7 @@ function normalizePath(pathLike) {
282
275
  }
283
276
  if (firstSegmentEnd > 2) {
284
277
  i = firstSegmentEnd;
285
- while (i < length && (filepath.charCodeAt(i) === 47 || filepath.charCodeAt(i) === 92)) {
278
+ while (i < length && ((0, import_primordials.StringPrototypeCharCodeAt)(filepath, i) === 47 || (0, import_primordials.StringPrototypeCharCodeAt)(filepath, i) === 92)) {
286
279
  i++;
287
280
  }
288
281
  if (i < length) {
@@ -293,20 +286,20 @@ function normalizePath(pathLike) {
293
286
  start = 2;
294
287
  prefix = "//";
295
288
  } else {
296
- code = filepath.charCodeAt(start);
289
+ code = (0, import_primordials.StringPrototypeCharCodeAt)(filepath, start);
297
290
  while (code === 47 || code === 92) {
298
291
  start += 1;
299
- code = filepath.charCodeAt(start);
292
+ code = (0, import_primordials.StringPrototypeCharCodeAt)(filepath, start);
300
293
  }
301
294
  if (start) {
302
295
  prefix = "/";
303
296
  }
304
297
  }
305
298
  } else {
306
- code = filepath.charCodeAt(start);
299
+ code = (0, import_primordials.StringPrototypeCharCodeAt)(filepath, start);
307
300
  while (code === 47 || code === 92) {
308
301
  start += 1;
309
- code = filepath.charCodeAt(start);
302
+ code = (0, import_primordials.StringPrototypeCharCodeAt)(filepath, start);
310
303
  }
311
304
  if (start) {
312
305
  prefix = "/";
@@ -320,7 +313,7 @@ function normalizePath(pathLike) {
320
313
  return prefix || ".";
321
314
  }
322
315
  if (segment === "..") {
323
- return prefix ? prefix.slice(0, -1) || "/" : "..";
316
+ return prefix ? (0, import_primordials.StringPrototypeSlice)(prefix, 0, -1) || "/" : "..";
324
317
  }
325
318
  return msysDriveToNative(prefix + segment);
326
319
  }
@@ -361,10 +354,10 @@ function normalizePath(pathLike) {
361
354
  }
362
355
  }
363
356
  start = nextIndex + 1;
364
- code = filepath.charCodeAt(start);
357
+ code = (0, import_primordials.StringPrototypeCharCodeAt)(filepath, start);
365
358
  while (code === 47 || code === 92) {
366
359
  start += 1;
367
- code = filepath.charCodeAt(start);
360
+ code = (0, import_primordials.StringPrototypeCharCodeAt)(filepath, start);
368
361
  }
369
362
  nextIndex = (0, import_strings.search)(filepath, slashRegExp, { fromIndex: start });
370
363
  }
@@ -413,8 +406,7 @@ function pathLikeToString(pathLike) {
413
406
  if (typeof pathLike === "string") {
414
407
  return pathLike;
415
408
  }
416
- const { Buffer: Buffer2 } = /* @__PURE__ */ getBuffer();
417
- if (Buffer2.isBuffer(pathLike)) {
409
+ if ((0, import_primordials.BufferIsBuffer)(pathLike)) {
418
410
  return pathLike.toString("utf8");
419
411
  }
420
412
  const url = /* @__PURE__ */ getUrl();
@@ -424,10 +416,10 @@ function pathLikeToString(pathLike) {
424
416
  } catch {
425
417
  const pathname = pathLike.pathname;
426
418
  const decodedPathname = decodeURIComponent(pathname);
427
- if (import_platform.WIN32 && decodedPathname.startsWith("/")) {
428
- const letter = decodedPathname.charCodeAt(1) | 32;
419
+ if (import_platform.WIN32 && (0, import_primordials.StringPrototypeStartsWith)(decodedPathname, "/")) {
420
+ const letter = (0, import_primordials.StringPrototypeCharCodeAt)(decodedPathname, 1) | 32;
429
421
  const hasValidDriveLetter = decodedPathname.length >= 3 && letter >= 97 && // 'a' to 'z'
430
- letter <= 122 && decodedPathname.charAt(2) === ":";
422
+ letter <= 122 && (0, import_primordials.StringPrototypeCharAt)(decodedPathname, 2) === ":";
431
423
  if (!hasValidDriveLetter) {
432
424
  return decodedPathname;
433
425
  }
@@ -467,7 +459,7 @@ function toUnixPath(pathLike) {
467
459
  // @__NO_SIDE_EFFECTS__
468
460
  function trimLeadingDotSlash(pathLike) {
469
461
  const filepath = /* @__PURE__ */ pathLikeToString(pathLike);
470
- if (filepath.startsWith("./") || filepath.startsWith(".\\")) {
462
+ if ((0, import_primordials.StringPrototypeStartsWith)(filepath, "./") || (0, import_primordials.StringPrototypeStartsWith)(filepath, ".\\")) {
471
463
  return filepath.slice(2);
472
464
  }
473
465
  return filepath;
@@ -25,6 +25,7 @@ __export(packages_exports, {
25
25
  });
26
26
  module.exports = __toCommonJS(packages_exports);
27
27
  var import_normalize = require("./normalize");
28
+ var import_primordials = require("../primordials");
28
29
  let _path;
29
30
  // @__NO_SIDE_EFFECTS__
30
31
  function getPath() {
@@ -35,7 +36,7 @@ function getPath() {
35
36
  }
36
37
  // @__NO_SIDE_EFFECTS__
37
38
  function isPackageJsonFile(filepath) {
38
- return filepath === "package.json" || filepath.endsWith("/package.json") || filepath.endsWith("\\package.json");
39
+ return filepath === "package.json" || (0, import_primordials.StringPrototypeEndsWith)(filepath, "/package.json") || (0, import_primordials.StringPrototypeEndsWith)(filepath, "\\package.json");
39
40
  }
40
41
  // @__NO_SIDE_EFFECTS__
41
42
  function resolvePackageJsonDirname(filepath) {
@@ -29,12 +29,13 @@ __export(rewire_exports, {
29
29
  setPath: () => setPath
30
30
  });
31
31
  module.exports = __toCommonJS(rewire_exports);
32
+ var import_primordials = require("../primordials");
32
33
  const stateSymbol = Symbol.for("@socketsecurity/lib/paths/rewire/state");
33
34
  const _globalThis = globalThis;
34
35
  if (!_globalThis[stateSymbol]) {
35
36
  _globalThis[stateSymbol] = {
36
- testOverrides: /* @__PURE__ */ new Map(),
37
- valueCache: /* @__PURE__ */ new Map(),
37
+ testOverrides: new import_primordials.MapCtor(),
38
+ valueCache: new import_primordials.MapCtor(),
38
39
  cacheInvalidationCallbacks: []
39
40
  };
40
41
  }
@@ -45,6 +45,7 @@ module.exports = __toCommonJS(performance_exports);
45
45
  var import_node_process = __toESM(require("node:process"));
46
46
  var import_debug = require("./debug");
47
47
  var import_errors = require("./errors");
48
+ var import_primordials = require("./primordials");
48
49
  const performanceMetrics = [];
49
50
  function isPerfEnabled() {
50
51
  return import_node_process.default.env["DEBUG"]?.includes("perf") || false;
@@ -58,7 +59,7 @@ function generatePerformanceReport() {
58
59
  return "(no performance data collected - enable with DEBUG=perf)";
59
60
  }
60
61
  const summary = getPerformanceSummary();
61
- const operations = Object.keys(summary).sort();
62
+ const operations = (0, import_primordials.ObjectKeys)(summary).sort();
62
63
  let report = "\n\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557\n";
63
64
  report += "\u2551 Performance Report \u2551\n";
64
65
  report += "\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D\n\n";
@@ -78,11 +79,11 @@ function generatePerformanceReport() {
78
79
 
79
80
  `;
80
81
  }
81
- const totalDuration = Object.values(summary).reduce(
82
+ const totalDuration = (0, import_primordials.ObjectValues)(summary).reduce(
82
83
  (sum, s) => sum + s.total,
83
84
  0
84
85
  );
85
- report += `Total measured time: ${Math.round(totalDuration * 100) / 100}ms
86
+ report += `Total measured time: ${(0, import_primordials.MathRound)(totalDuration * 100) / 100}ms
86
87
  `;
87
88
  return report;
88
89
  }
@@ -104,17 +105,17 @@ function getPerformanceSummary() {
104
105
  const stats = summary[operation];
105
106
  stats.count++;
106
107
  stats.total += duration;
107
- stats.min = Math.min(stats.min, duration);
108
- stats.max = Math.max(stats.max, duration);
108
+ stats.min = (0, import_primordials.MathMin)(stats.min, duration);
109
+ stats.max = (0, import_primordials.MathMax)(stats.max, duration);
109
110
  }
110
111
  const result = { __proto__: null };
111
- for (const { 0: operation, 1: stats } of Object.entries(summary)) {
112
+ for (const { 0: operation, 1: stats } of (0, import_primordials.ObjectEntries)(summary)) {
112
113
  result[operation] = {
113
114
  count: stats.count,
114
- total: Math.round(stats.total * 100) / 100,
115
- avg: Math.round(stats.total / stats.count * 100) / 100,
116
- min: Math.round(stats.min * 100) / 100,
117
- max: Math.round(stats.max * 100) / 100
115
+ total: (0, import_primordials.MathRound)(stats.total * 100) / 100,
116
+ avg: (0, import_primordials.MathRound)(stats.total / stats.count * 100) / 100,
117
+ min: (0, import_primordials.MathRound)(stats.min * 100) / 100,
118
+ max: (0, import_primordials.MathRound)(stats.max * 100) / 100
118
119
  };
119
120
  }
120
121
  return result;
@@ -156,7 +157,7 @@ function perfCheckpoint(checkpoint, metadata) {
156
157
  const metric = {
157
158
  operation: `checkpoint:${checkpoint}`,
158
159
  duration: 0,
159
- timestamp: Date.now(),
160
+ timestamp: (0, import_primordials.DateNow)(),
160
161
  ...metadata ? { metadata } : {}
161
162
  };
162
163
  performanceMetrics.push(metric);
@@ -174,8 +175,8 @@ function perfTimer(operation, metadata) {
174
175
  const metric = {
175
176
  operation,
176
177
  // Round to 2 decimals
177
- duration: Math.round(duration * 100) / 100,
178
- timestamp: Date.now(),
178
+ duration: (0, import_primordials.MathRound)(duration * 100) / 100,
179
+ timestamp: (0, import_primordials.DateNow)(),
179
180
  metadata: { ...metadata, ...additionalMetadata }
180
181
  };
181
182
  performanceMetrics.push(metric);
@@ -187,7 +188,7 @@ function printPerformanceSummary() {
187
188
  return;
188
189
  }
189
190
  const summary = getPerformanceSummary();
190
- const operations = Object.keys(summary).sort();
191
+ const operations = (0, import_primordials.ObjectKeys)(summary).sort();
191
192
  (0, import_debug.debugLog)("[perf]\n=== Performance Summary ===");
192
193
  for (const operation of operations) {
193
194
  const stats = summary[operation];
@@ -202,16 +203,16 @@ function trackMemory(label) {
202
203
  return 0;
203
204
  }
204
205
  const usage = import_node_process.default.memoryUsage();
205
- const heapUsedMB = Math.round(usage.heapUsed / 1024 / 1024 * 100) / 100;
206
+ const heapUsedMB = (0, import_primordials.MathRound)(usage.heapUsed / 1024 / 1024 * 100) / 100;
206
207
  (0, import_debug.debugLog)(`[perf] [MEMORY] ${label}: ${heapUsedMB}MB heap used`);
207
208
  const metric = {
208
209
  operation: `checkpoint:memory:${label}`,
209
210
  duration: 0,
210
- timestamp: Date.now(),
211
+ timestamp: (0, import_primordials.DateNow)(),
211
212
  metadata: {
212
213
  heapUsed: heapUsedMB,
213
- heapTotal: Math.round(usage.heapTotal / 1024 / 1024 * 100) / 100,
214
- external: Math.round(usage.external / 1024 / 1024 * 100) / 100
214
+ heapTotal: (0, import_primordials.MathRound)(usage.heapTotal / 1024 / 1024 * 100) / 100,
215
+ external: (0, import_primordials.MathRound)(usage.external / 1024 / 1024 * 100) / 100
215
216
  }
216
217
  };
217
218
  performanceMetrics.push(metric);
@@ -44,8 +44,10 @@ export declare const MapCtor: MapConstructor;
44
44
  export declare const NumberCtor: NumberConstructor;
45
45
  export declare const ObjectCtor: ObjectConstructor;
46
46
  export declare const PromiseCtor: PromiseConstructor;
47
+ export declare const ProxyCtor: ProxyConstructor;
47
48
  export declare const RegExpCtor: RegExpConstructor;
48
49
  export declare const SetCtor: SetConstructor;
50
+ export declare const SharedArrayBufferCtor: SharedArrayBufferConstructor;
49
51
  export declare const StringCtor: StringConstructor;
50
52
  export declare const SymbolCtor: SymbolConstructor;
51
53
  export declare const Float32ArrayCtor: Float32ArrayConstructor;
@@ -75,9 +77,15 @@ export declare const ArrayFrom: {
75
77
  <T>(iterable: Iterable<T> | ArrayLike<T>): T[];
76
78
  <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
77
79
  };
80
+ export type ArrayFromAsync = <T>(source: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>) => Promise<T[]>;
81
+ export declare const ArrayFromAsync: ArrayFromAsync | undefined;
78
82
  export declare const ArrayIsArray: (arg: any) => arg is any[];
79
83
  export declare const ArrayOf: <T>(...items: T[]) => T[];
80
84
  export declare const ArrayBufferIsView: (arg: any) => arg is ArrayBufferView;
85
+ export declare const AtomicsWait: {
86
+ (typedArray: Int32Array<ArrayBufferLike>, index: number, value: number, timeout?: number): "ok" | "not-equal" | "timed-out";
87
+ (typedArray: BigInt64Array<ArrayBufferLike>, index: number, value: bigint, timeout?: number): "ok" | "not-equal" | "timed-out";
88
+ };
81
89
  export declare const ArrayPrototypeAt: (self: unknown, index: number) => any;
82
90
  export declare const ArrayPrototypeConcat: <T>(self: T[], ...items: Array<T | readonly T[]>) => T[];
83
91
  export declare const ArrayPrototypeCopyWithin: (self: unknown, target: number, start: number, end?: number | undefined) => any[];
@@ -130,6 +138,7 @@ export declare const DateUTC: {
130
138
  };
131
139
  export declare const DatePrototypeGetTime: (self: unknown) => number;
132
140
  export declare const DatePrototypeToISOString: (self: unknown) => string;
141
+ export declare const DatePrototypeToLocaleString: (self: unknown, locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions | undefined) => string;
133
142
  export declare const DatePrototypeValueOf: (self: unknown) => number;
134
143
  export declare const ErrorIsError: ((value: unknown) => value is Error) | undefined;
135
144
  export declare const FunctionPrototypeApply: (self: (...args: unknown[]) => unknown, thisArg: unknown, args: unknown[]) => unknown;
@@ -25,6 +25,7 @@ __export(primordials_exports, {
25
25
  ArrayBufferIsView: () => ArrayBufferIsView,
26
26
  ArrayCtor: () => ArrayCtor,
27
27
  ArrayFrom: () => ArrayFrom,
28
+ ArrayFromAsync: () => ArrayFromAsync,
28
29
  ArrayIsArray: () => ArrayIsArray,
29
30
  ArrayOf: () => ArrayOf,
30
31
  ArrayPrototypeAt: () => ArrayPrototypeAt,
@@ -61,6 +62,7 @@ __export(primordials_exports, {
61
62
  ArrayPrototypeToSorted: () => ArrayPrototypeToSorted,
62
63
  ArrayPrototypeUnshift: () => ArrayPrototypeUnshift,
63
64
  ArrayPrototypeValues: () => ArrayPrototypeValues,
65
+ AtomicsWait: () => AtomicsWait,
64
66
  BooleanCtor: () => BooleanCtor,
65
67
  BufferAlloc: () => BufferAlloc,
66
68
  BufferAllocUnsafe: () => BufferAllocUnsafe,
@@ -79,6 +81,7 @@ __export(primordials_exports, {
79
81
  DateParse: () => DateParse,
80
82
  DatePrototypeGetTime: () => DatePrototypeGetTime,
81
83
  DatePrototypeToISOString: () => DatePrototypeToISOString,
84
+ DatePrototypeToLocaleString: () => DatePrototypeToLocaleString,
82
85
  DatePrototypeValueOf: () => DatePrototypeValueOf,
83
86
  DateUTC: () => DateUTC,
84
87
  ErrorCtor: () => ErrorCtor,
@@ -166,6 +169,7 @@ __export(primordials_exports, {
166
169
  PromiseReject: () => PromiseReject,
167
170
  PromiseResolve: () => PromiseResolve,
168
171
  PromiseWithResolvers: () => PromiseWithResolvers,
172
+ ProxyCtor: () => ProxyCtor,
169
173
  RangeErrorCtor: () => RangeErrorCtor,
170
174
  ReferenceErrorCtor: () => ReferenceErrorCtor,
171
175
  ReflectApply: () => ReflectApply,
@@ -196,6 +200,7 @@ __export(primordials_exports, {
196
200
  SetPrototypeHas: () => SetPrototypeHas,
197
201
  SetPrototypeKeys: () => SetPrototypeKeys,
198
202
  SetPrototypeValues: () => SetPrototypeValues,
203
+ SharedArrayBufferCtor: () => SharedArrayBufferCtor,
199
204
  StringCtor: () => StringCtor,
200
205
  StringFromCharCode: () => StringFromCharCode,
201
206
  StringFromCodePoint: () => StringFromCodePoint,
@@ -289,8 +294,10 @@ const MapCtor = Map;
289
294
  const NumberCtor = Number;
290
295
  const ObjectCtor = Object;
291
296
  const PromiseCtor = Promise;
297
+ const ProxyCtor = Proxy;
292
298
  const RegExpCtor = RegExp;
293
299
  const SetCtor = Set;
300
+ const SharedArrayBufferCtor = SharedArrayBuffer;
294
301
  const StringCtor = String;
295
302
  const SymbolCtor = Symbol;
296
303
  const Float32ArrayCtor = Float32Array;
@@ -312,9 +319,11 @@ const encodeComponent = globalThis.encodeURIComponent;
312
319
  const JSONParse = JSON.parse;
313
320
  const JSONStringify = JSON.stringify;
314
321
  const ArrayFrom = Array.from;
322
+ const ArrayFromAsync = Array.fromAsync;
315
323
  const ArrayIsArray = Array.isArray;
316
324
  const ArrayOf = Array.of;
317
325
  const ArrayBufferIsView = ArrayBuffer.isView;
326
+ const AtomicsWait = Atomics.wait;
318
327
  const ArrayPrototypeAt = uncurryThis(Array.prototype.at);
319
328
  const ArrayPrototypeConcat = uncurryThis(Array.prototype.concat);
320
329
  const ArrayPrototypeCopyWithin = uncurryThis(Array.prototype.copyWithin);
@@ -370,6 +379,9 @@ const DateParse = Date.parse;
370
379
  const DateUTC = Date.UTC;
371
380
  const DatePrototypeGetTime = uncurryThis(Date.prototype.getTime);
372
381
  const DatePrototypeToISOString = uncurryThis(Date.prototype.toISOString);
382
+ const DatePrototypeToLocaleString = uncurryThis(
383
+ Date.prototype.toLocaleString
384
+ );
373
385
  const DatePrototypeValueOf = uncurryThis(Date.prototype.valueOf);
374
386
  const ErrorIsError = Error.isError;
375
387
  const FunctionPrototypeApply = uncurryThis(Function.prototype.apply);
@@ -584,6 +596,7 @@ const WeakSetPrototypeHas = uncurryThis(WeakSet.prototype.has);
584
596
  ArrayBufferIsView,
585
597
  ArrayCtor,
586
598
  ArrayFrom,
599
+ ArrayFromAsync,
587
600
  ArrayIsArray,
588
601
  ArrayOf,
589
602
  ArrayPrototypeAt,
@@ -620,6 +633,7 @@ const WeakSetPrototypeHas = uncurryThis(WeakSet.prototype.has);
620
633
  ArrayPrototypeToSorted,
621
634
  ArrayPrototypeUnshift,
622
635
  ArrayPrototypeValues,
636
+ AtomicsWait,
623
637
  BooleanCtor,
624
638
  BufferAlloc,
625
639
  BufferAllocUnsafe,
@@ -638,6 +652,7 @@ const WeakSetPrototypeHas = uncurryThis(WeakSet.prototype.has);
638
652
  DateParse,
639
653
  DatePrototypeGetTime,
640
654
  DatePrototypeToISOString,
655
+ DatePrototypeToLocaleString,
641
656
  DatePrototypeValueOf,
642
657
  DateUTC,
643
658
  ErrorCtor,
@@ -725,6 +740,7 @@ const WeakSetPrototypeHas = uncurryThis(WeakSet.prototype.has);
725
740
  PromiseReject,
726
741
  PromiseResolve,
727
742
  PromiseWithResolvers,
743
+ ProxyCtor,
728
744
  RangeErrorCtor,
729
745
  ReferenceErrorCtor,
730
746
  ReflectApply,
@@ -755,6 +771,7 @@ const WeakSetPrototypeHas = uncurryThis(WeakSet.prototype.has);
755
771
  SetPrototypeHas,
756
772
  SetPrototypeKeys,
757
773
  SetPrototypeValues,
774
+ SharedArrayBufferCtor,
758
775
  StringCtor,
759
776
  StringFromCharCode,
760
777
  StringFromCodePoint,