@socketsecurity/lib
Version:
Core utilities and infrastructure for Socket.dev security tools
67 lines (66 loc) • 2.25 kB
JavaScript
;
/* Socket Lib - Built with esbuild */
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var pulse_frames_exports = {};
__export(pulse_frames_exports, {
generateSocketSpinnerFrames: () => generateSocketSpinnerFrames
});
module.exports = __toCommonJS(pulse_frames_exports);
function generateSocketSpinnerFrames(options) {
const opts = { __proto__: null, ...options };
const interval = opts.interval ?? 50;
const bold = "\x1B[1m";
const dim = "\x1B[2m";
const reset = "\x1B[0m";
const lightning = "\u26A1\uFE0E";
const starFilled = "\u2726\uFE0E ";
const starOutline = "\u2727\uFE0E ";
const starTiny = "\u22C6\uFE0E ";
const frames = [
// Build up from dim to bright
`${dim}${starOutline}${reset}`,
`${dim}${starOutline}${reset}`,
`${dim}${starTiny}${reset}`,
`${starFilled}${reset}`,
`${starFilled}${reset}`,
`${bold}${starFilled}${reset}`,
`${bold}${starFilled}${reset}`,
`${bold}${lightning}${reset}`,
`${bold}${lightning}${reset}`,
`${bold}${lightning}${reset}`,
// Fade down
`${bold}${lightning}${reset}`,
`${bold}${lightning}${reset}`,
`${bold}${starFilled}${reset}`,
`${bold}${starFilled}${reset}`,
`${starFilled}${reset}`,
`${starFilled}${reset}`,
`${dim}${starTiny}${reset}`,
`${dim}${starOutline}${reset}`
];
return {
__proto__: null,
frames,
interval
};
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
generateSocketSpinnerFrames
});