@socketsecurity/lib 2.10.4 → 3.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 +50 -24
- package/README.md +231 -40
- package/dist/constants/platform.js +1 -1
- package/dist/constants/platform.js.map +3 -3
- package/dist/cover/code.js +1 -1
- package/dist/cover/code.js.map +3 -3
- package/dist/debug.js +2 -2
- package/dist/debug.js.map +3 -3
- package/dist/dlx-binary.d.ts +29 -6
- package/dist/dlx-binary.js +6 -6
- package/dist/dlx-binary.js.map +3 -3
- package/dist/dlx-package.d.ts +16 -1
- package/dist/dlx-package.js +6 -6
- package/dist/dlx-package.js.map +3 -3
- package/dist/dlx.js +1 -1
- package/dist/dlx.js.map +3 -3
- package/dist/env/rewire.js +1 -1
- package/dist/env/rewire.js.map +3 -3
- package/dist/external/yoctocolors-cjs.d.ts +14 -0
- package/dist/fs.d.ts +2 -2
- package/dist/fs.js.map +1 -1
- package/dist/git.js +1 -1
- package/dist/git.js.map +3 -3
- package/dist/http-request.js +1 -1
- package/dist/http-request.js.map +3 -3
- package/dist/index.d.ts +6 -5
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/dist/ipc.js +1 -1
- package/dist/ipc.js.map +3 -3
- package/dist/links/index.d.ts +65 -0
- package/dist/links/index.js +3 -0
- package/dist/links/index.js.map +7 -0
- package/dist/logger.d.ts +21 -18
- package/dist/logger.js +1 -1
- package/dist/logger.js.map +3 -3
- package/dist/packages/isolation.js +1 -1
- package/dist/packages/isolation.js.map +3 -3
- package/dist/paths.js +1 -1
- package/dist/paths.js.map +2 -2
- package/dist/process-lock.js +2 -2
- package/dist/process-lock.js.map +3 -3
- package/dist/promises.d.ts +6 -21
- package/dist/promises.js +1 -1
- package/dist/promises.js.map +2 -2
- package/dist/prompts/index.d.ts +115 -0
- package/dist/prompts/index.js +3 -0
- package/dist/prompts/index.js.map +7 -0
- package/dist/spinner.d.ts +33 -23
- package/dist/spinner.js +1 -1
- package/dist/spinner.js.map +3 -3
- package/dist/stdio/mask.d.ts +2 -2
- package/dist/stdio/mask.js +4 -4
- package/dist/stdio/mask.js.map +3 -3
- package/dist/stdio/stdout.js +1 -1
- package/dist/stdio/stdout.js.map +3 -3
- package/dist/themes/context.d.ts +80 -0
- package/dist/themes/context.js +3 -0
- package/dist/themes/context.js.map +7 -0
- package/dist/themes/index.d.ts +53 -0
- package/dist/themes/index.js +3 -0
- package/dist/themes/index.js.map +7 -0
- package/dist/themes/themes.d.ts +49 -0
- package/dist/themes/themes.js +3 -0
- package/dist/themes/themes.js.map +7 -0
- package/dist/themes/types.d.ts +92 -0
- package/dist/themes/types.js +3 -0
- package/dist/themes/types.js.map +7 -0
- package/dist/themes/utils.d.ts +78 -0
- package/dist/themes/utils.js +3 -0
- package/dist/themes/utils.js.map +7 -0
- package/package.json +39 -11
- package/dist/download-lock.d.ts +0 -49
- package/dist/download-lock.js +0 -10
- package/dist/download-lock.js.map +0 -7
- package/dist/packages/registry.d.ts +0 -8
- package/dist/packages/registry.js +0 -3
- package/dist/packages/registry.js.map +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -5,38 +5,64 @@ 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.0.1](https://github.com/SocketDev/socket-lib/releases/tag/v3.0.1) - 2025-11-01
|
|
9
9
|
|
|
10
10
|
### Added
|
|
11
11
|
|
|
12
|
-
- **
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
12
|
+
- **Convenience exports from main index**: Added logger and spinner exports to ease v2→v3 migration
|
|
13
|
+
- Logger: `getDefaultLogger()`, `Logger`, `LOG_SYMBOLS` now available from `@socketsecurity/lib`
|
|
14
|
+
- Spinner: `getDefaultSpinner()`, `Spinner` now available from `@socketsecurity/lib`
|
|
15
|
+
- Both main index (`@socketsecurity/lib`) and subpath (`@socketsecurity/lib/logger`, `@socketsecurity/lib/spinner`) imports now work
|
|
16
|
+
- Both import paths return the same singleton instances
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- **Critical: Spinner crashes when calling logger**: Fixed spinner internal calls to use `getDefaultLogger()` instead of removed `logger` export
|
|
21
|
+
- Spinner methods (`start()`, `stop()`, `success()`, `fail()`, etc.) no longer crash with "logger is not defined" errors
|
|
22
|
+
- All 5 internal logger access points updated to use the correct v3 API
|
|
23
|
+
- Resolves runtime errors when using spinners with hoisted variables
|
|
17
24
|
|
|
18
25
|
### Changed
|
|
19
26
|
|
|
20
|
-
- **
|
|
21
|
-
- Prevents Webpack bundling errors with Node.js built-in modules
|
|
22
|
-
- Lazy initialization of `fs` module only when needed
|
|
23
|
-
- Maintains consistent pattern across entire DLX subsystem
|
|
24
|
-
- **Consistent bare imports for Node.js built-ins**: Replaced all `'node:'` prefixed imports with bare imports (e.g., `'node:fs'` → `'fs'`) across 17 source files
|
|
25
|
-
- Better compatibility with legacy bundlers and build tools
|
|
26
|
-
- Maintains functionality while improving tooling support
|
|
27
|
-
- **All directory creation now uses safe utilities**: Updated all `fs.promises.mkdir()` and `fs.mkdirSync()` calls to use `safeMkdir()` and `safeMkdirSync()` throughout DLX modules
|
|
28
|
-
- Eliminates manual `EEXIST` error handling code duplication
|
|
29
|
-
- Cleaner, more maintainable codebase
|
|
27
|
+
- **Migration path improvement**: Users can now import logger/spinner from either main index or subpaths, reducing breaking change impact from v3.0.0
|
|
30
28
|
|
|
31
|
-
|
|
29
|
+
## [3.0.0](https://github.com/SocketDev/socket-lib/releases/tag/v3.0.0) - 2025-11-01
|
|
30
|
+
|
|
31
|
+
### Added
|
|
32
|
+
|
|
33
|
+
- Theme system with 5 built-in themes: `socket`, `sunset`, `brick`, `lush`, `ultra`
|
|
34
|
+
- `setTheme()`, `getTheme()`, `withTheme()`, `withThemeSync()` for theme management
|
|
35
|
+
- `createTheme()`, `extendTheme()`, `resolveColor()` helper functions
|
|
36
|
+
- `onThemeChange()` event listener for theme reactivity
|
|
37
|
+
- `link()` function for themed terminal hyperlinks in `@socketsecurity/lib/links`
|
|
38
|
+
- Logger and spinner now inherit theme colors automatically
|
|
39
|
+
- Spinner methods: `enableShimmer()`, `disableShimmer()`, `setShimmer()`, `updateShimmer()`
|
|
40
|
+
- DLX cross-platform binary resolution (`.cmd`, `.bat`, `.ps1` on Windows)
|
|
41
|
+
- DLX programmatic options aligned with CLI conventions (`force`, `quiet`, `package`)
|
|
42
|
+
|
|
43
|
+
### Changed
|
|
44
|
+
|
|
45
|
+
- Theme context uses AsyncLocalStorage instead of manual stack management
|
|
46
|
+
- Promise retry options renamed: `factor` → `backoffFactor`, `minTimeout` → `baseDelayMs`, `maxTimeout` → `maxDelayMs`
|
|
47
|
+
|
|
48
|
+
### Removed
|
|
32
49
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
50
|
+
**BREAKING CHANGES:**
|
|
51
|
+
|
|
52
|
+
- `pushTheme()` and `popTheme()` - use `withTheme()` or `withThemeSync()` instead
|
|
53
|
+
- `logger` export - use `getDefaultLogger()` instead
|
|
54
|
+
- `spinner` export - use `getDefaultSpinner()` instead
|
|
55
|
+
- `download-lock.ts` - use `process-lock.ts` instead
|
|
56
|
+
- Promise option aliases: `factor`, `minTimeout`, `maxTimeout`
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
# Changelog
|
|
61
|
+
|
|
62
|
+
All notable changes to this project will be documented in this file.
|
|
63
|
+
|
|
64
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
65
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
40
66
|
|
|
41
67
|
## [2.10.3](https://github.com/SocketDev/socket-lib/releases/tag/v2.10.3) - 2025-10-31
|
|
42
68
|
|
package/README.md
CHANGED
|
@@ -1,87 +1,278 @@
|
|
|
1
1
|
# @socketsecurity/lib
|
|
2
2
|
|
|
3
3
|
[](https://socket.dev/npm/package/@socketsecurity/lib)
|
|
4
|
-
[](https://github.com/SocketDev/socket-lib/actions/workflows/ci.yml)
|
|
6
5
|
[](https://twitter.com/SocketSecurity)
|
|
7
|
-
[](https://bsky.app/profile/socket.dev)
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
**Core infrastructure library for Socket.dev security tools** — utilities, constants, and helpers with zero dependencies.
|
|
10
8
|
|
|
11
|
-
##
|
|
9
|
+
## Quick Start
|
|
12
10
|
|
|
13
11
|
```bash
|
|
14
|
-
pnpm
|
|
12
|
+
pnpm add @socketsecurity/lib
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
// Import what you need - tree-shakeable exports
|
|
17
|
+
import { Spinner } from '@socketsecurity/lib/spinner'
|
|
18
|
+
import { readJsonFile } from '@socketsecurity/lib/fs'
|
|
19
|
+
import { NODE_MODULES } from '@socketsecurity/lib/constants/packages'
|
|
20
|
+
|
|
21
|
+
const spinner = Spinner({ text: 'Loading...' })
|
|
22
|
+
spinner.start()
|
|
23
|
+
const pkg = await readJsonFile('./package.json')
|
|
24
|
+
spinner.stop()
|
|
15
25
|
```
|
|
16
26
|
|
|
17
|
-
##
|
|
27
|
+
## 📦 What's Inside
|
|
18
28
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
29
|
+
```
|
|
30
|
+
@socketsecurity/lib
|
|
31
|
+
├── Visual Effects → Spinners, shimmer, themes, logger
|
|
32
|
+
├── File System → fs, paths, globs, temp files
|
|
33
|
+
├── Package Management → npm, pnpm, yarn utilities
|
|
34
|
+
├── Process & Spawn → Safe process spawning, IPC
|
|
35
|
+
├── Environment → 68 typed env getters (CI, paths, etc)
|
|
36
|
+
├── Constants → Node.js, npm, platform constants
|
|
37
|
+
├── Utilities → Arrays, objects, strings, promises
|
|
38
|
+
└── Types → Full TypeScript definitions
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## 💡 Key Features
|
|
24
42
|
|
|
25
|
-
|
|
43
|
+
### Visual Effects
|
|
44
|
+
|
|
45
|
+
**Themed spinners and text effects:**
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
import { Spinner, setTheme } from '@socketsecurity/lib'
|
|
49
|
+
|
|
50
|
+
setTheme('ultra') // 🌈 Rainbow mode!
|
|
51
|
+
const spinner = Spinner({ text: 'Processing...' })
|
|
52
|
+
spinner.enableShimmer()
|
|
53
|
+
spinner.start()
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**5 Built-in Themes:** `socket` (purple) · `coana` · `socket-firewall` · `socket-cli-python` · `ultra` (rainbow)
|
|
57
|
+
|
|
58
|
+
👉 [**Theme System Docs**](./docs/themes.md)
|
|
59
|
+
|
|
60
|
+
### File System
|
|
61
|
+
|
|
62
|
+
**Safe, typed file operations:**
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
import { readJsonFile, writeJsonFile } from '@socketsecurity/lib/fs'
|
|
66
|
+
|
|
67
|
+
const pkg = await readJsonFile<PackageJson>('./package.json')
|
|
68
|
+
await writeJsonFile('./output.json', { data: pkg })
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Package Management
|
|
72
|
+
|
|
73
|
+
**Parse and validate package specs:**
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
import { parsePackageSpec } from '@socketsecurity/lib/packages'
|
|
77
|
+
|
|
78
|
+
const spec = parsePackageSpec('lodash@^4.17.0')
|
|
79
|
+
// { name: 'lodash', version: '^4.17.0', type: 'range', ... }
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Environment Variables
|
|
83
|
+
|
|
84
|
+
**68 typed environment getters:**
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
import { getCI } from '@socketsecurity/lib/env/ci'
|
|
88
|
+
import { getHome } from '@socketsecurity/lib/env/home'
|
|
89
|
+
import { getNodeEnv } from '@socketsecurity/lib/env/node-env'
|
|
90
|
+
|
|
91
|
+
if (getCI()) {
|
|
92
|
+
console.log('Running in CI')
|
|
93
|
+
}
|
|
94
|
+
```
|
|
26
95
|
|
|
27
96
|
### Constants
|
|
28
97
|
|
|
29
|
-
|
|
98
|
+
**Access platform and Node.js constants:**
|
|
30
99
|
|
|
31
100
|
```typescript
|
|
32
101
|
import {
|
|
33
102
|
NODE_MODULES,
|
|
34
103
|
PACKAGE_JSON,
|
|
35
|
-
PNPM_LOCK_YAML,
|
|
36
104
|
NPM_REGISTRY_URL,
|
|
37
105
|
} from '@socketsecurity/lib/constants/packages'
|
|
106
|
+
|
|
107
|
+
import { DARWIN, WIN32 } from '@socketsecurity/lib/constants/platform'
|
|
38
108
|
```
|
|
39
109
|
|
|
40
|
-
|
|
110
|
+
## Common Patterns
|
|
41
111
|
|
|
42
|
-
|
|
112
|
+
### Spinner with Progress
|
|
43
113
|
|
|
44
114
|
```typescript
|
|
45
|
-
import {
|
|
46
|
-
import { NODE_ENV } from '@socketsecurity/lib/env/node-env'
|
|
115
|
+
import { withSpinner, Spinner } from '@socketsecurity/lib/spinner'
|
|
47
116
|
|
|
48
|
-
|
|
49
|
-
|
|
117
|
+
await withSpinner({
|
|
118
|
+
message: 'Installing packages...',
|
|
119
|
+
spinner: Spinner({ color: [140, 82, 255] }),
|
|
120
|
+
operation: async () => {
|
|
121
|
+
await installPackages()
|
|
122
|
+
}
|
|
123
|
+
})
|
|
50
124
|
```
|
|
51
125
|
|
|
52
|
-
|
|
126
|
+
### Safe Process Spawning
|
|
53
127
|
|
|
54
|
-
|
|
128
|
+
```typescript
|
|
129
|
+
import { spawn } from '@socketsecurity/lib/spawn'
|
|
55
130
|
|
|
56
|
-
|
|
131
|
+
const result = await spawn('npm', ['install'], {
|
|
132
|
+
cwd: '/path/to/project',
|
|
133
|
+
timeout: 30000
|
|
134
|
+
})
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### JSON File Operations
|
|
57
138
|
|
|
58
139
|
```typescript
|
|
59
|
-
import
|
|
60
|
-
PackageJson,
|
|
61
|
-
TsConfig,
|
|
62
|
-
LockFile,
|
|
63
|
-
} from '@socketsecurity/lib/types'
|
|
64
|
-
```
|
|
140
|
+
import { readJsonFile, writeJsonFile } from '@socketsecurity/lib/fs'
|
|
65
141
|
|
|
66
|
-
|
|
142
|
+
const data = await readJsonFile('./config.json')
|
|
143
|
+
data.version = '2.0.0'
|
|
144
|
+
await writeJsonFile('./config.json', data)
|
|
145
|
+
```
|
|
67
146
|
|
|
68
|
-
|
|
147
|
+
### Promise Utilities
|
|
69
148
|
|
|
70
149
|
```typescript
|
|
71
|
-
|
|
72
|
-
import { readJsonFile, writeJsonFile } from '@socketsecurity/lib/fs'
|
|
150
|
+
import { timeout, retry } from '@socketsecurity/lib/promises'
|
|
73
151
|
|
|
74
|
-
//
|
|
75
|
-
|
|
152
|
+
// Timeout after 5 seconds
|
|
153
|
+
const result = await timeout(fetchData(), 5000)
|
|
154
|
+
|
|
155
|
+
// Retry up to 3 times
|
|
156
|
+
const data = await retry(() => fetchData(), { maxAttempts: 3 })
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Module Organization
|
|
160
|
+
|
|
161
|
+
**120+ granular exports** organized by category:
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
/constants/ → Node.js, npm, platform constants
|
|
165
|
+
├─ packages → PACKAGE_JSON, NODE_MODULES, etc.
|
|
166
|
+
├─ platform → DARWIN, WIN32, S_IXUSR, etc.
|
|
167
|
+
├─ node → NODE_VERSION, NODE_PATH, etc.
|
|
168
|
+
├─ time → MILLISECONDS_PER_*, DLX_BINARY_CACHE_TTL
|
|
169
|
+
└─ encoding → UTF8, CHAR_* codes
|
|
170
|
+
|
|
171
|
+
/env/ → 68 typed environment getters
|
|
172
|
+
├─ ci → getCI() - Detect CI environment
|
|
173
|
+
├─ home → getHome() - User home directory
|
|
174
|
+
├─ node-env → getNodeEnv() - NODE_ENV value
|
|
175
|
+
└─ ... → And 65 more!
|
|
176
|
+
|
|
177
|
+
/packages/ → Package management utilities
|
|
178
|
+
├─ validation → Package name/version validation
|
|
179
|
+
├─ operations → Install, extract, manifest
|
|
180
|
+
├─ registry → npm registry utilities
|
|
181
|
+
└─ editable → Editable installs detection
|
|
182
|
+
|
|
183
|
+
/effects/ → Visual effects for CLI
|
|
184
|
+
├─ text-shimmer → Animated gradient text
|
|
185
|
+
├─ pulse-frames → Pulsing text effect
|
|
186
|
+
└─ ultra → Rainbow gradients
|
|
76
187
|
|
|
77
|
-
|
|
78
|
-
|
|
188
|
+
/stdio/ → Terminal I/O utilities
|
|
189
|
+
├─ stdout → Safe stdout operations
|
|
190
|
+
├─ stderr → Safe stderr operations
|
|
191
|
+
├─ clear → Clear terminal
|
|
192
|
+
└─ footer → Terminal footers
|
|
79
193
|
|
|
80
|
-
|
|
194
|
+
/themes/ → Theme system for consistent branding
|
|
195
|
+
├─ types → Theme type definitions
|
|
196
|
+
├─ themes → 5 built-in themes
|
|
197
|
+
├─ context → Global theme management
|
|
198
|
+
└─ utils → Color resolution, theme creation
|
|
81
199
|
```
|
|
82
200
|
|
|
83
|
-
|
|
201
|
+
## Documentation
|
|
202
|
+
|
|
203
|
+
| Doc | Description |
|
|
204
|
+
|-----|-------------|
|
|
205
|
+
| [**Getting Started**](./docs/getting-started.md) | Development workflow, commands, architecture |
|
|
206
|
+
| [**Theme System**](./docs/themes.md) | Themed spinners, colors, and effects |
|
|
207
|
+
| [**Build Architecture**](./docs/build.md) | Vendored dependencies, build system |
|
|
208
|
+
| [**CLAUDE.md**](./CLAUDE.md) | Coding standards and patterns |
|
|
209
|
+
|
|
210
|
+
## Architecture
|
|
211
|
+
|
|
212
|
+
```
|
|
213
|
+
┌─────────────────────────────────────────────────────┐
|
|
214
|
+
│ @socketsecurity/lib │
|
|
215
|
+
│ Zero runtime dependencies │
|
|
216
|
+
├─────────────────────────────────────────────────────┤
|
|
217
|
+
│ src/ │
|
|
218
|
+
│ ├── constants/ 14 modules │
|
|
219
|
+
│ ├── env/ 68 getters │
|
|
220
|
+
│ ├── packages/ 12 utilities │
|
|
221
|
+
│ ├── effects/ 4 visual effects │
|
|
222
|
+
│ ├── stdio/ 9 I/O utilities │
|
|
223
|
+
│ ├── themes/ Theme system │
|
|
224
|
+
│ ├── external/ 40+ vendored deps │
|
|
225
|
+
│ └── ... 60+ more modules │
|
|
226
|
+
├─────────────────────────────────────────────────────┤
|
|
227
|
+
│ Build: esbuild → CommonJS (ES2022) │
|
|
228
|
+
│ Types: tsgo (TypeScript Native Preview) │
|
|
229
|
+
│ Tests: Vitest (4600+ tests, 100% coverage) │
|
|
230
|
+
└─────────────────────────────────────────────────────┘
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
## Development
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
# Setup
|
|
237
|
+
git clone https://github.com/SocketDev/socket-lib.git
|
|
238
|
+
cd socket-lib
|
|
239
|
+
pnpm install
|
|
240
|
+
|
|
241
|
+
# Build
|
|
242
|
+
pnpm run build # Production build
|
|
243
|
+
pnpm run dev # Watch mode
|
|
244
|
+
|
|
245
|
+
# Test
|
|
246
|
+
pnpm test # Run all tests
|
|
247
|
+
pnpm run cover # With coverage
|
|
248
|
+
|
|
249
|
+
# Quality
|
|
250
|
+
pnpm run check # Type check
|
|
251
|
+
pnpm run lint # Lint code
|
|
252
|
+
pnpm run fix # Auto-fix issues
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
## Stats
|
|
256
|
+
|
|
257
|
+
- **183** TypeScript modules
|
|
258
|
+
- **120+** granular exports
|
|
259
|
+
- **68** typed environment getters
|
|
260
|
+
- **14** constant modules
|
|
261
|
+
- **4600+** tests passing
|
|
262
|
+
- **Zero** runtime dependencies
|
|
263
|
+
|
|
264
|
+
## Contributing
|
|
265
|
+
|
|
266
|
+
See [CLAUDE.md](./CLAUDE.md) for:
|
|
267
|
+
- Code style and patterns
|
|
268
|
+
- Path alias usage
|
|
269
|
+
- Testing guidelines
|
|
270
|
+
- Build system details
|
|
84
271
|
|
|
85
272
|
## License
|
|
86
273
|
|
|
87
274
|
MIT
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
**Built by Socket.dev** — [socket.dev](https://socket.dev) | [@SocketSecurity](https://twitter.com/SocketSecurity)
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/* Socket Lib - Built with esbuild */
|
|
2
|
-
var p=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var S=(t,o)=>{for(var n in o)p(t,n,{get:o[n],enumerable:!0})},_=(t,o,n,c)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of I(o))!m.call(t,r)&&r!==n&&p(t,r,{get:()=>o[r],enumerable:!(c=x(o,r))||c.enumerable});return t};var a=t=>_(p({},"__esModule",{value:!0}),t);var w={};S(w,{DARWIN:()=>f,S_IXGRP:()=>X,S_IXOTH:()=>l,S_IXUSR:()=>R,WIN32:()=>i});module.exports=a(w);var s=require("
|
|
2
|
+
var p=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var S=(t,o)=>{for(var n in o)p(t,n,{get:o[n],enumerable:!0})},_=(t,o,n,c)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of I(o))!m.call(t,r)&&r!==n&&p(t,r,{get:()=>o[r],enumerable:!(c=x(o,r))||c.enumerable});return t};var a=t=>_(p({},"__esModule",{value:!0}),t);var w={};S(w,{DARWIN:()=>f,S_IXGRP:()=>X,S_IXOTH:()=>l,S_IXUSR:()=>R,WIN32:()=>i});module.exports=a(w);var s=require("os");const e=(0,s.platform)(),f=e==="darwin",i=e==="win32",R=64,X=8,l=1;0&&(module.exports={DARWIN,S_IXGRP,S_IXOTH,S_IXUSR,WIN32});
|
|
3
3
|
//# sourceMappingURL=platform.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/constants/platform.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Platform detection and OS-specific constants.\n */\n\nimport { platform } from '
|
|
5
|
-
"mappings": ";4ZAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,YAAAE,EAAA,YAAAC,EAAA,YAAAC,EAAA,YAAAC,EAAA,UAAAC,IAAA,eAAAC,EAAAP,GAIA,IAAAQ,EAAyB,
|
|
6
|
-
"names": ["platform_exports", "__export", "DARWIN", "S_IXGRP", "S_IXOTH", "S_IXUSR", "WIN32", "__toCommonJS", "
|
|
4
|
+
"sourcesContent": ["/**\n * Platform detection and OS-specific constants.\n */\n\nimport { platform } from 'os'\n\n// Platform detection.\nconst _platform = platform()\nexport const DARWIN = _platform === 'darwin'\nexport const WIN32 = _platform === 'win32'\n\n// File permission modes.\nexport const S_IXUSR = 0o100\nexport const S_IXGRP = 0o010\nexport const S_IXOTH = 0o001\n"],
|
|
5
|
+
"mappings": ";4ZAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,YAAAE,EAAA,YAAAC,EAAA,YAAAC,EAAA,YAAAC,EAAA,UAAAC,IAAA,eAAAC,EAAAP,GAIA,IAAAQ,EAAyB,cAGzB,MAAMC,KAAY,YAAS,EACdP,EAASO,IAAc,SACvBH,EAAQG,IAAc,QAGtBJ,EAAU,GACVF,EAAU,EACVC,EAAU",
|
|
6
|
+
"names": ["platform_exports", "__export", "DARWIN", "S_IXGRP", "S_IXOTH", "S_IXUSR", "WIN32", "__toCommonJS", "import_os", "_platform"]
|
|
7
7
|
}
|
package/dist/cover/code.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/* Socket Lib - Built with esbuild */
|
|
2
|
-
var u=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var O=(e,o)=>{for(var c in o)u(e,c,{get:o[c],enumerable:!0})},j=(e,o,c,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let a of w(o))!y.call(e,a)&&a!==c&&u(e,a,{get:()=>o[a],enumerable:!(n=b(o,a))||n.enumerable});return e};var E=e=>j(u({},"__esModule",{value:!0}),e);var D={};O(D,{getCodeCoverage:()=>x});module.exports=E(D);var m=require("
|
|
2
|
+
var u=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var O=(e,o)=>{for(var c in o)u(e,c,{get:o[c],enumerable:!0})},j=(e,o,c,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let a of w(o))!y.call(e,a)&&a!==c&&u(e,a,{get:()=>o[a],enumerable:!(n=b(o,a))||n.enumerable});return e};var E=e=>j(u({},"__esModule",{value:!0}),e);var D={};O(D,{getCodeCoverage:()=>x});module.exports=E(D);var m=require("fs"),_=require("../fs"),i=require("../objects"),C=require("../spawn");let v;function M(){return v===void 0&&(v=require("node:path")),v}async function x(e){const c={__proto__:null,coveragePath:M().join(process.cwd(),"coverage/coverage-final.json"),generateIfMissing:!1,...e},{coveragePath:n,generateIfMissing:a}=c;if(!n)throw new Error("Coverage path is required");if(!await m.promises.access(n).then(()=>!0).catch(()=>!1))if(a)await(0,C.spawn)("vitest",["run","--coverage"],{cwd:process.cwd(),stdio:"inherit"});else throw new Error(`Coverage file not found at "${n}". Run tests with coverage first.`);const p=await(0,_.readJson)(n);if(!(0,i.isObjectObject)(p))throw new Error(`Invalid coverage data format in "${n}"`);const t={__proto__:null,branches:{__proto__:null,covered:0,total:0},functions:{__proto__:null,covered:0,total:0},lines:{__proto__:null,covered:0,total:0},statements:{__proto__:null,covered:0,total:0}},h=p;for(const d of Object.values(h)){if(!(0,i.isObjectObject)(d))continue;const r=d;if(r.s&&(0,i.isObjectObject)(r.s)){const f=Object.values(r.s);for(const s of f)typeof s=="number"&&(t.statements.total+=1,s>0&&(t.statements.covered+=1))}if(r.b&&(0,i.isObjectObject)(r.b)){const f=Object.values(r.b);for(const s of f)if(Array.isArray(s))for(const g of s)typeof g=="number"&&(t.branches.total+=1,g>0&&(t.branches.covered+=1))}if(r.f&&(0,i.isObjectObject)(r.f)){const f=Object.values(r.f);for(const s of f)typeof s=="number"&&(t.functions.total+=1,s>0&&(t.functions.covered+=1))}t.lines.covered=t.statements.covered,t.lines.total=t.statements.total}return{branches:l(t.branches),functions:l(t.functions),lines:l(t.lines),statements:l(t.statements)}}function l(e){const o=e.total===0?"0.00":(e.covered/e.total*100).toFixed(2);return{covered:e.covered,percent:o,total:e.total}}0&&(module.exports={getCodeCoverage});
|
|
3
3
|
//# sourceMappingURL=code.js.map
|
package/dist/cover/code.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/cover/code.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * @fileoverview Code coverage utilities for parsing v8 coverage data.\n */\n\nimport { promises as fs } from '
|
|
5
|
-
"mappings": ";4ZAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,IAAA,eAAAC,EAAAH,GAIA,IAAAI,EAA+B,
|
|
6
|
-
"names": ["code_exports", "__export", "getCodeCoverage", "__toCommonJS", "
|
|
4
|
+
"sourcesContent": ["/**\n * @fileoverview Code coverage utilities for parsing v8 coverage data.\n */\n\nimport { promises as fs } from 'fs'\n\nimport { readJson } from '../fs'\nimport { isObjectObject } from '../objects'\nimport { spawn } from '../spawn'\n\nimport type {\n CodeCoverageResult,\n CoverageMetric,\n GetCodeCoverageOptions,\n V8CoverageData,\n V8FileCoverage,\n} from './types'\n\nlet _path: typeof import('path') | undefined\n/**\n * Lazily load the path module to avoid Webpack errors.\n * @private\n */\n/*@__NO_SIDE_EFFECTS__*/\nfunction getPath() {\n if (_path === undefined) {\n // Use non-'node:' prefixed require to avoid Webpack errors.\n\n _path = /*@__PURE__*/ require('node:path')\n }\n return _path as typeof import('path')\n}\n\n/**\n * Get code coverage metrics from v8 coverage-final.json.\n *\n * @throws {Error} When coverage file doesn't exist and generateIfMissing is false.\n * @throws {Error} When coverage data format is invalid.\n */\nexport async function getCodeCoverage(\n options?: GetCodeCoverageOptions | undefined,\n): Promise<CodeCoverageResult> {\n const path = getPath()\n const opts = {\n __proto__: null,\n coveragePath: path.join(process.cwd(), 'coverage/coverage-final.json'),\n generateIfMissing: false,\n ...options,\n } as GetCodeCoverageOptions\n\n const { coveragePath, generateIfMissing } = opts\n\n if (!coveragePath) {\n throw new Error('Coverage path is required')\n }\n\n // Check if coverage file exists.\n const coverageExists = await fs\n .access(coveragePath)\n .then(() => true)\n .catch(() => false)\n\n if (!coverageExists) {\n if (generateIfMissing) {\n // Run vitest to generate coverage.\n await spawn('vitest', ['run', '--coverage'], {\n cwd: process.cwd(),\n stdio: 'inherit',\n })\n } else {\n throw new Error(\n `Coverage file not found at \"${coveragePath}\". Run tests with coverage first.`,\n )\n }\n }\n\n // Read and parse coverage-final.json.\n const coverageData = (await readJson(coveragePath)) as unknown\n\n if (!isObjectObject(coverageData)) {\n throw new Error(`Invalid coverage data format in \"${coveragePath}\"`)\n }\n\n // Aggregate metrics across all files.\n const totals = {\n __proto__: null,\n branches: { __proto__: null, covered: 0, total: 0 },\n functions: { __proto__: null, covered: 0, total: 0 },\n lines: { __proto__: null, covered: 0, total: 0 },\n statements: { __proto__: null, covered: 0, total: 0 },\n }\n\n const v8Data = coverageData as V8CoverageData\n\n for (const fileCoverage of Object.values(v8Data)) {\n if (!isObjectObject(fileCoverage)) {\n continue\n }\n\n const fc = fileCoverage as V8FileCoverage\n\n // Aggregate statements.\n if (fc.s && isObjectObject(fc.s)) {\n const statementCounts = Object.values(fc.s)\n for (const count of statementCounts) {\n if (typeof count === 'number') {\n totals.statements.total += 1\n if (count > 0) {\n totals.statements.covered += 1\n }\n }\n }\n }\n\n // Aggregate branches.\n if (fc.b && isObjectObject(fc.b)) {\n const branchCounts = Object.values(fc.b)\n for (const branches of branchCounts) {\n if (Array.isArray(branches)) {\n for (const count of branches) {\n if (typeof count === 'number') {\n totals.branches.total += 1\n if (count > 0) {\n totals.branches.covered += 1\n }\n }\n }\n }\n }\n }\n\n // Aggregate functions.\n if (fc.f && isObjectObject(fc.f)) {\n const functionCounts = Object.values(fc.f)\n for (const count of functionCounts) {\n if (typeof count === 'number') {\n totals.functions.total += 1\n if (count > 0) {\n totals.functions.covered += 1\n }\n }\n }\n }\n\n // Note: Lines are typically derived from statement map in v8.\n // For simplicity, we use statements as a proxy for lines.\n // In a production implementation, you'd parse statementMap to get actual line coverage.\n totals.lines.covered = totals.statements.covered\n totals.lines.total = totals.statements.total\n }\n\n // Calculate percentages.\n return {\n branches: calculateMetric(totals.branches),\n functions: calculateMetric(totals.functions),\n lines: calculateMetric(totals.lines),\n statements: calculateMetric(totals.statements),\n }\n}\n\n/**\n * Calculate coverage metric with percentage.\n */\nfunction calculateMetric(data: {\n covered: number\n total: number\n}): CoverageMetric {\n const percent =\n data.total === 0 ? '0.00' : ((data.covered / data.total) * 100).toFixed(2)\n\n return {\n covered: data.covered,\n percent,\n total: data.total,\n }\n}\n"],
|
|
5
|
+
"mappings": ";4ZAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,IAAA,eAAAC,EAAAH,GAIA,IAAAI,EAA+B,cAE/BA,EAAyB,iBACzBC,EAA+B,sBAC/BC,EAAsB,oBAUtB,IAAIC,EAMJ,SAASC,GAAU,CACjB,OAAID,IAAU,SAGZA,EAAsB,QAAQ,WAAW,GAEpCA,CACT,CAQA,eAAsBL,EACpBO,EAC6B,CAE7B,MAAMC,EAAO,CACX,UAAW,KACX,aAHWF,EAAQ,EAGA,KAAK,QAAQ,IAAI,EAAG,8BAA8B,EACrE,kBAAmB,GACnB,GAAGC,CACL,EAEM,CAAE,aAAAE,EAAc,kBAAAC,CAAkB,EAAIF,EAE5C,GAAI,CAACC,EACH,MAAM,IAAI,MAAM,2BAA2B,EAS7C,GAAI,CALmB,MAAM,EAAAE,SAC1B,OAAOF,CAAY,EACnB,KAAK,IAAM,EAAI,EACf,MAAM,IAAM,EAAK,EAGlB,GAAIC,EAEF,QAAM,SAAM,SAAU,CAAC,MAAO,YAAY,EAAG,CAC3C,IAAK,QAAQ,IAAI,EACjB,MAAO,SACT,CAAC,MAED,OAAM,IAAI,MACR,+BAA+BD,CAAY,mCAC7C,EAKJ,MAAMG,EAAgB,QAAM,YAASH,CAAY,EAEjD,GAAI,IAAC,kBAAeG,CAAY,EAC9B,MAAM,IAAI,MAAM,oCAAoCH,CAAY,GAAG,EAIrE,MAAMI,EAAS,CACb,UAAW,KACX,SAAU,CAAE,UAAW,KAAM,QAAS,EAAG,MAAO,CAAE,EAClD,UAAW,CAAE,UAAW,KAAM,QAAS,EAAG,MAAO,CAAE,EACnD,MAAO,CAAE,UAAW,KAAM,QAAS,EAAG,MAAO,CAAE,EAC/C,WAAY,CAAE,UAAW,KAAM,QAAS,EAAG,MAAO,CAAE,CACtD,EAEMC,EAASF,EAEf,UAAWG,KAAgB,OAAO,OAAOD,CAAM,EAAG,CAChD,GAAI,IAAC,kBAAeC,CAAY,EAC9B,SAGF,MAAMC,EAAKD,EAGX,GAAIC,EAAG,MAAK,kBAAeA,EAAG,CAAC,EAAG,CAChC,MAAMC,EAAkB,OAAO,OAAOD,EAAG,CAAC,EAC1C,UAAWE,KAASD,EACd,OAAOC,GAAU,WACnBL,EAAO,WAAW,OAAS,EACvBK,EAAQ,IACVL,EAAO,WAAW,SAAW,GAIrC,CAGA,GAAIG,EAAG,MAAK,kBAAeA,EAAG,CAAC,EAAG,CAChC,MAAMG,EAAe,OAAO,OAAOH,EAAG,CAAC,EACvC,UAAWI,KAAYD,EACrB,GAAI,MAAM,QAAQC,CAAQ,EACxB,UAAWF,KAASE,EACd,OAAOF,GAAU,WACnBL,EAAO,SAAS,OAAS,EACrBK,EAAQ,IACVL,EAAO,SAAS,SAAW,GAMvC,CAGA,GAAIG,EAAG,MAAK,kBAAeA,EAAG,CAAC,EAAG,CAChC,MAAMK,EAAiB,OAAO,OAAOL,EAAG,CAAC,EACzC,UAAWE,KAASG,EACd,OAAOH,GAAU,WACnBL,EAAO,UAAU,OAAS,EACtBK,EAAQ,IACVL,EAAO,UAAU,SAAW,GAIpC,CAKAA,EAAO,MAAM,QAAUA,EAAO,WAAW,QACzCA,EAAO,MAAM,MAAQA,EAAO,WAAW,KACzC,CAGA,MAAO,CACL,SAAUS,EAAgBT,EAAO,QAAQ,EACzC,UAAWS,EAAgBT,EAAO,SAAS,EAC3C,MAAOS,EAAgBT,EAAO,KAAK,EACnC,WAAYS,EAAgBT,EAAO,UAAU,CAC/C,CACF,CAKA,SAASS,EAAgBC,EAGN,CACjB,MAAMC,EACJD,EAAK,QAAU,EAAI,QAAWA,EAAK,QAAUA,EAAK,MAAS,KAAK,QAAQ,CAAC,EAE3E,MAAO,CACL,QAASA,EAAK,QACd,QAAAC,EACA,MAAOD,EAAK,KACd,CACF",
|
|
6
|
+
"names": ["code_exports", "__export", "getCodeCoverage", "__toCommonJS", "import_fs", "import_objects", "import_spawn", "_path", "getPath", "options", "opts", "coveragePath", "generateIfMissing", "fs", "coverageData", "totals", "v8Data", "fileCoverage", "fc", "statementCounts", "count", "branchCounts", "branches", "functionCounts", "calculateMetric", "data", "percent"]
|
|
7
7
|
}
|
package/dist/debug.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/* Socket Lib - Built with esbuild */
|
|
2
|
-
var
|
|
3
|
-
`)if(u+=1,u<n)c=s+1;else{const r=o.slice(c,s).trimStart(),w=/(?<=^at\s+).*?(?=\s+\(|$)/.exec(r)?.[0];if(w&&(t=w.replace(/^(?:async|bound|get|new|set)\s+/,""),t.startsWith("Object."))){const
|
|
2
|
+
var j=Object.create;var h=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var T=Object.getPrototypeOf,W=Object.prototype.hasOwnProperty;var J=(n,t)=>{for(var e in t)h(n,e,{get:t[e],enumerable:!0})},S=(n,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of G(t))!W.call(n,o)&&o!==e&&h(n,o,{get:()=>t[o],enumerable:!(i=L(t,o))||i.enumerable});return n};var I=(n,t,e)=>(e=n!=null?j(T(n)):{},S(t||!n||!n.__esModule?h(e,"default",{value:n,enumerable:!0}):e,n)),R=n=>S(h({},"__esModule",{value:!0}),n);var Z={};J(Z,{debug:()=>F,debugCache:()=>P,debugCacheNs:()=>M,debugDir:()=>K,debugDirNs:()=>A,debugLog:()=>Q,debugLogNs:()=>U,debugNs:()=>B,debuglog:()=>X,debugtime:()=>Y,isDebug:()=>V,isDebugNs:()=>z});module.exports=R(Z);var m=require("#constants/process"),E=require("#env/debug"),a=require("#env/socket"),g=I(require("./external/@socketregistry/is-unicode-supported")),f=I(require("./external/debug")),H=require("./logger"),v=require("./objects"),x=require("./strings");const d=(0,H.getDefaultLogger)(),$=Reflect.apply,_=new Map;function C(n){let t=_.get(n);return t||(!(0,E.getDebug)()&&(0,a.getSocketDebug)()&&(n==="error"||n==="notice")&&f.default.enable(n),t=(0,f.default)(n),t.log=q,_.set(n,t),t)}let k;function N(){return k===void 0&&(k=require("node:util")),k}function b(n=3){let t="";const e=Error.captureStackTrace;if(typeof e=="function"){const i={};e(i,b);const o=i.stack;if(typeof o=="string"){let u=0,c=0;for(let s=0,{length:l}=o;s<l;s+=1)if(o[s]===`
|
|
3
|
+
`)if(u+=1,u<n)c=s+1;else{const r=o.slice(c,s).trimStart(),w=/(?<=^at\s+).*?(?=\s+\(|$)/.exec(r)?.[0];if(w&&(t=w.replace(/^(?:async|bound|get|new|set)\s+/,""),t.startsWith("Object."))){const D=t.slice(7);(0,v.hasOwn)(Object,D)||(t=D)}break}}}return t}function q(...n){const t=N(),e=f.default.inspectOpts?{...f.default.inspectOpts,showHidden:f.default.inspectOpts.showHidden===null?void 0:f.default.inspectOpts.showHidden,depth:f.default.inspectOpts.depth===null||typeof f.default.inspectOpts.depth=="boolean"?void 0:f.default.inspectOpts.depth}:{};$(d.info,d,[t.formatWithOptions(e,...n)])}function y(n){return n!==null&&typeof n=="object"?{__proto__:null,...n}:{__proto__:null,namespaces:n}}function O(n){if(!(0,a.getSocketDebug)())return!1;if(typeof n!="string"||!n||n==="*")return!0;const t=n.trim().replace(/\s+/g,",").split(",").filter(Boolean),e=[],i=[];for(const o of t)o.startsWith("-")?i.push(o.slice(1)):e.push(o);return e.length&&!e.some(o=>C(o).enabled)?!1:i.every(o=>!C(o).enabled)}function A(n,t,e){const i=y(n),{namespaces:o}=i;if(!O(o))return;const u=b(4)||"anonymous";p===void 0&&(p=(0,g.default)()?"\u25B8":">");let c=e;if(c===void 0){const r=f.default.inspectOpts;r&&(c={...r,showHidden:r.showHidden===null?void 0:r.showHidden,depth:r.depth===null||typeof r.depth=="boolean"?null:r.depth})}const s=i.spinner||(0,m.getSpinner)(),l=s?.isSpinning;s?.stop(),d.info(`[DEBUG] ${u} ${p} object inspection:`),d.dir(t,e),l&&s?.start()}let p;function B(n,...t){const e=y(n),{namespaces:i}=e;if(!O(i))return;const o=b(4)||"anonymous";p===void 0&&(p=(0,g.default)()?"\u25B8":">");const u=t.at(0),c=typeof u=="string"?[(0,x.applyLinePrefix)(`${o?`${o} ${p} `:""}${u}`,{prefix:"[DEBUG] "}),...t.slice(1)]:t,s=e.spinner||(0,m.getSpinner)(),l=s?.isSpinning;s?.stop(),$(d.info,d,c),l&&s?.start()}function U(n,...t){const e=y(n),{namespaces:i}=e;if(!O(i))return;const o=b(4)||"anonymous";p===void 0&&(p=(0,g.default)()?"\u25B8":">");const u=t.at(0),c=typeof u=="string"?[(0,x.applyLinePrefix)(`${o?`${o} ${p} `:""}${u}`,{prefix:"[DEBUG] "}),...t.slice(1)]:[`[DEBUG] ${o} ${p}`,...t],s=e.spinner||(0,m.getSpinner)(),l=s?.isSpinning;s?.stop(),$(d.info,d,c),l&&s?.start()}function M(n,t,e,i){const o=y(n),{namespaces:u}=o;if(!O(u))return;const c=b(4)||"cache";p===void 0&&(p=(0,g.default)()?"\u25B8":">");const s=`[CACHE] ${c} ${p} ${t}: ${e}`,l=i!==void 0?[s,i]:[s],r=o.spinner||(0,m.getSpinner)(),w=r?.isSpinning;r?.stop(),$(d.info,d,l),w&&r?.start()}function P(n,t,e){if(!(0,a.getSocketDebug)())return;const i=b(3)||"cache";p===void 0&&(p=(0,g.default)()?"\u25B8":">");const o=`[CACHE] ${i} ${p} ${n}: ${t}`;console.log(...e!==void 0?[o,e]:[o])}function z(n){return!!(0,a.getSocketDebug)()&&O(n)}function F(...n){B("*",...n)}function K(n,t){A("*",n,t)}function Q(...n){U("*",...n)}function V(){return!!(0,a.getSocketDebug)()}function X(n){return N().debuglog(n)}function Y(n){const t=N();let e;const i=()=>{if(e===void 0)e=Date.now();else{const o=Date.now()-e;t.debuglog("time")(`${n}: ${o}ms`),e=void 0}};return i.start=()=>{e=Date.now()},i.end=()=>{if(e!==void 0){const o=Date.now()-e;t.debuglog("time")(`${n}: ${o}ms`),e=void 0}},i}0&&(module.exports={debug,debugCache,debugCacheNs,debugDir,debugDirNs,debugLog,debugLogNs,debugNs,debuglog,debugtime,isDebug,isDebugNs});
|
|
4
4
|
//# sourceMappingURL=debug.js.map
|