@socketsecurity/lib 5.26.0 → 5.27.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 (183) hide show
  1. package/CHANGELOG.md +371 -1185
  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} +26 -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 +71 -71
  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 +50 -68
  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/node/async-hooks.d.ts +6 -0
  84. package/dist/node/async-hooks.js +34 -0
  85. package/dist/node/child-process.d.ts +11 -0
  86. package/dist/node/child-process.js +34 -0
  87. package/dist/node/crypto.d.ts +6 -0
  88. package/dist/node/crypto.js +34 -0
  89. package/dist/node/events.d.ts +6 -0
  90. package/dist/node/events.js +34 -0
  91. package/dist/node/fs-promises.d.ts +6 -0
  92. package/dist/node/fs-promises.js +34 -0
  93. package/dist/node/fs.d.ts +14 -0
  94. package/dist/node/fs.js +34 -0
  95. package/dist/node/http.d.ts +6 -0
  96. package/dist/node/http.js +34 -0
  97. package/dist/node/https.d.ts +6 -0
  98. package/dist/node/https.js +34 -0
  99. package/dist/node/os.d.ts +6 -0
  100. package/dist/node/os.js +34 -0
  101. package/dist/node/path.d.ts +6 -0
  102. package/dist/node/path.js +34 -0
  103. package/dist/node/timers-promises.d.ts +6 -0
  104. package/dist/node/timers-promises.js +34 -0
  105. package/dist/node/url.d.ts +6 -0
  106. package/dist/node/url.js +34 -0
  107. package/dist/node/util.d.ts +6 -0
  108. package/dist/node/util.js +34 -0
  109. package/dist/objects.js +2 -2
  110. package/dist/packages/edit.js +8 -7
  111. package/dist/packages/exports.js +17 -16
  112. package/dist/packages/isolation.js +20 -13
  113. package/dist/packages/licenses.js +6 -3
  114. package/dist/packages/manifest.js +2 -1
  115. package/dist/packages/normalize.js +8 -4
  116. package/dist/packages/operations.js +5 -4
  117. package/dist/packages/provenance.js +7 -6
  118. package/dist/packages/specs.js +2 -1
  119. package/dist/packages/validation.js +2 -1
  120. package/dist/paths/normalize.js +32 -40
  121. package/dist/paths/packages.js +2 -1
  122. package/dist/paths/rewire.js +3 -2
  123. package/dist/performance.js +19 -18
  124. package/dist/primordials.d.ts +85 -2
  125. package/dist/primordials.js +311 -23
  126. package/dist/process-lock.js +14 -13
  127. package/dist/promise-queue.js +17 -9
  128. package/dist/promises.d.ts +29 -6
  129. package/dist/promises.js +19 -15
  130. package/dist/regexps.js +9 -8
  131. package/dist/releases/github-api.d.ts +56 -0
  132. package/dist/releases/github-api.js +275 -0
  133. package/dist/releases/github-archives.d.ts +60 -0
  134. package/dist/releases/github-archives.js +136 -0
  135. package/dist/releases/github-assets.d.ts +21 -0
  136. package/dist/releases/github-assets.js +52 -0
  137. package/dist/releases/github-auth.d.ts +16 -0
  138. package/dist/releases/github-auth.js +51 -0
  139. package/dist/releases/github-downloads.d.ts +42 -0
  140. package/dist/releases/github-downloads.js +155 -0
  141. package/dist/releases/github-types.d.ts +66 -0
  142. package/dist/{effects/types.js → releases/github-types.js} +2 -2
  143. package/dist/releases/socket-btm.d.ts +1 -1
  144. package/dist/releases/socket-btm.js +17 -17
  145. package/dist/schema/parse.js +2 -1
  146. package/dist/schema/validate.js +6 -5
  147. package/dist/sea/util.d.ts +43 -0
  148. package/dist/{sea.js → sea/util.js} +7 -7
  149. package/dist/shadow.js +2 -1
  150. package/dist/signal-exit.js +2 -2
  151. package/dist/smol/primordial.d.ts +80 -0
  152. package/dist/smol/primordial.js +46 -0
  153. package/dist/smol/util.d.ts +87 -0
  154. package/dist/smol/util.js +59 -0
  155. package/dist/smol/versions.d.ts +46 -0
  156. package/dist/smol/versions.js +46 -0
  157. package/dist/spawn.js +58 -63
  158. package/dist/spinner.d.ts +13 -6
  159. package/dist/spinner.js +75 -57
  160. package/dist/ssri.js +8 -7
  161. package/dist/stdio/footer.js +13 -12
  162. package/dist/stdio/header.js +5 -4
  163. package/dist/stdio/progress.js +13 -12
  164. package/dist/strings.js +19 -18
  165. package/dist/suppress-warnings.js +2 -2
  166. package/dist/tables.js +16 -13
  167. package/dist/temporary-executor.js +2 -1
  168. package/dist/themes/context.js +2 -1
  169. package/dist/themes/types.d.ts +1 -1
  170. package/dist/themes/utils.d.ts +8 -3
  171. package/dist/themes/utils.js +29 -5
  172. package/dist/url.js +4 -3
  173. package/dist/versions.js +27 -22
  174. package/package.json +120 -26
  175. package/dist/effects/text-shimmer.d.ts +0 -58
  176. package/dist/effects/text-shimmer.js +0 -192
  177. package/dist/effects/types.d.ts +0 -47
  178. package/dist/effects/ultra.d.ts +0 -22
  179. package/dist/releases/github.d.ts +0 -234
  180. package/dist/releases/github.js +0 -417
  181. package/dist/sea.d.ts +0 -30
  182. package/dist/themes/index.d.ts +0 -49
  183. package/dist/themes/index.js +0 -60
@@ -31,13 +31,14 @@ module.exports = __toCommonJS(exports_exports);
31
31
  var import_arrays = require("../arrays");
32
32
  var import_core = require("../constants/core");
33
33
  var import_objects = require("../objects");
34
+ var import_primordials = require("../primordials");
34
35
  // @__NO_SIDE_EFFECTS__
35
36
  function findTypesForSubpath(entryExports, subpath) {
36
37
  const queue = [entryExports];
37
38
  let pos = 0;
38
39
  while (pos < queue.length) {
39
40
  if (pos === import_core.LOOP_SENTINEL) {
40
- throw new Error(
41
+ throw new import_primordials.ErrorCtor(
41
42
  "Detected infinite loop in entry exports crawl of getTypesForSubpath"
42
43
  );
43
44
  }
@@ -53,7 +54,7 @@ function findTypesForSubpath(entryExports, subpath) {
53
54
  }
54
55
  }
55
56
  } else if ((0, import_objects.isObject)(value)) {
56
- const keys = Object.getOwnPropertyNames(value);
57
+ const keys = (0, import_primordials.ObjectGetOwnPropertyNames)(value);
57
58
  for (let i = 0, { length } = keys; i < length; i += 1) {
58
59
  const key = keys[i];
59
60
  const item = value[key];
@@ -74,27 +75,27 @@ function getExportFilePaths(entryExports) {
74
75
  return [];
75
76
  }
76
77
  const paths = [];
77
- for (const key of Object.getOwnPropertyNames(entryExports)) {
78
- if (!key.startsWith(".")) {
78
+ for (const key of (0, import_primordials.ObjectGetOwnPropertyNames)(entryExports)) {
79
+ if (!(0, import_primordials.StringPrototypeStartsWith)(key, ".")) {
79
80
  continue;
80
81
  }
81
82
  const value = entryExports[key];
82
83
  if (typeof value === "string") {
83
- paths.push(value);
84
+ (0, import_primordials.ArrayPrototypePush)(paths, value);
84
85
  } else if ((0, import_objects.isObject)(value)) {
85
- for (const subKey of Object.getOwnPropertyNames(value)) {
86
+ for (const subKey of (0, import_primordials.ObjectGetOwnPropertyNames)(value)) {
86
87
  const subValue = value[subKey];
87
88
  if (typeof subValue === "string") {
88
- paths.push(subValue);
89
+ (0, import_primordials.ArrayPrototypePush)(paths, subValue);
89
90
  } else if ((0, import_arrays.isArray)(subValue)) {
90
91
  for (const item of subValue) {
91
92
  if (typeof item === "string") {
92
- paths.push(item);
93
+ (0, import_primordials.ArrayPrototypePush)(paths, item);
93
94
  } else if ((0, import_objects.isObject)(item)) {
94
- for (const nestedKey of Object.getOwnPropertyNames(item)) {
95
+ for (const nestedKey of (0, import_primordials.ObjectGetOwnPropertyNames)(item)) {
95
96
  const nestedValue = item[nestedKey];
96
97
  if (typeof nestedValue === "string") {
97
- paths.push(nestedValue);
98
+ (0, import_primordials.ArrayPrototypePush)(paths, nestedValue);
98
99
  }
99
100
  }
100
101
  }
@@ -103,15 +104,15 @@ function getExportFilePaths(entryExports) {
103
104
  }
104
105
  }
105
106
  }
106
- return [...new Set(paths)].filter((p) => p.startsWith("./"));
107
+ return [...new import_primordials.SetCtor(paths)].filter((p) => (0, import_primordials.StringPrototypeStartsWith)(p, "./"));
107
108
  }
108
109
  // @__NO_SIDE_EFFECTS__
109
110
  function getSubpaths(entryExports) {
110
111
  if (!(0, import_objects.isObject)(entryExports)) {
111
112
  return [];
112
113
  }
113
- return Object.getOwnPropertyNames(entryExports).filter(
114
- (key) => key.startsWith(".")
114
+ return (0, import_primordials.ObjectGetOwnPropertyNames)(entryExports).filter(
115
+ (key) => (0, import_primordials.StringPrototypeStartsWith)(key, ".")
115
116
  );
116
117
  }
117
118
  // @__NO_SIDE_EFFECTS__
@@ -119,14 +120,14 @@ function isConditionalExports(entryExports) {
119
120
  if (!(0, import_objects.isObjectObject)(entryExports)) {
120
121
  return false;
121
122
  }
122
- const keys = Object.getOwnPropertyNames(entryExports);
123
+ const keys = (0, import_primordials.ObjectGetOwnPropertyNames)(entryExports);
123
124
  const { length } = keys;
124
125
  if (!length) {
125
126
  return false;
126
127
  }
127
128
  for (let i = 0; i < length; i += 1) {
128
129
  const key = keys[i];
129
- if (key.length > 0 && key.charCodeAt(0) === 46) {
130
+ if (key.length > 0 && (0, import_primordials.StringPrototypeCharCodeAt)(key, 0) === 46) {
130
131
  return false;
131
132
  }
132
133
  }
@@ -135,7 +136,7 @@ function isConditionalExports(entryExports) {
135
136
  // @__NO_SIDE_EFFECTS__
136
137
  function isSubpathExports(entryExports) {
137
138
  if ((0, import_objects.isObjectObject)(entryExports)) {
138
- const keys = Object.getOwnPropertyNames(entryExports);
139
+ const keys = (0, import_primordials.ObjectGetOwnPropertyNames)(entryExports);
139
140
  for (let i = 0, { length } = keys; i < length; i += 1) {
140
141
  if (keys[i]?.charCodeAt(0) === 46) {
141
142
  return true;
@@ -40,10 +40,11 @@ var import_normalize = require("../paths/normalize");
40
40
  var import_socket = require("../paths/socket");
41
41
  var import_spawn = require("../spawn");
42
42
  var import_operations = require("./operations");
43
+ var import_primordials = require("../primordials");
43
44
  const FS_CP_OPTIONS = {
44
45
  dereference: true,
45
46
  errorOnExist: false,
46
- filter: (src) => !src.includes("node_modules") && !src.endsWith(".DS_Store"),
47
+ filter: (src) => !src.includes("node_modules") && !(0, import_primordials.StringPrototypeEndsWith)(src, ".DS_Store"),
47
48
  force: true,
48
49
  recursive: true,
49
50
  ...import_platform.WIN32 ? { maxRetries: 3, retryDelay: 100 } : {}
@@ -68,9 +69,9 @@ async function mergePackageJson(pkgJsonPath, originalPkgJson) {
68
69
  const fs = /* @__PURE__ */ getFs();
69
70
  let pkgJson;
70
71
  try {
71
- pkgJson = JSON.parse(await fs.promises.readFile(pkgJsonPath, "utf8"));
72
+ pkgJson = (0, import_primordials.JSONParse)(await fs.promises.readFile(pkgJsonPath, "utf8"));
72
73
  } catch (e) {
73
- throw new Error(`Failed to parse ${pkgJsonPath}: ${(0, import_errors.errorMessage)(e)}`, {
74
+ throw new import_primordials.ErrorCtor(`Failed to parse ${pkgJsonPath}: ${(0, import_errors.errorMessage)(e)}`, {
74
75
  cause: e
75
76
  });
76
77
  }
@@ -80,7 +81,11 @@ async function mergePackageJson(pkgJsonPath, originalPkgJson) {
80
81
  async function resolveRealPath(pathStr) {
81
82
  const fs = /* @__PURE__ */ getFs();
82
83
  const path = /* @__PURE__ */ getPath();
83
- return await fs.promises.realpath(pathStr).catch(() => path.resolve(pathStr));
84
+ try {
85
+ return await fs.promises.realpath(pathStr);
86
+ } catch {
87
+ return path.resolve(pathStr);
88
+ }
84
89
  }
85
90
  async function isolatePackage(packageSpec, options) {
86
91
  const fs = /* @__PURE__ */ getFs();
@@ -95,11 +100,11 @@ async function isolatePackage(packageSpec, options) {
95
100
  const pathToResolve = (0, import_normalize.isAbsolute)(trimmedPath) ? trimmedPath : packageSpec;
96
101
  sourcePath = path.resolve(pathToResolve);
97
102
  if (!fs.existsSync(sourcePath)) {
98
- throw new Error(`Source path does not exist: ${sourcePath}`);
103
+ throw new import_primordials.ErrorCtor(`Source path does not exist: ${sourcePath}`);
99
104
  }
100
105
  const pkgJson = await (0, import_operations.readPackageJson)(sourcePath, { normalize: true });
101
106
  if (!pkgJson) {
102
- throw new Error(`Could not read package.json from: ${sourcePath}`);
107
+ throw new import_primordials.ErrorCtor(`Could not read package.json from: ${sourcePath}`);
103
108
  }
104
109
  packageName = pkgJson.name;
105
110
  } else {
@@ -108,12 +113,12 @@ async function isolatePackage(packageSpec, options) {
108
113
  if (parsed.type === "directory" || parsed.type === "file") {
109
114
  sourcePath = parsed.fetchSpec;
110
115
  if (!sourcePath || !fs.existsSync(sourcePath)) {
111
- throw new Error(`Source path does not exist: ${sourcePath}`);
116
+ throw new import_primordials.ErrorCtor(`Source path does not exist: ${sourcePath}`);
112
117
  }
113
118
  if (!packageName) {
114
119
  const pkgJson = await (0, import_operations.readPackageJson)(sourcePath, { normalize: true });
115
120
  if (!pkgJson) {
116
- throw new Error(`Could not read package.json from: ${sourcePath}`);
121
+ throw new import_primordials.ErrorCtor(`Could not read package.json from: ${sourcePath}`);
117
122
  }
118
123
  packageName = pkgJson.name;
119
124
  }
@@ -122,7 +127,7 @@ async function isolatePackage(packageSpec, options) {
122
127
  }
123
128
  }
124
129
  if (!packageName) {
125
- throw new Error(`Could not determine package name from: ${packageSpec}`);
130
+ throw new import_primordials.ErrorCtor(`Could not determine package name from: ${packageSpec}`);
126
131
  }
127
132
  const sanitizedName = packageName.replace(/[@/]/g, "-");
128
133
  const tempDir = await fs.promises.mkdtemp(
@@ -148,7 +153,7 @@ async function isolatePackage(packageSpec, options) {
148
153
  if (install) {
149
154
  await install(packageTempDir);
150
155
  } else {
151
- const packageInstallSpec = spec.startsWith("https://") ? spec : `${packageName}@${spec}`;
156
+ const packageInstallSpec = (0, import_primordials.StringPrototypeStartsWith)(spec, "https://") ? spec : `${packageName}@${spec}`;
152
157
  await (0, import_spawn.spawn)("pnpm", ["add", packageInstallSpec], {
153
158
  cwd: packageTempDir,
154
159
  shell: import_platform.WIN32,
@@ -168,9 +173,11 @@ async function isolatePackage(packageSpec, options) {
168
173
  }
169
174
  } else {
170
175
  if (!sourcePath) {
171
- throw new Error("sourcePath is required when no version spec provided");
176
+ throw new import_primordials.ErrorCtor(
177
+ "sourcePath is required when no version spec provided"
178
+ );
172
179
  }
173
- const scopedPath = packageName.startsWith("@") ? path.join(
180
+ const scopedPath = (0, import_primordials.StringPrototypeStartsWith)(packageName, "@") ? path.join(
174
181
  packageTempDir,
175
182
  "node_modules",
176
183
  packageName.split("/")[0] ?? ""
@@ -202,7 +209,7 @@ async function isolatePackage(packageSpec, options) {
202
209
  }
203
210
  const exports2 = imports ? { __proto__: null } : void 0;
204
211
  if (imports) {
205
- for (const { 0: key, 1: specifier } of Object.entries(imports)) {
212
+ for (const { 0: key, 1: specifier } of (0, import_primordials.ObjectEntries)(imports)) {
206
213
  const fullPath = path.join(installedPath, specifier);
207
214
  exports2[key] = require(fullPath);
208
215
  }
@@ -46,6 +46,7 @@ var import_spdx_correct = __toESM(require("../external/spdx-correct"));
46
46
  var import_spdx_expression_parse = __toESM(require("../external/spdx-expression-parse"));
47
47
  var import_objects = require("../objects");
48
48
  var import_normalize = require("../paths/normalize");
49
+ var import_primordials = require("../primordials");
49
50
  const copyLeftLicenses = (0, import_licenses.getCopyLeftLicenses)();
50
51
  let _path;
51
52
  // @__NO_SIDE_EFFECTS__
@@ -71,7 +72,7 @@ function collectIncompatibleLicenses(licenseNodes) {
71
72
  }
72
73
  // @__NO_SIDE_EFFECTS__
73
74
  function collectLicenseWarnings(licenseNodes) {
74
- const warnings = /* @__PURE__ */ new Map();
75
+ const warnings = new import_primordials.MapCtor();
75
76
  for (let i = 0, { length } = licenseNodes; i < length; i += 1) {
76
77
  const node = licenseNodes[i];
77
78
  if (!node) {
@@ -139,7 +140,7 @@ function resolvePackageLicenses(licenseFieldValue, where) {
139
140
  if (licenseFieldValue === "UNLICENSED" || licenseFieldValue === "UNLICENCED") {
140
141
  return [{ license: "UNLICENSED" }];
141
142
  }
142
- const match = fileReferenceRegExp.exec(licenseFieldValue);
143
+ const match = (0, import_primordials.RegExpPrototypeExec)(fileReferenceRegExp, licenseFieldValue);
143
144
  if (match) {
144
145
  const path = /* @__PURE__ */ getPath();
145
146
  return [
@@ -174,7 +175,9 @@ function visitLicenses(ast, visitor) {
174
175
  let { length: queueLength } = queue;
175
176
  while (pos < queueLength) {
176
177
  if (pos === import_core.LOOP_SENTINEL) {
177
- throw new Error("Detected infinite loop in ast crawl of visitLicenses");
178
+ throw new import_primordials.ErrorCtor(
179
+ "Detected infinite loop in ast crawl of visitLicenses"
180
+ );
178
181
  }
179
182
  const { 0: node, 1: parent } = queue[pos++];
180
183
  const { type } = node;
@@ -45,6 +45,7 @@ var import_arrays = require("../arrays");
45
45
  var import_objects = require("../objects");
46
46
  var import_exports = require("./exports");
47
47
  var import_validation = require("./validation");
48
+ var import_primordials = require("../primordials");
48
49
  const abortSignal = (0, import_process.getAbortSignal)();
49
50
  const packageDefaultNodeRange = (0, import_packages.getPackageDefaultNodeRange)();
50
51
  const PACKAGE_DEFAULT_SOCKET_CATEGORIES = (0, import_packages.getPackageDefaultSocketCategories)();
@@ -91,7 +92,7 @@ function createPackageJson(sockRegPkgName, directory, options) {
91
92
  ...(0, import_objects.isObjectObject)(overrides) ? { overrides: { ...overrides } } : {},
92
93
  ...(0, import_objects.isObjectObject)(resolutions) ? { resolutions: { ...resolutions } } : {},
93
94
  ...(0, import_objects.isObjectObject)(engines) ? {
94
- engines: Object.fromEntries(
95
+ engines: (0, import_primordials.ObjectFromEntries)(
95
96
  (0, import_objects.objectEntries)(engines).map((pair) => {
96
97
  const strKey = String(pair[0]);
97
98
  const result = [strKey, pair[1]];
@@ -41,11 +41,12 @@ var import_regexps = require("../regexps");
41
41
  var import_normalize_package_data = __toESM(require("../external/normalize-package-data"));
42
42
  var import_objects = require("../objects");
43
43
  var import_operations = require("./operations");
44
+ var import_primordials = require("../primordials");
44
45
  const ArrayIsArray = Array.isArray;
45
46
  const ObjectHasOwn = Object.hasOwn;
46
47
  function getEscapedScopeRegExp() {
47
48
  const firstChar = import_socket.REGISTRY_SCOPE_DELIMITER[0];
48
- return new RegExp(
49
+ return new import_primordials.RegExpCtor(
49
50
  `^[^${(0, import_regexps.escapeRegExp)(firstChar)}]+${(0, import_regexps.escapeRegExp)(import_socket.REGISTRY_SCOPE_DELIMITER)}(?!${(0, import_regexps.escapeRegExp)(firstChar)})`
50
51
  );
51
52
  }
@@ -81,14 +82,17 @@ function normalizePackageJson(pkgJson, options) {
81
82
  // @__NO_SIDE_EFFECTS__
82
83
  function resolveEscapedScope(sockRegPkgName) {
83
84
  const escapedScopeRegExp = getEscapedScopeRegExp();
84
- const match = escapedScopeRegExp.exec(sockRegPkgName)?.[0];
85
+ const match = (0, import_primordials.RegExpPrototypeExec)(escapedScopeRegExp, sockRegPkgName)?.[0];
85
86
  return match || void 0;
86
87
  }
87
88
  // @__NO_SIDE_EFFECTS__
88
89
  function resolveOriginalPackageName(sockRegPkgName) {
89
- const name = sockRegPkgName.startsWith(`${import_socket.SOCKET_REGISTRY_SCOPE}/`) ? sockRegPkgName.slice(import_socket.SOCKET_REGISTRY_SCOPE.length + 1) : sockRegPkgName;
90
+ const name = (0, import_primordials.StringPrototypeStartsWith)(
91
+ sockRegPkgName,
92
+ `${import_socket.SOCKET_REGISTRY_SCOPE}/`
93
+ ) ? sockRegPkgName.slice(import_socket.SOCKET_REGISTRY_SCOPE.length + 1) : sockRegPkgName;
90
94
  const escapedScope = /* @__PURE__ */ resolveEscapedScope(name);
91
- return escapedScope ? `${/* @__PURE__ */ unescapeScope(escapedScope)}/${name.slice(escapedScope.length)}` : name;
95
+ return escapedScope ? `${/* @__PURE__ */ unescapeScope(escapedScope)}/${(0, import_primordials.StringPrototypeSlice)(name, escapedScope.length)}` : name;
92
96
  }
93
97
  // @__NO_SIDE_EFFECTS__
94
98
  function unescapeScope(escapedScope) {
@@ -57,6 +57,7 @@ var import_normalize = require("./normalize");
57
57
  var import_packages2 = require("../paths/packages");
58
58
  var import_specs = require("./specs");
59
59
  var import_edit = require("./edit");
60
+ var import_primordials = require("../primordials");
60
61
  const abortSignal = (0, import_process.getAbortSignal)();
61
62
  const packageExtensions = (0, import_packages.getPackageExtensions)();
62
63
  const packumentCache = (0, import_packages.getPackumentCache)();
@@ -131,13 +132,13 @@ function getReleaseTag(spec) {
131
132
  return "";
132
133
  }
133
134
  let atIndex = -1;
134
- if (spec.startsWith("@")) {
135
- atIndex = spec.indexOf("@", 1);
135
+ if ((0, import_primordials.StringPrototypeStartsWith)(spec, "@")) {
136
+ atIndex = (0, import_primordials.StringPrototypeIndexOf)(spec, "@", 1);
136
137
  } else {
137
- atIndex = spec.indexOf("@");
138
+ atIndex = (0, import_primordials.StringPrototypeIndexOf)(spec, "@");
138
139
  }
139
140
  if (atIndex !== -1) {
140
- return spec.slice(atIndex + 1);
141
+ return (0, import_primordials.StringPrototypeSlice)(spec, atIndex + 1);
141
142
  }
142
143
  return "";
143
144
  }
@@ -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;