@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.
- package/CHANGELOG.md +371 -1185
- package/README.md +1 -1
- package/dist/abort.js +7 -6
- package/dist/agent.js +16 -15
- package/dist/ansi.js +3 -2
- package/dist/archives.js +18 -17
- package/dist/argv/flags.js +29 -28
- package/dist/argv/parse.js +4 -3
- package/dist/arrays.js +3 -2
- package/dist/bin.js +12 -11
- package/dist/cacache.js +16 -11
- package/dist/cache-with-ttl.js +26 -21
- package/dist/colors.js +2 -1
- package/dist/constants/licenses.js +2 -1
- package/dist/constants/lifecycle-script-names.js +2 -1
- package/dist/constants/maintained-node-versions.js +2 -1
- package/dist/constants/node.js +4 -3
- package/dist/constants/package-default-socket-categories.js +2 -1
- package/dist/constants/packages.js +4 -3
- package/dist/constants/socket.js +1 -1
- package/dist/cover/code.js +9 -8
- package/dist/cover/formatters.js +12 -11
- package/dist/cover/type.js +5 -4
- package/dist/crypto.d.ts +36 -0
- package/dist/{effects/ultra.js → crypto.js} +26 -37
- package/dist/debug.js +12 -15
- package/dist/dlx/arborist.js +10 -9
- package/dist/dlx/binary.js +27 -24
- package/dist/dlx/cache.js +2 -10
- package/dist/dlx/detect.js +6 -5
- package/dist/dlx/integrity.js +13 -11
- package/dist/dlx/lockfile.js +7 -6
- package/dist/dlx/manifest.js +6 -5
- package/dist/dlx/package.js +17 -16
- package/dist/dlx/packages.js +6 -5
- package/dist/dlx/paths.d.ts +1 -1
- package/dist/dlx/paths.js +2 -1
- package/dist/effects/pulse-frames.js +4 -3
- package/dist/effects/shimmer-keyframes.d.ts +62 -0
- package/dist/effects/shimmer-keyframes.js +55 -0
- package/dist/effects/shimmer-terminal.d.ts +66 -0
- package/dist/effects/shimmer-terminal.js +57 -0
- package/dist/effects/shimmer.d.ts +293 -0
- package/dist/effects/shimmer.js +180 -0
- package/dist/env/rewire.js +4 -3
- package/dist/env.js +5 -4
- package/dist/errors.js +1 -1
- package/dist/external/@npmcli/package-json/lib/read-package.js +10 -10
- package/dist/external/@npmcli/package-json.js +372 -372
- package/dist/external/@npmcli/promise-spawn.js +24 -24
- package/dist/external/@socketregistry/packageurl-js.js +19 -18
- package/dist/external/@socketregistry/yocto-spinner.js +4 -3
- package/dist/external/@yarnpkg/extensions.js +2 -1
- package/dist/external/adm-zip.js +71 -71
- package/dist/external/debug.js +22 -22
- package/dist/external/external-pack.js +45 -45
- package/dist/external/fast-sort.js +5 -5
- package/dist/external/libnpmexec.js +4 -3
- package/dist/external/npm-pack.js +369 -369
- package/dist/external/p-map.js +9 -9
- package/dist/external/pico-pack.js +190 -190
- package/dist/external/pony-cause.js +2 -1
- package/dist/external/spdx-pack.js +11 -10
- package/dist/external/tar-fs.js +58 -58
- package/dist/external/which.js +13 -13
- package/dist/external/yargs-parser.js +71 -71
- package/dist/fs.js +50 -68
- package/dist/git.js +14 -13
- package/dist/github.d.ts +34 -0
- package/dist/github.js +248 -23
- package/dist/globs.d.ts +20 -0
- package/dist/globs.js +134 -25
- package/dist/http-request.d.ts +4 -3
- package/dist/http-request.js +39 -32
- package/dist/ipc-cli.js +2 -1
- package/dist/ipc.js +5 -4
- package/dist/json/edit.js +4 -3
- package/dist/json/format.js +3 -2
- package/dist/json/parse.js +7 -6
- package/dist/links.js +2 -1
- package/dist/logger.js +21 -14
- package/dist/memoization.js +16 -15
- package/dist/node/async-hooks.d.ts +6 -0
- package/dist/node/async-hooks.js +34 -0
- package/dist/node/child-process.d.ts +11 -0
- package/dist/node/child-process.js +34 -0
- package/dist/node/crypto.d.ts +6 -0
- package/dist/node/crypto.js +34 -0
- package/dist/node/events.d.ts +6 -0
- package/dist/node/events.js +34 -0
- package/dist/node/fs-promises.d.ts +6 -0
- package/dist/node/fs-promises.js +34 -0
- package/dist/node/fs.d.ts +14 -0
- package/dist/node/fs.js +34 -0
- package/dist/node/http.d.ts +6 -0
- package/dist/node/http.js +34 -0
- package/dist/node/https.d.ts +6 -0
- package/dist/node/https.js +34 -0
- package/dist/node/os.d.ts +6 -0
- package/dist/node/os.js +34 -0
- package/dist/node/path.d.ts +6 -0
- package/dist/node/path.js +34 -0
- package/dist/node/timers-promises.d.ts +6 -0
- package/dist/node/timers-promises.js +34 -0
- package/dist/node/url.d.ts +6 -0
- package/dist/node/url.js +34 -0
- package/dist/node/util.d.ts +6 -0
- package/dist/node/util.js +34 -0
- package/dist/objects.js +2 -2
- package/dist/packages/edit.js +8 -7
- package/dist/packages/exports.js +17 -16
- package/dist/packages/isolation.js +20 -13
- package/dist/packages/licenses.js +6 -3
- package/dist/packages/manifest.js +2 -1
- package/dist/packages/normalize.js +8 -4
- package/dist/packages/operations.js +5 -4
- package/dist/packages/provenance.js +7 -6
- package/dist/packages/specs.js +2 -1
- package/dist/packages/validation.js +2 -1
- package/dist/paths/normalize.js +32 -40
- package/dist/paths/packages.js +2 -1
- package/dist/paths/rewire.js +3 -2
- package/dist/performance.js +19 -18
- package/dist/primordials.d.ts +85 -2
- package/dist/primordials.js +311 -23
- package/dist/process-lock.js +14 -13
- package/dist/promise-queue.js +17 -9
- package/dist/promises.d.ts +29 -6
- package/dist/promises.js +19 -15
- package/dist/regexps.js +9 -8
- package/dist/releases/github-api.d.ts +56 -0
- package/dist/releases/github-api.js +275 -0
- package/dist/releases/github-archives.d.ts +60 -0
- package/dist/releases/github-archives.js +136 -0
- package/dist/releases/github-assets.d.ts +21 -0
- package/dist/releases/github-assets.js +52 -0
- package/dist/releases/github-auth.d.ts +16 -0
- package/dist/releases/github-auth.js +51 -0
- package/dist/releases/github-downloads.d.ts +42 -0
- package/dist/releases/github-downloads.js +155 -0
- package/dist/releases/github-types.d.ts +66 -0
- package/dist/{effects/types.js → releases/github-types.js} +2 -2
- package/dist/releases/socket-btm.d.ts +1 -1
- package/dist/releases/socket-btm.js +17 -17
- package/dist/schema/parse.js +2 -1
- package/dist/schema/validate.js +6 -5
- package/dist/sea/util.d.ts +43 -0
- package/dist/{sea.js → sea/util.js} +7 -7
- package/dist/shadow.js +2 -1
- package/dist/signal-exit.js +2 -2
- package/dist/smol/primordial.d.ts +80 -0
- package/dist/smol/primordial.js +46 -0
- package/dist/smol/util.d.ts +87 -0
- package/dist/smol/util.js +59 -0
- package/dist/smol/versions.d.ts +46 -0
- package/dist/smol/versions.js +46 -0
- package/dist/spawn.js +58 -63
- package/dist/spinner.d.ts +13 -6
- package/dist/spinner.js +75 -57
- package/dist/ssri.js +8 -7
- package/dist/stdio/footer.js +13 -12
- package/dist/stdio/header.js +5 -4
- package/dist/stdio/progress.js +13 -12
- package/dist/strings.js +19 -18
- package/dist/suppress-warnings.js +2 -2
- package/dist/tables.js +16 -13
- package/dist/temporary-executor.js +2 -1
- package/dist/themes/context.js +2 -1
- package/dist/themes/types.d.ts +1 -1
- package/dist/themes/utils.d.ts +8 -3
- package/dist/themes/utils.js +29 -5
- package/dist/url.js +4 -3
- package/dist/versions.js +27 -22
- package/package.json +120 -26
- package/dist/effects/text-shimmer.d.ts +0 -58
- package/dist/effects/text-shimmer.js +0 -192
- package/dist/effects/types.d.ts +0 -47
- package/dist/effects/ultra.d.ts +0 -22
- package/dist/releases/github.d.ts +0 -234
- package/dist/releases/github.js +0 -417
- package/dist/sea.d.ts +0 -30
- package/dist/themes/index.d.ts +0 -49
- package/dist/themes/index.js +0 -60
package/dist/packages/exports.js
CHANGED
|
@@ -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
|
|
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 =
|
|
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
|
|
78
|
-
if (!
|
|
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
|
-
|
|
84
|
+
(0, import_primordials.ArrayPrototypePush)(paths, value);
|
|
84
85
|
} else if ((0, import_objects.isObject)(value)) {
|
|
85
|
-
for (const subKey of
|
|
86
|
+
for (const subKey of (0, import_primordials.ObjectGetOwnPropertyNames)(value)) {
|
|
86
87
|
const subValue = value[subKey];
|
|
87
88
|
if (typeof subValue === "string") {
|
|
88
|
-
|
|
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
|
-
|
|
93
|
+
(0, import_primordials.ArrayPrototypePush)(paths, item);
|
|
93
94
|
} else if ((0, import_objects.isObject)(item)) {
|
|
94
|
-
for (const nestedKey of
|
|
95
|
+
for (const nestedKey of (0, import_primordials.ObjectGetOwnPropertyNames)(item)) {
|
|
95
96
|
const nestedValue = item[nestedKey];
|
|
96
97
|
if (typeof nestedValue === "string") {
|
|
97
|
-
|
|
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
|
|
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
|
|
114
|
-
(key) =>
|
|
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 =
|
|
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 &&
|
|
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 =
|
|
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") && !
|
|
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 =
|
|
72
|
+
pkgJson = (0, import_primordials.JSONParse)(await fs.promises.readFile(pkgJsonPath, "utf8"));
|
|
72
73
|
} catch (e) {
|
|
73
|
-
throw new
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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 =
|
|
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
|
|
176
|
+
throw new import_primordials.ErrorCtor(
|
|
177
|
+
"sourcePath is required when no version spec provided"
|
|
178
|
+
);
|
|
172
179
|
}
|
|
173
|
-
const scopedPath =
|
|
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
|
|
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 =
|
|
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 =
|
|
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
|
|
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:
|
|
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
|
|
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 =
|
|
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 =
|
|
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)}/${
|
|
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 (
|
|
135
|
-
atIndex =
|
|
135
|
+
if ((0, import_primordials.StringPrototypeStartsWith)(spec, "@")) {
|
|
136
|
+
atIndex = (0, import_primordials.StringPrototypeIndexOf)(spec, "@", 1);
|
|
136
137
|
} else {
|
|
137
|
-
atIndex =
|
|
138
|
+
atIndex = (0, import_primordials.StringPrototypeIndexOf)(spec, "@");
|
|
138
139
|
}
|
|
139
140
|
if (atIndex !== -1) {
|
|
140
|
-
return
|
|
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 =
|
|
54
|
+
const decodedPayload = (0, import_primordials.BufferFrom)(
|
|
54
55
|
att.bundle.dsseEnvelope.payload,
|
|
55
56
|
"base64"
|
|
56
57
|
).toString("utf8");
|
|
57
|
-
const statement =
|
|
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 &&
|
|
105
|
-
const firstPart =
|
|
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" ||
|
|
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
|
|
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) {
|
package/dist/packages/specs.js
CHANGED
|
@@ -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 =
|
|
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" ||
|
|
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) {
|
package/dist/paths/normalize.js
CHANGED
|
@@ -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 =
|
|
110
|
-
let toCode =
|
|
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(
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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) &&
|
|
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
|
|
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 (
|
|
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" &&
|
|
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 &&
|
|
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 &&
|
|
261
|
-
const code2 =
|
|
262
|
-
if ((code2 === 63 || code2 === 46) &&
|
|
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 && (
|
|
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 && (
|
|
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 =
|
|
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 && (
|
|
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 =
|
|
289
|
+
code = (0, import_primordials.StringPrototypeCharCodeAt)(filepath, start);
|
|
297
290
|
while (code === 47 || code === 92) {
|
|
298
291
|
start += 1;
|
|
299
|
-
code =
|
|
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 =
|
|
299
|
+
code = (0, import_primordials.StringPrototypeCharCodeAt)(filepath, start);
|
|
307
300
|
while (code === 47 || code === 92) {
|
|
308
301
|
start += 1;
|
|
309
|
-
code =
|
|
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 ?
|
|
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 =
|
|
357
|
+
code = (0, import_primordials.StringPrototypeCharCodeAt)(filepath, start);
|
|
365
358
|
while (code === 47 || code === 92) {
|
|
366
359
|
start += 1;
|
|
367
|
-
code =
|
|
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
|
-
|
|
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 &&
|
|
428
|
-
const letter =
|
|
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 &&
|
|
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 (
|
|
462
|
+
if ((0, import_primordials.StringPrototypeStartsWith)(filepath, "./") || (0, import_primordials.StringPrototypeStartsWith)(filepath, ".\\")) {
|
|
471
463
|
return filepath.slice(2);
|
|
472
464
|
}
|
|
473
465
|
return filepath;
|