@socketsecurity/lib 3.5.0 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/README.md +8 -8
- package/dist/agent.js +12 -25
- package/dist/bin.d.ts +97 -40
- package/dist/bin.js +133 -138
- package/dist/cacache.d.ts +5 -2
- package/dist/cacache.js +29 -18
- package/dist/cache-with-ttl.js +1 -1
- package/dist/constants/agents.d.ts +0 -4
- package/dist/constants/agents.js +13 -4
- package/dist/constants/node.d.ts +1 -0
- package/dist/constants/node.js +2 -5
- package/dist/constants/packages.js +23 -11
- package/dist/constants/process.d.ts +1 -1
- package/dist/constants/process.js +2 -2
- package/dist/debug.js +3 -3
- package/dist/dlx-binary.js +10 -18
- package/dist/dlx-manifest.js +2 -2
- package/dist/dlx-package.js +22 -62
- package/dist/dlx.js +14 -14
- package/dist/effects/text-shimmer.js +1 -1
- package/dist/env/ci.js +2 -2
- package/dist/env/debug.js +1 -1
- package/dist/env/github.js +1 -1
- package/dist/env/home.js +1 -1
- package/dist/env/locale.js +1 -1
- package/dist/env/node-auth-token.js +1 -1
- package/dist/env/node-env.js +1 -1
- package/dist/env/npm.js +1 -1
- package/dist/env/package-manager.js +1 -1
- package/dist/env/path.js +1 -1
- package/dist/env/pre-commit.js +2 -2
- package/dist/env/rewire.d.ts +7 -7
- package/dist/env/rewire.js +1 -1
- package/dist/env/shell.js +1 -1
- package/dist/env/socket-cli-shadow.js +2 -2
- package/dist/env/socket-cli.js +2 -2
- package/dist/env/socket.js +2 -2
- package/dist/env/temp-dir.js +1 -1
- package/dist/env/term.js +1 -1
- package/dist/env/test.js +3 -3
- package/dist/env/windows.js +1 -1
- package/dist/env/xdg.js +1 -1
- package/dist/fs.js +20 -25
- package/dist/git.d.ts +6 -6
- package/dist/git.js +11 -14
- package/dist/github.js +2 -2
- package/dist/globs.js +16 -29
- package/dist/ipc.d.ts +4 -4
- package/dist/ipc.js +3 -3
- package/dist/logger.d.ts +0 -25
- package/dist/logger.js +0 -26
- package/dist/objects.js +1 -1
- package/dist/package-default-node-range.js +13 -3
- package/dist/package-extensions.d.ts +2 -1
- package/dist/package-extensions.js +12 -2
- package/dist/packages/editable.d.ts +0 -3
- package/dist/packages/editable.js +34 -24
- package/dist/packages/exports.js +1 -1
- package/dist/packages/isolation.js +33 -33
- package/dist/packages/licenses.js +20 -34
- package/dist/packages/manifest.js +21 -36
- package/dist/packages/normalize.js +20 -52
- package/dist/packages/operations.js +39 -103
- package/dist/packages/provenance.js +15 -5
- package/dist/packages/specs.js +13 -12
- package/dist/packages/validation.js +12 -10
- package/dist/packages.d.ts +2 -2
- package/dist/packages.js +3 -3
- package/dist/paths/dirnames.d.ts +13 -0
- package/dist/paths/dirnames.js +50 -0
- package/dist/paths/exts.d.ts +18 -0
- package/dist/paths/exts.js +68 -0
- package/dist/paths/filenames.d.ts +16 -0
- package/dist/paths/filenames.js +62 -0
- package/dist/paths/globs.d.ts +10 -0
- package/dist/{argv/quote.js → paths/globs.js} +21 -19
- package/dist/{path.d.ts → paths/normalize.d.ts} +41 -0
- package/dist/{path.js → paths/normalize.js} +18 -5
- package/dist/{packages/paths.js → paths/packages.js} +8 -8
- package/dist/paths/rewire.d.ts +1 -1
- package/dist/{paths.js → paths/socket.js} +31 -67
- package/dist/promises.js +2 -2
- package/dist/sea.js +2 -2
- package/dist/shadow.js +3 -3
- package/dist/sorts.js +12 -2
- package/dist/spawn.d.ts +15 -12
- package/dist/spawn.js +43 -31
- package/dist/spinner.d.ts +2 -6
- package/dist/spinner.js +9 -41
- package/dist/stdio/prompts.d.ts +8 -10
- package/dist/stdio/prompts.js +15 -13
- package/dist/streams.d.ts +0 -4
- package/dist/streams.js +3 -12
- package/dist/temporary-executor.js +4 -4
- package/dist/versions.js +31 -28
- package/package.json +28 -29
- package/dist/argv/quote.d.ts +0 -49
- package/dist/constants/paths.d.ts +0 -51
- package/dist/constants/paths.js +0 -152
- /package/dist/{packages/paths.d.ts → paths/packages.d.ts} +0 -0
- /package/dist/{paths.d.ts → paths/socket.d.ts} +0 -0
package/dist/env/node-env.js
CHANGED
|
@@ -22,7 +22,7 @@ __export(node_env_exports, {
|
|
|
22
22
|
getNodeEnv: () => getNodeEnv
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(node_env_exports);
|
|
25
|
-
var import_rewire = require("
|
|
25
|
+
var import_rewire = require("./rewire");
|
|
26
26
|
// @__NO_SIDE_EFFECTS__
|
|
27
27
|
function getNodeEnv() {
|
|
28
28
|
return (0, import_rewire.getEnvValue)("NODE_ENV");
|
package/dist/env/npm.js
CHANGED
|
@@ -26,7 +26,7 @@ __export(npm_exports, {
|
|
|
26
26
|
getNpmToken: () => getNpmToken
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(npm_exports);
|
|
29
|
-
var import_rewire = require("
|
|
29
|
+
var import_rewire = require("./rewire");
|
|
30
30
|
// @__NO_SIDE_EFFECTS__
|
|
31
31
|
function getNpmConfigRegistry() {
|
|
32
32
|
return (0, import_rewire.getEnvValue)("npm_config_registry");
|
|
@@ -24,7 +24,7 @@ __export(package_manager_exports, {
|
|
|
24
24
|
getPackageManagerUserAgent: () => getPackageManagerUserAgent
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(package_manager_exports);
|
|
27
|
-
var import_rewire = require("
|
|
27
|
+
var import_rewire = require("./rewire");
|
|
28
28
|
// @__NO_SIDE_EFFECTS__
|
|
29
29
|
function detectPackageManager() {
|
|
30
30
|
const userAgent = /* @__PURE__ */ getPackageManagerUserAgent();
|
package/dist/env/path.js
CHANGED
|
@@ -22,7 +22,7 @@ __export(path_exports, {
|
|
|
22
22
|
getPath: () => getPath
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(path_exports);
|
|
25
|
-
var import_rewire = require("
|
|
25
|
+
var import_rewire = require("./rewire");
|
|
26
26
|
// @__NO_SIDE_EFFECTS__
|
|
27
27
|
function getPath() {
|
|
28
28
|
return (0, import_rewire.getEnvValue)("PATH");
|
package/dist/env/pre-commit.js
CHANGED
|
@@ -22,8 +22,8 @@ __export(pre_commit_exports, {
|
|
|
22
22
|
getPreCommit: () => getPreCommit
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(pre_commit_exports);
|
|
25
|
-
var import_helpers = require("
|
|
26
|
-
var import_rewire = require("
|
|
25
|
+
var import_helpers = require("./helpers");
|
|
26
|
+
var import_rewire = require("./rewire");
|
|
27
27
|
// @__NO_SIDE_EFFECTS__
|
|
28
28
|
function getPreCommit() {
|
|
29
29
|
return (0, import_helpers.envAsBoolean)((0, import_rewire.getEnvValue)("PRE_COMMIT"));
|
package/dist/env/rewire.d.ts
CHANGED
|
@@ -18,8 +18,8 @@ export declare function getEnvValue(key: string): string | undefined;
|
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
20
20
|
* ```typescript
|
|
21
|
-
* import { setEnv, resetEnv } from '
|
|
22
|
-
* import { getCI } from '
|
|
21
|
+
* import { setEnv, resetEnv } from './rewire'
|
|
22
|
+
* import { getCI } from './ci'
|
|
23
23
|
*
|
|
24
24
|
* beforeEach(() => {
|
|
25
25
|
* setEnv('CI', '1')
|
|
@@ -45,7 +45,7 @@ export declare function clearEnv(key: string): void;
|
|
|
45
45
|
*
|
|
46
46
|
* @example
|
|
47
47
|
* ```typescript
|
|
48
|
-
* import { resetEnv } from '
|
|
48
|
+
* import { resetEnv } from './rewire'
|
|
49
49
|
*
|
|
50
50
|
* afterEach(() => {
|
|
51
51
|
* resetEnv()
|
|
@@ -66,8 +66,8 @@ export declare function hasOverride(key: string): boolean;
|
|
|
66
66
|
*
|
|
67
67
|
* @example
|
|
68
68
|
* ```typescript
|
|
69
|
-
* import { withEnv } from '
|
|
70
|
-
* import { getCI } from '
|
|
69
|
+
* import { withEnv } from './rewire'
|
|
70
|
+
* import { getCI } from './ci'
|
|
71
71
|
*
|
|
72
72
|
* // Temporary override in isolated context
|
|
73
73
|
* await withEnv({ CI: '1' }, async () => {
|
|
@@ -94,8 +94,8 @@ export declare function withEnv<T>(overrides: Record<string, string | undefined>
|
|
|
94
94
|
*
|
|
95
95
|
* @example
|
|
96
96
|
* ```typescript
|
|
97
|
-
* import { withEnvSync } from '
|
|
98
|
-
* import { getCI } from '
|
|
97
|
+
* import { withEnvSync } from './rewire'
|
|
98
|
+
* import { getCI } from './ci'
|
|
99
99
|
*
|
|
100
100
|
* const result = withEnvSync({ CI: '1' }, () => {
|
|
101
101
|
* return getCI()
|
package/dist/env/rewire.js
CHANGED
|
@@ -29,7 +29,7 @@ __export(rewire_exports, {
|
|
|
29
29
|
});
|
|
30
30
|
module.exports = __toCommonJS(rewire_exports);
|
|
31
31
|
var import_async_hooks = require("async_hooks");
|
|
32
|
-
var import_helpers = require("
|
|
32
|
+
var import_helpers = require("./helpers");
|
|
33
33
|
const isolatedOverridesStorage = new import_async_hooks.AsyncLocalStorage();
|
|
34
34
|
const sharedOverridesSymbol = Symbol.for(
|
|
35
35
|
"@socketsecurity/lib/env/rewire/test-overrides"
|
package/dist/env/shell.js
CHANGED
|
@@ -22,7 +22,7 @@ __export(shell_exports, {
|
|
|
22
22
|
getShell: () => getShell
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(shell_exports);
|
|
25
|
-
var import_rewire = require("
|
|
25
|
+
var import_rewire = require("./rewire");
|
|
26
26
|
// @__NO_SIDE_EFFECTS__
|
|
27
27
|
function getShell() {
|
|
28
28
|
return (0, import_rewire.getEnvValue)("SHELL");
|
|
@@ -26,8 +26,8 @@ __export(socket_cli_shadow_exports, {
|
|
|
26
26
|
getSocketCliShadowSilent: () => getSocketCliShadowSilent
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(socket_cli_shadow_exports);
|
|
29
|
-
var import_helpers = require("
|
|
30
|
-
var import_rewire = require("
|
|
29
|
+
var import_helpers = require("./helpers");
|
|
30
|
+
var import_rewire = require("./rewire");
|
|
31
31
|
// @__NO_SIDE_EFFECTS__
|
|
32
32
|
function getSocketCliShadowAcceptRisks() {
|
|
33
33
|
return (0, import_helpers.envAsBoolean)((0, import_rewire.getEnvValue)("SOCKET_CLI_SHADOW_ACCEPT_RISKS"));
|
package/dist/env/socket-cli.js
CHANGED
|
@@ -35,8 +35,8 @@ __export(socket_cli_exports, {
|
|
|
35
35
|
getSocketCliViewAllRisks: () => getSocketCliViewAllRisks
|
|
36
36
|
});
|
|
37
37
|
module.exports = __toCommonJS(socket_cli_exports);
|
|
38
|
-
var import_helpers = require("
|
|
39
|
-
var import_rewire = require("
|
|
38
|
+
var import_helpers = require("./helpers");
|
|
39
|
+
var import_rewire = require("./rewire");
|
|
40
40
|
// @__NO_SIDE_EFFECTS__
|
|
41
41
|
function getSocketCliAcceptRisks() {
|
|
42
42
|
return (0, import_helpers.envAsBoolean)((0, import_rewire.getEnvValue)("SOCKET_CLI_ACCEPT_RISKS"));
|
package/dist/env/socket.js
CHANGED
|
@@ -36,8 +36,8 @@ __export(socket_exports, {
|
|
|
36
36
|
getSocketViewAllRisks: () => getSocketViewAllRisks
|
|
37
37
|
});
|
|
38
38
|
module.exports = __toCommonJS(socket_exports);
|
|
39
|
-
var import_helpers = require("
|
|
40
|
-
var import_rewire = require("
|
|
39
|
+
var import_helpers = require("./helpers");
|
|
40
|
+
var import_rewire = require("./rewire");
|
|
41
41
|
// @__NO_SIDE_EFFECTS__
|
|
42
42
|
function getSocketAcceptRisks() {
|
|
43
43
|
return (0, import_helpers.envAsBoolean)((0, import_rewire.getEnvValue)("SOCKET_ACCEPT_RISKS"));
|
package/dist/env/temp-dir.js
CHANGED
|
@@ -24,7 +24,7 @@ __export(temp_dir_exports, {
|
|
|
24
24
|
getTmpdir: () => getTmpdir
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(temp_dir_exports);
|
|
27
|
-
var import_rewire = require("
|
|
27
|
+
var import_rewire = require("./rewire");
|
|
28
28
|
// @__NO_SIDE_EFFECTS__
|
|
29
29
|
function getTmpdir() {
|
|
30
30
|
return (0, import_rewire.getEnvValue)("TMPDIR");
|
package/dist/env/term.js
CHANGED
|
@@ -22,7 +22,7 @@ __export(term_exports, {
|
|
|
22
22
|
getTerm: () => getTerm
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(term_exports);
|
|
25
|
-
var import_rewire = require("
|
|
25
|
+
var import_rewire = require("./rewire");
|
|
26
26
|
// @__NO_SIDE_EFFECTS__
|
|
27
27
|
function getTerm() {
|
|
28
28
|
return (0, import_rewire.getEnvValue)("TERM");
|
package/dist/env/test.js
CHANGED
|
@@ -24,9 +24,9 @@ __export(test_exports, {
|
|
|
24
24
|
isTest: () => isTest
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(test_exports);
|
|
27
|
-
var import_helpers = require("
|
|
28
|
-
var import_node_env = require("
|
|
29
|
-
var import_rewire = require("
|
|
27
|
+
var import_helpers = require("./helpers");
|
|
28
|
+
var import_node_env = require("./node-env");
|
|
29
|
+
var import_rewire = require("./rewire");
|
|
30
30
|
// @__NO_SIDE_EFFECTS__
|
|
31
31
|
function getJestWorkerId() {
|
|
32
32
|
return (0, import_helpers.envAsString)((0, import_rewire.getEnvValue)("JEST_WORKER_ID"));
|
package/dist/env/windows.js
CHANGED
|
@@ -25,7 +25,7 @@ __export(windows_exports, {
|
|
|
25
25
|
getUserprofile: () => getUserprofile
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(windows_exports);
|
|
28
|
-
var import_rewire = require("
|
|
28
|
+
var import_rewire = require("./rewire");
|
|
29
29
|
// @__NO_SIDE_EFFECTS__
|
|
30
30
|
function getAppdata() {
|
|
31
31
|
return (0, import_rewire.getEnvValue)("APPDATA");
|
package/dist/env/xdg.js
CHANGED
|
@@ -24,7 +24,7 @@ __export(xdg_exports, {
|
|
|
24
24
|
getXdgDataHome: () => getXdgDataHome
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(xdg_exports);
|
|
27
|
-
var import_rewire = require("
|
|
27
|
+
var import_rewire = require("./rewire");
|
|
28
28
|
// @__NO_SIDE_EFFECTS__
|
|
29
29
|
function getXdgCacheHome() {
|
|
30
30
|
return (0, import_rewire.getEnvValue)("XDG_CACHE_HOME");
|
package/dist/fs.js
CHANGED
|
@@ -48,13 +48,15 @@ __export(fs_exports, {
|
|
|
48
48
|
writeJsonSync: () => writeJsonSync
|
|
49
49
|
});
|
|
50
50
|
module.exports = __toCommonJS(fs_exports);
|
|
51
|
-
var import_process = require("
|
|
51
|
+
var import_process = require("./constants/process");
|
|
52
52
|
var import_arrays = require("./arrays");
|
|
53
|
+
var import_del = require("./external/del");
|
|
53
54
|
var import_globs = require("./globs");
|
|
54
55
|
var import_json = require("./json");
|
|
55
56
|
var import_objects = require("./objects");
|
|
56
|
-
var
|
|
57
|
+
var import_normalize = require("./paths/normalize");
|
|
57
58
|
var import_rewire = require("./paths/rewire");
|
|
59
|
+
var import_socket = require("./paths/socket");
|
|
58
60
|
var import_sorts = require("./sorts");
|
|
59
61
|
const abortSignal = (0, import_process.getAbortSignal)();
|
|
60
62
|
const defaultRemoveOptions = (0, import_objects.objectFreeze)({
|
|
@@ -131,10 +133,10 @@ async function findUp(name, options) {
|
|
|
131
133
|
try {
|
|
132
134
|
const stats = await fs.promises.stat(thePath);
|
|
133
135
|
if (!onlyDirectories && stats.isFile()) {
|
|
134
|
-
return (0,
|
|
136
|
+
return (0, import_normalize.normalizePath)(thePath);
|
|
135
137
|
}
|
|
136
138
|
if (!onlyFiles && stats.isDirectory()) {
|
|
137
|
-
return (0,
|
|
139
|
+
return (0, import_normalize.normalizePath)(thePath);
|
|
138
140
|
}
|
|
139
141
|
} catch {
|
|
140
142
|
}
|
|
@@ -172,10 +174,10 @@ function findUpSync(name, options) {
|
|
|
172
174
|
try {
|
|
173
175
|
const stats = fs.statSync(thePath);
|
|
174
176
|
if (!onlyDirectories && stats.isFile()) {
|
|
175
|
-
return (0,
|
|
177
|
+
return (0, import_normalize.normalizePath)(thePath);
|
|
176
178
|
}
|
|
177
179
|
if (!onlyFiles && stats.isDirectory()) {
|
|
178
|
-
return (0,
|
|
180
|
+
return (0, import_normalize.normalizePath)(thePath);
|
|
179
181
|
}
|
|
180
182
|
} catch {
|
|
181
183
|
}
|
|
@@ -187,10 +189,10 @@ function findUpSync(name, options) {
|
|
|
187
189
|
try {
|
|
188
190
|
const stats = fs.statSync(thePath);
|
|
189
191
|
if (!onlyDirectories && stats.isFile()) {
|
|
190
|
-
return (0,
|
|
192
|
+
return (0, import_normalize.normalizePath)(thePath);
|
|
191
193
|
}
|
|
192
194
|
if (!onlyFiles && stats.isDirectory()) {
|
|
193
|
-
return (0,
|
|
195
|
+
return (0, import_normalize.normalizePath)(thePath);
|
|
194
196
|
}
|
|
195
197
|
} catch {
|
|
196
198
|
}
|
|
@@ -223,7 +225,7 @@ function isDirEmptySync(dirname, options) {
|
|
|
223
225
|
const matcher = (0, import_globs.getGlobMatcher)(
|
|
224
226
|
ignore,
|
|
225
227
|
{
|
|
226
|
-
cwd: (0,
|
|
228
|
+
cwd: (0, import_normalize.pathLikeToString)(dirname)
|
|
227
229
|
}
|
|
228
230
|
);
|
|
229
231
|
let ignoredCount = 0;
|
|
@@ -425,15 +427,10 @@ let _cachedAllowedDirs;
|
|
|
425
427
|
function getAllowedDirectories() {
|
|
426
428
|
if (_cachedAllowedDirs === void 0) {
|
|
427
429
|
const path = /* @__PURE__ */ getPath();
|
|
428
|
-
const {
|
|
429
|
-
getOsTmpDir,
|
|
430
|
-
getSocketCacacheDir,
|
|
431
|
-
getSocketUserDir
|
|
432
|
-
} = require("#lib/paths");
|
|
433
430
|
_cachedAllowedDirs = [
|
|
434
|
-
path.resolve(getOsTmpDir()),
|
|
435
|
-
path.resolve(getSocketCacacheDir()),
|
|
436
|
-
path.resolve(getSocketUserDir())
|
|
431
|
+
path.resolve((0, import_socket.getOsTmpDir)()),
|
|
432
|
+
path.resolve((0, import_socket.getSocketCacacheDir)()),
|
|
433
|
+
path.resolve((0, import_socket.getSocketUserDir)())
|
|
437
434
|
];
|
|
438
435
|
}
|
|
439
436
|
return _cachedAllowedDirs;
|
|
@@ -443,9 +440,8 @@ function invalidatePathCache() {
|
|
|
443
440
|
}
|
|
444
441
|
(0, import_rewire.registerCacheInvalidation)(invalidatePathCache);
|
|
445
442
|
async function safeDelete(filepath, options) {
|
|
446
|
-
const { deleteAsync } = require("./external/del.js");
|
|
447
443
|
const opts = { __proto__: null, ...options };
|
|
448
|
-
const patterns = (0, import_arrays.isArray)(filepath) ? filepath.map(
|
|
444
|
+
const patterns = (0, import_arrays.isArray)(filepath) ? filepath.map(import_normalize.pathLikeToString) : [(0, import_normalize.pathLikeToString)(filepath)];
|
|
449
445
|
let shouldForce = opts.force !== false;
|
|
450
446
|
if (!shouldForce && patterns.length > 0) {
|
|
451
447
|
const path = /* @__PURE__ */ getPath();
|
|
@@ -466,7 +462,7 @@ async function safeDelete(filepath, options) {
|
|
|
466
462
|
shouldForce = true;
|
|
467
463
|
}
|
|
468
464
|
}
|
|
469
|
-
await deleteAsync(patterns, {
|
|
465
|
+
await (0, import_del.deleteAsync)(patterns, {
|
|
470
466
|
concurrency: opts.maxRetries || defaultRemoveOptions.maxRetries,
|
|
471
467
|
dryRun: false,
|
|
472
468
|
force: shouldForce,
|
|
@@ -474,9 +470,8 @@ async function safeDelete(filepath, options) {
|
|
|
474
470
|
});
|
|
475
471
|
}
|
|
476
472
|
function safeDeleteSync(filepath, options) {
|
|
477
|
-
const { deleteSync } = require("./external/del.js");
|
|
478
473
|
const opts = { __proto__: null, ...options };
|
|
479
|
-
const patterns = (0, import_arrays.isArray)(filepath) ? filepath.map(
|
|
474
|
+
const patterns = (0, import_arrays.isArray)(filepath) ? filepath.map(import_normalize.pathLikeToString) : [(0, import_normalize.pathLikeToString)(filepath)];
|
|
480
475
|
let shouldForce = opts.force !== false;
|
|
481
476
|
if (!shouldForce && patterns.length > 0) {
|
|
482
477
|
const path = /* @__PURE__ */ getPath();
|
|
@@ -497,7 +492,7 @@ function safeDeleteSync(filepath, options) {
|
|
|
497
492
|
shouldForce = true;
|
|
498
493
|
}
|
|
499
494
|
}
|
|
500
|
-
deleteSync(patterns, {
|
|
495
|
+
(0, import_del.deleteSync)(patterns, {
|
|
501
496
|
concurrency: opts.maxRetries || defaultRemoveOptions.maxRetries,
|
|
502
497
|
dryRun: false,
|
|
503
498
|
force: shouldForce,
|
|
@@ -581,7 +576,7 @@ function uniqueSync(filepath) {
|
|
|
581
576
|
const path = /* @__PURE__ */ getPath();
|
|
582
577
|
const filepathStr = String(filepath);
|
|
583
578
|
if (!fs.existsSync(filepathStr)) {
|
|
584
|
-
return (0,
|
|
579
|
+
return (0, import_normalize.normalizePath)(filepathStr);
|
|
585
580
|
}
|
|
586
581
|
const dirname = path.dirname(filepathStr);
|
|
587
582
|
const ext = path.extname(filepathStr);
|
|
@@ -592,7 +587,7 @@ function uniqueSync(filepath) {
|
|
|
592
587
|
uniquePath = path.join(dirname, `${basename}-${counter}${ext}`);
|
|
593
588
|
counter++;
|
|
594
589
|
} while (fs.existsSync(uniquePath));
|
|
595
|
-
return (0,
|
|
590
|
+
return (0, import_normalize.normalizePath)(uniquePath);
|
|
596
591
|
}
|
|
597
592
|
async function writeJson(filepath, jsonContent, options) {
|
|
598
593
|
const opts = typeof options === "string" ? { encoding: options } : options;
|
package/dist/git.d.ts
CHANGED
|
@@ -24,6 +24,12 @@ export interface GitDiffOptions {
|
|
|
24
24
|
* @default false
|
|
25
25
|
*/
|
|
26
26
|
absolute?: boolean | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Return results as a `Set` instead of an array.
|
|
29
|
+
*
|
|
30
|
+
* @default false
|
|
31
|
+
*/
|
|
32
|
+
asSet?: boolean | undefined;
|
|
27
33
|
/**
|
|
28
34
|
* Cache git diff results to avoid repeated git subprocess calls.
|
|
29
35
|
*
|
|
@@ -52,12 +58,6 @@ export interface GitDiffOptions {
|
|
|
52
58
|
* @default false
|
|
53
59
|
*/
|
|
54
60
|
porcelain?: boolean | undefined;
|
|
55
|
-
/**
|
|
56
|
-
* Return results as a `Set` instead of an array.
|
|
57
|
-
*
|
|
58
|
-
* @default false
|
|
59
|
-
*/
|
|
60
|
-
asSet?: boolean | undefined;
|
|
61
61
|
/**
|
|
62
62
|
* Additional options passed to glob matcher.
|
|
63
63
|
*
|
package/dist/git.js
CHANGED
|
@@ -45,10 +45,9 @@ __export(git_exports, {
|
|
|
45
45
|
});
|
|
46
46
|
module.exports = __toCommonJS(git_exports);
|
|
47
47
|
var import_path = __toESM(require("path"));
|
|
48
|
-
var import_platform = require("#constants/platform");
|
|
49
48
|
var import_debug = require("./debug");
|
|
50
49
|
var import_globs = require("./globs");
|
|
51
|
-
var
|
|
50
|
+
var import_normalize = require("./paths/normalize");
|
|
52
51
|
var import_spawn = require("./spawn");
|
|
53
52
|
var import_strings = require("./strings");
|
|
54
53
|
const gitDiffCache = /* @__PURE__ */ new Map();
|
|
@@ -81,8 +80,7 @@ function getGitDiffSpawnArgs(cwd) {
|
|
|
81
80
|
getGitPath(),
|
|
82
81
|
["status", "--porcelain"],
|
|
83
82
|
{
|
|
84
|
-
cwd: resolvedCwd
|
|
85
|
-
shell: import_platform.WIN32
|
|
83
|
+
cwd: resolvedCwd
|
|
86
84
|
}
|
|
87
85
|
],
|
|
88
86
|
unstaged: [
|
|
@@ -96,8 +94,7 @@ function getGitDiffSpawnArgs(cwd) {
|
|
|
96
94
|
getGitPath(),
|
|
97
95
|
["diff", "--cached", "--name-only"],
|
|
98
96
|
{
|
|
99
|
-
cwd: resolvedCwd
|
|
100
|
-
shell: import_platform.WIN32
|
|
97
|
+
cwd: resolvedCwd
|
|
101
98
|
}
|
|
102
99
|
]
|
|
103
100
|
};
|
|
@@ -197,11 +194,11 @@ function parseGitDiffStdout(stdout, options, spawnCwd) {
|
|
|
197
194
|
return line.length > 3 ? line.substring(3) : line;
|
|
198
195
|
});
|
|
199
196
|
}
|
|
200
|
-
const files = absolute ? rawFiles.map((relPath2) => (0,
|
|
197
|
+
const files = absolute ? rawFiles.map((relPath2) => (0, import_normalize.normalizePath)(import_path.default.join(rootPath, relPath2))) : rawFiles.map((relPath2) => (0, import_normalize.normalizePath)(relPath2));
|
|
201
198
|
if (cwd === rootPath) {
|
|
202
199
|
return files;
|
|
203
200
|
}
|
|
204
|
-
const relPath = (0,
|
|
201
|
+
const relPath = (0, import_normalize.normalizePath)(import_path.default.relative(rootPath, cwd));
|
|
205
202
|
const matcher = (0, import_globs.getGlobMatcher)([`${relPath}/**`], {
|
|
206
203
|
...matcherOptions,
|
|
207
204
|
absolute,
|
|
@@ -255,7 +252,7 @@ async function isChanged(pathname, options) {
|
|
|
255
252
|
});
|
|
256
253
|
const resolvedPathname = (/* @__PURE__ */ getFs()).realpathSync(pathname);
|
|
257
254
|
const baseCwd = options?.cwd ? (/* @__PURE__ */ getFs()).realpathSync(options["cwd"]) : getCwd();
|
|
258
|
-
const relativePath = (0,
|
|
255
|
+
const relativePath = (0, import_normalize.normalizePath)(import_path.default.relative(baseCwd, resolvedPathname));
|
|
259
256
|
return files.includes(relativePath);
|
|
260
257
|
}
|
|
261
258
|
function isChangedSync(pathname, options) {
|
|
@@ -266,7 +263,7 @@ function isChangedSync(pathname, options) {
|
|
|
266
263
|
});
|
|
267
264
|
const resolvedPathname = (/* @__PURE__ */ getFs()).realpathSync(pathname);
|
|
268
265
|
const baseCwd = options?.cwd ? (/* @__PURE__ */ getFs()).realpathSync(options["cwd"]) : getCwd();
|
|
269
|
-
const relativePath = (0,
|
|
266
|
+
const relativePath = (0, import_normalize.normalizePath)(import_path.default.relative(baseCwd, resolvedPathname));
|
|
270
267
|
return files.includes(relativePath);
|
|
271
268
|
}
|
|
272
269
|
async function isUnstaged(pathname, options) {
|
|
@@ -277,7 +274,7 @@ async function isUnstaged(pathname, options) {
|
|
|
277
274
|
});
|
|
278
275
|
const resolvedPathname = (/* @__PURE__ */ getFs()).realpathSync(pathname);
|
|
279
276
|
const baseCwd = options?.cwd ? (/* @__PURE__ */ getFs()).realpathSync(options["cwd"]) : getCwd();
|
|
280
|
-
const relativePath = (0,
|
|
277
|
+
const relativePath = (0, import_normalize.normalizePath)(import_path.default.relative(baseCwd, resolvedPathname));
|
|
281
278
|
return files.includes(relativePath);
|
|
282
279
|
}
|
|
283
280
|
function isUnstagedSync(pathname, options) {
|
|
@@ -288,7 +285,7 @@ function isUnstagedSync(pathname, options) {
|
|
|
288
285
|
});
|
|
289
286
|
const resolvedPathname = (/* @__PURE__ */ getFs()).realpathSync(pathname);
|
|
290
287
|
const baseCwd = options?.cwd ? (/* @__PURE__ */ getFs()).realpathSync(options["cwd"]) : getCwd();
|
|
291
|
-
const relativePath = (0,
|
|
288
|
+
const relativePath = (0, import_normalize.normalizePath)(import_path.default.relative(baseCwd, resolvedPathname));
|
|
292
289
|
return files.includes(relativePath);
|
|
293
290
|
}
|
|
294
291
|
async function isStaged(pathname, options) {
|
|
@@ -299,7 +296,7 @@ async function isStaged(pathname, options) {
|
|
|
299
296
|
});
|
|
300
297
|
const resolvedPathname = (/* @__PURE__ */ getFs()).realpathSync(pathname);
|
|
301
298
|
const baseCwd = options?.cwd ? (/* @__PURE__ */ getFs()).realpathSync(options["cwd"]) : getCwd();
|
|
302
|
-
const relativePath = (0,
|
|
299
|
+
const relativePath = (0, import_normalize.normalizePath)(import_path.default.relative(baseCwd, resolvedPathname));
|
|
303
300
|
return files.includes(relativePath);
|
|
304
301
|
}
|
|
305
302
|
function isStagedSync(pathname, options) {
|
|
@@ -310,7 +307,7 @@ function isStagedSync(pathname, options) {
|
|
|
310
307
|
});
|
|
311
308
|
const resolvedPathname = (/* @__PURE__ */ getFs()).realpathSync(pathname);
|
|
312
309
|
const baseCwd = options?.cwd ? (/* @__PURE__ */ getFs()).realpathSync(options["cwd"]) : getCwd();
|
|
313
|
-
const relativePath = (0,
|
|
310
|
+
const relativePath = (0, import_normalize.normalizePath)(import_path.default.relative(baseCwd, resolvedPathname));
|
|
314
311
|
return files.includes(relativePath);
|
|
315
312
|
}
|
|
316
313
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/github.js
CHANGED
|
@@ -31,8 +31,8 @@ __export(github_exports, {
|
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(github_exports);
|
|
33
33
|
var import_cache_with_ttl = require("./cache-with-ttl");
|
|
34
|
-
var import_github = require("
|
|
35
|
-
var import_socket_cli = require("
|
|
34
|
+
var import_github = require("./env/github");
|
|
35
|
+
var import_socket_cli = require("./env/socket-cli");
|
|
36
36
|
var import_http_request = require("./http-request");
|
|
37
37
|
var import_spawn = require("./spawn");
|
|
38
38
|
const GITHUB_API_BASE_URL = "https://api.github.com";
|
package/dist/globs.js
CHANGED
|
@@ -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 globs_exports = {};
|
|
21
31
|
__export(globs_exports, {
|
|
@@ -24,7 +34,10 @@ __export(globs_exports, {
|
|
|
24
34
|
globStreamLicenses: () => globStreamLicenses
|
|
25
35
|
});
|
|
26
36
|
module.exports = __toCommonJS(globs_exports);
|
|
37
|
+
var fastGlob = __toESM(require("./external/fast-glob.js"));
|
|
38
|
+
var import_picomatch = __toESM(require("./external/picomatch.js"));
|
|
27
39
|
var import_objects = require("./objects");
|
|
40
|
+
var import_globs = require("./paths/globs");
|
|
28
41
|
const defaultIgnore = (0, import_objects.objectFreeze)([
|
|
29
42
|
// Most of these ignored files can be included specifically if included in the
|
|
30
43
|
// files globs. Exceptions to this are:
|
|
@@ -65,22 +78,6 @@ const defaultIgnore = (0, import_objects.objectFreeze)([
|
|
|
65
78
|
// Inline additional ignores.
|
|
66
79
|
"**/bower_components"
|
|
67
80
|
]);
|
|
68
|
-
let _picomatch;
|
|
69
|
-
// @__NO_SIDE_EFFECTS__
|
|
70
|
-
function getPicomatch() {
|
|
71
|
-
if (_picomatch === void 0) {
|
|
72
|
-
_picomatch = require("./external/picomatch.js");
|
|
73
|
-
}
|
|
74
|
-
return _picomatch;
|
|
75
|
-
}
|
|
76
|
-
let _fastGlob;
|
|
77
|
-
// @__NO_SIDE_EFFECTS__
|
|
78
|
-
function getFastGlob() {
|
|
79
|
-
if (_fastGlob === void 0) {
|
|
80
|
-
_fastGlob = require("./external/fast-glob.js");
|
|
81
|
-
}
|
|
82
|
-
return _fastGlob;
|
|
83
|
-
}
|
|
84
81
|
// @__NO_SIDE_EFFECTS__
|
|
85
82
|
function globStreamLicenses(dirname, options) {
|
|
86
83
|
const {
|
|
@@ -94,19 +91,10 @@ function globStreamLicenses(dirname, options) {
|
|
|
94
91
|
"**/*.{cjs,cts,js,json,mjs,mts,ts}"
|
|
95
92
|
];
|
|
96
93
|
if (ignoreOriginals) {
|
|
97
|
-
|
|
98
|
-
/*@__INLINE__*/
|
|
99
|
-
require("#constants/paths")
|
|
100
|
-
);
|
|
101
|
-
ignore.push(LICENSE_ORIGINAL_GLOB_RECURSIVE);
|
|
94
|
+
ignore.push(import_globs.LICENSE_ORIGINAL_GLOB_RECURSIVE);
|
|
102
95
|
}
|
|
103
|
-
const fastGlob = /* @__PURE__ */ getFastGlob();
|
|
104
|
-
const paths = (
|
|
105
|
-
/*@__INLINE__*/
|
|
106
|
-
require("#constants/paths")
|
|
107
|
-
);
|
|
108
96
|
return fastGlob.globStream(
|
|
109
|
-
[recursive ?
|
|
97
|
+
[recursive ? import_globs.LICENSE_GLOB_RECURSIVE : import_globs.LICENSE_GLOB],
|
|
110
98
|
{
|
|
111
99
|
__proto__: null,
|
|
112
100
|
absolute: true,
|
|
@@ -128,14 +116,13 @@ function getGlobMatcher(glob, options) {
|
|
|
128
116
|
}
|
|
129
117
|
const positivePatterns = patterns.filter((p) => !p.startsWith("!"));
|
|
130
118
|
const negativePatterns = patterns.filter((p) => p.startsWith("!")).map((p) => p.slice(1));
|
|
131
|
-
const picomatch = /* @__PURE__ */ getPicomatch();
|
|
132
119
|
const matchOptions = {
|
|
133
120
|
dot: true,
|
|
134
121
|
nocase: true,
|
|
135
122
|
...options,
|
|
136
123
|
...negativePatterns.length > 0 ? { ignore: negativePatterns } : {}
|
|
137
124
|
};
|
|
138
|
-
matcher =
|
|
125
|
+
matcher = (0, import_picomatch.default)(
|
|
139
126
|
positivePatterns.length > 0 ? positivePatterns : patterns,
|
|
140
127
|
matchOptions
|
|
141
128
|
);
|
package/dist/ipc.d.ts
CHANGED
|
@@ -56,21 +56,21 @@ export interface IpcHandshake extends IpcMessage<{
|
|
|
56
56
|
* Represents the structure of stub files used for filesystem-based IPC.
|
|
57
57
|
*/
|
|
58
58
|
export interface IpcStub {
|
|
59
|
+
/** The actual data payload. */
|
|
60
|
+
data: unknown;
|
|
59
61
|
/** Process ID that created the stub. */
|
|
60
62
|
pid: number;
|
|
61
63
|
/** Creation timestamp for age validation. */
|
|
62
64
|
timestamp: number;
|
|
63
|
-
/** The actual data payload. */
|
|
64
|
-
data: unknown;
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
67
67
|
* Options for IPC communication
|
|
68
68
|
*/
|
|
69
69
|
export interface IpcOptions {
|
|
70
|
-
/** Timeout in milliseconds for async operations. */
|
|
71
|
-
timeout?: number;
|
|
72
70
|
/** Text encoding for message serialization. */
|
|
73
71
|
encoding?: BufferEncoding;
|
|
72
|
+
/** Timeout in milliseconds for async operations. */
|
|
73
|
+
timeout?: number;
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
76
76
|
* Create a unique IPC channel identifier for message correlation.
|
package/dist/ipc.js
CHANGED
|
@@ -47,7 +47,7 @@ var import_crypto = __toESM(require("crypto"));
|
|
|
47
47
|
var import_fs = require("fs");
|
|
48
48
|
var import_path = __toESM(require("path"));
|
|
49
49
|
var import_fs2 = require("./fs");
|
|
50
|
-
var
|
|
50
|
+
var import_socket = require("./paths/socket");
|
|
51
51
|
var import_zod = require("./zod");
|
|
52
52
|
const IpcMessageSchema = import_zod.z.object({
|
|
53
53
|
/** Unique identifier for message tracking and response correlation. */
|
|
@@ -84,7 +84,7 @@ function createIpcChannelId(prefix = "socket") {
|
|
|
84
84
|
return `${prefix}-${process.pid}-${import_crypto.default.randomBytes(8).toString("hex")}`;
|
|
85
85
|
}
|
|
86
86
|
function getIpcStubPath(appName) {
|
|
87
|
-
const tempDir = (0,
|
|
87
|
+
const tempDir = (0, import_socket.getOsTmpDir)();
|
|
88
88
|
const stubDir = import_path.default.join(tempDir, ".socket-ipc", appName);
|
|
89
89
|
return import_path.default.join(stubDir, `stub-${process.pid}.json`);
|
|
90
90
|
}
|
|
@@ -124,7 +124,7 @@ async function readIpcStub(stubPath) {
|
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
async function cleanupIpcStubs(appName) {
|
|
127
|
-
const tempDir = (0,
|
|
127
|
+
const tempDir = (0, import_socket.getOsTmpDir)();
|
|
128
128
|
const stubDir = import_path.default.join(tempDir, ".socket-ipc", appName);
|
|
129
129
|
try {
|
|
130
130
|
const files = await import_fs.promises.readdir(stubDir);
|