@socketsecurity/lib 5.26.0 → 5.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +371 -1185
- package/README.md +1 -1
- package/dist/abort.js +7 -6
- package/dist/agent.js +16 -15
- package/dist/ansi.js +3 -2
- package/dist/archives.js +18 -17
- package/dist/argv/flags.js +29 -28
- package/dist/argv/parse.js +4 -3
- package/dist/arrays.js +3 -2
- package/dist/bin.js +12 -11
- package/dist/cacache.js +16 -11
- package/dist/cache-with-ttl.js +26 -21
- package/dist/colors.js +2 -1
- package/dist/constants/licenses.js +2 -1
- package/dist/constants/lifecycle-script-names.js +2 -1
- package/dist/constants/maintained-node-versions.js +2 -1
- package/dist/constants/node.js +4 -3
- package/dist/constants/package-default-socket-categories.js +2 -1
- package/dist/constants/packages.js +4 -3
- package/dist/constants/socket.js +1 -1
- package/dist/cover/code.js +9 -8
- package/dist/cover/formatters.js +12 -11
- package/dist/cover/type.js +5 -4
- package/dist/crypto.d.ts +36 -0
- package/dist/{effects/ultra.js → crypto.js} +26 -37
- package/dist/debug.js +12 -15
- package/dist/dlx/arborist.js +10 -9
- package/dist/dlx/binary.js +27 -24
- package/dist/dlx/cache.js +2 -10
- package/dist/dlx/detect.js +6 -5
- package/dist/dlx/integrity.js +13 -11
- package/dist/dlx/lockfile.js +7 -6
- package/dist/dlx/manifest.js +6 -5
- package/dist/dlx/package.js +17 -16
- package/dist/dlx/packages.js +6 -5
- package/dist/dlx/paths.d.ts +1 -1
- package/dist/dlx/paths.js +2 -1
- package/dist/effects/pulse-frames.js +4 -3
- package/dist/effects/shimmer-keyframes.d.ts +62 -0
- package/dist/effects/shimmer-keyframes.js +55 -0
- package/dist/effects/shimmer-terminal.d.ts +66 -0
- package/dist/effects/shimmer-terminal.js +57 -0
- package/dist/effects/shimmer.d.ts +293 -0
- package/dist/effects/shimmer.js +180 -0
- package/dist/env/rewire.js +4 -3
- package/dist/env.js +5 -4
- package/dist/errors.js +1 -1
- package/dist/external/@npmcli/package-json/lib/read-package.js +10 -10
- package/dist/external/@npmcli/package-json.js +372 -372
- package/dist/external/@npmcli/promise-spawn.js +24 -24
- package/dist/external/@socketregistry/packageurl-js.js +19 -18
- package/dist/external/@socketregistry/yocto-spinner.js +4 -3
- package/dist/external/@yarnpkg/extensions.js +2 -1
- package/dist/external/adm-zip.js +71 -71
- package/dist/external/debug.js +22 -22
- package/dist/external/external-pack.js +45 -45
- package/dist/external/fast-sort.js +5 -5
- package/dist/external/libnpmexec.js +4 -3
- package/dist/external/npm-pack.js +369 -369
- package/dist/external/p-map.js +9 -9
- package/dist/external/pico-pack.js +190 -190
- package/dist/external/pony-cause.js +2 -1
- package/dist/external/spdx-pack.js +11 -10
- package/dist/external/tar-fs.js +58 -58
- package/dist/external/which.js +13 -13
- package/dist/external/yargs-parser.js +71 -71
- package/dist/fs.js +50 -68
- package/dist/git.js +14 -13
- package/dist/github.d.ts +34 -0
- package/dist/github.js +248 -23
- package/dist/globs.d.ts +20 -0
- package/dist/globs.js +134 -25
- package/dist/http-request.d.ts +4 -3
- package/dist/http-request.js +39 -32
- package/dist/ipc-cli.js +2 -1
- package/dist/ipc.js +5 -4
- package/dist/json/edit.js +4 -3
- package/dist/json/format.js +3 -2
- package/dist/json/parse.js +7 -6
- package/dist/links.js +2 -1
- package/dist/logger.js +21 -14
- package/dist/memoization.js +16 -15
- package/dist/node/async-hooks.d.ts +6 -0
- package/dist/node/async-hooks.js +34 -0
- package/dist/node/child-process.d.ts +11 -0
- package/dist/node/child-process.js +34 -0
- package/dist/node/crypto.d.ts +6 -0
- package/dist/node/crypto.js +34 -0
- package/dist/node/events.d.ts +6 -0
- package/dist/node/events.js +34 -0
- package/dist/node/fs-promises.d.ts +6 -0
- package/dist/node/fs-promises.js +34 -0
- package/dist/node/fs.d.ts +14 -0
- package/dist/node/fs.js +34 -0
- package/dist/node/http.d.ts +6 -0
- package/dist/node/http.js +34 -0
- package/dist/node/https.d.ts +6 -0
- package/dist/node/https.js +34 -0
- package/dist/node/os.d.ts +6 -0
- package/dist/node/os.js +34 -0
- package/dist/node/path.d.ts +6 -0
- package/dist/node/path.js +34 -0
- package/dist/node/timers-promises.d.ts +6 -0
- package/dist/node/timers-promises.js +34 -0
- package/dist/node/url.d.ts +6 -0
- package/dist/node/url.js +34 -0
- package/dist/node/util.d.ts +6 -0
- package/dist/node/util.js +34 -0
- package/dist/objects.js +2 -2
- package/dist/packages/edit.js +8 -7
- package/dist/packages/exports.js +17 -16
- package/dist/packages/isolation.js +20 -13
- package/dist/packages/licenses.js +6 -3
- package/dist/packages/manifest.js +2 -1
- package/dist/packages/normalize.js +8 -4
- package/dist/packages/operations.js +5 -4
- package/dist/packages/provenance.js +7 -6
- package/dist/packages/specs.js +2 -1
- package/dist/packages/validation.js +2 -1
- package/dist/paths/normalize.js +32 -40
- package/dist/paths/packages.js +2 -1
- package/dist/paths/rewire.js +3 -2
- package/dist/performance.js +19 -18
- package/dist/primordials.d.ts +85 -2
- package/dist/primordials.js +311 -23
- package/dist/process-lock.js +14 -13
- package/dist/promise-queue.js +17 -9
- package/dist/promises.d.ts +29 -6
- package/dist/promises.js +19 -15
- package/dist/regexps.js +9 -8
- package/dist/releases/github-api.d.ts +56 -0
- package/dist/releases/github-api.js +275 -0
- package/dist/releases/github-archives.d.ts +60 -0
- package/dist/releases/github-archives.js +136 -0
- package/dist/releases/github-assets.d.ts +21 -0
- package/dist/releases/github-assets.js +52 -0
- package/dist/releases/github-auth.d.ts +16 -0
- package/dist/releases/github-auth.js +51 -0
- package/dist/releases/github-downloads.d.ts +42 -0
- package/dist/releases/github-downloads.js +155 -0
- package/dist/releases/github-types.d.ts +66 -0
- package/dist/{effects/types.js → releases/github-types.js} +2 -2
- package/dist/releases/socket-btm.d.ts +1 -1
- package/dist/releases/socket-btm.js +17 -17
- package/dist/schema/parse.js +2 -1
- package/dist/schema/validate.js +6 -5
- package/dist/sea/util.d.ts +43 -0
- package/dist/{sea.js → sea/util.js} +7 -7
- package/dist/shadow.js +2 -1
- package/dist/signal-exit.js +2 -2
- package/dist/smol/primordial.d.ts +80 -0
- package/dist/smol/primordial.js +46 -0
- package/dist/smol/util.d.ts +87 -0
- package/dist/smol/util.js +59 -0
- package/dist/smol/versions.d.ts +46 -0
- package/dist/smol/versions.js +46 -0
- package/dist/spawn.js +58 -63
- package/dist/spinner.d.ts +13 -6
- package/dist/spinner.js +75 -57
- package/dist/ssri.js +8 -7
- package/dist/stdio/footer.js +13 -12
- package/dist/stdio/header.js +5 -4
- package/dist/stdio/progress.js +13 -12
- package/dist/strings.js +19 -18
- package/dist/suppress-warnings.js +2 -2
- package/dist/tables.js +16 -13
- package/dist/temporary-executor.js +2 -1
- package/dist/themes/context.js +2 -1
- package/dist/themes/types.d.ts +1 -1
- package/dist/themes/utils.d.ts +8 -3
- package/dist/themes/utils.js +29 -5
- package/dist/url.js +4 -3
- package/dist/versions.js +27 -22
- package/package.json +120 -26
- package/dist/effects/text-shimmer.d.ts +0 -58
- package/dist/effects/text-shimmer.js +0 -192
- package/dist/effects/types.d.ts +0 -47
- package/dist/effects/ultra.d.ts +0 -22
- package/dist/releases/github.d.ts +0 -234
- package/dist/releases/github.js +0 -417
- package/dist/sea.d.ts +0 -30
- package/dist/themes/index.d.ts +0 -49
- package/dist/themes/index.js +0 -60
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* Socket Lib - Built with esbuild */
|
|
3
|
-
"use strict";
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
-
var text_shimmer_exports = {};
|
|
22
|
-
__export(text_shimmer_exports, {
|
|
23
|
-
COLOR_INHERIT: () => COLOR_INHERIT,
|
|
24
|
-
DIR_LTR: () => DIR_LTR,
|
|
25
|
-
DIR_NONE: () => DIR_NONE,
|
|
26
|
-
DIR_RANDOM: () => DIR_RANDOM,
|
|
27
|
-
DIR_RTL: () => DIR_RTL,
|
|
28
|
-
MODE_BI: () => MODE_BI,
|
|
29
|
-
applyShimmer: () => applyShimmer
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(text_shimmer_exports);
|
|
32
|
-
var import_ansi = require("../ansi");
|
|
33
|
-
var import_arrays = require("../arrays");
|
|
34
|
-
var import_ci = require("../env/ci");
|
|
35
|
-
var import_themes = require("../themes/themes");
|
|
36
|
-
var import_utils = require("../themes/utils");
|
|
37
|
-
const COLOR_INHERIT = "inherit";
|
|
38
|
-
const DIR_LTR = "ltr";
|
|
39
|
-
const DIR_NONE = "none";
|
|
40
|
-
const DIR_RANDOM = "random";
|
|
41
|
-
const DIR_RTL = "rtl";
|
|
42
|
-
const MODE_BI = "bi";
|
|
43
|
-
function blendColors(color1, color2, factor) {
|
|
44
|
-
const r = Math.round(color1[0] + (color2[0] - color1[0]) * factor);
|
|
45
|
-
const g = Math.round(color1[1] + (color2[1] - color1[1]) * factor);
|
|
46
|
-
const b = Math.round(color1[2] + (color2[2] - color1[2]) * factor);
|
|
47
|
-
return [r, g, b];
|
|
48
|
-
}
|
|
49
|
-
function detectStyles(text) {
|
|
50
|
-
return {
|
|
51
|
-
__proto__: null,
|
|
52
|
-
// biome-ignore lint/suspicious/noControlCharactersInRegex: ANSI escape sequence detection.
|
|
53
|
-
bold: /\x1b\[1m/.test(text),
|
|
54
|
-
// biome-ignore lint/suspicious/noControlCharactersInRegex: ANSI escape sequence detection.
|
|
55
|
-
dim: /\x1b\[2m/.test(text),
|
|
56
|
-
// biome-ignore lint/suspicious/noControlCharactersInRegex: ANSI escape sequence detection.
|
|
57
|
-
italic: /\x1b\[3m/.test(text),
|
|
58
|
-
// biome-ignore lint/suspicious/noControlCharactersInRegex: ANSI escape sequence detection.
|
|
59
|
-
strikethrough: /\x1b\[9m/.test(text),
|
|
60
|
-
// biome-ignore lint/suspicious/noControlCharactersInRegex: ANSI escape sequence detection.
|
|
61
|
-
underline: /\x1b\[4m/.test(text)
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
function getShimmerPos(textLength, step, currentDir, shimmerWidth = 2.5) {
|
|
65
|
-
const totalSteps = textLength + shimmerWidth + 2;
|
|
66
|
-
if (currentDir === DIR_RTL) {
|
|
67
|
-
return textLength - step % totalSteps;
|
|
68
|
-
}
|
|
69
|
-
return step % totalSteps;
|
|
70
|
-
}
|
|
71
|
-
function pickDirection(direction) {
|
|
72
|
-
if (direction === DIR_RANDOM) {
|
|
73
|
-
return Math.random() < 0.5 ? DIR_LTR : DIR_RTL;
|
|
74
|
-
}
|
|
75
|
-
if (direction === DIR_RTL) {
|
|
76
|
-
return DIR_RTL;
|
|
77
|
-
}
|
|
78
|
-
return DIR_LTR;
|
|
79
|
-
}
|
|
80
|
-
function renderChar(char, index, shimmerPos, baseColor, styles) {
|
|
81
|
-
const distance = Math.abs(index - shimmerPos);
|
|
82
|
-
const intensity = shimmerIntensity(distance);
|
|
83
|
-
const styleCode = stylesToAnsi(styles);
|
|
84
|
-
const charColor = (0, import_arrays.isArray)(baseColor[0]) ? baseColor[index % baseColor.length] ?? [
|
|
85
|
-
140,
|
|
86
|
-
82,
|
|
87
|
-
255
|
|
88
|
-
] : baseColor;
|
|
89
|
-
if (intensity === 0) {
|
|
90
|
-
const base = `\x1B[38;2;${charColor[0]};${charColor[1]};${charColor[2]}m`;
|
|
91
|
-
return `${styleCode}${base}${char}${import_ansi.ANSI_RESET}`;
|
|
92
|
-
}
|
|
93
|
-
const white = [255, 255, 255];
|
|
94
|
-
const blended = blendColors(charColor, white, intensity);
|
|
95
|
-
const color = `\x1B[38;2;${blended[0]};${blended[1]};${blended[2]}m`;
|
|
96
|
-
return `${styleCode}${color}${char}${import_ansi.ANSI_RESET}`;
|
|
97
|
-
}
|
|
98
|
-
function shimmerIntensity(distance, shimmerWidth = 2.5) {
|
|
99
|
-
if (distance > shimmerWidth) {
|
|
100
|
-
return 0;
|
|
101
|
-
}
|
|
102
|
-
const normalized = distance / shimmerWidth;
|
|
103
|
-
return (1 - normalized) ** 2.5;
|
|
104
|
-
}
|
|
105
|
-
function stylesToAnsi(styles) {
|
|
106
|
-
let codes = "";
|
|
107
|
-
if (styles.bold) {
|
|
108
|
-
codes += "\x1B[1m";
|
|
109
|
-
}
|
|
110
|
-
if (styles.dim) {
|
|
111
|
-
codes += "\x1B[2m";
|
|
112
|
-
}
|
|
113
|
-
if (styles.italic) {
|
|
114
|
-
codes += "\x1B[3m";
|
|
115
|
-
}
|
|
116
|
-
if (styles.underline) {
|
|
117
|
-
codes += "\x1B[4m";
|
|
118
|
-
}
|
|
119
|
-
if (styles.strikethrough) {
|
|
120
|
-
codes += "\x1B[9m";
|
|
121
|
-
}
|
|
122
|
-
return codes;
|
|
123
|
-
}
|
|
124
|
-
function applyShimmer(text, state, options) {
|
|
125
|
-
const opts = { __proto__: null, ...options };
|
|
126
|
-
const direction = opts.direction ?? DIR_NONE;
|
|
127
|
-
const shimmerWidth = opts.shimmerWidth ?? 2.5;
|
|
128
|
-
let color;
|
|
129
|
-
if (opts.theme) {
|
|
130
|
-
const theme = typeof opts.theme === "string" ? import_themes.THEMES[opts.theme] : opts.theme;
|
|
131
|
-
if (!theme) {
|
|
132
|
-
throw new Error(`Unknown theme: ${opts.theme}`);
|
|
133
|
-
}
|
|
134
|
-
const themeColor = (0, import_utils.resolveColor)(
|
|
135
|
-
theme.colors.primary,
|
|
136
|
-
theme.colors
|
|
137
|
-
);
|
|
138
|
-
color = typeof themeColor === "string" ? [140, 82, 255] : themeColor;
|
|
139
|
-
} else {
|
|
140
|
-
color = opts.color ?? [140, 82, 255];
|
|
141
|
-
}
|
|
142
|
-
const styles = opts.styles ?? detectStyles(text);
|
|
143
|
-
const plainText = (0, import_ansi.stripAnsi)(text);
|
|
144
|
-
if ((0, import_ci.getCI)() || !plainText || direction === DIR_NONE) {
|
|
145
|
-
const styleCode = stylesToAnsi(styles);
|
|
146
|
-
const isGradient = (0, import_arrays.isArray)(color[0]);
|
|
147
|
-
return plainText.split("").map((char, i) => {
|
|
148
|
-
const charColor = isGradient ? color[i % color.length] ?? [
|
|
149
|
-
140,
|
|
150
|
-
82,
|
|
151
|
-
255
|
|
152
|
-
] : color;
|
|
153
|
-
const base = `\x1B[38;2;${charColor[0]};${charColor[1]};${charColor[2]}m`;
|
|
154
|
-
return `${styleCode}${base}${char}${import_ansi.ANSI_RESET}`;
|
|
155
|
-
}).join("");
|
|
156
|
-
}
|
|
157
|
-
const shimmerPos = getShimmerPos(
|
|
158
|
-
plainText.length,
|
|
159
|
-
state.step,
|
|
160
|
-
state.currentDir,
|
|
161
|
-
shimmerWidth
|
|
162
|
-
);
|
|
163
|
-
const result = plainText.split("").map((char, i) => renderChar(char, i, shimmerPos, color, styles)).join("");
|
|
164
|
-
state.step += state.speed;
|
|
165
|
-
const totalSteps = plainText.length + shimmerWidth + 2;
|
|
166
|
-
if (state.mode === MODE_BI) {
|
|
167
|
-
if (state.step >= totalSteps) {
|
|
168
|
-
state.step = 0;
|
|
169
|
-
state.currentDir = state.currentDir === DIR_LTR ? DIR_RTL : DIR_LTR;
|
|
170
|
-
}
|
|
171
|
-
} else if (state.mode === DIR_RANDOM) {
|
|
172
|
-
if (state.step >= totalSteps) {
|
|
173
|
-
state.step = 0;
|
|
174
|
-
state.currentDir = pickDirection(DIR_RANDOM);
|
|
175
|
-
}
|
|
176
|
-
} else {
|
|
177
|
-
if (state.step >= totalSteps) {
|
|
178
|
-
state.step = 0;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
return result;
|
|
182
|
-
}
|
|
183
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
184
|
-
0 && (module.exports = {
|
|
185
|
-
COLOR_INHERIT,
|
|
186
|
-
DIR_LTR,
|
|
187
|
-
DIR_NONE,
|
|
188
|
-
DIR_RANDOM,
|
|
189
|
-
DIR_RTL,
|
|
190
|
-
MODE_BI,
|
|
191
|
-
applyShimmer
|
|
192
|
-
});
|
package/dist/effects/types.d.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Shared types for effects (shimmer, pulse, ultra, etc.).
|
|
3
|
-
* Common type definitions used across multiple effect modules.
|
|
4
|
-
*/
|
|
5
|
-
export type ShimmerColorInherit = 'inherit';
|
|
6
|
-
export type ShimmerColorRgb = readonly [number, number, number];
|
|
7
|
-
export type ShimmerColor = ShimmerColorInherit | ShimmerColorRgb;
|
|
8
|
-
export type ShimmerColorGradient = readonly ShimmerColorRgb[];
|
|
9
|
-
export type ShimmerDirection = 'ltr' | 'rtl' | 'bi' | 'random' | 'none';
|
|
10
|
-
/**
|
|
11
|
-
* Shimmer animation configuration.
|
|
12
|
-
*/
|
|
13
|
-
export type ShimmerConfig = {
|
|
14
|
-
readonly color?: ShimmerColor | ShimmerColorGradient | undefined;
|
|
15
|
-
readonly dir?: ShimmerDirection | undefined;
|
|
16
|
-
/**
|
|
17
|
-
* Animation speed in steps per frame.
|
|
18
|
-
* Lower values = slower shimmer (e.g., 0.33 = ~150ms per step).
|
|
19
|
-
* Higher values = faster shimmer (e.g., 1.0 = 50ms per step).
|
|
20
|
-
* Default: 1/3 (~0.33).
|
|
21
|
-
*/
|
|
22
|
-
readonly speed?: number | undefined;
|
|
23
|
-
/**
|
|
24
|
-
* Theme to use for shimmer colors.
|
|
25
|
-
* Can be a theme name ('socket', 'sunset', etc.) or a Theme object.
|
|
26
|
-
* If provided, overrides the color option.
|
|
27
|
-
*/
|
|
28
|
-
readonly theme?: import('../themes/types').Theme | import('../themes/themes').ThemeName | undefined;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Internal shimmer animation state.
|
|
32
|
-
* Tracks current animation position and direction.
|
|
33
|
-
*/
|
|
34
|
-
export type ShimmerState = {
|
|
35
|
-
currentDir: 'ltr' | 'rtl';
|
|
36
|
-
mode: ShimmerDirection;
|
|
37
|
-
/**
|
|
38
|
-
* Animation speed in steps per frame.
|
|
39
|
-
* The shimmer position advances by this amount every frame.
|
|
40
|
-
*/
|
|
41
|
-
speed: number;
|
|
42
|
-
/**
|
|
43
|
-
* Current shimmer position.
|
|
44
|
-
* Can be fractional for smooth sub-character movement.
|
|
45
|
-
*/
|
|
46
|
-
step: number;
|
|
47
|
-
};
|
package/dist/effects/ultra.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Ultrathink rainbow gradient effect.
|
|
3
|
-
* Provides rainbow gradient color generation for shimmer animations.
|
|
4
|
-
* "Ultrathink" is Claude's intensive thinking mode for deep analysis.
|
|
5
|
-
*/
|
|
6
|
-
import type { ShimmerColorGradient } from './types';
|
|
7
|
-
/**
|
|
8
|
-
* Rainbow gradient colors used for ultrathink effect.
|
|
9
|
-
* This gradient cycles through the full color spectrum with smooth transitions.
|
|
10
|
-
*/
|
|
11
|
-
export declare const RAINBOW_GRADIENT: ShimmerColorGradient;
|
|
12
|
-
/**
|
|
13
|
-
* Generate rainbow gradient colors for any text length.
|
|
14
|
-
* Colors are distributed evenly across the text by cycling through the gradient.
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```typescript
|
|
18
|
-
* const colors = generateRainbowGradient('Hello'.length)
|
|
19
|
-
* console.log(colors.length) // 5
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
export declare function generateRainbowGradient(textLength: number): ShimmerColorGradient;
|
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview GitHub release download utilities.
|
|
3
|
-
*/
|
|
4
|
-
import { type ArchiveFormat } from '../archives';
|
|
5
|
-
/**
|
|
6
|
-
* Pattern for matching release assets.
|
|
7
|
-
* Can be either:
|
|
8
|
-
* - A string with glob pattern syntax
|
|
9
|
-
* - A prefix/suffix pair for explicit matching (backward compatible)
|
|
10
|
-
* - A RegExp for complex patterns
|
|
11
|
-
*
|
|
12
|
-
* String patterns support full glob syntax via picomatch.
|
|
13
|
-
* Examples:
|
|
14
|
-
* - Simple wildcard: yoga-sync-*.mjs matches yoga-sync-abc123.mjs
|
|
15
|
-
* - Complex: models-*.tar.gz matches models-2024-01-15.tar.gz
|
|
16
|
-
* - Prefix wildcard: *-models.tar.gz matches foo-models.tar.gz
|
|
17
|
-
* - Suffix wildcard: yoga-* matches yoga-layout
|
|
18
|
-
* - Brace expansion: {yoga,models}-*.{mjs,js} matches yoga-abc.mjs or models-xyz.js
|
|
19
|
-
*
|
|
20
|
-
* For backward compatibility, prefix/suffix objects are still supported but glob patterns are recommended.
|
|
21
|
-
*/
|
|
22
|
-
export type AssetPattern = string | {
|
|
23
|
-
prefix: string;
|
|
24
|
-
suffix: string;
|
|
25
|
-
} | RegExp;
|
|
26
|
-
/**
|
|
27
|
-
* Configuration for downloading a GitHub release.
|
|
28
|
-
*/
|
|
29
|
-
export interface DownloadGitHubReleaseConfig {
|
|
30
|
-
/** Asset name on GitHub. */
|
|
31
|
-
assetName: string;
|
|
32
|
-
/** Binary filename (e.g., 'node', 'binject'). */
|
|
33
|
-
binaryName: string;
|
|
34
|
-
/** Working directory (defaults to process.cwd()). */
|
|
35
|
-
cwd?: string;
|
|
36
|
-
/** Download destination directory. @default 'build/downloaded' */
|
|
37
|
-
downloadDir?: string;
|
|
38
|
-
/** GitHub repository owner/organization. */
|
|
39
|
-
owner: string;
|
|
40
|
-
/** Platform-arch identifier (e.g., 'linux-x64-musl'). */
|
|
41
|
-
platformArch: string;
|
|
42
|
-
/** Suppress log messages. @default false */
|
|
43
|
-
quiet?: boolean;
|
|
44
|
-
/** Remove macOS quarantine attribute after download. @default true */
|
|
45
|
-
removeMacOSQuarantine?: boolean;
|
|
46
|
-
/** GitHub repository name. */
|
|
47
|
-
repo: string;
|
|
48
|
-
/** Specific release tag to download. */
|
|
49
|
-
tag?: string;
|
|
50
|
-
/** Tool name for directory structure. */
|
|
51
|
-
toolName: string;
|
|
52
|
-
/** Tool prefix for finding latest release. */
|
|
53
|
-
toolPrefix?: string;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Configuration for repository access.
|
|
57
|
-
*/
|
|
58
|
-
export interface RepoConfig {
|
|
59
|
-
/**
|
|
60
|
-
* GitHub repository owner/organization.
|
|
61
|
-
*/
|
|
62
|
-
owner: string;
|
|
63
|
-
/**
|
|
64
|
-
* GitHub repository name.
|
|
65
|
-
*/
|
|
66
|
-
repo: string;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Create a matcher function for a pattern using picomatch for glob patterns
|
|
70
|
-
* or simple prefix/suffix matching for object patterns.
|
|
71
|
-
*
|
|
72
|
-
* @param pattern - Pattern to match (string glob, prefix/suffix object, or RegExp)
|
|
73
|
-
* @returns Function that tests if a string matches the pattern
|
|
74
|
-
*
|
|
75
|
-
* @example
|
|
76
|
-
* ```typescript
|
|
77
|
-
* const isMatch = createAssetMatcher('tool-*-linux-x64')
|
|
78
|
-
* isMatch('tool-v1.0-linux-x64') // true
|
|
79
|
-
* isMatch('tool-v1.0-darwin-arm64') // false
|
|
80
|
-
* ```
|
|
81
|
-
*/
|
|
82
|
-
export declare function createAssetMatcher(pattern: string | {
|
|
83
|
-
prefix: string;
|
|
84
|
-
suffix: string;
|
|
85
|
-
} | RegExp): (input: string) => boolean;
|
|
86
|
-
/**
|
|
87
|
-
* Download and extract an archive from a GitHub release.
|
|
88
|
-
* Supports zip, tar, tar.gz, and tgz formats.
|
|
89
|
-
* Automatically handles downloading, extracting, and cleanup.
|
|
90
|
-
*
|
|
91
|
-
* @param tag - Release tag name
|
|
92
|
-
* @param assetPattern - Asset name or pattern (glob string, prefix/suffix object, or RegExp)
|
|
93
|
-
* @param outputDir - Directory to extract the archive contents to
|
|
94
|
-
* @param repoConfig - Repository configuration (owner/repo)
|
|
95
|
-
* @param options - Additional options
|
|
96
|
-
* @param options.quiet - Suppress log messages
|
|
97
|
-
* @param options.cleanup - Remove downloaded archive after extraction (default: true)
|
|
98
|
-
* @param options.strip - Strip leading path components (like tar --strip-components)
|
|
99
|
-
* @param options.format - Archive format (auto-detected if not specified)
|
|
100
|
-
* @returns Path to the extraction directory
|
|
101
|
-
*
|
|
102
|
-
* @example
|
|
103
|
-
* ```typescript
|
|
104
|
-
* const outputDir = await downloadAndExtractArchive(
|
|
105
|
-
* 'v1.0.0', 'data-*.tar.gz', '/tmp/data',
|
|
106
|
-
* { owner: 'SocketDev', repo: 'socket-btm' },
|
|
107
|
-
* )
|
|
108
|
-
* ```
|
|
109
|
-
*/
|
|
110
|
-
export declare function downloadAndExtractArchive(tag: string, assetPattern: string | AssetPattern, outputDir: string, repoConfig: RepoConfig, options?: {
|
|
111
|
-
cleanup?: boolean;
|
|
112
|
-
format?: ArchiveFormat;
|
|
113
|
-
quiet?: boolean;
|
|
114
|
-
strip?: number;
|
|
115
|
-
}): Promise<string>;
|
|
116
|
-
/**
|
|
117
|
-
* Download and extract a zip file from a GitHub release.
|
|
118
|
-
* Automatically handles downloading, extracting, and cleanup.
|
|
119
|
-
*
|
|
120
|
-
* @param tag - Release tag name
|
|
121
|
-
* @param assetPattern - Asset name or pattern (glob string, prefix/suffix object, or RegExp)
|
|
122
|
-
* @param outputDir - Directory to extract the zip contents to
|
|
123
|
-
* @param repoConfig - Repository configuration (owner/repo)
|
|
124
|
-
* @param options - Additional options
|
|
125
|
-
* @param options.quiet - Suppress log messages
|
|
126
|
-
* @param options.cleanup - Remove downloaded zip file after extraction (default: true)
|
|
127
|
-
* @returns Path to the extraction directory
|
|
128
|
-
*
|
|
129
|
-
* @example
|
|
130
|
-
* ```typescript
|
|
131
|
-
* const outputDir = await downloadAndExtractZip(
|
|
132
|
-
* 'v1.0.0', 'models-*.zip', '/tmp/models',
|
|
133
|
-
* { owner: 'SocketDev', repo: 'socket-btm' },
|
|
134
|
-
* )
|
|
135
|
-
* ```
|
|
136
|
-
*/
|
|
137
|
-
export declare function downloadAndExtractZip(tag: string, assetPattern: string | AssetPattern, outputDir: string, repoConfig: RepoConfig, options?: {
|
|
138
|
-
cleanup?: boolean;
|
|
139
|
-
quiet?: boolean;
|
|
140
|
-
}): Promise<string>;
|
|
141
|
-
/**
|
|
142
|
-
* Download a binary from any GitHub repository with version caching.
|
|
143
|
-
*
|
|
144
|
-
* @param config - Download configuration
|
|
145
|
-
* @returns Path to the downloaded binary
|
|
146
|
-
*
|
|
147
|
-
* @example
|
|
148
|
-
* ```typescript
|
|
149
|
-
* const binaryPath = await downloadGitHubRelease({
|
|
150
|
-
* owner: 'SocketDev', repo: 'socket-btm',
|
|
151
|
-
* toolName: 'lief', toolPrefix: 'lief-',
|
|
152
|
-
* assetName: 'lief-linux-x64', binaryName: 'lief',
|
|
153
|
-
* platformArch: 'linux-x64',
|
|
154
|
-
* })
|
|
155
|
-
* ```
|
|
156
|
-
*/
|
|
157
|
-
export declare function downloadGitHubRelease(config: DownloadGitHubReleaseConfig): Promise<string>;
|
|
158
|
-
/**
|
|
159
|
-
* Download a specific release asset.
|
|
160
|
-
* Supports pattern matching for dynamic asset discovery.
|
|
161
|
-
*
|
|
162
|
-
* @param tag - Release tag name
|
|
163
|
-
* @param assetPattern - Asset name or pattern (glob string, prefix/suffix object, or RegExp)
|
|
164
|
-
* @param outputPath - Path to write the downloaded file
|
|
165
|
-
* @param repoConfig - Repository configuration (owner/repo)
|
|
166
|
-
* @param options - Additional options
|
|
167
|
-
*
|
|
168
|
-
* @example
|
|
169
|
-
* ```typescript
|
|
170
|
-
* await downloadReleaseAsset(
|
|
171
|
-
* 'v1.0.0', 'tool-linux-x64', '/tmp/tool',
|
|
172
|
-
* { owner: 'SocketDev', repo: 'socket-btm' },
|
|
173
|
-
* )
|
|
174
|
-
* ```
|
|
175
|
-
*/
|
|
176
|
-
export declare function downloadReleaseAsset(tag: string, assetPattern: string | AssetPattern, outputPath: string, repoConfig: RepoConfig, options?: {
|
|
177
|
-
quiet?: boolean;
|
|
178
|
-
}): Promise<void>;
|
|
179
|
-
/**
|
|
180
|
-
* Get GitHub authentication headers if token is available.
|
|
181
|
-
* Checks GH_TOKEN or GITHUB_TOKEN environment variables.
|
|
182
|
-
*
|
|
183
|
-
* @returns Headers object with Authorization header if token exists.
|
|
184
|
-
*
|
|
185
|
-
* @example
|
|
186
|
-
* ```typescript
|
|
187
|
-
* const headers = getAuthHeaders()
|
|
188
|
-
* // { Accept: 'application/vnd.github+json', Authorization: 'Bearer ...' }
|
|
189
|
-
* ```
|
|
190
|
-
*/
|
|
191
|
-
export declare function getAuthHeaders(): Record<string, string>;
|
|
192
|
-
/**
|
|
193
|
-
* Get latest release tag matching a tool prefix.
|
|
194
|
-
* Optionally filter by releases containing a matching asset.
|
|
195
|
-
*
|
|
196
|
-
* @param toolPrefix - Tool name prefix to search for (e.g., 'node-smol-')
|
|
197
|
-
* @param repoConfig - Repository configuration (owner/repo)
|
|
198
|
-
* @param options - Additional options
|
|
199
|
-
* @param options.assetPattern - Optional pattern to filter releases by matching asset
|
|
200
|
-
* @returns Latest release tag or null if not found
|
|
201
|
-
*
|
|
202
|
-
* @example
|
|
203
|
-
* ```typescript
|
|
204
|
-
* const tag = await getLatestRelease('lief-', {
|
|
205
|
-
* owner: 'SocketDev', repo: 'socket-btm',
|
|
206
|
-
* })
|
|
207
|
-
* console.log(tag) // 'lief-2025-01-15-abc1234'
|
|
208
|
-
* ```
|
|
209
|
-
*/
|
|
210
|
-
export declare function getLatestRelease(toolPrefix: string, repoConfig: RepoConfig, options?: {
|
|
211
|
-
assetPattern?: AssetPattern;
|
|
212
|
-
quiet?: boolean;
|
|
213
|
-
}): Promise<string | null>;
|
|
214
|
-
/**
|
|
215
|
-
* Get download URL for a specific release asset.
|
|
216
|
-
* Supports pattern matching for dynamic asset discovery.
|
|
217
|
-
*
|
|
218
|
-
* @param tag - Release tag name
|
|
219
|
-
* @param assetPattern - Asset name or pattern (glob string, prefix/suffix object, or RegExp)
|
|
220
|
-
* @param repoConfig - Repository configuration (owner/repo)
|
|
221
|
-
* @param options - Additional options
|
|
222
|
-
* @returns Browser download URL for the asset
|
|
223
|
-
*
|
|
224
|
-
* @example
|
|
225
|
-
* ```typescript
|
|
226
|
-
* const url = await getReleaseAssetUrl(
|
|
227
|
-
* 'v1.0.0', 'tool-linux-x64',
|
|
228
|
-
* { owner: 'SocketDev', repo: 'socket-btm' },
|
|
229
|
-
* )
|
|
230
|
-
* ```
|
|
231
|
-
*/
|
|
232
|
-
export declare function getReleaseAssetUrl(tag: string, assetPattern: string | AssetPattern, repoConfig: RepoConfig, options?: {
|
|
233
|
-
quiet?: boolean;
|
|
234
|
-
}): Promise<string | null>;
|