@socketsecurity/lib 6.0.7 → 6.0.8
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 +20 -0
- package/README.md +1 -1
- package/dist/ai/agent-context.d.mts +103 -0
- package/dist/ai/agent-context.js +157 -0
- package/dist/ai/backends.d.mts +83 -0
- package/dist/ai/backends.js +173 -0
- package/dist/ai/credentials.d.mts +49 -0
- package/dist/ai/credentials.js +82 -0
- package/dist/ai/discover.d.mts +4 -0
- package/dist/ai/discover.js +1 -1
- package/dist/ai/exec.d.mts +52 -0
- package/dist/ai/exec.js +92 -0
- package/dist/ai/http.d.mts +132 -0
- package/dist/ai/http.js +130 -0
- package/dist/ai/profiles.d.mts +41 -6
- package/dist/ai/profiles.js +52 -10
- package/dist/ai/route.d.mts +69 -0
- package/dist/ai/route.js +156 -0
- package/dist/ai/spawn.d.mts +10 -2
- package/dist/ai/spawn.js +55 -31
- package/dist/ai/subagent-status.d.mts +48 -0
- package/dist/ai/subagent-status.js +57 -0
- package/dist/ai/tier.d.mts +60 -0
- package/dist/ai/tier.js +53 -0
- package/dist/ai/types.d.mts +15 -2
- package/dist/ai/worktree.js +4 -0
- package/dist/archives/tar.js +1 -1
- package/dist/archives/zip.js +2 -2
- package/dist/argv/parse.d.ts +19 -2
- package/dist/argv/parse.js +1 -1
- package/dist/arrays/join.js +4 -0
- package/dist/bin/find.js +4 -4
- package/dist/bin/prim.cjs +3915 -3781
- package/dist/bin/resolve.js +1 -1
- package/dist/cache/ttl/store.js +1 -1
- package/dist/cli/check-primordials.d.ts +8 -3
- package/dist/cli/check-primordials.js +4 -4
- package/dist/compression/_internal.js +1 -1
- package/dist/compression/brotli.d.ts +1 -2
- package/dist/compression/brotli.js +6 -2
- package/dist/compression/gzip.js +6 -2
- package/dist/constants/packages.d.ts +3 -0
- package/dist/constants/packages.js +2 -1
- package/dist/constants/socket.d.ts +2 -6
- package/dist/constants/socket.js +12 -14
- package/dist/cover/code.js +2 -2
- package/dist/crypto/hash.d.ts +4 -1
- package/dist/crypto/hash.js +4 -1
- package/dist/debug/caller-info.js +1 -1
- package/dist/dlx/arborist.js +13 -3
- package/dist/dlx/binary-cache.js +1 -1
- package/dist/dlx/binary-resolution.js +1 -1
- package/dist/dlx/detect.d.ts +8 -0
- package/dist/dlx/firewall.d.ts +8 -0
- package/dist/dlx/firewall.js +1 -1
- package/dist/dlx/lockfile.js +4 -1
- package/dist/dlx/manifest.js +1 -1
- package/dist/dlx/package.js +4 -0
- package/dist/eco/cargo/parse-lockfile.d.ts +1 -2
- package/dist/eco/cargo/parse-lockfile.js +3 -3
- package/dist/eco/manifest/detect-format.js +1 -1
- package/dist/eco/npm/npm/parse-lockfile.d.ts +3 -4
- package/dist/eco/npm/npm/parse-lockfile.js +2 -2
- package/dist/eco/npm/parse-package-json.d.ts +11 -0
- package/dist/eco/npm/parse-package-json.js +1 -1
- package/dist/eco/npm/pnpm/parse-lockfile.d.ts +5 -3
- package/dist/eco/npm/pnpm/parse-lockfile.js +3 -3
- package/dist/eco/npm/yarnpkg/yarn/exec.js +1 -1
- package/dist/eco/npm/yarnpkg/yarn/parse-lockfile.d.ts +1 -2
- package/dist/eco/npm/yarnpkg/yarn/parse-lockfile.js +1 -1
- package/dist/env/proxy.js +1 -1
- package/dist/env/rewire.d.ts +1 -0
- package/dist/env/rewire.js +1 -1
- package/dist/env/socket.d.ts +7 -0
- package/dist/env/socket.js +10 -0
- package/dist/errors/predicates.js +1 -1
- package/dist/external/@npmcli/promise-spawn.js +3 -1
- package/dist/external/pico-pack.js +4 -2
- package/dist/external/which.js +3 -1
- package/dist/external-tools/bazel/asset-names.d.ts +1 -1
- package/dist/external-tools/bazel/asset-names.js +5 -2
- package/dist/external-tools/bazel/from-download.d.ts +1 -1
- package/dist/external-tools/bazel/from-download.js +5 -2
- package/dist/external-tools/bazel/resolve-bazel-version.js +4 -0
- package/dist/external-tools/bazel/resolve.d.ts +3 -3
- package/dist/external-tools/bazel/resolve.js +16 -8
- package/dist/external-tools/cdxgen/asset-names.d.ts +1 -1
- package/dist/external-tools/cdxgen/asset-names.js +5 -2
- package/dist/external-tools/cdxgen/from-download.d.ts +1 -1
- package/dist/external-tools/cdxgen/from-download.js +7 -4
- package/dist/external-tools/cdxgen/resolve.d.ts +3 -3
- package/dist/external-tools/cdxgen/resolve.js +16 -8
- package/dist/external-tools/from-download.d.ts +2 -2
- package/dist/external-tools/from-download.js +11 -5
- package/dist/external-tools/from-pip-venv.d.ts +1 -1
- package/dist/external-tools/from-pip-venv.js +12 -5
- package/dist/external-tools/janus/asset-names.d.ts +1 -1
- package/dist/external-tools/janus/asset-names.js +5 -2
- package/dist/external-tools/janus/from-download.d.ts +1 -1
- package/dist/external-tools/janus/from-download.js +5 -2
- package/dist/external-tools/janus/resolve.d.ts +3 -3
- package/dist/external-tools/janus/resolve.js +16 -8
- package/dist/external-tools/jre/asset-names.d.ts +1 -1
- package/dist/external-tools/jre/asset-names.js +5 -2
- package/dist/external-tools/jre/from-download.d.ts +1 -1
- package/dist/external-tools/jre/from-download.js +7 -4
- package/dist/external-tools/jre/from-java-home.js +2 -2
- package/dist/external-tools/jre/from-vfs.js +2 -2
- package/dist/external-tools/jre/resolve.d.ts +3 -3
- package/dist/external-tools/jre/resolve.js +16 -8
- package/dist/external-tools/manifest.d.ts +18 -0
- package/dist/external-tools/manifest.js +1 -1
- package/dist/external-tools/opengrep/asset-names.d.ts +1 -1
- package/dist/external-tools/opengrep/asset-names.js +5 -2
- package/dist/external-tools/opengrep/from-download.d.ts +1 -1
- package/dist/external-tools/opengrep/from-download.js +5 -2
- package/dist/external-tools/opengrep/resolve.d.ts +3 -3
- package/dist/external-tools/opengrep/resolve.js +16 -8
- package/dist/external-tools/python/asset-names.d.ts +1 -1
- package/dist/external-tools/python/asset-names.js +10 -3
- package/dist/external-tools/python/dlx.d.ts +3 -3
- package/dist/external-tools/python/dlx.js +20 -9
- package/dist/external-tools/python/from-download.d.ts +1 -1
- package/dist/external-tools/python/from-download.js +12 -5
- package/dist/external-tools/python/pin.js +6 -3
- package/dist/external-tools/python/pip-install.js +6 -3
- package/dist/external-tools/python/resolve.d.ts +3 -3
- package/dist/external-tools/python/resolve.js +19 -11
- package/dist/external-tools/sbt/asset-names.d.ts +1 -1
- package/dist/external-tools/sbt/asset-names.js +5 -2
- package/dist/external-tools/sbt/from-download.d.ts +1 -1
- package/dist/external-tools/sbt/from-download.js +5 -2
- package/dist/external-tools/sbt/resolve.d.ts +3 -3
- package/dist/external-tools/sbt/resolve.js +16 -8
- package/dist/external-tools/skillspector/from-dlx.d.ts +1 -1
- package/dist/external-tools/skillspector/from-dlx.js +10 -3
- package/dist/external-tools/skillspector/resolve.d.ts +2 -2
- package/dist/external-tools/skillspector/resolve.js +14 -6
- package/dist/external-tools/synp/asset-names.d.ts +1 -1
- package/dist/external-tools/synp/asset-names.js +6 -2
- package/dist/external-tools/synp/from-download.d.ts +1 -1
- package/dist/external-tools/synp/from-download.js +5 -2
- package/dist/external-tools/synp/resolve.d.ts +3 -3
- package/dist/external-tools/synp/resolve.js +16 -8
- package/dist/external-tools/trivy/asset-names.d.ts +1 -1
- package/dist/external-tools/trivy/asset-names.js +5 -2
- package/dist/external-tools/trivy/from-download.d.ts +1 -1
- package/dist/external-tools/trivy/from-download.js +7 -4
- package/dist/external-tools/trivy/resolve.d.ts +3 -3
- package/dist/external-tools/trivy/resolve.js +16 -8
- package/dist/external-tools/trufflehog/asset-names.d.ts +1 -1
- package/dist/external-tools/trufflehog/asset-names.js +5 -2
- package/dist/external-tools/trufflehog/from-download.d.ts +1 -1
- package/dist/external-tools/trufflehog/from-download.js +7 -4
- package/dist/external-tools/trufflehog/resolve.d.ts +3 -3
- package/dist/external-tools/trufflehog/resolve.js +16 -8
- package/dist/fs/allowed-dirs-cache.d.ts +27 -1
- package/dist/fs/allowed-dirs-cache.js +38 -3
- package/dist/fs/find.js +1 -1
- package/dist/fs/read-json-cache.d.ts +7 -0
- package/dist/fs/resolve-module.js +6 -2
- package/dist/fs/safe.js +1 -1
- package/dist/git/_internal.js +2 -2
- package/dist/git/repo.js +2 -4
- package/dist/git/staged.js +8 -0
- package/dist/git/tracked.d.ts +84 -0
- package/dist/git/tracked.js +163 -0
- package/dist/git/unstaged.js +8 -0
- package/dist/github/refs-graphql.js +4 -0
- package/dist/github/refs-rest.js +4 -0
- package/dist/github/refs.js +15 -10
- package/dist/globs/_internal.js +1 -1
- package/dist/globs/match.js +9 -1
- package/dist/globs/matcher.js +5 -1
- package/dist/http-request/browser.js +6 -2
- package/dist/http-request/{browser-fetch.d.ts → fetch/browser.d.ts} +2 -2
- package/dist/http-request/{browser-fetch.js → fetch/browser.js} +4 -4
- package/dist/http-request/headers.js +1 -1
- package/dist/http-request/request-attempt.js +2 -2
- package/dist/http-request/user-agent.js +1 -1
- package/dist/integrity.d.ts +10 -4
- package/dist/integrity.js +10 -4
- package/dist/json/edit.js +38 -30
- package/dist/json/format.js +1 -1
- package/dist/native-messaging/install.d.ts +1 -1
- package/dist/native-messaging/install.js +7 -4
- package/dist/native-messaging/rate-limit.d.ts +7 -0
- package/dist/native-messaging/rate-limit.js +4 -0
- package/dist/node/async-hooks.js +1 -1
- package/dist/node/child-process.js +1 -1
- package/dist/node/crypto.js +1 -1
- package/dist/node/events.js +1 -1
- package/dist/node/fs-promises.js +1 -1
- package/dist/node/fs.d.ts +22 -6
- package/dist/node/fs.js +16 -3
- package/dist/node/http.js +1 -1
- package/dist/node/https.js +1 -1
- package/dist/node/module.js +1 -1
- package/dist/node/os.d.ts +10 -2
- package/dist/node/os.js +11 -4
- package/dist/node/path.d.ts +11 -2
- package/dist/node/path.js +17 -4
- package/dist/node/timers-promises.js +1 -1
- package/dist/node/url.js +1 -1
- package/dist/node/util.js +1 -1
- package/dist/objects/getters.js +1 -1
- package/dist/objects/mutate.js +2 -2
- package/dist/objects/predicates.js +1 -1
- package/dist/packages/edit-class.d.ts +2 -3
- package/dist/packages/edit-class.js +41 -35
- package/dist/packages/exports.js +4 -4
- package/dist/packages/fetch.js +1 -1
- package/dist/packages/isolation.js +1 -1
- package/dist/packages/licenses.js +2 -2
- package/dist/packages/manifest.js +4 -4
- package/dist/packages/normalize.js +1 -1
- package/dist/packages/provenance.js +2 -2
- package/dist/packages/specs.js +1 -1
- package/dist/packages/tarball.js +4 -2
- package/dist/packages/types.d.ts +1 -2
- package/dist/paths/dirnames.d.ts +1 -0
- package/dist/paths/dirnames.js +2 -0
- package/dist/paths/resolve.js +14 -19
- package/dist/paths/rewire.d.ts +5 -0
- package/dist/paths/socket.d.ts +74 -111
- package/dist/paths/socket.js +99 -132
- package/dist/primordials/process.d.ts +88 -0
- package/dist/primordials/process.js +132 -0
- package/dist/primordials/uncurry.d.ts +1 -2
- package/dist/process/spawn/child.js +8 -2
- package/dist/process/spawn/errors.js +1 -1
- package/dist/regexps/spec.js +1 -1
- package/dist/releases/github-archives.js +1 -1
- package/dist/releases/github-listing.d.ts +1 -2
- package/dist/schema/types.d.ts +3 -4
- package/dist/schema/validate.js +1 -1
- package/dist/secrets/find.d.ts +2 -2
- package/dist/secrets/find.js +10 -4
- package/dist/secrets/keychain.d.ts +1 -1
- package/dist/secrets/linux.js +32 -44
- package/dist/secrets/macos.d.ts +1 -2
- package/dist/secrets/macos.js +20 -29
- package/dist/secrets/rc.d.ts +2 -2
- package/dist/secrets/rc.js +21 -13
- package/dist/secrets/socket-api-token.js +8 -0
- package/dist/secrets/windows.js +27 -33
- package/dist/shell/parse.d.ts +32 -0
- package/dist/shell/parse.js +60 -0
- package/dist/spinner/create-spinner-class.js +2 -2
- package/dist/spinner/spinner-internals.d.ts +1 -1
- package/dist/spinner/spinner-internals.js +9 -5
- package/dist/spinner/spinner.d.ts +4 -0
- package/dist/spinner/spinner.js +1 -1
- package/dist/stdio/progress.js +5 -1
- package/dist/stdio/prompts.d.ts +2 -2
- package/dist/stdio/prompts.js +1 -1
- package/dist/temporal/instant.js +2 -2
- package/dist/url/assert-safe.d.ts +29 -0
- package/dist/url/assert-safe.js +54 -0
- package/dist/url/predicates.d.ts +31 -1
- package/dist/url/predicates.js +42 -1
- package/dist/url/types.d.ts +4 -0
- package/package.json +177 -115
|
@@ -18,7 +18,7 @@ let src_external__npmcli_package_json_lib_sort = require("../external/@npmcli/pa
|
|
|
18
18
|
/**
|
|
19
19
|
* @file The `EditablePackageJson` class factory. Split out of
|
|
20
20
|
* `packages/edit.ts` for size hygiene. Wraps `@npmcli/package-json` with
|
|
21
|
-
* Socket-specific knobs: path tracking, a `
|
|
21
|
+
* Socket-specific knobs: path tracking, a `canSave` guard for content-only
|
|
22
22
|
* instances, async + sync save paths that honor `EditablePackageJsonOptions`
|
|
23
23
|
* formatting.
|
|
24
24
|
*
|
|
@@ -40,28 +40,28 @@ function getEditablePackageJsonClass() {
|
|
|
40
40
|
static fixSteps = src_external__npmcli_package_json.default.fixSteps;
|
|
41
41
|
static normalizeSteps = src_external__npmcli_package_json.default.normalizeSteps;
|
|
42
42
|
static prepareSteps = src_external__npmcli_package_json.default.prepareSteps;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
canSave = true;
|
|
44
|
+
pkgPath = void 0;
|
|
45
|
+
readFileContent = "";
|
|
46
|
+
readFileJson = void 0;
|
|
47
47
|
get content() {
|
|
48
48
|
return super.content;
|
|
49
49
|
}
|
|
50
50
|
get filename() {
|
|
51
|
-
const
|
|
52
|
-
if (!
|
|
53
|
-
if (require_primordials_string.StringPrototypeEndsWith(
|
|
54
|
-
return require_node_path.getNodePath().join(
|
|
51
|
+
const pkgPath = this.pkgPath;
|
|
52
|
+
if (!pkgPath) return "";
|
|
53
|
+
if (require_primordials_string.StringPrototypeEndsWith(pkgPath, "package.json")) return pkgPath;
|
|
54
|
+
return require_node_path.getNodePath().join(pkgPath, "package.json");
|
|
55
55
|
}
|
|
56
56
|
static async create(path, opts = {}) {
|
|
57
57
|
const p = new cachedEditablePackageJsonClass();
|
|
58
58
|
await p.create(path);
|
|
59
59
|
return opts.data ? p.update(opts.data) : p;
|
|
60
60
|
}
|
|
61
|
-
static async fix(path,
|
|
61
|
+
static async fix(path, options) {
|
|
62
62
|
const p = new cachedEditablePackageJsonClass();
|
|
63
63
|
await p.load(path, true);
|
|
64
|
-
return await p.fix(
|
|
64
|
+
return await p.fix(options);
|
|
65
65
|
}
|
|
66
66
|
static async load(path, opts = {}) {
|
|
67
67
|
const p = new cachedEditablePackageJsonClass();
|
|
@@ -73,19 +73,19 @@ function getEditablePackageJsonClass() {
|
|
|
73
73
|
return p.create(path);
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
static async normalize(path,
|
|
76
|
+
static async normalize(path, options) {
|
|
77
77
|
const p = new cachedEditablePackageJsonClass();
|
|
78
78
|
await p.load(path);
|
|
79
|
-
return await p.normalize(
|
|
79
|
+
return await p.normalize(options);
|
|
80
80
|
}
|
|
81
|
-
static async prepare(path,
|
|
81
|
+
static async prepare(path, options) {
|
|
82
82
|
const p = new cachedEditablePackageJsonClass();
|
|
83
83
|
await p.load(path, true);
|
|
84
|
-
return await p.prepare(
|
|
84
|
+
return await p.prepare(options);
|
|
85
85
|
}
|
|
86
86
|
create(path) {
|
|
87
87
|
super.create(path);
|
|
88
|
-
this.
|
|
88
|
+
this.pkgPath = path;
|
|
89
89
|
return this;
|
|
90
90
|
}
|
|
91
91
|
async fix(opts = {}) {
|
|
@@ -94,7 +94,7 @@ function getEditablePackageJsonClass() {
|
|
|
94
94
|
}
|
|
95
95
|
fromContent(data) {
|
|
96
96
|
super.fromContent(data);
|
|
97
|
-
this.
|
|
97
|
+
this.canSave = false;
|
|
98
98
|
return this;
|
|
99
99
|
}
|
|
100
100
|
fromJSON(data) {
|
|
@@ -102,11 +102,11 @@ function getEditablePackageJsonClass() {
|
|
|
102
102
|
return this;
|
|
103
103
|
}
|
|
104
104
|
async load(path, create) {
|
|
105
|
-
this.
|
|
105
|
+
this.pkgPath = path;
|
|
106
106
|
const { promises: fsPromises } = require_node_fs.getNodeFs();
|
|
107
107
|
let parseErr;
|
|
108
108
|
try {
|
|
109
|
-
this.
|
|
109
|
+
this.readFileContent = await (0, src_external__npmcli_package_json_lib_read_package.read)(this.filename);
|
|
110
110
|
} catch (e) {
|
|
111
111
|
if (!create) throw e;
|
|
112
112
|
parseErr = e;
|
|
@@ -124,11 +124,11 @@ function getEditablePackageJsonClass() {
|
|
|
124
124
|
} catch {
|
|
125
125
|
throw parseErr;
|
|
126
126
|
}
|
|
127
|
-
this.
|
|
127
|
+
this.canSave = false;
|
|
128
128
|
return this;
|
|
129
129
|
}
|
|
130
|
-
this.fromJSON(this.
|
|
131
|
-
this.
|
|
130
|
+
this.fromJSON(this.readFileContent);
|
|
131
|
+
this.readFileJson = (0, src_external__npmcli_package_json_lib_read_package.parse)(this.readFileContent);
|
|
132
132
|
return this;
|
|
133
133
|
}
|
|
134
134
|
async normalize(opts = {}) {
|
|
@@ -136,15 +136,19 @@ function getEditablePackageJsonClass() {
|
|
|
136
136
|
return this;
|
|
137
137
|
}
|
|
138
138
|
get path() {
|
|
139
|
-
return this.
|
|
139
|
+
return this.pkgPath;
|
|
140
140
|
}
|
|
141
141
|
async prepare(opts = {}) {
|
|
142
142
|
await super.prepare(opts);
|
|
143
143
|
return this;
|
|
144
144
|
}
|
|
145
145
|
async save(options) {
|
|
146
|
-
|
|
147
|
-
|
|
146
|
+
options = {
|
|
147
|
+
__proto__: null,
|
|
148
|
+
...options
|
|
149
|
+
};
|
|
150
|
+
if (!this.canSave || this.content === void 0) throw new require_primordials_error.ErrorCtor("No package.json to save to");
|
|
151
|
+
if (!require_json_format.shouldSave(this.content, this.readFileJson, this.readFileContent, {
|
|
148
152
|
...options,
|
|
149
153
|
sortFn: options?.sort ? src_external__npmcli_package_json_lib_sort.packageSort : void 0
|
|
150
154
|
})) return false;
|
|
@@ -152,26 +156,27 @@ function getEditablePackageJsonClass() {
|
|
|
152
156
|
const fileContent = require_json_format.stringifyWithFormatting(options?.sort ? (0, src_external__npmcli_package_json_lib_sort.packageSort)(content) : content, require_json_format.getFormattingFromContent(this.content));
|
|
153
157
|
const { promises: fsPromises } = require_node_fs.getNodeFs();
|
|
154
158
|
await fsPromises.writeFile(this.filename, fileContent);
|
|
155
|
-
this.
|
|
156
|
-
this.
|
|
159
|
+
this.readFileContent = fileContent;
|
|
160
|
+
this.readFileJson = (0, src_external__npmcli_package_json_lib_read_package.parse)(fileContent);
|
|
157
161
|
return true;
|
|
158
162
|
}
|
|
159
163
|
saveSync(options) {
|
|
160
|
-
if (!this.
|
|
164
|
+
if (!this.canSave || this.content === void 0) throw new require_primordials_error.ErrorCtor("No package.json to save to");
|
|
161
165
|
const { ignoreWhitespace = false, sort = false } = {
|
|
162
166
|
__proto__: null,
|
|
163
167
|
...options
|
|
164
168
|
};
|
|
165
169
|
const { [Symbol.for("indent")]: indent, [Symbol.for("newline")]: newline, ...rest } = this.content;
|
|
166
170
|
const content = sort ? (0, src_external__npmcli_package_json_lib_sort.packageSort)(rest) : rest;
|
|
167
|
-
|
|
171
|
+
const util = require_node_util.getNodeUtil();
|
|
172
|
+
if (ignoreWhitespace && util.isDeepStrictEqual(content, this.readFileJson)) return false;
|
|
168
173
|
const format = indent === void 0 || indent === null ? " " : indent;
|
|
169
174
|
const eol = newline === void 0 || newline === null ? "\n" : newline;
|
|
170
175
|
const fileContent = `${require_primordials_json.JSONStringify(content, void 0, format)}\n`.replace(/\n/g, eol);
|
|
171
|
-
if (!ignoreWhitespace && fileContent.trim() === this.
|
|
176
|
+
if (!ignoreWhitespace && fileContent.trim() === this.readFileContent.trim()) return false;
|
|
172
177
|
require_node_fs.getNodeFs().writeFileSync(this.filename, fileContent);
|
|
173
|
-
this.
|
|
174
|
-
this.
|
|
178
|
+
this.readFileContent = fileContent;
|
|
179
|
+
this.readFileJson = (0, src_external__npmcli_package_json_lib_read_package.parse)(fileContent);
|
|
175
180
|
return true;
|
|
176
181
|
}
|
|
177
182
|
update(content) {
|
|
@@ -183,14 +188,15 @@ function getEditablePackageJsonClass() {
|
|
|
183
188
|
__proto__: null,
|
|
184
189
|
...options
|
|
185
190
|
};
|
|
186
|
-
if (!this.
|
|
191
|
+
if (!this.canSave || this.content === void 0) return false;
|
|
187
192
|
const { [Symbol.for("indent")]: indent, [Symbol.for("newline")]: newline, ...rest } = this.content;
|
|
188
193
|
const content = sort ? (0, src_external__npmcli_package_json_lib_sort.packageSort)(rest) : rest;
|
|
189
|
-
|
|
194
|
+
const util = require_node_util.getNodeUtil();
|
|
195
|
+
if (ignoreWhitespace && util.isDeepStrictEqual(content, this.readFileJson)) return false;
|
|
190
196
|
const format = indent === void 0 || indent === null ? " " : indent;
|
|
191
197
|
const eol = newline === void 0 || newline === null ? "\n" : newline;
|
|
192
198
|
const fileContent = `${require_primordials_json.JSONStringify(content, void 0, format)}\n`.replace(/\n/g, eol);
|
|
193
|
-
if (!ignoreWhitespace && fileContent.trim() === this.
|
|
199
|
+
if (!ignoreWhitespace && fileContent.trim() === this.readFileContent.trim()) return false;
|
|
194
200
|
return true;
|
|
195
201
|
}
|
|
196
202
|
};
|
package/dist/packages/exports.js
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
/* Socket Lib - Built with rolldown */
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
const require_primordials_error = require('../primordials/error.js');
|
|
5
|
+
const require_arrays_predicates = require('../arrays/predicates.js');
|
|
6
|
+
const require_primordials_object = require('../primordials/object.js');
|
|
7
|
+
const require_objects_predicates = require('../objects/predicates.js');
|
|
8
|
+
const require_primordials_map_set = require('../primordials/map-set.js');
|
|
5
9
|
const require_primordials_string = require('../primordials/string.js');
|
|
6
10
|
const require_primordials_array = require('../primordials/array.js');
|
|
7
|
-
const require_primordials_map_set = require('../primordials/map-set.js');
|
|
8
|
-
const require_primordials_object = require('../primordials/object.js');
|
|
9
11
|
const require_constants_sentinels = require('../constants/sentinels.js');
|
|
10
|
-
const require_arrays_predicates = require('../arrays/predicates.js');
|
|
11
|
-
const require_objects_predicates = require('../objects/predicates.js');
|
|
12
12
|
|
|
13
13
|
//#region src/packages/exports.ts
|
|
14
14
|
/**
|
package/dist/packages/fetch.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
const require_runtime = require('../_virtual/_rolldown/runtime.js');
|
|
5
5
|
const require_objects_predicates = require('../objects/predicates.js');
|
|
6
|
-
const require_constants_packages = require('../constants/packages.js');
|
|
7
6
|
const require_packages_specs = require('./specs.js');
|
|
7
|
+
const require_constants_packages = require('../constants/packages.js');
|
|
8
8
|
const require_packages_read = require('./read.js');
|
|
9
9
|
let src_external_npm_package_arg = require("../external/npm-package-arg");
|
|
10
10
|
src_external_npm_package_arg = require_runtime.__toESM(src_external_npm_package_arg);
|
|
@@ -4,13 +4,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
4
4
|
const require_runtime = require('../_virtual/_rolldown/runtime.js');
|
|
5
5
|
const require_primordials_error = require('../primordials/error.js');
|
|
6
6
|
const require_constants_platform = require('../constants/platform.js');
|
|
7
|
+
const require_primordials_object = require('../primordials/object.js');
|
|
7
8
|
const require_primordials_string = require('../primordials/string.js');
|
|
8
9
|
const require_paths_conversion = require('../paths/conversion.js');
|
|
9
10
|
const require_paths_predicates = require('../paths/predicates.js');
|
|
10
11
|
const require_node_fs = require('../node/fs.js');
|
|
11
12
|
const require_node_path = require('../node/path.js');
|
|
12
13
|
const require_primordials_json = require('../primordials/json.js');
|
|
13
|
-
const require_primordials_object = require('../primordials/object.js');
|
|
14
14
|
const require_errors_message = require('../errors/message.js');
|
|
15
15
|
const require_process_spawn_child = require('../process/spawn/child.js');
|
|
16
16
|
const require_paths_socket = require('../paths/socket.js');
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
const require_runtime = require('../_virtual/_rolldown/runtime.js');
|
|
5
5
|
const require_primordials_error = require('../primordials/error.js');
|
|
6
|
+
const require_objects_predicates = require('../objects/predicates.js');
|
|
7
|
+
const require_primordials_map_set = require('../primordials/map-set.js');
|
|
6
8
|
const require_primordials_regexp = require('../primordials/regexp.js');
|
|
7
9
|
const require_paths_normalize = require('../paths/normalize.js');
|
|
8
|
-
const require_primordials_map_set = require('../primordials/map-set.js');
|
|
9
10
|
const require_node_path = require('../node/path.js');
|
|
10
11
|
const require_constants_sentinels = require('../constants/sentinels.js');
|
|
11
|
-
const require_objects_predicates = require('../objects/predicates.js');
|
|
12
12
|
const require_constants_licenses = require('../constants/licenses.js');
|
|
13
13
|
let src_external_spdx_correct = require("../external/spdx-correct");
|
|
14
14
|
src_external_spdx_correct = require_runtime.__toESM(src_external_spdx_correct);
|
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
/* Socket Lib - Built with rolldown */
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
const require_runtime = require('../_virtual/_rolldown/runtime.js');
|
|
5
|
-
const require_primordials_object = require('../primordials/object.js');
|
|
6
|
-
const require_process_abort = require('../process/abort.js');
|
|
7
5
|
const require_arrays_predicates = require('../arrays/predicates.js');
|
|
6
|
+
const require_primordials_object = require('../primordials/object.js');
|
|
8
7
|
const require_objects_predicates = require('../objects/predicates.js');
|
|
8
|
+
const require_process_abort = require('../process/abort.js');
|
|
9
9
|
const require_constants_socket = require('../constants/socket.js');
|
|
10
10
|
const require_constants_packages = require('../constants/packages.js');
|
|
11
11
|
const require_objects_sort = require('../objects/sort.js');
|
|
12
12
|
const require_packages_exports = require('./exports.js');
|
|
13
13
|
const require_packages_validation = require('./validation.js');
|
|
14
|
+
let src_external_npm_package_arg = require("../external/npm-package-arg");
|
|
15
|
+
src_external_npm_package_arg = require_runtime.__toESM(src_external_npm_package_arg);
|
|
14
16
|
let src_external_semver = require("../external/semver");
|
|
15
17
|
src_external_semver = require_runtime.__toESM(src_external_semver);
|
|
16
18
|
let src_external_pacote = require("../external/pacote");
|
|
17
19
|
src_external_pacote = require_runtime.__toESM(src_external_pacote);
|
|
18
|
-
let src_external_npm_package_arg = require("../external/npm-package-arg");
|
|
19
|
-
src_external_npm_package_arg = require_runtime.__toESM(src_external_npm_package_arg);
|
|
20
20
|
|
|
21
21
|
//#region src/packages/manifest.ts
|
|
22
22
|
/**
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
/* Socket Lib - Built with rolldown */
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
const require_runtime = require('../_virtual/_rolldown/runtime.js');
|
|
5
|
+
const require_primordials_object = require('../primordials/object.js');
|
|
5
6
|
const require_primordials_string = require('../primordials/string.js');
|
|
6
7
|
const require_primordials_regexp = require('../primordials/regexp.js');
|
|
7
8
|
const require_primordials_array = require('../primordials/array.js');
|
|
8
|
-
const require_primordials_object = require('../primordials/object.js');
|
|
9
9
|
const require_objects_mutate = require('../objects/mutate.js');
|
|
10
10
|
const require_constants_socket = require('../constants/socket.js');
|
|
11
11
|
const require_regexps_escape = require('../regexps/escape.js');
|
|
@@ -4,11 +4,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
4
4
|
const require_runtime = require('../_virtual/_rolldown/runtime.js');
|
|
5
5
|
const require_primordials_buffer = require('../primordials/buffer.js');
|
|
6
6
|
const require_abort_signal = require('../abort/signal.js');
|
|
7
|
+
const require_primordials_object = require('../primordials/object.js');
|
|
8
|
+
const require_objects_predicates = require('../objects/predicates.js');
|
|
7
9
|
const require_primordials_string = require('../primordials/string.js');
|
|
8
10
|
const require_primordials_array = require('../primordials/array.js');
|
|
9
11
|
const require_primordials_json = require('../primordials/json.js');
|
|
10
|
-
const require_primordials_object = require('../primordials/object.js');
|
|
11
|
-
const require_objects_predicates = require('../objects/predicates.js');
|
|
12
12
|
const require_constants_agents = require('../constants/agents.js');
|
|
13
13
|
const require_constants_packages = require('../constants/packages.js');
|
|
14
14
|
const require_url_parse = require('../url/parse.js');
|
package/dist/packages/specs.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
/* Socket Lib - Built with rolldown */
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
const require_runtime = require('../_virtual/_rolldown/runtime.js');
|
|
5
|
+
const require_objects_predicates = require('../objects/predicates.js');
|
|
5
6
|
const require_primordials_string = require('../primordials/string.js');
|
|
6
7
|
const require_strings_predicates = require('../strings/predicates.js');
|
|
7
|
-
const require_objects_predicates = require('../objects/predicates.js');
|
|
8
8
|
const require_constants_socket = require('../constants/socket.js');
|
|
9
9
|
const require_smol_purl = require('../smol/purl.js');
|
|
10
10
|
let src_external__socketregistry_packageurl_js = require("../external/@socketregistry/packageurl-js");
|
package/dist/packages/tarball.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/* Socket Lib - Built with rolldown */
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
const require_runtime = require('../_virtual/_rolldown/runtime.js');
|
|
5
|
+
const require_paths_normalize = require('../paths/normalize.js');
|
|
5
6
|
const require_process_abort = require('../process/abort.js');
|
|
6
7
|
const require_constants_packages = require('../constants/packages.js');
|
|
7
8
|
let src_external_cacache = require("../external/cacache");
|
|
@@ -46,8 +47,9 @@ async function extractPackage(pkgNameOrId, options, callback) {
|
|
|
46
47
|
};
|
|
47
48
|
/* c8 ignore start - External package registry extraction */
|
|
48
49
|
if (typeof dest === "string") {
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
const normalizedDest = require_paths_normalize.normalizePath(dest);
|
|
51
|
+
await src_external_pacote.default.extract(pkgNameOrId, normalizedDest, extractOptions);
|
|
52
|
+
if (typeof actualCallback === "function") await actualCallback(normalizedDest);
|
|
51
53
|
} else await src_external_cacache.default.tmp.withTmp(pacoteCachePath, { tmpPrefix }, async (tmpDirPath) => {
|
|
52
54
|
await src_external_pacote.default.extract(pkgNameOrId, tmpDirPath, extractOptions);
|
|
53
55
|
if (typeof actualCallback === "function") await actualCallback(tmpDirPath);
|
package/dist/packages/types.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { CategoryString } from '../eco/types';
|
|
8
8
|
import type { EditablePackageJsonInstance } from './edit';
|
|
9
|
-
type PackageExports = {
|
|
9
|
+
export type PackageExports = {
|
|
10
10
|
[path: string]: unknown;
|
|
11
11
|
};
|
|
12
12
|
export type EditablePackageJson = EditablePackageJsonInstance;
|
|
@@ -131,4 +131,3 @@ export type PacoteOptions = {
|
|
|
131
131
|
preferOffline?: boolean | undefined;
|
|
132
132
|
fullMetadata?: boolean | undefined;
|
|
133
133
|
};
|
|
134
|
-
export {};
|
package/dist/paths/dirnames.d.ts
CHANGED
|
@@ -7,5 +7,6 @@ export declare const DOT_GITHUB = ".github";
|
|
|
7
7
|
export declare const DOT_SOCKET_DIR = ".socket";
|
|
8
8
|
export declare const CACHE_DIR = "cache";
|
|
9
9
|
export declare const CACHE_TTL_DIR = "ttl";
|
|
10
|
+
export declare const RUN_DIR = "run";
|
|
10
11
|
export declare const NODE_MODULES_GLOB_RECURSIVE = "**/node_modules";
|
|
11
12
|
export declare const SLASH_NODE_MODULES_SLASH = "/node_modules/";
|
package/dist/paths/dirnames.js
CHANGED
|
@@ -12,6 +12,7 @@ const DOT_GITHUB = ".github";
|
|
|
12
12
|
const DOT_SOCKET_DIR = ".socket";
|
|
13
13
|
const CACHE_DIR = "cache";
|
|
14
14
|
const CACHE_TTL_DIR = "ttl";
|
|
15
|
+
const RUN_DIR = "run";
|
|
15
16
|
const NODE_MODULES_GLOB_RECURSIVE = "**/node_modules";
|
|
16
17
|
const SLASH_NODE_MODULES_SLASH = "/node_modules/";
|
|
17
18
|
|
|
@@ -23,4 +24,5 @@ exports.DOT_GIT_DIR = DOT_GIT_DIR;
|
|
|
23
24
|
exports.DOT_SOCKET_DIR = DOT_SOCKET_DIR;
|
|
24
25
|
exports.NODE_MODULES = NODE_MODULES;
|
|
25
26
|
exports.NODE_MODULES_GLOB_RECURSIVE = NODE_MODULES_GLOB_RECURSIVE;
|
|
27
|
+
exports.RUN_DIR = RUN_DIR;
|
|
26
28
|
exports.SLASH_NODE_MODULES_SLASH = SLASH_NODE_MODULES_SLASH;
|
package/dist/paths/resolve.js
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* Socket Lib - Built with rolldown */
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
-
const require_constants_platform = require('../constants/platform.js');
|
|
5
|
-
const require_primordials_string = require('../primordials/string.js');
|
|
6
|
-
const require_paths__internal = require('./_internal.js');
|
|
7
|
-
const require_paths_predicates = require('./predicates.js');
|
|
8
|
-
const require_paths_normalize = require('./normalize.js');
|
|
9
4
|
|
|
10
5
|
//#region src/paths/resolve.ts
|
|
11
6
|
/**
|
|
@@ -44,7 +39,7 @@ function relative(from, to) {
|
|
|
44
39
|
const actualTo = resolve(to);
|
|
45
40
|
if (actualFrom === actualTo) return "";
|
|
46
41
|
/* c8 ignore start - Windows-only case-insensitive comparison. */
|
|
47
|
-
if (
|
|
42
|
+
if (WIN32) {
|
|
48
43
|
if (actualFrom.toLowerCase() === actualTo.toLowerCase()) return "";
|
|
49
44
|
}
|
|
50
45
|
/* c8 ignore stop */
|
|
@@ -57,32 +52,32 @@ function relative(from, to) {
|
|
|
57
52
|
let lastCommonSep = -1;
|
|
58
53
|
let i = 0;
|
|
59
54
|
for (; i < length; i += 1) {
|
|
60
|
-
let fromCode =
|
|
61
|
-
let toCode =
|
|
55
|
+
let fromCode = StringPrototypeCharCodeAt(actualFrom, fromStart + i);
|
|
56
|
+
let toCode = StringPrototypeCharCodeAt(actualTo, toStart + i);
|
|
62
57
|
/* c8 ignore start - Windows-only case folding. */
|
|
63
|
-
if (
|
|
64
|
-
if (fromCode >=
|
|
65
|
-
if (toCode >=
|
|
58
|
+
if (WIN32) {
|
|
59
|
+
if (fromCode >= CHAR_UPPERCASE_A && fromCode <= CHAR_UPPERCASE_Z) fromCode += 32;
|
|
60
|
+
if (toCode >= CHAR_UPPERCASE_A && toCode <= CHAR_UPPERCASE_Z) toCode += 32;
|
|
66
61
|
}
|
|
67
62
|
/* c8 ignore stop */
|
|
68
63
|
if (fromCode !== toCode) break;
|
|
69
|
-
if (
|
|
64
|
+
if (isPathSeparator(StringPrototypeCharCodeAt(actualFrom, fromStart + i))) lastCommonSep = i;
|
|
70
65
|
}
|
|
71
66
|
/* c8 ignore start */
|
|
72
67
|
if (i === length) {
|
|
73
68
|
if (toLen > length) {
|
|
74
|
-
if (
|
|
69
|
+
if (isPathSeparator(StringPrototypeCharCodeAt(actualTo, toStart + i))) return actualTo.slice(toStart + i + 1);
|
|
75
70
|
if (i === 0) return actualTo.slice(toStart + i);
|
|
76
71
|
} else if (fromLen > length) {
|
|
77
|
-
if (
|
|
72
|
+
if (isPathSeparator(StringPrototypeCharCodeAt(actualFrom, fromStart + i))) lastCommonSep = i;
|
|
78
73
|
else if (i === 0) lastCommonSep = 0;
|
|
79
74
|
}
|
|
80
75
|
}
|
|
81
76
|
/* c8 ignore stop */
|
|
82
77
|
let out = "";
|
|
83
78
|
for (i = fromStart + lastCommonSep + 1; i <= fromEnd; i += 1) {
|
|
84
|
-
const code =
|
|
85
|
-
if (i === fromEnd ||
|
|
79
|
+
const code = StringPrototypeCharCodeAt(actualFrom, i);
|
|
80
|
+
if (i === fromEnd || isPathSeparator(code)) out += out.length === 0 ? ".." : "/..";
|
|
86
81
|
}
|
|
87
82
|
return out + actualTo.slice(toStart + lastCommonSep);
|
|
88
83
|
}
|
|
@@ -108,7 +103,7 @@ function relative(from, to) {
|
|
|
108
103
|
function relativeResolve(from, to) {
|
|
109
104
|
const rel = relative(from, to);
|
|
110
105
|
if (rel === "") return "";
|
|
111
|
-
return
|
|
106
|
+
return normalizePath(rel);
|
|
112
107
|
}
|
|
113
108
|
/**
|
|
114
109
|
* Resolve an absolute path from path segments.
|
|
@@ -137,11 +132,11 @@ function resolve(...segments) {
|
|
|
137
132
|
/* c8 ignore start */
|
|
138
133
|
if (typeof segment !== "string" || segment.length === 0) continue;
|
|
139
134
|
resolvedPath = segment + (resolvedPath.length === 0 ? "" : `/${resolvedPath}`);
|
|
140
|
-
resolvedAbsolute =
|
|
135
|
+
resolvedAbsolute = isAbsolute(segment);
|
|
141
136
|
}
|
|
142
137
|
if (!resolvedAbsolute) resolvedPath = /* @__PURE__ */ require("node:process").cwd() + (resolvedPath.length === 0 ? "" : `/${resolvedPath}`);
|
|
143
138
|
/* c8 ignore stop */
|
|
144
|
-
return
|
|
139
|
+
return normalizePath(resolvedPath);
|
|
145
140
|
}
|
|
146
141
|
|
|
147
142
|
//#endregion
|
package/dist/paths/rewire.d.ts
CHANGED
|
@@ -7,6 +7,11 @@
|
|
|
7
7
|
* - Automatic cache invalidation for path-dependent modules
|
|
8
8
|
* - Thread-safe for concurrent test execution
|
|
9
9
|
*/
|
|
10
|
+
export interface PathRewireState {
|
|
11
|
+
testOverrides: Map<string, string | undefined>;
|
|
12
|
+
valueCache: Map<string, string>;
|
|
13
|
+
cacheInvalidationCallbacks: Array<() => void>;
|
|
14
|
+
}
|
|
10
15
|
/**
|
|
11
16
|
* Clear a specific path override.
|
|
12
17
|
*/
|