@socketsecurity/lib 6.0.0 → 6.0.2
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 +91 -0
- package/README.md +26 -17
- package/dist/ai/discover.js +2 -2
- package/dist/ai/spawn.js +3 -3
- package/dist/ai/worktree.js +3 -3
- package/dist/argv/parse-args-string.d.ts +30 -0
- package/dist/argv/parse-args-string.js +42 -0
- package/dist/bin/check-primordials.js +15 -10
- package/dist/bin/check.js +2 -2
- package/dist/bin/exec.d.ts +1 -1
- package/dist/bin/exec.js +2 -2
- package/dist/bin/socket-lib.js +2 -2
- package/dist/{ttl-cache/cache.js → cache/ttl/store.js} +15 -15
- package/dist/{ttl-cache → cache/ttl}/types.d.ts +1 -1
- package/dist/checks/primordials-defaults.d.ts +20 -0
- package/dist/checks/primordials-defaults.js +92 -0
- package/dist/colors/socket-palette.d.ts +69 -0
- package/dist/colors/socket-palette.js +91 -0
- package/dist/constants/socket.js +1 -1
- package/dist/cover/code.js +2 -2
- package/dist/cover/type.js +2 -2
- package/dist/debug/_internal.d.ts +1 -1
- package/dist/debug/_internal.js +2 -2
- package/dist/debug/output.js +5 -5
- package/dist/dlx/binary-types.d.ts +2 -2
- package/dist/dlx/binary.d.ts +2 -2
- package/dist/dlx/binary.js +3 -3
- package/dist/dlx/firewall.js +2 -2
- package/dist/dlx/manifest.js +2 -2
- package/dist/dlx/package.d.ts +2 -2
- package/dist/dlx/package.js +2 -2
- package/dist/dlx/types.d.ts +2 -2
- package/dist/eco/npm/npm/exec.d.ts +2 -2
- package/dist/eco/npm/npm/exec.js +2 -2
- package/dist/eco/npm/pnpm/exec.d.ts +1 -1
- package/dist/eco/npm/script.d.ts +1 -1
- package/dist/eco/npm/script.js +3 -3
- package/dist/eco/npm/yarnpkg/yarn/exec.d.ts +1 -1
- package/dist/{signal-exit → events/exit}/_internal.d.ts +1 -1
- package/dist/{signal-exit/register.js → events/exit/handler.js} +4 -4
- package/dist/{signal-exit → events/exit}/intercept.js +2 -2
- package/dist/{signal-exit → events/exit}/types.d.ts +1 -1
- package/dist/{warnings/event-target.d.ts → events/warning/handler.d.ts} +1 -1
- package/dist/{warnings/event-target.js → events/warning/handler.js} +4 -4
- package/dist/{warnings → events/warning}/suppress.d.ts +3 -3
- package/dist/{warnings → events/warning}/suppress.js +2 -2
- package/dist/external-tools/janus/asset-names.d.ts +7 -0
- package/dist/external-tools/janus/asset-names.js +5 -0
- package/dist/external-tools/janus/from-download.d.ts +1 -1
- package/dist/external-tools/janus/from-download.js +12 -4
- package/dist/fs/read-json-cache.d.ts +83 -0
- package/dist/fs/read-json-cache.js +156 -0
- package/dist/fs/read-json.d.ts +6 -1
- package/dist/fs/read-json.js +80 -8
- package/dist/fs/types.d.ts +14 -0
- package/dist/git/_internal.js +3 -3
- package/dist/github/refs-cache.d.ts +1 -1
- package/dist/github/refs-cache.js +2 -2
- package/dist/github/token.d.ts +1 -1
- package/dist/github/token.js +2 -2
- package/dist/globs/{glob.js → match.js} +3 -3
- package/dist/http-request/browser-fetch.d.ts +10 -0
- package/dist/http-request/browser-fetch.js +32 -0
- package/dist/http-request/browser.d.ts +190 -0
- package/dist/http-request/browser.js +224 -0
- package/dist/http-request/download-types.d.ts +2 -2
- package/dist/http-request/http-request.d.ts +12 -0
- package/dist/http-request/http-request.js +36 -0
- package/dist/http-request/node.d.ts +29 -0
- package/dist/http-request/{convenience.js → node.js} +9 -3
- package/dist/http-request/request-attempt.js +4 -0
- package/dist/http-request/request-types.d.ts +15 -0
- package/dist/http-request/request.js +5 -0
- package/dist/links/{link.d.ts → create.d.ts} +2 -2
- package/dist/links/{link.js → create.js} +3 -3
- package/dist/logger/_internal.d.ts +1 -1
- package/dist/logger/browser.d.ts +18 -0
- package/dist/logger/browser.js +58 -0
- package/dist/logger/console.js +3 -3
- package/dist/logger/default.d.ts +11 -0
- package/dist/logger/default.js +37 -0
- package/dist/logger/logger.d.ts +8 -403
- package/dist/logger/logger.js +3 -827
- package/dist/logger/node.d.ts +400 -0
- package/dist/logger/node.js +856 -0
- package/dist/logger/symbols-builder.d.ts +1 -1
- package/dist/logger/types.d.ts +1 -1
- package/dist/packages/isolation.js +3 -3
- package/dist/packages/provenance.d.ts +42 -0
- package/dist/packages/provenance.js +71 -0
- package/dist/packages/types.d.ts +2 -0
- package/dist/primordials/globals.d.ts +6 -3
- package/dist/primordials/globals.js +15 -9
- package/dist/primordials/map-set.d.ts +35 -0
- package/dist/primordials/map-set.js +43 -0
- package/dist/primordials/url.d.ts +1 -1
- package/dist/process/lock-manager.js +4 -4
- package/dist/{spawn → process/spawn}/_internal.js +3 -3
- package/dist/{spawn/spawn.js → process/spawn/child.js} +13 -13
- package/dist/{spawn → process/spawn}/errors.js +5 -5
- package/dist/{spawn → process/spawn}/stdio.js +1 -1
- package/dist/{spawn → process/spawn}/types.d.ts +3 -3
- package/dist/promises/types.d.ts +15 -2
- package/dist/releases/github-archives.js +2 -2
- package/dist/releases/github-downloads.js +4 -4
- package/dist/spinner/{registry.d.ts → default.d.ts} +1 -1
- package/dist/spinner/{registry.js → default.js} +3 -3
- package/dist/spinner/spinner.js +4 -4
- package/dist/spinner/with.d.ts +1 -1
- package/dist/stdio/divider.js +2 -2
- package/dist/stdio/footer.js +2 -2
- package/dist/stdio/header.js +2 -2
- package/dist/stdio/prompts.js +2 -2
- package/package.json +410 -132
- package/dist/http-request/convenience.d.ts +0 -104
- package/dist/promise-queue/types.d.ts +0 -10
- package/dist/ttl-cache/types.js +0 -18
- /package/dist/{ttl-cache/cache.d.ts → cache/ttl/store.d.ts} +0 -0
- /package/dist/{promise-queue → cache/ttl}/types.js +0 -0
- /package/dist/{signal-exit → events/exit}/_internal.js +0 -0
- /package/dist/{signal-exit/register.d.ts → events/exit/handler.d.ts} +0 -0
- /package/dist/{signal-exit → events/exit}/intercept.d.ts +0 -0
- /package/dist/{signal-exit → events/exit}/lifecycle.d.ts +0 -0
- /package/dist/{signal-exit → events/exit}/lifecycle.js +0 -0
- /package/dist/{signal-exit → events/exit}/signals.d.ts +0 -0
- /package/dist/{signal-exit → events/exit}/signals.js +0 -0
- /package/dist/{signal-exit → events/exit}/types.js +0 -0
- /package/dist/globs/{glob.d.ts → match.d.ts} +0 -0
- /package/dist/{spawn → process/spawn}/_internal.d.ts +0 -0
- /package/dist/{spawn/spawn.d.ts → process/spawn/child.d.ts} +0 -0
- /package/dist/{spawn → process/spawn}/errors.d.ts +0 -0
- /package/dist/{spawn → process/spawn}/stdio.d.ts +0 -0
- /package/dist/{spawn → process/spawn}/types.js +0 -0
- /package/dist/{promise-queue → promises}/queue.d.ts +0 -0
- /package/dist/{promise-queue → promises}/queue.js +0 -0
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Thin convenience wrappers over `httpRequest` — `httpJson` and
|
|
3
|
-
* `httpText`. Both set sensible default `Accept` (and `Content-Type` when a
|
|
4
|
-
* body is present) headers, then delegate to `httpRequest`. User-supplied
|
|
5
|
-
* headers always win in the merge. Each wrapper throws `HttpResponseError` on
|
|
6
|
-
* non-2xx responses (parallel to the `throwOnError` mode of `httpRequest`) so
|
|
7
|
-
* callers never have to inspect `.ok` themselves.
|
|
8
|
-
*/
|
|
9
|
-
import type { HttpRequestOptions } from './request-types';
|
|
10
|
-
/**
|
|
11
|
-
* Perform an HTTP request and parse JSON response. Convenience wrapper around
|
|
12
|
-
* `httpRequest` for JSON API calls. Automatically sets appropriate headers for
|
|
13
|
-
* JSON requests: - `Accept: application/json` (always) - `Content-Type:
|
|
14
|
-
* application/json` (when body is present) User-provided headers override these
|
|
15
|
-
* defaults.
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ;```ts
|
|
19
|
-
* // Simple JSON GET (automatically sets Accept: application/json)
|
|
20
|
-
* const data = await httpJson('https://api.example.com/data')
|
|
21
|
-
* console.log(data)
|
|
22
|
-
*
|
|
23
|
-
* // With type safety
|
|
24
|
-
* interface User {
|
|
25
|
-
* id: number
|
|
26
|
-
* name: string
|
|
27
|
-
* email: string
|
|
28
|
-
* }
|
|
29
|
-
* const user = await httpJson<User>('https://api.example.com/user/123')
|
|
30
|
-
* console.log(user.name, user.email)
|
|
31
|
-
*
|
|
32
|
-
* // POST with JSON body (automatically sets Content-Type: application/json)
|
|
33
|
-
* const result = await httpJson('https://api.example.com/users', {
|
|
34
|
-
* method: 'POST',
|
|
35
|
-
* body: JSON.stringify({ name: 'Alice', email: 'alice@example.com' }),
|
|
36
|
-
* })
|
|
37
|
-
*
|
|
38
|
-
* // With custom headers and retries
|
|
39
|
-
* const data = await httpJson('https://api.example.com/data', {
|
|
40
|
-
* headers: {
|
|
41
|
-
* Authorization: 'Bearer token123',
|
|
42
|
-
* },
|
|
43
|
-
* retries: 3,
|
|
44
|
-
* retryDelay: 1000,
|
|
45
|
-
* })
|
|
46
|
-
* ```
|
|
47
|
-
*
|
|
48
|
-
* @template T - Expected JSON response type (defaults to `unknown`)
|
|
49
|
-
*
|
|
50
|
-
* @param url - The URL to request (must start with http:// or https://)
|
|
51
|
-
* @param options - Request configuration options.
|
|
52
|
-
*
|
|
53
|
-
* @returns Promise resolving to parsed JSON data
|
|
54
|
-
*
|
|
55
|
-
* @throws {Error} When request fails, response is not ok (status < 200 or >=
|
|
56
|
-
* 300), or JSON parsing fails.
|
|
57
|
-
*/
|
|
58
|
-
export declare function httpJson<T = unknown>(url: string, options?: HttpRequestOptions | undefined): Promise<T>;
|
|
59
|
-
/**
|
|
60
|
-
* Perform an HTTP request and return text response. Convenience wrapper around
|
|
61
|
-
* `httpRequest` for fetching text content. Automatically sets appropriate
|
|
62
|
-
* headers for text requests: - `Accept: text/plain` (always) - `Content-Type:
|
|
63
|
-
* text/plain` (when body is present) User-provided headers override these
|
|
64
|
-
* defaults.
|
|
65
|
-
*
|
|
66
|
-
* @example
|
|
67
|
-
* ;```ts
|
|
68
|
-
* // Fetch HTML (automatically sets Accept: text/plain)
|
|
69
|
-
* const html = await httpText('https://example.com')
|
|
70
|
-
* console.log(html.includes('<!DOCTYPE html>'))
|
|
71
|
-
*
|
|
72
|
-
* // Fetch plain text
|
|
73
|
-
* const text = await httpText('https://example.com/file.txt')
|
|
74
|
-
* console.log(text)
|
|
75
|
-
*
|
|
76
|
-
* // POST with text body (automatically sets Content-Type: text/plain)
|
|
77
|
-
* const result = await httpText('https://example.com/api', {
|
|
78
|
-
* method: 'POST',
|
|
79
|
-
* body: 'raw text data',
|
|
80
|
-
* })
|
|
81
|
-
*
|
|
82
|
-
* // With custom headers (override defaults)
|
|
83
|
-
* const text = await httpText('https://example.com/data.txt', {
|
|
84
|
-
* headers: {
|
|
85
|
-
* Authorization: 'Bearer token123',
|
|
86
|
-
* Accept: 'text/html', // Override default Accept header
|
|
87
|
-
* },
|
|
88
|
-
* })
|
|
89
|
-
*
|
|
90
|
-
* // With timeout
|
|
91
|
-
* const text = await httpText('https://example.com/large-file.txt', {
|
|
92
|
-
* timeout: 60000, // 1 minute
|
|
93
|
-
* })
|
|
94
|
-
* ```
|
|
95
|
-
*
|
|
96
|
-
* @param url - The URL to request (must start with http:// or https://)
|
|
97
|
-
* @param options - Request configuration options.
|
|
98
|
-
*
|
|
99
|
-
* @returns Promise resolving to response body as UTF-8 string
|
|
100
|
-
*
|
|
101
|
-
* @throws {Error} When request fails or response is not ok (status < 200 or >=
|
|
102
|
-
* 300)
|
|
103
|
-
*/
|
|
104
|
-
export declare function httpText(url: string, options?: HttpRequestOptions | undefined): Promise<string>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Public type surface for `promise-queue/*` modules — the `QueuedTask`
|
|
3
|
-
* storage shape used by the bounded-concurrency `PromiseQueue`. Pure types,
|
|
4
|
-
* no runtime side effects.
|
|
5
|
-
*/
|
|
6
|
-
export type QueuedTask<T> = {
|
|
7
|
-
fn: () => Promise<T>;
|
|
8
|
-
resolve: (value: T) => void;
|
|
9
|
-
reject: (error: unknown) => void;
|
|
10
|
-
};
|
package/dist/ttl-cache/types.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* Socket Lib - Built with esbuild */
|
|
3
|
-
"use strict";
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
-
for (let key of __getOwnPropNames(from))
|
|
11
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
-
}
|
|
14
|
-
return to;
|
|
15
|
-
};
|
|
16
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
17
|
-
var types_exports = {};
|
|
18
|
-
module.exports = __toCommonJS(types_exports);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|