UNPKG

redgifs-downloader

Version:

This is a simple utiliy which allows you to download all videos from any user or search term on RedGIFs.

271 lines (232 loc) 6.37 kB
'use strict'; var fs = require('fs'); var path = require('path'); function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs); var path__default = /*#__PURE__*/_interopDefaultLegacy(path); let FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM, isTTY=true; if (typeof process !== 'undefined') { ({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env); isTTY = process.stdout && process.stdout.isTTY; } const $ = { enabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== 'dumb' && ( FORCE_COLOR != null && FORCE_COLOR !== '0' || isTTY ), // modifiers reset: init(0, 0), bold: init(1, 22), dim: init(2, 22), italic: init(3, 23), underline: init(4, 24), inverse: init(7, 27), hidden: init(8, 28), strikethrough: init(9, 29), // colors black: init(30, 39), red: init(31, 39), green: init(32, 39), yellow: init(33, 39), blue: init(34, 39), magenta: init(35, 39), cyan: init(36, 39), white: init(37, 39), gray: init(90, 39), grey: init(90, 39), // background colors bgBlack: init(40, 49), bgRed: init(41, 49), bgGreen: init(42, 49), bgYellow: init(43, 49), bgBlue: init(44, 49), bgMagenta: init(45, 49), bgCyan: init(46, 49), bgWhite: init(47, 49) }; function run(arr, str) { let i=0, tmp, beg='', end=''; for (; i < arr.length; i++) { tmp = arr[i]; beg += tmp.open; end += tmp.close; if (!!~str.indexOf(tmp.close)) { str = str.replace(tmp.rgx, tmp.close + tmp.open); } } return beg + str + end; } function chain(has, keys) { let ctx = { has, keys }; ctx.reset = $.reset.bind(ctx); ctx.bold = $.bold.bind(ctx); ctx.dim = $.dim.bind(ctx); ctx.italic = $.italic.bind(ctx); ctx.underline = $.underline.bind(ctx); ctx.inverse = $.inverse.bind(ctx); ctx.hidden = $.hidden.bind(ctx); ctx.strikethrough = $.strikethrough.bind(ctx); ctx.black = $.black.bind(ctx); ctx.red = $.red.bind(ctx); ctx.green = $.green.bind(ctx); ctx.yellow = $.yellow.bind(ctx); ctx.blue = $.blue.bind(ctx); ctx.magenta = $.magenta.bind(ctx); ctx.cyan = $.cyan.bind(ctx); ctx.white = $.white.bind(ctx); ctx.gray = $.gray.bind(ctx); ctx.grey = $.grey.bind(ctx); ctx.bgBlack = $.bgBlack.bind(ctx); ctx.bgRed = $.bgRed.bind(ctx); ctx.bgGreen = $.bgGreen.bind(ctx); ctx.bgYellow = $.bgYellow.bind(ctx); ctx.bgBlue = $.bgBlue.bind(ctx); ctx.bgMagenta = $.bgMagenta.bind(ctx); ctx.bgCyan = $.bgCyan.bind(ctx); ctx.bgWhite = $.bgWhite.bind(ctx); return ctx; } function init(open, close) { let blk = { open: `\x1b[${open}m`, close: `\x1b[${close}m`, rgx: new RegExp(`\\x1b\\[${close}m`, 'g') }; return function (txt) { if (this !== void 0 && this.has !== void 0) { !!~this.has.indexOf(open) || (this.has.push(open),this.keys.push(blk)); return txt === void 0 ? this : $.enabled ? run(this.keys, txt+'') : txt+''; } return txt === void 0 ? chain([open], [blk]) : $.enabled ? run([blk], txt+'') : txt+''; }; } var kleur$1 = /*#__PURE__*/Object.freeze({ __proto__: null, 'default': $ }); const {env} = process; const forceColor = readEnv('FORCE_COLOR'); const noColor = readEnv('NO_COLOR'); var supportsColor = (() => { if (noColor === true || forceColor === false) return false; if (!process.stdout.isTTY && forceColor === undefined) return false; if (env.TERM === 'dumb') return forceColor || false; return true; })(); function readEnv(name) { if (!(name in env)) return; if (env[name].length === 0) return true; if (env[name] === 'true') return true; if (env[name] === 'false') return false; return Boolean(parseInt(env[name], 10)); } var bin = { "redgifs-downloader": "cli.js" }; var name$1 = "redgifs-downloader"; var version = "2.1.1"; var description = "This is a simple utiliy which allows you to download all videos from any user or search term on RedGIFs."; var engines = { node: ">=8" }; var keywords = [ "redgifs", "redgifs downloader", "nsfw" ]; var main = "./dist/lib.js"; var scripts = { build: "rollup -c rollup.config.js", preinstall: "node preinstall.js", prepublishOnly: "npm run build", release: "npx np" }; var files = [ "dist/**/*", "preflight.compact.js", "preflight.js", "preinstall.js", "xdg-open" ]; var pkg = { targets: [ "node12-win-x64" ], outputPath: "dist" }; var author = "misob"; var license = "MIT"; var dependencies = { axios: "^0.21.1" }; var devDependencies = { camelcase: "^5.3.1", kleur: "^4.1.4", pkg: "^5.3.0", rollup: "^2.0.0", "rollup-plugin-commonjs": "^10.1.0", "rollup-plugin-cpy": "^2.0.1", "rollup-plugin-json": "^4.0.0", "rollup-plugin-node-resolve": "^5.2.0", "rollup-plugin-re": "^1.0.7", "rollup-plugin-strip": "^1.2.2", "rollup-plugin-terser": "^7.0.2", "rollup-plugin-visualizer": "^1.1.1", "rollup-pluginutils": "^2.8.2", "unlazy-loader": "^0.1.3" }; var _package = { bin: bin, name: name$1, version: version, description: description, engines: engines, keywords: keywords, main: main, scripts: scripts, files: files, pkg: pkg, author: author, license: license, dependencies: dependencies, devDependencies: devDependencies }; var _package$1 = /*#__PURE__*/Object.freeze({ __proto__: null, bin: bin, name: name$1, version: version, description: description, engines: engines, keywords: keywords, main: main, scripts: scripts, files: files, pkg: pkg, author: author, license: license, dependencies: dependencies, devDependencies: devDependencies, 'default': _package }); function getCjsExportFromNamespace (n) { return n && n['default'] || n; } var kleur = getCjsExportFromNamespace(kleur$1); var require$$1 = getCjsExportFromNamespace(_package$1); kleur.enabled = supportsColor; const { name } = require$$1; const { npm_config_prefix: prefix } = process.env; const isGit = fs__default["default"].existsSync(path__default["default"].join(process.cwd(), '.git/config')); const isNpx = prefix && prefix.includes('npx'); if (isGit || isNpx) process.exit(); const formatError = msg => `${kleur.white().inverse().bold().red(' Error ')} ${msg}`; const msg = 'redgifs-downloader is not supposed to be installed as a normal package'; console.error(` ${formatError(msg)} Use npx instead: $ npx ${name} `); process.exit(1); var preflight = { }; module.exports = preflight; //# sourceMappingURL=preflight.compact.js.map