@socketsecurity/lib 3.2.7 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -1
- package/README.md +18 -240
- package/dist/agent.js +10 -10
- package/dist/bin.js +4 -4
- package/dist/colors.d.ts +37 -0
- package/dist/colors.js +58 -0
- package/dist/constants/node.js +1 -1
- package/dist/constants/packages.js +7 -7
- package/dist/constants/process.js +1 -1
- package/dist/debug.js +3 -3
- package/dist/dlx-binary.js +4 -4
- 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 +5 -5
- package/dist/env/rewire.js +22 -14
- 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/external/@inquirer/confirm.js +2 -2
- package/dist/external/@inquirer/input.js +2 -2
- package/dist/external/@inquirer/password.js +3 -3
- package/dist/external/@inquirer/search.js +2 -2
- package/dist/external/@inquirer/select.js +3 -3
- package/dist/external/@socketregistry/yocto-spinner.js +1 -1
- package/dist/external/yoctocolors-cjs.js +1 -1
- package/dist/fs.js +4 -6
- package/dist/git.js +1 -1
- package/dist/github.js +2 -2
- package/dist/globs.js +3 -4
- package/dist/lifecycle-script-names.d.ts +9 -2
- package/dist/lifecycle-script-names.js +11 -4
- package/dist/logger.d.ts +106 -81
- package/dist/logger.js +234 -205
- package/dist/maintained-node-versions.d.ts +3 -2
- package/dist/maintained-node-versions.js +11 -4
- package/dist/objects.js +1 -1
- package/dist/package-default-node-range.d.ts +3 -2
- package/dist/package-default-node-range.js +12 -5
- package/dist/package-default-socket-categories.d.ts +7 -2
- package/dist/package-default-socket-categories.js +11 -4
- package/dist/package-extensions.d.ts +3 -2
- package/dist/package-extensions.js +11 -4
- package/dist/packages/exports.js +1 -1
- package/dist/packages/isolation.js +2 -2
- package/dist/packages/licenses.js +2 -2
- package/dist/packages/manifest.js +3 -3
- package/dist/packages/normalize.js +1 -1
- package/dist/packages/operations.js +5 -5
- package/dist/packages/provenance.js +1 -1
- package/dist/path.js +1 -1
- package/dist/paths.js +14 -14
- package/dist/promises.js +2 -2
- package/dist/spawn.js +1 -1
- package/dist/spinner.d.ts +29 -51
- package/dist/spinner.js +155 -149
- package/dist/stdio/prompts.js +1 -1
- package/dist/temporary-executor.js +1 -1
- package/dist/themes/types.d.ts +2 -1
- package/dist/themes/utils.d.ts +1 -1
- package/dist/utils/get-ipc.d.ts +0 -1
- package/dist/utils/get-ipc.js +4 -4
- package/dist/versions.d.ts +1 -1
- package/package.json +10 -9
package/CHANGELOG.md
CHANGED
|
@@ -5,7 +5,29 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
-
## [
|
|
8
|
+
## [3.3.0](https://github.com/SocketDev/socket-lib/releases/tag/v3.3.0) - 2025-11-07
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **Spinner**: New `reason()` and `reasonAndStop()` methods for displaying working/thinking output
|
|
13
|
+
- `reason(text)`: Display reason text alongside spinner (e.g., "Analyzing dependencies...")
|
|
14
|
+
- `reasonAndStop(text)`: Display reason text and stop spinner in one call
|
|
15
|
+
- Normalizes text formatting consistently with other spinner methods
|
|
16
|
+
- Useful for communicating progress steps during long-running operations
|
|
17
|
+
|
|
18
|
+
- **Logger**: New `reason()` method and symbol for working/thinking output
|
|
19
|
+
- `LOG_SYMBOLS.reason`: New symbol for reason output (distinct from info/step symbols)
|
|
20
|
+
- `reason(message)`: Display reason messages with dedicated symbol
|
|
21
|
+
- Complements existing info/step/success/error/warning methods
|
|
22
|
+
|
|
23
|
+
## [3.2.8](https://github.com/SocketDev/socket-lib/releases/tag/v3.2.8) - 2025-11-05
|
|
24
|
+
|
|
25
|
+
### Fixed
|
|
26
|
+
|
|
27
|
+
- **build**: Fix CommonJS export script edge cases
|
|
28
|
+
- Fixed stray semicolons after comment placeholders in transformed modules
|
|
29
|
+
- Fixed incorrect transformation of `module.exports.default` to `module.module.exports`
|
|
30
|
+
- Ensures external dependencies and default exports work correctly
|
|
9
31
|
|
|
10
32
|
## [3.2.7](https://github.com/SocketDev/socket-lib/releases/tag/v3.2.7) - 2025-11-05
|
|
11
33
|
|
package/README.md
CHANGED
|
@@ -2,21 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://socket.dev/npm/package/@socketsecurity/lib)
|
|
4
4
|
[](https://github.com/SocketDev/socket-lib/actions/workflows/ci.yml)
|
|
5
|
-

|
|
5
|
+

|
|
7
6
|
|
|
8
7
|
[](https://twitter.com/SocketSecurity)
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
Core library for Socket.dev tools.
|
|
11
10
|
|
|
12
|
-
##
|
|
11
|
+
## Install
|
|
13
12
|
|
|
14
13
|
```bash
|
|
15
14
|
pnpm add @socketsecurity/lib
|
|
16
15
|
```
|
|
17
16
|
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
18
19
|
```typescript
|
|
19
|
-
//
|
|
20
|
+
// Tree-shakeable exports
|
|
20
21
|
import { Spinner } from '@socketsecurity/lib/spinner'
|
|
21
22
|
import { readJsonFile } from '@socketsecurity/lib/fs'
|
|
22
23
|
import { NODE_MODULES } from '@socketsecurity/lib/constants/packages'
|
|
@@ -27,248 +28,25 @@ const pkg = await readJsonFile('./package.json')
|
|
|
27
28
|
spinner.stop()
|
|
28
29
|
```
|
|
29
30
|
|
|
30
|
-
##
|
|
31
|
-
|
|
32
|
-
```
|
|
33
|
-
@socketsecurity/lib
|
|
34
|
-
├── Visual Effects → 5 themes, spinners, shimmer, logger
|
|
35
|
-
├── File System → fs, paths, globs, temp files
|
|
36
|
-
├── Package Management → 11 utilities (npm, pnpm, yarn, dlx)
|
|
37
|
-
├── Process & Spawn → Safe process spawning, IPC
|
|
38
|
-
├── Environment → 22 modules with 68 typed env getters
|
|
39
|
-
├── Constants → 14 modules (Node.js, npm, platform)
|
|
40
|
-
├── Utilities → Arrays, objects, strings, promises
|
|
41
|
-
└── Types → Full TypeScript definitions
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
## 💡 Key Features
|
|
45
|
-
|
|
46
|
-
### Visual Effects
|
|
47
|
-
|
|
48
|
-
**Themed spinners and text effects:**
|
|
49
|
-
|
|
50
|
-
```typescript
|
|
51
|
-
import { Spinner, setTheme } from '@socketsecurity/lib'
|
|
52
|
-
|
|
53
|
-
setTheme('ultra') // 🌈 Rainbow shimmer!
|
|
54
|
-
const spinner = Spinner({ text: 'Processing...' })
|
|
55
|
-
spinner.start()
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
**5 Built-in Themes:** `socket` (violet) · `sunset` (twilight) · `terracotta` (warm) · `lush` (steel blue) · `ultra` (rainbow)
|
|
59
|
-
|
|
60
|
-
👉 [**Theme System Docs**](./docs/themes.md)
|
|
61
|
-
|
|
62
|
-
### File System
|
|
63
|
-
|
|
64
|
-
**Safe, typed file operations:**
|
|
65
|
-
|
|
66
|
-
```typescript
|
|
67
|
-
import { readJsonFile, writeJsonFile } from '@socketsecurity/lib/fs'
|
|
68
|
-
|
|
69
|
-
const pkg = await readJsonFile<PackageJson>('./package.json')
|
|
70
|
-
await writeJsonFile('./output.json', { data: pkg })
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
### Package Management
|
|
31
|
+
## What's Inside
|
|
74
32
|
|
|
75
|
-
**
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
### Environment Variables
|
|
85
|
-
|
|
86
|
-
**68 typed environment getters:**
|
|
87
|
-
|
|
88
|
-
```typescript
|
|
89
|
-
import { getCI } from '@socketsecurity/lib/env/ci'
|
|
90
|
-
import { getHome } from '@socketsecurity/lib/env/home'
|
|
91
|
-
import { getNodeEnv } from '@socketsecurity/lib/env/node-env'
|
|
92
|
-
|
|
93
|
-
if (getCI()) {
|
|
94
|
-
console.log('Running in CI')
|
|
95
|
-
}
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
### Constants
|
|
99
|
-
|
|
100
|
-
**Access platform and Node.js constants:**
|
|
101
|
-
|
|
102
|
-
```typescript
|
|
103
|
-
import {
|
|
104
|
-
NODE_MODULES,
|
|
105
|
-
PACKAGE_JSON,
|
|
106
|
-
NPM_REGISTRY_URL,
|
|
107
|
-
} from '@socketsecurity/lib/constants/packages'
|
|
108
|
-
|
|
109
|
-
import { DARWIN, WIN32 } from '@socketsecurity/lib/constants/platform'
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
## Common Patterns
|
|
113
|
-
|
|
114
|
-
### Spinner with Progress
|
|
115
|
-
|
|
116
|
-
```typescript
|
|
117
|
-
import { withSpinner, Spinner } from '@socketsecurity/lib/spinner'
|
|
118
|
-
|
|
119
|
-
await withSpinner({
|
|
120
|
-
message: 'Installing packages...',
|
|
121
|
-
spinner: Spinner({ color: [140, 82, 255] }),
|
|
122
|
-
operation: async () => {
|
|
123
|
-
await installPackages()
|
|
124
|
-
}
|
|
125
|
-
})
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
### Safe Process Spawning
|
|
129
|
-
|
|
130
|
-
```typescript
|
|
131
|
-
import { spawn } from '@socketsecurity/lib/spawn'
|
|
132
|
-
|
|
133
|
-
const result = await spawn('npm', ['install'], {
|
|
134
|
-
cwd: '/path/to/project',
|
|
135
|
-
timeout: 30000
|
|
136
|
-
})
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
### JSON File Operations
|
|
140
|
-
|
|
141
|
-
```typescript
|
|
142
|
-
import { readJsonFile, writeJsonFile } from '@socketsecurity/lib/fs'
|
|
143
|
-
|
|
144
|
-
const data = await readJsonFile('./config.json')
|
|
145
|
-
data.version = '2.0.0'
|
|
146
|
-
await writeJsonFile('./config.json', data)
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
### Promise Utilities
|
|
150
|
-
|
|
151
|
-
```typescript
|
|
152
|
-
import { timeout, retry } from '@socketsecurity/lib/promises'
|
|
153
|
-
|
|
154
|
-
// Timeout after 5 seconds
|
|
155
|
-
const result = await timeout(fetchData(), 5000)
|
|
156
|
-
|
|
157
|
-
// Retry up to 3 times
|
|
158
|
-
const data = await retry(() => fetchData(), { maxAttempts: 3 })
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
## Module Organization
|
|
162
|
-
|
|
163
|
-
**120+ granular exports** organized by category:
|
|
164
|
-
|
|
165
|
-
```
|
|
166
|
-
/constants/ → Node.js, npm, platform constants
|
|
167
|
-
├─ packages → PACKAGE_JSON, NODE_MODULES, etc.
|
|
168
|
-
├─ platform → DARWIN, WIN32, S_IXUSR, etc.
|
|
169
|
-
├─ node → NODE_VERSION, NODE_PATH, etc.
|
|
170
|
-
├─ time → MILLISECONDS_PER_*, DLX_BINARY_CACHE_TTL
|
|
171
|
-
└─ encoding → UTF8, CHAR_* codes
|
|
172
|
-
|
|
173
|
-
/env/ → 22 modules providing 68 typed getters
|
|
174
|
-
├─ ci → getCI() - Detect CI environment
|
|
175
|
-
├─ home → getHome() - User home directory
|
|
176
|
-
├─ node-env → getNodeEnv() - NODE_ENV value
|
|
177
|
-
└─ ... → And 19 more modules!
|
|
178
|
-
|
|
179
|
-
/packages/ → Package management utilities (11 modules)
|
|
180
|
-
├─ validation → Package name/version validation
|
|
181
|
-
├─ operations → Install, extract, manifest, dlx
|
|
182
|
-
├─ registry → npm registry utilities
|
|
183
|
-
└─ editable → Editable installs detection
|
|
184
|
-
|
|
185
|
-
/effects/ → Visual effects for CLI
|
|
186
|
-
├─ text-shimmer → Animated gradient text
|
|
187
|
-
├─ pulse-frames → Pulsing text effect
|
|
188
|
-
└─ ultra → Rainbow gradients
|
|
189
|
-
|
|
190
|
-
/stdio/ → Terminal I/O utilities
|
|
191
|
-
├─ stdout → Safe stdout operations
|
|
192
|
-
├─ stderr → Safe stderr operations
|
|
193
|
-
├─ clear → Clear terminal
|
|
194
|
-
└─ footer → Terminal footers
|
|
195
|
-
|
|
196
|
-
/themes/ → Theme system for consistent branding (5 modules)
|
|
197
|
-
├─ types → Theme type definitions
|
|
198
|
-
├─ themes → 5 themes (socket, sunset, terracotta, lush, ultra)
|
|
199
|
-
├─ context → Global theme management
|
|
200
|
-
└─ utils → Color resolution, theme creation
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
## Documentation
|
|
204
|
-
|
|
205
|
-
| Doc | Description |
|
|
206
|
-
|-----|-------------|
|
|
207
|
-
| [**Getting Started**](./docs/getting-started.md) | Quick start for contributors (5 min setup) |
|
|
208
|
-
| [**Theme System**](./docs/themes.md) | Themed spinners, colors, and effects |
|
|
209
|
-
| [**Build Architecture**](./docs/build.md) | Vendored dependencies, build system |
|
|
210
|
-
| [**CLAUDE.md**](./CLAUDE.md) | Coding standards and patterns |
|
|
211
|
-
|
|
212
|
-
## Architecture
|
|
213
|
-
|
|
214
|
-
```
|
|
215
|
-
┌─────────────────────────────────────────────────────┐
|
|
216
|
-
│ @socketsecurity/lib │
|
|
217
|
-
│ Zero runtime dependencies │
|
|
218
|
-
├─────────────────────────────────────────────────────┤
|
|
219
|
-
│ src/ │
|
|
220
|
-
│ ├── constants/ 14 modules │
|
|
221
|
-
│ ├── env/ 22 modules (68 getters) │
|
|
222
|
-
│ ├── packages/ 11 utilities │
|
|
223
|
-
│ ├── effects/ 4 visual effects │
|
|
224
|
-
│ ├── stdio/ 9 I/O utilities │
|
|
225
|
-
│ ├── themes/ 5 theme definitions │
|
|
226
|
-
│ ├── external/ 16 vendored deps │
|
|
227
|
-
│ └── ... 62+ more modules │
|
|
228
|
-
├─────────────────────────────────────────────────────┤
|
|
229
|
-
│ Build: esbuild → CommonJS (ES2022) │
|
|
230
|
-
│ Types: tsgo (TypeScript Native Preview) │
|
|
231
|
-
│ Tests: Vitest (4600+ tests, 100% coverage) │
|
|
232
|
-
└─────────────────────────────────────────────────────┘
|
|
233
|
-
```
|
|
33
|
+
- **Visual Effects** → Spinners, themes, logger
|
|
34
|
+
- **File System** → fs, paths, globs
|
|
35
|
+
- **Package Management** → npm, pnpm, yarn, dlx
|
|
36
|
+
- **Process & Spawn** → Safe process spawning
|
|
37
|
+
- **Environment** → 68 typed env getters
|
|
38
|
+
- **Constants** → Node.js, npm, platform
|
|
39
|
+
- **Utilities** → Arrays, objects, strings, promises
|
|
234
40
|
|
|
235
41
|
## Development
|
|
236
42
|
|
|
237
|
-
**New to the project?** See the [**Getting Started Guide**](./docs/getting-started.md) for setup, workflow, and contribution guidelines.
|
|
238
|
-
|
|
239
|
-
**Quick commands:**
|
|
240
43
|
```bash
|
|
241
|
-
pnpm install
|
|
242
|
-
pnpm
|
|
243
|
-
pnpm test
|
|
244
|
-
pnpm
|
|
44
|
+
pnpm install # Install
|
|
45
|
+
pnpm build # Build
|
|
46
|
+
pnpm test # Test
|
|
47
|
+
pnpm dev # Watch mode
|
|
245
48
|
```
|
|
246
49
|
|
|
247
|
-
## Stats
|
|
248
|
-
|
|
249
|
-
- **143** TypeScript modules
|
|
250
|
-
- **120+** granular exports
|
|
251
|
-
- **68** typed environment getters
|
|
252
|
-
- **22** environment modules
|
|
253
|
-
- **14** constant modules
|
|
254
|
-
- **5** theme definitions
|
|
255
|
-
- **4600+** tests passing
|
|
256
|
-
- **Zero** runtime dependencies
|
|
257
|
-
|
|
258
|
-
## Contributing
|
|
259
|
-
|
|
260
|
-
**Ready to contribute?** Start with the [Getting Started Guide](./docs/getting-started.md) for a quick setup walkthrough.
|
|
261
|
-
|
|
262
|
-
See [CLAUDE.md](./CLAUDE.md) for:
|
|
263
|
-
- Code style and patterns
|
|
264
|
-
- Path alias usage
|
|
265
|
-
- Testing guidelines
|
|
266
|
-
- Build system details
|
|
267
|
-
|
|
268
50
|
## License
|
|
269
51
|
|
|
270
52
|
MIT
|
|
271
|
-
|
|
272
|
-
---
|
|
273
|
-
|
|
274
|
-
**Built by Socket.dev** — [socket.dev](https://socket.dev) | [@SocketSecurity](https://twitter.com/SocketSecurity)
|
package/dist/agent.js
CHANGED
|
@@ -34,8 +34,8 @@ __export(agent_exports, {
|
|
|
34
34
|
isPnpmLoglevelFlag: () => isPnpmLoglevelFlag
|
|
35
35
|
});
|
|
36
36
|
module.exports = __toCommonJS(agent_exports);
|
|
37
|
-
var import_ci = require("
|
|
38
|
-
var import_platform = require("
|
|
37
|
+
var import_ci = require("#env/ci");
|
|
38
|
+
var import_platform = require("#constants/platform");
|
|
39
39
|
var import_bin = require("./bin");
|
|
40
40
|
var import_debug = require("./debug");
|
|
41
41
|
var import_fs = require("./fs");
|
|
@@ -87,7 +87,7 @@ function execNpm(args, options) {
|
|
|
87
87
|
// one level quieter.
|
|
88
88
|
useDebug || npmArgs.some(isNpmLoglevelFlag) ? [] : ["--loglevel", "warn"]
|
|
89
89
|
);
|
|
90
|
-
const npmBin = require("
|
|
90
|
+
const npmBin = require("#constants/agents").NPM_BIN_PATH;
|
|
91
91
|
return (0, import_spawn.spawn)(
|
|
92
92
|
npmBin,
|
|
93
93
|
[
|
|
@@ -231,11 +231,11 @@ function execScript(scriptName, args, options) {
|
|
|
231
231
|
if (spawnOptions.shell === true) {
|
|
232
232
|
return (0, import_spawn.spawn)(scriptName, resolvedArgs, spawnOptions);
|
|
233
233
|
}
|
|
234
|
-
const useNodeRun = !prepost && /* @__PURE__ */ require("
|
|
234
|
+
const useNodeRun = !prepost && /* @__PURE__ */ require("#constants/node").supportsNodeRun();
|
|
235
235
|
const cwd = (0, import_objects.getOwn)(spawnOptions, "cwd") ?? process.cwd();
|
|
236
236
|
const pnpmLockPath = (0, import_fs.findUpSync)(
|
|
237
237
|
/*@__INLINE__*/
|
|
238
|
-
require("
|
|
238
|
+
require("#constants/agents").PNPM_LOCK_YAML,
|
|
239
239
|
{ cwd }
|
|
240
240
|
);
|
|
241
241
|
if (pnpmLockPath) {
|
|
@@ -243,7 +243,7 @@ function execScript(scriptName, args, options) {
|
|
|
243
243
|
}
|
|
244
244
|
const packageLockPath = (0, import_fs.findUpSync)(
|
|
245
245
|
/*@__INLINE__*/
|
|
246
|
-
require("
|
|
246
|
+
require("#constants/agents").PACKAGE_LOCK_JSON,
|
|
247
247
|
{ cwd }
|
|
248
248
|
);
|
|
249
249
|
if (packageLockPath) {
|
|
@@ -251,18 +251,18 @@ function execScript(scriptName, args, options) {
|
|
|
251
251
|
}
|
|
252
252
|
const yarnLockPath = (0, import_fs.findUpSync)(
|
|
253
253
|
/*@__INLINE__*/
|
|
254
|
-
require("
|
|
254
|
+
require("#constants/agents").YARN_LOCK,
|
|
255
255
|
{ cwd }
|
|
256
256
|
);
|
|
257
257
|
if (yarnLockPath) {
|
|
258
258
|
return /* @__PURE__ */ execYarn(["run", scriptName, ...resolvedArgs], spawnOptions);
|
|
259
259
|
}
|
|
260
260
|
return (0, import_spawn.spawn)(
|
|
261
|
-
/* @__PURE__ */ require("
|
|
261
|
+
/* @__PURE__ */ require("#constants/node").getExecPath(),
|
|
262
262
|
[
|
|
263
|
-
.../* @__PURE__ */ require("
|
|
263
|
+
.../* @__PURE__ */ require("#constants/node").getNodeNoWarningsFlags(),
|
|
264
264
|
...useNodeRun ? ["--run"] : [
|
|
265
|
-
require("
|
|
265
|
+
require("#constants/agents").NPM_REAL_EXEC_PATH,
|
|
266
266
|
"run"
|
|
267
267
|
],
|
|
268
268
|
scriptName,
|
package/dist/bin.js
CHANGED
|
@@ -32,10 +32,10 @@ __export(bin_exports, {
|
|
|
32
32
|
whichSync: () => whichSync
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(bin_exports);
|
|
35
|
-
var import_home = require("
|
|
36
|
-
var import_windows = require("
|
|
37
|
-
var import_xdg = require("
|
|
38
|
-
var import_platform = require("
|
|
35
|
+
var import_home = require("#env/home");
|
|
36
|
+
var import_windows = require("#env/windows");
|
|
37
|
+
var import_xdg = require("#env/xdg");
|
|
38
|
+
var import_platform = require("#constants/platform");
|
|
39
39
|
var import_fs = require("./fs");
|
|
40
40
|
var import_path = require("./path");
|
|
41
41
|
var import_spawn = require("./spawn");
|
package/dist/colors.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Color utilities for RGB color conversion and manipulation.
|
|
3
|
+
* Provides type-safe color handling with named colors and RGB tuples.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Named color values supported by the library.
|
|
7
|
+
* Maps to standard terminal colors with bright variants.
|
|
8
|
+
*/
|
|
9
|
+
export type ColorName = 'black' | 'blue' | 'blueBright' | 'cyan' | 'cyanBright' | 'gray' | 'green' | 'greenBright' | 'magenta' | 'magentaBright' | 'red' | 'redBright' | 'white' | 'whiteBright' | 'yellow' | 'yellowBright';
|
|
10
|
+
/**
|
|
11
|
+
* Special 'inherit' color value that uses the current color context.
|
|
12
|
+
* Used with effects like shimmer to dynamically inherit color.
|
|
13
|
+
*/
|
|
14
|
+
export type ColorInherit = 'inherit';
|
|
15
|
+
/**
|
|
16
|
+
* RGB color tuple with values 0-255 for red, green, and blue channels.
|
|
17
|
+
* @example [140, 82, 255] // Socket purple
|
|
18
|
+
* @example [255, 0, 0] // Red
|
|
19
|
+
*/
|
|
20
|
+
export type ColorRgb = readonly [number, number, number];
|
|
21
|
+
/**
|
|
22
|
+
* Union of all supported color types: named colors or RGB tuples.
|
|
23
|
+
*/
|
|
24
|
+
export type ColorValue = ColorName | ColorRgb;
|
|
25
|
+
/**
|
|
26
|
+
* Type guard to check if a color value is an RGB tuple.
|
|
27
|
+
* @param value - Color value to check
|
|
28
|
+
* @returns `true` if value is an RGB tuple, `false` if it's a color name
|
|
29
|
+
*/
|
|
30
|
+
export declare function isRgbTuple(value: ColorValue): value is ColorRgb;
|
|
31
|
+
/**
|
|
32
|
+
* Convert a color value to RGB tuple format.
|
|
33
|
+
* Named colors are looked up in the `colorToRgb` map, RGB tuples are returned as-is.
|
|
34
|
+
* @param color - Color name or RGB tuple
|
|
35
|
+
* @returns RGB tuple with values 0-255
|
|
36
|
+
*/
|
|
37
|
+
export declare function toRgb(color: ColorValue): ColorRgb;
|
package/dist/colors.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* Socket Lib - Built with esbuild */
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var colors_exports = {};
|
|
21
|
+
__export(colors_exports, {
|
|
22
|
+
isRgbTuple: () => isRgbTuple,
|
|
23
|
+
toRgb: () => toRgb
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(colors_exports);
|
|
26
|
+
const colorToRgb = {
|
|
27
|
+
__proto__: null,
|
|
28
|
+
black: [0, 0, 0],
|
|
29
|
+
blue: [0, 0, 255],
|
|
30
|
+
blueBright: [100, 149, 237],
|
|
31
|
+
cyan: [0, 255, 255],
|
|
32
|
+
cyanBright: [0, 255, 255],
|
|
33
|
+
gray: [128, 128, 128],
|
|
34
|
+
green: [0, 128, 0],
|
|
35
|
+
greenBright: [0, 255, 0],
|
|
36
|
+
magenta: [255, 0, 255],
|
|
37
|
+
magentaBright: [255, 105, 180],
|
|
38
|
+
red: [255, 0, 0],
|
|
39
|
+
redBright: [255, 69, 0],
|
|
40
|
+
white: [255, 255, 255],
|
|
41
|
+
whiteBright: [255, 255, 255],
|
|
42
|
+
yellow: [255, 255, 0],
|
|
43
|
+
yellowBright: [255, 255, 153]
|
|
44
|
+
};
|
|
45
|
+
function isRgbTuple(value) {
|
|
46
|
+
return Array.isArray(value);
|
|
47
|
+
}
|
|
48
|
+
function toRgb(color) {
|
|
49
|
+
if (isRgbTuple(color)) {
|
|
50
|
+
return color;
|
|
51
|
+
}
|
|
52
|
+
return colorToRgb[color];
|
|
53
|
+
}
|
|
54
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
55
|
+
0 && (module.exports = {
|
|
56
|
+
isRgbTuple,
|
|
57
|
+
toRgb
|
|
58
|
+
});
|
package/dist/constants/node.js
CHANGED
|
@@ -49,7 +49,7 @@ function getNodeMajorVersion() {
|
|
|
49
49
|
let _maintainedNodeVersions;
|
|
50
50
|
function getMaintainedNodeVersions() {
|
|
51
51
|
if (_maintainedNodeVersions === void 0) {
|
|
52
|
-
_maintainedNodeVersions = require("
|
|
52
|
+
_maintainedNodeVersions = require("#lib/maintained-node-versions").default;
|
|
53
53
|
}
|
|
54
54
|
return _maintainedNodeVersions;
|
|
55
55
|
}
|
|
@@ -32,7 +32,7 @@ __export(packages_exports, {
|
|
|
32
32
|
getPacoteCachePath: () => getPacoteCachePath
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(packages_exports);
|
|
35
|
-
var import_npm = require("
|
|
35
|
+
var import_npm = require("#env/npm");
|
|
36
36
|
let _lifecycleScriptNames;
|
|
37
37
|
let _packageDefaultNodeRange;
|
|
38
38
|
let _packageDefaultSocketCategories;
|
|
@@ -45,19 +45,19 @@ const LATEST = "latest";
|
|
|
45
45
|
const PACKAGE_DEFAULT_VERSION = "1.0.0";
|
|
46
46
|
function getPackageDefaultNodeRange() {
|
|
47
47
|
if (_packageDefaultNodeRange === void 0) {
|
|
48
|
-
_packageDefaultNodeRange = require("
|
|
48
|
+
_packageDefaultNodeRange = require("#lib/package-default-node-range").default;
|
|
49
49
|
}
|
|
50
50
|
return _packageDefaultNodeRange;
|
|
51
51
|
}
|
|
52
52
|
function getPackageDefaultSocketCategories() {
|
|
53
53
|
if (_packageDefaultSocketCategories === void 0) {
|
|
54
|
-
_packageDefaultSocketCategories = require("
|
|
54
|
+
_packageDefaultSocketCategories = require("#lib/package-default-socket-categories").default;
|
|
55
55
|
}
|
|
56
56
|
return _packageDefaultSocketCategories;
|
|
57
57
|
}
|
|
58
58
|
function getPackageExtensions() {
|
|
59
59
|
if (_packageExtensions === void 0) {
|
|
60
|
-
const exts = require("
|
|
60
|
+
const exts = require("#lib/package-extensions").default;
|
|
61
61
|
_packageExtensions = Object.entries(exts);
|
|
62
62
|
}
|
|
63
63
|
return _packageExtensions;
|
|
@@ -67,7 +67,7 @@ function getNpmLifecycleEvent() {
|
|
|
67
67
|
}
|
|
68
68
|
function getLifecycleScriptNames() {
|
|
69
69
|
if (_lifecycleScriptNames === void 0) {
|
|
70
|
-
const scriptNamesSet = require("
|
|
70
|
+
const scriptNamesSet = require("#lib/lifecycle-script-names").default;
|
|
71
71
|
_lifecycleScriptNames = Array.from(scriptNamesSet);
|
|
72
72
|
}
|
|
73
73
|
return _lifecycleScriptNames;
|
|
@@ -81,8 +81,8 @@ function getPackumentCache() {
|
|
|
81
81
|
function getPacoteCachePath() {
|
|
82
82
|
if (_pacoteCachePath === void 0) {
|
|
83
83
|
try {
|
|
84
|
-
const pacote = require(
|
|
85
|
-
const { normalizePath } = require("
|
|
84
|
+
const pacote = require("../external/pacote");
|
|
85
|
+
const { normalizePath } = require("#lib/path");
|
|
86
86
|
const proto = Reflect.getPrototypeOf(
|
|
87
87
|
pacote.RegistryFetcher.prototype
|
|
88
88
|
);
|
|
@@ -37,7 +37,7 @@ function getAbortSignal() {
|
|
|
37
37
|
let _spinner;
|
|
38
38
|
function getSpinner() {
|
|
39
39
|
if (_spinner === void 0) {
|
|
40
|
-
const { Spinner: SpinnerFn } = require("
|
|
40
|
+
const { Spinner: SpinnerFn } = require("#lib/spinner");
|
|
41
41
|
_spinner = SpinnerFn() ?? null;
|
|
42
42
|
}
|
|
43
43
|
return _spinner ?? null;
|
package/dist/debug.js
CHANGED
|
@@ -43,9 +43,9 @@ __export(debug_exports, {
|
|
|
43
43
|
isDebugNs: () => isDebugNs
|
|
44
44
|
});
|
|
45
45
|
module.exports = __toCommonJS(debug_exports);
|
|
46
|
-
var import_process = require("
|
|
47
|
-
var import_debug = require("
|
|
48
|
-
var import_socket = require("
|
|
46
|
+
var import_process = require("#constants/process");
|
|
47
|
+
var import_debug = require("#env/debug");
|
|
48
|
+
var import_socket = require("#env/socket");
|
|
49
49
|
var import_is_unicode_supported = __toESM(require("./external/@socketregistry/is-unicode-supported"));
|
|
50
50
|
var import_debug2 = __toESM(require("./external/debug"));
|
|
51
51
|
var import_logger = require("./logger");
|
package/dist/dlx-binary.js
CHANGED
|
@@ -40,7 +40,7 @@ module.exports = __toCommonJS(dlx_binary_exports);
|
|
|
40
40
|
var import_crypto = require("crypto");
|
|
41
41
|
var import_os = __toESM(require("os"));
|
|
42
42
|
var import_path = __toESM(require("path"));
|
|
43
|
-
var import_platform = require("
|
|
43
|
+
var import_platform = require("#constants/platform");
|
|
44
44
|
var import_dlx = require("./dlx");
|
|
45
45
|
var import_dlx_manifest = require("./dlx-manifest");
|
|
46
46
|
var import_http_request = require("./http-request");
|
|
@@ -167,7 +167,7 @@ async function writeMetadata(cacheEntryPath, cacheKey, url, binaryName, checksum
|
|
|
167
167
|
}
|
|
168
168
|
async function cleanDlxCache(maxAge = (
|
|
169
169
|
/*@__INLINE__*/
|
|
170
|
-
require("
|
|
170
|
+
require("#constants/time").DLX_BINARY_CACHE_TTL
|
|
171
171
|
)) {
|
|
172
172
|
const cacheDir = getDlxCachePath();
|
|
173
173
|
const fs = /* @__PURE__ */ getFs();
|
|
@@ -211,7 +211,7 @@ async function dlxBinary(args, options, spawnExtra) {
|
|
|
211
211
|
const {
|
|
212
212
|
cacheTtl = (
|
|
213
213
|
/*@__INLINE__*/
|
|
214
|
-
require("
|
|
214
|
+
require("#constants/time").DLX_BINARY_CACHE_TTL
|
|
215
215
|
),
|
|
216
216
|
checksum,
|
|
217
217
|
force: userForce = false,
|
|
@@ -300,7 +300,7 @@ async function downloadBinary(options) {
|
|
|
300
300
|
const {
|
|
301
301
|
cacheTtl = (
|
|
302
302
|
/*@__INLINE__*/
|
|
303
|
-
require("
|
|
303
|
+
require("#constants/time").DLX_BINARY_CACHE_TTL
|
|
304
304
|
),
|
|
305
305
|
checksum,
|
|
306
306
|
force = false,
|
|
@@ -30,7 +30,7 @@ __export(text_shimmer_exports, {
|
|
|
30
30
|
module.exports = __toCommonJS(text_shimmer_exports);
|
|
31
31
|
var import_ansi = require("../ansi");
|
|
32
32
|
var import_arrays = require("../arrays");
|
|
33
|
-
var import_ci = require("
|
|
33
|
+
var import_ci = require("#env/ci");
|
|
34
34
|
var import_utils = require("../themes/utils");
|
|
35
35
|
var import_themes = require("../themes/themes");
|
|
36
36
|
function detectStyles(text) {
|
package/dist/env/ci.js
CHANGED
|
@@ -22,8 +22,8 @@ __export(ci_exports, {
|
|
|
22
22
|
getCI: () => getCI
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(ci_exports);
|
|
25
|
-
var import_helpers = require("
|
|
26
|
-
var import_rewire = require("
|
|
25
|
+
var import_helpers = require("#env/helpers");
|
|
26
|
+
var import_rewire = require("#env/rewire");
|
|
27
27
|
function getCI() {
|
|
28
28
|
return (0, import_helpers.envAsBoolean)((0, import_rewire.getEnvValue)("CI"));
|
|
29
29
|
}
|
package/dist/env/debug.js
CHANGED
|
@@ -22,7 +22,7 @@ __export(debug_exports, {
|
|
|
22
22
|
getDebug: () => getDebug
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(debug_exports);
|
|
25
|
-
var import_rewire = require("
|
|
25
|
+
var import_rewire = require("#env/rewire");
|
|
26
26
|
function getDebug() {
|
|
27
27
|
return (0, import_rewire.getEnvValue)("DEBUG");
|
|
28
28
|
}
|
package/dist/env/github.js
CHANGED
|
@@ -29,7 +29,7 @@ __export(github_exports, {
|
|
|
29
29
|
getGithubToken: () => getGithubToken
|
|
30
30
|
});
|
|
31
31
|
module.exports = __toCommonJS(github_exports);
|
|
32
|
-
var import_rewire = require("
|
|
32
|
+
var import_rewire = require("#env/rewire");
|
|
33
33
|
function getGithubApiUrl() {
|
|
34
34
|
return (0, import_rewire.getEnvValue)("GITHUB_API_URL");
|
|
35
35
|
}
|
package/dist/env/home.js
CHANGED
|
@@ -22,7 +22,7 @@ __export(home_exports, {
|
|
|
22
22
|
getHome: () => getHome
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(home_exports);
|
|
25
|
-
var import_rewire = require("
|
|
25
|
+
var import_rewire = require("#env/rewire");
|
|
26
26
|
function getHome() {
|
|
27
27
|
return (0, import_rewire.getEnvValue)("HOME");
|
|
28
28
|
}
|