@socketsecurity/lib 3.0.0 → 3.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 +32 -0
- package/dist/constants/core.d.ts +1 -1
- package/dist/constants/core.js +2 -2
- package/dist/constants/core.js.map +2 -2
- package/dist/dlx.js +1 -1
- package/dist/dlx.js.map +2 -2
- package/dist/globs.js +1 -1
- package/dist/globs.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/logger.js +7 -1
- package/dist/signal-exit.js +1 -1
- package/dist/signal-exit.js.map +1 -1
- package/dist/sorts.js +1 -1
- package/dist/sorts.js.map +2 -2
- package/dist/spinner.js +1 -1
- package/dist/spinner.js.map +3 -3
- package/package.json +1 -5
- 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,6 +5,38 @@ 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
|
+
## [3.0.2](https://github.com/SocketDev/socket-lib/releases/tag/v3.0.2) - 2025-11-01
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- **Critical: Node.js ESM named imports from CommonJS**: Fixed build output to ensure Node.js ESM can properly detect named exports from CommonJS modules
|
|
13
|
+
- Previously, esbuild's minified export pattern placed `module.exports` before variable definitions, causing "Cannot access before initialization" errors
|
|
14
|
+
- Build script now uses `@babel/parser` + `magic-string` for safe AST parsing and transformation
|
|
15
|
+
- Exports are now correctly placed at end of files after all variable definitions
|
|
16
|
+
- Enables proper ESM named imports: `import { getDefaultLogger, Logger } from '@socketsecurity/lib/logger'`
|
|
17
|
+
- Fixes socket-cli issue where named imports were failing with obscure initialization errors
|
|
18
|
+
|
|
19
|
+
## [3.0.1](https://github.com/SocketDev/socket-lib/releases/tag/v3.0.1) - 2025-11-01
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
|
|
23
|
+
- **Convenience exports from main index**: Added logger and spinner exports to ease v2→v3 migration
|
|
24
|
+
- Logger: `getDefaultLogger()`, `Logger`, `LOG_SYMBOLS` now available from `@socketsecurity/lib`
|
|
25
|
+
- Spinner: `getDefaultSpinner()`, `Spinner` now available from `@socketsecurity/lib`
|
|
26
|
+
- Both main index (`@socketsecurity/lib`) and subpath (`@socketsecurity/lib/logger`, `@socketsecurity/lib/spinner`) imports now work
|
|
27
|
+
- Both import paths return the same singleton instances
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
|
|
31
|
+
- **Critical: Spinner crashes when calling logger**: Fixed spinner internal calls to use `getDefaultLogger()` instead of removed `logger` export
|
|
32
|
+
- Spinner methods (`start()`, `stop()`, `success()`, `fail()`, etc.) no longer crash with "logger is not defined" errors
|
|
33
|
+
- All 5 internal logger access points updated to use the correct v3 API
|
|
34
|
+
- Resolves runtime errors when using spinners with hoisted variables
|
|
35
|
+
|
|
36
|
+
### Changed
|
|
37
|
+
|
|
38
|
+
- **Migration path improvement**: Users can now import logger/spinner from either main index or subpaths, reducing breaking change impact from v3.0.0
|
|
39
|
+
|
|
8
40
|
## [3.0.0](https://github.com/SocketDev/socket-lib/releases/tag/v3.0.0) - 2025-11-01
|
|
9
41
|
|
|
10
42
|
### Added
|
package/dist/constants/core.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export declare const UNKNOWN_VALUE = "<unknown>";
|
|
|
13
13
|
export declare const EMPTY_FILE = "/* empty */\n";
|
|
14
14
|
export declare const EMPTY_VALUE = "<value>";
|
|
15
15
|
// Undefined token.
|
|
16
|
-
export declare const UNDEFINED_TOKEN:
|
|
16
|
+
export declare const UNDEFINED_TOKEN: undefined;
|
|
17
17
|
// Miscellaneous.
|
|
18
18
|
export declare const V = "v";
|
|
19
19
|
export declare const COLUMN_LIMIT = 80;
|
package/dist/constants/core.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/* Socket Lib - Built with esbuild */
|
|
2
|
-
var N=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var c=(t,o)=>{for(var e in o)N(t,e,{get:o[e],enumerable:!0})},O=(t,o,e,E)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of s(o))!_.call(t,n)&&n!==e&&N(t,n,{get:()=>o[n],enumerable:!(E=r(o,n))||E.enumerable});return t};var p=t=>O(N({},"__esModule",{value:!0}),t);var
|
|
3
|
-
`,I="<value>",l=void 0,K="v",V=80,a="NODE_AUTH_TOKEN",
|
|
2
|
+
var N=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var c=(t,o)=>{for(var e in o)N(t,e,{get:o[e],enumerable:!0})},O=(t,o,e,E)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of s(o))!_.call(t,n)&&n!==e&&N(t,n,{get:()=>o[n],enumerable:!(E=r(o,n))||E.enumerable});return t};var p=t=>O(N({},"__esModule",{value:!0}),t);var i={};c(i,{COLUMN_LIMIT:()=>V,EMPTY_FILE:()=>D,EMPTY_VALUE:()=>I,LOOP_SENTINEL:()=>T,NODE_AUTH_TOKEN:()=>a,NODE_ENV:()=>d,UNDEFINED_TOKEN:()=>l,UNKNOWN_ERROR:()=>U,UNKNOWN_VALUE:()=>L,V:()=>K,kInternalsSymbol:()=>x});module.exports=p(i);const x=Symbol("@socketregistry.constants.internals"),T=1e6,U="Unknown error",L="<unknown>",D=`/* empty */
|
|
3
|
+
`,I="<value>",l=void 0,K="v",V=80,a="NODE_AUTH_TOKEN",d="NODE_ENV";0&&(module.exports={COLUMN_LIMIT,EMPTY_FILE,EMPTY_VALUE,LOOP_SENTINEL,NODE_AUTH_TOKEN,NODE_ENV,UNDEFINED_TOKEN,UNKNOWN_ERROR,UNKNOWN_VALUE,V,kInternalsSymbol});
|
|
4
4
|
//# sourceMappingURL=core.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/constants/core.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Core primitives and fundamental constants.\n * Goal: Minimize this module by finding proper semantic homes for all constants.\n */\n\n// Internal implementation symbol.\nexport const kInternalsSymbol = Symbol('@socketregistry.constants.internals')\n\n// Sentinel values.\nexport const LOOP_SENTINEL = 1_000_000\n\n// Error and unknown values.\nexport const UNKNOWN_ERROR = 'Unknown error'\nexport const UNKNOWN_VALUE = '<unknown>'\n\n// Empty values.\nexport const EMPTY_FILE = '/* empty */\\n'\nexport const EMPTY_VALUE = '<value>'\n\n// Undefined token.\nexport const UNDEFINED_TOKEN = undefined\n\n// Miscellaneous.\nexport const V = 'v'\nexport const COLUMN_LIMIT = 80\n\n// Environment variable name constants.\nexport const NODE_AUTH_TOKEN = 'NODE_AUTH_TOKEN'\nexport const NODE_ENV = 'NODE_ENV'\n"],
|
|
5
|
-
"mappings": ";4ZAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kBAAAE,EAAA,eAAAC,EAAA,gBAAAC,EAAA,kBAAAC,EAAA,oBAAAC,EAAA,aAAAC,EAAA,oBAAAC,EAAA,kBAAAC,EAAA,kBAAAC,EAAA,MAAAC,EAAA,qBAAAC,IAAA,eAAAC,EAAAb,GAMO,MAAMY,EAAmB,OAAO,qCAAqC,EAG/DP,EAAgB,IAGhBI,EAAgB,gBAChBC,EAAgB,YAGhBP,EAAa;AAAA,EACbC,EAAc,UAGdI,
|
|
4
|
+
"sourcesContent": ["/**\n * Core primitives and fundamental constants.\n * Goal: Minimize this module by finding proper semantic homes for all constants.\n */\n\n// Internal implementation symbol.\nexport const kInternalsSymbol = Symbol('@socketregistry.constants.internals')\n\n// Sentinel values.\nexport const LOOP_SENTINEL = 1_000_000\n\n// Error and unknown values.\nexport const UNKNOWN_ERROR = 'Unknown error'\nexport const UNKNOWN_VALUE = '<unknown>'\n\n// Empty values.\nexport const EMPTY_FILE = '/* empty */\\n'\nexport const EMPTY_VALUE = '<value>'\n\n// Undefined token.\nexport const UNDEFINED_TOKEN: undefined = undefined\n\n// Miscellaneous.\nexport const V = 'v'\nexport const COLUMN_LIMIT = 80\n\n// Environment variable name constants.\nexport const NODE_AUTH_TOKEN = 'NODE_AUTH_TOKEN'\nexport const NODE_ENV = 'NODE_ENV'\n"],
|
|
5
|
+
"mappings": ";4ZAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kBAAAE,EAAA,eAAAC,EAAA,gBAAAC,EAAA,kBAAAC,EAAA,oBAAAC,EAAA,aAAAC,EAAA,oBAAAC,EAAA,kBAAAC,EAAA,kBAAAC,EAAA,MAAAC,EAAA,qBAAAC,IAAA,eAAAC,EAAAb,GAMO,MAAMY,EAAmB,OAAO,qCAAqC,EAG/DP,EAAgB,IAGhBI,EAAgB,gBAChBC,EAAgB,YAGhBP,EAAa;AAAA,EACbC,EAAc,UAGdI,EAA6B,OAG7BG,EAAI,IACJT,EAAe,GAGfI,EAAkB,kBAClBC,EAAW",
|
|
6
6
|
"names": ["core_exports", "__export", "COLUMN_LIMIT", "EMPTY_FILE", "EMPTY_VALUE", "LOOP_SENTINEL", "NODE_AUTH_TOKEN", "NODE_ENV", "UNDEFINED_TOKEN", "UNKNOWN_ERROR", "UNKNOWN_VALUE", "V", "kInternalsSymbol", "__toCommonJS"]
|
|
7
7
|
}
|
package/dist/dlx.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* Socket Lib - Built with esbuild */
|
|
2
|
-
var p=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var E=Object.prototype.hasOwnProperty;var S=(e,r)=>{for(var t in r)p(e,t,{get:r[t],enumerable:!0})},b=(e,r,t,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of w(r))!E.call(e,n)&&n!==t&&p(e,n,{get:()=>r[n],enumerable:!(s=v(r,n))||s.enumerable});return e};var $=e=>b(p({},"__esModule",{value:!0}),e);var J={};S(J,{clearDlx:()=>j,clearDlxSync:()=>F,dlxDirExists:()=>M,dlxDirExistsAsync:()=>A,ensureDlxDir:()=>I,ensureDlxDirSync:()=>L,generateCacheKey:()=>C,getDlxInstalledPackageDir:()=>f,getDlxPackageDir:()=>l,getDlxPackageJsonPath:()=>T,getDlxPackageNodeModulesDir:()=>m,isDlxPackageInstalled:()=>_,isDlxPackageInstalledAsync:()=>q,isInSocketDlx:()=>X,listDlxPackages:()=>h,listDlxPackagesAsync:()=>D,removeDlxPackage:()=>P,removeDlxPackageSync:()=>k});module.exports=$(J);var x=require("crypto"),i=require("./fs"),
|
|
2
|
+
var p=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var E=Object.prototype.hasOwnProperty;var S=(e,r)=>{for(var t in r)p(e,t,{get:r[t],enumerable:!0})},b=(e,r,t,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of w(r))!E.call(e,n)&&n!==t&&p(e,n,{get:()=>r[n],enumerable:!(s=v(r,n))||s.enumerable});return e};var $=e=>b(p({},"__esModule",{value:!0}),e);var J={};S(J,{clearDlx:()=>j,clearDlxSync:()=>F,dlxDirExists:()=>M,dlxDirExistsAsync:()=>A,ensureDlxDir:()=>I,ensureDlxDirSync:()=>L,generateCacheKey:()=>C,getDlxInstalledPackageDir:()=>f,getDlxPackageDir:()=>l,getDlxPackageJsonPath:()=>T,getDlxPackageNodeModulesDir:()=>m,isDlxPackageInstalled:()=>_,isDlxPackageInstalledAsync:()=>q,isInSocketDlx:()=>X,listDlxPackages:()=>h,listDlxPackagesAsync:()=>D,removeDlxPackage:()=>P,removeDlxPackageSync:()=>k});module.exports=$(J);var x=require("crypto"),i=require("./fs"),a=require("./path"),o=require("./paths"),y=require("./promises");let g;function c(){return g===void 0&&(g=require("node:fs")),g}function C(e){return(0,x.createHash)("sha512").update(e).digest("hex").substring(0,16)}let d;function u(){return d===void 0&&(d=require("node:path")),d}async function j(){const e=await D();await(0,y.pEach)(e,r=>P(r))}function F(){const e=h();for(const r of e)k(r)}function M(){return c().existsSync((0,o.getSocketDlxDir)())}async function A(){const e=c();try{return await e.promises.access((0,o.getSocketDlxDir)()),!0}catch{return!1}}async function I(){await(0,i.safeMkdir)((0,o.getSocketDlxDir)(),{recursive:!0})}function L(){(0,i.safeMkdirSync)((0,o.getSocketDlxDir)(),{recursive:!0})}function f(e){return(0,a.normalizePath)(u().join(m(e),e))}function l(e){return(0,a.normalizePath)(u().join((0,o.getSocketDlxDir)(),e))}function T(e){return(0,a.normalizePath)(u().join(f(e),"package.json"))}function m(e){return(0,a.normalizePath)(u().join(l(e),"node_modules"))}function X(e){if(!e)return!1;const r=u(),t=(0,o.getSocketDlxDir)();return(0,a.normalizePath)(r.resolve(e)).startsWith(t+"/")}function _(e){return c().existsSync(f(e))}async function q(e){const r=c();try{return await r.promises.access(f(e)),!0}catch{return!1}}function h(){try{return(0,i.readDirNamesSync)((0,o.getSocketDlxDir)(),{sort:!0})}catch{return[]}}async function D(){const e=c();try{return(await e.promises.readdir((0,o.getSocketDlxDir)(),{withFileTypes:!0})).filter(t=>t.isDirectory()).map(t=>t.name).sort()}catch{return[]}}async function P(e){const r=l(e);try{await(0,i.safeDelete)(r,{recursive:!0,force:!0})}catch(t){throw new Error(`Failed to remove DLX package "${e}"`,{cause:t})}}function k(e){const r=c(),t=l(e);try{r.rmSync(t,{recursive:!0,force:!0})}catch(s){const n=s.code;throw n==="EACCES"||n==="EPERM"?new Error(`Permission denied removing DLX package "${e}"
|
|
3
3
|
Directory: ${t}
|
|
4
4
|
To resolve:
|
|
5
5
|
1. Check file/directory permissions
|
package/dist/dlx.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/dlx.ts"],
|
|
4
|
-
"sourcesContent": ["/** @fileoverview DLX (execute package) utilities for Socket ecosystem shared installations. */\n\nimport { createHash } from 'crypto'\n\nimport { readDirNamesSync, safeDelete, safeMkdir, safeMkdirSync } from './fs'\nimport { normalizePath } from './path'\nimport { getSocketDlxDir } from './paths'\nimport { pEach } from './promises'\n\nlet _fs: typeof import('fs') | undefined\n/**\n * Lazily load the fs module to avoid Webpack errors.\n * Uses non-'node:' prefixed require to prevent Webpack bundling issues.\n *\n * @returns The Node.js fs module\n * @private\n */\n/*@__NO_SIDE_EFFECTS__*/\nfunction getFs() {\n if (_fs === undefined) {\n // Use non-'node:' prefixed require to avoid Webpack errors.\n\n _fs = /*@__PURE__*/ require('node:fs')\n }\n return _fs as typeof import('fs')\n}\n\n/**\n * Generate a cache directory name using npm/npx approach.\n * Uses first 16 characters of SHA-512 hash (like npm/npx).\n *\n * Rationale for SHA-512 truncated (vs full SHA-256):\n * - Matches npm/npx ecosystem behavior\n * - Shorter paths for Windows MAX_PATH compatibility (260 chars)\n * - 16 hex chars = 64 bits = acceptable collision risk for local cache\n * - Collision probability ~1 in 18 quintillion with 1000 entries\n *\n * Input strategy (aligned with npx):\n * - npx uses package spec strings (e.g., '@scope/pkg@1.0.0', 'prettier@3.0.0')\n * - Caller provides complete spec string with version for accurate cache keying\n * - For package installs: Use PURL-style spec with version\n * Examples: 'npm:prettier@3.0.0', 'pypi:requests@2.31.0', 'gem:rails@7.0.0'\n * Note: Socket uses shorthand format without 'pkg:' prefix\n * (handled by @socketregistry/packageurl-js)\n * - For binary downloads: Use URL:name for uniqueness\n *\n * Reference: npm/cli v11.6.2 libnpmexec/lib/index.js#L233-L244\n * https://github.com/npm/cli/blob/v11.6.2/workspaces/libnpmexec/lib/index.js#L233-L244\n * Implementation: packages.map().sort().join('\\n') \u2192 SHA-512 \u2192 slice(0,16)\n * npx hashes the package spec (name@version), not just name\n */\nexport function generateCacheKey(spec: string): string {\n return createHash('sha512').update(spec).digest('hex').substring(0, 16)\n}\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!\n}\n\n/**\n * Clear all DLX package installations.\n */\nexport async function clearDlx(): Promise<void> {\n const packages = await listDlxPackagesAsync()\n await pEach(packages, pkg => removeDlxPackage(pkg))\n}\n\n/**\n * Clear all DLX package installations synchronously.\n */\nexport function clearDlxSync(): void {\n const packages = listDlxPackages()\n for (const pkg of packages) {\n removeDlxPackageSync(pkg)\n }\n}\n\n/**\n * Check if the DLX directory exists.\n */\nexport function dlxDirExists(): boolean {\n const fs = getFs()\n return fs.existsSync(getSocketDlxDir())\n}\n\n/**\n * Check if the DLX directory exists asynchronously.\n */\nexport async function dlxDirExistsAsync(): Promise<boolean> {\n const fs = getFs()\n try {\n await fs.promises.access(getSocketDlxDir())\n return true\n } catch {\n return false\n }\n}\n\n/**\n * Ensure the DLX directory exists, creating it if necessary.\n */\nexport async function ensureDlxDir(): Promise<void> {\n await safeMkdir(getSocketDlxDir(), { recursive: true })\n}\n\n/**\n * Ensure the DLX directory exists synchronously, creating it if necessary.\n */\nexport function ensureDlxDirSync(): void {\n safeMkdirSync(getSocketDlxDir(), { recursive: true })\n}\n\n/**\n * Get the installed package directory within DLX node_modules.\n */\nexport function getDlxInstalledPackageDir(packageName: string): string {\n const path = getPath()\n return normalizePath(\n path.join(getDlxPackageNodeModulesDir(packageName), packageName),\n )\n}\n\n/**\n * Get the DLX installation directory for a specific package.\n */\nexport function getDlxPackageDir(packageName: string): string {\n const path = getPath()\n return normalizePath(path.join(getSocketDlxDir(), packageName))\n}\n\n/**\n * Get the package.json path for a DLX installed package.\n */\nexport function getDlxPackageJsonPath(packageName: string): string {\n const path = getPath()\n return normalizePath(\n path.join(getDlxInstalledPackageDir(packageName), 'package.json'),\n )\n}\n\n/**\n * Get the node_modules directory for a DLX package installation.\n */\nexport function getDlxPackageNodeModulesDir(packageName: string): string {\n const path = getPath()\n return normalizePath(path.join(getDlxPackageDir(packageName), 'node_modules'))\n}\n\n/**\n * Check if a file path is within the Socket DLX directory.\n * This is useful for determining if a binary or file is managed by Socket's DLX system.\n *\n * @param filePath - Absolute or relative path to check\n * @returns true if the path is within ~/.socket/_dlx/, false otherwise\n *\n * @example\n * ```typescript\n * isInSocketDlx('/home/user/.socket/_dlx/abc123/bin/socket') // true\n * isInSocketDlx('/usr/local/bin/socket') // false\n * isInSocketDlx(process.argv[0]) // Check if current binary is in DLX\n * ```\n */\nexport function isInSocketDlx(filePath: string): boolean {\n if (!filePath) {\n return false\n }\n\n const path = getPath()\n const dlxDir = getSocketDlxDir()\n const absolutePath = path.resolve(filePath)\n\n // Check if the absolute path starts with the DLX directory.\n return absolutePath.startsWith(dlxDir +
|
|
5
|
-
"mappings": ";4ZAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,cAAAE,EAAA,iBAAAC,EAAA,iBAAAC,EAAA,sBAAAC,EAAA,iBAAAC,EAAA,qBAAAC,EAAA,qBAAAC,EAAA,8BAAAC,EAAA,qBAAAC,EAAA,0BAAAC,EAAA,gCAAAC,EAAA,0BAAAC,EAAA,+BAAAC,EAAA,kBAAAC,EAAA,oBAAAC,EAAA,yBAAAC,EAAA,qBAAAC,EAAA,yBAAAC,IAAA,eAAAC,EAAApB,GAEA,IAAAqB,EAA2B,kBAE3BC,EAAuE,gBACvEC,EAA8B,kBAC9BC,EAAgC,mBAChCC,EAAsB,sBAEtB,IAAIC,EASJ,SAASC,GAAQ,CACf,OAAID,IAAQ,SAGVA,EAAoB,QAAQ,SAAS,GAEhCA,CACT,CA0BO,SAASlB,EAAiBoB,EAAsB,CACrD,SAAO,cAAW,QAAQ,EAAE,OAAOA,CAAI,EAAE,OAAO,KAAK,EAAE,UAAU,EA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AAQ,EACfO,KAAS,mBAAgB,
|
|
4
|
+
"sourcesContent": ["/** @fileoverview DLX (execute package) utilities for Socket ecosystem shared installations. */\n\nimport { createHash } from 'crypto'\n\nimport { readDirNamesSync, safeDelete, safeMkdir, safeMkdirSync } from './fs'\nimport { normalizePath } from './path'\nimport { getSocketDlxDir } from './paths'\nimport { pEach } from './promises'\n\nlet _fs: typeof import('fs') | undefined\n/**\n * Lazily load the fs module to avoid Webpack errors.\n * Uses non-'node:' prefixed require to prevent Webpack bundling issues.\n *\n * @returns The Node.js fs module\n * @private\n */\n/*@__NO_SIDE_EFFECTS__*/\nfunction getFs() {\n if (_fs === undefined) {\n // Use non-'node:' prefixed require to avoid Webpack errors.\n\n _fs = /*@__PURE__*/ require('node:fs')\n }\n return _fs as typeof import('fs')\n}\n\n/**\n * Generate a cache directory name using npm/npx approach.\n * Uses first 16 characters of SHA-512 hash (like npm/npx).\n *\n * Rationale for SHA-512 truncated (vs full SHA-256):\n * - Matches npm/npx ecosystem behavior\n * - Shorter paths for Windows MAX_PATH compatibility (260 chars)\n * - 16 hex chars = 64 bits = acceptable collision risk for local cache\n * - Collision probability ~1 in 18 quintillion with 1000 entries\n *\n * Input strategy (aligned with npx):\n * - npx uses package spec strings (e.g., '@scope/pkg@1.0.0', 'prettier@3.0.0')\n * - Caller provides complete spec string with version for accurate cache keying\n * - For package installs: Use PURL-style spec with version\n * Examples: 'npm:prettier@3.0.0', 'pypi:requests@2.31.0', 'gem:rails@7.0.0'\n * Note: Socket uses shorthand format without 'pkg:' prefix\n * (handled by @socketregistry/packageurl-js)\n * - For binary downloads: Use URL:name for uniqueness\n *\n * Reference: npm/cli v11.6.2 libnpmexec/lib/index.js#L233-L244\n * https://github.com/npm/cli/blob/v11.6.2/workspaces/libnpmexec/lib/index.js#L233-L244\n * Implementation: packages.map().sort().join('\\n') \u2192 SHA-512 \u2192 slice(0,16)\n * npx hashes the package spec (name@version), not just name\n */\nexport function generateCacheKey(spec: string): string {\n return createHash('sha512').update(spec).digest('hex').substring(0, 16)\n}\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!\n}\n\n/**\n * Clear all DLX package installations.\n */\nexport async function clearDlx(): Promise<void> {\n const packages = await listDlxPackagesAsync()\n await pEach(packages, pkg => removeDlxPackage(pkg))\n}\n\n/**\n * Clear all DLX package installations synchronously.\n */\nexport function clearDlxSync(): void {\n const packages = listDlxPackages()\n for (const pkg of packages) {\n removeDlxPackageSync(pkg)\n }\n}\n\n/**\n * Check if the DLX directory exists.\n */\nexport function dlxDirExists(): boolean {\n const fs = getFs()\n return fs.existsSync(getSocketDlxDir())\n}\n\n/**\n * Check if the DLX directory exists asynchronously.\n */\nexport async function dlxDirExistsAsync(): Promise<boolean> {\n const fs = getFs()\n try {\n await fs.promises.access(getSocketDlxDir())\n return true\n } catch {\n return false\n }\n}\n\n/**\n * Ensure the DLX directory exists, creating it if necessary.\n */\nexport async function ensureDlxDir(): Promise<void> {\n await safeMkdir(getSocketDlxDir(), { recursive: true })\n}\n\n/**\n * Ensure the DLX directory exists synchronously, creating it if necessary.\n */\nexport function ensureDlxDirSync(): void {\n safeMkdirSync(getSocketDlxDir(), { recursive: true })\n}\n\n/**\n * Get the installed package directory within DLX node_modules.\n */\nexport function getDlxInstalledPackageDir(packageName: string): string {\n const path = getPath()\n return normalizePath(\n path.join(getDlxPackageNodeModulesDir(packageName), packageName),\n )\n}\n\n/**\n * Get the DLX installation directory for a specific package.\n */\nexport function getDlxPackageDir(packageName: string): string {\n const path = getPath()\n return normalizePath(path.join(getSocketDlxDir(), packageName))\n}\n\n/**\n * Get the package.json path for a DLX installed package.\n */\nexport function getDlxPackageJsonPath(packageName: string): string {\n const path = getPath()\n return normalizePath(\n path.join(getDlxInstalledPackageDir(packageName), 'package.json'),\n )\n}\n\n/**\n * Get the node_modules directory for a DLX package installation.\n */\nexport function getDlxPackageNodeModulesDir(packageName: string): string {\n const path = getPath()\n return normalizePath(path.join(getDlxPackageDir(packageName), 'node_modules'))\n}\n\n/**\n * Check if a file path is within the Socket DLX directory.\n * This is useful for determining if a binary or file is managed by Socket's DLX system.\n *\n * @param filePath - Absolute or relative path to check\n * @returns true if the path is within ~/.socket/_dlx/, false otherwise\n *\n * @example\n * ```typescript\n * isInSocketDlx('/home/user/.socket/_dlx/abc123/bin/socket') // true\n * isInSocketDlx('/usr/local/bin/socket') // false\n * isInSocketDlx(process.argv[0]) // Check if current binary is in DLX\n * ```\n */\nexport function isInSocketDlx(filePath: string): boolean {\n if (!filePath) {\n return false\n }\n\n const path = getPath()\n const dlxDir = getSocketDlxDir()\n const absolutePath = normalizePath(path.resolve(filePath))\n\n // Check if the absolute path starts with the DLX directory.\n // Both paths are normalized to use forward slashes for consistent comparison.\n return absolutePath.startsWith(dlxDir + '/')\n}\n\n/**\n * Check if a package is installed in DLX.\n */\nexport function isDlxPackageInstalled(packageName: string): boolean {\n const fs = getFs()\n return fs.existsSync(getDlxInstalledPackageDir(packageName))\n}\n\n/**\n * Check if a package is installed in DLX asynchronously.\n */\nexport async function isDlxPackageInstalledAsync(\n packageName: string,\n): Promise<boolean> {\n const fs = getFs()\n try {\n await fs.promises.access(getDlxInstalledPackageDir(packageName))\n return true\n } catch {\n return false\n }\n}\n\n/**\n * List all packages installed in DLX.\n */\nexport function listDlxPackages(): string[] {\n try {\n return readDirNamesSync(getSocketDlxDir(), { sort: true })\n } catch {\n return []\n }\n}\n\n/**\n * List all packages installed in DLX asynchronously.\n */\nexport async function listDlxPackagesAsync(): Promise<string[]> {\n const fs = getFs()\n try {\n const entries = await fs.promises.readdir(getSocketDlxDir(), {\n withFileTypes: true,\n })\n return entries\n .filter(e => e.isDirectory())\n .map(e => e.name)\n .sort()\n } catch {\n return []\n }\n}\n\n/**\n * Remove a DLX package installation.\n */\nexport async function removeDlxPackage(packageName: string): Promise<void> {\n const packageDir = getDlxPackageDir(packageName)\n try {\n await safeDelete(packageDir, { recursive: true, force: true })\n } catch (e) {\n throw new Error(`Failed to remove DLX package \"${packageName}\"`, {\n cause: e,\n })\n }\n}\n\n/**\n * Remove a DLX package installation synchronously.\n */\nexport function removeDlxPackageSync(packageName: string): void {\n const fs = getFs()\n const packageDir = getDlxPackageDir(packageName)\n try {\n fs.rmSync(packageDir, { recursive: true, force: true })\n } catch (e) {\n const code = (e as NodeJS.ErrnoException).code\n if (code === 'EACCES' || code === 'EPERM') {\n throw new Error(\n `Permission denied removing DLX package \"${packageName}\"\\n` +\n `Directory: ${packageDir}\\n` +\n 'To resolve:\\n' +\n ' 1. Check file/directory permissions\\n' +\n ' 2. Close any programs using files in this directory\\n' +\n ' 3. Try running with elevated privileges if necessary\\n' +\n ` 4. Manually remove: rm -rf \"${packageDir}\"`,\n { cause: e },\n )\n }\n if (code === 'EROFS') {\n throw new Error(\n `Cannot remove DLX package \"${packageName}\" from read-only filesystem\\n` +\n `Directory: ${packageDir}\\n` +\n 'The filesystem is mounted read-only.',\n { cause: e },\n )\n }\n throw new Error(\n `Failed to remove DLX package \"${packageName}\"\\n` +\n `Directory: ${packageDir}\\n` +\n 'Check permissions and ensure no programs are using this directory.',\n { cause: e },\n )\n }\n}\n"],
|
|
5
|
+
"mappings": ";4ZAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,cAAAE,EAAA,iBAAAC,EAAA,iBAAAC,EAAA,sBAAAC,EAAA,iBAAAC,EAAA,qBAAAC,EAAA,qBAAAC,EAAA,8BAAAC,EAAA,qBAAAC,EAAA,0BAAAC,EAAA,gCAAAC,EAAA,0BAAAC,EAAA,+BAAAC,EAAA,kBAAAC,EAAA,oBAAAC,EAAA,yBAAAC,EAAA,qBAAAC,EAAA,yBAAAC,IAAA,eAAAC,EAAApB,GAEA,IAAAqB,EAA2B,kBAE3BC,EAAuE,gBACvEC,EAA8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CACF,CAKO,SAASnB,EAAqBe,EAA2B,CAC9D,MAAMD,EAAKN,EAAM,EACXY,EAAa7B,EAAiBwB,CAAW,EAC/C,GAAI,CACFD,EAAG,OAAOM,EAAY,CAAE,UAAW,GAAM,MAAO,EAAK,CAAC,CACxD,OAASD,EAAG,CACV,MAAME,EAAQF,EAA4B,KAC1C,MAAIE,IAAS,UAAYA,IAAS,QAC1B,IAAI,MACR,2CAA2CN,CAAW;AAAA,aACtCK,CAAU;AAAA;AAAA;AAAA;AAAA;AAAA,gCAKSA,CAAU,IAC7C,CAAE,MAAOD,CAAE,CACb,EAEEE,IAAS,QACL,IAAI,MACR,8BAA8BN,CAAW;AAAA,aACzBK,CAAU;AAAA,sCAE1B,CAAE,MAAOD,CAAE,CACb,EAEI,IAAI,MACR,iCAAiCJ,CAAW;AAAA,aAC5BK,CAAU;AAAA,oEAE1B,CAAE,MAAOD,CAAE,CACb,CACF,CACF",
|
|
6
6
|
"names": ["dlx_exports", "__export", "clearDlx", "clearDlxSync", "dlxDirExists", "dlxDirExistsAsync", "ensureDlxDir", "ensureDlxDirSync", "generateCacheKey", "getDlxInstalledPackageDir", "getDlxPackageDir", "getDlxPackageJsonPath", "getDlxPackageNodeModulesDir", "isDlxPackageInstalled", "isDlxPackageInstalledAsync", "isInSocketDlx", "listDlxPackages", "listDlxPackagesAsync", "removeDlxPackage", "removeDlxPackageSync", "__toCommonJS", "import_crypto", "import_fs", "import_path", "import_paths", "import_promises", "_fs", "getFs", "spec", "_path", "getPath", "packages", "pkg", "fs", "packageName", "filePath", "path", "dlxDir", "e", "packageDir", "code"]
|
|
7
7
|
}
|
package/dist/globs.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/* Socket Lib - Built with esbuild */
|
|
2
|
-
var
|
|
2
|
+
var p=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var _=(t,o)=>{for(var n in o)p(t,n,{get:o[n],enumerable:!0})},O=(t,o,n,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of h(o))!y.call(t,e)&&e!==n&&p(t,e,{get:()=>o[e],enumerable:!(r=d(o,e))||r.enumerable});return t};var S=t=>O(p({},"__esModule",{value:!0}),t);var L={};_(L,{defaultIgnore:()=>m,getGlobMatcher:()=>w,globStreamLicenses:()=>v});module.exports=S(L);var u=require("./objects");const m=(0,u.objectFreeze)(["**/.git","**/.npmrc","**/node_modules","**/.DS_Store","**/.gitignore","**/.hg","**/.lock-wscript","**/.npmignore","**/.svn","**/.wafpickle-*","**/.*.swp","**/._*/**","**/archived-packages/**","**/build/config.gypi","**/CVS","**/npm-debug.log","**/*.orig","**/.env","**/.eslintcache","**/.nvm","**/.tap","**/.vscode","**/*.tsbuildinfo","**/Thumbs.db","**/bower_components"]);let b;function E(){return b===void 0&&(b=require("./external/picomatch")),b}let g;function G(){if(g===void 0){const t=require("./external/fast-glob");g="default"in t?t.default:t}return g}function v(t,o){const{ignore:n,ignoreOriginals:r,recursive:e,...i}={__proto__:null,...o},a=[...Array.isArray(n)?n:m,"**/*.{cjs,cts,js,json,mjs,mts,ts}"];if(r){const{LICENSE_ORIGINAL_GLOB_RECURSIVE:s}=require("#constants/paths");a.push(s)}const c=G(),l=require("#constants/paths");return c.globStream([e?l.LICENSE_GLOB_RECURSIVE:l.LICENSE_GLOB],{__proto__:null,absolute:!0,caseSensitiveMatch:!1,cwd:t,...i,...a?{ignore:a}:{}})}const f=new Map;function w(t,o){const n=Array.isArray(t)?t:[t],r=JSON.stringify({patterns:n,options:o});let e=f.get(r);if(e)return e;const i=n.filter(s=>!s.startsWith("!")),a=n.filter(s=>s.startsWith("!")).map(s=>s.slice(1)),c=E(),l={dot:!0,nocase:!0,...o,...a.length>0?{ignore:a}:{}};return e=c(i.length>0?i:n,l),f.set(r,e),e}0&&(module.exports={defaultIgnore,getGlobMatcher,globStreamLicenses});
|
|
3
3
|
//# sourceMappingURL=globs.js.map
|
package/dist/globs.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/globs.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * @fileoverview Glob pattern matching utilities with default ignore patterns.\n * Provides file filtering and glob matcher functions for npm-like behavior.\n */\n\n// IMPORTANT: Do not use destructuring here - use direct assignment instead.\nimport { objectFreeze as ObjectFreeze } from './objects'\n\n// Type definitions\ntype Pattern = string\n\ninterface FastGlobOptions {\n absolute?: boolean\n baseNameMatch?: boolean\n braceExpansion?: boolean\n caseSensitiveMatch?: boolean\n concurrency?: number\n cwd?: string\n deep?: number\n dot?: boolean\n extglob?: boolean\n followSymbolicLinks?: boolean\n fs?: unknown\n globstar?: boolean\n ignore?: string[]\n ignoreFiles?: string[]\n markDirectories?: boolean\n objectMode?: boolean\n onlyDirectories?: boolean\n onlyFiles?: boolean\n stats?: boolean\n suppressErrors?: boolean\n throwErrorOnBrokenSymbolicLink?: boolean\n unique?: boolean\n}\n\nexport interface GlobOptions extends FastGlobOptions {\n ignoreOriginals?: boolean\n recursive?: boolean\n}\n\nexport type { Pattern, FastGlobOptions }\n\nexport const defaultIgnore = ObjectFreeze([\n // Most of these ignored files can be included specifically if included in the\n // files globs. Exceptions to this are:\n // https://docs.npmjs.com/cli/v10/configuring-npm/package-json#files\n // These can NOT be included.\n // https://github.com/npm/npm-packlist/blob/v10.0.0/lib/index.js#L280\n '**/.git',\n '**/.npmrc',\n // '**/bun.lockb?',\n '**/node_modules',\n // '**/package-lock.json',\n // '**/pnpm-lock.ya?ml',\n // '**/yarn.lock',\n // Include npm-packlist defaults:\n // https://github.com/npm/npm-packlist/blob/v10.0.0/lib/index.js#L15-L38\n '**/.DS_Store',\n '**/.gitignore',\n '**/.hg',\n '**/.lock-wscript',\n '**/.npmignore',\n '**/.svn',\n '**/.wafpickle-*',\n '**/.*.swp',\n '**/._*/**',\n '**/archived-packages/**',\n '**/build/config.gypi',\n '**/CVS',\n '**/npm-debug.log',\n '**/*.orig',\n // Inline generic socket-registry .gitignore entries.\n '**/.env',\n '**/.eslintcache',\n '**/.nvm',\n '**/.tap',\n '**/.vscode',\n '**/*.tsbuildinfo',\n '**/Thumbs.db',\n // Inline additional ignores.\n '**/bower_components',\n])\n\nlet _picomatch: typeof import('picomatch') | undefined\n/**\n * Lazily load the picomatch module.\n * @private\n */\n/*@__NO_SIDE_EFFECTS__*/\nfunction getPicomatch() {\n if (_picomatch === undefined) {\n // The 'picomatch' package is browser safe.\n _picomatch = /*@__PURE__*/ require('./external/picomatch')\n }\n return _picomatch as typeof import('picomatch')\n}\n\nlet _fastGlob: typeof import('fast-glob') | undefined\n/**\n * Lazily load the fast-glob module.\n * @private\n */\n/*@__NO_SIDE_EFFECTS__*/\nfunction getFastGlob() {\n if (_fastGlob === undefined) {\n const globExport = /*@__PURE__*/ require('./external/fast-glob')\n _fastGlob = globExport.default
|
|
5
|
-
"mappings": ";4ZAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,EAAA,mBAAAC,EAAA,uBAAAC,IAAA,eAAAC,EAAAL,GAMA,IAAAM,EAA6C,qBAqCtC,MAAMJ,KAAgB,EAAAK,cAAa,CAMxC,UACA,YAEA,kBAMA,eACA,gBACA,SACA,mBACA,gBACA,UACA,kBACA,YACA,YACA,0BACA,uBACA,SACA,mBACA,YAEA,UACA,kBACA,UACA,UACA,aACA,mBACA,eAEA,qBACF,CAAC,EAED,IAAIC,EAMJ,SAASC,GAAe,CACtB,OAAID,IAAe,SAEjBA,EAA2B,QAAQ,sBAAsB,GAEpDA,CACT,CAEA,IAAIE,EAMJ,SAASC,GAAc,CACrB,GAAID,IAAc,OAAW,CAC3B,MAAME,EAA2B,QAAQ,sBAAsB,
|
|
6
|
-
"names": ["globs_exports", "__export", "defaultIgnore", "getGlobMatcher", "globStreamLicenses", "__toCommonJS", "import_objects", "ObjectFreeze", "_picomatch", "getPicomatch", "_fastGlob", "getFastGlob", "globExport", "dirname", "options", "ignoreOpt", "ignoreOriginals", "recursive", "globOptions", "ignore", "matcherCache", "glob", "patterns", "key", "matcher", "positivePatterns", "p", "negativePatterns", "picomatch", "matchOptions"]
|
|
4
|
+
"sourcesContent": ["/**\n * @fileoverview Glob pattern matching utilities with default ignore patterns.\n * Provides file filtering and glob matcher functions for npm-like behavior.\n */\n\n// IMPORTANT: Do not use destructuring here - use direct assignment instead.\nimport { objectFreeze as ObjectFreeze } from './objects'\n\n// Type definitions\ntype Pattern = string\n\ninterface FastGlobOptions {\n absolute?: boolean\n baseNameMatch?: boolean\n braceExpansion?: boolean\n caseSensitiveMatch?: boolean\n concurrency?: number\n cwd?: string\n deep?: number\n dot?: boolean\n extglob?: boolean\n followSymbolicLinks?: boolean\n fs?: unknown\n globstar?: boolean\n ignore?: string[]\n ignoreFiles?: string[]\n markDirectories?: boolean\n objectMode?: boolean\n onlyDirectories?: boolean\n onlyFiles?: boolean\n stats?: boolean\n suppressErrors?: boolean\n throwErrorOnBrokenSymbolicLink?: boolean\n unique?: boolean\n}\n\nexport interface GlobOptions extends FastGlobOptions {\n ignoreOriginals?: boolean\n recursive?: boolean\n}\n\nexport type { Pattern, FastGlobOptions }\n\nexport const defaultIgnore = ObjectFreeze([\n // Most of these ignored files can be included specifically if included in the\n // files globs. Exceptions to this are:\n // https://docs.npmjs.com/cli/v10/configuring-npm/package-json#files\n // These can NOT be included.\n // https://github.com/npm/npm-packlist/blob/v10.0.0/lib/index.js#L280\n '**/.git',\n '**/.npmrc',\n // '**/bun.lockb?',\n '**/node_modules',\n // '**/package-lock.json',\n // '**/pnpm-lock.ya?ml',\n // '**/yarn.lock',\n // Include npm-packlist defaults:\n // https://github.com/npm/npm-packlist/blob/v10.0.0/lib/index.js#L15-L38\n '**/.DS_Store',\n '**/.gitignore',\n '**/.hg',\n '**/.lock-wscript',\n '**/.npmignore',\n '**/.svn',\n '**/.wafpickle-*',\n '**/.*.swp',\n '**/._*/**',\n '**/archived-packages/**',\n '**/build/config.gypi',\n '**/CVS',\n '**/npm-debug.log',\n '**/*.orig',\n // Inline generic socket-registry .gitignore entries.\n '**/.env',\n '**/.eslintcache',\n '**/.nvm',\n '**/.tap',\n '**/.vscode',\n '**/*.tsbuildinfo',\n '**/Thumbs.db',\n // Inline additional ignores.\n '**/bower_components',\n])\n\nlet _picomatch: typeof import('picomatch') | undefined\n/**\n * Lazily load the picomatch module.\n * @private\n */\n/*@__NO_SIDE_EFFECTS__*/\nfunction getPicomatch() {\n if (_picomatch === undefined) {\n // The 'picomatch' package is browser safe.\n _picomatch = /*@__PURE__*/ require('./external/picomatch')\n }\n return _picomatch as typeof import('picomatch')\n}\n\nlet _fastGlob: typeof import('fast-glob') | undefined\n/**\n * Lazily load the fast-glob module.\n * @private\n */\n/*@__NO_SIDE_EFFECTS__*/\nfunction getFastGlob() {\n if (_fastGlob === undefined) {\n const globExport = /*@__PURE__*/ require('./external/fast-glob') as\n | (typeof import('fast-glob') & { default?: typeof import('fast-glob') })\n | typeof import('fast-glob')\n _fastGlob = (\n 'default' in globExport ? globExport.default : globExport\n ) as typeof import('fast-glob')\n }\n return _fastGlob as typeof import('fast-glob')\n}\n\n/**\n * Create a stream of license file paths matching glob patterns.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function globStreamLicenses(\n dirname: string,\n options?: GlobOptions,\n): NodeJS.ReadableStream {\n const {\n ignore: ignoreOpt,\n ignoreOriginals,\n recursive,\n ...globOptions\n } = { __proto__: null, ...options } as GlobOptions\n const ignore = [\n ...(Array.isArray(ignoreOpt) ? ignoreOpt : defaultIgnore),\n '**/*.{cjs,cts,js,json,mjs,mts,ts}',\n ]\n if (ignoreOriginals) {\n const { LICENSE_ORIGINAL_GLOB_RECURSIVE } =\n /*@__INLINE__*/ require('#constants/paths') as typeof import('#constants/paths')\n ignore.push(LICENSE_ORIGINAL_GLOB_RECURSIVE)\n }\n const fastGlob = getFastGlob()\n const paths =\n /*@__INLINE__*/ require('#constants/paths') as typeof import('#constants/paths')\n return fastGlob.globStream(\n [recursive ? paths.LICENSE_GLOB_RECURSIVE : paths.LICENSE_GLOB],\n {\n __proto__: null,\n absolute: true,\n caseSensitiveMatch: false,\n cwd: dirname,\n ...globOptions,\n ...(ignore ? { ignore } : {}),\n } as import('fast-glob').Options,\n )\n}\n\nconst matcherCache = new Map<string, (path: string) => boolean>()\n/**\n * Get a cached glob matcher function.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function getGlobMatcher(\n glob: Pattern | Pattern[],\n options?: { dot?: boolean; nocase?: boolean; ignore?: string[] },\n): (path: string) => boolean {\n const patterns = Array.isArray(glob) ? glob : [glob]\n const key = JSON.stringify({ patterns, options })\n let matcher: ((path: string) => boolean) | undefined = matcherCache.get(key)\n if (matcher) {\n return matcher\n }\n\n // Separate positive and negative patterns.\n const positivePatterns = patterns.filter(p => !p.startsWith('!'))\n const negativePatterns = patterns\n .filter(p => p.startsWith('!'))\n .map(p => p.slice(1))\n\n const picomatch = getPicomatch()\n\n // Use ignore option for negation patterns.\n const matchOptions = {\n dot: true,\n nocase: true,\n ...options,\n ...(negativePatterns.length > 0 ? { ignore: negativePatterns } : {}),\n }\n\n matcher = picomatch(\n positivePatterns.length > 0 ? positivePatterns : patterns,\n matchOptions,\n ) as (path: string) => boolean\n\n matcherCache.set(key, matcher)\n return matcher\n}\n"],
|
|
5
|
+
"mappings": ";4ZAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,EAAA,mBAAAC,EAAA,uBAAAC,IAAA,eAAAC,EAAAL,GAMA,IAAAM,EAA6C,qBAqCtC,MAAMJ,KAAgB,EAAAK,cAAa,CAMxC,UACA,YAEA,kBAMA,eACA,gBACA,SACA,mBACA,gBACA,UACA,kBACA,YACA,YACA,0BACA,uBACA,SACA,mBACA,YAEA,UACA,kBACA,UACA,UACA,aACA,mBACA,eAEA,qBACF,CAAC,EAED,IAAIC,EAMJ,SAASC,GAAe,CACtB,OAAID,IAAe,SAEjBA,EAA2B,QAAQ,sBAAsB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AK,GACL,OAAQ,GACR,GAAGlB,EACH,GAAIgB,EAAiB,OAAS,EAAI,CAAE,OAAQA,CAAiB,EAAI,CAAC,CACpE,EAEA,OAAAH,EAAUI,EACRH,EAAiB,OAAS,EAAIA,EAAmBH,EACjDO,CACF,EAEAT,EAAa,IAAIG,EAAKC,CAAO,EACtBA,CACT",
|
|
6
|
+
"names": ["globs_exports", "__export", "defaultIgnore", "getGlobMatcher", "globStreamLicenses", "__toCommonJS", "import_objects", "ObjectFreeze", "_picomatch", "getPicomatch", "_fastGlob", "getFastGlob", "globExport", "dirname", "options", "ignoreOpt", "ignoreOriginals", "recursive", "globOptions", "ignore", "LICENSE_ORIGINAL_GLOB_RECURSIVE", "fastGlob", "paths", "matcherCache", "glob", "patterns", "key", "matcher", "positivePatterns", "p", "negativePatterns", "picomatch", "matchOptions"]
|
|
7
7
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @fileoverview Main entry point for
|
|
2
|
+
* @fileoverview Main entry point for @socketsecurity/lib.
|
|
3
3
|
* Clean, organized exports for better developer experience.
|
|
4
4
|
*/
|
|
5
|
-
//
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
// Export logger utilities for convenience
|
|
6
|
+
export { getDefaultLogger, Logger, LOG_SYMBOLS } from './logger';
|
|
7
|
+
// Export spinner utilities for convenience
|
|
8
|
+
export { getDefaultSpinner, Spinner } from './spinner';
|
|
8
9
|
// Export types
|
|
9
10
|
export * from './types';
|
|
10
11
|
// Manifest data helper function
|
|
11
12
|
export declare function getManifestData(ecosystem?: string, packageName?: string): any;
|
|
12
13
|
// Version export
|
|
13
|
-
export declare const version = "
|
|
14
|
+
export declare const version = "3.0.1";
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/* Socket Lib - Built with esbuild */
|
|
2
|
-
var
|
|
2
|
+
var a=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var L=(n,r)=>{for(var t in r)a(n,t,{get:r[t],enumerable:!0})},s=(n,r,t,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of D(r))!x.call(n,i)&&i!==t&&a(n,i,{get:()=>r[i],enumerable:!(e=c(r,i))||e.enumerable});return n},o=(n,r,t)=>(s(n,r,"default"),t&&s(t,r,"default"));var S=n=>s(a({},"__esModule",{value:!0}),n);var f={};L(f,{LOG_SYMBOLS:()=>u.LOG_SYMBOLS,Logger:()=>u.Logger,Spinner:()=>d.Spinner,getDefaultLogger:()=>u.getDefaultLogger,getDefaultSpinner:()=>d.getDefaultSpinner,getManifestData:()=>l,version:()=>y});module.exports=S(f);var u=require("./logger"),d=require("./spinner");o(f,require("./types"),module.exports);function l(n,r){try{const t=require("./manifest.json");if(!n)return t;const e=t[n];if(!e)return;if(!r)return e;if(Array.isArray(e)){const g=e.find(([A,p])=>p.package===r);return g?g[1]:void 0}const i=e[r];return i?[r,i]:void 0}catch{return}}const y="3.0.1";0&&(module.exports={LOG_SYMBOLS,Logger,Spinner,getDefaultLogger,getDefaultSpinner,getManifestData,version,...require("./types")});
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * @fileoverview Main entry point for
|
|
5
|
-
"mappings": ";8cAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,
|
|
6
|
-
"names": ["index_exports", "__export", "getManifestData", "version", "__toCommonJS", "
|
|
4
|
+
"sourcesContent": ["/**\n * @fileoverview Main entry point for @socketsecurity/lib.\n * Clean, organized exports for better developer experience.\n */\n\n// Export logger utilities for convenience\nexport { getDefaultLogger, Logger, LOG_SYMBOLS } from './logger'\n// Export spinner utilities for convenience\nexport { getDefaultSpinner, Spinner } from './spinner'\n// Export types\nexport * from './types'\n\n// Manifest data helper function\nexport function getManifestData(ecosystem?: string, packageName?: string) {\n try {\n const manifestData = require('../manifest.json')\n\n if (!ecosystem) {\n return manifestData\n }\n\n const ecoData = manifestData[ecosystem]\n if (!ecoData) {\n return undefined\n }\n\n if (!packageName) {\n return ecoData\n }\n\n // ecoData is an array of [purl, data] entries\n if (Array.isArray(ecoData)) {\n const entry = ecoData.find(\n ([_purl, data]) => data.package === packageName,\n )\n return entry ? entry[1] : undefined\n }\n\n // Fallback for object-based structure\n const pkgData = ecoData[packageName]\n return pkgData ? [packageName, pkgData] : undefined\n } catch {\n return undefined\n }\n}\n\n// Version export\nexport const version = '3.0.1'\n"],
|
|
5
|
+
"mappings": ";8cAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,+KAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GAMA,IAAAK,EAAsD,oBAEtDC,EAA2C,qBAE3CC,EAAAP,EAAc,mBAVd,gBAaO,SAASE,EAAgBM,EAAoBC,EAAsB,CACxE,GAAI,CACF,MAAMC,EAAe,QAAQ,kBAAkB,EAE/C,GAAI,CAACF,EACH,OAAOE,EAGT,MAAMC,EAAUD,EAAaF,CAAS,EACtC,GAAI,CAACG,EACH,OAGF,GAAI,CAACF,EACH,OAAOE,EAIT,GAAI,MAAM,QAAQA,CAAO,EAAG,CAC1B,MAAMC,EAAQD,EAAQ,KACpB,CAAC,CAACE,EAAOC,CAAI,IAAMA,EAAK,UAAYL,CACtC,EACA,OAAOG,EAAQA,EAAM,CAAC,EAAI,MAC5B,CAGA,MAAMG,EAAUJ,EAAQF,CAAW,EACnC,OAAOM,EAAU,CAACN,EAAaM,CAAO,EAAI,MAC5C,MAAQ,CACN,MACF,CACF,CAGO,MAAMZ,EAAU",
|
|
6
|
+
"names": ["index_exports", "__export", "getManifestData", "version", "__toCommonJS", "import_logger", "import_spinner", "__reExport", "ecosystem", "packageName", "manifestData", "ecoData", "entry", "_purl", "data", "pkgData"]
|
|
7
7
|
}
|
package/dist/logger.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
/* Socket Lib - Built with esbuild */
|
|
2
|
-
var G=Object.create;var w=Object.defineProperty;var Y=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var H=Object.getPrototypeOf,N=Object.prototype.hasOwnProperty;var V=(e,t)=>{for(var s in t)w(e,s,{get:t[s],enumerable:!0})},A=(e,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of v(t))!N.call(e,o)&&o!==s&&w(e,o,{get:()=>t[o],enumerable:!(n=Y(t,o))||n.enumerable});return e};var W=(e,t,s)=>(s=e!=null?G(H(e)):{},A(t||!e||!e.__esModule?w(s,"default",{value:e,enumerable:!0}):s,e)),z=e=>A(w({},"__esModule",{value:!0}),e);var X={};
|
|
2
|
+
var G=Object.create;var w=Object.defineProperty;var Y=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var H=Object.getPrototypeOf,N=Object.prototype.hasOwnProperty;var V=(e,t)=>{for(var s in t)w(e,s,{get:t[s],enumerable:!0})},A=(e,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of v(t))!N.call(e,o)&&o!==s&&w(e,o,{get:()=>t[o],enumerable:!(n=Y(t,o))||n.enumerable});return e};var W=(e,t,s)=>(s=e!=null?G(H(e)):{},A(t||!e||!e.__esModule?w(s,"default",{value:e,enumerable:!0}):s,e)),z=e=>A(w({},"__esModule",{value:!0}),e);var X={};var P=W(require("./external/@socketregistry/is-unicode-supported")),j=W(require("./external/yoctocolors-cjs")),f=require("./strings"),_=require("./themes/context");const y=console,C=Reflect.apply,D=Reflect.construct;let L;function k(...e){return L===void 0&&(L=require("node:console").Console),D(L,e)}function F(){return j.default}function p(e,t,s){return typeof t=="string"?s[t](e):s.rgb(t[0],t[1],t[2])(e)}const m=(()=>{const e={__proto__:null};let t=!1;const s={__proto__:null},n=()=>{const r=(0,P.default)(),c=F(),a=(0,_.getTheme)(),g=a.colors.success,B=a.colors.error,M=a.colors.warning,$=a.colors.info,K=a.colors.step;e.fail=p(r?"\u2716":"\xD7",B,c),e.info=p(r?"\u2139":"i",$,c),e.step=p(r?"\u2192":">",K,c),e.success=p(r?"\u2714":"\u221A",g,c),e.warn=p(r?"\u26A0":"\u203C",M,c)},o=()=>{if(!t){n(),t=!0;for(const r in s)delete s[r]}},i=()=>{t&&n()};for(const r of Reflect.ownKeys(Reflect)){const c=Reflect[r];typeof c=="function"&&(s[r]=(...a)=>(o(),c(...a)))}return(0,_.onThemeChange)(()=>{i()}),new Proxy(e,s)})(),E=["_stderrErrorHandler","_stdoutErrorHandler","assert","clear","count","countReset","createTask","debug","dir","dirxml","error","info","log","table","time","timeEnd","timeLog","trace","warn"].filter(e=>typeof y[e]=="function").map(e=>[e,y[e].bind(y)]),I={__proto__:null,writable:!0,enumerable:!1,configurable:!0},J=1e3,b=new WeakMap,h=new WeakMap;let S;function q(){return S===void 0&&(S=Object.getOwnPropertySymbols(y)),S}const l=Symbol.for("logger.logCallCount++");let x;function R(){return x===void 0&&(x=q().find(e=>e.label==="kGroupIndentWidth")??Symbol("kGroupIndentWidth")),x}const u=Symbol.for("logger.lastWasBlank");class d{static LOG_SYMBOLS=m;#c;#s;#l;#a;#g="";#f="";#p=!1;#y=!1;#h=0;#o;#w;constructor(...t){h.set(this,t);const s=t[0];typeof s=="object"&&s!==null?(this.#o={__proto__:null,...s},this.#w=s.stdout):this.#o={__proto__:null}}#t(){U();let t=b.get(this);if(!t){const s=h.get(this)??[];if(s.length)t=k(...s);else{t=k({stdout:process.stdout,stderr:process.stderr});for(const{0:n,1:o}of E)t[n]=o}b.set(this,t),h.delete(this)}return t}get stderr(){if(!this.#l){const t=h.get(this)??[],s=new d(...t);s.#c=this,s.#s="stderr",s.#o={__proto__:null,...this.#o},this.#l=s}return this.#l}get stdout(){if(!this.#a){const t=h.get(this)??[],s=new d(...t);s.#c=this,s.#s="stdout",s.#o={__proto__:null,...this.#o},this.#a=s}return this.#a}#r(){return this.#c||this}#n(t){const s=this.#r();return t==="stderr"?s.#g:s.#f}#e(t,s){const n=this.#r();t==="stderr"?n.#g=s:n.#f=s}#d(t){const s=this.#r();return t==="stderr"?s.#p:s.#y}#u(t,s){const n=this.#r();t==="stderr"?n.#p=s:n.#y=s}#m(){return this.#s||"stderr"}#k(t,s,n){const o=this.#t(),i=s.at(0),r=typeof i=="string",c=n||(t==="log"?"stdout":"stderr"),a=this.#n(c),g=r?[(0,f.applyLinePrefix)(i,{prefix:a}),...s.slice(1)]:s;return C(o[t],o,g),this[u](r&&(0,f.isBlankString)(g[0]),c),this[l](),this}#b(t){return t.replace(/^[✖✗×⚠‼✔✓√ℹ→]\uFE0F?\s*/u,"")}#i(t,s){const n=this.#t();let o=s.at(0),i;typeof o=="string"?(o=this.#b(o),i=s.slice(1)):(i=s,o="");const r=this.#n("stderr");return n.error((0,f.applyLinePrefix)(`${m[t]} ${o}`,{prefix:r}),...i),this[u](!1,"stderr"),this[l](),this}get logCallCount(){return this.#r().#h}[l](){const t=this.#r();return t.#h+=1,this}[u](t,s){return s?this.#u(s,!!t):this.#s?this.#u(this.#s,!!t):(this.#u("stderr",!!t),this.#u("stdout",!!t)),this}assert(t,...s){return this.#t().assert(t,s[0],...s.slice(1)),this[u](!1),t?this:this[l]()}clearVisible(){if(this.#s)throw new Error("clearVisible() is only available on the main logger instance, not on stream-bound instances");const t=this.#t();return t.clear(),t._stdout.isTTY&&(this[u](!0),this.#h=0),this}count(t){return this.#t().count(t),this[u](!1),this[l]()}createTask(t){return{run:s=>{this.log(`Starting task: ${t}`);const n=s();return this.log(`Completed task: ${t}`),n}}}dedent(t=2){if(this.#s){const s=this.#n(this.#s);this.#e(this.#s,s.slice(0,-t))}else{const s=this.#n("stderr"),n=this.#n("stdout");this.#e("stderr",s.slice(0,-t)),this.#e("stdout",n.slice(0,-t))}return this}dir(t,s){return this.#t().dir(t,s),this[u](!1),this[l]()}dirxml(...t){return this.#t().dirxml(t),this[u](!1),this[l]()}error(...t){return this.#k("error",t)}errorNewline(){return this.#d("stderr")?this:this.error("")}fail(...t){return this.#i("fail",t)}group(...t){const{length:s}=t;return s&&C(this.log,this,t),this.indent(this[R()]),s&&(this[u](!1),this[l]()),this}groupCollapsed(...t){return C(this.group,this,t)}groupEnd(){return this.dedent(this[R()]),this}indent(t=2){const s=" ".repeat(Math.min(t,J));if(this.#s){const n=this.#n(this.#s);this.#e(this.#s,n+s)}else{const n=this.#n("stderr"),o=this.#n("stdout");this.#e("stderr",n+s),this.#e("stdout",o+s)}return this}info(...t){return this.#i("info",t)}log(...t){return this.#k("log",t)}logNewline(){return this.#d("stdout")?this:this.log("")}resetIndent(){return this.#s?this.#e(this.#s,""):(this.#e("stderr",""),this.#e("stdout","")),this}step(t,...s){this.#d("stdout")||this.log("");const n=this.#b(t),o=this.#n("stdout");return this.#t().log((0,f.applyLinePrefix)(`${m.step} ${n}`,{prefix:o}),...s),this[u](!1,"stdout"),this[l](),this}substep(t,...s){const n=` ${t}`;return this.log(n,...s)}success(...t){return this.#i("success",t)}done(...t){return this.#i("success",t)}table(t,s){return this.#t().table(t,s),this[u](!1),this[l]()}timeEnd(t){return this.#t().timeEnd(t),this[u](!1),this[l]()}timeLog(t,...s){return this.#t().timeLog(t,...s),this[u](!1),this[l]()}trace(t,...s){return this.#t().trace(t,...s),this[u](!1),this[l]()}warn(...t){return this.#i("warn",t)}write(t){const s=this.#t(),n=h.get(this)??[];return(this.#w||n[0]?.stdout||s._stdout).write(t),this[u](!1),this}progress(t){const s=this.#t();return(this.#m()==="stderr"?s._stderr:s._stdout).write(`\u2234 ${t}`),this[u](!1),this}clearLine(){const t=this.#t(),n=this.#m()==="stderr"?t._stderr:t._stdout;return n.isTTY?(n.cursorTo(0),n.clearLine(0)):n.write("\r\x1B[K"),this}}let O=!1;function U(){if(O)return;O=!0;const e=[[R(),{...I,value:2}],[Symbol.toStringTag,{__proto__:null,configurable:!0,value:"logger"}]];for(const{0:t,1:s}of Object.entries(y))if(!d.prototype[t]&&typeof s=="function"){const{[t]:n}={[t](...o){let i=b.get(this);if(i===void 0){const c=h.get(this)??[];if(h.delete(this),c.length)i=k(...c);else{i=k({stdout:process.stdout,stderr:process.stderr});for(const{0:a,1:g}of E)i[a]=g}b.set(this,i)}const r=i[t](...o);return r===void 0||r===i?this:r}};e.push([t,{...I,value:n}])}Object.defineProperties(d.prototype,Object.fromEntries(e))}let T;function Q(){return T===void 0&&(T=new d),T}module.exports = {
|
|
3
|
+
LOG_SYMBOLS: m,
|
|
4
|
+
Logger: d,
|
|
5
|
+
getDefaultLogger: Q,
|
|
6
|
+
incLogCallCountSymbol: l,
|
|
7
|
+
lastWasBlankSymbol: u
|
|
8
|
+
};
|
|
3
9
|
//# sourceMappingURL=logger.js.map
|
package/dist/signal-exit.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/* Socket Lib - Built with esbuild */
|
|
2
|
-
var g=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var P=Object.prototype.hasOwnProperty;var T=(e,t)=>{for(var s in t)g(e,s,{get:t[s],enumerable:!0})},w=(e,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of h(t))!P.call(e,r)&&r!==s&&g(e,r,{get:()=>t[r],enumerable:!(n=G(t,r))||n.enumerable});return e};var R=e=>w(g({},"__esModule",{value:!0}),e);var U={};T(U,{load:()=>
|
|
2
|
+
var g=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var P=Object.prototype.hasOwnProperty;var T=(e,t)=>{for(var s in t)g(e,s,{get:t[s],enumerable:!0})},w=(e,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of h(t))!P.call(e,r)&&r!==s&&g(e,r,{get:()=>t[r],enumerable:!(n=G(t,r))||n.enumerable});return e};var R=e=>w(g({},"__esModule",{value:!0}),e);var U={};T(U,{load:()=>L,onExit:()=>k,signals:()=>C,unload:()=>_});module.exports=R(U);const S=Reflect.apply,i=globalThis.process,p=i?.emit,y=i?.platform??"",x=i?.reallyExit,b=y==="win32";let m;function N(){return m===void 0&&(m=require("node:events")),m}let o;function d(){if(o===void 0){if(i?.__signal_exit_emitter__)o=i.__signal_exit_emitter__;else if(i){const e=N().EventEmitter;o=i.__signal_exit_emitter__=new e,o.count=0,o.emitted={__proto__:null}}o&&!o.infinite&&(o.setMaxListeners(Number.POSITIVE_INFINITY),o.infinite=!0)}return o}let c;function v(){if(c===void 0){c={__proto__:null};const e=d(),t=E();for(const s of t)c[s]=function(){if((i?.listeners(s)||[]).length===e.count){const a=b&&s==="SIGHUP"?"SIGINT":s;i?.kill(i?.pid,a)}}}return c}let l;function E(){return l===void 0&&(l=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"],b||l.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT"),y==="linux"&&l.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")),l}function u(e,t,s){const n=d();n.emitted?.[e]||(n.emitted&&(n.emitted[e]=!0),n.emit(e,t,s))}let f=!1;function L(){if(f||!i)return;f=!0;const e=d();e.count!==void 0&&(e.count+=1);const t=E(),s=v();l=t.filter(n=>{try{return i.on(n,s[n]),!0}catch{}return!1}),i.emit=O,i.reallyExit=M}function O(e,t,...s){if(e==="exit"){let n=t;if(n===void 0){const I=i?.exitCode;n=typeof I=="number"?I:void 0}else i&&(i.exitCode=n);const r=S(p,this,[e,n,...s]),a=typeof n=="number"?n:null;return r}return S(p,this,[e,t,...s])}function M(e){const t=e||0;throw i&&(i.exitCode=t),S(x,i,[t]),new Error("processReallyExit should never return")}function k(e,t){if(!i)return function(){};if(typeof e!="function")throw new TypeError("a callback must be provided for exit handler");const{alwaysLast:s}={__proto__:null,...t};let n="exit";s&&(n="afterexit");const r=d();return r.on(n,e),function(){r.removeListener(n,e),!r.listeners("exit").length&&r.listeners("afterexit").length}}function C(){return l}function _(){if(!f||!i)return;f=!1;const e=E(),t=v();for(const n of e)try{i.removeListener(n,t[n])}catch{}i.emit=p,x!==void 0&&(i.reallyExit=x);const s=d();s.count!==void 0&&(s.count-=1)}0&&(module.exports={load,onExit,signals,unload});
|
|
3
3
|
//# sourceMappingURL=signal-exit.js.map
|
package/dist/signal-exit.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/signal-exit.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * @fileoverview Process signal handling utilities.\n * Provides cross-platform signal exit detection and cleanup handlers.\n */\n\n// Inlined signal-exit:\n// https://socket.dev/npm/package/signal-exit/overview/4.1.0\n// ISC License\n// Copyright (c) 2015-2023 Benjamin Coe, Isaac Z. Schlueter, and Contributors\n\n// This is not the set of all possible signals.\n//\n// It IS, however, the set of all signals that trigger\n// an exit on either Linux or BSD systems. Linux is a\n// superset of the signal names supported on BSD, and\n// the unknown signals just fail to register, so we can\n// catch that easily enough.\n//\n// Don't bother with SIGKILL. It's uncatchable, which\n// means that we can't fire any callbacks anyway.\n//\n// If a user does happen to register a handler on a non-\n// fatal signal like SIGWINCH or something, and then\n// exit, it'll end up firing `process.emit('exit')`, so\n// the handler will be fired anyway.\n//\n// SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised\n// artificially, inherently leave the process in a\n// state from which it is not safe to try and enter JS\n// listeners.\n\n// IMPORTANT: Do not use destructuring here - use direct assignment instead.\n// tsgo has a bug that incorrectly transpiles destructured exports, resulting in\n// `exports.SomeName = void 0;` which causes runtime errors.\n// See: https://github.com/SocketDev/socket-packageurl-js/issues/3\nconst ReflectApply = Reflect.apply\nconst globalProcess = globalThis.process as\n | (NodeJS.Process & {\n __signal_exit_emitter__?: any\n reallyExit?: (code?: number | undefined) => never\n })\n | undefined\nconst originalProcessEmit = globalProcess?.emit\nconst platform = globalProcess?.platform ?? ''\nconst originalProcessReallyExit = globalProcess?.reallyExit as\n | ((code?: number | undefined) => never)\n | undefined\nconst WIN32 = platform === 'win32'\n\nlet _events: typeof import('node:events') | undefined\n/*@__NO_SIDE_EFFECTS__*/\nfunction getEvents() {\n if (_events === undefined) {\n // Use non-'node:' prefixed require to avoid Webpack errors.\n\n _events = /*@__PURE__*/ require('node:events')\n }\n return _events as typeof import('node:events')\n}\n\n// Type for tracking emitted signals.\ntype EmittedSignals = {\n // Using string as signals can include custom events like 'exit' and 'afterexit'.\n [signal: string]: boolean\n}\n\ntype SignalExitEmitter = import('node:events').EventEmitter & {\n count?: number\n emitted?: EmittedSignals\n infinite?: boolean\n}\nlet _emitter: SignalExitEmitter | undefined\n/*@__NO_SIDE_EFFECTS__*/\nfunction getEmitter() {\n if (_emitter === undefined) {\n if (globalProcess?.__signal_exit_emitter__) {\n _emitter = globalProcess.__signal_exit_emitter__\n } else if (globalProcess) {\n const EventEmitter = getEvents().EventEmitter\n _emitter = globalProcess.__signal_exit_emitter__ =\n new EventEmitter() as SignalExitEmitter\n _emitter.count = 0\n _emitter.emitted = { __proto__: null } as unknown as EmittedSignals\n }\n // Because this emitter is a global, we have to check to see if a\n // previous version of this library failed to enable infinite listeners.\n // I know what you're about to say. But literally everything about\n // signal-exit is a compromise with evil. Get used to it.\n if (_emitter && !_emitter.infinite) {\n _emitter.setMaxListeners(Number.POSITIVE_INFINITY)\n _emitter.infinite = true\n }\n }\n return _emitter as SignalExitEmitter\n}\n\ntype SignalListener = () => void\n// Type for signal listeners indexed by signal name.\ntype SignalListenerMap = {\n [signal: string]: SignalListener\n}\nlet _sigListeners: SignalListenerMap | undefined\n/*@__NO_SIDE_EFFECTS__*/\nfunction getSignalListeners() {\n if (_sigListeners === undefined) {\n _sigListeners = { __proto__: null } as unknown as SignalListenerMap\n const emitter = getEmitter()\n const sigs = getSignals()\n for (const sig of sigs) {\n _sigListeners[sig] = function listener() {\n // If there are no other listeners, an exit is coming!\n // Simplest way: remove us and then re-send the signal.\n // We know that this will kill the process, so we can\n // safely emit now.\n const listeners = globalProcess?.listeners(sig as NodeJS.Signals) || []\n if (listeners.length === emitter.count) {\n unload()\n emit('exit', null, sig)\n emit('afterexit', null, sig)\n // \"SIGHUP\" throws an `ENOSYS` error on Windows,\n // so use a supported signal instead.\n const killSig = WIN32 && sig === 'SIGHUP' ? 'SIGINT' : sig\n globalProcess?.kill(globalProcess?.pid, killSig)\n }\n }\n }\n }\n return _sigListeners as SignalListenerMap\n}\n\nlet _signals: string[] | undefined\n/*@__NO_SIDE_EFFECTS__*/\nfunction getSignals() {\n if (_signals === undefined) {\n _signals = ['SIGABRT', 'SIGALRM', 'SIGHUP', 'SIGINT', 'SIGTERM']\n if (!WIN32) {\n _signals.push(\n 'SIGVTALRM',\n 'SIGXCPU',\n 'SIGXFSZ',\n 'SIGUSR2',\n 'SIGTRAP',\n 'SIGSYS',\n 'SIGQUIT',\n 'SIGIOT',\n // should detect profiler and enable/disable accordingly.\n // see #21\n // 'SIGPROF'\n )\n }\n if (platform === 'linux') {\n _signals.push('SIGIO', 'SIGPOLL', 'SIGPWR', 'SIGSTKFLT', 'SIGUNUSED')\n }\n }\n return _signals as string[]\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nfunction emit(event: string, code: number | null, signal: string | null): void {\n const emitter = getEmitter()\n if (emitter.emitted?.[event]) {\n return\n }\n if (emitter.emitted) {\n emitter.emitted[event] = true\n }\n emitter.emit(event, code, signal)\n}\n\nlet loaded = false\n\n/**\n * Load signal handlers and hook into process exit events.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function load(): void {\n if (loaded || !globalProcess) {\n return\n }\n loaded = true\n\n // This is the number of onSignalExit's that are in play.\n // It's important so that we can count the correct number of\n // listeners on signals, and don't wait for the other one to\n // handle it instead of us.\n const emitter = getEmitter()\n if (emitter.count !== undefined) {\n emitter.count += 1\n }\n\n const sigs = getSignals()\n const sigListeners = getSignalListeners()\n _signals = sigs.filter(sig => {\n try {\n globalProcess.on(\n sig as NodeJS.Signals,\n sigListeners[sig] as SignalListener,\n )\n return true\n } catch {}\n return false\n })\n\n globalProcess.emit = processEmit as typeof globalProcess.emit\n globalProcess.reallyExit = processReallyExit\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nfunction processEmit(\n this: NodeJS.Process,\n eventName: string,\n exitCode?: number | undefined,\n ...args: any[]\n): boolean {\n if (eventName === 'exit') {\n let actualExitCode = exitCode\n if (actualExitCode === undefined) {\n const processExitCode = globalProcess?.exitCode\n actualExitCode =\n typeof processExitCode === 'number' ? processExitCode : undefined\n } else if (globalProcess) {\n globalProcess.exitCode = actualExitCode\n }\n const result = ReflectApply(\n originalProcessEmit as (...args: unknown[]) => boolean,\n this,\n [eventName, actualExitCode, ...args],\n ) as boolean\n const numExitCode =\n typeof actualExitCode === 'number' ? actualExitCode : null\n emit('exit', numExitCode, null)\n emit('afterexit', numExitCode, null)\n return result\n }\n return ReflectApply(\n originalProcessEmit as (...args: unknown[]) => boolean,\n this,\n [eventName, exitCode, ...args],\n ) as boolean\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nfunction processReallyExit(code?: number | undefined): never {\n const exitCode = code || 0\n if (globalProcess) {\n globalProcess.exitCode = exitCode\n }\n emit('exit', exitCode, null)\n emit('afterexit', exitCode, null)\n ReflectApply(\n originalProcessReallyExit as (code?: number) => never,\n globalProcess,\n [exitCode],\n )\n throw new Error('processReallyExit should never return')\n}\n\nexport interface OnExitOptions {\n alwaysLast?: boolean\n}\n\n/**\n * Register a callback to run on process exit or signal.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function onExit(\n cb: (code: number | null, signal: string | null) => void,\n options?: OnExitOptions | undefined,\n): () => void {\n if (!globalProcess) {\n return function remove() {}\n }\n if (typeof cb !== 'function') {\n throw new TypeError('a callback must be provided for exit handler')\n }\n if (loaded === false) {\n load()\n }\n const { alwaysLast } = { __proto__: null, ...options } as OnExitOptions\n\n let eventName = 'exit'\n if (alwaysLast) {\n eventName = 'afterexit'\n }\n\n const emitter = getEmitter()\n emitter.on(eventName, cb)\n\n return function remove() {\n emitter.removeListener(eventName, cb)\n if (\n !emitter.listeners('exit').length &&\n !emitter.listeners('afterexit').length\n ) {\n unload()\n }\n }\n}\n\n/**\n * Get the list of signals that are currently being monitored.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function signals(): string[] | undefined {\n return _signals\n}\n\n/**\n * Unload signal handlers and restore original process behavior.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function unload(): void {\n if (!loaded || !globalProcess) {\n return\n }\n loaded = false\n\n const sigs = getSignals()\n const sigListeners = getSignalListeners()\n for (const sig of sigs) {\n try {\n globalProcess.removeListener(\n sig as NodeJS.Signals,\n sigListeners[sig] as SignalListener,\n )\n } catch {}\n }\n globalProcess.emit = originalProcessEmit as typeof globalProcess.emit\n if (originalProcessReallyExit !== undefined) {\n globalProcess.reallyExit = originalProcessReallyExit\n }\n const emitter = getEmitter()\n if (emitter.count !== undefined) {\n emitter.count -= 1\n }\n}\n"],
|
|
4
|
+
"sourcesContent": ["/**\n * @fileoverview Process signal handling utilities.\n * Provides cross-platform signal exit detection and cleanup handlers.\n */\n\n// Inlined signal-exit:\n// https://socket.dev/npm/package/signal-exit/overview/4.1.0\n// ISC License\n// Copyright (c) 2015-2023 Benjamin Coe, Isaac Z. Schlueter, and Contributors\n\n// This is not the set of all possible signals.\n//\n// It IS, however, the set of all signals that trigger\n// an exit on either Linux or BSD systems. Linux is a\n// superset of the signal names supported on BSD, and\n// the unknown signals just fail to register, so we can\n// catch that easily enough.\n//\n// Don't bother with SIGKILL. It's uncatchable, which\n// means that we can't fire any callbacks anyway.\n//\n// If a user does happen to register a handler on a non-\n// fatal signal like SIGWINCH or something, and then\n// exit, it'll end up firing `process.emit('exit')`, so\n// the handler will be fired anyway.\n//\n// SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised\n// artificially, inherently leave the process in a\n// state from which it is not safe to try and enter JS\n// listeners.\n\n// IMPORTANT: Do not use destructuring here - use direct assignment instead.\n// tsgo has a bug that incorrectly transpiles destructured exports, resulting in\n// `exports.SomeName = void 0;` which causes runtime errors.\n// See: https://github.com/SocketDev/socket-packageurl-js/issues/3\nconst ReflectApply = Reflect.apply\nconst globalProcess = globalThis.process as\n | (NodeJS.Process & {\n __signal_exit_emitter__?: import('node:events').EventEmitter\n reallyExit?: (code?: number | undefined) => never\n })\n | undefined\nconst originalProcessEmit = globalProcess?.emit\nconst platform = globalProcess?.platform ?? ''\nconst originalProcessReallyExit = globalProcess?.reallyExit as\n | ((code?: number | undefined) => never)\n | undefined\nconst WIN32 = platform === 'win32'\n\nlet _events: typeof import('node:events') | undefined\n/*@__NO_SIDE_EFFECTS__*/\nfunction getEvents() {\n if (_events === undefined) {\n // Use non-'node:' prefixed require to avoid Webpack errors.\n\n _events = /*@__PURE__*/ require('node:events')\n }\n return _events as typeof import('node:events')\n}\n\n// Type for tracking emitted signals.\ntype EmittedSignals = {\n // Using string as signals can include custom events like 'exit' and 'afterexit'.\n [signal: string]: boolean\n}\n\ntype SignalExitEmitter = import('node:events').EventEmitter & {\n count?: number\n emitted?: EmittedSignals\n infinite?: boolean\n}\nlet _emitter: SignalExitEmitter | undefined\n/*@__NO_SIDE_EFFECTS__*/\nfunction getEmitter() {\n if (_emitter === undefined) {\n if (globalProcess?.__signal_exit_emitter__) {\n _emitter = globalProcess.__signal_exit_emitter__\n } else if (globalProcess) {\n const EventEmitter = getEvents().EventEmitter\n _emitter = globalProcess.__signal_exit_emitter__ =\n new EventEmitter() as SignalExitEmitter\n _emitter.count = 0\n _emitter.emitted = { __proto__: null } as unknown as EmittedSignals\n }\n // Because this emitter is a global, we have to check to see if a\n // previous version of this library failed to enable infinite listeners.\n // I know what you're about to say. But literally everything about\n // signal-exit is a compromise with evil. Get used to it.\n if (_emitter && !_emitter.infinite) {\n _emitter.setMaxListeners(Number.POSITIVE_INFINITY)\n _emitter.infinite = true\n }\n }\n return _emitter as SignalExitEmitter\n}\n\ntype SignalListener = () => void\n// Type for signal listeners indexed by signal name.\ntype SignalListenerMap = {\n [signal: string]: SignalListener\n}\nlet _sigListeners: SignalListenerMap | undefined\n/*@__NO_SIDE_EFFECTS__*/\nfunction getSignalListeners() {\n if (_sigListeners === undefined) {\n _sigListeners = { __proto__: null } as unknown as SignalListenerMap\n const emitter = getEmitter()\n const sigs = getSignals()\n for (const sig of sigs) {\n _sigListeners[sig] = function listener() {\n // If there are no other listeners, an exit is coming!\n // Simplest way: remove us and then re-send the signal.\n // We know that this will kill the process, so we can\n // safely emit now.\n const listeners = globalProcess?.listeners(sig as NodeJS.Signals) || []\n if (listeners.length === emitter.count) {\n unload()\n emit('exit', null, sig)\n emit('afterexit', null, sig)\n // \"SIGHUP\" throws an `ENOSYS` error on Windows,\n // so use a supported signal instead.\n const killSig = WIN32 && sig === 'SIGHUP' ? 'SIGINT' : sig\n globalProcess?.kill(globalProcess?.pid, killSig)\n }\n }\n }\n }\n return _sigListeners as SignalListenerMap\n}\n\nlet _signals: string[] | undefined\n/*@__NO_SIDE_EFFECTS__*/\nfunction getSignals() {\n if (_signals === undefined) {\n _signals = ['SIGABRT', 'SIGALRM', 'SIGHUP', 'SIGINT', 'SIGTERM']\n if (!WIN32) {\n _signals.push(\n 'SIGVTALRM',\n 'SIGXCPU',\n 'SIGXFSZ',\n 'SIGUSR2',\n 'SIGTRAP',\n 'SIGSYS',\n 'SIGQUIT',\n 'SIGIOT',\n // should detect profiler and enable/disable accordingly.\n // see #21\n // 'SIGPROF'\n )\n }\n if (platform === 'linux') {\n _signals.push('SIGIO', 'SIGPOLL', 'SIGPWR', 'SIGSTKFLT', 'SIGUNUSED')\n }\n }\n return _signals as string[]\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nfunction emit(event: string, code: number | null, signal: string | null): void {\n const emitter = getEmitter()\n if (emitter.emitted?.[event]) {\n return\n }\n if (emitter.emitted) {\n emitter.emitted[event] = true\n }\n emitter.emit(event, code, signal)\n}\n\nlet loaded = false\n\n/**\n * Load signal handlers and hook into process exit events.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function load(): void {\n if (loaded || !globalProcess) {\n return\n }\n loaded = true\n\n // This is the number of onSignalExit's that are in play.\n // It's important so that we can count the correct number of\n // listeners on signals, and don't wait for the other one to\n // handle it instead of us.\n const emitter = getEmitter()\n if (emitter.count !== undefined) {\n emitter.count += 1\n }\n\n const sigs = getSignals()\n const sigListeners = getSignalListeners()\n _signals = sigs.filter(sig => {\n try {\n globalProcess.on(\n sig as NodeJS.Signals,\n sigListeners[sig] as SignalListener,\n )\n return true\n } catch {}\n return false\n })\n\n globalProcess.emit = processEmit as typeof globalProcess.emit\n globalProcess.reallyExit = processReallyExit\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nfunction processEmit(\n this: NodeJS.Process,\n eventName: string,\n exitCode?: number | undefined,\n ...args: any[]\n): boolean {\n if (eventName === 'exit') {\n let actualExitCode = exitCode\n if (actualExitCode === undefined) {\n const processExitCode = globalProcess?.exitCode\n actualExitCode =\n typeof processExitCode === 'number' ? processExitCode : undefined\n } else if (globalProcess) {\n globalProcess.exitCode = actualExitCode\n }\n const result = ReflectApply(\n originalProcessEmit as (...args: unknown[]) => boolean,\n this,\n [eventName, actualExitCode, ...args],\n ) as boolean\n const numExitCode =\n typeof actualExitCode === 'number' ? actualExitCode : null\n emit('exit', numExitCode, null)\n emit('afterexit', numExitCode, null)\n return result\n }\n return ReflectApply(\n originalProcessEmit as (...args: unknown[]) => boolean,\n this,\n [eventName, exitCode, ...args],\n ) as boolean\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nfunction processReallyExit(code?: number | undefined): never {\n const exitCode = code || 0\n if (globalProcess) {\n globalProcess.exitCode = exitCode\n }\n emit('exit', exitCode, null)\n emit('afterexit', exitCode, null)\n ReflectApply(\n originalProcessReallyExit as (code?: number) => never,\n globalProcess,\n [exitCode],\n )\n throw new Error('processReallyExit should never return')\n}\n\nexport interface OnExitOptions {\n alwaysLast?: boolean\n}\n\n/**\n * Register a callback to run on process exit or signal.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function onExit(\n cb: (code: number | null, signal: string | null) => void,\n options?: OnExitOptions | undefined,\n): () => void {\n if (!globalProcess) {\n return function remove() {}\n }\n if (typeof cb !== 'function') {\n throw new TypeError('a callback must be provided for exit handler')\n }\n if (loaded === false) {\n load()\n }\n const { alwaysLast } = { __proto__: null, ...options } as OnExitOptions\n\n let eventName = 'exit'\n if (alwaysLast) {\n eventName = 'afterexit'\n }\n\n const emitter = getEmitter()\n emitter.on(eventName, cb)\n\n return function remove() {\n emitter.removeListener(eventName, cb)\n if (\n !emitter.listeners('exit').length &&\n !emitter.listeners('afterexit').length\n ) {\n unload()\n }\n }\n}\n\n/**\n * Get the list of signals that are currently being monitored.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function signals(): string[] | undefined {\n return _signals\n}\n\n/**\n * Unload signal handlers and restore original process behavior.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function unload(): void {\n if (!loaded || !globalProcess) {\n return\n }\n loaded = false\n\n const sigs = getSignals()\n const sigListeners = getSignalListeners()\n for (const sig of sigs) {\n try {\n globalProcess.removeListener(\n sig as NodeJS.Signals,\n sigListeners[sig] as SignalListener,\n )\n } catch {}\n }\n globalProcess.emit = originalProcessEmit as typeof globalProcess.emit\n if (originalProcessReallyExit !== undefined) {\n globalProcess.reallyExit = originalProcessReallyExit\n }\n const emitter = getEmitter()\n if (emitter.count !== undefined) {\n emitter.count -= 1\n }\n}\n"],
|
|
5
5
|
"mappings": ";4ZAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,UAAAE,EAAA,WAAAC,EAAA,YAAAC,EAAA,WAAAC,IAAA,eAAAC,EAAAN,GAmCA,MAAMO,EAAe,QAAQ,MACvBC,EAAgB,WAAW,QAM3BC,EAAsBD,GAAe,KACrCE,EAAWF,GAAe,UAAY,GACtCG,EAA4BH,GAAe,WAG3CI,EAAQF,IAAa,QAE3B,IAAIG,EAEJ,SAASC,GAAY,CACn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EAAY,aAGd,MAAMd,EAAUJ,EAAW,EAC3B,OAAAI,EAAQ,GAAGc,EAAWO,CAAE,EAEjB,UAAkB,CACvBrB,EAAQ,eAAec,EAAWO,CAAE,EAElC,CAACrB,EAAQ,UAAU,MAAM,EAAE,QAC1BA,EAAQ,UAAU,WAAW,EAAE,MAIpC,CACF,CAMO,SAAShB,GAAgC,CAC9C,OAAOqB,CACT,CAMO,SAASpB,GAAe,CAC7B,GAAI,CAACyB,GAAU,CAACtB,EACd,OAEFsB,EAAS,GAET,MAAMT,EAAOC,EAAW,EAClBS,EAAeZ,EAAmB,EACxC,UAAWI,KAAOF,EAChB,GAAI,CACFb,EAAc,eACZe,EACAQ,EAAaR,CAAG,CAClB,CACF,MAAQ,CAAC,CAEXf,EAAc,KAAOC,EACjBE,IAA8B,SAChCH,EAAc,WAAaG,GAE7B,MAAMS,EAAUJ,EAAW,EACvBI,EAAQ,QAAU,SACpBA,EAAQ,OAAS,EAErB",
|
|
6
6
|
"names": ["signal_exit_exports", "__export", "load", "onExit", "signals", "unload", "__toCommonJS", "ReflectApply", "globalProcess", "originalProcessEmit", "platform", "originalProcessReallyExit", "WIN32", "_events", "getEvents", "_emitter", "getEmitter", "EventEmitter", "_sigListeners", "getSignalListeners", "emitter", "sigs", "getSignals", "sig", "killSig", "_signals", "emit", "event", "code", "signal", "loaded", "sigListeners", "processEmit", "processReallyExit", "eventName", "exitCode", "args", "actualExitCode", "processExitCode", "result", "numExitCode", "cb", "options", "alwaysLast"]
|
|
7
7
|
}
|
package/dist/sorts.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/* Socket Lib - Built with esbuild */
|
|
2
|
-
var i=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var p=(
|
|
2
|
+
var i=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var p=(t,r)=>{for(var n in r)i(t,n,{get:r[n],enumerable:!0})},d=(t,r,n,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let e of l(r))!m.call(t,e)&&e!==n&&i(t,e,{get:()=>r[e],enumerable:!(o=f(r,e))||o.enumerable});return t};var g=t=>d(i({},"__esModule",{value:!0}),t);var x={};p(x,{compareSemver:()=>v,compareStr:()=>y,localeCompare:()=>S,naturalCompare:()=>c,naturalSorter:()=>F});module.exports=g(x);let u;function S(t,r){return u===void 0&&(u=new Intl.Collator().compare),u(t,r)}let a;function c(t,r){return a===void 0&&(a=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}).compare),a(t,r)}let s;function F(t){return s===void 0&&(s=require("./external/fast-sort").createNewSortInstance({comparer:c})),s(t)}function y(t,r){return t<r?-1:t>r?1:0}function v(t,r){const n=require("./external/semver"),o=n.valid(t),e=n.valid(r);return!o&&!e?0:o?e?n.compare(t,r):1:-1}0&&(module.exports={compareSemver,compareStr,localeCompare,naturalCompare,naturalSorter});
|
|
3
3
|
//# sourceMappingURL=sorts.js.map
|
package/dist/sorts.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/sorts.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * @fileoverview Sorting comparison functions including locale-aware and natural sorting.\n * Provides various comparison utilities for arrays and collections.\n */\n\nlet _localeCompare: ((x: string, y: string) => number) | undefined\n/**\n * Compare two strings using locale-aware comparison.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function localeCompare(x: string, y: string): number {\n if (_localeCompare === undefined) {\n // Lazily call new Intl.Collator() because in Node it can take 10-14ms.\n _localeCompare = new Intl.Collator().compare\n }\n return _localeCompare(x, y)\n}\n\nlet _naturalCompare: ((x: string, y: string) => number) | undefined\n/**\n * Compare two strings using natural sorting (numeric-aware, case-insensitive).\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function naturalCompare(x: string, y: string): number {\n if (_naturalCompare === undefined) {\n // Lazily call new Intl.Collator() because in Node it can take 10-14ms.\n _naturalCompare = new Intl.Collator(\n // The `undefined` locale means it uses the default locale of the user's\n // environment.\n undefined,\n {\n // Enables numeric sorting: numbers in strings are compared by value,\n // e.g. 'file2' comes before 'file10' as numbers and not 'file10' before\n // 'file2' as plain text.\n numeric: true,\n // Makes the comparison case-insensitive and ignores diacritics, e.g.\n // 'a', 'A', and '\u00E1' are treated as equivalent.\n sensitivity: 'base',\n },\n ).compare\n }\n return _naturalCompare(x, y)\n}\n\n// Type for fast-sort sorter function.\ntype FastSortFunction = ReturnType<\n typeof import('fast-sort').createNewSortInstance\n>\n\nlet _naturalSorter: FastSortFunction | undefined\n/**\n * Sort an array using natural comparison.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function naturalSorter<T>(\n arrayToSort: T[],\n): ReturnType<FastSortFunction> {\n if (_naturalSorter === undefined) {\n const fastSort
|
|
5
|
-
"mappings": ";4ZAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,EAAA,eAAAC,EAAA,kBAAAC,EAAA,mBAAAC,EAAA,kBAAAC,IAAA,eAAAC,EAAAP,GAKA,IAAIQ,EAKG,SAASJ,EAAcK,EAAWC,EAAmB,CAC1D,OAAIF,IAAmB,SAErBA,EAAiB,IAAI,KAAK,SAAS,EAAE,SAEhCA,EAAeC,EAAGC,CAAC,CAC5B,CAEA,IAAIC,EAKG,SAASN,EAAeI,EAAWC,EAAmB,CAC3D,OAAIC,IAAoB,SAEtBA,EAAkB,IAAI,KAAK,SAGzB,OACA,CAIE,QAAS,GAGT,YAAa,MACf,CACF,EAAE,SAEGA,EAAgBF,EAAGC,CAAC,CAC7B,CAOA,IAAIE,EAKG,SAASN,EACdO,EAC8B,CAC9B,OAAID,IAAmB,
|
|
4
|
+
"sourcesContent": ["/**\n * @fileoverview Sorting comparison functions including locale-aware and natural sorting.\n * Provides various comparison utilities for arrays and collections.\n */\n\nlet _localeCompare: ((x: string, y: string) => number) | undefined\n/**\n * Compare two strings using locale-aware comparison.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function localeCompare(x: string, y: string): number {\n if (_localeCompare === undefined) {\n // Lazily call new Intl.Collator() because in Node it can take 10-14ms.\n _localeCompare = new Intl.Collator().compare\n }\n return _localeCompare(x, y)\n}\n\nlet _naturalCompare: ((x: string, y: string) => number) | undefined\n/**\n * Compare two strings using natural sorting (numeric-aware, case-insensitive).\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function naturalCompare(x: string, y: string): number {\n if (_naturalCompare === undefined) {\n // Lazily call new Intl.Collator() because in Node it can take 10-14ms.\n _naturalCompare = new Intl.Collator(\n // The `undefined` locale means it uses the default locale of the user's\n // environment.\n undefined,\n {\n // Enables numeric sorting: numbers in strings are compared by value,\n // e.g. 'file2' comes before 'file10' as numbers and not 'file10' before\n // 'file2' as plain text.\n numeric: true,\n // Makes the comparison case-insensitive and ignores diacritics, e.g.\n // 'a', 'A', and '\u00E1' are treated as equivalent.\n sensitivity: 'base',\n },\n ).compare\n }\n return _naturalCompare(x, y)\n}\n\n// Type for fast-sort sorter function.\ntype FastSortFunction = ReturnType<\n typeof import('fast-sort').createNewSortInstance\n>\n\nlet _naturalSorter: FastSortFunction | undefined\n/**\n * Sort an array using natural comparison.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function naturalSorter<T>(\n arrayToSort: T[],\n): ReturnType<FastSortFunction> {\n if (_naturalSorter === undefined) {\n const fastSort =\n /*@__PURE__*/ require('./external/fast-sort') as typeof import('fast-sort')\n _naturalSorter = fastSort.createNewSortInstance({\n comparer: naturalCompare,\n }) as FastSortFunction\n }\n return (_naturalSorter as FastSortFunction)(arrayToSort)\n}\n\n/**\n * Simple string comparison.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function compareStr(a: string, b: string): number {\n return a < b ? -1 : a > b ? 1 : 0\n}\n\n/**\n * Compare semantic versions.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function compareSemver(a: string, b: string): number {\n const semver =\n /*@__PURE__*/ require('./external/semver') as typeof import('semver')\n const validA: string | null = semver.valid(a)\n const validB: string | null = semver.valid(b)\n\n if (!validA && !validB) {\n return 0\n }\n if (!validA) {\n return -1\n }\n if (!validB) {\n return 1\n }\n return semver.compare(a, b) as number\n}\n"],
|
|
5
|
+
"mappings": ";4ZAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,EAAA,eAAAC,EAAA,kBAAAC,EAAA,mBAAAC,EAAA,kBAAAC,IAAA,eAAAC,EAAAP,GAKA,IAAIQ,EAKG,SAASJ,EAAcK,EAAWC,EAAmB,CAC1D,OAAIF,IAAmB,SAErBA,EAAiB,IAAI,KAAK,SAAS,EAAE,SAEhCA,EAAeC,EAAGC,CAAC,CAC5B,CAEA,IAAIC,EAKG,SAASN,EAAeI,EAAWC,EAAmB,CAC3D,OAAIC,IAAoB,SAEtBA,EAAkB,IAAI,KAAK,SAGzB,OACA,CAIE,QAAS,GAGT,YAAa,MACf,CACF,EAAE,SAEGA,EAAgBF,EAAGC,CAAC,CAC7B,CAOA,IAAIE,EAKG,SAASN,EACdO,EAC8B,CAC9B,OAAID,IAAmB,SAGrBA,EADgB,QAAQ,sBAAsB,EACpB,sBAAsB,CAC9C,SAAUP,CACZ,CAAC,GAEKO,EAAoCC,CAAW,CACzD,CAMO,SAASV,EAAWW,EAAWC,EAAmB,CACvD,OAAOD,EAAIC,EAAI,GAAKD,EAAIC,EAAI,EAAI,CAClC,CAMO,SAASb,EAAcY,EAAWC,EAAmB,CAC1D,MAAMC,EACU,QAAQ,mBAAmB,EACrCC,EAAwBD,EAAO,MAAMF,CAAC,EACtCI,EAAwBF,EAAO,MAAMD,CAAC,EAE5C,MAAI,CAACE,GAAU,CAACC,EACP,EAEJD,EAGAC,EAGEF,EAAO,QAAQF,EAAGC,CAAC,EAFjB,EAHA,EAMX",
|
|
6
6
|
"names": ["sorts_exports", "__export", "compareSemver", "compareStr", "localeCompare", "naturalCompare", "naturalSorter", "__toCommonJS", "_localeCompare", "x", "y", "_naturalCompare", "_naturalSorter", "arrayToSort", "a", "b", "semver", "validA", "validB"]
|
|
7
7
|
}
|
package/dist/spinner.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/* Socket Lib - Built with esbuild */
|
|
2
|
-
var
|
|
2
|
+
var q=Object.create;var x=Object.defineProperty;var Y=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var M=Object.getPrototypeOf,z=Object.prototype.hasOwnProperty;var F=(r,s)=>{for(var u in s)x(r,u,{get:s[u],enumerable:!0})},I=(r,s,u,t)=>{if(s&&typeof s=="object"||typeof s=="function")for(let i of G(s))!z.call(r,i)&&i!==u&&x(r,i,{get:()=>s[i],enumerable:!(t=Y(s,i))||t.enumerable});return r};var E=(r,s,u)=>(u=r!=null?q(M(r)):{},I(s||!r||!r.__esModule?x(u,"default",{value:r,enumerable:!0}):u,r)),N=r=>I(x({},"__esModule",{value:!0}),r);var Z={};F(Z,{Spinner:()=>L,ciSpinner:()=>W,getCliSpinners:()=>v,getDefaultSpinner:()=>U,toRgb:()=>S,withSpinner:()=>J,withSpinnerRestore:()=>Q,withSpinnerSync:()=>X});module.exports=N(Z);var O=require("#env/ci"),D=require("./effects/pulse-frames"),p=require("./effects/text-shimmer"),T=E(require("./external/@socketregistry/yocto-spinner")),P=require("./objects"),_=require("./strings"),B=require("./themes/context"),$=require("./themes/utils");const j={__proto__:null,black:[0,0,0],blue:[0,0,255],blueBright:[100,149,237],cyan:[0,255,255],cyanBright:[0,255,255],gray:[128,128,128],green:[0,128,0],greenBright:[0,255,0],magenta:[255,0,255],magentaBright:[255,105,180],red:[255,0,0],redBright:[255,69,0],white:[255,255,255],whiteBright:[255,255,255],yellow:[255,255,0],yellowBright:[255,255,153]};function C(r){return Array.isArray(r)}function S(r){return C(r)?r:j[r]}const W={frames:[""],interval:2147483647};function b(r){return{__proto__:null,configurable:!0,value:r,writable:!0}}function R(r){return typeof r=="string"?r.trimStart():""}function H(r){const{current:s,total:u,unit:t}=r,i=Math.round(s/u*100),e=K(i),n=t?`${s}/${u} ${t}`:`${s}/${u}`;return`${e} ${i}% (${n})`}function K(r,s=20){const u=Math.round(r/100*s),t=s-u,i="\u2588".repeat(u)+"\u2591".repeat(t);return require("./external/yoctocolors-cjs").cyan(i)}let y;function v(r){return y===void 0&&(y={__proto__:null,...(0,T.default)({}).constructor.spinners,socket:(0,D.generateSocketSpinnerFrames)()}),typeof r=="string"&&y?(0,P.hasOwn)(y,r)?y[r]:void 0:y}let h,A;function L(r){if(h===void 0){const t=(0,T.default)({}).constructor;h=class extends t{#s="";#o="";#e;#n;#r;constructor(e){const n={__proto__:null,...e},o=(0,B.getTheme)();let l=o.colors.primary;if(o.effects?.spinner?.color){const d=(0,$.resolveColor)(o.effects.spinner.color,o.colors);d==="inherit"||Array.isArray(d[0])?l=o.colors.primary:l=d}const f=n.color??l;if(C(f)&&(f.length!==3||!f.every(d=>typeof d=="number"&&d>=0&&d<=255)))throw new TypeError("RGB color must be an array of 3 numbers between 0 and 255");const c=S(f);let g;if(n.shimmer){let d,m,a=.3333333333333333;if(typeof n.shimmer=="string")d=n.shimmer;else{const w={__proto__:null,...n.shimmer};d=w.dir??p.DIR_LTR,m=w.color??p.COLOR_INHERIT,a=w.speed??1/3}g={__proto__:null,color:m===void 0?p.COLOR_INHERIT:m,currentDir:p.DIR_LTR,mode:d,speed:a,step:0}}super({signal:require("#constants/process").getAbortSignal(),...n,color:c,onRenderFrame:(d,m,a)=>{const V=(0,_.stringWidth)(d)===1?" ":" ";return d?`${a(d)}${V}${m}`:m},onFrameUpdate:g?()=>{this.#s&&(super.text=this.#d())}:void 0}),this.#n=g,this.#r=g}get color(){const e=super.color;return C(e)?e:S(e)}set color(e){super.color=C(e)?e:S(e)}get shimmerState(){if(this.#n)return{color:this.#n.color,currentDir:this.#n.currentDir,mode:this.#n.mode,speed:this.#n.speed,step:this.#n.step}}#i(e,n){let o,l=n.at(0);typeof l=="string"?o=n.slice(1):(o=n,l="");const f=this.isSpinning,c=R(l);super[e](c);const{getDefaultLogger:g,incLogCallCountSymbol:d,lastWasBlankSymbol:m}=require("./logger.js"),a=g();return e==="stop"?f&&c&&(a[m]((0,_.isBlankString)(c)),a[d]()):(a[m](!1),a[d]()),o.length&&(a.log(...o),a[m](!1)),this}#d(){let e=this.#s;if(this.#e){const n=H(this.#e);e=e?`${e} ${n}`:n}if(e&&this.#n){let n;this.#n.color===p.COLOR_INHERIT?n=this.color:Array.isArray(this.#n.color[0])?n=this.#n.color:n=S(this.#n.color),e=(0,p.applyShimmer)(e,this.#n,{color:n,direction:this.#n.mode})}return this.#o&&e&&(e=this.#o+e),e}#u(e,n){let o=n.at(0),l;typeof o=="string"?l=n.slice(1):(l=n,o="");const{LOG_SYMBOLS:f,getDefaultLogger:c}=require("./logger.js");return c().error(`${f[e]} ${o}`,...l),this}#t(){super.text=this.#d()}debug(e,...n){const{isDebug:o}=require("./debug.js");return o()?this.#u("info",[e,...n]):this}debugAndStop(e,...n){const{isDebug:o}=require("./debug.js");return o()?this.#i("info",[e,...n]):this}dedent(e){if(e===0)this.#o="";else{const n=e??2,o=Math.max(0,this.#o.length-n);this.#o=this.#o.slice(0,o)}return this.#t(),this}done(e,...n){return this.#u("success",[e,...n])}doneAndStop(e,...n){return this.#i("success",[e,...n])}fail(e,...n){return this.#u("fail",[e,...n])}failAndStop(e,...n){return this.#i("error",[e,...n])}indent(e){if(e===0)this.#o="";else{const n=e??2;this.#o+=" ".repeat(n)}return this.#t(),this}info(e,...n){return this.#u("info",[e,...n])}infoAndStop(e,...n){return this.#i("info",[e,...n])}log(...e){const{getDefaultLogger:n}=require("./logger.js");return n().log(...e),this}logAndStop(e,...n){return this.#i("stop",[e,...n])}progress=(e,n,o)=>(this.#e={__proto__:null,current:e,total:n,...o?{unit:o}:{}},this.#t(),this);progressStep(e=1){if(this.#e){const n=this.#e.current+e;this.#e={__proto__:null,current:Math.max(0,Math.min(n,this.#e.total)),total:this.#e.total,...this.#e.unit?{unit:this.#e.unit}:{}},this.#t()}return this}start(...e){if(e.length){const n=e.at(0),o=R(n);o?this.#s=o:(this.#s="",super.text="")}return this.#t(),this.#i("start",[])}step(e,...n){const{getDefaultLogger:o}=require("./logger.js");if(typeof e=="string"){const l=o();l.error(""),l.error(e,...n)}return this}substep(e,...n){if(typeof e=="string"){const{getDefaultLogger:o}=require("./logger.js");o().error(` ${e}`,...n)}return this}stop(...e){this.#s="",this.#e=void 0,this.#n&&(this.#n.currentDir=p.DIR_LTR,this.#n.step=0);const n=this.#i("stop",e);return super.text="",n}success(e,...n){return this.#u("success",[e,...n])}successAndStop(e,...n){return this.#i("success",[e,...n])}text(e){return arguments.length===0?this.#s:(this.#s=e??"",this.#t(),this)}warn(e,...n){return this.#u("warn",[e,...n])}warnAndStop(e,...n){return this.#i("warning",[e,...n])}enableShimmer(){return this.#r?this.#n={...this.#r}:(this.#n={color:p.COLOR_INHERIT,currentDir:p.DIR_LTR,mode:p.DIR_LTR,speed:1/3,step:0},this.#r=this.#n),this.#t(),this}disableShimmer(){return this.#n=void 0,this.#t(),this}setShimmer(e){return this.#n={color:e.color,currentDir:p.DIR_LTR,mode:e.dir,speed:e.speed,step:0},this.#r=this.#n,this.#t(),this}updateShimmer(e){const n={__proto__:null,...e};return this.#n?(this.#n={...this.#n,...n.color!==void 0?{color:n.color}:{},...n.dir!==void 0?{mode:n.dir}:{},...n.speed!==void 0?{speed:n.speed}:{}},this.#r=this.#n):this.#r?(this.#n={...this.#r,...n.color!==void 0?{color:n.color}:{},...n.dir!==void 0?{mode:n.dir}:{},...n.speed!==void 0?{speed:n.speed}:{}},this.#r=this.#n):(this.#n={color:n.color??p.COLOR_INHERIT,currentDir:p.DIR_LTR,mode:n.dir??p.DIR_LTR,speed:n.speed??1/3,step:0},this.#r=this.#n),this.#t(),this}},Object.defineProperties(h.prototype,{error:b(h.prototype.fail),errorAndStop:b(h.prototype.failAndStop),warning:b(h.prototype.warn),warningAndStop:b(h.prototype.warnAndStop)}),A=(0,O.getCI)()?W:v("socket")}return new h({spinner:A,...r})}let k;function U(){return k===void 0&&(k=L()),k}async function J(r){const{message:s,operation:u,spinner:t,withOptions:i}={__proto__:null,...r};if(!t)return await u();const e=i?.color!==void 0?t.color:void 0,n=i?.shimmer!==void 0?t.shimmerState:void 0;i?.color!==void 0&&(t.color=S(i.color)),i?.shimmer!==void 0&&(typeof i.shimmer=="string"?t.updateShimmer({dir:i.shimmer}):t.setShimmer(i.shimmer)),t.start(s);try{return await u()}finally{t.stop(),e!==void 0&&(t.color=e),i?.shimmer!==void 0&&(n?t.setShimmer({color:n.color,dir:n.mode,speed:n.speed}):t.disableShimmer())}}async function Q(r){const{operation:s,spinner:u,wasSpinning:t}={__proto__:null,...r};try{return await s()}finally{u&&t&&u.start()}}function X(r){const{message:s,operation:u,spinner:t,withOptions:i}={__proto__:null,...r};if(!t)return u();const e=i?.color!==void 0?t.color:void 0,n=i?.shimmer!==void 0?t.shimmerState:void 0;i?.color!==void 0&&(t.color=S(i.color)),i?.shimmer!==void 0&&(typeof i.shimmer=="string"?t.updateShimmer({dir:i.shimmer}):t.setShimmer(i.shimmer)),t.start(s);try{return u()}finally{t.stop(),e!==void 0&&(t.color=e),i?.shimmer!==void 0&&(n?t.setShimmer({color:n.color,dir:n.mode,speed:n.speed}):t.disableShimmer())}}0&&(module.exports={Spinner,ciSpinner,getCliSpinners,getDefaultSpinner,toRgb,withSpinner,withSpinnerRestore,withSpinnerSync});
|
|
3
3
|
//# sourceMappingURL=spinner.js.map
|
package/dist/spinner.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/spinner.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * @fileoverview CLI spinner utilities for long-running operations.\n * Provides animated progress indicators with CI environment detection.\n */\n\nimport type { Writable } from 'stream'\n\n// Note: getAbortSignal is imported lazily to avoid circular dependencies.\nimport { getCI } from '#env/ci'\nimport { generateSocketSpinnerFrames } from './effects/pulse-frames'\nimport type {\n ShimmerColorGradient,\n ShimmerConfig,\n ShimmerDirection,\n ShimmerState,\n} from './effects/text-shimmer'\nimport { applyShimmer, COLOR_INHERIT, DIR_LTR } from './effects/text-shimmer'\nimport yoctoSpinner from './external/@socketregistry/yocto-spinner'\nimport { hasOwn } from './objects'\nimport { isBlankString, stringWidth } from './strings'\nimport { getTheme } from './themes/context'\nimport { resolveColor } from './themes/utils'\n\n/**\n * Named color values supported by the spinner.\n * Maps to standard terminal colors with bright variants.\n */\nexport type ColorName =\n | 'black'\n | 'blue'\n | 'blueBright'\n | 'cyan'\n | 'cyanBright'\n | 'gray'\n | 'green'\n | 'greenBright'\n | 'magenta'\n | 'magentaBright'\n | 'red'\n | 'redBright'\n | 'white'\n | 'whiteBright'\n | 'yellow'\n | 'yellowBright'\n\n/**\n * Special 'inherit' color value that uses the spinner's current color.\n * Used with shimmer effects to dynamically inherit the spinner color.\n */\nexport type ColorInherit = 'inherit'\n\n/**\n * RGB color tuple with values 0-255 for red, green, and blue channels.\n * @example [140, 82, 255] // Socket purple\n * @example [255, 0, 0] // Red\n */\nexport type ColorRgb = readonly [number, number, number]\n\n/**\n * Union of all supported color types: named colors or RGB tuples.\n */\nexport type ColorValue = ColorName | ColorRgb\n\n/**\n * Symbol types for status messages.\n * Maps to log symbols: success (\u2713), fail (\u2717), info (\u2139), warn (\u26A0).\n */\nexport type SymbolType = 'fail' | 'info' | 'success' | 'warn'\n\n// Map color names to RGB values.\nconst colorToRgb: Record<ColorName, ColorRgb> = {\n __proto__: null,\n black: [0, 0, 0],\n blue: [0, 0, 255],\n blueBright: [100, 149, 237],\n cyan: [0, 255, 255],\n cyanBright: [0, 255, 255],\n gray: [128, 128, 128],\n green: [0, 128, 0],\n greenBright: [0, 255, 0],\n magenta: [255, 0, 255],\n magentaBright: [255, 105, 180],\n red: [255, 0, 0],\n redBright: [255, 69, 0],\n white: [255, 255, 255],\n whiteBright: [255, 255, 255],\n yellow: [255, 255, 0],\n yellowBright: [255, 255, 153],\n} as Record<ColorName, ColorRgb>\n\n/**\n * Type guard to check if a color value is an RGB tuple.\n * @param value - Color value to check\n * @returns `true` if value is an RGB tuple, `false` if it's a color name\n */\nfunction isRgbTuple(value: ColorValue): value is ColorRgb {\n return Array.isArray(value)\n}\n\n/**\n * Convert a color value to RGB tuple format.\n * Named colors are looked up in the `colorToRgb` map, RGB tuples are returned as-is.\n * @param color - Color name or RGB tuple\n * @returns RGB tuple with values 0-255\n */\nexport function toRgb(color: ColorValue): ColorRgb {\n if (isRgbTuple(color)) {\n return color\n }\n return colorToRgb[color]\n}\n\n/**\n * Progress tracking information for display in spinner.\n * Used by `progress()` and `progressStep()` methods to show animated progress bars.\n */\nexport type ProgressInfo = {\n /** Current progress value */\n current: number\n /** Total/maximum progress value */\n total: number\n /** Optional unit label displayed after the progress count (e.g., 'files', 'items') */\n unit?: string | undefined\n}\n\n/**\n * Internal shimmer state with color configuration.\n * Extends `ShimmerState` with additional color property that can be inherited from spinner.\n */\nexport type ShimmerInfo = ShimmerState & {\n /** Color for shimmer effect - can inherit from spinner, use explicit color, or gradient */\n color: ColorInherit | ColorValue | ShimmerColorGradient\n}\n\n/**\n * Spinner instance for displaying animated loading indicators.\n * Provides methods for status updates, progress tracking, and text shimmer effects.\n *\n * KEY BEHAVIORS:\n * - Methods WITHOUT \"AndStop\" keep the spinner running (e.g., `success()`, `fail()`)\n * - Methods WITH \"AndStop\" auto-clear the spinner line (e.g., `successAndStop()`, `failAndStop()`)\n * - Status messages (done, success, fail, info, warn, step, substep) go to stderr\n * - Data messages (`log()`) go to stdout\n *\n * @example\n * ```ts\n * import { Spinner } from '@socketsecurity/lib/spinner'\n *\n * const spinner = Spinner({ text: 'Loading\u2026' })\n * spinner.start()\n *\n * // Show success while continuing to spin\n * spinner.success('Step 1 complete')\n *\n * // Stop the spinner with success message\n * spinner.successAndStop('All done!')\n * ```\n */\nexport type Spinner = {\n /** Current spinner color as RGB tuple */\n color: ColorRgb\n /** Current spinner animation style */\n spinner: SpinnerStyle\n\n /** Whether spinner is currently animating */\n get isSpinning(): boolean\n\n /** Get current shimmer state (enabled/disabled and configuration) */\n get shimmerState(): ShimmerInfo | undefined\n\n /** Clear the current line without stopping the spinner */\n clear(): Spinner\n\n /** Show debug message without stopping (only if debug mode enabled) */\n debug(text?: string | undefined, ...extras: unknown[]): Spinner\n /** Show debug message and stop the spinner (only if debug mode enabled) */\n debugAndStop(text?: string | undefined, ...extras: unknown[]): Spinner\n\n /** Alias for `fail()` - show error without stopping */\n error(text?: string | undefined, ...extras: unknown[]): Spinner\n /** Alias for `failAndStop()` - show error and stop */\n errorAndStop(text?: string | undefined, ...extras: unknown[]): Spinner\n\n /** Show failure (\u2717) without stopping the spinner */\n fail(text?: string | undefined, ...extras: unknown[]): Spinner\n /** Show failure (\u2717) and stop the spinner, auto-clearing the line */\n failAndStop(text?: string | undefined, ...extras: unknown[]): Spinner\n\n /** Get current spinner text (getter) or set new text (setter) */\n text(value: string): Spinner\n text(): string\n\n /** Increase indentation by specified spaces (default: 2) */\n indent(spaces?: number | undefined): Spinner\n /** Decrease indentation by specified spaces (default: 2) */\n dedent(spaces?: number | undefined): Spinner\n\n /** Show info (\u2139) message without stopping the spinner */\n info(text?: string | undefined, ...extras: unknown[]): Spinner\n /** Show info (\u2139) message and stop the spinner, auto-clearing the line */\n infoAndStop(text?: string | undefined, ...extras: unknown[]): Spinner\n\n /** Log to stdout without stopping the spinner */\n log(text?: string | undefined, ...extras: unknown[]): Spinner\n /** Log and stop the spinner, auto-clearing the line */\n logAndStop(text?: string | undefined, ...extras: unknown[]): Spinner\n\n /** Start spinning with optional text */\n start(text?: string | undefined): Spinner\n /** Stop spinning and clear internal state, auto-clearing the line */\n stop(text?: string | undefined): Spinner\n /** Stop and show final text without clearing the line */\n stopAndPersist(text?: string | undefined): Spinner\n\n /** Show main step message to stderr without stopping */\n step(text?: string | undefined, ...extras: unknown[]): Spinner\n /** Show indented substep message to stderr without stopping */\n substep(text?: string | undefined, ...extras: unknown[]): Spinner\n\n /** Show success (\u2713) without stopping the spinner */\n success(text?: string | undefined, ...extras: unknown[]): Spinner\n /** Show success (\u2713) and stop the spinner, auto-clearing the line */\n successAndStop(text?: string | undefined, ...extras: unknown[]): Spinner\n\n /** Alias for `success()` - show success without stopping */\n done(text?: string | undefined, ...extras: unknown[]): Spinner\n /** Alias for `successAndStop()` - show success and stop */\n doneAndStop(text?: string | undefined, ...extras: unknown[]): Spinner\n\n /** Update progress bar with current/total values and optional unit */\n progress(current: number, total: number, unit?: string | undefined): Spinner\n /** Increment progress by specified amount (default: 1) */\n progressStep(amount?: number): Spinner\n\n /** Enable shimmer effect (restores saved config or uses defaults) */\n enableShimmer(): Spinner\n /** Disable shimmer effect (preserves config for later re-enable) */\n disableShimmer(): Spinner\n /** Set complete shimmer configuration */\n setShimmer(config: ShimmerConfig): Spinner\n /** Update partial shimmer configuration */\n updateShimmer(config: Partial<ShimmerConfig>): Spinner\n\n /** Show warning (\u26A0) without stopping the spinner */\n warn(text?: string | undefined, ...extras: unknown[]): Spinner\n /** Show warning (\u26A0) and stop the spinner, auto-clearing the line */\n warnAndStop(text?: string | undefined, ...extras: unknown[]): Spinner\n}\n\n/**\n * Configuration options for creating a spinner instance.\n */\nexport type SpinnerOptions = {\n /**\n * Spinner color as RGB tuple or color name.\n * @default [140, 82, 255] Socket purple\n */\n readonly color?: ColorValue | undefined\n /**\n * Shimmer effect configuration or direction string.\n * When enabled, text will have an animated shimmer effect.\n * @default undefined No shimmer effect\n */\n readonly shimmer?: ShimmerConfig | ShimmerDirection | undefined\n /**\n * Animation style with frames and timing.\n * @default 'socket' Custom Socket animation in CLI, minimal in CI\n */\n readonly spinner?: SpinnerStyle | undefined\n /**\n * Abort signal for cancelling the spinner.\n * @default getAbortSignal() from process constants\n */\n readonly signal?: AbortSignal | undefined\n /**\n * Output stream for spinner rendering.\n * @default process.stderr\n */\n readonly stream?: Writable | undefined\n /**\n * Initial text to display with the spinner.\n * @default undefined No initial text\n */\n readonly text?: string | undefined\n}\n\n/**\n * Animation style definition for spinner frames.\n * Defines the visual appearance and timing of the spinner animation.\n */\nexport type SpinnerStyle = {\n /** Array of animation frames (strings to display sequentially) */\n readonly frames: string[]\n /**\n * Milliseconds between frame changes.\n * @default 80 Standard frame rate\n */\n readonly interval?: number | undefined\n}\n\n/**\n * Minimal spinner style for CI environments.\n * Uses empty frame and max interval to effectively disable animation in CI.\n */\nexport const ciSpinner: SpinnerStyle = {\n frames: [''],\n interval: 2_147_483_647,\n}\n\n/**\n * Create a property descriptor for defining non-enumerable properties.\n * Used for adding aliased methods to the Spinner prototype.\n * @param value - Value for the property\n * @returns Property descriptor object\n * @private\n */\nfunction desc(value: unknown) {\n return {\n __proto__: null,\n configurable: true,\n value,\n writable: true,\n }\n}\n\n/**\n * Normalize text input by trimming leading whitespace.\n * Non-string values are converted to empty string.\n * @param value - Text to normalize\n * @returns Normalized string with leading whitespace removed\n * @private\n */\nfunction normalizeText(value: unknown) {\n return typeof value === 'string' ? value.trimStart() : ''\n}\n\n/**\n * Format progress information as a visual progress bar with percentage and count.\n * @param progress - Progress tracking information\n * @returns Formatted string with colored progress bar, percentage, and count\n * @private\n * @example \"\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591 35% (7/20 files)\"\n */\nfunction formatProgress(progress: ProgressInfo): string {\n const { current, total, unit } = progress\n const percentage = Math.round((current / total) * 100)\n const bar = renderProgressBar(percentage)\n const count = unit ? `${current}/${total} ${unit}` : `${current}/${total}`\n return `${bar} ${percentage}% (${count})`\n}\n\n/**\n * Render a progress bar using block characters (\u2588 for filled, \u2591 for empty).\n * @param percentage - Progress percentage (0-100)\n * @param width - Total width of progress bar in characters\n * @returns Colored progress bar string\n * @default width=20\n * @private\n */\nfunction renderProgressBar(percentage: number, width: number = 20): string {\n const filled = Math.round((percentage / 100) * width)\n const empty = width - filled\n const bar = '\u2588'.repeat(filled) + '\u2591'.repeat(empty)\n // Use cyan color for the progress bar\n const colors = /*@__PURE__*/ require('./external/yoctocolors-cjs')\n return colors.cyan(bar)\n}\n\nlet _cliSpinners: Record<string, SpinnerStyle> | undefined\n\n/**\n * Get available CLI spinner styles or a specific style by name.\n * Extends the standard cli-spinners collection with Socket custom spinners.\n *\n * Custom spinners:\n * - `socket` (default): Socket pulse animation with sparkles and lightning\n *\n * @param styleName - Optional name of specific spinner style to retrieve\n * @returns Specific spinner style if name provided, all styles if omitted, `undefined` if style not found\n * @see https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json\n *\n * @example\n * ```ts\n * // Get all available spinner styles\n * const allSpinners = getCliSpinners()\n *\n * // Get specific style\n * const socketStyle = getCliSpinners('socket')\n * const dotsStyle = getCliSpinners('dots')\n * ```\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function getCliSpinners(\n styleName?: string | undefined,\n): SpinnerStyle | Record<string, SpinnerStyle> | undefined {\n if (_cliSpinners === undefined) {\n const YoctoCtor = yoctoSpinner as any\n // Get the YoctoSpinner class to access static properties.\n const tempInstance = YoctoCtor({})\n const YoctoSpinnerClass = tempInstance.constructor as any\n // Extend the standard cli-spinners collection with Socket custom spinners.\n _cliSpinners = {\n __proto__: null,\n ...YoctoSpinnerClass.spinners,\n socket: generateSocketSpinnerFrames(),\n }\n }\n if (typeof styleName === 'string' && _cliSpinners) {\n return hasOwn(_cliSpinners, styleName) ? _cliSpinners[styleName] : undefined\n }\n return _cliSpinners\n}\n\nlet _Spinner: {\n new (options?: SpinnerOptions | undefined): Spinner\n}\nlet _defaultSpinner: SpinnerStyle | undefined\n\n/**\n * Create a spinner instance for displaying loading indicators.\n * Provides an animated CLI spinner with status messages, progress tracking, and shimmer effects.\n *\n * AUTO-CLEAR BEHAVIOR:\n * - All *AndStop() methods AUTO-CLEAR the spinner line via yocto-spinner.stop()\n * Examples: `doneAndStop()`, `successAndStop()`, `failAndStop()`, etc.\n *\n * - Methods WITHOUT \"AndStop\" do NOT clear (spinner keeps spinning)\n * Examples: `done()`, `success()`, `fail()`, etc.\n *\n * STREAM USAGE:\n * - Spinner animation: stderr (yocto-spinner default)\n * - Status methods (done, success, fail, info, warn, step, substep): stderr\n * - Data methods (`log()`): stdout\n *\n * COMPARISON WITH LOGGER:\n * - `logger.done()` does NOT auto-clear (requires manual `logger.clearLine()`)\n * - `spinner.doneAndStop()` DOES auto-clear (built into yocto-spinner.stop())\n * - Pattern: `logger.clearLine().done()` vs `spinner.doneAndStop()`\n *\n * @param options - Configuration options for the spinner\n * @returns New spinner instance\n *\n * @example\n * ```ts\n * import { Spinner } from '@socketsecurity/lib/spinner'\n *\n * // Basic usage\n * const spinner = Spinner({ text: 'Loading data\u2026' })\n * spinner.start()\n * await fetchData()\n * spinner.successAndStop('Data loaded!')\n *\n * // With custom color\n * const spinner = Spinner({\n * text: 'Processing\u2026',\n * color: [255, 0, 0] // Red\n * })\n *\n * // With shimmer effect\n * const spinner = Spinner({\n * text: 'Building\u2026',\n * shimmer: { dir: 'ltr', speed: 0.5 }\n * })\n *\n * // Show progress\n * spinner.progress(5, 10, 'files')\n * spinner.progressStep() // Increment by 1\n * ```\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function Spinner(options?: SpinnerOptions | undefined): Spinner {\n if (_Spinner === undefined) {\n const YoctoCtor = yoctoSpinner as any\n // Get the actual YoctoSpinner class from an instance\n const tempInstance = YoctoCtor({})\n const YoctoSpinnerClass = tempInstance.constructor\n\n /*@__PURE__*/\n _Spinner = class SpinnerClass extends (YoctoSpinnerClass as any) {\n declare isSpinning: boolean\n #baseText: string = ''\n #indentation: string = ''\n #progress?: ProgressInfo | undefined\n #shimmer?: ShimmerInfo | undefined\n #shimmerSavedConfig?: ShimmerInfo | undefined\n\n constructor(options?: SpinnerOptions | undefined) {\n const opts = { __proto__: null, ...options } as SpinnerOptions\n\n // Get default color from theme if not specified\n const theme = getTheme()\n let defaultColor: ColorValue = theme.colors.primary\n if (theme.effects?.spinner?.color) {\n const resolved = resolveColor(\n theme.effects.spinner.color,\n theme.colors,\n )\n // resolveColor can return 'inherit' or gradients which aren't valid for spinner\n // Fall back to primary for these cases\n if (resolved === 'inherit' || Array.isArray(resolved[0])) {\n defaultColor = theme.colors.primary\n } else {\n defaultColor = resolved as ColorValue\n }\n }\n\n // Convert color option to RGB (default from theme).\n const spinnerColor = opts.color ?? defaultColor\n\n // Validate RGB tuple if provided.\n if (\n isRgbTuple(spinnerColor) &&\n (spinnerColor.length !== 3 ||\n !spinnerColor.every(\n n => typeof n === 'number' && n >= 0 && n <= 255,\n ))\n ) {\n throw new TypeError(\n 'RGB color must be an array of 3 numbers between 0 and 255',\n )\n }\n\n const spinnerColorRgb = toRgb(spinnerColor)\n\n // Parse shimmer config - can be object or direction string.\n let shimmerInfo: ShimmerInfo | undefined\n if (opts.shimmer) {\n let shimmerDir: ShimmerDirection\n let shimmerColor:\n | ColorInherit\n | ColorValue\n | ShimmerColorGradient\n | undefined\n // Default: 0.33 steps per frame (~150ms per step).\n let shimmerSpeed: number = 1 / 3\n\n if (typeof opts.shimmer === 'string') {\n shimmerDir = opts.shimmer\n } else {\n const shimmerConfig = {\n __proto__: null,\n ...opts.shimmer,\n } as ShimmerConfig\n shimmerDir = shimmerConfig.dir ?? DIR_LTR\n shimmerColor = shimmerConfig.color ?? COLOR_INHERIT\n shimmerSpeed = shimmerConfig.speed ?? 1 / 3\n }\n\n // Create shimmer info with initial animation state:\n // - COLOR_INHERIT means use spinner color dynamically\n // - ColorValue (name or RGB tuple) is an explicit override color\n // - undefined color defaults to COLOR_INHERIT\n // - speed controls steps per frame (lower = slower, e.g., 0.33 = ~150ms per step)\n shimmerInfo = {\n __proto__: null,\n color: shimmerColor === undefined ? COLOR_INHERIT : shimmerColor,\n currentDir: DIR_LTR,\n mode: shimmerDir,\n speed: shimmerSpeed,\n step: 0,\n } as ShimmerInfo\n }\n\n // eslint-disable-next-line constructor-super\n super({\n signal: require('#constants/process').getAbortSignal(),\n ...opts,\n // Pass RGB color directly to yocto-spinner (it now supports RGB).\n color: spinnerColorRgb,\n // onRenderFrame callback provides full control over frame + text layout.\n // Calculates spacing based on frame width to prevent text jumping.\n onRenderFrame: (\n frame: string,\n text: string,\n applyColor: (text: string) => string,\n ) => {\n const width = stringWidth(frame)\n // Narrow frames (width 1) get 2 spaces, wide frames (width 2) get 1 space.\n // Total width is consistent: 3 characters (frame + spacing) before text.\n const spacing = width === 1 ? ' ' : ' '\n return frame ? `${applyColor(frame)}${spacing}${text}` : text\n },\n // onFrameUpdate callback is called by yocto-spinner whenever a frame advances.\n // This ensures shimmer updates are perfectly synchronized with animation beats.\n onFrameUpdate: shimmerInfo\n ? () => {\n // Update parent's text without triggering render.\n // Parent's #skipRender flag prevents nested render calls.\n // Only update if we have base text to avoid blank frames.\n if (this.#baseText) {\n super.text = this.#buildDisplayText()\n }\n }\n : undefined,\n })\n\n this.#shimmer = shimmerInfo\n this.#shimmerSavedConfig = shimmerInfo\n }\n\n // Override color getter to ensure it's always RGB.\n get color(): ColorRgb {\n const value = super.color\n return isRgbTuple(value) ? value : toRgb(value)\n }\n\n // Override color setter to always convert to RGB before passing to yocto-spinner.\n set color(value: ColorValue | ColorRgb) {\n super.color = isRgbTuple(value) ? value : toRgb(value)\n }\n\n // Getter to expose current shimmer state.\n get shimmerState(): ShimmerInfo | undefined {\n if (!this.#shimmer) {\n return undefined\n }\n return {\n color: this.#shimmer.color,\n currentDir: this.#shimmer.currentDir,\n mode: this.#shimmer.mode,\n speed: this.#shimmer.speed,\n step: this.#shimmer.step,\n } as ShimmerInfo\n }\n\n /**\n * Apply a yocto-spinner method and update logger state.\n * Handles text normalization, extra arguments, and logger tracking.\n * @private\n */\n #apply(methodName: string, args: unknown[]) {\n let extras: unknown[]\n let text = args.at(0)\n if (typeof text === 'string') {\n extras = args.slice(1)\n } else {\n extras = args\n text = ''\n }\n const wasSpinning = this.isSpinning\n const normalized = normalizeText(text)\n super[methodName](normalized)\n const {\n incLogCallCountSymbol,\n lastWasBlankSymbol,\n logger,\n } = /*@__PURE__*/ require('./logger.js')\n if (methodName === 'stop') {\n if (wasSpinning && normalized) {\n logger[lastWasBlankSymbol](isBlankString(normalized))\n logger[incLogCallCountSymbol]()\n }\n } else {\n logger[lastWasBlankSymbol](false)\n logger[incLogCallCountSymbol]()\n }\n if (extras.length) {\n logger.log(...extras)\n logger[lastWasBlankSymbol](false)\n }\n return this\n }\n\n /**\n * Build the complete display text with progress, shimmer, and indentation.\n * Combines base text, progress bar, shimmer effects, and indentation.\n * @private\n */\n #buildDisplayText() {\n let displayText = this.#baseText\n\n if (this.#progress) {\n const progressText = formatProgress(this.#progress)\n displayText = displayText\n ? `${displayText} ${progressText}`\n : progressText\n }\n\n // Apply shimmer effect if enabled.\n if (displayText && this.#shimmer) {\n // If shimmer color is 'inherit', use current spinner color (getter ensures RGB).\n // Otherwise, check if it's a gradient (array of arrays) or single color.\n let shimmerColor: ColorRgb | ShimmerColorGradient\n if (this.#shimmer.color === COLOR_INHERIT) {\n shimmerColor = this.color\n } else if (Array.isArray(this.#shimmer.color[0])) {\n // It's a gradient - use as is.\n shimmerColor = this.#shimmer.color as ShimmerColorGradient\n } else {\n // It's a single color - convert to RGB.\n shimmerColor = toRgb(this.#shimmer.color as ColorValue)\n }\n\n displayText = applyShimmer(displayText, this.#shimmer, {\n color: shimmerColor,\n direction: this.#shimmer.mode,\n })\n }\n\n // Apply indentation\n if (this.#indentation && displayText) {\n displayText = this.#indentation + displayText\n }\n\n return displayText\n }\n\n /**\n * Show a status message without stopping the spinner.\n * Outputs the symbol and message to stderr, then continues spinning.\n */\n #showStatusAndKeepSpinning(symbolType: SymbolType, args: unknown[]) {\n let text = args.at(0)\n let extras: unknown[]\n if (typeof text === 'string') {\n extras = args.slice(1)\n } else {\n extras = args\n text = ''\n }\n\n const { LOG_SYMBOLS, logger } = /*@__PURE__*/ require('./logger.js')\n // Note: Status messages always go to stderr.\n logger.error(`${LOG_SYMBOLS[symbolType]} ${text}`, ...extras)\n return this\n }\n\n /**\n * Update the spinner's displayed text.\n * Rebuilds display text and triggers render.\n * @private\n */\n #updateSpinnerText() {\n // Call the parent class's text setter, which triggers render.\n super.text = this.#buildDisplayText()\n }\n\n /**\n * Show a debug message (\u2139) without stopping the spinner.\n * Only displays if debug mode is enabled via environment variable.\n * Outputs to stderr and continues spinning.\n *\n * @param text - Debug message to display\n * @param extras - Additional values to log\n * @returns This spinner for chaining\n */\n debug(text?: string | undefined, ...extras: unknown[]) {\n const { isDebug } = /*@__PURE__*/ require('./debug.js')\n if (isDebug()) {\n return this.#showStatusAndKeepSpinning('info', [text, ...extras])\n }\n return this\n }\n\n /**\n * Show a debug message (\u2139) and stop the spinner.\n * Only displays if debug mode is enabled via environment variable.\n * Auto-clears the spinner line before displaying the message.\n *\n * @param text - Debug message to display\n * @param extras - Additional values to log\n * @returns This spinner for chaining\n */\n debugAndStop(text?: string | undefined, ...extras: unknown[]) {\n const { isDebug } = /*@__PURE__*/ require('./debug.js')\n if (isDebug()) {\n return this.#apply('info', [text, ...extras])\n }\n return this\n }\n\n /**\n * Decrease indentation level by removing spaces from the left.\n * Pass 0 to reset indentation to zero completely.\n *\n * @param spaces - Number of spaces to remove\n * @returns This spinner for chaining\n * @default spaces=2\n *\n * @example\n * ```ts\n * spinner.dedent() // Remove 2 spaces\n * spinner.dedent(4) // Remove 4 spaces\n * spinner.dedent(0) // Reset to zero indentation\n * ```\n */\n dedent(spaces?: number | undefined) {\n // Pass 0 to reset indentation\n if (spaces === 0) {\n this.#indentation = ''\n } else {\n const amount = spaces ?? 2\n const newLength = Math.max(0, this.#indentation.length - amount)\n this.#indentation = this.#indentation.slice(0, newLength)\n }\n this.#updateSpinnerText()\n return this\n }\n\n /**\n * Show a done/success message (\u2713) without stopping the spinner.\n * Alias for `success()` with a shorter name.\n *\n * DESIGN DECISION: Unlike yocto-spinner, our `done()` does NOT stop the spinner.\n * Use `doneAndStop()` if you want to stop the spinner.\n *\n * @param text - Message to display\n * @param extras - Additional values to log\n * @returns This spinner for chaining\n */\n done(text?: string | undefined, ...extras: unknown[]) {\n return this.#showStatusAndKeepSpinning('success', [text, ...extras])\n }\n\n /**\n * Show a done/success message (\u2713) and stop the spinner.\n * Auto-clears the spinner line before displaying the success message.\n *\n * @param text - Message to display\n * @param extras - Additional values to log\n * @returns This spinner for chaining\n */\n doneAndStop(text?: string | undefined, ...extras: unknown[]) {\n return this.#apply('success', [text, ...extras])\n }\n\n /**\n * Show a failure message (\u2717) without stopping the spinner.\n * DESIGN DECISION: Unlike yocto-spinner, our `fail()` does NOT stop the spinner.\n * This allows displaying errors while continuing to spin.\n * Use `failAndStop()` if you want to stop the spinner.\n *\n * @param text - Error message to display\n * @param extras - Additional values to log\n * @returns This spinner for chaining\n */\n fail(text?: string | undefined, ...extras: unknown[]) {\n return this.#showStatusAndKeepSpinning('fail', [text, ...extras])\n }\n\n /**\n * Show a failure message (\u2717) and stop the spinner.\n * Auto-clears the spinner line before displaying the error message.\n *\n * @param text - Error message to display\n * @param extras - Additional values to log\n * @returns This spinner for chaining\n */\n failAndStop(text?: string | undefined, ...extras: unknown[]) {\n return this.#apply('error', [text, ...extras])\n }\n\n /**\n * Increase indentation level by adding spaces to the left.\n * Pass 0 to reset indentation to zero completely.\n *\n * @param spaces - Number of spaces to add\n * @returns This spinner for chaining\n * @default spaces=2\n *\n * @example\n * ```ts\n * spinner.indent() // Add 2 spaces\n * spinner.indent(4) // Add 4 spaces\n * spinner.indent(0) // Reset to zero indentation\n * ```\n */\n indent(spaces?: number | undefined) {\n // Pass 0 to reset indentation\n if (spaces === 0) {\n this.#indentation = ''\n } else {\n const amount = spaces ?? 2\n this.#indentation += ' '.repeat(amount)\n }\n this.#updateSpinnerText()\n return this\n }\n\n /**\n * Show an info message (\u2139) without stopping the spinner.\n * Outputs to stderr and continues spinning.\n *\n * @param text - Info message to display\n * @param extras - Additional values to log\n * @returns This spinner for chaining\n */\n info(text?: string | undefined, ...extras: unknown[]) {\n return this.#showStatusAndKeepSpinning('info', [text, ...extras])\n }\n\n /**\n * Show an info message (\u2139) and stop the spinner.\n * Auto-clears the spinner line before displaying the message.\n *\n * @param text - Info message to display\n * @param extras - Additional values to log\n * @returns This spinner for chaining\n */\n infoAndStop(text?: string | undefined, ...extras: unknown[]) {\n return this.#apply('info', [text, ...extras])\n }\n\n /**\n * Log a message to stdout without stopping the spinner.\n * Unlike other status methods, this outputs to stdout for data logging.\n *\n * @param args - Values to log to stdout\n * @returns This spinner for chaining\n */\n log(...args: unknown[]) {\n const { logger } = /*@__PURE__*/ require('./logger.js')\n logger.log(...args)\n return this\n }\n\n /**\n * Log a message to stdout and stop the spinner.\n * Auto-clears the spinner line before displaying the message.\n *\n * @param text - Message to display\n * @param extras - Additional values to log\n * @returns This spinner for chaining\n */\n logAndStop(text?: string | undefined, ...extras: unknown[]) {\n return this.#apply('stop', [text, ...extras])\n }\n\n /**\n * Update progress information displayed with the spinner.\n * Shows a progress bar with percentage and optional unit label.\n *\n * @param current - Current progress value\n * @param total - Total/maximum progress value\n * @param unit - Optional unit label (e.g., 'files', 'items')\n * @returns This spinner for chaining\n *\n * @example\n * ```ts\n * spinner.progress(5, 10) // \"\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591 50% (5/10)\"\n * spinner.progress(7, 20, 'files') // \"\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591 35% (7/20 files)\"\n * ```\n */\n progress = (\n current: number,\n total: number,\n unit?: string | undefined,\n ) => {\n this.#progress = {\n __proto__: null,\n current,\n total,\n ...(unit ? { unit } : {}),\n } as ProgressInfo\n this.#updateSpinnerText()\n return this\n }\n\n /**\n * Increment progress by a specified amount.\n * Updates the progress bar displayed with the spinner.\n * Clamps the result between 0 and the total value.\n *\n * @param amount - Amount to increment by\n * @returns This spinner for chaining\n * @default amount=1\n *\n * @example\n * ```ts\n * spinner.progress(0, 10, 'files')\n * spinner.progressStep() // Progress: 1/10\n * spinner.progressStep(3) // Progress: 4/10\n * ```\n */\n progressStep(amount: number = 1) {\n if (this.#progress) {\n const newCurrent = this.#progress.current + amount\n this.#progress = {\n __proto__: null,\n current: Math.max(0, Math.min(newCurrent, this.#progress.total)),\n total: this.#progress.total,\n ...(this.#progress.unit ? { unit: this.#progress.unit } : {}),\n } as ProgressInfo\n this.#updateSpinnerText()\n }\n return this\n }\n\n /**\n * Start the spinner animation with optional text.\n * Begins displaying the animated spinner on stderr.\n *\n * @param text - Optional text to display with the spinner\n * @returns This spinner for chaining\n *\n * @example\n * ```ts\n * spinner.start('Loading\u2026')\n * // Later:\n * spinner.successAndStop('Done!')\n * ```\n */\n start(...args: unknown[]) {\n if (args.length) {\n const text = args.at(0)\n const normalized = normalizeText(text)\n // We clear this.text on start when `text` is falsy because yocto-spinner\n // will not clear it otherwise.\n if (!normalized) {\n this.#baseText = ''\n super.text = ''\n } else {\n this.#baseText = normalized\n }\n }\n\n this.#updateSpinnerText()\n // Don't pass text to yocto-spinner.start() since we already set it via #updateSpinnerText().\n // Passing args would cause duplicate message output.\n return this.#apply('start', [])\n }\n\n /**\n * Log a main step message to stderr without stopping the spinner.\n * Adds a blank line before the message for visual separation.\n * Aligns with `logger.step()` to use stderr for status messages.\n *\n * @param text - Step message to display\n * @param extras - Additional values to log\n * @returns This spinner for chaining\n *\n * @example\n * ```ts\n * spinner.step('Building application')\n * spinner.substep('Compiling TypeScript')\n * spinner.substep('Bundling assets')\n * ```\n */\n step(text?: string | undefined, ...extras: unknown[]) {\n const { logger } = /*@__PURE__*/ require('./logger.js')\n if (typeof text === 'string') {\n // Add blank line before step for visual separation.\n logger.error('')\n // Use error (stderr) to align with logger.step() default stream.\n logger.error(text, ...extras)\n }\n return this\n }\n\n /**\n * Log an indented substep message to stderr without stopping the spinner.\n * Adds 2-space indentation to the message.\n * Aligns with `logger.substep()` to use stderr for status messages.\n *\n * @param text - Substep message to display\n * @param extras - Additional values to log\n * @returns This spinner for chaining\n *\n * @example\n * ```ts\n * spinner.step('Building application')\n * spinner.substep('Compiling TypeScript')\n * spinner.substep('Bundling assets')\n * ```\n */\n substep(text?: string | undefined, ...extras: unknown[]) {\n if (typeof text === 'string') {\n // Add 2-space indent for substep.\n const { logger } = /*@__PURE__*/ require('./logger.js')\n // Use error (stderr) to align with logger.substep() default stream.\n logger.error(` ${text}`, ...extras)\n }\n return this\n }\n\n /**\n * Stop the spinner animation and clear internal state.\n * Auto-clears the spinner line via yocto-spinner.stop().\n * Resets progress, shimmer, and text state.\n *\n * @param text - Optional final text to display after stopping\n * @returns This spinner for chaining\n *\n * @example\n * ```ts\n * spinner.start('Processing\u2026')\n * // Do work\n * spinner.stop() // Just stop, no message\n * // or\n * spinner.stop('Finished processing')\n * ```\n */\n stop(...args: unknown[]) {\n // Clear internal state.\n this.#baseText = ''\n this.#progress = undefined\n // Reset shimmer animation state if shimmer is enabled.\n if (this.#shimmer) {\n this.#shimmer.currentDir = DIR_LTR\n this.#shimmer.step = 0\n }\n // Call parent stop first (clears screen, sets isSpinning = false).\n const result = this.#apply('stop', args)\n // Then clear text to avoid blank frame render.\n // This is safe now because isSpinning is false.\n super.text = ''\n return result\n }\n\n /**\n * Show a success message (\u2713) without stopping the spinner.\n * DESIGN DECISION: Unlike yocto-spinner, our `success()` does NOT stop the spinner.\n * This allows displaying success messages while continuing to spin for multi-step operations.\n * Use `successAndStop()` if you want to stop the spinner.\n *\n * @param text - Success message to display\n * @param extras - Additional values to log\n * @returns This spinner for chaining\n */\n success(text?: string | undefined, ...extras: unknown[]) {\n return this.#showStatusAndKeepSpinning('success', [text, ...extras])\n }\n\n /**\n * Show a success message (\u2713) and stop the spinner.\n * Auto-clears the spinner line before displaying the success message.\n *\n * @param text - Success message to display\n * @param extras - Additional values to log\n * @returns This spinner for chaining\n */\n successAndStop(text?: string | undefined, ...extras: unknown[]) {\n return this.#apply('success', [text, ...extras])\n }\n\n /**\n * Get or set the spinner text.\n * When called with no arguments, returns the current base text.\n * When called with text, updates the display and returns the spinner for chaining.\n *\n * @param value - Text to display (omit to get current text)\n * @returns Current text (getter) or this spinner (setter)\n *\n * @example\n * ```ts\n * // Setter\n * spinner.text('Loading data\u2026')\n * spinner.text('Processing\u2026')\n *\n * // Getter\n * const current = spinner.text()\n * console.log(current) // \"Processing\u2026\"\n * ```\n */\n text(): string\n text(value: string): Spinner\n text(value?: string): string | Spinner {\n // biome-ignore lint/complexity/noArguments: Function overload for getter/setter pattern.\n if (arguments.length === 0) {\n // Getter: return current base text\n return this.#baseText\n }\n // Setter: update base text and refresh display\n this.#baseText = value ?? ''\n this.#updateSpinnerText()\n return this as unknown as Spinner\n }\n\n /**\n * Show a warning message (\u26A0) without stopping the spinner.\n * Outputs to stderr and continues spinning.\n *\n * @param text - Warning message to display\n * @param extras - Additional values to log\n * @returns This spinner for chaining\n */\n warn(text?: string | undefined, ...extras: unknown[]) {\n return this.#showStatusAndKeepSpinning('warn', [text, ...extras])\n }\n\n /**\n * Show a warning message (\u26A0) and stop the spinner.\n * Auto-clears the spinner line before displaying the warning message.\n *\n * @param text - Warning message to display\n * @param extras - Additional values to log\n * @returns This spinner for chaining\n */\n warnAndStop(text?: string | undefined, ...extras: unknown[]) {\n return this.#apply('warning', [text, ...extras])\n }\n\n /**\n * Enable shimmer effect.\n * Restores saved config or uses defaults if no saved config exists.\n *\n * @returns This spinner for chaining\n *\n * @example\n * spinner.enableShimmer()\n */\n enableShimmer(): Spinner {\n if (this.#shimmerSavedConfig) {\n // Restore saved config.\n this.#shimmer = { ...this.#shimmerSavedConfig }\n } else {\n // Create default config.\n this.#shimmer = {\n color: COLOR_INHERIT,\n currentDir: DIR_LTR,\n mode: DIR_LTR,\n speed: 1 / 3,\n step: 0,\n } as ShimmerInfo\n this.#shimmerSavedConfig = this.#shimmer\n }\n\n this.#updateSpinnerText()\n return this as unknown as Spinner\n }\n\n /**\n * Disable shimmer effect.\n * Preserves config for later re-enable via enableShimmer().\n *\n * @returns This spinner for chaining\n *\n * @example\n * spinner.disableShimmer()\n */\n disableShimmer(): Spinner {\n // Disable shimmer but preserve config.\n this.#shimmer = undefined\n this.#updateSpinnerText()\n return this as unknown as Spinner\n }\n\n /**\n * Set complete shimmer configuration.\n * Replaces any existing shimmer config with the provided values.\n *\n * @param config - Complete shimmer configuration\n * @returns This spinner for chaining\n *\n * @example\n * spinner.setShimmer({\n * color: [255, 0, 0],\n * dir: 'rtl',\n * speed: 0.5\n * })\n */\n setShimmer(config: ShimmerConfig): Spinner {\n this.#shimmer = {\n color: config.color,\n currentDir: DIR_LTR,\n mode: config.dir,\n speed: config.speed,\n step: 0,\n } as ShimmerInfo\n this.#shimmerSavedConfig = this.#shimmer\n this.#updateSpinnerText()\n return this as unknown as Spinner\n }\n\n /**\n * Update partial shimmer configuration.\n * Merges with existing config, enabling shimmer if currently disabled.\n *\n * @param config - Partial shimmer configuration to merge\n * @returns This spinner for chaining\n *\n * @example\n * // Update just the speed\n * spinner.updateShimmer({ speed: 0.5 })\n *\n * // Update direction\n * spinner.updateShimmer({ dir: 'rtl' })\n *\n * // Update multiple properties\n * spinner.updateShimmer({ color: [255, 0, 0], speed: 0.8 })\n */\n updateShimmer(config: Partial<ShimmerConfig>): Spinner {\n const partialConfig = {\n __proto__: null,\n ...config,\n } as Partial<ShimmerConfig>\n\n if (this.#shimmer) {\n // Update existing shimmer.\n this.#shimmer = {\n ...this.#shimmer,\n ...(partialConfig.color !== undefined\n ? { color: partialConfig.color }\n : {}),\n ...(partialConfig.dir !== undefined\n ? { mode: partialConfig.dir }\n : {}),\n ...(partialConfig.speed !== undefined\n ? { speed: partialConfig.speed }\n : {}),\n } as ShimmerInfo\n this.#shimmerSavedConfig = this.#shimmer\n } else if (this.#shimmerSavedConfig) {\n // Restore and update.\n this.#shimmer = {\n ...this.#shimmerSavedConfig,\n ...(partialConfig.color !== undefined\n ? { color: partialConfig.color }\n : {}),\n ...(partialConfig.dir !== undefined\n ? { mode: partialConfig.dir }\n : {}),\n ...(partialConfig.speed !== undefined\n ? { speed: partialConfig.speed }\n : {}),\n } as ShimmerInfo\n this.#shimmerSavedConfig = this.#shimmer\n } else {\n // Create new with partial config.\n this.#shimmer = {\n color: partialConfig.color ?? COLOR_INHERIT,\n currentDir: DIR_LTR,\n mode: partialConfig.dir ?? DIR_LTR,\n speed: partialConfig.speed ?? 1 / 3,\n step: 0,\n } as ShimmerInfo\n this.#shimmerSavedConfig = this.#shimmer\n }\n\n this.#updateSpinnerText()\n return this as unknown as Spinner\n }\n } as unknown as {\n new (options?: SpinnerOptions | undefined): Spinner\n }\n // Add aliases.\n Object.defineProperties(_Spinner.prototype, {\n error: desc(_Spinner.prototype.fail),\n errorAndStop: desc(_Spinner.prototype.failAndStop),\n warning: desc(_Spinner.prototype.warn),\n warningAndStop: desc(_Spinner.prototype.warnAndStop),\n })\n _defaultSpinner = getCI()\n ? ciSpinner\n : (getCliSpinners('socket') as SpinnerStyle)\n }\n return new _Spinner({\n spinner: _defaultSpinner,\n ...options,\n })\n}\n\nlet _spinner: ReturnType<typeof Spinner> | undefined\n\n/**\n * Get the default spinner instance.\n * Lazily creates the spinner to avoid circular dependencies during module initialization.\n * Reuses the same instance across calls.\n *\n * @returns Shared default spinner instance\n *\n * @example\n * ```ts\n * import { getDefaultSpinner } from '@socketsecurity/lib/spinner'\n *\n * const spinner = getDefaultSpinner()\n * spinner.start('Loading\u2026')\n * ```\n */\nexport function getDefaultSpinner(): ReturnType<typeof Spinner> {\n if (_spinner === undefined) {\n _spinner = Spinner()\n }\n return _spinner\n}\n\n// REMOVED: Deprecated `spinner` export\n// Migration: Use getDefaultSpinner() instead\n// See: getDefaultSpinner() function above\n\n/**\n * Configuration options for `withSpinner()` helper.\n * @template T - Return type of the async operation\n */\nexport type WithSpinnerOptions<T> = {\n /** Message to display while the spinner is running */\n message: string\n /** Async function to execute while spinner is active */\n operation: () => Promise<T>\n /**\n * Optional spinner instance to use.\n * If not provided, operation runs without spinner.\n */\n spinner?: Spinner | undefined\n /**\n * Optional spinner options to apply during the operation.\n * These options will be pushed when the operation starts and popped when it completes.\n * Supports color and shimmer configuration.\n */\n withOptions?: Partial<Pick<SpinnerOptions, 'color' | 'shimmer'>> | undefined\n}\n\n/**\n * Execute an async operation with spinner lifecycle management.\n * Ensures `spinner.stop()` is always called via try/finally, even if the operation throws.\n * Provides safe cleanup and consistent spinner behavior.\n *\n * @template T - Return type of the operation\n * @param options - Configuration object\n * @param options.message - Message to display while spinner is running\n * @param options.operation - Async function to execute\n * @param options.spinner - Optional spinner instance (if not provided, no spinner is used)\n * @returns Result of the operation\n * @throws Re-throws any error from operation after stopping spinner\n *\n * @example\n * ```ts\n * import { Spinner, withSpinner } from '@socketsecurity/lib/spinner'\n *\n * const spinner = Spinner()\n *\n * // With spinner instance\n * const result = await withSpinner({\n * message: 'Processing\u2026',\n * operation: async () => {\n * return await processData()\n * },\n * spinner\n * })\n *\n * // Without spinner instance (no-op, just runs operation)\n * const result = await withSpinner({\n * message: 'Processing\u2026',\n * operation: async () => {\n * return await processData()\n * }\n * })\n * ```\n */\nexport async function withSpinner<T>(\n options: WithSpinnerOptions<T>,\n): Promise<T> {\n const { message, operation, spinner, withOptions } = {\n __proto__: null,\n ...options,\n } as WithSpinnerOptions<T>\n\n if (!spinner) {\n return await operation()\n }\n\n // Save current options if we're going to change them\n const savedColor =\n withOptions?.color !== undefined ? spinner.color : undefined\n const savedShimmerState =\n withOptions?.shimmer !== undefined ? spinner.shimmerState : undefined\n\n // Apply temporary options\n if (withOptions?.color !== undefined) {\n spinner.color = toRgb(withOptions.color)\n }\n if (withOptions?.shimmer !== undefined) {\n if (typeof withOptions.shimmer === 'string') {\n spinner.updateShimmer({ dir: withOptions.shimmer })\n } else {\n spinner.setShimmer(withOptions.shimmer)\n }\n }\n\n spinner.start(message)\n try {\n return await operation()\n } finally {\n spinner.stop()\n // Restore previous options\n if (savedColor !== undefined) {\n spinner.color = savedColor\n }\n if (withOptions?.shimmer !== undefined) {\n if (savedShimmerState) {\n spinner.setShimmer({\n color: savedShimmerState.color as any,\n dir: savedShimmerState.mode,\n speed: savedShimmerState.speed,\n })\n } else {\n spinner.disableShimmer()\n }\n }\n }\n}\n\n/**\n * Configuration options for `withSpinnerRestore()` helper.\n * @template T - Return type of the async operation\n */\nexport type WithSpinnerRestoreOptions<T> = {\n /** Async function to execute while spinner is stopped */\n operation: () => Promise<T>\n /** Optional spinner instance to restore after operation */\n spinner?: Spinner | undefined\n /** Whether spinner was spinning before the operation (used to conditionally restart) */\n wasSpinning: boolean\n}\n\n/**\n * Execute an async operation with conditional spinner restart.\n * Useful when you need to temporarily stop a spinner for an operation,\n * then restore it to its previous state (if it was spinning).\n *\n * @template T - Return type of the operation\n * @param options - Configuration object\n * @param options.operation - Async function to execute\n * @param options.spinner - Optional spinner instance to manage\n * @param options.wasSpinning - Whether spinner was spinning before the operation\n * @returns Result of the operation\n * @throws Re-throws any error from operation after restoring spinner state\n *\n * @example\n * ```ts\n * import { getDefaultSpinner, withSpinnerRestore } from '@socketsecurity/lib/spinner'\n *\n * const spinner = getDefaultSpinner()\n * const wasSpinning = spinner.isSpinning\n * spinner.stop()\n *\n * const result = await withSpinnerRestore({\n * operation: async () => {\n * // Do work without spinner\n * return await someOperation()\n * },\n * spinner,\n * wasSpinning\n * })\n * // Spinner is automatically restarted if wasSpinning was true\n * ```\n */\nexport async function withSpinnerRestore<T>(\n options: WithSpinnerRestoreOptions<T>,\n): Promise<T> {\n const { operation, spinner, wasSpinning } = {\n __proto__: null,\n ...options,\n } as WithSpinnerRestoreOptions<T>\n\n try {\n return await operation()\n } finally {\n if (spinner && wasSpinning) {\n spinner.start()\n }\n }\n}\n\n/**\n * Configuration options for `withSpinnerSync()` helper.\n * @template T - Return type of the sync operation\n */\nexport type WithSpinnerSyncOptions<T> = {\n /** Message to display while the spinner is running */\n message: string\n /** Synchronous function to execute while spinner is active */\n operation: () => T\n /**\n * Optional spinner instance to use.\n * If not provided, operation runs without spinner.\n */\n spinner?: Spinner | undefined\n /**\n * Optional spinner options to apply during the operation.\n * These options will be pushed when the operation starts and popped when it completes.\n * Supports color and shimmer configuration.\n */\n withOptions?: Partial<Pick<SpinnerOptions, 'color' | 'shimmer'>> | undefined\n}\n\n/**\n * Execute a synchronous operation with spinner lifecycle management.\n * Ensures `spinner.stop()` is always called via try/finally, even if the operation throws.\n * Provides safe cleanup and consistent spinner behavior for sync operations.\n *\n * @template T - Return type of the operation\n * @param options - Configuration object\n * @param options.message - Message to display while spinner is running\n * @param options.operation - Synchronous function to execute\n * @param options.spinner - Optional spinner instance (if not provided, no spinner is used)\n * @returns Result of the operation\n * @throws Re-throws any error from operation after stopping spinner\n *\n * @example\n * ```ts\n * import { Spinner, withSpinnerSync } from '@socketsecurity/lib/spinner'\n *\n * const spinner = Spinner()\n *\n * const result = withSpinnerSync({\n * message: 'Processing\u2026',\n * operation: () => {\n * return processDataSync()\n * },\n * spinner\n * })\n * ```\n */\nexport function withSpinnerSync<T>(options: WithSpinnerSyncOptions<T>): T {\n const { message, operation, spinner, withOptions } = {\n __proto__: null,\n ...options,\n } as WithSpinnerSyncOptions<T>\n\n if (!spinner) {\n return operation()\n }\n\n // Save current options if we're going to change them\n const savedColor =\n withOptions?.color !== undefined ? spinner.color : undefined\n const savedShimmerState =\n withOptions?.shimmer !== undefined ? spinner.shimmerState : undefined\n\n // Apply temporary options\n if (withOptions?.color !== undefined) {\n spinner.color = toRgb(withOptions.color)\n }\n if (withOptions?.shimmer !== undefined) {\n if (typeof withOptions.shimmer === 'string') {\n spinner.updateShimmer({ dir: withOptions.shimmer })\n } else {\n spinner.setShimmer(withOptions.shimmer)\n }\n }\n\n spinner.start(message)\n try {\n return operation()\n } finally {\n spinner.stop()\n // Restore previous options\n if (savedColor !== undefined) {\n spinner.color = savedColor\n }\n if (withOptions?.shimmer !== undefined) {\n if (savedShimmerState) {\n spinner.setShimmer({\n color: savedShimmerState.color as any,\n dir: savedShimmerState.mode,\n speed: savedShimmerState.speed,\n })\n } else {\n spinner.disableShimmer()\n }\n }\n }\n}\n"],
|
|
5
|
-
"mappings": ";6iBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,cAAAC,EAAA,mBAAAC,EAAA,sBAAAC,EAAA,UAAAC,EAAA,gBAAAC,EAAA,uBAAAC,EAAA,oBAAAC,IAAA,eAAAC,EAAAV,GAQA,IAAAW,EAAsB,mBACtBC,EAA4C,kCAO5CC,EAAqD,kCACrDC,EAAyB,uDACzBC,EAAuB,qBACvBC,EAA2C,qBAC3CC,EAAyB,4BACzBC,EAA6B,0BAiD7B,MAAMC,EAA0C,CAC9C,UAAW,KACX,MAAO,CAAC,EAAG,EAAG,CAAC,EACf,KAAM,CAAC,EAAG,EAAG,GAAG,EAChB,WAAY,CAAC,IAAK,IAAK,GAAG,EAC1B,KAAM,CAAC,EAAG,IAAK,GAAG,EAClB,WAAY,CAAC,EAAG,IAAK,GAAG,EACxB,KAAM,CAAC,IAAK,IAAK,GAAG,EACpB,MAAO,CAAC,EAAG,IAAK,CAAC,EACjB,YAAa,CAAC,EAAG,IAAK,CAAC,EACvB,QAAS,CAAC,IAAK,EAAG,GAAG,EACrB,cAAe,CAAC,IAAK,IAAK,GAAG,EAC7B,IAAK,CAAC,IAAK,EAAG,CAAC,EACf,UAAW,CAAC,IAAK,GAAI,CAAC,EACtB,MAAO,CAAC,IAAK,IAAK,GAAG,EACrB,YAAa,CAAC,IAAK,IAAK,GAAG,EAC3B,OAAQ,CAAC,IAAK,IAAK,CAAC,EACpB,aAAc,CAAC,IAAK,IAAK,GAAG,CAC9B,EAOA,SAASC,EAAWC,EAAsC,CACxD,OAAO,MAAM,QAAQA,CAAK,CAC5B,CAQO,SAASf,EAAMgB,EAA6B,CACjD,OAAIF,EAAWE,CAAK,EACXA,EAEFH,EAAWG,CAAK,CACzB,CAkMO,MAAMnB,EAA0B,CACrC,OA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AY,SACjCD,EAAQ,cAAc,CAAE,IAAKC,EAAY,OAAQ,CAAC,EAElDD,EAAQ,WAAWC,EAAY,OAAO,GAI1CD,EAAQ,MAAMF,CAAO,EACrB,GAAI,CACF,OAAOC,EAAU,CACnB,QAAE,CACAC,EAAQ,KAAK,EAETE,IAAe,SACjBF,EAAQ,MAAQE,GAEdD,GAAa,UAAY,SACvBE,EACFH,EAAQ,WAAW,CACjB,MAAOG,EAAkB,MACzB,IAAKA,EAAkB,KACvB,MAAOA,EAAkB,KAC3B,CAAC,EAEDH,EAAQ,eAAe,EAG7B,CACF",
|
|
6
|
-
"names": ["spinner_exports", "__export", "Spinner", "ciSpinner", "getCliSpinners", "getDefaultSpinner", "toRgb", "withSpinner", "withSpinnerRestore", "withSpinnerSync", "__toCommonJS", "import_ci", "import_pulse_frames", "import_text_shimmer", "import_yocto_spinner", "import_objects", "import_strings", "import_context", "import_utils", "colorToRgb", "isRgbTuple", "value", "color", "desc", "normalizeText", "formatProgress", "progress", "current", "total", "unit", "percentage", "bar", "renderProgressBar", "count", "width", "filled", "empty", "_cliSpinners", "styleName", "yoctoSpinner", "_Spinner", "_defaultSpinner", "options", "YoctoSpinnerClass", "#baseText", "#indentation", "#progress", "#shimmer", "#shimmerSavedConfig", "opts", "theme", "defaultColor", "resolved", "spinnerColor", "n", "spinnerColorRgb", "shimmerInfo", "shimmerDir", "shimmerColor", "shimmerSpeed", "shimmerConfig", "frame", "text", "applyColor", "spacing", "#buildDisplayText", "#apply", "methodName", "args", "extras", "wasSpinning", "normalized", "incLogCallCountSymbol", "lastWasBlankSymbol", "logger", "displayText", "progressText", "#showStatusAndKeepSpinning", "symbolType", "LOG_SYMBOLS", "#updateSpinnerText", "isDebug", "spaces", "amount", "newLength", "newCurrent", "result", "config", "partialConfig", "_spinner", "message", "operation", "spinner", "withOptions", "savedColor", "savedShimmerState"]
|
|
4
|
+
"sourcesContent": ["/**\n * @fileoverview CLI spinner utilities for long-running operations.\n * Provides animated progress indicators with CI environment detection.\n */\n\nimport type { Writable } from 'stream'\n\n// Note: getAbortSignal is imported lazily to avoid circular dependencies.\nimport { getCI } from '#env/ci'\nimport { generateSocketSpinnerFrames } from './effects/pulse-frames'\nimport type {\n ShimmerColorGradient,\n ShimmerConfig,\n ShimmerDirection,\n ShimmerState,\n} from './effects/text-shimmer'\nimport { applyShimmer, COLOR_INHERIT, DIR_LTR } from './effects/text-shimmer'\nimport yoctoSpinner from './external/@socketregistry/yocto-spinner'\nimport { hasOwn } from './objects'\nimport { isBlankString, stringWidth } from './strings'\nimport { getTheme } from './themes/context'\nimport { resolveColor } from './themes/utils'\n\n/**\n * Named color values supported by the spinner.\n * Maps to standard terminal colors with bright variants.\n */\nexport type ColorName =\n | 'black'\n | 'blue'\n | 'blueBright'\n | 'cyan'\n | 'cyanBright'\n | 'gray'\n | 'green'\n | 'greenBright'\n | 'magenta'\n | 'magentaBright'\n | 'red'\n | 'redBright'\n | 'white'\n | 'whiteBright'\n | 'yellow'\n | 'yellowBright'\n\n/**\n * Special 'inherit' color value that uses the spinner's current color.\n * Used with shimmer effects to dynamically inherit the spinner color.\n */\nexport type ColorInherit = 'inherit'\n\n/**\n * RGB color tuple with values 0-255 for red, green, and blue channels.\n * @example [140, 82, 255] // Socket purple\n * @example [255, 0, 0] // Red\n */\nexport type ColorRgb = readonly [number, number, number]\n\n/**\n * Union of all supported color types: named colors or RGB tuples.\n */\nexport type ColorValue = ColorName | ColorRgb\n\n/**\n * Symbol types for status messages.\n * Maps to log symbols: success (\u2713), fail (\u2717), info (\u2139), warn (\u26A0).\n */\nexport type SymbolType = 'fail' | 'info' | 'success' | 'warn'\n\n// Map color names to RGB values.\nconst colorToRgb: Record<ColorName, ColorRgb> = {\n __proto__: null,\n black: [0, 0, 0],\n blue: [0, 0, 255],\n blueBright: [100, 149, 237],\n cyan: [0, 255, 255],\n cyanBright: [0, 255, 255],\n gray: [128, 128, 128],\n green: [0, 128, 0],\n greenBright: [0, 255, 0],\n magenta: [255, 0, 255],\n magentaBright: [255, 105, 180],\n red: [255, 0, 0],\n redBright: [255, 69, 0],\n white: [255, 255, 255],\n whiteBright: [255, 255, 255],\n yellow: [255, 255, 0],\n yellowBright: [255, 255, 153],\n} as Record<ColorName, ColorRgb>\n\n/**\n * Type guard to check if a color value is an RGB tuple.\n * @param value - Color value to check\n * @returns `true` if value is an RGB tuple, `false` if it's a color name\n */\nfunction isRgbTuple(value: ColorValue): value is ColorRgb {\n return Array.isArray(value)\n}\n\n/**\n * Convert a color value to RGB tuple format.\n * Named colors are looked up in the `colorToRgb` map, RGB tuples are returned as-is.\n * @param color - Color name or RGB tuple\n * @returns RGB tuple with values 0-255\n */\nexport function toRgb(color: ColorValue): ColorRgb {\n if (isRgbTuple(color)) {\n return color\n }\n return colorToRgb[color]\n}\n\n/**\n * Progress tracking information for display in spinner.\n * Used by `progress()` and `progressStep()` methods to show animated progress bars.\n */\nexport type ProgressInfo = {\n /** Current progress value */\n current: number\n /** Total/maximum progress value */\n total: number\n /** Optional unit label displayed after the progress count (e.g., 'files', 'items') */\n unit?: string | undefined\n}\n\n/**\n * Internal shimmer state with color configuration.\n * Extends `ShimmerState` with additional color property that can be inherited from spinner.\n */\nexport type ShimmerInfo = ShimmerState & {\n /** Color for shimmer effect - can inherit from spinner, use explicit color, or gradient */\n color: ColorInherit | ColorValue | ShimmerColorGradient\n}\n\n/**\n * Spinner instance for displaying animated loading indicators.\n * Provides methods for status updates, progress tracking, and text shimmer effects.\n *\n * KEY BEHAVIORS:\n * - Methods WITHOUT \"AndStop\" keep the spinner running (e.g., `success()`, `fail()`)\n * - Methods WITH \"AndStop\" auto-clear the spinner line (e.g., `successAndStop()`, `failAndStop()`)\n * - Status messages (done, success, fail, info, warn, step, substep) go to stderr\n * - Data messages (`log()`) go to stdout\n *\n * @example\n * ```ts\n * import { Spinner } from '@socketsecurity/lib/spinner'\n *\n * const spinner = Spinner({ text: 'Loading\u2026' })\n * spinner.start()\n *\n * // Show success while continuing to spin\n * spinner.success('Step 1 complete')\n *\n * // Stop the spinner with success message\n * spinner.successAndStop('All done!')\n * ```\n */\nexport type Spinner = {\n /** Current spinner color as RGB tuple */\n color: ColorRgb\n /** Current spinner animation style */\n spinner: SpinnerStyle\n\n /** Whether spinner is currently animating */\n get isSpinning(): boolean\n\n /** Get current shimmer state (enabled/disabled and configuration) */\n get shimmerState(): ShimmerInfo | undefined\n\n /** Clear the current line without stopping the spinner */\n clear(): Spinner\n\n /** Show debug message without stopping (only if debug mode enabled) */\n debug(text?: string | undefined, ...extras: unknown[]): Spinner\n /** Show debug message and stop the spinner (only if debug mode enabled) */\n debugAndStop(text?: string | undefined, ...extras: unknown[]): Spinner\n\n /** Alias for `fail()` - show error without stopping */\n error(text?: string | undefined, ...extras: unknown[]): Spinner\n /** Alias for `failAndStop()` - show error and stop */\n errorAndStop(text?: string | undefined, ...extras: unknown[]): Spinner\n\n /** Show failure (\u2717) without stopping the spinner */\n fail(text?: string | undefined, ...extras: unknown[]): Spinner\n /** Show failure (\u2717) and stop the spinner, auto-clearing the line */\n failAndStop(text?: string | undefined, ...extras: unknown[]): Spinner\n\n /** Get current spinner text (getter) or set new text (setter) */\n text(value: string): Spinner\n text(): string\n\n /** Increase indentation by specified spaces (default: 2) */\n indent(spaces?: number | undefined): Spinner\n /** Decrease indentation by specified spaces (default: 2) */\n dedent(spaces?: number | undefined): Spinner\n\n /** Show info (\u2139) message without stopping the spinner */\n info(text?: string | undefined, ...extras: unknown[]): Spinner\n /** Show info (\u2139) message and stop the spinner, auto-clearing the line */\n infoAndStop(text?: string | undefined, ...extras: unknown[]): Spinner\n\n /** Log to stdout without stopping the spinner */\n log(text?: string | undefined, ...extras: unknown[]): Spinner\n /** Log and stop the spinner, auto-clearing the line */\n logAndStop(text?: string | undefined, ...extras: unknown[]): Spinner\n\n /** Start spinning with optional text */\n start(text?: string | undefined): Spinner\n /** Stop spinning and clear internal state, auto-clearing the line */\n stop(text?: string | undefined): Spinner\n /** Stop and show final text without clearing the line */\n stopAndPersist(text?: string | undefined): Spinner\n\n /** Show main step message to stderr without stopping */\n step(text?: string | undefined, ...extras: unknown[]): Spinner\n /** Show indented substep message to stderr without stopping */\n substep(text?: string | undefined, ...extras: unknown[]): Spinner\n\n /** Show success (\u2713) without stopping the spinner */\n success(text?: string | undefined, ...extras: unknown[]): Spinner\n /** Show success (\u2713) and stop the spinner, auto-clearing the line */\n successAndStop(text?: string | undefined, ...extras: unknown[]): Spinner\n\n /** Alias for `success()` - show success without stopping */\n done(text?: string | undefined, ...extras: unknown[]): Spinner\n /** Alias for `successAndStop()` - show success and stop */\n doneAndStop(text?: string | undefined, ...extras: unknown[]): Spinner\n\n /** Update progress bar with current/total values and optional unit */\n progress(current: number, total: number, unit?: string | undefined): Spinner\n /** Increment progress by specified amount (default: 1) */\n progressStep(amount?: number): Spinner\n\n /** Enable shimmer effect (restores saved config or uses defaults) */\n enableShimmer(): Spinner\n /** Disable shimmer effect (preserves config for later re-enable) */\n disableShimmer(): Spinner\n /** Set complete shimmer configuration */\n setShimmer(config: ShimmerConfig): Spinner\n /** Update partial shimmer configuration */\n updateShimmer(config: Partial<ShimmerConfig>): Spinner\n\n /** Show warning (\u26A0) without stopping the spinner */\n warn(text?: string | undefined, ...extras: unknown[]): Spinner\n /** Show warning (\u26A0) and stop the spinner, auto-clearing the line */\n warnAndStop(text?: string | undefined, ...extras: unknown[]): Spinner\n}\n\n/**\n * Configuration options for creating a spinner instance.\n */\nexport type SpinnerOptions = {\n /**\n * Spinner color as RGB tuple or color name.\n * @default [140, 82, 255] Socket purple\n */\n readonly color?: ColorValue | undefined\n /**\n * Shimmer effect configuration or direction string.\n * When enabled, text will have an animated shimmer effect.\n * @default undefined No shimmer effect\n */\n readonly shimmer?: ShimmerConfig | ShimmerDirection | undefined\n /**\n * Animation style with frames and timing.\n * @default 'socket' Custom Socket animation in CLI, minimal in CI\n */\n readonly spinner?: SpinnerStyle | undefined\n /**\n * Abort signal for cancelling the spinner.\n * @default getAbortSignal() from process constants\n */\n readonly signal?: AbortSignal | undefined\n /**\n * Output stream for spinner rendering.\n * @default process.stderr\n */\n readonly stream?: Writable | undefined\n /**\n * Initial text to display with the spinner.\n * @default undefined No initial text\n */\n readonly text?: string | undefined\n}\n\n/**\n * Animation style definition for spinner frames.\n * Defines the visual appearance and timing of the spinner animation.\n */\nexport type SpinnerStyle = {\n /** Array of animation frames (strings to display sequentially) */\n readonly frames: string[]\n /**\n * Milliseconds between frame changes.\n * @default 80 Standard frame rate\n */\n readonly interval?: number | undefined\n}\n\n/**\n * Minimal spinner style for CI environments.\n * Uses empty frame and max interval to effectively disable animation in CI.\n */\nexport const ciSpinner: SpinnerStyle = {\n frames: [''],\n interval: 2_147_483_647,\n}\n\n/**\n * Create a property descriptor for defining non-enumerable properties.\n * Used for adding aliased methods to the Spinner prototype.\n * @param value - Value for the property\n * @returns Property descriptor object\n * @private\n */\nfunction desc(value: unknown) {\n return {\n __proto__: null,\n configurable: true,\n value,\n writable: true,\n }\n}\n\n/**\n * Normalize text input by trimming leading whitespace.\n * Non-string values are converted to empty string.\n * @param value - Text to normalize\n * @returns Normalized string with leading whitespace removed\n * @private\n */\nfunction normalizeText(value: unknown) {\n return typeof value === 'string' ? value.trimStart() : ''\n}\n\n/**\n * Format progress information as a visual progress bar with percentage and count.\n * @param progress - Progress tracking information\n * @returns Formatted string with colored progress bar, percentage, and count\n * @private\n * @example \"\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591 35% (7/20 files)\"\n */\nfunction formatProgress(progress: ProgressInfo): string {\n const { current, total, unit } = progress\n const percentage = Math.round((current / total) * 100)\n const bar = renderProgressBar(percentage)\n const count = unit ? `${current}/${total} ${unit}` : `${current}/${total}`\n return `${bar} ${percentage}% (${count})`\n}\n\n/**\n * Render a progress bar using block characters (\u2588 for filled, \u2591 for empty).\n * @param percentage - Progress percentage (0-100)\n * @param width - Total width of progress bar in characters\n * @returns Colored progress bar string\n * @default width=20\n * @private\n */\nfunction renderProgressBar(percentage: number, width: number = 20): string {\n const filled = Math.round((percentage / 100) * width)\n const empty = width - filled\n const bar = '\u2588'.repeat(filled) + '\u2591'.repeat(empty)\n // Use cyan color for the progress bar\n const colors = /*@__PURE__*/ require('./external/yoctocolors-cjs')\n return colors.cyan(bar)\n}\n\nlet _cliSpinners: Record<string, SpinnerStyle> | undefined\n\n/**\n * Get available CLI spinner styles or a specific style by name.\n * Extends the standard cli-spinners collection with Socket custom spinners.\n *\n * Custom spinners:\n * - `socket` (default): Socket pulse animation with sparkles and lightning\n *\n * @param styleName - Optional name of specific spinner style to retrieve\n * @returns Specific spinner style if name provided, all styles if omitted, `undefined` if style not found\n * @see https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json\n *\n * @example\n * ```ts\n * // Get all available spinner styles\n * const allSpinners = getCliSpinners()\n *\n * // Get specific style\n * const socketStyle = getCliSpinners('socket')\n * const dotsStyle = getCliSpinners('dots')\n * ```\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function getCliSpinners(\n styleName?: string | undefined,\n): SpinnerStyle | Record<string, SpinnerStyle> | undefined {\n if (_cliSpinners === undefined) {\n const YoctoCtor = yoctoSpinner as any\n // Get the YoctoSpinner class to access static properties.\n const tempInstance = YoctoCtor({})\n const YoctoSpinnerClass = tempInstance.constructor as any\n // Extend the standard cli-spinners collection with Socket custom spinners.\n _cliSpinners = {\n __proto__: null,\n ...YoctoSpinnerClass.spinners,\n socket: generateSocketSpinnerFrames(),\n }\n }\n if (typeof styleName === 'string' && _cliSpinners) {\n return hasOwn(_cliSpinners, styleName) ? _cliSpinners[styleName] : undefined\n }\n return _cliSpinners\n}\n\nlet _Spinner: {\n new (options?: SpinnerOptions | undefined): Spinner\n}\nlet _defaultSpinner: SpinnerStyle | undefined\n\n/**\n * Create a spinner instance for displaying loading indicators.\n * Provides an animated CLI spinner with status messages, progress tracking, and shimmer effects.\n *\n * AUTO-CLEAR BEHAVIOR:\n * - All *AndStop() methods AUTO-CLEAR the spinner line via yocto-spinner.stop()\n * Examples: `doneAndStop()`, `successAndStop()`, `failAndStop()`, etc.\n *\n * - Methods WITHOUT \"AndStop\" do NOT clear (spinner keeps spinning)\n * Examples: `done()`, `success()`, `fail()`, etc.\n *\n * STREAM USAGE:\n * - Spinner animation: stderr (yocto-spinner default)\n * - Status methods (done, success, fail, info, warn, step, substep): stderr\n * - Data methods (`log()`): stdout\n *\n * COMPARISON WITH LOGGER:\n * - `logger.done()` does NOT auto-clear (requires manual `logger.clearLine()`)\n * - `spinner.doneAndStop()` DOES auto-clear (built into yocto-spinner.stop())\n * - Pattern: `logger.clearLine().done()` vs `spinner.doneAndStop()`\n *\n * @param options - Configuration options for the spinner\n * @returns New spinner instance\n *\n * @example\n * ```ts\n * import { Spinner } from '@socketsecurity/lib/spinner'\n *\n * // Basic usage\n * const spinner = Spinner({ text: 'Loading data\u2026' })\n * spinner.start()\n * await fetchData()\n * spinner.successAndStop('Data loaded!')\n *\n * // With custom color\n * const spinner = Spinner({\n * text: 'Processing\u2026',\n * color: [255, 0, 0] // Red\n * })\n *\n * // With shimmer effect\n * const spinner = Spinner({\n * text: 'Building\u2026',\n * shimmer: { dir: 'ltr', speed: 0.5 }\n * })\n *\n * // Show progress\n * spinner.progress(5, 10, 'files')\n * spinner.progressStep() // Increment by 1\n * ```\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function Spinner(options?: SpinnerOptions | undefined): Spinner {\n if (_Spinner === undefined) {\n const YoctoCtor = yoctoSpinner as any\n // Get the actual YoctoSpinner class from an instance\n const tempInstance = YoctoCtor({})\n const YoctoSpinnerClass = tempInstance.constructor\n\n /*@__PURE__*/\n _Spinner = class SpinnerClass extends (YoctoSpinnerClass as any) {\n declare isSpinning: boolean\n #baseText: string = ''\n #indentation: string = ''\n #progress?: ProgressInfo | undefined\n #shimmer?: ShimmerInfo | undefined\n #shimmerSavedConfig?: ShimmerInfo | undefined\n\n constructor(options?: SpinnerOptions | undefined) {\n const opts = { __proto__: null, ...options } as SpinnerOptions\n\n // Get default color from theme if not specified\n const theme = getTheme()\n let defaultColor: ColorValue = theme.colors.primary\n if (theme.effects?.spinner?.color) {\n const resolved = resolveColor(\n theme.effects.spinner.color,\n theme.colors,\n )\n // resolveColor can return 'inherit' or gradients which aren't valid for spinner\n // Fall back to primary for these cases\n if (resolved === 'inherit' || Array.isArray(resolved[0])) {\n defaultColor = theme.colors.primary\n } else {\n defaultColor = resolved as ColorValue\n }\n }\n\n // Convert color option to RGB (default from theme).\n const spinnerColor = opts.color ?? defaultColor\n\n // Validate RGB tuple if provided.\n if (\n isRgbTuple(spinnerColor) &&\n (spinnerColor.length !== 3 ||\n !spinnerColor.every(\n n => typeof n === 'number' && n >= 0 && n <= 255,\n ))\n ) {\n throw new TypeError(\n 'RGB color must be an array of 3 numbers between 0 and 255',\n )\n }\n\n const spinnerColorRgb = toRgb(spinnerColor)\n\n // Parse shimmer config - can be object or direction string.\n let shimmerInfo: ShimmerInfo | undefined\n if (opts.shimmer) {\n let shimmerDir: ShimmerDirection\n let shimmerColor:\n | ColorInherit\n | ColorValue\n | ShimmerColorGradient\n | undefined\n // Default: 0.33 steps per frame (~150ms per step).\n let shimmerSpeed: number = 1 / 3\n\n if (typeof opts.shimmer === 'string') {\n shimmerDir = opts.shimmer\n } else {\n const shimmerConfig = {\n __proto__: null,\n ...opts.shimmer,\n } as ShimmerConfig\n shimmerDir = shimmerConfig.dir ?? DIR_LTR\n shimmerColor = shimmerConfig.color ?? COLOR_INHERIT\n shimmerSpeed = shimmerConfig.speed ?? 1 / 3\n }\n\n // Create shimmer info with initial animation state:\n // - COLOR_INHERIT means use spinner color dynamically\n // - ColorValue (name or RGB tuple) is an explicit override color\n // - undefined color defaults to COLOR_INHERIT\n // - speed controls steps per frame (lower = slower, e.g., 0.33 = ~150ms per step)\n shimmerInfo = {\n __proto__: null,\n color: shimmerColor === undefined ? COLOR_INHERIT : shimmerColor,\n currentDir: DIR_LTR,\n mode: shimmerDir,\n speed: shimmerSpeed,\n step: 0,\n } as ShimmerInfo\n }\n\n // eslint-disable-next-line constructor-super\n super({\n signal: require('#constants/process').getAbortSignal(),\n ...opts,\n // Pass RGB color directly to yocto-spinner (it now supports RGB).\n color: spinnerColorRgb,\n // onRenderFrame callback provides full control over frame + text layout.\n // Calculates spacing based on frame width to prevent text jumping.\n onRenderFrame: (\n frame: string,\n text: string,\n applyColor: (text: string) => string,\n ) => {\n const width = stringWidth(frame)\n // Narrow frames (width 1) get 2 spaces, wide frames (width 2) get 1 space.\n // Total width is consistent: 3 characters (frame + spacing) before text.\n const spacing = width === 1 ? ' ' : ' '\n return frame ? `${applyColor(frame)}${spacing}${text}` : text\n },\n // onFrameUpdate callback is called by yocto-spinner whenever a frame advances.\n // This ensures shimmer updates are perfectly synchronized with animation beats.\n onFrameUpdate: shimmerInfo\n ? () => {\n // Update parent's text without triggering render.\n // Parent's #skipRender flag prevents nested render calls.\n // Only update if we have base text to avoid blank frames.\n if (this.#baseText) {\n super.text = this.#buildDisplayText()\n }\n }\n : undefined,\n })\n\n this.#shimmer = shimmerInfo\n this.#shimmerSavedConfig = shimmerInfo\n }\n\n // Override color getter to ensure it's always RGB.\n get color(): ColorRgb {\n const value = super.color\n return isRgbTuple(value) ? value : toRgb(value)\n }\n\n // Override color setter to always convert to RGB before passing to yocto-spinner.\n set color(value: ColorValue | ColorRgb) {\n super.color = isRgbTuple(value) ? value : toRgb(value)\n }\n\n // Getter to expose current shimmer state.\n get shimmerState(): ShimmerInfo | undefined {\n if (!this.#shimmer) {\n return undefined\n }\n return {\n color: this.#shimmer.color,\n currentDir: this.#shimmer.currentDir,\n mode: this.#shimmer.mode,\n speed: this.#shimmer.speed,\n step: this.#shimmer.step,\n } as ShimmerInfo\n }\n\n /**\n * Apply a yocto-spinner method and update logger state.\n * Handles text normalization, extra arguments, and logger tracking.\n * @private\n */\n #apply(methodName: string, args: unknown[]) {\n let extras: unknown[]\n let text = args.at(0)\n if (typeof text === 'string') {\n extras = args.slice(1)\n } else {\n extras = args\n text = ''\n }\n const wasSpinning = this.isSpinning\n const normalized = normalizeText(text)\n super[methodName](normalized)\n const {\n getDefaultLogger,\n incLogCallCountSymbol,\n lastWasBlankSymbol,\n } = /*@__PURE__*/ require('./logger.js')\n const logger = getDefaultLogger()\n if (methodName === 'stop') {\n if (wasSpinning && normalized) {\n logger[lastWasBlankSymbol](isBlankString(normalized))\n logger[incLogCallCountSymbol]()\n }\n } else {\n logger[lastWasBlankSymbol](false)\n logger[incLogCallCountSymbol]()\n }\n if (extras.length) {\n logger.log(...extras)\n logger[lastWasBlankSymbol](false)\n }\n return this\n }\n\n /**\n * Build the complete display text with progress, shimmer, and indentation.\n * Combines base text, progress bar, shimmer effects, and indentation.\n * @private\n */\n #buildDisplayText() {\n let displayText = this.#baseText\n\n if (this.#progress) {\n const progressText = formatProgress(this.#progress)\n displayText = displayText\n ? `${displayText} ${progressText}`\n : progressText\n }\n\n // Apply shimmer effect if enabled.\n if (displayText && this.#shimmer) {\n // If shimmer color is 'inherit', use current spinner color (getter ensures RGB).\n // Otherwise, check if it's a gradient (array of arrays) or single color.\n let shimmerColor: ColorRgb | ShimmerColorGradient\n if (this.#shimmer.color === COLOR_INHERIT) {\n shimmerColor = this.color\n } else if (Array.isArray(this.#shimmer.color[0])) {\n // It's a gradient - use as is.\n shimmerColor = this.#shimmer.color as ShimmerColorGradient\n } else {\n // It's a single color - convert to RGB.\n shimmerColor = toRgb(this.#shimmer.color as ColorValue)\n }\n\n displayText = applyShimmer(displayText, this.#shimmer, {\n color: shimmerColor,\n direction: this.#shimmer.mode,\n })\n }\n\n // Apply indentation\n if (this.#indentation && displayText) {\n displayText = this.#indentation + displayText\n }\n\n return displayText\n }\n\n /**\n * Show a status message without stopping the spinner.\n * Outputs the symbol and message to stderr, then continues spinning.\n */\n #showStatusAndKeepSpinning(symbolType: SymbolType, args: unknown[]) {\n let text = args.at(0)\n let extras: unknown[]\n if (typeof text === 'string') {\n extras = args.slice(1)\n } else {\n extras = args\n text = ''\n }\n\n const {\n LOG_SYMBOLS,\n getDefaultLogger,\n } = /*@__PURE__*/ require('./logger.js')\n // Note: Status messages always go to stderr.\n const logger = getDefaultLogger()\n logger.error(`${LOG_SYMBOLS[symbolType]} ${text}`, ...extras)\n return this\n }\n\n /**\n * Update the spinner's displayed text.\n * Rebuilds display text and triggers render.\n * @private\n */\n #updateSpinnerText() {\n // Call the parent class's text setter, which triggers render.\n super.text = this.#buildDisplayText()\n }\n\n /**\n * Show a debug message (\u2139) without stopping the spinner.\n * Only displays if debug mode is enabled via environment variable.\n * Outputs to stderr and continues spinning.\n *\n * @param text - Debug message to display\n * @param extras - Additional values to log\n * @returns This spinner for chaining\n */\n debug(text?: string | undefined, ...extras: unknown[]) {\n const { isDebug } = /*@__PURE__*/ require('./debug.js')\n if (isDebug()) {\n return this.#showStatusAndKeepSpinning('info', [text, ...extras])\n }\n return this\n }\n\n /**\n * Show a debug message (\u2139) and stop the spinner.\n * Only displays if debug mode is enabled via environment variable.\n * Auto-clears the spinner line before displaying the message.\n *\n * @param text - Debug message to display\n * @param extras - Additional values to log\n * @returns This spinner for chaining\n */\n debugAndStop(text?: string | undefined, ...extras: unknown[]) {\n const { isDebug } = /*@__PURE__*/ require('./debug.js')\n if (isDebug()) {\n return this.#apply('info', [text, ...extras])\n }\n return this\n }\n\n /**\n * Decrease indentation level by removing spaces from the left.\n * Pass 0 to reset indentation to zero completely.\n *\n * @param spaces - Number of spaces to remove\n * @returns This spinner for chaining\n * @default spaces=2\n *\n * @example\n * ```ts\n * spinner.dedent() // Remove 2 spaces\n * spinner.dedent(4) // Remove 4 spaces\n * spinner.dedent(0) // Reset to zero indentation\n * ```\n */\n dedent(spaces?: number | undefined) {\n // Pass 0 to reset indentation\n if (spaces === 0) {\n this.#indentation = ''\n } else {\n const amount = spaces ?? 2\n const newLength = Math.max(0, this.#indentation.length - amount)\n this.#indentation = this.#indentation.slice(0, newLength)\n }\n this.#updateSpinnerText()\n return this\n }\n\n /**\n * Show a done/success message (\u2713) without stopping the spinner.\n * Alias for `success()` with a shorter name.\n *\n * DESIGN DECISION: Unlike yocto-spinner, our `done()` does NOT stop the spinner.\n * Use `doneAndStop()` if you want to stop the spinner.\n *\n * @param text - Message to display\n * @param extras - Additional values to log\n * @returns This spinner for chaining\n */\n done(text?: string | undefined, ...extras: unknown[]) {\n return this.#showStatusAndKeepSpinning('success', [text, ...extras])\n }\n\n /**\n * Show a done/success message (\u2713) and stop the spinner.\n * Auto-clears the spinner line before displaying the success message.\n *\n * @param text - Message to display\n * @param extras - Additional values to log\n * @returns This spinner for chaining\n */\n doneAndStop(text?: string | undefined, ...extras: unknown[]) {\n return this.#apply('success', [text, ...extras])\n }\n\n /**\n * Show a failure message (\u2717) without stopping the spinner.\n * DESIGN DECISION: Unlike yocto-spinner, our `fail()` does NOT stop the spinner.\n * This allows displaying errors while continuing to spin.\n * Use `failAndStop()` if you want to stop the spinner.\n *\n * @param text - Error message to display\n * @param extras - Additional values to log\n * @returns This spinner for chaining\n */\n fail(text?: string | undefined, ...extras: unknown[]) {\n return this.#showStatusAndKeepSpinning('fail', [text, ...extras])\n }\n\n /**\n * Show a failure message (\u2717) and stop the spinner.\n * Auto-clears the spinner line before displaying the error message.\n *\n * @param text - Error message to display\n * @param extras - Additional values to log\n * @returns This spinner for chaining\n */\n failAndStop(text?: string | undefined, ...extras: unknown[]) {\n return this.#apply('error', [text, ...extras])\n }\n\n /**\n * Increase indentation level by adding spaces to the left.\n * Pass 0 to reset indentation to zero completely.\n *\n * @param spaces - Number of spaces to add\n * @returns This spinner for chaining\n * @default spaces=2\n *\n * @example\n * ```ts\n * spinner.indent() // Add 2 spaces\n * spinner.indent(4) // Add 4 spaces\n * spinner.indent(0) // Reset to zero indentation\n * ```\n */\n indent(spaces?: number | undefined) {\n // Pass 0 to reset indentation\n if (spaces === 0) {\n this.#indentation = ''\n } else {\n const amount = spaces ?? 2\n this.#indentation += ' '.repeat(amount)\n }\n this.#updateSpinnerText()\n return this\n }\n\n /**\n * Show an info message (\u2139) without stopping the spinner.\n * Outputs to stderr and continues spinning.\n *\n * @param text - Info message to display\n * @param extras - Additional values to log\n * @returns This spinner for chaining\n */\n info(text?: string | undefined, ...extras: unknown[]) {\n return this.#showStatusAndKeepSpinning('info', [text, ...extras])\n }\n\n /**\n * Show an info message (\u2139) and stop the spinner.\n * Auto-clears the spinner line before displaying the message.\n *\n * @param text - Info message to display\n * @param extras - Additional values to log\n * @returns This spinner for chaining\n */\n infoAndStop(text?: string | undefined, ...extras: unknown[]) {\n return this.#apply('info', [text, ...extras])\n }\n\n /**\n * Log a message to stdout without stopping the spinner.\n * Unlike other status methods, this outputs to stdout for data logging.\n *\n * @param args - Values to log to stdout\n * @returns This spinner for chaining\n */\n log(...args: unknown[]) {\n const { getDefaultLogger } = /*@__PURE__*/ require('./logger.js')\n const logger = getDefaultLogger()\n logger.log(...args)\n return this\n }\n\n /**\n * Log a message to stdout and stop the spinner.\n * Auto-clears the spinner line before displaying the message.\n *\n * @param text - Message to display\n * @param extras - Additional values to log\n * @returns This spinner for chaining\n */\n logAndStop(text?: string | undefined, ...extras: unknown[]) {\n return this.#apply('stop', [text, ...extras])\n }\n\n /**\n * Update progress information displayed with the spinner.\n * Shows a progress bar with percentage and optional unit label.\n *\n * @param current - Current progress value\n * @param total - Total/maximum progress value\n * @param unit - Optional unit label (e.g., 'files', 'items')\n * @returns This spinner for chaining\n *\n * @example\n * ```ts\n * spinner.progress(5, 10) // \"\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591 50% (5/10)\"\n * spinner.progress(7, 20, 'files') // \"\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591 35% (7/20 files)\"\n * ```\n */\n progress = (\n current: number,\n total: number,\n unit?: string | undefined,\n ) => {\n this.#progress = {\n __proto__: null,\n current,\n total,\n ...(unit ? { unit } : {}),\n } as ProgressInfo\n this.#updateSpinnerText()\n return this\n }\n\n /**\n * Increment progress by a specified amount.\n * Updates the progress bar displayed with the spinner.\n * Clamps the result between 0 and the total value.\n *\n * @param amount - Amount to increment by\n * @returns This spinner for chaining\n * @default amount=1\n *\n * @example\n * ```ts\n * spinner.progress(0, 10, 'files')\n * spinner.progressStep() // Progress: 1/10\n * spinner.progressStep(3) // Progress: 4/10\n * ```\n */\n progressStep(amount: number = 1) {\n if (this.#progress) {\n const newCurrent = this.#progress.current + amount\n this.#progress = {\n __proto__: null,\n current: Math.max(0, Math.min(newCurrent, this.#progress.total)),\n total: this.#progress.total,\n ...(this.#progress.unit ? { unit: this.#progress.unit } : {}),\n } as ProgressInfo\n this.#updateSpinnerText()\n }\n return this\n }\n\n /**\n * Start the spinner animation with optional text.\n * Begins displaying the animated spinner on stderr.\n *\n * @param text - Optional text to display with the spinner\n * @returns This spinner for chaining\n *\n * @example\n * ```ts\n * spinner.start('Loading\u2026')\n * // Later:\n * spinner.successAndStop('Done!')\n * ```\n */\n start(...args: unknown[]) {\n if (args.length) {\n const text = args.at(0)\n const normalized = normalizeText(text)\n // We clear this.text on start when `text` is falsy because yocto-spinner\n // will not clear it otherwise.\n if (!normalized) {\n this.#baseText = ''\n super.text = ''\n } else {\n this.#baseText = normalized\n }\n }\n\n this.#updateSpinnerText()\n // Don't pass text to yocto-spinner.start() since we already set it via #updateSpinnerText().\n // Passing args would cause duplicate message output.\n return this.#apply('start', [])\n }\n\n /**\n * Log a main step message to stderr without stopping the spinner.\n * Adds a blank line before the message for visual separation.\n * Aligns with `logger.step()` to use stderr for status messages.\n *\n * @param text - Step message to display\n * @param extras - Additional values to log\n * @returns This spinner for chaining\n *\n * @example\n * ```ts\n * spinner.step('Building application')\n * spinner.substep('Compiling TypeScript')\n * spinner.substep('Bundling assets')\n * ```\n */\n step(text?: string | undefined, ...extras: unknown[]) {\n const { getDefaultLogger } = /*@__PURE__*/ require('./logger.js')\n if (typeof text === 'string') {\n const logger = getDefaultLogger()\n // Add blank line before step for visual separation.\n logger.error('')\n // Use error (stderr) to align with logger.step() default stream.\n logger.error(text, ...extras)\n }\n return this\n }\n\n /**\n * Log an indented substep message to stderr without stopping the spinner.\n * Adds 2-space indentation to the message.\n * Aligns with `logger.substep()` to use stderr for status messages.\n *\n * @param text - Substep message to display\n * @param extras - Additional values to log\n * @returns This spinner for chaining\n *\n * @example\n * ```ts\n * spinner.step('Building application')\n * spinner.substep('Compiling TypeScript')\n * spinner.substep('Bundling assets')\n * ```\n */\n substep(text?: string | undefined, ...extras: unknown[]) {\n if (typeof text === 'string') {\n // Add 2-space indent for substep.\n const { getDefaultLogger } = /*@__PURE__*/ require('./logger.js')\n const logger = getDefaultLogger()\n // Use error (stderr) to align with logger.substep() default stream.\n logger.error(` ${text}`, ...extras)\n }\n return this\n }\n\n /**\n * Stop the spinner animation and clear internal state.\n * Auto-clears the spinner line via yocto-spinner.stop().\n * Resets progress, shimmer, and text state.\n *\n * @param text - Optional final text to display after stopping\n * @returns This spinner for chaining\n *\n * @example\n * ```ts\n * spinner.start('Processing\u2026')\n * // Do work\n * spinner.stop() // Just stop, no message\n * // or\n * spinner.stop('Finished processing')\n * ```\n */\n stop(...args: unknown[]) {\n // Clear internal state.\n this.#baseText = ''\n this.#progress = undefined\n // Reset shimmer animation state if shimmer is enabled.\n if (this.#shimmer) {\n this.#shimmer.currentDir = DIR_LTR\n this.#shimmer.step = 0\n }\n // Call parent stop first (clears screen, sets isSpinning = false).\n const result = this.#apply('stop', args)\n // Then clear text to avoid blank frame render.\n // This is safe now because isSpinning is false.\n super.text = ''\n return result\n }\n\n /**\n * Show a success message (\u2713) without stopping the spinner.\n * DESIGN DECISION: Unlike yocto-spinner, our `success()` does NOT stop the spinner.\n * This allows displaying success messages while continuing to spin for multi-step operations.\n * Use `successAndStop()` if you want to stop the spinner.\n *\n * @param text - Success message to display\n * @param extras - Additional values to log\n * @returns This spinner for chaining\n */\n success(text?: string | undefined, ...extras: unknown[]) {\n return this.#showStatusAndKeepSpinning('success', [text, ...extras])\n }\n\n /**\n * Show a success message (\u2713) and stop the spinner.\n * Auto-clears the spinner line before displaying the success message.\n *\n * @param text - Success message to display\n * @param extras - Additional values to log\n * @returns This spinner for chaining\n */\n successAndStop(text?: string | undefined, ...extras: unknown[]) {\n return this.#apply('success', [text, ...extras])\n }\n\n /**\n * Get or set the spinner text.\n * When called with no arguments, returns the current base text.\n * When called with text, updates the display and returns the spinner for chaining.\n *\n * @param value - Text to display (omit to get current text)\n * @returns Current text (getter) or this spinner (setter)\n *\n * @example\n * ```ts\n * // Setter\n * spinner.text('Loading data\u2026')\n * spinner.text('Processing\u2026')\n *\n * // Getter\n * const current = spinner.text()\n * console.log(current) // \"Processing\u2026\"\n * ```\n */\n text(): string\n text(value: string): Spinner\n text(value?: string): string | Spinner {\n // biome-ignore lint/complexity/noArguments: Function overload for getter/setter pattern.\n if (arguments.length === 0) {\n // Getter: return current base text\n return this.#baseText\n }\n // Setter: update base text and refresh display\n this.#baseText = value ?? ''\n this.#updateSpinnerText()\n return this as unknown as Spinner\n }\n\n /**\n * Show a warning message (\u26A0) without stopping the spinner.\n * Outputs to stderr and continues spinning.\n *\n * @param text - Warning message to display\n * @param extras - Additional values to log\n * @returns This spinner for chaining\n */\n warn(text?: string | undefined, ...extras: unknown[]) {\n return this.#showStatusAndKeepSpinning('warn', [text, ...extras])\n }\n\n /**\n * Show a warning message (\u26A0) and stop the spinner.\n * Auto-clears the spinner line before displaying the warning message.\n *\n * @param text - Warning message to display\n * @param extras - Additional values to log\n * @returns This spinner for chaining\n */\n warnAndStop(text?: string | undefined, ...extras: unknown[]) {\n return this.#apply('warning', [text, ...extras])\n }\n\n /**\n * Enable shimmer effect.\n * Restores saved config or uses defaults if no saved config exists.\n *\n * @returns This spinner for chaining\n *\n * @example\n * spinner.enableShimmer()\n */\n enableShimmer(): Spinner {\n if (this.#shimmerSavedConfig) {\n // Restore saved config.\n this.#shimmer = { ...this.#shimmerSavedConfig }\n } else {\n // Create default config.\n this.#shimmer = {\n color: COLOR_INHERIT,\n currentDir: DIR_LTR,\n mode: DIR_LTR,\n speed: 1 / 3,\n step: 0,\n } as ShimmerInfo\n this.#shimmerSavedConfig = this.#shimmer\n }\n\n this.#updateSpinnerText()\n return this as unknown as Spinner\n }\n\n /**\n * Disable shimmer effect.\n * Preserves config for later re-enable via enableShimmer().\n *\n * @returns This spinner for chaining\n *\n * @example\n * spinner.disableShimmer()\n */\n disableShimmer(): Spinner {\n // Disable shimmer but preserve config.\n this.#shimmer = undefined\n this.#updateSpinnerText()\n return this as unknown as Spinner\n }\n\n /**\n * Set complete shimmer configuration.\n * Replaces any existing shimmer config with the provided values.\n *\n * @param config - Complete shimmer configuration\n * @returns This spinner for chaining\n *\n * @example\n * spinner.setShimmer({\n * color: [255, 0, 0],\n * dir: 'rtl',\n * speed: 0.5\n * })\n */\n setShimmer(config: ShimmerConfig): Spinner {\n this.#shimmer = {\n color: config.color,\n currentDir: DIR_LTR,\n mode: config.dir,\n speed: config.speed,\n step: 0,\n } as ShimmerInfo\n this.#shimmerSavedConfig = this.#shimmer\n this.#updateSpinnerText()\n return this as unknown as Spinner\n }\n\n /**\n * Update partial shimmer configuration.\n * Merges with existing config, enabling shimmer if currently disabled.\n *\n * @param config - Partial shimmer configuration to merge\n * @returns This spinner for chaining\n *\n * @example\n * // Update just the speed\n * spinner.updateShimmer({ speed: 0.5 })\n *\n * // Update direction\n * spinner.updateShimmer({ dir: 'rtl' })\n *\n * // Update multiple properties\n * spinner.updateShimmer({ color: [255, 0, 0], speed: 0.8 })\n */\n updateShimmer(config: Partial<ShimmerConfig>): Spinner {\n const partialConfig = {\n __proto__: null,\n ...config,\n } as Partial<ShimmerConfig>\n\n if (this.#shimmer) {\n // Update existing shimmer.\n this.#shimmer = {\n ...this.#shimmer,\n ...(partialConfig.color !== undefined\n ? { color: partialConfig.color }\n : {}),\n ...(partialConfig.dir !== undefined\n ? { mode: partialConfig.dir }\n : {}),\n ...(partialConfig.speed !== undefined\n ? { speed: partialConfig.speed }\n : {}),\n } as ShimmerInfo\n this.#shimmerSavedConfig = this.#shimmer\n } else if (this.#shimmerSavedConfig) {\n // Restore and update.\n this.#shimmer = {\n ...this.#shimmerSavedConfig,\n ...(partialConfig.color !== undefined\n ? { color: partialConfig.color }\n : {}),\n ...(partialConfig.dir !== undefined\n ? { mode: partialConfig.dir }\n : {}),\n ...(partialConfig.speed !== undefined\n ? { speed: partialConfig.speed }\n : {}),\n } as ShimmerInfo\n this.#shimmerSavedConfig = this.#shimmer\n } else {\n // Create new with partial config.\n this.#shimmer = {\n color: partialConfig.color ?? COLOR_INHERIT,\n currentDir: DIR_LTR,\n mode: partialConfig.dir ?? DIR_LTR,\n speed: partialConfig.speed ?? 1 / 3,\n step: 0,\n } as ShimmerInfo\n this.#shimmerSavedConfig = this.#shimmer\n }\n\n this.#updateSpinnerText()\n return this as unknown as Spinner\n }\n } as unknown as {\n new (options?: SpinnerOptions | undefined): Spinner\n }\n // Add aliases.\n Object.defineProperties(_Spinner.prototype, {\n error: desc(_Spinner.prototype.fail),\n errorAndStop: desc(_Spinner.prototype.failAndStop),\n warning: desc(_Spinner.prototype.warn),\n warningAndStop: desc(_Spinner.prototype.warnAndStop),\n })\n _defaultSpinner = getCI()\n ? ciSpinner\n : (getCliSpinners('socket') as SpinnerStyle)\n }\n return new _Spinner({\n spinner: _defaultSpinner,\n ...options,\n })\n}\n\nlet _spinner: ReturnType<typeof Spinner> | undefined\n\n/**\n * Get the default spinner instance.\n * Lazily creates the spinner to avoid circular dependencies during module initialization.\n * Reuses the same instance across calls.\n *\n * @returns Shared default spinner instance\n *\n * @example\n * ```ts\n * import { getDefaultSpinner } from '@socketsecurity/lib/spinner'\n *\n * const spinner = getDefaultSpinner()\n * spinner.start('Loading\u2026')\n * ```\n */\nexport function getDefaultSpinner(): ReturnType<typeof Spinner> {\n if (_spinner === undefined) {\n _spinner = Spinner()\n }\n return _spinner\n}\n\n// REMOVED: Deprecated `spinner` export\n// Migration: Use getDefaultSpinner() instead\n// See: getDefaultSpinner() function above\n\n/**\n * Configuration options for `withSpinner()` helper.\n * @template T - Return type of the async operation\n */\nexport type WithSpinnerOptions<T> = {\n /** Message to display while the spinner is running */\n message: string\n /** Async function to execute while spinner is active */\n operation: () => Promise<T>\n /**\n * Optional spinner instance to use.\n * If not provided, operation runs without spinner.\n */\n spinner?: Spinner | undefined\n /**\n * Optional spinner options to apply during the operation.\n * These options will be pushed when the operation starts and popped when it completes.\n * Supports color and shimmer configuration.\n */\n withOptions?: Partial<Pick<SpinnerOptions, 'color' | 'shimmer'>> | undefined\n}\n\n/**\n * Execute an async operation with spinner lifecycle management.\n * Ensures `spinner.stop()` is always called via try/finally, even if the operation throws.\n * Provides safe cleanup and consistent spinner behavior.\n *\n * @template T - Return type of the operation\n * @param options - Configuration object\n * @param options.message - Message to display while spinner is running\n * @param options.operation - Async function to execute\n * @param options.spinner - Optional spinner instance (if not provided, no spinner is used)\n * @returns Result of the operation\n * @throws Re-throws any error from operation after stopping spinner\n *\n * @example\n * ```ts\n * import { Spinner, withSpinner } from '@socketsecurity/lib/spinner'\n *\n * const spinner = Spinner()\n *\n * // With spinner instance\n * const result = await withSpinner({\n * message: 'Processing\u2026',\n * operation: async () => {\n * return await processData()\n * },\n * spinner\n * })\n *\n * // Without spinner instance (no-op, just runs operation)\n * const result = await withSpinner({\n * message: 'Processing\u2026',\n * operation: async () => {\n * return await processData()\n * }\n * })\n * ```\n */\nexport async function withSpinner<T>(\n options: WithSpinnerOptions<T>,\n): Promise<T> {\n const { message, operation, spinner, withOptions } = {\n __proto__: null,\n ...options,\n } as WithSpinnerOptions<T>\n\n if (!spinner) {\n return await operation()\n }\n\n // Save current options if we're going to change them\n const savedColor =\n withOptions?.color !== undefined ? spinner.color : undefined\n const savedShimmerState =\n withOptions?.shimmer !== undefined ? spinner.shimmerState : undefined\n\n // Apply temporary options\n if (withOptions?.color !== undefined) {\n spinner.color = toRgb(withOptions.color)\n }\n if (withOptions?.shimmer !== undefined) {\n if (typeof withOptions.shimmer === 'string') {\n spinner.updateShimmer({ dir: withOptions.shimmer })\n } else {\n spinner.setShimmer(withOptions.shimmer)\n }\n }\n\n spinner.start(message)\n try {\n return await operation()\n } finally {\n spinner.stop()\n // Restore previous options\n if (savedColor !== undefined) {\n spinner.color = savedColor\n }\n if (withOptions?.shimmer !== undefined) {\n if (savedShimmerState) {\n spinner.setShimmer({\n color: savedShimmerState.color as any,\n dir: savedShimmerState.mode,\n speed: savedShimmerState.speed,\n })\n } else {\n spinner.disableShimmer()\n }\n }\n }\n}\n\n/**\n * Configuration options for `withSpinnerRestore()` helper.\n * @template T - Return type of the async operation\n */\nexport type WithSpinnerRestoreOptions<T> = {\n /** Async function to execute while spinner is stopped */\n operation: () => Promise<T>\n /** Optional spinner instance to restore after operation */\n spinner?: Spinner | undefined\n /** Whether spinner was spinning before the operation (used to conditionally restart) */\n wasSpinning: boolean\n}\n\n/**\n * Execute an async operation with conditional spinner restart.\n * Useful when you need to temporarily stop a spinner for an operation,\n * then restore it to its previous state (if it was spinning).\n *\n * @template T - Return type of the operation\n * @param options - Configuration object\n * @param options.operation - Async function to execute\n * @param options.spinner - Optional spinner instance to manage\n * @param options.wasSpinning - Whether spinner was spinning before the operation\n * @returns Result of the operation\n * @throws Re-throws any error from operation after restoring spinner state\n *\n * @example\n * ```ts\n * import { getDefaultSpinner, withSpinnerRestore } from '@socketsecurity/lib/spinner'\n *\n * const spinner = getDefaultSpinner()\n * const wasSpinning = spinner.isSpinning\n * spinner.stop()\n *\n * const result = await withSpinnerRestore({\n * operation: async () => {\n * // Do work without spinner\n * return await someOperation()\n * },\n * spinner,\n * wasSpinning\n * })\n * // Spinner is automatically restarted if wasSpinning was true\n * ```\n */\nexport async function withSpinnerRestore<T>(\n options: WithSpinnerRestoreOptions<T>,\n): Promise<T> {\n const { operation, spinner, wasSpinning } = {\n __proto__: null,\n ...options,\n } as WithSpinnerRestoreOptions<T>\n\n try {\n return await operation()\n } finally {\n if (spinner && wasSpinning) {\n spinner.start()\n }\n }\n}\n\n/**\n * Configuration options for `withSpinnerSync()` helper.\n * @template T - Return type of the sync operation\n */\nexport type WithSpinnerSyncOptions<T> = {\n /** Message to display while the spinner is running */\n message: string\n /** Synchronous function to execute while spinner is active */\n operation: () => T\n /**\n * Optional spinner instance to use.\n * If not provided, operation runs without spinner.\n */\n spinner?: Spinner | undefined\n /**\n * Optional spinner options to apply during the operation.\n * These options will be pushed when the operation starts and popped when it completes.\n * Supports color and shimmer configuration.\n */\n withOptions?: Partial<Pick<SpinnerOptions, 'color' | 'shimmer'>> | undefined\n}\n\n/**\n * Execute a synchronous operation with spinner lifecycle management.\n * Ensures `spinner.stop()` is always called via try/finally, even if the operation throws.\n * Provides safe cleanup and consistent spinner behavior for sync operations.\n *\n * @template T - Return type of the operation\n * @param options - Configuration object\n * @param options.message - Message to display while spinner is running\n * @param options.operation - Synchronous function to execute\n * @param options.spinner - Optional spinner instance (if not provided, no spinner is used)\n * @returns Result of the operation\n * @throws Re-throws any error from operation after stopping spinner\n *\n * @example\n * ```ts\n * import { Spinner, withSpinnerSync } from '@socketsecurity/lib/spinner'\n *\n * const spinner = Spinner()\n *\n * const result = withSpinnerSync({\n * message: 'Processing\u2026',\n * operation: () => {\n * return processDataSync()\n * },\n * spinner\n * })\n * ```\n */\nexport function withSpinnerSync<T>(options: WithSpinnerSyncOptions<T>): T {\n const { message, operation, spinner, withOptions } = {\n __proto__: null,\n ...options,\n } as WithSpinnerSyncOptions<T>\n\n if (!spinner) {\n return operation()\n }\n\n // Save current options if we're going to change them\n const savedColor =\n withOptions?.color !== undefined ? spinner.color : undefined\n const savedShimmerState =\n withOptions?.shimmer !== undefined ? spinner.shimmerState : undefined\n\n // Apply temporary options\n if (withOptions?.color !== undefined) {\n spinner.color = toRgb(withOptions.color)\n }\n if (withOptions?.shimmer !== undefined) {\n if (typeof withOptions.shimmer === 'string') {\n spinner.updateShimmer({ dir: withOptions.shimmer })\n } else {\n spinner.setShimmer(withOptions.shimmer)\n }\n }\n\n spinner.start(message)\n try {\n return operation()\n } finally {\n spinner.stop()\n // Restore previous options\n if (savedColor !== undefined) {\n spinner.color = savedColor\n }\n if (withOptions?.shimmer !== undefined) {\n if (savedShimmerState) {\n spinner.setShimmer({\n color: savedShimmerState.color as any,\n dir: savedShimmerState.mode,\n speed: savedShimmerState.speed,\n })\n } else {\n spinner.disableShimmer()\n }\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";6iBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,cAAAC,EAAA,mBAAAC,EAAA,sBAAAC,EAAA,UAAAC,EAAA,gBAAAC,EAAA,uBAAAC,EAAA,oBAAAC,IAAA,eAAAC,EAAAV,GAQA,IAAAW,EAAsB,mBACtBC,EAA4C,kCAO5CC,EAAqD,kCACrDC,EAAyB,uDACzBC,EAAuB,qBACvBC,EAA2C,qBAC3CC,EAAyB,4BACzBC,EAA6B,0BAiD7B,MAAMC,EAA0C,CAC9C,UAAW,KACX,MAAO,CAAC,EAAG,EAAG,CAAC,EACf,KAAM,CAAC,EAAG,EAAG,GAAG,EAChB,WAAY,CAAC,IAAK,IAAK,GAAG,EAC1B,KAAM,CAAC,EAAG,IAAK,GAAG,EAClB,WAAY,CAAC,EAAG,IAAK,GAAG,EACxB,KAAM,CAAC,IAAK,IAAK,GAAG,EACpB,MAAO,CAAC,EAAG,IAAK,CAAC,EACjB,YAAa,CAAC,EAAG,IAAK,CAAC,EACvB,QAAS,CAAC,IAAK,EAAG,GAAG,EACrB,cAAe,CAAC,IAAK,IAAK,GAAG,EAC7B,IAAK,CAAC,IAAK,EAAG,CAAC,EACf,UAAW,CAAC,IAAK,GAAI,CAAC,EACtB,MAAO,CAAC,IAAK,IAAK,GAAG,EACrB,YAAa,CAAC,IAAK,IAAK,GAAG,EAC3B,OAAQ,CAAC,IAAK,IAAK,CAAC,EACpB,aAA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AC,EAAW,QAAAC,EAAS,YAAAC,CAAY,EAAI,CACnD,UAAW,KACX,GAAGpD,CACL,EAEA,GAAI,CAACmD,EACH,OAAOD,EAAU,EAInB,MAAMG,EACJD,GAAa,QAAU,OAAYD,EAAQ,MAAQ,OAC/CG,EACJF,GAAa,UAAY,OAAYD,EAAQ,aAAe,OAG1DC,GAAa,QAAU,SACzBD,EAAQ,MAAQvF,EAAMwF,EAAY,KAAK,GAErCA,GAAa,UAAY,SACvB,OAAOA,EAAY,SAAY,SACjCD,EAAQ,cAAc,CAAE,IAAKC,EAAY,OAAQ,CAAC,EAElDD,EAAQ,WAAWC,EAAY,OAAO,GAI1CD,EAAQ,MAAMF,CAAO,EACrB,GAAI,CACF,OAAOC,EAAU,CACnB,QAAE,CACAC,EAAQ,KAAK,EAETE,IAAe,SACjBF,EAAQ,MAAQE,GAEdD,GAAa,UAAY,SACvBE,EACFH,EAAQ,WAAW,CACjB,MAAOG,EAAkB,MACzB,IAAKA,EAAkB,KACvB,MAAOA,EAAkB,KAC3B,CAAC,EAEDH,EAAQ,eAAe,EAG7B,CACF",
|
|
6
|
+
"names": ["spinner_exports", "__export", "Spinner", "ciSpinner", "getCliSpinners", "getDefaultSpinner", "toRgb", "withSpinner", "withSpinnerRestore", "withSpinnerSync", "__toCommonJS", "import_ci", "import_pulse_frames", "import_text_shimmer", "import_yocto_spinner", "import_objects", "import_strings", "import_context", "import_utils", "colorToRgb", "isRgbTuple", "value", "color", "desc", "normalizeText", "formatProgress", "progress", "current", "total", "unit", "percentage", "bar", "renderProgressBar", "count", "width", "filled", "empty", "_cliSpinners", "styleName", "yoctoSpinner", "_Spinner", "_defaultSpinner", "options", "YoctoSpinnerClass", "#baseText", "#indentation", "#progress", "#shimmer", "#shimmerSavedConfig", "opts", "theme", "defaultColor", "resolved", "spinnerColor", "n", "spinnerColorRgb", "shimmerInfo", "shimmerDir", "shimmerColor", "shimmerSpeed", "shimmerConfig", "frame", "text", "applyColor", "spacing", "#buildDisplayText", "#apply", "methodName", "args", "extras", "wasSpinning", "normalized", "getDefaultLogger", "incLogCallCountSymbol", "lastWasBlankSymbol", "logger", "displayText", "progressText", "#showStatusAndKeepSpinning", "symbolType", "LOG_SYMBOLS", "#updateSpinnerText", "isDebug", "spaces", "amount", "newLength", "newCurrent", "result", "config", "partialConfig", "_spinner", "message", "operation", "spinner", "withOptions", "savedColor", "savedShimmerState"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@socketsecurity/lib",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Core utilities and infrastructure for Socket.dev security tools",
|
|
6
6
|
"keywords": [
|
|
@@ -356,10 +356,6 @@
|
|
|
356
356
|
"types": "./dist/packages/provenance.d.ts",
|
|
357
357
|
"default": "./dist/packages/provenance.js"
|
|
358
358
|
},
|
|
359
|
-
"./packages/registry": {
|
|
360
|
-
"types": "./dist/packages/registry.d.ts",
|
|
361
|
-
"default": "./dist/packages/registry.js"
|
|
362
|
-
},
|
|
363
359
|
"./packages/specs": {
|
|
364
360
|
"types": "./dist/packages/specs.d.ts",
|
|
365
361
|
"default": "./dist/packages/specs.js"
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
/* Socket Lib - Built with esbuild */
|
|
2
|
-
var o=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var k=(s,e)=>{for(var c in e)o(s,c,{get:e[c],enumerable:!0})},l=(s,e,c,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of g(e))!i.call(s,t)&&t!==c&&o(s,t,{get:()=>e[t],enumerable:!(r=a(e,t))||r.enumerable});return s};var p=s=>l(o({},"__esModule",{value:!0}),s);var y={};k(y,{SocketRegistry:()=>x});module.exports=p(y);class x{}0&&(module.exports={SocketRegistry});
|
|
3
|
-
//# sourceMappingURL=registry.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/packages/registry.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * @fileoverview Socket Registry class implementation.\n */\n\n/**\n * Main Socket Registry class for managing packages.\n */\nexport class SocketRegistry {}\n"],
|
|
5
|
-
"mappings": ";4ZAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oBAAAE,IAAA,eAAAC,EAAAH,GAOO,MAAME,CAAe,CAAC",
|
|
6
|
-
"names": ["registry_exports", "__export", "SocketRegistry", "__toCommonJS"]
|
|
7
|
-
}
|