@socketsecurity/lib 3.4.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +8 -8
  3. package/dist/agent.js +11 -24
  4. package/dist/bin.d.ts +97 -40
  5. package/dist/bin.js +129 -134
  6. package/dist/cacache.d.ts +5 -2
  7. package/dist/cacache.js +29 -18
  8. package/dist/cache-with-ttl.js +1 -1
  9. package/dist/constants/agents.d.ts +0 -4
  10. package/dist/constants/agents.js +13 -4
  11. package/dist/constants/node.d.ts +1 -0
  12. package/dist/constants/node.js +2 -5
  13. package/dist/constants/packages.js +22 -10
  14. package/dist/dlx-binary.js +9 -17
  15. package/dist/dlx-manifest.js +2 -2
  16. package/dist/dlx-package.js +22 -62
  17. package/dist/dlx.js +14 -14
  18. package/dist/fs.js +19 -24
  19. package/dist/git.d.ts +6 -6
  20. package/dist/git.js +11 -14
  21. package/dist/globs.js +16 -29
  22. package/dist/ipc.d.ts +4 -4
  23. package/dist/ipc.js +3 -3
  24. package/dist/logger.d.ts +0 -25
  25. package/dist/logger.js +0 -26
  26. package/dist/package-default-node-range.js +13 -3
  27. package/dist/package-extensions.d.ts +2 -1
  28. package/dist/package-extensions.js +12 -2
  29. package/dist/packages/editable.d.ts +0 -3
  30. package/dist/packages/editable.js +34 -24
  31. package/dist/packages/isolation.js +32 -32
  32. package/dist/packages/licenses.js +18 -32
  33. package/dist/packages/manifest.js +18 -33
  34. package/dist/packages/normalize.js +19 -43
  35. package/dist/packages/operations.js +33 -80
  36. package/dist/packages/provenance.js +14 -4
  37. package/dist/packages/specs.js +13 -12
  38. package/dist/packages/validation.js +12 -10
  39. package/dist/packages.d.ts +1 -1
  40. package/dist/packages.js +3 -3
  41. package/dist/paths/dirnames.d.ts +13 -0
  42. package/dist/paths/dirnames.js +50 -0
  43. package/dist/paths/exts.d.ts +18 -0
  44. package/dist/paths/exts.js +68 -0
  45. package/dist/paths/filenames.d.ts +16 -0
  46. package/dist/paths/filenames.js +62 -0
  47. package/dist/paths/globs.d.ts +10 -0
  48. package/dist/paths/globs.js +44 -0
  49. package/dist/{path.d.ts → paths/normalize.d.ts} +41 -0
  50. package/dist/{path.js → paths/normalize.js} +17 -4
  51. package/dist/{packages/paths.js → paths/packages.js} +8 -8
  52. package/dist/{paths.js → paths/socket.js} +29 -65
  53. package/dist/sea.js +2 -2
  54. package/dist/shadow.js +3 -3
  55. package/dist/sorts.js +12 -2
  56. package/dist/spawn.d.ts +15 -12
  57. package/dist/spawn.js +42 -30
  58. package/dist/spinner.d.ts +2 -6
  59. package/dist/spinner.js +6 -39
  60. package/dist/stdio/prompts.d.ts +8 -10
  61. package/dist/stdio/prompts.js +14 -12
  62. package/dist/streams.d.ts +0 -4
  63. package/dist/streams.js +3 -12
  64. package/dist/temporary-executor.js +3 -3
  65. package/dist/versions.js +31 -28
  66. package/package.json +28 -16
  67. package/dist/constants/paths.d.ts +0 -51
  68. package/dist/constants/paths.js +0 -152
  69. /package/dist/{packages/paths.d.ts → paths/packages.d.ts} +0 -0
  70. /package/dist/{paths.d.ts → paths/socket.d.ts} +0 -0
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with esbuild */
3
+ var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
6
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
9
  var __export = (target, all) => {
8
10
  for (var name in all)
@@ -16,6 +18,14 @@ var __copyProps = (to, from, except, desc) => {
16
18
  }
17
19
  return to;
18
20
  };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
19
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
30
  var isolation_exports = {};
21
31
  __export(isolation_exports, {
@@ -24,17 +34,12 @@ __export(isolation_exports, {
24
34
  module.exports = __toCommonJS(isolation_exports);
25
35
  var import_fs = require("fs");
26
36
  var import_platform = require("#constants/platform");
27
- var import_path = require("../path");
37
+ var import_node_path = __toESM(require("node:path"));
38
+ var import_npm_package_arg = __toESM(require("../external/npm-package-arg"));
39
+ var import_spawn = require("../spawn");
40
+ var import_normalize = require("../paths/normalize");
28
41
  var import_operations = require("./operations");
29
- var import_paths = require("#lib/paths");
30
- let _path;
31
- // @__NO_SIDE_EFFECTS__
32
- function getPath() {
33
- if (_path === void 0) {
34
- _path = require("node:path");
35
- }
36
- return _path;
37
- }
42
+ var import_socket = require("../paths/socket");
38
43
  const FS_CP_OPTIONS = {
39
44
  dereference: true,
40
45
  errorOnExist: false,
@@ -44,8 +49,7 @@ const FS_CP_OPTIONS = {
44
49
  ...import_platform.WIN32 ? { maxRetries: 3, retryDelay: 100 } : {}
45
50
  };
46
51
  async function resolveRealPath(pathStr) {
47
- const path = /* @__PURE__ */ getPath();
48
- return await import_fs.promises.realpath(pathStr).catch(() => path.resolve(pathStr));
52
+ return await import_fs.promises.realpath(pathStr).catch(() => import_node_path.default.resolve(pathStr));
49
53
  }
50
54
  async function mergePackageJson(pkgJsonPath, originalPkgJson) {
51
55
  const pkgJson = JSON.parse(await import_fs.promises.readFile(pkgJsonPath, "utf8"));
@@ -53,16 +57,15 @@ async function mergePackageJson(pkgJsonPath, originalPkgJson) {
53
57
  return mergedPkgJson;
54
58
  }
55
59
  async function isolatePackage(packageSpec, options) {
56
- const path = /* @__PURE__ */ getPath();
57
60
  const opts = { __proto__: null, ...options };
58
61
  const { imports, install, onPackageJson, sourcePath: optSourcePath } = opts;
59
62
  let sourcePath = optSourcePath;
60
63
  let packageName;
61
64
  let spec;
62
- if ((0, import_path.isPath)(packageSpec)) {
63
- const trimmedPath = (0, import_path.trimLeadingDotSlash)(packageSpec);
64
- const pathToResolve = (0, import_path.isAbsolute)(trimmedPath) ? trimmedPath : packageSpec;
65
- sourcePath = path.resolve(pathToResolve);
65
+ if ((0, import_normalize.isPath)(packageSpec)) {
66
+ const trimmedPath = (0, import_normalize.trimLeadingDotSlash)(packageSpec);
67
+ const pathToResolve = (0, import_normalize.isAbsolute)(trimmedPath) ? trimmedPath : packageSpec;
68
+ sourcePath = import_node_path.default.resolve(pathToResolve);
66
69
  if (!(0, import_fs.existsSync)(sourcePath)) {
67
70
  throw new Error(`Source path does not exist: ${sourcePath}`);
68
71
  }
@@ -72,8 +75,7 @@ async function isolatePackage(packageSpec, options) {
72
75
  }
73
76
  packageName = pkgJson.name;
74
77
  } else {
75
- const npa = require("../external/npm-package-arg");
76
- const parsed = npa(packageSpec);
78
+ const parsed = (0, import_npm_package_arg.default)(packageSpec);
77
79
  packageName = parsed.name;
78
80
  if (parsed.type === "directory" || parsed.type === "file") {
79
81
  sourcePath = parsed.fetchSpec;
@@ -96,15 +98,15 @@ async function isolatePackage(packageSpec, options) {
96
98
  }
97
99
  const sanitizedName = packageName.replace(/[@/]/g, "-");
98
100
  const tempDir = await import_fs.promises.mkdtemp(
99
- path.join((0, import_paths.getOsTmpDir)(), `socket-test-${sanitizedName}-`)
101
+ import_node_path.default.join((0, import_socket.getOsTmpDir)(), `socket-test-${sanitizedName}-`)
100
102
  );
101
- const packageTempDir = path.join(tempDir, sanitizedName);
103
+ const packageTempDir = import_node_path.default.join(tempDir, sanitizedName);
102
104
  await import_fs.promises.mkdir(packageTempDir, { recursive: true });
103
105
  let installedPath;
104
106
  let originalPackageJson;
105
107
  if (spec) {
106
108
  await import_fs.promises.writeFile(
107
- path.join(packageTempDir, "package.json"),
109
+ import_node_path.default.join(packageTempDir, "package.json"),
108
110
  JSON.stringify(
109
111
  {
110
112
  name: "test-temp",
@@ -118,15 +120,14 @@ async function isolatePackage(packageSpec, options) {
118
120
  if (install) {
119
121
  await install(packageTempDir);
120
122
  } else {
121
- const { spawn } = require("../spawn");
122
123
  const packageInstallSpec = spec.startsWith("https://") ? spec : `${packageName}@${spec}`;
123
- await spawn("pnpm", ["add", packageInstallSpec], {
124
+ await (0, import_spawn.spawn)("pnpm", ["add", packageInstallSpec], {
124
125
  cwd: packageTempDir,
125
126
  shell: import_platform.WIN32,
126
127
  stdio: "pipe"
127
128
  });
128
129
  }
129
- installedPath = path.join(packageTempDir, "node_modules", packageName);
130
+ installedPath = import_node_path.default.join(packageTempDir, "node_modules", packageName);
130
131
  originalPackageJson = await (0, import_operations.readPackageJson)(installedPath, {
131
132
  normalize: true
132
133
  });
@@ -141,17 +142,17 @@ async function isolatePackage(packageSpec, options) {
141
142
  if (!sourcePath) {
142
143
  throw new Error("sourcePath is required when no version spec provided");
143
144
  }
144
- const scopedPath = packageName.startsWith("@") ? path.join(
145
+ const scopedPath = packageName.startsWith("@") ? import_node_path.default.join(
145
146
  packageTempDir,
146
147
  "node_modules",
147
148
  packageName.split("/")[0] ?? ""
148
- ) : path.join(packageTempDir, "node_modules");
149
+ ) : import_node_path.default.join(packageTempDir, "node_modules");
149
150
  await import_fs.promises.mkdir(scopedPath, { recursive: true });
150
- installedPath = path.join(packageTempDir, "node_modules", packageName);
151
+ installedPath = import_node_path.default.join(packageTempDir, "node_modules", packageName);
151
152
  await import_fs.promises.cp(sourcePath, installedPath, FS_CP_OPTIONS);
152
153
  }
153
154
  if (onPackageJson || originalPackageJson) {
154
- const pkgJsonPath = path.join(installedPath, "package.json");
155
+ const pkgJsonPath = import_node_path.default.join(installedPath, "package.json");
155
156
  const mergedPkgJson = await mergePackageJson(
156
157
  pkgJsonPath,
157
158
  originalPackageJson
@@ -162,8 +163,7 @@ async function isolatePackage(packageSpec, options) {
162
163
  if (install) {
163
164
  await install(installedPath);
164
165
  } else {
165
- const { spawn } = require("../spawn");
166
- await spawn("pnpm", ["install"], {
166
+ await (0, import_spawn.spawn)("pnpm", ["install"], {
167
167
  cwd: installedPath,
168
168
  shell: import_platform.WIN32,
169
169
  stdio: "pipe"
@@ -172,7 +172,7 @@ async function isolatePackage(packageSpec, options) {
172
172
  const exports2 = imports ? { __proto__: null } : void 0;
173
173
  if (imports) {
174
174
  for (const { 0: key, 1: specifier } of Object.entries(imports)) {
175
- const fullPath = path.join(installedPath, specifier);
175
+ const fullPath = import_node_path.default.join(installedPath, specifier);
176
176
  exports2[key] = require(fullPath);
177
177
  }
178
178
  }
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with esbuild */
3
+ var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
6
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
9
  var __export = (target, all) => {
8
10
  for (var name in all)
@@ -16,6 +18,14 @@ var __copyProps = (to, from, except, desc) => {
16
18
  }
17
19
  return to;
18
20
  };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
19
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
30
  var licenses_exports = {};
21
31
  __export(licenses_exports, {
@@ -31,36 +41,15 @@ __export(licenses_exports, {
31
41
  module.exports = __toCommonJS(licenses_exports);
32
42
  var import_core = require("#constants/core");
33
43
  var import_licenses = require("#constants/licenses");
44
+ var import_node_path = __toESM(require("node:path"));
45
+ var import_spdx_correct = __toESM(require("../external/spdx-correct"));
46
+ var import_spdx_expression_parse = __toESM(require("../external/spdx-expression-parse"));
34
47
  var import_objects = require("../objects");
35
- var import_path = require("../path");
48
+ var import_normalize = require("../paths/normalize");
36
49
  const copyLeftLicenses = (0, import_licenses.getCopyLeftLicenses)();
37
50
  const BINARY_OPERATION_NODE_TYPE = "BinaryOperation";
38
51
  const LICENSE_NODE_TYPE = "License";
39
52
  const fileReferenceRegExp = /^SEE LICEN[CS]E IN (.+)$/;
40
- let _path;
41
- // @__NO_SIDE_EFFECTS__
42
- function getPath() {
43
- if (_path === void 0) {
44
- _path = require("node:path");
45
- }
46
- return _path;
47
- }
48
- let _spdxCorrect;
49
- // @__NO_SIDE_EFFECTS__
50
- function getSpdxCorrect() {
51
- if (_spdxCorrect === void 0) {
52
- _spdxCorrect = require("../external/spdx-correct");
53
- }
54
- return _spdxCorrect;
55
- }
56
- let _spdxExpParse;
57
- // @__NO_SIDE_EFFECTS__
58
- function getSpdxExpParse() {
59
- if (_spdxExpParse === void 0) {
60
- _spdxExpParse = require("../external/spdx-expression-parse");
61
- }
62
- return _spdxExpParse;
63
- }
64
53
  // @__NO_SIDE_EFFECTS__
65
54
  function collectIncompatibleLicenses(licenseNodes) {
66
55
  const result = [];
@@ -130,14 +119,12 @@ function createLicenseNode(rawNode) {
130
119
  }
131
120
  // @__NO_SIDE_EFFECTS__
132
121
  function parseSpdxExp(spdxExp) {
133
- const spdxExpParse = /* @__PURE__ */ getSpdxExpParse();
134
122
  try {
135
- return spdxExpParse(spdxExp);
123
+ return (0, import_spdx_expression_parse.default)(spdxExp);
136
124
  } catch {
137
125
  }
138
- const spdxCorrect = /* @__PURE__ */ getSpdxCorrect();
139
- const corrected = spdxCorrect(spdxExp);
140
- return corrected ? spdxExpParse(corrected) : void 0;
126
+ const corrected = (0, import_spdx_correct.default)(spdxExp);
127
+ return corrected ? (0, import_spdx_expression_parse.default)(corrected) : void 0;
141
128
  }
142
129
  // @__NO_SIDE_EFFECTS__
143
130
  function resolvePackageLicenses(licenseFieldValue, where) {
@@ -146,11 +133,10 @@ function resolvePackageLicenses(licenseFieldValue, where) {
146
133
  }
147
134
  const match = fileReferenceRegExp.exec(licenseFieldValue);
148
135
  if (match) {
149
- const path = /* @__PURE__ */ getPath();
150
136
  return [
151
137
  {
152
138
  license: licenseFieldValue,
153
- inFile: (0, import_path.normalizePath)(path.relative(where, match[1] || ""))
139
+ inFile: (0, import_normalize.normalizePath)(import_node_path.default.relative(where, match[1] || ""))
154
140
  }
155
141
  ];
156
142
  }
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with esbuild */
3
+ var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
6
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
9
  var __export = (target, all) => {
8
10
  for (var name in all)
@@ -16,6 +18,14 @@ var __copyProps = (to, from, except, desc) => {
16
18
  }
17
19
  return to;
18
20
  };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
19
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
30
  var manifest_exports = {};
21
31
  __export(manifest_exports, {
@@ -27,6 +37,9 @@ module.exports = __toCommonJS(manifest_exports);
27
37
  var import_packages = require("#constants/packages");
28
38
  var import_process = require("#constants/process");
29
39
  var import_socket = require("#constants/socket");
40
+ var import_npm_package_arg = __toESM(require("../external/npm-package-arg"));
41
+ var import_pacote = __toESM(require("../external/pacote"));
42
+ var import_semver = __toESM(require("../external/semver"));
30
43
  var import_arrays = require("../arrays");
31
44
  var import_objects = require("../objects");
32
45
  var import_exports = require("./exports");
@@ -36,30 +49,6 @@ const packageDefaultNodeRange = (0, import_packages.getPackageDefaultNodeRange)(
36
49
  const PACKAGE_DEFAULT_SOCKET_CATEGORIES = (0, import_packages.getPackageDefaultSocketCategories)();
37
50
  const packumentCache = (0, import_packages.getPackumentCache)();
38
51
  const pkgScopePrefixRegExp = /^@socketregistry\//;
39
- let _npmPackageArg;
40
- // @__NO_SIDE_EFFECTS__
41
- function getNpmPackageArg() {
42
- if (_npmPackageArg === void 0) {
43
- _npmPackageArg = require("../external/npm-package-arg");
44
- }
45
- return _npmPackageArg;
46
- }
47
- let _pacote;
48
- // @__NO_SIDE_EFFECTS__
49
- function getPacote() {
50
- if (_pacote === void 0) {
51
- _pacote = require("../external/pacote");
52
- }
53
- return _pacote;
54
- }
55
- let _semver;
56
- // @__NO_SIDE_EFFECTS__
57
- function getSemver() {
58
- if (_semver === void 0) {
59
- _semver = require("../external/semver");
60
- }
61
- return _semver;
62
- }
63
52
  // @__NO_SIDE_EFFECTS__
64
53
  function createPackageJson(sockRegPkgName, directory, options) {
65
54
  const {
@@ -106,11 +95,10 @@ function createPackageJson(sockRegPkgName, directory, options) {
106
95
  const strKey = String(pair[0]);
107
96
  const result = [strKey, pair[1]];
108
97
  if (strKey === "node") {
109
- const semver = /* @__PURE__ */ getSemver();
110
98
  const { 1: range } = result;
111
99
  if (typeof range === "string" && range && packageDefaultNodeRange) {
112
- const coercedRange = semver.coerce(range);
113
- if (!semver.satisfies(
100
+ const coercedRange = import_semver.default.coerce(range);
101
+ if (!import_semver.default.satisfies(
114
102
  coercedRange?.version ?? "0.0.0",
115
103
  packageDefaultNodeRange
116
104
  )) {
@@ -144,18 +132,16 @@ async function fetchPackageManifest(pkgNameOrId, options) {
144
132
  if (signal?.aborted) {
145
133
  return void 0;
146
134
  }
147
- const pacote = /* @__PURE__ */ getPacote();
148
135
  let result;
149
136
  try {
150
- result = await pacote.manifest(pkgNameOrId, pacoteOptions);
137
+ result = await import_pacote.default.manifest(pkgNameOrId, pacoteOptions);
151
138
  } catch {
152
139
  }
153
140
  if (signal?.aborted) {
154
141
  return void 0;
155
142
  }
156
143
  if (result) {
157
- const npmPackageArg = /* @__PURE__ */ getNpmPackageArg();
158
- const spec = npmPackageArg(pkgNameOrId, pacoteOptions.where);
144
+ const spec = (0, import_npm_package_arg.default)(pkgNameOrId, pacoteOptions.where);
159
145
  if ((0, import_validation.isRegistryFetcherType)(spec.type)) {
160
146
  return result;
161
147
  }
@@ -171,9 +157,8 @@ async function fetchPackageManifest(pkgNameOrId, options) {
171
157
  }
172
158
  // @__NO_SIDE_EFFECTS__
173
159
  async function fetchPackagePackument(pkgNameOrId, options) {
174
- const pacote = /* @__PURE__ */ getPacote();
175
160
  try {
176
- return await pacote.packument(pkgNameOrId, {
161
+ return await import_pacote.default.packument(pkgNameOrId, {
177
162
  __proto__: null,
178
163
  signal: abortSignal,
179
164
  ...options,
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with esbuild */
3
+ var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
6
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
9
  var __export = (target, all) => {
8
10
  for (var name in all)
@@ -16,6 +18,14 @@ var __copyProps = (to, from, except, desc) => {
16
18
  }
17
19
  return to;
18
20
  };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
19
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
30
  var normalize_exports = {};
21
31
  __export(normalize_exports, {
@@ -25,50 +35,19 @@ __export(normalize_exports, {
25
35
  unescapeScope: () => unescapeScope
26
36
  });
27
37
  module.exports = __toCommonJS(normalize_exports);
38
+ var import_socket = require("../constants/socket");
39
+ var import_regexps = require("../regexps");
40
+ var import_normalize_package_data = __toESM(require("../external/normalize-package-data"));
28
41
  var import_objects = require("../objects");
29
42
  const ArrayIsArray = Array.isArray;
30
43
  const ObjectHasOwn = Object.hasOwn;
31
- let _REGISTRY_SCOPE_DELIMITER;
32
- function getRegistryScopeDelimiter() {
33
- if (_REGISTRY_SCOPE_DELIMITER === void 0) {
34
- _REGISTRY_SCOPE_DELIMITER = /*@__INLINE__*/
35
- require("../constants/socket").REGISTRY_SCOPE_DELIMITER;
36
- }
37
- return _REGISTRY_SCOPE_DELIMITER;
38
- }
39
- let _SOCKET_REGISTRY_SCOPE;
40
- function getSocketRegistryScope() {
41
- if (_SOCKET_REGISTRY_SCOPE === void 0) {
42
- _SOCKET_REGISTRY_SCOPE = /*@__INLINE__*/
43
- require("../constants/socket").SOCKET_REGISTRY_SCOPE;
44
- }
45
- return _SOCKET_REGISTRY_SCOPE;
46
- }
47
- let _escapeRegExp;
48
- function getEscapeRegExp() {
49
- if (_escapeRegExp === void 0) {
50
- _escapeRegExp = require("../regexps").escapeRegExp;
51
- }
52
- return _escapeRegExp;
53
- }
54
44
  function getEscapedScopeRegExp() {
55
- const REGISTRY_SCOPE_DELIMITER = getRegistryScopeDelimiter();
56
- const escapeRegExp = getEscapeRegExp();
57
- const firstChar = REGISTRY_SCOPE_DELIMITER[0];
45
+ const firstChar = import_socket.REGISTRY_SCOPE_DELIMITER[0];
58
46
  return new RegExp(
59
- `^[^${escapeRegExp(firstChar)}]+${escapeRegExp(REGISTRY_SCOPE_DELIMITER)}(?!${escapeRegExp(firstChar)})`
47
+ `^[^${(0, import_regexps.escapeRegExp)(firstChar)}]+${(0, import_regexps.escapeRegExp)(import_socket.REGISTRY_SCOPE_DELIMITER)}(?!${(0, import_regexps.escapeRegExp)(firstChar)})`
60
48
  );
61
49
  }
62
- let _normalizePackageData;
63
- // @__NO_SIDE_EFFECTS__
64
- function getNormalizePackageData() {
65
- if (_normalizePackageData === void 0) {
66
- _normalizePackageData = require("../external/normalize-package-data");
67
- }
68
- return _normalizePackageData;
69
- }
70
50
  let _findPackageExtensions;
71
- // @__NO_SIDE_EFFECTS__
72
51
  function _getFindPackageExtensions() {
73
52
  if (_findPackageExtensions === void 0) {
74
53
  const operations = require("#packages/operations");
@@ -93,10 +72,9 @@ function normalizePackageJson(pkgJson, options) {
93
72
  ObjectHasOwn(pkgJson, k) ? pkgJson[k] : void 0
94
73
  ]) : []
95
74
  ];
96
- const normalizePackageData = /* @__PURE__ */ getNormalizePackageData();
97
- normalizePackageData(pkgJson);
75
+ (0, import_normalize_package_data.default)(pkgJson);
98
76
  if (pkgJson.name && pkgJson.version) {
99
- const findPackageExtensions = /* @__PURE__ */ _getFindPackageExtensions();
77
+ const findPackageExtensions = _getFindPackageExtensions();
100
78
  const extensions = findPackageExtensions(pkgJson.name, pkgJson.version);
101
79
  if (extensions && typeof extensions === "object") {
102
80
  (0, import_objects.merge)(pkgJson, extensions);
@@ -115,15 +93,13 @@ function resolveEscapedScope(sockRegPkgName) {
115
93
  }
116
94
  // @__NO_SIDE_EFFECTS__
117
95
  function resolveOriginalPackageName(sockRegPkgName) {
118
- const SOCKET_REGISTRY_SCOPE = getSocketRegistryScope();
119
- const name = sockRegPkgName.startsWith(`${SOCKET_REGISTRY_SCOPE}/`) ? sockRegPkgName.slice(SOCKET_REGISTRY_SCOPE.length + 1) : sockRegPkgName;
96
+ const name = sockRegPkgName.startsWith(`${import_socket.SOCKET_REGISTRY_SCOPE}/`) ? sockRegPkgName.slice(import_socket.SOCKET_REGISTRY_SCOPE.length + 1) : sockRegPkgName;
120
97
  const escapedScope = /* @__PURE__ */ resolveEscapedScope(name);
121
98
  return escapedScope ? `${/* @__PURE__ */ unescapeScope(escapedScope)}/${name.slice(escapedScope.length)}` : name;
122
99
  }
123
100
  // @__NO_SIDE_EFFECTS__
124
101
  function unescapeScope(escapedScope) {
125
- const REGISTRY_SCOPE_DELIMITER = getRegistryScopeDelimiter();
126
- return `@${escapedScope.slice(0, -REGISTRY_SCOPE_DELIMITER.length)}`;
102
+ return `@${escapedScope.slice(0, -import_socket.REGISTRY_SCOPE_DELIMITER.length)}`;
127
103
  }
128
104
  // Annotate the CommonJS export names for ESM import in node:
129
105
  0 && (module.exports = {