@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.
Files changed (135) hide show
  1. package/CHANGELOG.md +91 -0
  2. package/README.md +26 -17
  3. package/dist/ai/discover.js +2 -2
  4. package/dist/ai/spawn.js +3 -3
  5. package/dist/ai/worktree.js +3 -3
  6. package/dist/argv/parse-args-string.d.ts +30 -0
  7. package/dist/argv/parse-args-string.js +42 -0
  8. package/dist/bin/check-primordials.js +15 -10
  9. package/dist/bin/check.js +2 -2
  10. package/dist/bin/exec.d.ts +1 -1
  11. package/dist/bin/exec.js +2 -2
  12. package/dist/bin/socket-lib.js +2 -2
  13. package/dist/{ttl-cache/cache.js → cache/ttl/store.js} +15 -15
  14. package/dist/{ttl-cache → cache/ttl}/types.d.ts +1 -1
  15. package/dist/checks/primordials-defaults.d.ts +20 -0
  16. package/dist/checks/primordials-defaults.js +92 -0
  17. package/dist/colors/socket-palette.d.ts +69 -0
  18. package/dist/colors/socket-palette.js +91 -0
  19. package/dist/constants/socket.js +1 -1
  20. package/dist/cover/code.js +2 -2
  21. package/dist/cover/type.js +2 -2
  22. package/dist/debug/_internal.d.ts +1 -1
  23. package/dist/debug/_internal.js +2 -2
  24. package/dist/debug/output.js +5 -5
  25. package/dist/dlx/binary-types.d.ts +2 -2
  26. package/dist/dlx/binary.d.ts +2 -2
  27. package/dist/dlx/binary.js +3 -3
  28. package/dist/dlx/firewall.js +2 -2
  29. package/dist/dlx/manifest.js +2 -2
  30. package/dist/dlx/package.d.ts +2 -2
  31. package/dist/dlx/package.js +2 -2
  32. package/dist/dlx/types.d.ts +2 -2
  33. package/dist/eco/npm/npm/exec.d.ts +2 -2
  34. package/dist/eco/npm/npm/exec.js +2 -2
  35. package/dist/eco/npm/pnpm/exec.d.ts +1 -1
  36. package/dist/eco/npm/script.d.ts +1 -1
  37. package/dist/eco/npm/script.js +3 -3
  38. package/dist/eco/npm/yarnpkg/yarn/exec.d.ts +1 -1
  39. package/dist/{signal-exit → events/exit}/_internal.d.ts +1 -1
  40. package/dist/{signal-exit/register.js → events/exit/handler.js} +4 -4
  41. package/dist/{signal-exit → events/exit}/intercept.js +2 -2
  42. package/dist/{signal-exit → events/exit}/types.d.ts +1 -1
  43. package/dist/{warnings/event-target.d.ts → events/warning/handler.d.ts} +1 -1
  44. package/dist/{warnings/event-target.js → events/warning/handler.js} +4 -4
  45. package/dist/{warnings → events/warning}/suppress.d.ts +3 -3
  46. package/dist/{warnings → events/warning}/suppress.js +2 -2
  47. package/dist/external-tools/janus/asset-names.d.ts +7 -0
  48. package/dist/external-tools/janus/asset-names.js +5 -0
  49. package/dist/external-tools/janus/from-download.d.ts +1 -1
  50. package/dist/external-tools/janus/from-download.js +12 -4
  51. package/dist/fs/read-json-cache.d.ts +83 -0
  52. package/dist/fs/read-json-cache.js +156 -0
  53. package/dist/fs/read-json.d.ts +6 -1
  54. package/dist/fs/read-json.js +80 -8
  55. package/dist/fs/types.d.ts +14 -0
  56. package/dist/git/_internal.js +3 -3
  57. package/dist/github/refs-cache.d.ts +1 -1
  58. package/dist/github/refs-cache.js +2 -2
  59. package/dist/github/token.d.ts +1 -1
  60. package/dist/github/token.js +2 -2
  61. package/dist/globs/{glob.js → match.js} +3 -3
  62. package/dist/http-request/browser-fetch.d.ts +10 -0
  63. package/dist/http-request/browser-fetch.js +32 -0
  64. package/dist/http-request/browser.d.ts +190 -0
  65. package/dist/http-request/browser.js +224 -0
  66. package/dist/http-request/download-types.d.ts +2 -2
  67. package/dist/http-request/http-request.d.ts +12 -0
  68. package/dist/http-request/http-request.js +36 -0
  69. package/dist/http-request/node.d.ts +29 -0
  70. package/dist/http-request/{convenience.js → node.js} +9 -3
  71. package/dist/http-request/request-attempt.js +4 -0
  72. package/dist/http-request/request-types.d.ts +15 -0
  73. package/dist/http-request/request.js +5 -0
  74. package/dist/links/{link.d.ts → create.d.ts} +2 -2
  75. package/dist/links/{link.js → create.js} +3 -3
  76. package/dist/logger/_internal.d.ts +1 -1
  77. package/dist/logger/browser.d.ts +18 -0
  78. package/dist/logger/browser.js +58 -0
  79. package/dist/logger/console.js +3 -3
  80. package/dist/logger/default.d.ts +11 -0
  81. package/dist/logger/default.js +37 -0
  82. package/dist/logger/logger.d.ts +8 -403
  83. package/dist/logger/logger.js +3 -827
  84. package/dist/logger/node.d.ts +400 -0
  85. package/dist/logger/node.js +856 -0
  86. package/dist/logger/symbols-builder.d.ts +1 -1
  87. package/dist/logger/types.d.ts +1 -1
  88. package/dist/packages/isolation.js +3 -3
  89. package/dist/packages/provenance.d.ts +42 -0
  90. package/dist/packages/provenance.js +71 -0
  91. package/dist/packages/types.d.ts +2 -0
  92. package/dist/primordials/globals.d.ts +6 -3
  93. package/dist/primordials/globals.js +15 -9
  94. package/dist/primordials/map-set.d.ts +35 -0
  95. package/dist/primordials/map-set.js +43 -0
  96. package/dist/primordials/url.d.ts +1 -1
  97. package/dist/process/lock-manager.js +4 -4
  98. package/dist/{spawn → process/spawn}/_internal.js +3 -3
  99. package/dist/{spawn/spawn.js → process/spawn/child.js} +13 -13
  100. package/dist/{spawn → process/spawn}/errors.js +5 -5
  101. package/dist/{spawn → process/spawn}/stdio.js +1 -1
  102. package/dist/{spawn → process/spawn}/types.d.ts +3 -3
  103. package/dist/promises/types.d.ts +15 -2
  104. package/dist/releases/github-archives.js +2 -2
  105. package/dist/releases/github-downloads.js +4 -4
  106. package/dist/spinner/{registry.d.ts → default.d.ts} +1 -1
  107. package/dist/spinner/{registry.js → default.js} +3 -3
  108. package/dist/spinner/spinner.js +4 -4
  109. package/dist/spinner/with.d.ts +1 -1
  110. package/dist/stdio/divider.js +2 -2
  111. package/dist/stdio/footer.js +2 -2
  112. package/dist/stdio/header.js +2 -2
  113. package/dist/stdio/prompts.js +2 -2
  114. package/package.json +410 -132
  115. package/dist/http-request/convenience.d.ts +0 -104
  116. package/dist/promise-queue/types.d.ts +0 -10
  117. package/dist/ttl-cache/types.js +0 -18
  118. /package/dist/{ttl-cache/cache.d.ts → cache/ttl/store.d.ts} +0 -0
  119. /package/dist/{promise-queue → cache/ttl}/types.js +0 -0
  120. /package/dist/{signal-exit → events/exit}/_internal.js +0 -0
  121. /package/dist/{signal-exit/register.d.ts → events/exit/handler.d.ts} +0 -0
  122. /package/dist/{signal-exit → events/exit}/intercept.d.ts +0 -0
  123. /package/dist/{signal-exit → events/exit}/lifecycle.d.ts +0 -0
  124. /package/dist/{signal-exit → events/exit}/lifecycle.js +0 -0
  125. /package/dist/{signal-exit → events/exit}/signals.d.ts +0 -0
  126. /package/dist/{signal-exit → events/exit}/signals.js +0 -0
  127. /package/dist/{signal-exit → events/exit}/types.js +0 -0
  128. /package/dist/globs/{glob.d.ts → match.d.ts} +0 -0
  129. /package/dist/{spawn → process/spawn}/_internal.d.ts +0 -0
  130. /package/dist/{spawn/spawn.d.ts → process/spawn/child.d.ts} +0 -0
  131. /package/dist/{spawn → process/spawn}/errors.d.ts +0 -0
  132. /package/dist/{spawn → process/spawn}/stdio.d.ts +0 -0
  133. /package/dist/{spawn → process/spawn}/types.js +0 -0
  134. /package/dist/{promise-queue → promises}/queue.d.ts +0 -0
  135. /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
- };
@@ -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