5194 lines
219 KiB
JavaScript
5194 lines
219 KiB
JavaScript
var $aniHR$fs = require("fs");
|
|
var $aniHR$child_process = require("child_process");
|
|
var $aniHR$path = require("path");
|
|
var $aniHR$stream = require("stream");
|
|
var $aniHR$events = require("events");
|
|
var $aniHR$buffer = require("buffer");
|
|
var $aniHR$util = require("util");
|
|
var $aniHR$parcelcore = require("@parcel/core");
|
|
var $aniHR$parceldiagnostic = require("@parcel/diagnostic");
|
|
var $aniHR$parcelfs = require("@parcel/fs");
|
|
var $aniHR$module = require("module");
|
|
var $aniHR$semver = require("semver");
|
|
var $aniHR$parcellogger = require("@parcel/logger");
|
|
var $aniHR$parcelutils = require("@parcel/utils");
|
|
var $aniHR$parcelnoderesolvercore = require("@parcel/node-resolver-core");
|
|
var $aniHR$url = require("url");
|
|
var $aniHR$swccore = require("@swc/core");
|
|
var $aniHR$assert = require("assert");
|
|
var $aniHR$parcelworkers = require("@parcel/workers");
|
|
var $aniHR$string_decoder = require("string_decoder");
|
|
|
|
|
|
var $parcel$global = globalThis;
|
|
|
|
function $parcel$export(e, n, v, s) {
|
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
}
|
|
|
|
function $parcel$interopDefault(a) {
|
|
return a && a.__esModule ? a.default : a;
|
|
}
|
|
|
|
function $parcel$exportWildcard(dest, source) {
|
|
Object.keys(source).forEach(function(key) {
|
|
if (key === 'default' || key === '__esModule' || Object.prototype.hasOwnProperty.call(dest, key)) {
|
|
return;
|
|
}
|
|
|
|
Object.defineProperty(dest, key, {
|
|
enumerable: true,
|
|
get: function get() {
|
|
return source[key];
|
|
}
|
|
});
|
|
});
|
|
|
|
return dest;
|
|
}
|
|
|
|
var $parcel$modules = {};
|
|
var $parcel$inits = {};
|
|
|
|
var parcelRequire = $parcel$global["parcelRequire0b48"];
|
|
|
|
if (parcelRequire == null) {
|
|
parcelRequire = function(id) {
|
|
if (id in $parcel$modules) {
|
|
return $parcel$modules[id].exports;
|
|
}
|
|
if (id in $parcel$inits) {
|
|
var init = $parcel$inits[id];
|
|
delete $parcel$inits[id];
|
|
var module = {id: id, exports: {}};
|
|
$parcel$modules[id] = module;
|
|
init.call(module.exports, module, module.exports);
|
|
return module.exports;
|
|
}
|
|
var err = new Error("Cannot find module '" + id + "'");
|
|
err.code = 'MODULE_NOT_FOUND';
|
|
throw err;
|
|
};
|
|
|
|
parcelRequire.register = function register(id, init) {
|
|
$parcel$inits[id] = init;
|
|
};
|
|
|
|
$parcel$global["parcelRequire0b48"] = parcelRequire;
|
|
}
|
|
|
|
var parcelRegister = parcelRequire.register;
|
|
parcelRegister("7WOeY", function(module, exports) {
|
|
module.exports = $5c94ebe0d23d6bf5$var$isexe;
|
|
$5c94ebe0d23d6bf5$var$isexe.sync = $5c94ebe0d23d6bf5$var$sync;
|
|
|
|
function $5c94ebe0d23d6bf5$var$checkPathExt(path, options) {
|
|
var pathext = options.pathExt !== undefined ? options.pathExt : process.env.PATHEXT;
|
|
if (!pathext) return true;
|
|
pathext = pathext.split(";");
|
|
if (pathext.indexOf("") !== -1) return true;
|
|
for(var i = 0; i < pathext.length; i++){
|
|
var p = pathext[i].toLowerCase();
|
|
if (p && path.substr(-p.length).toLowerCase() === p) return true;
|
|
}
|
|
return false;
|
|
}
|
|
function $5c94ebe0d23d6bf5$var$checkStat(stat, path, options) {
|
|
if (!stat.isSymbolicLink() && !stat.isFile()) return false;
|
|
return $5c94ebe0d23d6bf5$var$checkPathExt(path, options);
|
|
}
|
|
function $5c94ebe0d23d6bf5$var$isexe(path, options, cb) {
|
|
$aniHR$fs.stat(path, function(er, stat) {
|
|
cb(er, er ? false : $5c94ebe0d23d6bf5$var$checkStat(stat, path, options));
|
|
});
|
|
}
|
|
function $5c94ebe0d23d6bf5$var$sync(path, options) {
|
|
return $5c94ebe0d23d6bf5$var$checkStat($aniHR$fs.statSync(path), path, options);
|
|
}
|
|
|
|
});
|
|
|
|
parcelRegister("grRFE", function(module, exports) {
|
|
module.exports = $bf98ccddc862bf65$var$isexe;
|
|
$bf98ccddc862bf65$var$isexe.sync = $bf98ccddc862bf65$var$sync;
|
|
|
|
function $bf98ccddc862bf65$var$isexe(path, options, cb) {
|
|
$aniHR$fs.stat(path, function(er, stat) {
|
|
cb(er, er ? false : $bf98ccddc862bf65$var$checkStat(stat, options));
|
|
});
|
|
}
|
|
function $bf98ccddc862bf65$var$sync(path, options) {
|
|
return $bf98ccddc862bf65$var$checkStat($aniHR$fs.statSync(path), options);
|
|
}
|
|
function $bf98ccddc862bf65$var$checkStat(stat, options) {
|
|
return stat.isFile() && $bf98ccddc862bf65$var$checkMode(stat, options);
|
|
}
|
|
function $bf98ccddc862bf65$var$checkMode(stat, options) {
|
|
var mod = stat.mode;
|
|
var uid = stat.uid;
|
|
var gid = stat.gid;
|
|
var myUid = options.uid !== undefined ? options.uid : process.getuid && process.getuid();
|
|
var myGid = options.gid !== undefined ? options.gid : process.getgid && process.getgid();
|
|
var u = parseInt("100", 8);
|
|
var g = parseInt("010", 8);
|
|
var o = parseInt("001", 8);
|
|
var ug = u | g;
|
|
var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
|
|
return ret;
|
|
}
|
|
|
|
});
|
|
|
|
parcelRegister("jOxMb", function(module, exports) {
|
|
"use strict";
|
|
module.exports = (opts)=>{
|
|
opts = opts || {};
|
|
const env = opts.env || process.env;
|
|
const platform = opts.platform || process.platform;
|
|
if (platform !== "win32") return "PATH";
|
|
return Object.keys(env).find((x)=>x.toUpperCase() === "PATH") || "Path";
|
|
};
|
|
|
|
});
|
|
|
|
parcelRegister("2Fy42", function(module, exports) {
|
|
"use strict";
|
|
|
|
var $1f19d589db763ffd$require$exec = $aniHR$child_process.exec;
|
|
|
|
var $1f19d589db763ffd$require$execSync = $aniHR$child_process.execSync;
|
|
|
|
|
|
var $1f19d589db763ffd$var$access = $aniHR$fs.access;
|
|
var $1f19d589db763ffd$var$accessSync = $aniHR$fs.accessSync;
|
|
var $1f19d589db763ffd$var$constants = $aniHR$fs.constants || $aniHR$fs;
|
|
var $1f19d589db763ffd$var$isUsingWindows = process.platform == "win32";
|
|
var $1f19d589db763ffd$var$fileNotExists = function(commandName, callback) {
|
|
$1f19d589db763ffd$var$access(commandName, $1f19d589db763ffd$var$constants.F_OK, function(err) {
|
|
callback(!err);
|
|
});
|
|
};
|
|
var $1f19d589db763ffd$var$fileNotExistsSync = function(commandName) {
|
|
try {
|
|
$1f19d589db763ffd$var$accessSync(commandName, $1f19d589db763ffd$var$constants.F_OK);
|
|
return false;
|
|
} catch (e) {
|
|
return true;
|
|
}
|
|
};
|
|
var $1f19d589db763ffd$var$localExecutable = function(commandName, callback) {
|
|
$1f19d589db763ffd$var$access(commandName, $1f19d589db763ffd$var$constants.F_OK | $1f19d589db763ffd$var$constants.X_OK, function(err) {
|
|
callback(null, !err);
|
|
});
|
|
};
|
|
var $1f19d589db763ffd$var$localExecutableSync = function(commandName) {
|
|
try {
|
|
$1f19d589db763ffd$var$accessSync(commandName, $1f19d589db763ffd$var$constants.F_OK | $1f19d589db763ffd$var$constants.X_OK);
|
|
return true;
|
|
} catch (e) {
|
|
return false;
|
|
}
|
|
};
|
|
var $1f19d589db763ffd$var$commandExistsUnix = function(commandName, cleanedCommandName, callback) {
|
|
$1f19d589db763ffd$var$fileNotExists(commandName, function(isFile) {
|
|
if (!isFile) {
|
|
var child = $1f19d589db763ffd$require$exec("command -v " + cleanedCommandName + " 2>/dev/null" + " && { echo >&1 " + cleanedCommandName + "; exit 0; }", function(error, stdout, stderr) {
|
|
callback(null, !!stdout);
|
|
});
|
|
return;
|
|
}
|
|
$1f19d589db763ffd$var$localExecutable(commandName, callback);
|
|
});
|
|
};
|
|
var $1f19d589db763ffd$var$commandExistsWindows = function(commandName, cleanedCommandName, callback) {
|
|
// Regex from Julio from: https://stackoverflow.com/questions/51494579/regex-windows-path-validator
|
|
if (!/^(?!(?:.*\s|.*\.|\W+)$)(?:[a-zA-Z]:)?(?:(?:[^<>:"\|\?\*\n])+(?:\/\/|\/|\\\\|\\)?)+$/m.test(commandName)) {
|
|
callback(null, false);
|
|
return;
|
|
}
|
|
var child = $1f19d589db763ffd$require$exec("where " + cleanedCommandName, function(error) {
|
|
if (error !== null) callback(null, false);
|
|
else callback(null, true);
|
|
});
|
|
};
|
|
var $1f19d589db763ffd$var$commandExistsUnixSync = function(commandName, cleanedCommandName) {
|
|
if ($1f19d589db763ffd$var$fileNotExistsSync(commandName)) try {
|
|
var stdout = $1f19d589db763ffd$require$execSync("command -v " + cleanedCommandName + " 2>/dev/null" + " && { echo >&1 " + cleanedCommandName + "; exit 0; }");
|
|
return !!stdout;
|
|
} catch (error) {
|
|
return false;
|
|
}
|
|
return $1f19d589db763ffd$var$localExecutableSync(commandName);
|
|
};
|
|
var $1f19d589db763ffd$var$commandExistsWindowsSync = function(commandName, cleanedCommandName, callback) {
|
|
// Regex from Julio from: https://stackoverflow.com/questions/51494579/regex-windows-path-validator
|
|
if (!/^(?!(?:.*\s|.*\.|\W+)$)(?:[a-zA-Z]:)?(?:(?:[^<>:"\|\?\*\n])+(?:\/\/|\/|\\\\|\\)?)+$/m.test(commandName)) return false;
|
|
try {
|
|
var stdout = $1f19d589db763ffd$require$execSync("where " + cleanedCommandName, {
|
|
stdio: []
|
|
});
|
|
return !!stdout;
|
|
} catch (error) {
|
|
return false;
|
|
}
|
|
};
|
|
var $1f19d589db763ffd$var$cleanInput = function(s) {
|
|
if (/[^A-Za-z0-9_\/:=-]/.test(s)) {
|
|
s = "'" + s.replace(/'/g, "'\\''") + "'";
|
|
s = s.replace(/^(?:'')+/g, "") // unduplicate single-quote at the beginning
|
|
.replace(/\\'''/g, "\\'"); // remove non-escaped single-quote if there are enclosed between 2 escaped
|
|
}
|
|
return s;
|
|
};
|
|
if ($1f19d589db763ffd$var$isUsingWindows) $1f19d589db763ffd$var$cleanInput = function(s) {
|
|
var isPathName = /[\\]/.test(s);
|
|
if (isPathName) {
|
|
var dirname = '"' + $aniHR$path.dirname(s) + '"';
|
|
var basename = '"' + $aniHR$path.basename(s) + '"';
|
|
return dirname + ":" + basename;
|
|
}
|
|
return '"' + s + '"';
|
|
};
|
|
module.exports = function commandExists(commandName, callback) {
|
|
var cleanedCommandName = $1f19d589db763ffd$var$cleanInput(commandName);
|
|
if (!callback && typeof Promise !== "undefined") return new Promise(function(resolve, reject) {
|
|
commandExists(commandName, function(error, output) {
|
|
if (output) resolve(commandName);
|
|
else reject(error);
|
|
});
|
|
});
|
|
if ($1f19d589db763ffd$var$isUsingWindows) $1f19d589db763ffd$var$commandExistsWindows(commandName, cleanedCommandName, callback);
|
|
else $1f19d589db763ffd$var$commandExistsUnix(commandName, cleanedCommandName, callback);
|
|
};
|
|
module.exports.sync = function(commandName) {
|
|
var cleanedCommandName = $1f19d589db763ffd$var$cleanInput(commandName);
|
|
if ($1f19d589db763ffd$var$isUsingWindows) return $1f19d589db763ffd$var$commandExistsWindowsSync(commandName, cleanedCommandName);
|
|
else return $1f19d589db763ffd$var$commandExistsUnixSync(commandName, cleanedCommandName);
|
|
};
|
|
|
|
});
|
|
|
|
parcelRegister("caqzW", function(module, exports) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (process.env.READABLE_STREAM === "disable" && $aniHR$stream) {
|
|
module.exports = $aniHR$stream.Readable;
|
|
Object.assign(module.exports, $aniHR$stream);
|
|
module.exports.Stream = $aniHR$stream;
|
|
} else {
|
|
exports = module.exports = (parcelRequire("6yfzc"));
|
|
exports.Stream = $aniHR$stream || exports;
|
|
exports.Readable = exports;
|
|
exports.Writable = (parcelRequire("zKkrI"));
|
|
exports.Duplex = (parcelRequire("12ctx"));
|
|
exports.Transform = (parcelRequire("8WmTM"));
|
|
exports.PassThrough = (parcelRequire("7dfYu"));
|
|
exports.finished = (parcelRequire("bli3A"));
|
|
exports.pipeline = (parcelRequire("br0Mq"));
|
|
}
|
|
|
|
});
|
|
parcelRegister("6yfzc", function(module, exports) {
|
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
//
|
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
// copy of this software and associated documentation files (the
|
|
// "Software"), to deal in the Software without restriction, including
|
|
// without limitation the rights to use, copy, modify, merge, publish,
|
|
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
// persons to whom the Software is furnished to do so, subject to the
|
|
// following conditions:
|
|
//
|
|
// The above copyright notice and this permission notice shall be included
|
|
// in all copies or substantial portions of the Software.
|
|
//
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
"use strict";
|
|
module.exports = $4c51fe47e28d9b5f$var$Readable;
|
|
/*<replacement>*/ var $4c51fe47e28d9b5f$var$Duplex;
|
|
/*</replacement>*/ $4c51fe47e28d9b5f$var$Readable.ReadableState = $4c51fe47e28d9b5f$var$ReadableState;
|
|
|
|
var $4c51fe47e28d9b5f$require$EE = $aniHR$events.EventEmitter;
|
|
var $4c51fe47e28d9b5f$var$EElistenerCount = function EElistenerCount(emitter, type) {
|
|
return emitter.listeners(type).length;
|
|
};
|
|
|
|
var $9pk2O = parcelRequire("9pk2O");
|
|
|
|
var $4c51fe47e28d9b5f$require$Buffer = $aniHR$buffer.Buffer;
|
|
var $4c51fe47e28d9b5f$var$OurUint8Array = (typeof $parcel$global !== "undefined" ? $parcel$global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {};
|
|
function $4c51fe47e28d9b5f$var$_uint8ArrayToBuffer(chunk) {
|
|
return $4c51fe47e28d9b5f$require$Buffer.from(chunk);
|
|
}
|
|
function $4c51fe47e28d9b5f$var$_isUint8Array(obj) {
|
|
return $4c51fe47e28d9b5f$require$Buffer.isBuffer(obj) || obj instanceof $4c51fe47e28d9b5f$var$OurUint8Array;
|
|
}
|
|
|
|
var $4c51fe47e28d9b5f$var$debug;
|
|
if ($aniHR$util && $aniHR$util.debuglog) $4c51fe47e28d9b5f$var$debug = $aniHR$util.debuglog("stream");
|
|
else $4c51fe47e28d9b5f$var$debug = function debug() {};
|
|
|
|
var $esMLA = parcelRequire("esMLA");
|
|
|
|
var $4LH3f = parcelRequire("4LH3f");
|
|
|
|
var $fmvC3 = parcelRequire("fmvC3");
|
|
var $4c51fe47e28d9b5f$var$getHighWaterMark = $fmvC3.getHighWaterMark;
|
|
|
|
var $eP0c0 = parcelRequire("eP0c0");
|
|
var $4c51fe47e28d9b5f$require$_require$codes = $eP0c0.codes;
|
|
var $4c51fe47e28d9b5f$var$ERR_INVALID_ARG_TYPE = $4c51fe47e28d9b5f$require$_require$codes.ERR_INVALID_ARG_TYPE, $4c51fe47e28d9b5f$var$ERR_STREAM_PUSH_AFTER_EOF = $4c51fe47e28d9b5f$require$_require$codes.ERR_STREAM_PUSH_AFTER_EOF, $4c51fe47e28d9b5f$var$ERR_METHOD_NOT_IMPLEMENTED = $4c51fe47e28d9b5f$require$_require$codes.ERR_METHOD_NOT_IMPLEMENTED, $4c51fe47e28d9b5f$var$ERR_STREAM_UNSHIFT_AFTER_END_EVENT = $4c51fe47e28d9b5f$require$_require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;
|
|
// Lazy loaded to improve the startup performance.
|
|
var $4c51fe47e28d9b5f$var$StringDecoder;
|
|
var $4c51fe47e28d9b5f$var$createReadableStreamAsyncIterator;
|
|
var $4c51fe47e28d9b5f$var$from;
|
|
|
|
(parcelRequire("bCCsL"))($4c51fe47e28d9b5f$var$Readable, $9pk2O);
|
|
var $4c51fe47e28d9b5f$var$errorOrDestroy = $4LH3f.errorOrDestroy;
|
|
var $4c51fe47e28d9b5f$var$kProxyEvents = [
|
|
"error",
|
|
"close",
|
|
"destroy",
|
|
"pause",
|
|
"resume"
|
|
];
|
|
function $4c51fe47e28d9b5f$var$prependListener(emitter, event, fn) {
|
|
// Sadly this is not cacheable as some libraries bundle their own
|
|
// event emitter implementation with them.
|
|
if (typeof emitter.prependListener === "function") return emitter.prependListener(event, fn);
|
|
// This is a hack to make sure that our error handler is attached before any
|
|
// userland ones. NEVER DO THIS. This is here only because this code needs
|
|
// to continue to work with older versions of Node.js that do not include
|
|
// the prependListener() method. The goal is to eventually remove this hack.
|
|
if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);
|
|
else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);
|
|
else emitter._events[event] = [
|
|
fn,
|
|
emitter._events[event]
|
|
];
|
|
}
|
|
|
|
|
|
function $4c51fe47e28d9b5f$var$ReadableState(options, stream, isDuplex) {
|
|
$4c51fe47e28d9b5f$var$Duplex = $4c51fe47e28d9b5f$var$Duplex || (parcelRequire("12ctx"));
|
|
options = options || {};
|
|
// Duplex streams are both readable and writable, but share
|
|
// the same options object.
|
|
// However, some cases require setting options to different
|
|
// values for the readable and the writable sides of the duplex stream.
|
|
// These options can be provided separately as readableXXX and writableXXX.
|
|
if (typeof isDuplex !== "boolean") isDuplex = stream instanceof $4c51fe47e28d9b5f$var$Duplex;
|
|
// object stream flag. Used to make read(n) ignore n and to
|
|
// make all the buffer merging and length checks go away
|
|
this.objectMode = !!options.objectMode;
|
|
if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
|
|
// the point at which it stops calling _read() to fill the buffer
|
|
// Note: 0 is a valid value, means "don't call _read preemptively ever"
|
|
this.highWaterMark = $4c51fe47e28d9b5f$var$getHighWaterMark(this, options, "readableHighWaterMark", isDuplex);
|
|
// A linked list is used to store data chunks instead of an array because the
|
|
// linked list can remove elements from the beginning faster than
|
|
// array.shift()
|
|
this.buffer = new $esMLA();
|
|
this.length = 0;
|
|
this.pipes = null;
|
|
this.pipesCount = 0;
|
|
this.flowing = null;
|
|
this.ended = false;
|
|
this.endEmitted = false;
|
|
this.reading = false;
|
|
// a flag to be able to tell if the event 'readable'/'data' is emitted
|
|
// immediately, or on a later tick. We set this to true at first, because
|
|
// any actions that shouldn't happen until "later" should generally also
|
|
// not happen before the first read call.
|
|
this.sync = true;
|
|
// whenever we return null, then we set a flag to say
|
|
// that we're awaiting a 'readable' event emission.
|
|
this.needReadable = false;
|
|
this.emittedReadable = false;
|
|
this.readableListening = false;
|
|
this.resumeScheduled = false;
|
|
this.paused = true;
|
|
// Should close be emitted on destroy. Defaults to true.
|
|
this.emitClose = options.emitClose !== false;
|
|
// Should .destroy() be called after 'end' (and potentially 'finish')
|
|
this.autoDestroy = !!options.autoDestroy;
|
|
// has it been destroyed
|
|
this.destroyed = false;
|
|
// Crypto is kind of old and crusty. Historically, its default string
|
|
// encoding is 'binary' so we have to make this configurable.
|
|
// Everything else in the universe uses 'utf8', though.
|
|
this.defaultEncoding = options.defaultEncoding || "utf8";
|
|
// the number of writers that are awaiting a drain event in .pipe()s
|
|
this.awaitDrain = 0;
|
|
// if true, a maybeReadMore has been scheduled
|
|
this.readingMore = false;
|
|
this.decoder = null;
|
|
this.encoding = null;
|
|
if (options.encoding) {
|
|
if (!$4c51fe47e28d9b5f$var$StringDecoder) $4c51fe47e28d9b5f$var$StringDecoder = (parcelRequire("8BMvp")).StringDecoder;
|
|
this.decoder = new $4c51fe47e28d9b5f$var$StringDecoder(options.encoding);
|
|
this.encoding = options.encoding;
|
|
}
|
|
}
|
|
|
|
function $4c51fe47e28d9b5f$var$Readable(options) {
|
|
$4c51fe47e28d9b5f$var$Duplex = $4c51fe47e28d9b5f$var$Duplex || (parcelRequire("12ctx"));
|
|
if (!(this instanceof $4c51fe47e28d9b5f$var$Readable)) return new $4c51fe47e28d9b5f$var$Readable(options);
|
|
// Checking for a Stream.Duplex instance is faster here instead of inside
|
|
// the ReadableState constructor, at least with V8 6.5
|
|
var isDuplex = this instanceof $4c51fe47e28d9b5f$var$Duplex;
|
|
this._readableState = new $4c51fe47e28d9b5f$var$ReadableState(options, this, isDuplex);
|
|
// legacy
|
|
this.readable = true;
|
|
if (options) {
|
|
if (typeof options.read === "function") this._read = options.read;
|
|
if (typeof options.destroy === "function") this._destroy = options.destroy;
|
|
}
|
|
$9pk2O.call(this);
|
|
}
|
|
Object.defineProperty($4c51fe47e28d9b5f$var$Readable.prototype, "destroyed", {
|
|
// making it explicit this property is not enumerable
|
|
// because otherwise some prototype manipulation in
|
|
// userland will fail
|
|
enumerable: false,
|
|
get: function get() {
|
|
if (this._readableState === undefined) return false;
|
|
return this._readableState.destroyed;
|
|
},
|
|
set: function set(value) {
|
|
// we ignore the value if the stream
|
|
// has not been initialized yet
|
|
if (!this._readableState) return;
|
|
// backward compatibility, the user is explicitly
|
|
// managing destroyed
|
|
this._readableState.destroyed = value;
|
|
}
|
|
});
|
|
$4c51fe47e28d9b5f$var$Readable.prototype.destroy = $4LH3f.destroy;
|
|
$4c51fe47e28d9b5f$var$Readable.prototype._undestroy = $4LH3f.undestroy;
|
|
$4c51fe47e28d9b5f$var$Readable.prototype._destroy = function(err, cb) {
|
|
cb(err);
|
|
};
|
|
// Manually shove something into the read() buffer.
|
|
// This returns true if the highWaterMark has not been hit yet,
|
|
// similar to how Writable.write() returns true if you should
|
|
// write() some more.
|
|
$4c51fe47e28d9b5f$var$Readable.prototype.push = function(chunk, encoding) {
|
|
var state = this._readableState;
|
|
var skipChunkCheck;
|
|
if (!state.objectMode) {
|
|
if (typeof chunk === "string") {
|
|
encoding = encoding || state.defaultEncoding;
|
|
if (encoding !== state.encoding) {
|
|
chunk = $4c51fe47e28d9b5f$require$Buffer.from(chunk, encoding);
|
|
encoding = "";
|
|
}
|
|
skipChunkCheck = true;
|
|
}
|
|
} else skipChunkCheck = true;
|
|
return $4c51fe47e28d9b5f$var$readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
|
|
};
|
|
// Unshift should *always* be something directly out of read()
|
|
$4c51fe47e28d9b5f$var$Readable.prototype.unshift = function(chunk) {
|
|
return $4c51fe47e28d9b5f$var$readableAddChunk(this, chunk, null, true, false);
|
|
};
|
|
function $4c51fe47e28d9b5f$var$readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
|
|
$4c51fe47e28d9b5f$var$debug("readableAddChunk", chunk);
|
|
var state = stream._readableState;
|
|
if (chunk === null) {
|
|
state.reading = false;
|
|
$4c51fe47e28d9b5f$var$onEofChunk(stream, state);
|
|
} else {
|
|
var er;
|
|
if (!skipChunkCheck) er = $4c51fe47e28d9b5f$var$chunkInvalid(state, chunk);
|
|
if (er) $4c51fe47e28d9b5f$var$errorOrDestroy(stream, er);
|
|
else if (state.objectMode || chunk && chunk.length > 0) {
|
|
if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== $4c51fe47e28d9b5f$require$Buffer.prototype) chunk = $4c51fe47e28d9b5f$var$_uint8ArrayToBuffer(chunk);
|
|
if (addToFront) {
|
|
if (state.endEmitted) $4c51fe47e28d9b5f$var$errorOrDestroy(stream, new $4c51fe47e28d9b5f$var$ERR_STREAM_UNSHIFT_AFTER_END_EVENT());
|
|
else $4c51fe47e28d9b5f$var$addChunk(stream, state, chunk, true);
|
|
} else if (state.ended) $4c51fe47e28d9b5f$var$errorOrDestroy(stream, new $4c51fe47e28d9b5f$var$ERR_STREAM_PUSH_AFTER_EOF());
|
|
else if (state.destroyed) return false;
|
|
else {
|
|
state.reading = false;
|
|
if (state.decoder && !encoding) {
|
|
chunk = state.decoder.write(chunk);
|
|
if (state.objectMode || chunk.length !== 0) $4c51fe47e28d9b5f$var$addChunk(stream, state, chunk, false);
|
|
else $4c51fe47e28d9b5f$var$maybeReadMore(stream, state);
|
|
} else $4c51fe47e28d9b5f$var$addChunk(stream, state, chunk, false);
|
|
}
|
|
} else if (!addToFront) {
|
|
state.reading = false;
|
|
$4c51fe47e28d9b5f$var$maybeReadMore(stream, state);
|
|
}
|
|
}
|
|
// We can push more data if we are below the highWaterMark.
|
|
// Also, if we have no data yet, we can stand some more bytes.
|
|
// This is to work around cases where hwm=0, such as the repl.
|
|
return !state.ended && (state.length < state.highWaterMark || state.length === 0);
|
|
}
|
|
function $4c51fe47e28d9b5f$var$addChunk(stream, state, chunk, addToFront) {
|
|
if (state.flowing && state.length === 0 && !state.sync) {
|
|
state.awaitDrain = 0;
|
|
stream.emit("data", chunk);
|
|
} else {
|
|
// update the buffer info.
|
|
state.length += state.objectMode ? 1 : chunk.length;
|
|
if (addToFront) state.buffer.unshift(chunk);
|
|
else state.buffer.push(chunk);
|
|
if (state.needReadable) $4c51fe47e28d9b5f$var$emitReadable(stream);
|
|
}
|
|
$4c51fe47e28d9b5f$var$maybeReadMore(stream, state);
|
|
}
|
|
function $4c51fe47e28d9b5f$var$chunkInvalid(state, chunk) {
|
|
var er;
|
|
if (!$4c51fe47e28d9b5f$var$_isUint8Array(chunk) && typeof chunk !== "string" && chunk !== undefined && !state.objectMode) er = new $4c51fe47e28d9b5f$var$ERR_INVALID_ARG_TYPE("chunk", [
|
|
"string",
|
|
"Buffer",
|
|
"Uint8Array"
|
|
], chunk);
|
|
return er;
|
|
}
|
|
$4c51fe47e28d9b5f$var$Readable.prototype.isPaused = function() {
|
|
return this._readableState.flowing === false;
|
|
};
|
|
|
|
// backwards compatibility.
|
|
$4c51fe47e28d9b5f$var$Readable.prototype.setEncoding = function(enc) {
|
|
if (!$4c51fe47e28d9b5f$var$StringDecoder) $4c51fe47e28d9b5f$var$StringDecoder = (parcelRequire("8BMvp")).StringDecoder;
|
|
var decoder = new $4c51fe47e28d9b5f$var$StringDecoder(enc);
|
|
this._readableState.decoder = decoder;
|
|
// If setEncoding(null), decoder.encoding equals utf8
|
|
this._readableState.encoding = this._readableState.decoder.encoding;
|
|
// Iterate over current buffer to convert already stored Buffers:
|
|
var p = this._readableState.buffer.head;
|
|
var content = "";
|
|
while(p !== null){
|
|
content += decoder.write(p.data);
|
|
p = p.next;
|
|
}
|
|
this._readableState.buffer.clear();
|
|
if (content !== "") this._readableState.buffer.push(content);
|
|
this._readableState.length = content.length;
|
|
return this;
|
|
};
|
|
// Don't raise the hwm > 1GB
|
|
var $4c51fe47e28d9b5f$var$MAX_HWM = 0x40000000;
|
|
function $4c51fe47e28d9b5f$var$computeNewHighWaterMark(n) {
|
|
if (n >= $4c51fe47e28d9b5f$var$MAX_HWM) // TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE.
|
|
n = $4c51fe47e28d9b5f$var$MAX_HWM;
|
|
else {
|
|
// Get the next highest power of 2 to prevent increasing hwm excessively in
|
|
// tiny amounts
|
|
n--;
|
|
n |= n >>> 1;
|
|
n |= n >>> 2;
|
|
n |= n >>> 4;
|
|
n |= n >>> 8;
|
|
n |= n >>> 16;
|
|
n++;
|
|
}
|
|
return n;
|
|
}
|
|
// This function is designed to be inlinable, so please take care when making
|
|
// changes to the function body.
|
|
function $4c51fe47e28d9b5f$var$howMuchToRead(n, state) {
|
|
if (n <= 0 || state.length === 0 && state.ended) return 0;
|
|
if (state.objectMode) return 1;
|
|
if (n !== n) {
|
|
// Only flow one buffer at a time
|
|
if (state.flowing && state.length) return state.buffer.head.data.length;
|
|
else return state.length;
|
|
}
|
|
// If we're asking for more than the current hwm, then raise the hwm.
|
|
if (n > state.highWaterMark) state.highWaterMark = $4c51fe47e28d9b5f$var$computeNewHighWaterMark(n);
|
|
if (n <= state.length) return n;
|
|
// Don't have enough
|
|
if (!state.ended) {
|
|
state.needReadable = true;
|
|
return 0;
|
|
}
|
|
return state.length;
|
|
}
|
|
// you can override either this method, or the async _read(n) below.
|
|
$4c51fe47e28d9b5f$var$Readable.prototype.read = function(n) {
|
|
$4c51fe47e28d9b5f$var$debug("read", n);
|
|
n = parseInt(n, 10);
|
|
var state = this._readableState;
|
|
var nOrig = n;
|
|
if (n !== 0) state.emittedReadable = false;
|
|
// if we're doing read(0) to trigger a readable event, but we
|
|
// already have a bunch of data in the buffer, then just trigger
|
|
// the 'readable' event and move on.
|
|
if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) {
|
|
$4c51fe47e28d9b5f$var$debug("read: emitReadable", state.length, state.ended);
|
|
if (state.length === 0 && state.ended) $4c51fe47e28d9b5f$var$endReadable(this);
|
|
else $4c51fe47e28d9b5f$var$emitReadable(this);
|
|
return null;
|
|
}
|
|
n = $4c51fe47e28d9b5f$var$howMuchToRead(n, state);
|
|
// if we've ended, and we're now clear, then finish it up.
|
|
if (n === 0 && state.ended) {
|
|
if (state.length === 0) $4c51fe47e28d9b5f$var$endReadable(this);
|
|
return null;
|
|
}
|
|
// All the actual chunk generation logic needs to be
|
|
// *below* the call to _read. The reason is that in certain
|
|
// synthetic stream cases, such as passthrough streams, _read
|
|
// may be a completely synchronous operation which may change
|
|
// the state of the read buffer, providing enough data when
|
|
// before there was *not* enough.
|
|
//
|
|
// So, the steps are:
|
|
// 1. Figure out what the state of things will be after we do
|
|
// a read from the buffer.
|
|
//
|
|
// 2. If that resulting state will trigger a _read, then call _read.
|
|
// Note that this may be asynchronous, or synchronous. Yes, it is
|
|
// deeply ugly to write APIs this way, but that still doesn't mean
|
|
// that the Readable class should behave improperly, as streams are
|
|
// designed to be sync/async agnostic.
|
|
// Take note if the _read call is sync or async (ie, if the read call
|
|
// has returned yet), so that we know whether or not it's safe to emit
|
|
// 'readable' etc.
|
|
//
|
|
// 3. Actually pull the requested chunks out of the buffer and return.
|
|
// if we need a readable event, then we need to do some reading.
|
|
var doRead = state.needReadable;
|
|
$4c51fe47e28d9b5f$var$debug("need readable", doRead);
|
|
// if we currently have less than the highWaterMark, then also read some
|
|
if (state.length === 0 || state.length - n < state.highWaterMark) {
|
|
doRead = true;
|
|
$4c51fe47e28d9b5f$var$debug("length less than watermark", doRead);
|
|
}
|
|
// however, if we've ended, then there's no point, and if we're already
|
|
// reading, then it's unnecessary.
|
|
if (state.ended || state.reading) {
|
|
doRead = false;
|
|
$4c51fe47e28d9b5f$var$debug("reading or ended", doRead);
|
|
} else if (doRead) {
|
|
$4c51fe47e28d9b5f$var$debug("do read");
|
|
state.reading = true;
|
|
state.sync = true;
|
|
// if the length is currently zero, then we *need* a readable event.
|
|
if (state.length === 0) state.needReadable = true;
|
|
// call internal read method
|
|
this._read(state.highWaterMark);
|
|
state.sync = false;
|
|
// If _read pushed data synchronously, then `reading` will be false,
|
|
// and we need to re-evaluate how much data we can return to the user.
|
|
if (!state.reading) n = $4c51fe47e28d9b5f$var$howMuchToRead(nOrig, state);
|
|
}
|
|
var ret;
|
|
if (n > 0) ret = $4c51fe47e28d9b5f$var$fromList(n, state);
|
|
else ret = null;
|
|
if (ret === null) {
|
|
state.needReadable = state.length <= state.highWaterMark;
|
|
n = 0;
|
|
} else {
|
|
state.length -= n;
|
|
state.awaitDrain = 0;
|
|
}
|
|
if (state.length === 0) {
|
|
// If we have nothing in the buffer, then we want to know
|
|
// as soon as we *do* get something into the buffer.
|
|
if (!state.ended) state.needReadable = true;
|
|
// If we tried to read() past the EOF, then emit end on the next tick.
|
|
if (nOrig !== n && state.ended) $4c51fe47e28d9b5f$var$endReadable(this);
|
|
}
|
|
if (ret !== null) this.emit("data", ret);
|
|
return ret;
|
|
};
|
|
function $4c51fe47e28d9b5f$var$onEofChunk(stream, state) {
|
|
$4c51fe47e28d9b5f$var$debug("onEofChunk");
|
|
if (state.ended) return;
|
|
if (state.decoder) {
|
|
var chunk = state.decoder.end();
|
|
if (chunk && chunk.length) {
|
|
state.buffer.push(chunk);
|
|
state.length += state.objectMode ? 1 : chunk.length;
|
|
}
|
|
}
|
|
state.ended = true;
|
|
if (state.sync) // if we are sync, wait until next tick to emit the data.
|
|
// Otherwise we risk emitting data in the flow()
|
|
// the readable code triggers during a read() call
|
|
$4c51fe47e28d9b5f$var$emitReadable(stream);
|
|
else {
|
|
// emit 'readable' now to make sure it gets picked up.
|
|
state.needReadable = false;
|
|
if (!state.emittedReadable) {
|
|
state.emittedReadable = true;
|
|
$4c51fe47e28d9b5f$var$emitReadable_(stream);
|
|
}
|
|
}
|
|
}
|
|
// Don't emit readable right away in sync mode, because this can trigger
|
|
// another read() call => stack overflow. This way, it might trigger
|
|
// a nextTick recursion warning, but that's not so bad.
|
|
function $4c51fe47e28d9b5f$var$emitReadable(stream) {
|
|
var state = stream._readableState;
|
|
$4c51fe47e28d9b5f$var$debug("emitReadable", state.needReadable, state.emittedReadable);
|
|
state.needReadable = false;
|
|
if (!state.emittedReadable) {
|
|
$4c51fe47e28d9b5f$var$debug("emitReadable", state.flowing);
|
|
state.emittedReadable = true;
|
|
process.nextTick($4c51fe47e28d9b5f$var$emitReadable_, stream);
|
|
}
|
|
}
|
|
function $4c51fe47e28d9b5f$var$emitReadable_(stream) {
|
|
var state = stream._readableState;
|
|
$4c51fe47e28d9b5f$var$debug("emitReadable_", state.destroyed, state.length, state.ended);
|
|
if (!state.destroyed && (state.length || state.ended)) {
|
|
stream.emit("readable");
|
|
state.emittedReadable = false;
|
|
}
|
|
// The stream needs another readable event if
|
|
// 1. It is not flowing, as the flow mechanism will take
|
|
// care of it.
|
|
// 2. It is not ended.
|
|
// 3. It is below the highWaterMark, so we can schedule
|
|
// another readable later.
|
|
state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark;
|
|
$4c51fe47e28d9b5f$var$flow(stream);
|
|
}
|
|
// at this point, the user has presumably seen the 'readable' event,
|
|
// and called read() to consume some data. that may have triggered
|
|
// in turn another _read(n) call, in which case reading = true if
|
|
// it's in progress.
|
|
// However, if we're not ended, or reading, and the length < hwm,
|
|
// then go ahead and try to read some more preemptively.
|
|
function $4c51fe47e28d9b5f$var$maybeReadMore(stream, state) {
|
|
if (!state.readingMore) {
|
|
state.readingMore = true;
|
|
process.nextTick($4c51fe47e28d9b5f$var$maybeReadMore_, stream, state);
|
|
}
|
|
}
|
|
function $4c51fe47e28d9b5f$var$maybeReadMore_(stream, state) {
|
|
// Attempt to read more data if we should.
|
|
//
|
|
// The conditions for reading more data are (one of):
|
|
// - Not enough data buffered (state.length < state.highWaterMark). The loop
|
|
// is responsible for filling the buffer with enough data if such data
|
|
// is available. If highWaterMark is 0 and we are not in the flowing mode
|
|
// we should _not_ attempt to buffer any extra data. We'll get more data
|
|
// when the stream consumer calls read() instead.
|
|
// - No data in the buffer, and the stream is in flowing mode. In this mode
|
|
// the loop below is responsible for ensuring read() is called. Failing to
|
|
// call read here would abort the flow and there's no other mechanism for
|
|
// continuing the flow if the stream consumer has just subscribed to the
|
|
// 'data' event.
|
|
//
|
|
// In addition to the above conditions to keep reading data, the following
|
|
// conditions prevent the data from being read:
|
|
// - The stream has ended (state.ended).
|
|
// - There is already a pending 'read' operation (state.reading). This is a
|
|
// case where the the stream has called the implementation defined _read()
|
|
// method, but they are processing the call asynchronously and have _not_
|
|
// called push() with new data. In this case we skip performing more
|
|
// read()s. The execution ends in this method again after the _read() ends
|
|
// up calling push() with more data.
|
|
while(!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)){
|
|
var len = state.length;
|
|
$4c51fe47e28d9b5f$var$debug("maybeReadMore read 0");
|
|
stream.read(0);
|
|
if (len === state.length) break;
|
|
}
|
|
state.readingMore = false;
|
|
}
|
|
// abstract method. to be overridden in specific implementation classes.
|
|
// call cb(er, data) where data is <= n in length.
|
|
// for virtual (non-string, non-buffer) streams, "length" is somewhat
|
|
// arbitrary, and perhaps not very meaningful.
|
|
$4c51fe47e28d9b5f$var$Readable.prototype._read = function(n) {
|
|
$4c51fe47e28d9b5f$var$errorOrDestroy(this, new $4c51fe47e28d9b5f$var$ERR_METHOD_NOT_IMPLEMENTED("_read()"));
|
|
};
|
|
$4c51fe47e28d9b5f$var$Readable.prototype.pipe = function(dest, pipeOpts) {
|
|
var src = this;
|
|
var state = this._readableState;
|
|
switch(state.pipesCount){
|
|
case 0:
|
|
state.pipes = dest;
|
|
break;
|
|
case 1:
|
|
state.pipes = [
|
|
state.pipes,
|
|
dest
|
|
];
|
|
break;
|
|
default:
|
|
state.pipes.push(dest);
|
|
break;
|
|
}
|
|
state.pipesCount += 1;
|
|
$4c51fe47e28d9b5f$var$debug("pipe count=%d opts=%j", state.pipesCount, pipeOpts);
|
|
var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
|
|
var endFn = doEnd ? onend : unpipe;
|
|
if (state.endEmitted) process.nextTick(endFn);
|
|
else src.once("end", endFn);
|
|
dest.on("unpipe", onunpipe);
|
|
function onunpipe(readable, unpipeInfo) {
|
|
$4c51fe47e28d9b5f$var$debug("onunpipe");
|
|
if (readable === src) {
|
|
if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
|
|
unpipeInfo.hasUnpiped = true;
|
|
cleanup();
|
|
}
|
|
}
|
|
}
|
|
function onend() {
|
|
$4c51fe47e28d9b5f$var$debug("onend");
|
|
dest.end();
|
|
}
|
|
// when the dest drains, it reduces the awaitDrain counter
|
|
// on the source. This would be more elegant with a .once()
|
|
// handler in flow(), but adding and removing repeatedly is
|
|
// too slow.
|
|
var ondrain = $4c51fe47e28d9b5f$var$pipeOnDrain(src);
|
|
dest.on("drain", ondrain);
|
|
var cleanedUp = false;
|
|
function cleanup() {
|
|
$4c51fe47e28d9b5f$var$debug("cleanup");
|
|
// cleanup event handlers once the pipe is broken
|
|
dest.removeListener("close", onclose);
|
|
dest.removeListener("finish", onfinish);
|
|
dest.removeListener("drain", ondrain);
|
|
dest.removeListener("error", onerror);
|
|
dest.removeListener("unpipe", onunpipe);
|
|
src.removeListener("end", onend);
|
|
src.removeListener("end", unpipe);
|
|
src.removeListener("data", ondata);
|
|
cleanedUp = true;
|
|
// if the reader is waiting for a drain event from this
|
|
// specific writer, then it would cause it to never start
|
|
// flowing again.
|
|
// So, if this is awaiting a drain, then we just call it now.
|
|
// If we don't know, then assume that we are waiting for one.
|
|
if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
|
|
}
|
|
src.on("data", ondata);
|
|
function ondata(chunk) {
|
|
$4c51fe47e28d9b5f$var$debug("ondata");
|
|
var ret = dest.write(chunk);
|
|
$4c51fe47e28d9b5f$var$debug("dest.write", ret);
|
|
if (ret === false) {
|
|
// If the user unpiped during `dest.write()`, it is possible
|
|
// to get stuck in a permanently paused state if that write
|
|
// also returned false.
|
|
// => Check whether `dest` is still a piping destination.
|
|
if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && $4c51fe47e28d9b5f$var$indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
|
|
$4c51fe47e28d9b5f$var$debug("false write response, pause", state.awaitDrain);
|
|
state.awaitDrain++;
|
|
}
|
|
src.pause();
|
|
}
|
|
}
|
|
// if the dest has an error, then stop piping into it.
|
|
// however, don't suppress the throwing behavior for this.
|
|
function onerror(er) {
|
|
$4c51fe47e28d9b5f$var$debug("onerror", er);
|
|
unpipe();
|
|
dest.removeListener("error", onerror);
|
|
if ($4c51fe47e28d9b5f$var$EElistenerCount(dest, "error") === 0) $4c51fe47e28d9b5f$var$errorOrDestroy(dest, er);
|
|
}
|
|
// Make sure our error handler is attached before userland ones.
|
|
$4c51fe47e28d9b5f$var$prependListener(dest, "error", onerror);
|
|
// Both close and finish should trigger unpipe, but only once.
|
|
function onclose() {
|
|
dest.removeListener("finish", onfinish);
|
|
unpipe();
|
|
}
|
|
dest.once("close", onclose);
|
|
function onfinish() {
|
|
$4c51fe47e28d9b5f$var$debug("onfinish");
|
|
dest.removeListener("close", onclose);
|
|
unpipe();
|
|
}
|
|
dest.once("finish", onfinish);
|
|
function unpipe() {
|
|
$4c51fe47e28d9b5f$var$debug("unpipe");
|
|
src.unpipe(dest);
|
|
}
|
|
// tell the dest that it's being piped to
|
|
dest.emit("pipe", src);
|
|
// start the flow if it hasn't been started already.
|
|
if (!state.flowing) {
|
|
$4c51fe47e28d9b5f$var$debug("pipe resume");
|
|
src.resume();
|
|
}
|
|
return dest;
|
|
};
|
|
function $4c51fe47e28d9b5f$var$pipeOnDrain(src) {
|
|
return function pipeOnDrainFunctionResult() {
|
|
var state = src._readableState;
|
|
$4c51fe47e28d9b5f$var$debug("pipeOnDrain", state.awaitDrain);
|
|
if (state.awaitDrain) state.awaitDrain--;
|
|
if (state.awaitDrain === 0 && $4c51fe47e28d9b5f$var$EElistenerCount(src, "data")) {
|
|
state.flowing = true;
|
|
$4c51fe47e28d9b5f$var$flow(src);
|
|
}
|
|
};
|
|
}
|
|
$4c51fe47e28d9b5f$var$Readable.prototype.unpipe = function(dest) {
|
|
var state = this._readableState;
|
|
var unpipeInfo = {
|
|
hasUnpiped: false
|
|
};
|
|
// if we're not piping anywhere, then do nothing.
|
|
if (state.pipesCount === 0) return this;
|
|
// just one destination. most common case.
|
|
if (state.pipesCount === 1) {
|
|
// passed in one, but it's not the right one.
|
|
if (dest && dest !== state.pipes) return this;
|
|
if (!dest) dest = state.pipes;
|
|
// got a match.
|
|
state.pipes = null;
|
|
state.pipesCount = 0;
|
|
state.flowing = false;
|
|
if (dest) dest.emit("unpipe", this, unpipeInfo);
|
|
return this;
|
|
}
|
|
// slow case. multiple pipe destinations.
|
|
if (!dest) {
|
|
// remove all.
|
|
var dests = state.pipes;
|
|
var len = state.pipesCount;
|
|
state.pipes = null;
|
|
state.pipesCount = 0;
|
|
state.flowing = false;
|
|
for(var i = 0; i < len; i++)dests[i].emit("unpipe", this, {
|
|
hasUnpiped: false
|
|
});
|
|
return this;
|
|
}
|
|
// try to find the right one.
|
|
var index = $4c51fe47e28d9b5f$var$indexOf(state.pipes, dest);
|
|
if (index === -1) return this;
|
|
state.pipes.splice(index, 1);
|
|
state.pipesCount -= 1;
|
|
if (state.pipesCount === 1) state.pipes = state.pipes[0];
|
|
dest.emit("unpipe", this, unpipeInfo);
|
|
return this;
|
|
};
|
|
// set up data events if they are asked for
|
|
// Ensure readable listeners eventually get something
|
|
$4c51fe47e28d9b5f$var$Readable.prototype.on = function(ev, fn) {
|
|
var res = $9pk2O.prototype.on.call(this, ev, fn);
|
|
var state = this._readableState;
|
|
if (ev === "data") {
|
|
// update readableListening so that resume() may be a no-op
|
|
// a few lines down. This is needed to support once('readable').
|
|
state.readableListening = this.listenerCount("readable") > 0;
|
|
// Try start flowing on next tick if stream isn't explicitly paused
|
|
if (state.flowing !== false) this.resume();
|
|
} else if (ev === "readable") {
|
|
if (!state.endEmitted && !state.readableListening) {
|
|
state.readableListening = state.needReadable = true;
|
|
state.flowing = false;
|
|
state.emittedReadable = false;
|
|
$4c51fe47e28d9b5f$var$debug("on readable", state.length, state.reading);
|
|
if (state.length) $4c51fe47e28d9b5f$var$emitReadable(this);
|
|
else if (!state.reading) process.nextTick($4c51fe47e28d9b5f$var$nReadingNextTick, this);
|
|
}
|
|
}
|
|
return res;
|
|
};
|
|
$4c51fe47e28d9b5f$var$Readable.prototype.addListener = $4c51fe47e28d9b5f$var$Readable.prototype.on;
|
|
$4c51fe47e28d9b5f$var$Readable.prototype.removeListener = function(ev, fn) {
|
|
var res = $9pk2O.prototype.removeListener.call(this, ev, fn);
|
|
if (ev === "readable") // We need to check if there is someone still listening to
|
|
// readable and reset the state. However this needs to happen
|
|
// after readable has been emitted but before I/O (nextTick) to
|
|
// support once('readable', fn) cycles. This means that calling
|
|
// resume within the same tick will have no
|
|
// effect.
|
|
process.nextTick($4c51fe47e28d9b5f$var$updateReadableListening, this);
|
|
return res;
|
|
};
|
|
$4c51fe47e28d9b5f$var$Readable.prototype.removeAllListeners = function(ev) {
|
|
var res = $9pk2O.prototype.removeAllListeners.apply(this, arguments);
|
|
if (ev === "readable" || ev === undefined) // We need to check if there is someone still listening to
|
|
// readable and reset the state. However this needs to happen
|
|
// after readable has been emitted but before I/O (nextTick) to
|
|
// support once('readable', fn) cycles. This means that calling
|
|
// resume within the same tick will have no
|
|
// effect.
|
|
process.nextTick($4c51fe47e28d9b5f$var$updateReadableListening, this);
|
|
return res;
|
|
};
|
|
function $4c51fe47e28d9b5f$var$updateReadableListening(self1) {
|
|
var state = self1._readableState;
|
|
state.readableListening = self1.listenerCount("readable") > 0;
|
|
if (state.resumeScheduled && !state.paused) // flowing needs to be set to true now, otherwise
|
|
// the upcoming resume will not flow.
|
|
state.flowing = true;
|
|
else if (self1.listenerCount("data") > 0) self1.resume();
|
|
}
|
|
function $4c51fe47e28d9b5f$var$nReadingNextTick(self1) {
|
|
$4c51fe47e28d9b5f$var$debug("readable nexttick read 0");
|
|
self1.read(0);
|
|
}
|
|
// pause() and resume() are remnants of the legacy readable stream API
|
|
// If the user uses them, then switch into old mode.
|
|
$4c51fe47e28d9b5f$var$Readable.prototype.resume = function() {
|
|
var state = this._readableState;
|
|
if (!state.flowing) {
|
|
$4c51fe47e28d9b5f$var$debug("resume");
|
|
// we flow only if there is no one listening
|
|
// for readable, but we still have to call
|
|
// resume()
|
|
state.flowing = !state.readableListening;
|
|
$4c51fe47e28d9b5f$var$resume(this, state);
|
|
}
|
|
state.paused = false;
|
|
return this;
|
|
};
|
|
function $4c51fe47e28d9b5f$var$resume(stream, state) {
|
|
if (!state.resumeScheduled) {
|
|
state.resumeScheduled = true;
|
|
process.nextTick($4c51fe47e28d9b5f$var$resume_, stream, state);
|
|
}
|
|
}
|
|
function $4c51fe47e28d9b5f$var$resume_(stream, state) {
|
|
$4c51fe47e28d9b5f$var$debug("resume", state.reading);
|
|
if (!state.reading) stream.read(0);
|
|
state.resumeScheduled = false;
|
|
stream.emit("resume");
|
|
$4c51fe47e28d9b5f$var$flow(stream);
|
|
if (state.flowing && !state.reading) stream.read(0);
|
|
}
|
|
$4c51fe47e28d9b5f$var$Readable.prototype.pause = function() {
|
|
$4c51fe47e28d9b5f$var$debug("call pause flowing=%j", this._readableState.flowing);
|
|
if (this._readableState.flowing !== false) {
|
|
$4c51fe47e28d9b5f$var$debug("pause");
|
|
this._readableState.flowing = false;
|
|
this.emit("pause");
|
|
}
|
|
this._readableState.paused = true;
|
|
return this;
|
|
};
|
|
function $4c51fe47e28d9b5f$var$flow(stream) {
|
|
var state = stream._readableState;
|
|
$4c51fe47e28d9b5f$var$debug("flow", state.flowing);
|
|
while(state.flowing && stream.read() !== null);
|
|
}
|
|
// wrap an old-style stream as the async data source.
|
|
// This is *not* part of the readable stream interface.
|
|
// It is an ugly unfortunate mess of history.
|
|
$4c51fe47e28d9b5f$var$Readable.prototype.wrap = function(stream) {
|
|
var _this = this;
|
|
var state = this._readableState;
|
|
var paused = false;
|
|
stream.on("end", function() {
|
|
$4c51fe47e28d9b5f$var$debug("wrapped end");
|
|
if (state.decoder && !state.ended) {
|
|
var chunk = state.decoder.end();
|
|
if (chunk && chunk.length) _this.push(chunk);
|
|
}
|
|
_this.push(null);
|
|
});
|
|
stream.on("data", function(chunk) {
|
|
$4c51fe47e28d9b5f$var$debug("wrapped data");
|
|
if (state.decoder) chunk = state.decoder.write(chunk);
|
|
// don't skip over falsy values in objectMode
|
|
if (state.objectMode && (chunk === null || chunk === undefined)) return;
|
|
else if (!state.objectMode && (!chunk || !chunk.length)) return;
|
|
var ret = _this.push(chunk);
|
|
if (!ret) {
|
|
paused = true;
|
|
stream.pause();
|
|
}
|
|
});
|
|
// proxy all the other methods.
|
|
// important when wrapping filters and duplexes.
|
|
for(var i in stream)if (this[i] === undefined && typeof stream[i] === "function") this[i] = function methodWrap(method) {
|
|
return function methodWrapReturnFunction() {
|
|
return stream[method].apply(stream, arguments);
|
|
};
|
|
}(i);
|
|
// proxy certain important events.
|
|
for(var n = 0; n < $4c51fe47e28d9b5f$var$kProxyEvents.length; n++)stream.on($4c51fe47e28d9b5f$var$kProxyEvents[n], this.emit.bind(this, $4c51fe47e28d9b5f$var$kProxyEvents[n]));
|
|
// when we try to consume some more bytes, simply unpause the
|
|
// underlying stream.
|
|
this._read = function(n) {
|
|
$4c51fe47e28d9b5f$var$debug("wrapped _read", n);
|
|
if (paused) {
|
|
paused = false;
|
|
stream.resume();
|
|
}
|
|
};
|
|
return this;
|
|
};
|
|
|
|
if (typeof Symbol === "function") $4c51fe47e28d9b5f$var$Readable.prototype[Symbol.asyncIterator] = function() {
|
|
if ($4c51fe47e28d9b5f$var$createReadableStreamAsyncIterator === undefined) $4c51fe47e28d9b5f$var$createReadableStreamAsyncIterator = (parcelRequire("gbsST"));
|
|
return $4c51fe47e28d9b5f$var$createReadableStreamAsyncIterator(this);
|
|
};
|
|
Object.defineProperty($4c51fe47e28d9b5f$var$Readable.prototype, "readableHighWaterMark", {
|
|
// making it explicit this property is not enumerable
|
|
// because otherwise some prototype manipulation in
|
|
// userland will fail
|
|
enumerable: false,
|
|
get: function get() {
|
|
return this._readableState.highWaterMark;
|
|
}
|
|
});
|
|
Object.defineProperty($4c51fe47e28d9b5f$var$Readable.prototype, "readableBuffer", {
|
|
// making it explicit this property is not enumerable
|
|
// because otherwise some prototype manipulation in
|
|
// userland will fail
|
|
enumerable: false,
|
|
get: function get() {
|
|
return this._readableState && this._readableState.buffer;
|
|
}
|
|
});
|
|
Object.defineProperty($4c51fe47e28d9b5f$var$Readable.prototype, "readableFlowing", {
|
|
// making it explicit this property is not enumerable
|
|
// because otherwise some prototype manipulation in
|
|
// userland will fail
|
|
enumerable: false,
|
|
get: function get() {
|
|
return this._readableState.flowing;
|
|
},
|
|
set: function set(state) {
|
|
if (this._readableState) this._readableState.flowing = state;
|
|
}
|
|
});
|
|
// exposed for testing purposes only.
|
|
$4c51fe47e28d9b5f$var$Readable._fromList = $4c51fe47e28d9b5f$var$fromList;
|
|
Object.defineProperty($4c51fe47e28d9b5f$var$Readable.prototype, "readableLength", {
|
|
// making it explicit this property is not enumerable
|
|
// because otherwise some prototype manipulation in
|
|
// userland will fail
|
|
enumerable: false,
|
|
get: function get() {
|
|
return this._readableState.length;
|
|
}
|
|
});
|
|
// Pluck off n bytes from an array of buffers.
|
|
// Length is the combined lengths of all the buffers in the list.
|
|
// This function is designed to be inlinable, so please take care when making
|
|
// changes to the function body.
|
|
function $4c51fe47e28d9b5f$var$fromList(n, state) {
|
|
// nothing buffered
|
|
if (state.length === 0) return null;
|
|
var ret;
|
|
if (state.objectMode) ret = state.buffer.shift();
|
|
else if (!n || n >= state.length) {
|
|
// read it all, truncate the list
|
|
if (state.decoder) ret = state.buffer.join("");
|
|
else if (state.buffer.length === 1) ret = state.buffer.first();
|
|
else ret = state.buffer.concat(state.length);
|
|
state.buffer.clear();
|
|
} else // read part of list
|
|
ret = state.buffer.consume(n, state.decoder);
|
|
return ret;
|
|
}
|
|
function $4c51fe47e28d9b5f$var$endReadable(stream) {
|
|
var state = stream._readableState;
|
|
$4c51fe47e28d9b5f$var$debug("endReadable", state.endEmitted);
|
|
if (!state.endEmitted) {
|
|
state.ended = true;
|
|
process.nextTick($4c51fe47e28d9b5f$var$endReadableNT, state, stream);
|
|
}
|
|
}
|
|
function $4c51fe47e28d9b5f$var$endReadableNT(state, stream) {
|
|
$4c51fe47e28d9b5f$var$debug("endReadableNT", state.endEmitted, state.length);
|
|
// Check that we didn't get one last unshift.
|
|
if (!state.endEmitted && state.length === 0) {
|
|
state.endEmitted = true;
|
|
stream.readable = false;
|
|
stream.emit("end");
|
|
if (state.autoDestroy) {
|
|
// In case of duplex streams we need a way to detect
|
|
// if the writable side is ready for autoDestroy as well
|
|
var wState = stream._writableState;
|
|
if (!wState || wState.autoDestroy && wState.finished) stream.destroy();
|
|
}
|
|
}
|
|
}
|
|
|
|
if (typeof Symbol === "function") $4c51fe47e28d9b5f$var$Readable.from = function(iterable, opts) {
|
|
if ($4c51fe47e28d9b5f$var$from === undefined) $4c51fe47e28d9b5f$var$from = (parcelRequire("53TPx"));
|
|
return $4c51fe47e28d9b5f$var$from($4c51fe47e28d9b5f$var$Readable, iterable, opts);
|
|
};
|
|
function $4c51fe47e28d9b5f$var$indexOf(xs, x) {
|
|
for(var i = 0, l = xs.length; i < l; i++){
|
|
if (xs[i] === x) return i;
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
});
|
|
parcelRegister("9pk2O", function(module, exports) {
|
|
|
|
module.exports = $aniHR$stream;
|
|
|
|
});
|
|
|
|
parcelRegister("esMLA", function(module, exports) {
|
|
"use strict";
|
|
function $a879823f5092f14a$var$ownKeys(object, enumerableOnly) {
|
|
var keys = Object.keys(object);
|
|
if (Object.getOwnPropertySymbols) {
|
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
})), keys.push.apply(keys, symbols);
|
|
}
|
|
return keys;
|
|
}
|
|
function $a879823f5092f14a$var$_objectSpread(target) {
|
|
for(var i = 1; i < arguments.length; i++){
|
|
var source = null != arguments[i] ? arguments[i] : {};
|
|
i % 2 ? $a879823f5092f14a$var$ownKeys(Object(source), !0).forEach(function(key) {
|
|
$a879823f5092f14a$var$_defineProperty(target, key, source[key]);
|
|
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : $a879823f5092f14a$var$ownKeys(Object(source)).forEach(function(key) {
|
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
});
|
|
}
|
|
return target;
|
|
}
|
|
function $a879823f5092f14a$var$_defineProperty(obj, key, value) {
|
|
key = $a879823f5092f14a$var$_toPropertyKey(key);
|
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
value: value,
|
|
enumerable: true,
|
|
configurable: true,
|
|
writable: true
|
|
});
|
|
else obj[key] = value;
|
|
return obj;
|
|
}
|
|
function $a879823f5092f14a$var$_classCallCheck(instance, Constructor) {
|
|
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
}
|
|
function $a879823f5092f14a$var$_defineProperties(target, props) {
|
|
for(var i = 0; i < props.length; i++){
|
|
var descriptor = props[i];
|
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
descriptor.configurable = true;
|
|
if ("value" in descriptor) descriptor.writable = true;
|
|
Object.defineProperty(target, $a879823f5092f14a$var$_toPropertyKey(descriptor.key), descriptor);
|
|
}
|
|
}
|
|
function $a879823f5092f14a$var$_createClass(Constructor, protoProps, staticProps) {
|
|
if (protoProps) $a879823f5092f14a$var$_defineProperties(Constructor.prototype, protoProps);
|
|
if (staticProps) $a879823f5092f14a$var$_defineProperties(Constructor, staticProps);
|
|
Object.defineProperty(Constructor, "prototype", {
|
|
writable: false
|
|
});
|
|
return Constructor;
|
|
}
|
|
function $a879823f5092f14a$var$_toPropertyKey(arg) {
|
|
var key = $a879823f5092f14a$var$_toPrimitive(arg, "string");
|
|
return typeof key === "symbol" ? key : String(key);
|
|
}
|
|
function $a879823f5092f14a$var$_toPrimitive(input, hint) {
|
|
if (typeof input !== "object" || input === null) return input;
|
|
var prim = input[Symbol.toPrimitive];
|
|
if (prim !== undefined) {
|
|
var res = prim.call(input, hint || "default");
|
|
if (typeof res !== "object") return res;
|
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
}
|
|
return (hint === "string" ? String : Number)(input);
|
|
}
|
|
|
|
var $a879823f5092f14a$var$Buffer = $aniHR$buffer.Buffer;
|
|
|
|
var $a879823f5092f14a$var$inspect = $aniHR$util.inspect;
|
|
var $a879823f5092f14a$var$custom = $a879823f5092f14a$var$inspect && $a879823f5092f14a$var$inspect.custom || "inspect";
|
|
function $a879823f5092f14a$var$copyBuffer(src, target, offset) {
|
|
$a879823f5092f14a$var$Buffer.prototype.copy.call(src, target, offset);
|
|
}
|
|
module.exports = /*#__PURE__*/ function() {
|
|
function BufferList() {
|
|
$a879823f5092f14a$var$_classCallCheck(this, BufferList);
|
|
this.head = null;
|
|
this.tail = null;
|
|
this.length = 0;
|
|
}
|
|
$a879823f5092f14a$var$_createClass(BufferList, [
|
|
{
|
|
key: "push",
|
|
value: function push(v) {
|
|
var entry = {
|
|
data: v,
|
|
next: null
|
|
};
|
|
if (this.length > 0) this.tail.next = entry;
|
|
else this.head = entry;
|
|
this.tail = entry;
|
|
++this.length;
|
|
}
|
|
},
|
|
{
|
|
key: "unshift",
|
|
value: function unshift(v) {
|
|
var entry = {
|
|
data: v,
|
|
next: this.head
|
|
};
|
|
if (this.length === 0) this.tail = entry;
|
|
this.head = entry;
|
|
++this.length;
|
|
}
|
|
},
|
|
{
|
|
key: "shift",
|
|
value: function shift() {
|
|
if (this.length === 0) return;
|
|
var ret = this.head.data;
|
|
if (this.length === 1) this.head = this.tail = null;
|
|
else this.head = this.head.next;
|
|
--this.length;
|
|
return ret;
|
|
}
|
|
},
|
|
{
|
|
key: "clear",
|
|
value: function clear() {
|
|
this.head = this.tail = null;
|
|
this.length = 0;
|
|
}
|
|
},
|
|
{
|
|
key: "join",
|
|
value: function join(s) {
|
|
if (this.length === 0) return "";
|
|
var p = this.head;
|
|
var ret = "" + p.data;
|
|
while(p = p.next)ret += s + p.data;
|
|
return ret;
|
|
}
|
|
},
|
|
{
|
|
key: "concat",
|
|
value: function concat(n) {
|
|
if (this.length === 0) return $a879823f5092f14a$var$Buffer.alloc(0);
|
|
var ret = $a879823f5092f14a$var$Buffer.allocUnsafe(n >>> 0);
|
|
var p = this.head;
|
|
var i = 0;
|
|
while(p){
|
|
$a879823f5092f14a$var$copyBuffer(p.data, ret, i);
|
|
i += p.data.length;
|
|
p = p.next;
|
|
}
|
|
return ret;
|
|
}
|
|
},
|
|
{
|
|
key: "consume",
|
|
value: function consume(n, hasStrings) {
|
|
var ret;
|
|
if (n < this.head.data.length) {
|
|
// `slice` is the same for buffers and strings.
|
|
ret = this.head.data.slice(0, n);
|
|
this.head.data = this.head.data.slice(n);
|
|
} else if (n === this.head.data.length) // First chunk is a perfect match.
|
|
ret = this.shift();
|
|
else // Result spans more than one buffer.
|
|
ret = hasStrings ? this._getString(n) : this._getBuffer(n);
|
|
return ret;
|
|
}
|
|
},
|
|
{
|
|
key: "first",
|
|
value: function first() {
|
|
return this.head.data;
|
|
}
|
|
},
|
|
{
|
|
key: "_getString",
|
|
value: function _getString(n) {
|
|
var p = this.head;
|
|
var c = 1;
|
|
var ret = p.data;
|
|
n -= ret.length;
|
|
while(p = p.next){
|
|
var str = p.data;
|
|
var nb = n > str.length ? str.length : n;
|
|
if (nb === str.length) ret += str;
|
|
else ret += str.slice(0, n);
|
|
n -= nb;
|
|
if (n === 0) {
|
|
if (nb === str.length) {
|
|
++c;
|
|
if (p.next) this.head = p.next;
|
|
else this.head = this.tail = null;
|
|
} else {
|
|
this.head = p;
|
|
p.data = str.slice(nb);
|
|
}
|
|
break;
|
|
}
|
|
++c;
|
|
}
|
|
this.length -= c;
|
|
return ret;
|
|
}
|
|
},
|
|
{
|
|
key: "_getBuffer",
|
|
value: function _getBuffer(n) {
|
|
var ret = $a879823f5092f14a$var$Buffer.allocUnsafe(n);
|
|
var p = this.head;
|
|
var c = 1;
|
|
p.data.copy(ret);
|
|
n -= p.data.length;
|
|
while(p = p.next){
|
|
var buf = p.data;
|
|
var nb = n > buf.length ? buf.length : n;
|
|
buf.copy(ret, ret.length - n, 0, nb);
|
|
n -= nb;
|
|
if (n === 0) {
|
|
if (nb === buf.length) {
|
|
++c;
|
|
if (p.next) this.head = p.next;
|
|
else this.head = this.tail = null;
|
|
} else {
|
|
this.head = p;
|
|
p.data = buf.slice(nb);
|
|
}
|
|
break;
|
|
}
|
|
++c;
|
|
}
|
|
this.length -= c;
|
|
return ret;
|
|
}
|
|
},
|
|
{
|
|
key: $a879823f5092f14a$var$custom,
|
|
value: function value(_, options) {
|
|
return $a879823f5092f14a$var$inspect(this, $a879823f5092f14a$var$_objectSpread($a879823f5092f14a$var$_objectSpread({}, options), {}, {
|
|
// Only inspect one level.
|
|
depth: 0,
|
|
// It should not recurse.
|
|
customInspect: false
|
|
}));
|
|
}
|
|
}
|
|
]);
|
|
return BufferList;
|
|
}();
|
|
|
|
});
|
|
|
|
parcelRegister("4LH3f", function(module, exports) {
|
|
"use strict";
|
|
// undocumented cb() API, needed for core, not for public API
|
|
function $378cf25324fc572e$var$destroy(err, cb) {
|
|
var _this = this;
|
|
var readableDestroyed = this._readableState && this._readableState.destroyed;
|
|
var writableDestroyed = this._writableState && this._writableState.destroyed;
|
|
if (readableDestroyed || writableDestroyed) {
|
|
if (cb) cb(err);
|
|
else if (err) {
|
|
if (!this._writableState) process.nextTick($378cf25324fc572e$var$emitErrorNT, this, err);
|
|
else if (!this._writableState.errorEmitted) {
|
|
this._writableState.errorEmitted = true;
|
|
process.nextTick($378cf25324fc572e$var$emitErrorNT, this, err);
|
|
}
|
|
}
|
|
return this;
|
|
}
|
|
// we set destroyed to true before firing error callbacks in order
|
|
// to make it re-entrance safe in case destroy() is called within callbacks
|
|
if (this._readableState) this._readableState.destroyed = true;
|
|
// if this is a duplex stream mark the writable part as destroyed as well
|
|
if (this._writableState) this._writableState.destroyed = true;
|
|
this._destroy(err || null, function(err) {
|
|
if (!cb && err) {
|
|
if (!_this._writableState) process.nextTick($378cf25324fc572e$var$emitErrorAndCloseNT, _this, err);
|
|
else if (!_this._writableState.errorEmitted) {
|
|
_this._writableState.errorEmitted = true;
|
|
process.nextTick($378cf25324fc572e$var$emitErrorAndCloseNT, _this, err);
|
|
} else process.nextTick($378cf25324fc572e$var$emitCloseNT, _this);
|
|
} else if (cb) {
|
|
process.nextTick($378cf25324fc572e$var$emitCloseNT, _this);
|
|
cb(err);
|
|
} else process.nextTick($378cf25324fc572e$var$emitCloseNT, _this);
|
|
});
|
|
return this;
|
|
}
|
|
function $378cf25324fc572e$var$emitErrorAndCloseNT(self, err) {
|
|
$378cf25324fc572e$var$emitErrorNT(self, err);
|
|
$378cf25324fc572e$var$emitCloseNT(self);
|
|
}
|
|
function $378cf25324fc572e$var$emitCloseNT(self) {
|
|
if (self._writableState && !self._writableState.emitClose) return;
|
|
if (self._readableState && !self._readableState.emitClose) return;
|
|
self.emit("close");
|
|
}
|
|
function $378cf25324fc572e$var$undestroy() {
|
|
if (this._readableState) {
|
|
this._readableState.destroyed = false;
|
|
this._readableState.reading = false;
|
|
this._readableState.ended = false;
|
|
this._readableState.endEmitted = false;
|
|
}
|
|
if (this._writableState) {
|
|
this._writableState.destroyed = false;
|
|
this._writableState.ended = false;
|
|
this._writableState.ending = false;
|
|
this._writableState.finalCalled = false;
|
|
this._writableState.prefinished = false;
|
|
this._writableState.finished = false;
|
|
this._writableState.errorEmitted = false;
|
|
}
|
|
}
|
|
function $378cf25324fc572e$var$emitErrorNT(self, err) {
|
|
self.emit("error", err);
|
|
}
|
|
function $378cf25324fc572e$var$errorOrDestroy(stream, err) {
|
|
// We have tests that rely on errors being emitted
|
|
// in the same tick, so changing this is semver major.
|
|
// For now when you opt-in to autoDestroy we allow
|
|
// the error to be emitted nextTick. In a future
|
|
// semver major update we should change the default to this.
|
|
var rState = stream._readableState;
|
|
var wState = stream._writableState;
|
|
if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);
|
|
else stream.emit("error", err);
|
|
}
|
|
module.exports = {
|
|
destroy: $378cf25324fc572e$var$destroy,
|
|
undestroy: $378cf25324fc572e$var$undestroy,
|
|
errorOrDestroy: $378cf25324fc572e$var$errorOrDestroy
|
|
};
|
|
|
|
});
|
|
|
|
parcelRegister("fmvC3", function(module, exports) {
|
|
"use strict";
|
|
|
|
var $b2f16eb9eccf3e92$var$ERR_INVALID_OPT_VALUE = (parcelRequire("eP0c0")).codes.ERR_INVALID_OPT_VALUE;
|
|
function $b2f16eb9eccf3e92$var$highWaterMarkFrom(options, isDuplex, duplexKey) {
|
|
return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
|
|
}
|
|
function $b2f16eb9eccf3e92$var$getHighWaterMark(state, options, duplexKey, isDuplex) {
|
|
var hwm = $b2f16eb9eccf3e92$var$highWaterMarkFrom(options, isDuplex, duplexKey);
|
|
if (hwm != null) {
|
|
if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
|
|
var name = isDuplex ? duplexKey : "highWaterMark";
|
|
throw new $b2f16eb9eccf3e92$var$ERR_INVALID_OPT_VALUE(name, hwm);
|
|
}
|
|
return Math.floor(hwm);
|
|
}
|
|
// Default value
|
|
return state.objectMode ? 16 : 16384;
|
|
}
|
|
module.exports = {
|
|
getHighWaterMark: $b2f16eb9eccf3e92$var$getHighWaterMark
|
|
};
|
|
|
|
});
|
|
parcelRegister("eP0c0", function(module, exports) {
|
|
|
|
$parcel$export(module.exports, "codes", () => $aca5fa5ab9fab201$export$e45cb6485273080e, (v) => $aca5fa5ab9fab201$export$e45cb6485273080e = v);
|
|
var $aca5fa5ab9fab201$export$e45cb6485273080e;
|
|
"use strict";
|
|
const $aca5fa5ab9fab201$var$codes = {};
|
|
function $aca5fa5ab9fab201$var$createErrorType(code, message, Base) {
|
|
if (!Base) Base = Error;
|
|
function getMessage(arg1, arg2, arg3) {
|
|
if (typeof message === "string") return message;
|
|
else return message(arg1, arg2, arg3);
|
|
}
|
|
class NodeError extends Base {
|
|
constructor(arg1, arg2, arg3){
|
|
super(getMessage(arg1, arg2, arg3));
|
|
}
|
|
}
|
|
NodeError.prototype.name = Base.name;
|
|
NodeError.prototype.code = code;
|
|
$aca5fa5ab9fab201$var$codes[code] = NodeError;
|
|
}
|
|
// https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js
|
|
function $aca5fa5ab9fab201$var$oneOf(expected, thing) {
|
|
if (Array.isArray(expected)) {
|
|
const len = expected.length;
|
|
expected = expected.map((i)=>String(i));
|
|
if (len > 2) return `one of ${thing} ${expected.slice(0, len - 1).join(", ")}, or ` + expected[len - 1];
|
|
else if (len === 2) return `one of ${thing} ${expected[0]} or ${expected[1]}`;
|
|
else return `of ${thing} ${expected[0]}`;
|
|
} else return `of ${thing} ${String(expected)}`;
|
|
}
|
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith
|
|
function $aca5fa5ab9fab201$var$startsWith(str, search, pos) {
|
|
return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;
|
|
}
|
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith
|
|
function $aca5fa5ab9fab201$var$endsWith(str, search, this_len) {
|
|
if (this_len === undefined || this_len > str.length) this_len = str.length;
|
|
return str.substring(this_len - search.length, this_len) === search;
|
|
}
|
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes
|
|
function $aca5fa5ab9fab201$var$includes(str, search, start) {
|
|
if (typeof start !== "number") start = 0;
|
|
if (start + search.length > str.length) return false;
|
|
else return str.indexOf(search, start) !== -1;
|
|
}
|
|
$aca5fa5ab9fab201$var$createErrorType("ERR_INVALID_OPT_VALUE", function(name, value) {
|
|
return 'The value "' + value + '" is invalid for option "' + name + '"';
|
|
}, TypeError);
|
|
$aca5fa5ab9fab201$var$createErrorType("ERR_INVALID_ARG_TYPE", function(name, expected, actual) {
|
|
// determiner: 'must be' or 'must not be'
|
|
let determiner;
|
|
if (typeof expected === "string" && $aca5fa5ab9fab201$var$startsWith(expected, "not ")) {
|
|
determiner = "must not be";
|
|
expected = expected.replace(/^not /, "");
|
|
} else determiner = "must be";
|
|
let msg;
|
|
if ($aca5fa5ab9fab201$var$endsWith(name, " argument")) // For cases like 'first argument'
|
|
msg = `The ${name} ${determiner} ${$aca5fa5ab9fab201$var$oneOf(expected, "type")}`;
|
|
else {
|
|
const type = $aca5fa5ab9fab201$var$includes(name, ".") ? "property" : "argument";
|
|
msg = `The "${name}" ${type} ${determiner} ${$aca5fa5ab9fab201$var$oneOf(expected, "type")}`;
|
|
}
|
|
msg += `. Received type ${typeof actual}`;
|
|
return msg;
|
|
}, TypeError);
|
|
$aca5fa5ab9fab201$var$createErrorType("ERR_STREAM_PUSH_AFTER_EOF", "stream.push() after EOF");
|
|
$aca5fa5ab9fab201$var$createErrorType("ERR_METHOD_NOT_IMPLEMENTED", function(name) {
|
|
return "The " + name + " method is not implemented";
|
|
});
|
|
$aca5fa5ab9fab201$var$createErrorType("ERR_STREAM_PREMATURE_CLOSE", "Premature close");
|
|
$aca5fa5ab9fab201$var$createErrorType("ERR_STREAM_DESTROYED", function(name) {
|
|
return "Cannot call " + name + " after a stream was destroyed";
|
|
});
|
|
$aca5fa5ab9fab201$var$createErrorType("ERR_MULTIPLE_CALLBACK", "Callback called multiple times");
|
|
$aca5fa5ab9fab201$var$createErrorType("ERR_STREAM_CANNOT_PIPE", "Cannot pipe, not readable");
|
|
$aca5fa5ab9fab201$var$createErrorType("ERR_STREAM_WRITE_AFTER_END", "write after end");
|
|
$aca5fa5ab9fab201$var$createErrorType("ERR_STREAM_NULL_VALUES", "May not write null values to stream", TypeError);
|
|
$aca5fa5ab9fab201$var$createErrorType("ERR_UNKNOWN_ENCODING", function(arg) {
|
|
return "Unknown encoding: " + arg;
|
|
}, TypeError);
|
|
$aca5fa5ab9fab201$var$createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT", "stream.unshift() after end event");
|
|
$aca5fa5ab9fab201$export$e45cb6485273080e = $aca5fa5ab9fab201$var$codes;
|
|
|
|
});
|
|
|
|
|
|
parcelRegister("bCCsL", function(module, exports) {
|
|
|
|
|
|
try {
|
|
var $8761144633255046$var$util = $8761144633255046$import$57f6e86051212e1;
|
|
/* istanbul ignore next */ if (typeof $8761144633255046$var$util.inherits !== "function") throw "";
|
|
module.exports = $8761144633255046$var$util.inherits;
|
|
} catch (e) {
|
|
/* istanbul ignore next */ module.exports = (parcelRequire("fzcg4"));
|
|
}
|
|
|
|
});
|
|
parcelRegister("fzcg4", function(module, exports) {
|
|
if (typeof Object.create === "function") // implementation from standard node.js 'util' module
|
|
module.exports = function inherits(ctor, superCtor) {
|
|
if (superCtor) {
|
|
ctor.super_ = superCtor;
|
|
ctor.prototype = Object.create(superCtor.prototype, {
|
|
constructor: {
|
|
value: ctor,
|
|
enumerable: false,
|
|
writable: true,
|
|
configurable: true
|
|
}
|
|
});
|
|
}
|
|
};
|
|
else // old school shim for old browsers
|
|
module.exports = function inherits(ctor, superCtor) {
|
|
if (superCtor) {
|
|
ctor.super_ = superCtor;
|
|
var TempCtor = function() {};
|
|
TempCtor.prototype = superCtor.prototype;
|
|
ctor.prototype = new TempCtor();
|
|
ctor.prototype.constructor = ctor;
|
|
}
|
|
};
|
|
|
|
});
|
|
|
|
|
|
parcelRegister("12ctx", function(module, exports) {
|
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
//
|
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
// copy of this software and associated documentation files (the
|
|
// "Software"), to deal in the Software without restriction, including
|
|
// without limitation the rights to use, copy, modify, merge, publish,
|
|
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
// persons to whom the Software is furnished to do so, subject to the
|
|
// following conditions:
|
|
//
|
|
// The above copyright notice and this permission notice shall be included
|
|
// in all copies or substantial portions of the Software.
|
|
//
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
// a duplex stream is just a stream that is both readable and writable.
|
|
// Since JS doesn't have multiple prototypal inheritance, this class
|
|
// prototypally inherits from Readable, and then parasitically from
|
|
// Writable.
|
|
"use strict";
|
|
/*<replacement>*/ var $0c0fa7b205a1dee1$var$objectKeys = Object.keys || function(obj) {
|
|
var keys = [];
|
|
for(var key in obj)keys.push(key);
|
|
return keys;
|
|
};
|
|
/*</replacement>*/ module.exports = $0c0fa7b205a1dee1$var$Duplex;
|
|
|
|
var $6yfzc = parcelRequire("6yfzc");
|
|
|
|
var $zKkrI = parcelRequire("zKkrI");
|
|
|
|
(parcelRequire("bCCsL"))($0c0fa7b205a1dee1$var$Duplex, $6yfzc);
|
|
// Allow the keys array to be GC'ed.
|
|
var $0c0fa7b205a1dee1$var$keys = $0c0fa7b205a1dee1$var$objectKeys($zKkrI.prototype);
|
|
for(var $0c0fa7b205a1dee1$var$v = 0; $0c0fa7b205a1dee1$var$v < $0c0fa7b205a1dee1$var$keys.length; $0c0fa7b205a1dee1$var$v++){
|
|
var $0c0fa7b205a1dee1$var$method = $0c0fa7b205a1dee1$var$keys[$0c0fa7b205a1dee1$var$v];
|
|
if (!$0c0fa7b205a1dee1$var$Duplex.prototype[$0c0fa7b205a1dee1$var$method]) $0c0fa7b205a1dee1$var$Duplex.prototype[$0c0fa7b205a1dee1$var$method] = $zKkrI.prototype[$0c0fa7b205a1dee1$var$method];
|
|
}
|
|
function $0c0fa7b205a1dee1$var$Duplex(options) {
|
|
if (!(this instanceof $0c0fa7b205a1dee1$var$Duplex)) return new $0c0fa7b205a1dee1$var$Duplex(options);
|
|
$6yfzc.call(this, options);
|
|
$zKkrI.call(this, options);
|
|
this.allowHalfOpen = true;
|
|
if (options) {
|
|
if (options.readable === false) this.readable = false;
|
|
if (options.writable === false) this.writable = false;
|
|
if (options.allowHalfOpen === false) {
|
|
this.allowHalfOpen = false;
|
|
this.once("end", $0c0fa7b205a1dee1$var$onend);
|
|
}
|
|
}
|
|
}
|
|
Object.defineProperty($0c0fa7b205a1dee1$var$Duplex.prototype, "writableHighWaterMark", {
|
|
// making it explicit this property is not enumerable
|
|
// because otherwise some prototype manipulation in
|
|
// userland will fail
|
|
enumerable: false,
|
|
get: function get() {
|
|
return this._writableState.highWaterMark;
|
|
}
|
|
});
|
|
Object.defineProperty($0c0fa7b205a1dee1$var$Duplex.prototype, "writableBuffer", {
|
|
// making it explicit this property is not enumerable
|
|
// because otherwise some prototype manipulation in
|
|
// userland will fail
|
|
enumerable: false,
|
|
get: function get() {
|
|
return this._writableState && this._writableState.getBuffer();
|
|
}
|
|
});
|
|
Object.defineProperty($0c0fa7b205a1dee1$var$Duplex.prototype, "writableLength", {
|
|
// making it explicit this property is not enumerable
|
|
// because otherwise some prototype manipulation in
|
|
// userland will fail
|
|
enumerable: false,
|
|
get: function get() {
|
|
return this._writableState.length;
|
|
}
|
|
});
|
|
// the no-half-open enforcer
|
|
function $0c0fa7b205a1dee1$var$onend() {
|
|
// If the writable side ended, then we're ok.
|
|
if (this._writableState.ended) return;
|
|
// no more data can be written.
|
|
// But allow more writes to happen in this tick.
|
|
process.nextTick($0c0fa7b205a1dee1$var$onEndNT, this);
|
|
}
|
|
function $0c0fa7b205a1dee1$var$onEndNT(self) {
|
|
self.end();
|
|
}
|
|
Object.defineProperty($0c0fa7b205a1dee1$var$Duplex.prototype, "destroyed", {
|
|
// making it explicit this property is not enumerable
|
|
// because otherwise some prototype manipulation in
|
|
// userland will fail
|
|
enumerable: false,
|
|
get: function get() {
|
|
if (this._readableState === undefined || this._writableState === undefined) return false;
|
|
return this._readableState.destroyed && this._writableState.destroyed;
|
|
},
|
|
set: function set(value) {
|
|
// we ignore the value if the stream
|
|
// has not been initialized yet
|
|
if (this._readableState === undefined || this._writableState === undefined) return;
|
|
// backward compatibility, the user is explicitly
|
|
// managing destroyed
|
|
this._readableState.destroyed = value;
|
|
this._writableState.destroyed = value;
|
|
}
|
|
});
|
|
|
|
});
|
|
parcelRegister("zKkrI", function(module, exports) {
|
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
//
|
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
// copy of this software and associated documentation files (the
|
|
// "Software"), to deal in the Software without restriction, including
|
|
// without limitation the rights to use, copy, modify, merge, publish,
|
|
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
// persons to whom the Software is furnished to do so, subject to the
|
|
// following conditions:
|
|
//
|
|
// The above copyright notice and this permission notice shall be included
|
|
// in all copies or substantial portions of the Software.
|
|
//
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
// A bit simpler than readable streams.
|
|
// Implement an async ._write(chunk, encoding, cb), and it'll handle all
|
|
// the drain event emission and buffering.
|
|
"use strict";
|
|
module.exports = $06b734edc99bcb15$var$Writable;
|
|
/* <replacement> */ function $06b734edc99bcb15$var$WriteReq(chunk, encoding, cb) {
|
|
this.chunk = chunk;
|
|
this.encoding = encoding;
|
|
this.callback = cb;
|
|
this.next = null;
|
|
}
|
|
// It seems a linked list but it is not
|
|
// there will be only 2 of these for each stream
|
|
function $06b734edc99bcb15$var$CorkedRequest(state) {
|
|
var _this = this;
|
|
this.next = null;
|
|
this.entry = null;
|
|
this.finish = function() {
|
|
$06b734edc99bcb15$var$onCorkedFinish(_this, state);
|
|
};
|
|
}
|
|
/* </replacement> */ /*<replacement>*/ var $06b734edc99bcb15$var$Duplex;
|
|
/*</replacement>*/ $06b734edc99bcb15$var$Writable.WritableState = $06b734edc99bcb15$var$WritableState;
|
|
|
|
/*<replacement>*/ var $06b734edc99bcb15$var$internalUtil = {
|
|
deprecate: (parcelRequire("2umAH"))
|
|
};
|
|
|
|
var $9pk2O = parcelRequire("9pk2O");
|
|
|
|
var $06b734edc99bcb15$require$Buffer = $aniHR$buffer.Buffer;
|
|
var $06b734edc99bcb15$var$OurUint8Array = (typeof $parcel$global !== "undefined" ? $parcel$global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {};
|
|
function $06b734edc99bcb15$var$_uint8ArrayToBuffer(chunk) {
|
|
return $06b734edc99bcb15$require$Buffer.from(chunk);
|
|
}
|
|
function $06b734edc99bcb15$var$_isUint8Array(obj) {
|
|
return $06b734edc99bcb15$require$Buffer.isBuffer(obj) || obj instanceof $06b734edc99bcb15$var$OurUint8Array;
|
|
}
|
|
|
|
var $4LH3f = parcelRequire("4LH3f");
|
|
|
|
var $fmvC3 = parcelRequire("fmvC3");
|
|
var $06b734edc99bcb15$var$getHighWaterMark = $fmvC3.getHighWaterMark;
|
|
|
|
var $eP0c0 = parcelRequire("eP0c0");
|
|
var $06b734edc99bcb15$require$_require$codes = $eP0c0.codes;
|
|
var $06b734edc99bcb15$var$ERR_INVALID_ARG_TYPE = $06b734edc99bcb15$require$_require$codes.ERR_INVALID_ARG_TYPE, $06b734edc99bcb15$var$ERR_METHOD_NOT_IMPLEMENTED = $06b734edc99bcb15$require$_require$codes.ERR_METHOD_NOT_IMPLEMENTED, $06b734edc99bcb15$var$ERR_MULTIPLE_CALLBACK = $06b734edc99bcb15$require$_require$codes.ERR_MULTIPLE_CALLBACK, $06b734edc99bcb15$var$ERR_STREAM_CANNOT_PIPE = $06b734edc99bcb15$require$_require$codes.ERR_STREAM_CANNOT_PIPE, $06b734edc99bcb15$var$ERR_STREAM_DESTROYED = $06b734edc99bcb15$require$_require$codes.ERR_STREAM_DESTROYED, $06b734edc99bcb15$var$ERR_STREAM_NULL_VALUES = $06b734edc99bcb15$require$_require$codes.ERR_STREAM_NULL_VALUES, $06b734edc99bcb15$var$ERR_STREAM_WRITE_AFTER_END = $06b734edc99bcb15$require$_require$codes.ERR_STREAM_WRITE_AFTER_END, $06b734edc99bcb15$var$ERR_UNKNOWN_ENCODING = $06b734edc99bcb15$require$_require$codes.ERR_UNKNOWN_ENCODING;
|
|
var $06b734edc99bcb15$var$errorOrDestroy = $4LH3f.errorOrDestroy;
|
|
|
|
(parcelRequire("bCCsL"))($06b734edc99bcb15$var$Writable, $9pk2O);
|
|
function $06b734edc99bcb15$var$nop() {}
|
|
|
|
function $06b734edc99bcb15$var$WritableState(options, stream, isDuplex) {
|
|
$06b734edc99bcb15$var$Duplex = $06b734edc99bcb15$var$Duplex || (parcelRequire("12ctx"));
|
|
options = options || {};
|
|
// Duplex streams are both readable and writable, but share
|
|
// the same options object.
|
|
// However, some cases require setting options to different
|
|
// values for the readable and the writable sides of the duplex stream,
|
|
// e.g. options.readableObjectMode vs. options.writableObjectMode, etc.
|
|
if (typeof isDuplex !== "boolean") isDuplex = stream instanceof $06b734edc99bcb15$var$Duplex;
|
|
// object stream flag to indicate whether or not this stream
|
|
// contains buffers or objects.
|
|
this.objectMode = !!options.objectMode;
|
|
if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
|
|
// the point at which write() starts returning false
|
|
// Note: 0 is a valid value, means that we always return false if
|
|
// the entire buffer is not flushed immediately on write()
|
|
this.highWaterMark = $06b734edc99bcb15$var$getHighWaterMark(this, options, "writableHighWaterMark", isDuplex);
|
|
// if _final has been called
|
|
this.finalCalled = false;
|
|
// drain event flag.
|
|
this.needDrain = false;
|
|
// at the start of calling end()
|
|
this.ending = false;
|
|
// when end() has been called, and returned
|
|
this.ended = false;
|
|
// when 'finish' is emitted
|
|
this.finished = false;
|
|
// has it been destroyed
|
|
this.destroyed = false;
|
|
// should we decode strings into buffers before passing to _write?
|
|
// this is here so that some node-core streams can optimize string
|
|
// handling at a lower level.
|
|
var noDecode = options.decodeStrings === false;
|
|
this.decodeStrings = !noDecode;
|
|
// Crypto is kind of old and crusty. Historically, its default string
|
|
// encoding is 'binary' so we have to make this configurable.
|
|
// Everything else in the universe uses 'utf8', though.
|
|
this.defaultEncoding = options.defaultEncoding || "utf8";
|
|
// not an actual buffer we keep track of, but a measurement
|
|
// of how much we're waiting to get pushed to some underlying
|
|
// socket or file.
|
|
this.length = 0;
|
|
// a flag to see when we're in the middle of a write.
|
|
this.writing = false;
|
|
// when true all writes will be buffered until .uncork() call
|
|
this.corked = 0;
|
|
// a flag to be able to tell if the onwrite cb is called immediately,
|
|
// or on a later tick. We set this to true at first, because any
|
|
// actions that shouldn't happen until "later" should generally also
|
|
// not happen before the first write call.
|
|
this.sync = true;
|
|
// a flag to know if we're processing previously buffered items, which
|
|
// may call the _write() callback in the same tick, so that we don't
|
|
// end up in an overlapped onwrite situation.
|
|
this.bufferProcessing = false;
|
|
// the callback that's passed to _write(chunk,cb)
|
|
this.onwrite = function(er) {
|
|
$06b734edc99bcb15$var$onwrite(stream, er);
|
|
};
|
|
// the callback that the user supplies to write(chunk,encoding,cb)
|
|
this.writecb = null;
|
|
// the amount that is being written when _write is called.
|
|
this.writelen = 0;
|
|
this.bufferedRequest = null;
|
|
this.lastBufferedRequest = null;
|
|
// number of pending user-supplied write callbacks
|
|
// this must be 0 before 'finish' can be emitted
|
|
this.pendingcb = 0;
|
|
// emit prefinish if the only thing we're waiting for is _write cbs
|
|
// This is relevant for synchronous Transform streams
|
|
this.prefinished = false;
|
|
// True if the error was already emitted and should not be thrown again
|
|
this.errorEmitted = false;
|
|
// Should close be emitted on destroy. Defaults to true.
|
|
this.emitClose = options.emitClose !== false;
|
|
// Should .destroy() be called after 'finish' (and potentially 'end')
|
|
this.autoDestroy = !!options.autoDestroy;
|
|
// count buffered requests
|
|
this.bufferedRequestCount = 0;
|
|
// allocate the first CorkedRequest, there is always
|
|
// one allocated and free to use, and we maintain at most two
|
|
this.corkedRequestsFree = new $06b734edc99bcb15$var$CorkedRequest(this);
|
|
}
|
|
$06b734edc99bcb15$var$WritableState.prototype.getBuffer = function getBuffer() {
|
|
var current = this.bufferedRequest;
|
|
var out = [];
|
|
while(current){
|
|
out.push(current);
|
|
current = current.next;
|
|
}
|
|
return out;
|
|
};
|
|
(function() {
|
|
try {
|
|
Object.defineProperty($06b734edc99bcb15$var$WritableState.prototype, "buffer", {
|
|
get: $06b734edc99bcb15$var$internalUtil.deprecate(function writableStateBufferGetter() {
|
|
return this.getBuffer();
|
|
}, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003")
|
|
});
|
|
} catch (_) {}
|
|
})();
|
|
// Test _writableState for inheritance to account for Duplex streams,
|
|
// whose prototype chain only points to Readable.
|
|
var $06b734edc99bcb15$var$realHasInstance;
|
|
if (typeof Symbol === "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === "function") {
|
|
$06b734edc99bcb15$var$realHasInstance = Function.prototype[Symbol.hasInstance];
|
|
Object.defineProperty($06b734edc99bcb15$var$Writable, Symbol.hasInstance, {
|
|
value: function value(object) {
|
|
if ($06b734edc99bcb15$var$realHasInstance.call(this, object)) return true;
|
|
if (this !== $06b734edc99bcb15$var$Writable) return false;
|
|
return object && object._writableState instanceof $06b734edc99bcb15$var$WritableState;
|
|
}
|
|
});
|
|
} else $06b734edc99bcb15$var$realHasInstance = function realHasInstance(object) {
|
|
return object instanceof this;
|
|
};
|
|
|
|
function $06b734edc99bcb15$var$Writable(options) {
|
|
$06b734edc99bcb15$var$Duplex = $06b734edc99bcb15$var$Duplex || (parcelRequire("12ctx"));
|
|
// Writable ctor is applied to Duplexes, too.
|
|
// `realHasInstance` is necessary because using plain `instanceof`
|
|
// would return false, as no `_writableState` property is attached.
|
|
// Trying to use the custom `instanceof` for Writable here will also break the
|
|
// Node.js LazyTransform implementation, which has a non-trivial getter for
|
|
// `_writableState` that would lead to infinite recursion.
|
|
// Checking for a Stream.Duplex instance is faster here instead of inside
|
|
// the WritableState constructor, at least with V8 6.5
|
|
var isDuplex = this instanceof $06b734edc99bcb15$var$Duplex;
|
|
if (!isDuplex && !$06b734edc99bcb15$var$realHasInstance.call($06b734edc99bcb15$var$Writable, this)) return new $06b734edc99bcb15$var$Writable(options);
|
|
this._writableState = new $06b734edc99bcb15$var$WritableState(options, this, isDuplex);
|
|
// legacy.
|
|
this.writable = true;
|
|
if (options) {
|
|
if (typeof options.write === "function") this._write = options.write;
|
|
if (typeof options.writev === "function") this._writev = options.writev;
|
|
if (typeof options.destroy === "function") this._destroy = options.destroy;
|
|
if (typeof options.final === "function") this._final = options.final;
|
|
}
|
|
$9pk2O.call(this);
|
|
}
|
|
// Otherwise people can pipe Writable streams, which is just wrong.
|
|
$06b734edc99bcb15$var$Writable.prototype.pipe = function() {
|
|
$06b734edc99bcb15$var$errorOrDestroy(this, new $06b734edc99bcb15$var$ERR_STREAM_CANNOT_PIPE());
|
|
};
|
|
function $06b734edc99bcb15$var$writeAfterEnd(stream, cb) {
|
|
var er = new $06b734edc99bcb15$var$ERR_STREAM_WRITE_AFTER_END();
|
|
// TODO: defer error events consistently everywhere, not just the cb
|
|
$06b734edc99bcb15$var$errorOrDestroy(stream, er);
|
|
process.nextTick(cb, er);
|
|
}
|
|
// Checks that a user-supplied chunk is valid, especially for the particular
|
|
// mode the stream is in. Currently this means that `null` is never accepted
|
|
// and undefined/non-string values are only allowed in object mode.
|
|
function $06b734edc99bcb15$var$validChunk(stream, state, chunk, cb) {
|
|
var er;
|
|
if (chunk === null) er = new $06b734edc99bcb15$var$ERR_STREAM_NULL_VALUES();
|
|
else if (typeof chunk !== "string" && !state.objectMode) er = new $06b734edc99bcb15$var$ERR_INVALID_ARG_TYPE("chunk", [
|
|
"string",
|
|
"Buffer"
|
|
], chunk);
|
|
if (er) {
|
|
$06b734edc99bcb15$var$errorOrDestroy(stream, er);
|
|
process.nextTick(cb, er);
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
$06b734edc99bcb15$var$Writable.prototype.write = function(chunk, encoding, cb) {
|
|
var state = this._writableState;
|
|
var ret = false;
|
|
var isBuf = !state.objectMode && $06b734edc99bcb15$var$_isUint8Array(chunk);
|
|
if (isBuf && !$06b734edc99bcb15$require$Buffer.isBuffer(chunk)) chunk = $06b734edc99bcb15$var$_uint8ArrayToBuffer(chunk);
|
|
if (typeof encoding === "function") {
|
|
cb = encoding;
|
|
encoding = null;
|
|
}
|
|
if (isBuf) encoding = "buffer";
|
|
else if (!encoding) encoding = state.defaultEncoding;
|
|
if (typeof cb !== "function") cb = $06b734edc99bcb15$var$nop;
|
|
if (state.ending) $06b734edc99bcb15$var$writeAfterEnd(this, cb);
|
|
else if (isBuf || $06b734edc99bcb15$var$validChunk(this, state, chunk, cb)) {
|
|
state.pendingcb++;
|
|
ret = $06b734edc99bcb15$var$writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
|
|
}
|
|
return ret;
|
|
};
|
|
$06b734edc99bcb15$var$Writable.prototype.cork = function() {
|
|
this._writableState.corked++;
|
|
};
|
|
$06b734edc99bcb15$var$Writable.prototype.uncork = function() {
|
|
var state = this._writableState;
|
|
if (state.corked) {
|
|
state.corked--;
|
|
if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) $06b734edc99bcb15$var$clearBuffer(this, state);
|
|
}
|
|
};
|
|
$06b734edc99bcb15$var$Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
|
|
// node::ParseEncoding() requires lower case.
|
|
if (typeof encoding === "string") encoding = encoding.toLowerCase();
|
|
if (!([
|
|
"hex",
|
|
"utf8",
|
|
"utf-8",
|
|
"ascii",
|
|
"binary",
|
|
"base64",
|
|
"ucs2",
|
|
"ucs-2",
|
|
"utf16le",
|
|
"utf-16le",
|
|
"raw"
|
|
].indexOf((encoding + "").toLowerCase()) > -1)) throw new $06b734edc99bcb15$var$ERR_UNKNOWN_ENCODING(encoding);
|
|
this._writableState.defaultEncoding = encoding;
|
|
return this;
|
|
};
|
|
Object.defineProperty($06b734edc99bcb15$var$Writable.prototype, "writableBuffer", {
|
|
// making it explicit this property is not enumerable
|
|
// because otherwise some prototype manipulation in
|
|
// userland will fail
|
|
enumerable: false,
|
|
get: function get() {
|
|
return this._writableState && this._writableState.getBuffer();
|
|
}
|
|
});
|
|
function $06b734edc99bcb15$var$decodeChunk(state, chunk, encoding) {
|
|
if (!state.objectMode && state.decodeStrings !== false && typeof chunk === "string") chunk = $06b734edc99bcb15$require$Buffer.from(chunk, encoding);
|
|
return chunk;
|
|
}
|
|
Object.defineProperty($06b734edc99bcb15$var$Writable.prototype, "writableHighWaterMark", {
|
|
// making it explicit this property is not enumerable
|
|
// because otherwise some prototype manipulation in
|
|
// userland will fail
|
|
enumerable: false,
|
|
get: function get() {
|
|
return this._writableState.highWaterMark;
|
|
}
|
|
});
|
|
// if we're already writing something, then just put this
|
|
// in the queue, and wait our turn. Otherwise, call _write
|
|
// If we return false, then we need a drain event, so set that flag.
|
|
function $06b734edc99bcb15$var$writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
|
|
if (!isBuf) {
|
|
var newChunk = $06b734edc99bcb15$var$decodeChunk(state, chunk, encoding);
|
|
if (chunk !== newChunk) {
|
|
isBuf = true;
|
|
encoding = "buffer";
|
|
chunk = newChunk;
|
|
}
|
|
}
|
|
var len = state.objectMode ? 1 : chunk.length;
|
|
state.length += len;
|
|
var ret = state.length < state.highWaterMark;
|
|
// we must ensure that previous needDrain will not be reset to false.
|
|
if (!ret) state.needDrain = true;
|
|
if (state.writing || state.corked) {
|
|
var last = state.lastBufferedRequest;
|
|
state.lastBufferedRequest = {
|
|
chunk: chunk,
|
|
encoding: encoding,
|
|
isBuf: isBuf,
|
|
callback: cb,
|
|
next: null
|
|
};
|
|
if (last) last.next = state.lastBufferedRequest;
|
|
else state.bufferedRequest = state.lastBufferedRequest;
|
|
state.bufferedRequestCount += 1;
|
|
} else $06b734edc99bcb15$var$doWrite(stream, state, false, len, chunk, encoding, cb);
|
|
return ret;
|
|
}
|
|
function $06b734edc99bcb15$var$doWrite(stream, state, writev, len, chunk, encoding, cb) {
|
|
state.writelen = len;
|
|
state.writecb = cb;
|
|
state.writing = true;
|
|
state.sync = true;
|
|
if (state.destroyed) state.onwrite(new $06b734edc99bcb15$var$ERR_STREAM_DESTROYED("write"));
|
|
else if (writev) stream._writev(chunk, state.onwrite);
|
|
else stream._write(chunk, encoding, state.onwrite);
|
|
state.sync = false;
|
|
}
|
|
function $06b734edc99bcb15$var$onwriteError(stream, state, sync, er, cb) {
|
|
--state.pendingcb;
|
|
if (sync) {
|
|
// defer the callback if we are being called synchronously
|
|
// to avoid piling up things on the stack
|
|
process.nextTick(cb, er);
|
|
// this can emit finish, and it will always happen
|
|
// after error
|
|
process.nextTick($06b734edc99bcb15$var$finishMaybe, stream, state);
|
|
stream._writableState.errorEmitted = true;
|
|
$06b734edc99bcb15$var$errorOrDestroy(stream, er);
|
|
} else {
|
|
// the caller expect this to happen before if
|
|
// it is async
|
|
cb(er);
|
|
stream._writableState.errorEmitted = true;
|
|
$06b734edc99bcb15$var$errorOrDestroy(stream, er);
|
|
// this can emit finish, but finish must
|
|
// always follow error
|
|
$06b734edc99bcb15$var$finishMaybe(stream, state);
|
|
}
|
|
}
|
|
function $06b734edc99bcb15$var$onwriteStateUpdate(state) {
|
|
state.writing = false;
|
|
state.writecb = null;
|
|
state.length -= state.writelen;
|
|
state.writelen = 0;
|
|
}
|
|
function $06b734edc99bcb15$var$onwrite(stream, er) {
|
|
var state = stream._writableState;
|
|
var sync = state.sync;
|
|
var cb = state.writecb;
|
|
if (typeof cb !== "function") throw new $06b734edc99bcb15$var$ERR_MULTIPLE_CALLBACK();
|
|
$06b734edc99bcb15$var$onwriteStateUpdate(state);
|
|
if (er) $06b734edc99bcb15$var$onwriteError(stream, state, sync, er, cb);
|
|
else {
|
|
// Check if we're actually ready to finish, but don't emit yet
|
|
var finished = $06b734edc99bcb15$var$needFinish(state) || stream.destroyed;
|
|
if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) $06b734edc99bcb15$var$clearBuffer(stream, state);
|
|
if (sync) process.nextTick($06b734edc99bcb15$var$afterWrite, stream, state, finished, cb);
|
|
else $06b734edc99bcb15$var$afterWrite(stream, state, finished, cb);
|
|
}
|
|
}
|
|
function $06b734edc99bcb15$var$afterWrite(stream, state, finished, cb) {
|
|
if (!finished) $06b734edc99bcb15$var$onwriteDrain(stream, state);
|
|
state.pendingcb--;
|
|
cb();
|
|
$06b734edc99bcb15$var$finishMaybe(stream, state);
|
|
}
|
|
// Must force callback to be called on nextTick, so that we don't
|
|
// emit 'drain' before the write() consumer gets the 'false' return
|
|
// value, and has a chance to attach a 'drain' listener.
|
|
function $06b734edc99bcb15$var$onwriteDrain(stream, state) {
|
|
if (state.length === 0 && state.needDrain) {
|
|
state.needDrain = false;
|
|
stream.emit("drain");
|
|
}
|
|
}
|
|
// if there's something in the buffer waiting, then process it
|
|
function $06b734edc99bcb15$var$clearBuffer(stream, state) {
|
|
state.bufferProcessing = true;
|
|
var entry = state.bufferedRequest;
|
|
if (stream._writev && entry && entry.next) {
|
|
// Fast case, write everything using _writev()
|
|
var l = state.bufferedRequestCount;
|
|
var buffer = new Array(l);
|
|
var holder = state.corkedRequestsFree;
|
|
holder.entry = entry;
|
|
var count = 0;
|
|
var allBuffers = true;
|
|
while(entry){
|
|
buffer[count] = entry;
|
|
if (!entry.isBuf) allBuffers = false;
|
|
entry = entry.next;
|
|
count += 1;
|
|
}
|
|
buffer.allBuffers = allBuffers;
|
|
$06b734edc99bcb15$var$doWrite(stream, state, true, state.length, buffer, "", holder.finish);
|
|
// doWrite is almost always async, defer these to save a bit of time
|
|
// as the hot path ends with doWrite
|
|
state.pendingcb++;
|
|
state.lastBufferedRequest = null;
|
|
if (holder.next) {
|
|
state.corkedRequestsFree = holder.next;
|
|
holder.next = null;
|
|
} else state.corkedRequestsFree = new $06b734edc99bcb15$var$CorkedRequest(state);
|
|
state.bufferedRequestCount = 0;
|
|
} else {
|
|
// Slow case, write chunks one-by-one
|
|
while(entry){
|
|
var chunk = entry.chunk;
|
|
var encoding = entry.encoding;
|
|
var cb = entry.callback;
|
|
var len = state.objectMode ? 1 : chunk.length;
|
|
$06b734edc99bcb15$var$doWrite(stream, state, false, len, chunk, encoding, cb);
|
|
entry = entry.next;
|
|
state.bufferedRequestCount--;
|
|
// if we didn't call the onwrite immediately, then
|
|
// it means that we need to wait until it does.
|
|
// also, that means that the chunk and cb are currently
|
|
// being processed, so move the buffer counter past them.
|
|
if (state.writing) break;
|
|
}
|
|
if (entry === null) state.lastBufferedRequest = null;
|
|
}
|
|
state.bufferedRequest = entry;
|
|
state.bufferProcessing = false;
|
|
}
|
|
$06b734edc99bcb15$var$Writable.prototype._write = function(chunk, encoding, cb) {
|
|
cb(new $06b734edc99bcb15$var$ERR_METHOD_NOT_IMPLEMENTED("_write()"));
|
|
};
|
|
$06b734edc99bcb15$var$Writable.prototype._writev = null;
|
|
$06b734edc99bcb15$var$Writable.prototype.end = function(chunk, encoding, cb) {
|
|
var state = this._writableState;
|
|
if (typeof chunk === "function") {
|
|
cb = chunk;
|
|
chunk = null;
|
|
encoding = null;
|
|
} else if (typeof encoding === "function") {
|
|
cb = encoding;
|
|
encoding = null;
|
|
}
|
|
if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
|
|
// .end() fully uncorks
|
|
if (state.corked) {
|
|
state.corked = 1;
|
|
this.uncork();
|
|
}
|
|
// ignore unnecessary end() calls.
|
|
if (!state.ending) $06b734edc99bcb15$var$endWritable(this, state, cb);
|
|
return this;
|
|
};
|
|
Object.defineProperty($06b734edc99bcb15$var$Writable.prototype, "writableLength", {
|
|
// making it explicit this property is not enumerable
|
|
// because otherwise some prototype manipulation in
|
|
// userland will fail
|
|
enumerable: false,
|
|
get: function get() {
|
|
return this._writableState.length;
|
|
}
|
|
});
|
|
function $06b734edc99bcb15$var$needFinish(state) {
|
|
return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
|
|
}
|
|
function $06b734edc99bcb15$var$callFinal(stream, state) {
|
|
stream._final(function(err) {
|
|
state.pendingcb--;
|
|
if (err) $06b734edc99bcb15$var$errorOrDestroy(stream, err);
|
|
state.prefinished = true;
|
|
stream.emit("prefinish");
|
|
$06b734edc99bcb15$var$finishMaybe(stream, state);
|
|
});
|
|
}
|
|
function $06b734edc99bcb15$var$prefinish(stream, state) {
|
|
if (!state.prefinished && !state.finalCalled) {
|
|
if (typeof stream._final === "function" && !state.destroyed) {
|
|
state.pendingcb++;
|
|
state.finalCalled = true;
|
|
process.nextTick($06b734edc99bcb15$var$callFinal, stream, state);
|
|
} else {
|
|
state.prefinished = true;
|
|
stream.emit("prefinish");
|
|
}
|
|
}
|
|
}
|
|
function $06b734edc99bcb15$var$finishMaybe(stream, state) {
|
|
var need = $06b734edc99bcb15$var$needFinish(state);
|
|
if (need) {
|
|
$06b734edc99bcb15$var$prefinish(stream, state);
|
|
if (state.pendingcb === 0) {
|
|
state.finished = true;
|
|
stream.emit("finish");
|
|
if (state.autoDestroy) {
|
|
// In case of duplex streams we need a way to detect
|
|
// if the readable side is ready for autoDestroy as well
|
|
var rState = stream._readableState;
|
|
if (!rState || rState.autoDestroy && rState.endEmitted) stream.destroy();
|
|
}
|
|
}
|
|
}
|
|
return need;
|
|
}
|
|
function $06b734edc99bcb15$var$endWritable(stream, state, cb) {
|
|
state.ending = true;
|
|
$06b734edc99bcb15$var$finishMaybe(stream, state);
|
|
if (cb) {
|
|
if (state.finished) process.nextTick(cb);
|
|
else stream.once("finish", cb);
|
|
}
|
|
state.ended = true;
|
|
stream.writable = false;
|
|
}
|
|
function $06b734edc99bcb15$var$onCorkedFinish(corkReq, state, err) {
|
|
var entry = corkReq.entry;
|
|
corkReq.entry = null;
|
|
while(entry){
|
|
var cb = entry.callback;
|
|
state.pendingcb--;
|
|
cb(err);
|
|
entry = entry.next;
|
|
}
|
|
// reuse the free corkReq.
|
|
state.corkedRequestsFree.next = corkReq;
|
|
}
|
|
Object.defineProperty($06b734edc99bcb15$var$Writable.prototype, "destroyed", {
|
|
// making it explicit this property is not enumerable
|
|
// because otherwise some prototype manipulation in
|
|
// userland will fail
|
|
enumerable: false,
|
|
get: function get() {
|
|
if (this._writableState === undefined) return false;
|
|
return this._writableState.destroyed;
|
|
},
|
|
set: function set(value) {
|
|
// we ignore the value if the stream
|
|
// has not been initialized yet
|
|
if (!this._writableState) return;
|
|
// backward compatibility, the user is explicitly
|
|
// managing destroyed
|
|
this._writableState.destroyed = value;
|
|
}
|
|
});
|
|
$06b734edc99bcb15$var$Writable.prototype.destroy = $4LH3f.destroy;
|
|
$06b734edc99bcb15$var$Writable.prototype._undestroy = $4LH3f.undestroy;
|
|
$06b734edc99bcb15$var$Writable.prototype._destroy = function(err, cb) {
|
|
cb(err);
|
|
};
|
|
|
|
});
|
|
parcelRegister("2umAH", function(module, exports) {
|
|
/**
|
|
* For Node.js, simply re-export the core `util.deprecate` function.
|
|
*/
|
|
module.exports = $aniHR$util.deprecate;
|
|
|
|
});
|
|
|
|
|
|
|
|
parcelRegister("8BMvp", function(module, exports) {
|
|
|
|
$parcel$export(module.exports, "StringDecoder", () => $6447679fcc743d97$export$63a7aa211a91ed69, (v) => $6447679fcc743d97$export$63a7aa211a91ed69 = v);
|
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
//
|
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
// copy of this software and associated documentation files (the
|
|
// "Software"), to deal in the Software without restriction, including
|
|
// without limitation the rights to use, copy, modify, merge, publish,
|
|
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
// persons to whom the Software is furnished to do so, subject to the
|
|
// following conditions:
|
|
//
|
|
// The above copyright notice and this permission notice shall be included
|
|
// in all copies or substantial portions of the Software.
|
|
//
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
// StringDecoder provides an interface for efficiently splitting a series of
|
|
// buffers into a series of JS strings without breaking apart multi-byte
|
|
// characters.
|
|
var $6447679fcc743d97$export$63a7aa211a91ed69;
|
|
"use strict";
|
|
|
|
var $e1ZLE = parcelRequire("e1ZLE");
|
|
var $6447679fcc743d97$require$Buffer = $e1ZLE.Buffer;
|
|
/*</replacement>*/ var $6447679fcc743d97$var$isEncoding = $6447679fcc743d97$require$Buffer.isEncoding || function(encoding) {
|
|
encoding = "" + encoding;
|
|
switch(encoding && encoding.toLowerCase()){
|
|
case "hex":
|
|
case "utf8":
|
|
case "utf-8":
|
|
case "ascii":
|
|
case "binary":
|
|
case "base64":
|
|
case "ucs2":
|
|
case "ucs-2":
|
|
case "utf16le":
|
|
case "utf-16le":
|
|
case "raw":
|
|
return true;
|
|
default:
|
|
return false;
|
|
}
|
|
};
|
|
function $6447679fcc743d97$var$_normalizeEncoding(enc) {
|
|
if (!enc) return "utf8";
|
|
var retried;
|
|
while(true)switch(enc){
|
|
case "utf8":
|
|
case "utf-8":
|
|
return "utf8";
|
|
case "ucs2":
|
|
case "ucs-2":
|
|
case "utf16le":
|
|
case "utf-16le":
|
|
return "utf16le";
|
|
case "latin1":
|
|
case "binary":
|
|
return "latin1";
|
|
case "base64":
|
|
case "ascii":
|
|
case "hex":
|
|
return enc;
|
|
default:
|
|
if (retried) return; // undefined
|
|
enc = ("" + enc).toLowerCase();
|
|
retried = true;
|
|
}
|
|
}
|
|
// Do not cache `Buffer.isEncoding` when checking encoding names as some
|
|
// modules monkey-patch it to support additional encodings
|
|
function $6447679fcc743d97$var$normalizeEncoding(enc) {
|
|
var nenc = $6447679fcc743d97$var$_normalizeEncoding(enc);
|
|
if (typeof nenc !== "string" && ($6447679fcc743d97$require$Buffer.isEncoding === $6447679fcc743d97$var$isEncoding || !$6447679fcc743d97$var$isEncoding(enc))) throw new Error("Unknown encoding: " + enc);
|
|
return nenc || enc;
|
|
}
|
|
$6447679fcc743d97$export$63a7aa211a91ed69 = $6447679fcc743d97$var$StringDecoder;
|
|
function $6447679fcc743d97$var$StringDecoder(encoding) {
|
|
this.encoding = $6447679fcc743d97$var$normalizeEncoding(encoding);
|
|
var nb;
|
|
switch(this.encoding){
|
|
case "utf16le":
|
|
this.text = $6447679fcc743d97$var$utf16Text;
|
|
this.end = $6447679fcc743d97$var$utf16End;
|
|
nb = 4;
|
|
break;
|
|
case "utf8":
|
|
this.fillLast = $6447679fcc743d97$var$utf8FillLast;
|
|
nb = 4;
|
|
break;
|
|
case "base64":
|
|
this.text = $6447679fcc743d97$var$base64Text;
|
|
this.end = $6447679fcc743d97$var$base64End;
|
|
nb = 3;
|
|
break;
|
|
default:
|
|
this.write = $6447679fcc743d97$var$simpleWrite;
|
|
this.end = $6447679fcc743d97$var$simpleEnd;
|
|
return;
|
|
}
|
|
this.lastNeed = 0;
|
|
this.lastTotal = 0;
|
|
this.lastChar = $6447679fcc743d97$require$Buffer.allocUnsafe(nb);
|
|
}
|
|
$6447679fcc743d97$var$StringDecoder.prototype.write = function(buf) {
|
|
if (buf.length === 0) return "";
|
|
var r;
|
|
var i;
|
|
if (this.lastNeed) {
|
|
r = this.fillLast(buf);
|
|
if (r === undefined) return "";
|
|
i = this.lastNeed;
|
|
this.lastNeed = 0;
|
|
} else i = 0;
|
|
if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
|
|
return r || "";
|
|
};
|
|
$6447679fcc743d97$var$StringDecoder.prototype.end = $6447679fcc743d97$var$utf8End;
|
|
// Returns only complete characters in a Buffer
|
|
$6447679fcc743d97$var$StringDecoder.prototype.text = $6447679fcc743d97$var$utf8Text;
|
|
// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer
|
|
$6447679fcc743d97$var$StringDecoder.prototype.fillLast = function(buf) {
|
|
if (this.lastNeed <= buf.length) {
|
|
buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
|
|
return this.lastChar.toString(this.encoding, 0, this.lastTotal);
|
|
}
|
|
buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
|
|
this.lastNeed -= buf.length;
|
|
};
|
|
// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a
|
|
// continuation byte. If an invalid byte is detected, -2 is returned.
|
|
function $6447679fcc743d97$var$utf8CheckByte(byte) {
|
|
if (byte <= 0x7F) return 0;
|
|
else if (byte >> 5 === 0x06) return 2;
|
|
else if (byte >> 4 === 0x0E) return 3;
|
|
else if (byte >> 3 === 0x1E) return 4;
|
|
return byte >> 6 === 0x02 ? -1 : -2;
|
|
}
|
|
// Checks at most 3 bytes at the end of a Buffer in order to detect an
|
|
// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)
|
|
// needed to complete the UTF-8 character (if applicable) are returned.
|
|
function $6447679fcc743d97$var$utf8CheckIncomplete(self, buf, i) {
|
|
var j = buf.length - 1;
|
|
if (j < i) return 0;
|
|
var nb = $6447679fcc743d97$var$utf8CheckByte(buf[j]);
|
|
if (nb >= 0) {
|
|
if (nb > 0) self.lastNeed = nb - 1;
|
|
return nb;
|
|
}
|
|
if (--j < i || nb === -2) return 0;
|
|
nb = $6447679fcc743d97$var$utf8CheckByte(buf[j]);
|
|
if (nb >= 0) {
|
|
if (nb > 0) self.lastNeed = nb - 2;
|
|
return nb;
|
|
}
|
|
if (--j < i || nb === -2) return 0;
|
|
nb = $6447679fcc743d97$var$utf8CheckByte(buf[j]);
|
|
if (nb >= 0) {
|
|
if (nb > 0) {
|
|
if (nb === 2) nb = 0;
|
|
else self.lastNeed = nb - 3;
|
|
}
|
|
return nb;
|
|
}
|
|
return 0;
|
|
}
|
|
// Validates as many continuation bytes for a multi-byte UTF-8 character as
|
|
// needed or are available. If we see a non-continuation byte where we expect
|
|
// one, we "replace" the validated continuation bytes we've seen so far with
|
|
// a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding
|
|
// behavior. The continuation byte check is included three times in the case
|
|
// where all of the continuation bytes for a character exist in the same buffer.
|
|
// It is also done this way as a slight performance increase instead of using a
|
|
// loop.
|
|
function $6447679fcc743d97$var$utf8CheckExtraBytes(self, buf, p) {
|
|
if ((buf[0] & 0xC0) !== 0x80) {
|
|
self.lastNeed = 0;
|
|
return "\uFFFD";
|
|
}
|
|
if (self.lastNeed > 1 && buf.length > 1) {
|
|
if ((buf[1] & 0xC0) !== 0x80) {
|
|
self.lastNeed = 1;
|
|
return "\uFFFD";
|
|
}
|
|
if (self.lastNeed > 2 && buf.length > 2) {
|
|
if ((buf[2] & 0xC0) !== 0x80) {
|
|
self.lastNeed = 2;
|
|
return "\uFFFD";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.
|
|
function $6447679fcc743d97$var$utf8FillLast(buf) {
|
|
var p = this.lastTotal - this.lastNeed;
|
|
var r = $6447679fcc743d97$var$utf8CheckExtraBytes(this, buf, p);
|
|
if (r !== undefined) return r;
|
|
if (this.lastNeed <= buf.length) {
|
|
buf.copy(this.lastChar, p, 0, this.lastNeed);
|
|
return this.lastChar.toString(this.encoding, 0, this.lastTotal);
|
|
}
|
|
buf.copy(this.lastChar, p, 0, buf.length);
|
|
this.lastNeed -= buf.length;
|
|
}
|
|
// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a
|
|
// partial character, the character's bytes are buffered until the required
|
|
// number of bytes are available.
|
|
function $6447679fcc743d97$var$utf8Text(buf, i) {
|
|
var total = $6447679fcc743d97$var$utf8CheckIncomplete(this, buf, i);
|
|
if (!this.lastNeed) return buf.toString("utf8", i);
|
|
this.lastTotal = total;
|
|
var end = buf.length - (total - this.lastNeed);
|
|
buf.copy(this.lastChar, 0, end);
|
|
return buf.toString("utf8", i, end);
|
|
}
|
|
// For UTF-8, a replacement character is added when ending on a partial
|
|
// character.
|
|
function $6447679fcc743d97$var$utf8End(buf) {
|
|
var r = buf && buf.length ? this.write(buf) : "";
|
|
if (this.lastNeed) return r + "\uFFFD";
|
|
return r;
|
|
}
|
|
// UTF-16LE typically needs two bytes per character, but even if we have an even
|
|
// number of bytes available, we need to check if we end on a leading/high
|
|
// surrogate. In that case, we need to wait for the next two bytes in order to
|
|
// decode the last character properly.
|
|
function $6447679fcc743d97$var$utf16Text(buf, i) {
|
|
if ((buf.length - i) % 2 === 0) {
|
|
var r = buf.toString("utf16le", i);
|
|
if (r) {
|
|
var c = r.charCodeAt(r.length - 1);
|
|
if (c >= 0xD800 && c <= 0xDBFF) {
|
|
this.lastNeed = 2;
|
|
this.lastTotal = 4;
|
|
this.lastChar[0] = buf[buf.length - 2];
|
|
this.lastChar[1] = buf[buf.length - 1];
|
|
return r.slice(0, -1);
|
|
}
|
|
}
|
|
return r;
|
|
}
|
|
this.lastNeed = 1;
|
|
this.lastTotal = 2;
|
|
this.lastChar[0] = buf[buf.length - 1];
|
|
return buf.toString("utf16le", i, buf.length - 1);
|
|
}
|
|
// For UTF-16LE we do not explicitly append special replacement characters if we
|
|
// end on a partial character, we simply let v8 handle that.
|
|
function $6447679fcc743d97$var$utf16End(buf) {
|
|
var r = buf && buf.length ? this.write(buf) : "";
|
|
if (this.lastNeed) {
|
|
var end = this.lastTotal - this.lastNeed;
|
|
return r + this.lastChar.toString("utf16le", 0, end);
|
|
}
|
|
return r;
|
|
}
|
|
function $6447679fcc743d97$var$base64Text(buf, i) {
|
|
var n = (buf.length - i) % 3;
|
|
if (n === 0) return buf.toString("base64", i);
|
|
this.lastNeed = 3 - n;
|
|
this.lastTotal = 3;
|
|
if (n === 1) this.lastChar[0] = buf[buf.length - 1];
|
|
else {
|
|
this.lastChar[0] = buf[buf.length - 2];
|
|
this.lastChar[1] = buf[buf.length - 1];
|
|
}
|
|
return buf.toString("base64", i, buf.length - n);
|
|
}
|
|
function $6447679fcc743d97$var$base64End(buf) {
|
|
var r = buf && buf.length ? this.write(buf) : "";
|
|
if (this.lastNeed) return r + this.lastChar.toString("base64", 0, 3 - this.lastNeed);
|
|
return r;
|
|
}
|
|
// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)
|
|
function $6447679fcc743d97$var$simpleWrite(buf) {
|
|
return buf.toString(this.encoding);
|
|
}
|
|
function $6447679fcc743d97$var$simpleEnd(buf) {
|
|
return buf && buf.length ? this.write(buf) : "";
|
|
}
|
|
|
|
});
|
|
parcelRegister("e1ZLE", function(module, exports) {
|
|
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */ /* eslint-disable node/no-deprecated-api */
|
|
var $a371126c0da1e951$var$Buffer = $aniHR$buffer.Buffer;
|
|
// alternative to using Object.keys for old browsers
|
|
function $a371126c0da1e951$var$copyProps(src, dst) {
|
|
for(var key in src)dst[key] = src[key];
|
|
}
|
|
if ($a371126c0da1e951$var$Buffer.from && $a371126c0da1e951$var$Buffer.alloc && $a371126c0da1e951$var$Buffer.allocUnsafe && $a371126c0da1e951$var$Buffer.allocUnsafeSlow) module.exports = $aniHR$buffer;
|
|
else {
|
|
// Copy properties from require('buffer')
|
|
$a371126c0da1e951$var$copyProps($aniHR$buffer, module.exports);
|
|
module.exports.Buffer = $a371126c0da1e951$var$SafeBuffer;
|
|
}
|
|
function $a371126c0da1e951$var$SafeBuffer(arg, encodingOrOffset, length) {
|
|
return $a371126c0da1e951$var$Buffer(arg, encodingOrOffset, length);
|
|
}
|
|
$a371126c0da1e951$var$SafeBuffer.prototype = Object.create($a371126c0da1e951$var$Buffer.prototype);
|
|
// Copy static methods from Buffer
|
|
$a371126c0da1e951$var$copyProps($a371126c0da1e951$var$Buffer, $a371126c0da1e951$var$SafeBuffer);
|
|
$a371126c0da1e951$var$SafeBuffer.from = function(arg, encodingOrOffset, length) {
|
|
if (typeof arg === "number") throw new TypeError("Argument must not be a number");
|
|
return $a371126c0da1e951$var$Buffer(arg, encodingOrOffset, length);
|
|
};
|
|
$a371126c0da1e951$var$SafeBuffer.alloc = function(size, fill, encoding) {
|
|
if (typeof size !== "number") throw new TypeError("Argument must be a number");
|
|
var buf = $a371126c0da1e951$var$Buffer(size);
|
|
if (fill !== undefined) {
|
|
if (typeof encoding === "string") buf.fill(fill, encoding);
|
|
else buf.fill(fill);
|
|
} else buf.fill(0);
|
|
return buf;
|
|
};
|
|
$a371126c0da1e951$var$SafeBuffer.allocUnsafe = function(size) {
|
|
if (typeof size !== "number") throw new TypeError("Argument must be a number");
|
|
return $a371126c0da1e951$var$Buffer(size);
|
|
};
|
|
$a371126c0da1e951$var$SafeBuffer.allocUnsafeSlow = function(size) {
|
|
if (typeof size !== "number") throw new TypeError("Argument must be a number");
|
|
return $aniHR$buffer.SlowBuffer(size);
|
|
};
|
|
|
|
});
|
|
|
|
|
|
parcelRegister("gbsST", function(module, exports) {
|
|
"use strict";
|
|
var $bc841440619affdb$var$_Object$setPrototypeO;
|
|
function $bc841440619affdb$var$_defineProperty(obj, key, value) {
|
|
key = $bc841440619affdb$var$_toPropertyKey(key);
|
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
value: value,
|
|
enumerable: true,
|
|
configurable: true,
|
|
writable: true
|
|
});
|
|
else obj[key] = value;
|
|
return obj;
|
|
}
|
|
function $bc841440619affdb$var$_toPropertyKey(arg) {
|
|
var key = $bc841440619affdb$var$_toPrimitive(arg, "string");
|
|
return typeof key === "symbol" ? key : String(key);
|
|
}
|
|
function $bc841440619affdb$var$_toPrimitive(input, hint) {
|
|
if (typeof input !== "object" || input === null) return input;
|
|
var prim = input[Symbol.toPrimitive];
|
|
if (prim !== undefined) {
|
|
var res = prim.call(input, hint || "default");
|
|
if (typeof res !== "object") return res;
|
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
}
|
|
return (hint === "string" ? String : Number)(input);
|
|
}
|
|
|
|
var $bli3A = parcelRequire("bli3A");
|
|
var $bc841440619affdb$var$kLastResolve = Symbol("lastResolve");
|
|
var $bc841440619affdb$var$kLastReject = Symbol("lastReject");
|
|
var $bc841440619affdb$var$kError = Symbol("error");
|
|
var $bc841440619affdb$var$kEnded = Symbol("ended");
|
|
var $bc841440619affdb$var$kLastPromise = Symbol("lastPromise");
|
|
var $bc841440619affdb$var$kHandlePromise = Symbol("handlePromise");
|
|
var $bc841440619affdb$var$kStream = Symbol("stream");
|
|
function $bc841440619affdb$var$createIterResult(value, done) {
|
|
return {
|
|
value: value,
|
|
done: done
|
|
};
|
|
}
|
|
function $bc841440619affdb$var$readAndResolve(iter) {
|
|
var resolve = iter[$bc841440619affdb$var$kLastResolve];
|
|
if (resolve !== null) {
|
|
var data = iter[$bc841440619affdb$var$kStream].read();
|
|
// we defer if data is null
|
|
// we can be expecting either 'end' or
|
|
// 'error'
|
|
if (data !== null) {
|
|
iter[$bc841440619affdb$var$kLastPromise] = null;
|
|
iter[$bc841440619affdb$var$kLastResolve] = null;
|
|
iter[$bc841440619affdb$var$kLastReject] = null;
|
|
resolve($bc841440619affdb$var$createIterResult(data, false));
|
|
}
|
|
}
|
|
}
|
|
function $bc841440619affdb$var$onReadable(iter) {
|
|
// we wait for the next tick, because it might
|
|
// emit an error with process.nextTick
|
|
process.nextTick($bc841440619affdb$var$readAndResolve, iter);
|
|
}
|
|
function $bc841440619affdb$var$wrapForNext(lastPromise, iter) {
|
|
return function(resolve, reject) {
|
|
lastPromise.then(function() {
|
|
if (iter[$bc841440619affdb$var$kEnded]) {
|
|
resolve($bc841440619affdb$var$createIterResult(undefined, true));
|
|
return;
|
|
}
|
|
iter[$bc841440619affdb$var$kHandlePromise](resolve, reject);
|
|
}, reject);
|
|
};
|
|
}
|
|
var $bc841440619affdb$var$AsyncIteratorPrototype = Object.getPrototypeOf(function() {});
|
|
var $bc841440619affdb$var$ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf(($bc841440619affdb$var$_Object$setPrototypeO = {
|
|
get stream () {
|
|
return this[$bc841440619affdb$var$kStream];
|
|
},
|
|
next: function next() {
|
|
var _this = this;
|
|
// if we have detected an error in the meanwhile
|
|
// reject straight away
|
|
var error = this[$bc841440619affdb$var$kError];
|
|
if (error !== null) return Promise.reject(error);
|
|
if (this[$bc841440619affdb$var$kEnded]) return Promise.resolve($bc841440619affdb$var$createIterResult(undefined, true));
|
|
if (this[$bc841440619affdb$var$kStream].destroyed) // We need to defer via nextTick because if .destroy(err) is
|
|
// called, the error will be emitted via nextTick, and
|
|
// we cannot guarantee that there is no error lingering around
|
|
// waiting to be emitted.
|
|
return new Promise(function(resolve, reject) {
|
|
process.nextTick(function() {
|
|
if (_this[$bc841440619affdb$var$kError]) reject(_this[$bc841440619affdb$var$kError]);
|
|
else resolve($bc841440619affdb$var$createIterResult(undefined, true));
|
|
});
|
|
});
|
|
// if we have multiple next() calls
|
|
// we will wait for the previous Promise to finish
|
|
// this logic is optimized to support for await loops,
|
|
// where next() is only called once at a time
|
|
var lastPromise = this[$bc841440619affdb$var$kLastPromise];
|
|
var promise;
|
|
if (lastPromise) promise = new Promise($bc841440619affdb$var$wrapForNext(lastPromise, this));
|
|
else {
|
|
// fast path needed to support multiple this.push()
|
|
// without triggering the next() queue
|
|
var data = this[$bc841440619affdb$var$kStream].read();
|
|
if (data !== null) return Promise.resolve($bc841440619affdb$var$createIterResult(data, false));
|
|
promise = new Promise(this[$bc841440619affdb$var$kHandlePromise]);
|
|
}
|
|
this[$bc841440619affdb$var$kLastPromise] = promise;
|
|
return promise;
|
|
}
|
|
}, $bc841440619affdb$var$_defineProperty($bc841440619affdb$var$_Object$setPrototypeO, Symbol.asyncIterator, function() {
|
|
return this;
|
|
}), $bc841440619affdb$var$_defineProperty($bc841440619affdb$var$_Object$setPrototypeO, "return", function _return() {
|
|
var _this2 = this;
|
|
// destroy(err, cb) is a private API
|
|
// we can guarantee we have that here, because we control the
|
|
// Readable class this is attached to
|
|
return new Promise(function(resolve, reject) {
|
|
_this2[$bc841440619affdb$var$kStream].destroy(null, function(err) {
|
|
if (err) {
|
|
reject(err);
|
|
return;
|
|
}
|
|
resolve($bc841440619affdb$var$createIterResult(undefined, true));
|
|
});
|
|
});
|
|
}), $bc841440619affdb$var$_Object$setPrototypeO), $bc841440619affdb$var$AsyncIteratorPrototype);
|
|
var $bc841440619affdb$var$createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) {
|
|
var _Object$create;
|
|
var iterator = Object.create($bc841440619affdb$var$ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, $bc841440619affdb$var$_defineProperty(_Object$create, $bc841440619affdb$var$kStream, {
|
|
value: stream,
|
|
writable: true
|
|
}), $bc841440619affdb$var$_defineProperty(_Object$create, $bc841440619affdb$var$kLastResolve, {
|
|
value: null,
|
|
writable: true
|
|
}), $bc841440619affdb$var$_defineProperty(_Object$create, $bc841440619affdb$var$kLastReject, {
|
|
value: null,
|
|
writable: true
|
|
}), $bc841440619affdb$var$_defineProperty(_Object$create, $bc841440619affdb$var$kError, {
|
|
value: null,
|
|
writable: true
|
|
}), $bc841440619affdb$var$_defineProperty(_Object$create, $bc841440619affdb$var$kEnded, {
|
|
value: stream._readableState.endEmitted,
|
|
writable: true
|
|
}), $bc841440619affdb$var$_defineProperty(_Object$create, $bc841440619affdb$var$kHandlePromise, {
|
|
value: function value(resolve, reject) {
|
|
var data = iterator[$bc841440619affdb$var$kStream].read();
|
|
if (data) {
|
|
iterator[$bc841440619affdb$var$kLastPromise] = null;
|
|
iterator[$bc841440619affdb$var$kLastResolve] = null;
|
|
iterator[$bc841440619affdb$var$kLastReject] = null;
|
|
resolve($bc841440619affdb$var$createIterResult(data, false));
|
|
} else {
|
|
iterator[$bc841440619affdb$var$kLastResolve] = resolve;
|
|
iterator[$bc841440619affdb$var$kLastReject] = reject;
|
|
}
|
|
},
|
|
writable: true
|
|
}), _Object$create));
|
|
iterator[$bc841440619affdb$var$kLastPromise] = null;
|
|
$bli3A(stream, function(err) {
|
|
if (err && err.code !== "ERR_STREAM_PREMATURE_CLOSE") {
|
|
var reject = iterator[$bc841440619affdb$var$kLastReject];
|
|
// reject if we are waiting for data in the Promise
|
|
// returned by next() and store the error
|
|
if (reject !== null) {
|
|
iterator[$bc841440619affdb$var$kLastPromise] = null;
|
|
iterator[$bc841440619affdb$var$kLastResolve] = null;
|
|
iterator[$bc841440619affdb$var$kLastReject] = null;
|
|
reject(err);
|
|
}
|
|
iterator[$bc841440619affdb$var$kError] = err;
|
|
return;
|
|
}
|
|
var resolve = iterator[$bc841440619affdb$var$kLastResolve];
|
|
if (resolve !== null) {
|
|
iterator[$bc841440619affdb$var$kLastPromise] = null;
|
|
iterator[$bc841440619affdb$var$kLastResolve] = null;
|
|
iterator[$bc841440619affdb$var$kLastReject] = null;
|
|
resolve($bc841440619affdb$var$createIterResult(undefined, true));
|
|
}
|
|
iterator[$bc841440619affdb$var$kEnded] = true;
|
|
});
|
|
stream.on("readable", $bc841440619affdb$var$onReadable.bind(null, iterator));
|
|
return iterator;
|
|
};
|
|
module.exports = $bc841440619affdb$var$createReadableStreamAsyncIterator;
|
|
|
|
});
|
|
parcelRegister("bli3A", function(module, exports) {
|
|
// Ported from https://github.com/mafintosh/end-of-stream with
|
|
// permission from the author, Mathias Buus (@mafintosh).
|
|
"use strict";
|
|
|
|
var $841fa9988193c82b$var$ERR_STREAM_PREMATURE_CLOSE = (parcelRequire("eP0c0")).codes.ERR_STREAM_PREMATURE_CLOSE;
|
|
function $841fa9988193c82b$var$once(callback) {
|
|
var called = false;
|
|
return function() {
|
|
if (called) return;
|
|
called = true;
|
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key];
|
|
callback.apply(this, args);
|
|
};
|
|
}
|
|
function $841fa9988193c82b$var$noop() {}
|
|
function $841fa9988193c82b$var$isRequest(stream) {
|
|
return stream.setHeader && typeof stream.abort === "function";
|
|
}
|
|
function $841fa9988193c82b$var$eos(stream, opts, callback) {
|
|
if (typeof opts === "function") return $841fa9988193c82b$var$eos(stream, null, opts);
|
|
if (!opts) opts = {};
|
|
callback = $841fa9988193c82b$var$once(callback || $841fa9988193c82b$var$noop);
|
|
var readable = opts.readable || opts.readable !== false && stream.readable;
|
|
var writable = opts.writable || opts.writable !== false && stream.writable;
|
|
var onlegacyfinish = function onlegacyfinish() {
|
|
if (!stream.writable) onfinish();
|
|
};
|
|
var writableEnded = stream._writableState && stream._writableState.finished;
|
|
var onfinish = function onfinish() {
|
|
writable = false;
|
|
writableEnded = true;
|
|
if (!readable) callback.call(stream);
|
|
};
|
|
var readableEnded = stream._readableState && stream._readableState.endEmitted;
|
|
var onend = function onend() {
|
|
readable = false;
|
|
readableEnded = true;
|
|
if (!writable) callback.call(stream);
|
|
};
|
|
var onerror = function onerror(err) {
|
|
callback.call(stream, err);
|
|
};
|
|
var onclose = function onclose() {
|
|
var err;
|
|
if (readable && !readableEnded) {
|
|
if (!stream._readableState || !stream._readableState.ended) err = new $841fa9988193c82b$var$ERR_STREAM_PREMATURE_CLOSE();
|
|
return callback.call(stream, err);
|
|
}
|
|
if (writable && !writableEnded) {
|
|
if (!stream._writableState || !stream._writableState.ended) err = new $841fa9988193c82b$var$ERR_STREAM_PREMATURE_CLOSE();
|
|
return callback.call(stream, err);
|
|
}
|
|
};
|
|
var onrequest = function onrequest() {
|
|
stream.req.on("finish", onfinish);
|
|
};
|
|
if ($841fa9988193c82b$var$isRequest(stream)) {
|
|
stream.on("complete", onfinish);
|
|
stream.on("abort", onclose);
|
|
if (stream.req) onrequest();
|
|
else stream.on("request", onrequest);
|
|
} else if (writable && !stream._writableState) {
|
|
// legacy streams
|
|
stream.on("end", onlegacyfinish);
|
|
stream.on("close", onlegacyfinish);
|
|
}
|
|
stream.on("end", onend);
|
|
stream.on("finish", onfinish);
|
|
if (opts.error !== false) stream.on("error", onerror);
|
|
stream.on("close", onclose);
|
|
return function() {
|
|
stream.removeListener("complete", onfinish);
|
|
stream.removeListener("abort", onclose);
|
|
stream.removeListener("request", onrequest);
|
|
if (stream.req) stream.req.removeListener("finish", onfinish);
|
|
stream.removeListener("end", onlegacyfinish);
|
|
stream.removeListener("close", onlegacyfinish);
|
|
stream.removeListener("finish", onfinish);
|
|
stream.removeListener("end", onend);
|
|
stream.removeListener("error", onerror);
|
|
stream.removeListener("close", onclose);
|
|
};
|
|
}
|
|
module.exports = $841fa9988193c82b$var$eos;
|
|
|
|
});
|
|
|
|
|
|
parcelRegister("53TPx", function(module, exports) {
|
|
"use strict";
|
|
function $3af88a499b16e20f$var$asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
try {
|
|
var info = gen[key](arg);
|
|
var value = info.value;
|
|
} catch (error) {
|
|
reject(error);
|
|
return;
|
|
}
|
|
if (info.done) resolve(value);
|
|
else Promise.resolve(value).then(_next, _throw);
|
|
}
|
|
function $3af88a499b16e20f$var$_asyncToGenerator(fn) {
|
|
return function() {
|
|
var self = this, args = arguments;
|
|
return new Promise(function(resolve, reject) {
|
|
var gen = fn.apply(self, args);
|
|
function _next(value) {
|
|
$3af88a499b16e20f$var$asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
}
|
|
function _throw(err) {
|
|
$3af88a499b16e20f$var$asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
}
|
|
_next(undefined);
|
|
});
|
|
};
|
|
}
|
|
function $3af88a499b16e20f$var$ownKeys(object, enumerableOnly) {
|
|
var keys = Object.keys(object);
|
|
if (Object.getOwnPropertySymbols) {
|
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
})), keys.push.apply(keys, symbols);
|
|
}
|
|
return keys;
|
|
}
|
|
function $3af88a499b16e20f$var$_objectSpread(target) {
|
|
for(var i = 1; i < arguments.length; i++){
|
|
var source = null != arguments[i] ? arguments[i] : {};
|
|
i % 2 ? $3af88a499b16e20f$var$ownKeys(Object(source), !0).forEach(function(key) {
|
|
$3af88a499b16e20f$var$_defineProperty(target, key, source[key]);
|
|
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : $3af88a499b16e20f$var$ownKeys(Object(source)).forEach(function(key) {
|
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
});
|
|
}
|
|
return target;
|
|
}
|
|
function $3af88a499b16e20f$var$_defineProperty(obj, key, value) {
|
|
key = $3af88a499b16e20f$var$_toPropertyKey(key);
|
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
value: value,
|
|
enumerable: true,
|
|
configurable: true,
|
|
writable: true
|
|
});
|
|
else obj[key] = value;
|
|
return obj;
|
|
}
|
|
function $3af88a499b16e20f$var$_toPropertyKey(arg) {
|
|
var key = $3af88a499b16e20f$var$_toPrimitive(arg, "string");
|
|
return typeof key === "symbol" ? key : String(key);
|
|
}
|
|
function $3af88a499b16e20f$var$_toPrimitive(input, hint) {
|
|
if (typeof input !== "object" || input === null) return input;
|
|
var prim = input[Symbol.toPrimitive];
|
|
if (prim !== undefined) {
|
|
var res = prim.call(input, hint || "default");
|
|
if (typeof res !== "object") return res;
|
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
}
|
|
return (hint === "string" ? String : Number)(input);
|
|
}
|
|
|
|
var $3af88a499b16e20f$var$ERR_INVALID_ARG_TYPE = (parcelRequire("eP0c0")).codes.ERR_INVALID_ARG_TYPE;
|
|
function $3af88a499b16e20f$var$from(Readable, iterable, opts) {
|
|
var iterator;
|
|
if (iterable && typeof iterable.next === "function") iterator = iterable;
|
|
else if (iterable && iterable[Symbol.asyncIterator]) iterator = iterable[Symbol.asyncIterator]();
|
|
else if (iterable && iterable[Symbol.iterator]) iterator = iterable[Symbol.iterator]();
|
|
else throw new $3af88a499b16e20f$var$ERR_INVALID_ARG_TYPE("iterable", [
|
|
"Iterable"
|
|
], iterable);
|
|
var readable = new Readable($3af88a499b16e20f$var$_objectSpread({
|
|
objectMode: true
|
|
}, opts));
|
|
// Reading boolean to protect against _read
|
|
// being called before last iteration completion.
|
|
var reading = false;
|
|
readable._read = function() {
|
|
if (!reading) {
|
|
reading = true;
|
|
next();
|
|
}
|
|
};
|
|
function next() {
|
|
return _next2.apply(this, arguments);
|
|
}
|
|
function _next2() {
|
|
_next2 = $3af88a499b16e20f$var$_asyncToGenerator(function*() {
|
|
try {
|
|
var _yield$iterator$next = yield iterator.next(), value = _yield$iterator$next.value, done = _yield$iterator$next.done;
|
|
if (done) readable.push(null);
|
|
else if (readable.push((yield value))) next();
|
|
else reading = false;
|
|
} catch (err) {
|
|
readable.destroy(err);
|
|
}
|
|
});
|
|
return _next2.apply(this, arguments);
|
|
}
|
|
return readable;
|
|
}
|
|
module.exports = $3af88a499b16e20f$var$from;
|
|
|
|
});
|
|
|
|
|
|
parcelRegister("8WmTM", function(module, exports) {
|
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
//
|
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
// copy of this software and associated documentation files (the
|
|
// "Software"), to deal in the Software without restriction, including
|
|
// without limitation the rights to use, copy, modify, merge, publish,
|
|
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
// persons to whom the Software is furnished to do so, subject to the
|
|
// following conditions:
|
|
//
|
|
// The above copyright notice and this permission notice shall be included
|
|
// in all copies or substantial portions of the Software.
|
|
//
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
// a transform stream is a readable/writable stream where you do
|
|
// something with the data. Sometimes it's called a "filter",
|
|
// but that's not a great name for it, since that implies a thing where
|
|
// some bits pass through, and others are simply ignored. (That would
|
|
// be a valid example of a transform, of course.)
|
|
//
|
|
// While the output is causally related to the input, it's not a
|
|
// necessarily symmetric or synchronous transformation. For example,
|
|
// a zlib stream might take multiple plain-text writes(), and then
|
|
// emit a single compressed chunk some time in the future.
|
|
//
|
|
// Here's how this works:
|
|
//
|
|
// The Transform stream has all the aspects of the readable and writable
|
|
// stream classes. When you write(chunk), that calls _write(chunk,cb)
|
|
// internally, and returns false if there's a lot of pending writes
|
|
// buffered up. When you call read(), that calls _read(n) until
|
|
// there's enough pending readable data buffered up.
|
|
//
|
|
// In a transform stream, the written data is placed in a buffer. When
|
|
// _read(n) is called, it transforms the queued up data, calling the
|
|
// buffered _write cb's as it consumes chunks. If consuming a single
|
|
// written chunk would result in multiple output chunks, then the first
|
|
// outputted bit calls the readcb, and subsequent chunks just go into
|
|
// the read buffer, and will cause it to emit 'readable' if necessary.
|
|
//
|
|
// This way, back-pressure is actually determined by the reading side,
|
|
// since _read has to be called to start processing a new chunk. However,
|
|
// a pathological inflate type of transform can cause excessive buffering
|
|
// here. For example, imagine a stream where every byte of input is
|
|
// interpreted as an integer from 0-255, and then results in that many
|
|
// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
|
|
// 1kb of data being output. In this case, you could write a very small
|
|
// amount of input, and end up with a very large amount of output. In
|
|
// such a pathological inflating mechanism, there'd be no way to tell
|
|
// the system to stop doing the transform. A single 4MB write could
|
|
// cause the system to run out of memory.
|
|
//
|
|
// However, even in such a pathological case, only a single written chunk
|
|
// would be consumed, and then the rest would wait (un-transformed) until
|
|
// the results of the previous transformed chunk were consumed.
|
|
"use strict";
|
|
module.exports = $682580b9507111ae$var$Transform;
|
|
|
|
var $eP0c0 = parcelRequire("eP0c0");
|
|
var $682580b9507111ae$require$_require$codes = $eP0c0.codes;
|
|
var $682580b9507111ae$var$ERR_METHOD_NOT_IMPLEMENTED = $682580b9507111ae$require$_require$codes.ERR_METHOD_NOT_IMPLEMENTED, $682580b9507111ae$var$ERR_MULTIPLE_CALLBACK = $682580b9507111ae$require$_require$codes.ERR_MULTIPLE_CALLBACK, $682580b9507111ae$var$ERR_TRANSFORM_ALREADY_TRANSFORMING = $682580b9507111ae$require$_require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING, $682580b9507111ae$var$ERR_TRANSFORM_WITH_LENGTH_0 = $682580b9507111ae$require$_require$codes.ERR_TRANSFORM_WITH_LENGTH_0;
|
|
|
|
var $12ctx = parcelRequire("12ctx");
|
|
|
|
(parcelRequire("bCCsL"))($682580b9507111ae$var$Transform, $12ctx);
|
|
function $682580b9507111ae$var$afterTransform(er, data) {
|
|
var ts = this._transformState;
|
|
ts.transforming = false;
|
|
var cb = ts.writecb;
|
|
if (cb === null) return this.emit("error", new $682580b9507111ae$var$ERR_MULTIPLE_CALLBACK());
|
|
ts.writechunk = null;
|
|
ts.writecb = null;
|
|
if (data != null) // single equals check for both `null` and `undefined`
|
|
this.push(data);
|
|
cb(er);
|
|
var rs = this._readableState;
|
|
rs.reading = false;
|
|
if (rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
|
|
}
|
|
function $682580b9507111ae$var$Transform(options) {
|
|
if (!(this instanceof $682580b9507111ae$var$Transform)) return new $682580b9507111ae$var$Transform(options);
|
|
$12ctx.call(this, options);
|
|
this._transformState = {
|
|
afterTransform: $682580b9507111ae$var$afterTransform.bind(this),
|
|
needTransform: false,
|
|
transforming: false,
|
|
writecb: null,
|
|
writechunk: null,
|
|
writeencoding: null
|
|
};
|
|
// start out asking for a readable event once data is transformed.
|
|
this._readableState.needReadable = true;
|
|
// we have implemented the _read method, and done the other things
|
|
// that Readable wants before the first _read call, so unset the
|
|
// sync guard flag.
|
|
this._readableState.sync = false;
|
|
if (options) {
|
|
if (typeof options.transform === "function") this._transform = options.transform;
|
|
if (typeof options.flush === "function") this._flush = options.flush;
|
|
}
|
|
// When the writable side finishes, then flush out anything remaining.
|
|
this.on("prefinish", $682580b9507111ae$var$prefinish);
|
|
}
|
|
function $682580b9507111ae$var$prefinish() {
|
|
var _this = this;
|
|
if (typeof this._flush === "function" && !this._readableState.destroyed) this._flush(function(er, data) {
|
|
$682580b9507111ae$var$done(_this, er, data);
|
|
});
|
|
else $682580b9507111ae$var$done(this, null, null);
|
|
}
|
|
$682580b9507111ae$var$Transform.prototype.push = function(chunk, encoding) {
|
|
this._transformState.needTransform = false;
|
|
return $12ctx.prototype.push.call(this, chunk, encoding);
|
|
};
|
|
// This is the part where you do stuff!
|
|
// override this function in implementation classes.
|
|
// 'chunk' is an input chunk.
|
|
//
|
|
// Call `push(newChunk)` to pass along transformed output
|
|
// to the readable side. You may call 'push' zero or more times.
|
|
//
|
|
// Call `cb(err)` when you are done with this chunk. If you pass
|
|
// an error, then that'll put the hurt on the whole operation. If you
|
|
// never call cb(), then you'll never get another chunk.
|
|
$682580b9507111ae$var$Transform.prototype._transform = function(chunk, encoding, cb) {
|
|
cb(new $682580b9507111ae$var$ERR_METHOD_NOT_IMPLEMENTED("_transform()"));
|
|
};
|
|
$682580b9507111ae$var$Transform.prototype._write = function(chunk, encoding, cb) {
|
|
var ts = this._transformState;
|
|
ts.writecb = cb;
|
|
ts.writechunk = chunk;
|
|
ts.writeencoding = encoding;
|
|
if (!ts.transforming) {
|
|
var rs = this._readableState;
|
|
if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
|
|
}
|
|
};
|
|
// Doesn't matter what the args are here.
|
|
// _transform does all the work.
|
|
// That we got here means that the readable side wants more data.
|
|
$682580b9507111ae$var$Transform.prototype._read = function(n) {
|
|
var ts = this._transformState;
|
|
if (ts.writechunk !== null && !ts.transforming) {
|
|
ts.transforming = true;
|
|
this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
|
|
} else // mark that we need a transform, so that any data that comes in
|
|
// will get processed, now that we've asked for it.
|
|
ts.needTransform = true;
|
|
};
|
|
$682580b9507111ae$var$Transform.prototype._destroy = function(err, cb) {
|
|
$12ctx.prototype._destroy.call(this, err, function(err2) {
|
|
cb(err2);
|
|
});
|
|
};
|
|
function $682580b9507111ae$var$done(stream, er, data) {
|
|
if (er) return stream.emit("error", er);
|
|
if (data != null) // single equals check for both `null` and `undefined`
|
|
stream.push(data);
|
|
// TODO(BridgeAR): Write a test for these two error cases
|
|
// if there's nothing in the write buffer, then that means
|
|
// that nothing more will ever be provided
|
|
if (stream._writableState.length) throw new $682580b9507111ae$var$ERR_TRANSFORM_WITH_LENGTH_0();
|
|
if (stream._transformState.transforming) throw new $682580b9507111ae$var$ERR_TRANSFORM_ALREADY_TRANSFORMING();
|
|
return stream.push(null);
|
|
}
|
|
|
|
});
|
|
|
|
parcelRegister("7dfYu", function(module, exports) {
|
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
//
|
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
// copy of this software and associated documentation files (the
|
|
// "Software"), to deal in the Software without restriction, including
|
|
// without limitation the rights to use, copy, modify, merge, publish,
|
|
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
// persons to whom the Software is furnished to do so, subject to the
|
|
// following conditions:
|
|
//
|
|
// The above copyright notice and this permission notice shall be included
|
|
// in all copies or substantial portions of the Software.
|
|
//
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
// a passthrough stream.
|
|
// basically just the most minimal sort of Transform stream.
|
|
// Every written chunk gets output as-is.
|
|
"use strict";
|
|
module.exports = $015af00e7bfcae83$var$PassThrough;
|
|
|
|
var $8WmTM = parcelRequire("8WmTM");
|
|
|
|
(parcelRequire("bCCsL"))($015af00e7bfcae83$var$PassThrough, $8WmTM);
|
|
function $015af00e7bfcae83$var$PassThrough(options) {
|
|
if (!(this instanceof $015af00e7bfcae83$var$PassThrough)) return new $015af00e7bfcae83$var$PassThrough(options);
|
|
$8WmTM.call(this, options);
|
|
}
|
|
$015af00e7bfcae83$var$PassThrough.prototype._transform = function(chunk, encoding, cb) {
|
|
cb(null, chunk);
|
|
};
|
|
|
|
});
|
|
|
|
parcelRegister("br0Mq", function(module, exports) {
|
|
// Ported from https://github.com/mafintosh/pump with
|
|
// permission from the author, Mathias Buus (@mafintosh).
|
|
"use strict";
|
|
var $8532d236ed9ffa55$var$eos;
|
|
function $8532d236ed9ffa55$var$once(callback) {
|
|
var called = false;
|
|
return function() {
|
|
if (called) return;
|
|
called = true;
|
|
callback.apply(void 0, arguments);
|
|
};
|
|
}
|
|
|
|
var $eP0c0 = parcelRequire("eP0c0");
|
|
var $8532d236ed9ffa55$require$_require$codes = $eP0c0.codes;
|
|
var $8532d236ed9ffa55$var$ERR_MISSING_ARGS = $8532d236ed9ffa55$require$_require$codes.ERR_MISSING_ARGS, $8532d236ed9ffa55$var$ERR_STREAM_DESTROYED = $8532d236ed9ffa55$require$_require$codes.ERR_STREAM_DESTROYED;
|
|
function $8532d236ed9ffa55$var$noop(err) {
|
|
// Rethrow the error if it exists to avoid swallowing it
|
|
if (err) throw err;
|
|
}
|
|
function $8532d236ed9ffa55$var$isRequest(stream) {
|
|
return stream.setHeader && typeof stream.abort === "function";
|
|
}
|
|
|
|
function $8532d236ed9ffa55$var$destroyer(stream, reading, writing, callback) {
|
|
callback = $8532d236ed9ffa55$var$once(callback);
|
|
var closed = false;
|
|
stream.on("close", function() {
|
|
closed = true;
|
|
});
|
|
if ($8532d236ed9ffa55$var$eos === undefined) $8532d236ed9ffa55$var$eos = (parcelRequire("bli3A"));
|
|
$8532d236ed9ffa55$var$eos(stream, {
|
|
readable: reading,
|
|
writable: writing
|
|
}, function(err) {
|
|
if (err) return callback(err);
|
|
closed = true;
|
|
callback();
|
|
});
|
|
var destroyed = false;
|
|
return function(err) {
|
|
if (closed) return;
|
|
if (destroyed) return;
|
|
destroyed = true;
|
|
// request.destroy just do .end - .abort is what we want
|
|
if ($8532d236ed9ffa55$var$isRequest(stream)) return stream.abort();
|
|
if (typeof stream.destroy === "function") return stream.destroy();
|
|
callback(err || new $8532d236ed9ffa55$var$ERR_STREAM_DESTROYED("pipe"));
|
|
};
|
|
}
|
|
function $8532d236ed9ffa55$var$call(fn) {
|
|
fn();
|
|
}
|
|
function $8532d236ed9ffa55$var$pipe(from, to) {
|
|
return from.pipe(to);
|
|
}
|
|
function $8532d236ed9ffa55$var$popCallback(streams) {
|
|
if (!streams.length) return $8532d236ed9ffa55$var$noop;
|
|
if (typeof streams[streams.length - 1] !== "function") return $8532d236ed9ffa55$var$noop;
|
|
return streams.pop();
|
|
}
|
|
function $8532d236ed9ffa55$var$pipeline() {
|
|
for(var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++)streams[_key] = arguments[_key];
|
|
var callback = $8532d236ed9ffa55$var$popCallback(streams);
|
|
if (Array.isArray(streams[0])) streams = streams[0];
|
|
if (streams.length < 2) throw new $8532d236ed9ffa55$var$ERR_MISSING_ARGS("streams");
|
|
var error;
|
|
var destroys = streams.map(function(stream, i) {
|
|
var reading = i < streams.length - 1;
|
|
var writing = i > 0;
|
|
return $8532d236ed9ffa55$var$destroyer(stream, reading, writing, function(err) {
|
|
if (!error) error = err;
|
|
if (err) destroys.forEach($8532d236ed9ffa55$var$call);
|
|
if (reading) return;
|
|
destroys.forEach($8532d236ed9ffa55$var$call);
|
|
callback(error);
|
|
});
|
|
});
|
|
return streams.reduce($8532d236ed9ffa55$var$pipe);
|
|
}
|
|
module.exports = $8532d236ed9ffa55$var$pipeline;
|
|
|
|
});
|
|
|
|
|
|
parcelRegister("2Tg8r", function(module, exports) {
|
|
|
|
$parcel$export(module.exports, "NodePackageManager", () => NodePackageManager, (v) => NodePackageManager = v);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var $dBBzS = parcelRequire("dBBzS");
|
|
|
|
|
|
var $a5njb = parcelRequire("a5njb");
|
|
|
|
var $7o0cY = parcelRequire("7o0cY");
|
|
|
|
var $hgTxA = parcelRequire("hgTxA");
|
|
|
|
|
|
|
|
// Package.json fields. Must match package_json.rs.
|
|
const MAIN = 1;
|
|
const SOURCE = 4;
|
|
const ENTRIES = MAIN | ((0, process.env.PARCEL_SELF_BUILD) ? SOURCE : 0);
|
|
const NODE_MODULES = `${(0, ($parcel$interopDefault($aniHR$path))).sep}node_modules${(0, ($parcel$interopDefault($aniHR$path))).sep}`;
|
|
// There can be more than one instance of NodePackageManager, but node has only a single module cache.
|
|
// Therefore, the resolution cache and the map of parent to child modules should also be global.
|
|
const cache = new Map();
|
|
const children = new Map();
|
|
const invalidationsCache = new Map();
|
|
class NodePackageManager {
|
|
constructor(fs, projectRoot, installer){
|
|
this.fs = fs;
|
|
this.projectRoot = projectRoot;
|
|
this.installer = installer;
|
|
// $FlowFixMe - no type for _extensions
|
|
this.currentExtensions = Object.keys((0, ($parcel$interopDefault($aniHR$module)))._extensions).map((e)=>e.substring(1));
|
|
}
|
|
_createResolver() {
|
|
return new (0, $aniHR$parcelnoderesolvercore.ResolverBase)(this.projectRoot, {
|
|
fs: this.fs instanceof (0, $aniHR$parcelfs.NodeFS) && process.versions.pnp == null ? undefined : {
|
|
canonicalize: (path)=>this.fs.realpathSync(path),
|
|
read: (path)=>this.fs.readFileSync(path),
|
|
isFile: (path)=>this.fs.statSync(path).isFile(),
|
|
isDir: (path)=>this.fs.statSync(path).isDirectory()
|
|
},
|
|
mode: 2,
|
|
entries: ENTRIES,
|
|
packageExports: true,
|
|
moduleDirResolver: process.versions.pnp != null ? (module1, from)=>{
|
|
// $FlowFixMe[prop-missing]
|
|
let pnp = (0, ($parcel$interopDefault($aniHR$module))).findPnpApi((0, ($parcel$interopDefault($aniHR$path))).dirname(from));
|
|
return pnp.resolveToUnqualified(// append slash to force loading builtins from npm
|
|
module1 + "/", from);
|
|
} : undefined,
|
|
extensions: this.currentExtensions,
|
|
typescript: true
|
|
});
|
|
}
|
|
static deserialize(opts) {
|
|
return new NodePackageManager(opts.fs, opts.projectRoot, opts.installer);
|
|
}
|
|
serialize() {
|
|
return {
|
|
$$raw: false,
|
|
fs: this.fs,
|
|
projectRoot: this.projectRoot,
|
|
installer: this.installer
|
|
};
|
|
}
|
|
async require(name, from, opts) {
|
|
let { resolved, type } = await this.resolve(name, from, opts);
|
|
if (type === 2) {
|
|
(0, ($parcel$interopDefault($aniHR$parcellogger))).warn({
|
|
message: "ES module dependencies are experimental.",
|
|
origin: "@parcel/package-manager",
|
|
codeFrames: [
|
|
{
|
|
filePath: resolved,
|
|
codeHighlights: []
|
|
}
|
|
]
|
|
});
|
|
// On Windows, Node requires absolute paths to be file URLs.
|
|
if (process.platform === "win32" && (0, ($parcel$interopDefault($aniHR$path))).isAbsolute(resolved)) resolved = (0, $aniHR$url.pathToFileURL)(resolved);
|
|
// $FlowFixMe
|
|
return import(resolved);
|
|
}
|
|
return this.load(resolved, from);
|
|
}
|
|
requireSync(name, from) {
|
|
let { resolved } = this.resolveSync(name, from);
|
|
return this.load(resolved, from);
|
|
}
|
|
load(filePath, from) {
|
|
if (!(0, ($parcel$interopDefault($aniHR$path))).isAbsolute(filePath)) // Node builtin module
|
|
// $FlowFixMe
|
|
return require(filePath);
|
|
// $FlowFixMe[prop-missing]
|
|
const cachedModule = (0, ($parcel$interopDefault($aniHR$module)))._cache[filePath];
|
|
if (cachedModule !== undefined) return cachedModule.exports;
|
|
// $FlowFixMe
|
|
let m = new (0, ($parcel$interopDefault($aniHR$module)))(filePath, (0, ($parcel$interopDefault($aniHR$module)))._cache[from] || module.parent);
|
|
// $FlowFixMe _extensions not in type
|
|
const extensions = Object.keys((0, ($parcel$interopDefault($aniHR$module)))._extensions);
|
|
// This handles supported extensions changing due to, for example, esbuild/register being used
|
|
// We assume that the extension list will change in size - as these tools usually add support for
|
|
// additional extensions.
|
|
if (extensions.length !== this.currentExtensions.length) {
|
|
this.currentExtensions = extensions.map((e)=>e.substring(1));
|
|
this.resolver = this._createResolver();
|
|
}
|
|
// $FlowFixMe[prop-missing]
|
|
(0, ($parcel$interopDefault($aniHR$module)))._cache[filePath] = m;
|
|
// Patch require within this module so it goes through our require
|
|
m.require = (id)=>{
|
|
return this.requireSync(id, filePath);
|
|
};
|
|
// Patch `fs.readFileSync` temporarily so that it goes through our file system
|
|
let { readFileSync, statSync } = (0, ($parcel$interopDefault($aniHR$fs)));
|
|
// $FlowFixMe
|
|
(0, ($parcel$interopDefault($aniHR$fs))).readFileSync = (filename, encoding)=>{
|
|
return this.fs.readFileSync(filename, encoding);
|
|
};
|
|
// $FlowFixMe
|
|
(0, ($parcel$interopDefault($aniHR$fs))).statSync = (filename)=>{
|
|
return this.fs.statSync(filename);
|
|
};
|
|
if (!filePath.includes(NODE_MODULES)) {
|
|
let extname = (0, ($parcel$interopDefault($aniHR$path))).extname(filePath);
|
|
if ((extname === ".ts" || extname === ".tsx") && // $FlowFixMe
|
|
!(0, ($parcel$interopDefault($aniHR$module)))._extensions[extname]) {
|
|
let compile = m._compile;
|
|
m._compile = (code, filename)=>{
|
|
let out = (0, $aniHR$swccore.transformSync)(code, {
|
|
filename: filename,
|
|
module: {
|
|
type: "commonjs"
|
|
}
|
|
});
|
|
compile.call(m, out.code, filename);
|
|
};
|
|
// $FlowFixMe
|
|
(0, ($parcel$interopDefault($aniHR$module)))._extensions[extname] = (m, filename)=>{
|
|
// $FlowFixMe
|
|
delete (0, ($parcel$interopDefault($aniHR$module)))._extensions[extname];
|
|
// $FlowFixMe
|
|
(0, ($parcel$interopDefault($aniHR$module)))._extensions[".js"](m, filename);
|
|
};
|
|
}
|
|
}
|
|
try {
|
|
m.load(filePath);
|
|
} catch (err) {
|
|
// $FlowFixMe[prop-missing]
|
|
delete (0, ($parcel$interopDefault($aniHR$module)))._cache[filePath];
|
|
throw err;
|
|
} finally{
|
|
// $FlowFixMe
|
|
(0, ($parcel$interopDefault($aniHR$fs))).readFileSync = readFileSync;
|
|
// $FlowFixMe
|
|
(0, ($parcel$interopDefault($aniHR$fs))).statSync = statSync;
|
|
}
|
|
return m.exports;
|
|
}
|
|
async resolve(id, from, options) {
|
|
let basedir = (0, ($parcel$interopDefault($aniHR$path))).dirname(from);
|
|
let key = basedir + ":" + id;
|
|
let resolved = cache.get(key);
|
|
if (!resolved) {
|
|
let [name] = (0, $aniHR$parcelutils.getModuleParts)(id);
|
|
try {
|
|
resolved = this.resolveInternal(id, from);
|
|
} catch (e) {
|
|
if (e.code !== "MODULE_NOT_FOUND" || (options === null || options === void 0 ? void 0 : options.shouldAutoInstall) !== true || id.startsWith(".") // a local file, don't autoinstall
|
|
) {
|
|
if (e.code === "MODULE_NOT_FOUND" && (options === null || options === void 0 ? void 0 : options.shouldAutoInstall) !== true) {
|
|
let err = new (0, ($parcel$interopDefault($aniHR$parceldiagnostic)))({
|
|
diagnostic: {
|
|
message: (0, $aniHR$parceldiagnostic.escapeMarkdown)(e.message),
|
|
hints: [
|
|
"Autoinstall is disabled, please install this package manually and restart Parcel."
|
|
]
|
|
}
|
|
});
|
|
// $FlowFixMe - needed for loadParcelPlugin
|
|
err.code = "MODULE_NOT_FOUND";
|
|
throw err;
|
|
} else throw e;
|
|
}
|
|
let conflicts = await (0, $a5njb.getConflictingLocalDependencies)(this.fs, name, from, this.projectRoot);
|
|
if (conflicts == null) {
|
|
this.invalidate(id, from);
|
|
var _options_saveDev;
|
|
await this.install([
|
|
{
|
|
name: name,
|
|
range: options === null || options === void 0 ? void 0 : options.range
|
|
}
|
|
], from, {
|
|
saveDev: (_options_saveDev = options === null || options === void 0 ? void 0 : options.saveDev) !== null && _options_saveDev !== void 0 ? _options_saveDev : true
|
|
});
|
|
return this.resolve(id, from, {
|
|
...options,
|
|
shouldAutoInstall: false
|
|
});
|
|
}
|
|
throw new (0, ($parcel$interopDefault($aniHR$parceldiagnostic)))({
|
|
diagnostic: conflicts.fields.map((field)=>({
|
|
message: (0, $aniHR$parceldiagnostic.md)`Could not find module "${name}", but it was listed in package.json. Run your package manager first.`,
|
|
origin: "@parcel/package-manager",
|
|
codeFrames: [
|
|
{
|
|
filePath: conflicts.filePath,
|
|
language: "json",
|
|
code: conflicts.json,
|
|
codeHighlights: (0, $aniHR$parceldiagnostic.generateJSONCodeHighlights)(conflicts.json, [
|
|
{
|
|
key: `/${field}/${(0, $aniHR$parceldiagnostic.encodeJSONKeyComponent)(name)}`,
|
|
type: "key",
|
|
message: "Defined here, but not installed"
|
|
}
|
|
])
|
|
}
|
|
]
|
|
}))
|
|
});
|
|
}
|
|
let range = options === null || options === void 0 ? void 0 : options.range;
|
|
if (range != null) {
|
|
let pkg = resolved.pkg;
|
|
if (pkg == null || !(0, ($parcel$interopDefault($aniHR$semver))).satisfies(pkg.version, range)) {
|
|
let conflicts = await (0, $a5njb.getConflictingLocalDependencies)(this.fs, name, from, this.projectRoot);
|
|
if (conflicts == null && (options === null || options === void 0 ? void 0 : options.shouldAutoInstall) === true) {
|
|
this.invalidate(id, from);
|
|
await this.install([
|
|
{
|
|
name: name,
|
|
range: range
|
|
}
|
|
], from);
|
|
return this.resolve(id, from, {
|
|
...options,
|
|
shouldAutoInstall: false
|
|
});
|
|
} else if (conflicts != null) throw new (0, ($parcel$interopDefault($aniHR$parceldiagnostic)))({
|
|
diagnostic: {
|
|
message: (0, $aniHR$parceldiagnostic.md)`Could not find module "${name}" satisfying ${range}.`,
|
|
origin: "@parcel/package-manager",
|
|
codeFrames: [
|
|
{
|
|
filePath: conflicts.filePath,
|
|
language: "json",
|
|
code: conflicts.json,
|
|
codeHighlights: (0, $aniHR$parceldiagnostic.generateJSONCodeHighlights)(conflicts.json, conflicts.fields.map((field)=>({
|
|
key: `/${field}/${(0, $aniHR$parceldiagnostic.encodeJSONKeyComponent)(name)}`,
|
|
type: "key",
|
|
message: "Found this conflicting local requirement."
|
|
})))
|
|
}
|
|
]
|
|
}
|
|
});
|
|
let version = pkg === null || pkg === void 0 ? void 0 : pkg.version;
|
|
let message = (0, $aniHR$parceldiagnostic.md)`Could not resolve package "${name}" that satisfies ${range}.`;
|
|
if (version != null) message += (0, $aniHR$parceldiagnostic.md)` Found ${version}.`;
|
|
throw new (0, ($parcel$interopDefault($aniHR$parceldiagnostic)))({
|
|
diagnostic: {
|
|
message: message,
|
|
hints: [
|
|
"Looks like the incompatible version was installed transitively. Add this package as a direct dependency with a compatible version range."
|
|
]
|
|
}
|
|
});
|
|
}
|
|
}
|
|
cache.set(key, resolved);
|
|
invalidationsCache.clear();
|
|
// Add the specifier as a child to the parent module.
|
|
// Don't do this if the specifier was an absolute path, as this was likely a dynamically resolved path
|
|
// (e.g. babel uses require() to load .babelrc.js configs and we don't want them to be added as children of babel itself).
|
|
if (!(0, ($parcel$interopDefault($aniHR$path))).isAbsolute(name)) {
|
|
let moduleChildren = children.get(from);
|
|
if (!moduleChildren) {
|
|
moduleChildren = new Set();
|
|
children.set(from, moduleChildren);
|
|
}
|
|
moduleChildren.add(name);
|
|
}
|
|
}
|
|
return resolved;
|
|
}
|
|
resolveSync(name, from) {
|
|
let basedir = (0, ($parcel$interopDefault($aniHR$path))).dirname(from);
|
|
let key = basedir + ":" + name;
|
|
let resolved = cache.get(key);
|
|
if (!resolved) {
|
|
resolved = this.resolveInternal(name, from);
|
|
cache.set(key, resolved);
|
|
invalidationsCache.clear();
|
|
if (!(0, ($parcel$interopDefault($aniHR$path))).isAbsolute(name)) {
|
|
let moduleChildren = children.get(from);
|
|
if (!moduleChildren) {
|
|
moduleChildren = new Set();
|
|
children.set(from, moduleChildren);
|
|
}
|
|
moduleChildren.add(name);
|
|
}
|
|
}
|
|
return resolved;
|
|
}
|
|
async install(modules, from, opts) {
|
|
await (0, $7o0cY.installPackage)(this.fs, this, modules, from, this.projectRoot, {
|
|
packageInstaller: this.installer,
|
|
...opts
|
|
});
|
|
}
|
|
getInvalidations(name, from) {
|
|
let basedir = (0, ($parcel$interopDefault($aniHR$path))).dirname(from);
|
|
let resolved = cache.get(basedir + ":" + name);
|
|
if (resolved && (0, ($parcel$interopDefault($aniHR$path))).isAbsolute(resolved.resolved)) {
|
|
let cached = invalidationsCache.get(resolved.resolved);
|
|
if (cached != null) return cached;
|
|
let res = {
|
|
invalidateOnFileCreate: [],
|
|
invalidateOnFileChange: new Set(),
|
|
invalidateOnStartup: false
|
|
};
|
|
let seen = new Set();
|
|
let addKey = (name, from)=>{
|
|
let basedir = (0, ($parcel$interopDefault($aniHR$path))).dirname(from);
|
|
let key = basedir + ":" + name;
|
|
if (seen.has(key)) return;
|
|
seen.add(key);
|
|
let resolved = cache.get(key);
|
|
if (!resolved || !(0, ($parcel$interopDefault($aniHR$path))).isAbsolute(resolved.resolved)) return;
|
|
res.invalidateOnFileCreate.push(...resolved.invalidateOnFileCreate);
|
|
res.invalidateOnFileChange.add(resolved.resolved);
|
|
for (let file of resolved.invalidateOnFileChange)res.invalidateOnFileChange.add(file);
|
|
let moduleChildren = children.get(resolved.resolved);
|
|
if (moduleChildren) for (let specifier of moduleChildren)addKey(specifier, resolved.resolved);
|
|
};
|
|
addKey(name, from);
|
|
// If this is an ES module, we won't have any of the dependencies because import statements
|
|
// cannot be intercepted. Instead, ask the resolver to parse the file and recursively analyze the deps.
|
|
if (resolved.type === 2) {
|
|
var _res;
|
|
let invalidations = this.resolver.getInvalidations(resolved.resolved);
|
|
invalidations.invalidateOnFileChange.forEach((i)=>res.invalidateOnFileChange.add(i));
|
|
invalidations.invalidateOnFileCreate.forEach((i)=>res.invalidateOnFileCreate.push(i));
|
|
(_res = res).invalidateOnStartup || (_res.invalidateOnStartup = invalidations.invalidateOnStartup);
|
|
if (res.invalidateOnStartup) (0, ($parcel$interopDefault($aniHR$parcellogger))).warn({
|
|
message: (0, $aniHR$parceldiagnostic.md)`${(0, ($parcel$interopDefault($aniHR$path))).relative(this.projectRoot, resolved.resolved)} contains non-statically analyzable dependencies in its module graph. This causes Parcel to invalidate the cache on startup.`,
|
|
origin: "@parcel/package-manager"
|
|
});
|
|
}
|
|
invalidationsCache.set(resolved.resolved, res);
|
|
return res;
|
|
}
|
|
return {
|
|
invalidateOnFileCreate: [],
|
|
invalidateOnFileChange: new Set(),
|
|
invalidateOnStartup: false
|
|
};
|
|
}
|
|
invalidate(name, from) {
|
|
let seen = new Set();
|
|
let invalidate = (name, from)=>{
|
|
let basedir = (0, ($parcel$interopDefault($aniHR$path))).dirname(from);
|
|
let key = basedir + ":" + name;
|
|
if (seen.has(key)) return;
|
|
seen.add(key);
|
|
let resolved = cache.get(key);
|
|
if (!resolved || !(0, ($parcel$interopDefault($aniHR$path))).isAbsolute(resolved.resolved)) return;
|
|
invalidationsCache.delete(resolved.resolved);
|
|
// $FlowFixMe
|
|
let module1 = (0, ($parcel$interopDefault($aniHR$module)))._cache[resolved.resolved];
|
|
if (module1) // $FlowFixMe
|
|
delete (0, ($parcel$interopDefault($aniHR$module)))._cache[resolved.resolved];
|
|
let moduleChildren = children.get(resolved.resolved);
|
|
if (moduleChildren) for (let specifier of moduleChildren)invalidate(specifier, resolved.resolved);
|
|
children.delete(resolved.resolved);
|
|
cache.delete(key);
|
|
};
|
|
invalidate(name, from);
|
|
this.resolver = this._createResolver();
|
|
}
|
|
resolveInternal(name, from) {
|
|
if (this.resolver == null) this.resolver = this._createResolver();
|
|
let res = this.resolver.resolve({
|
|
filename: name,
|
|
specifierType: "commonjs",
|
|
parent: from
|
|
});
|
|
// Invalidate whenever the .pnp.js file changes.
|
|
// TODO: only when we actually resolve a node_modules package?
|
|
if (process.versions.pnp != null && res.invalidateOnFileChange) {
|
|
// $FlowFixMe[prop-missing]
|
|
let pnp = (0, ($parcel$interopDefault($aniHR$module))).findPnpApi((0, ($parcel$interopDefault($aniHR$path))).dirname(from));
|
|
res.invalidateOnFileChange.push(pnp.resolveToUnqualified("pnpapi", null));
|
|
}
|
|
if (res.error) {
|
|
let e = new Error(`Could not resolve module "${name}" from "${from}"`);
|
|
// $FlowFixMe
|
|
e.code = "MODULE_NOT_FOUND";
|
|
throw e;
|
|
}
|
|
let getPkg;
|
|
switch(res.resolution.type){
|
|
case "Path":
|
|
getPkg = ()=>{
|
|
let pkgPath = this.fs.findAncestorFile([
|
|
"package.json"
|
|
], (0, (/*@__PURE__*/$parcel$interopDefault($dBBzS)))(res.resolution.value), this.projectRoot);
|
|
return pkgPath ? JSON.parse(this.fs.readFileSync(pkgPath, "utf8")) : null;
|
|
};
|
|
// fallthrough
|
|
case "Builtin":
|
|
return {
|
|
resolved: res.resolution.value,
|
|
invalidateOnFileChange: new Set(res.invalidateOnFileChange),
|
|
invalidateOnFileCreate: res.invalidateOnFileCreate,
|
|
type: res.moduleType,
|
|
get pkg () {
|
|
return getPkg();
|
|
}
|
|
};
|
|
default:
|
|
throw new Error("Unknown resolution type");
|
|
}
|
|
}
|
|
}
|
|
(0, $aniHR$parcelcore.registerSerializableClass)(`${(0, (/*@__PURE__*/$parcel$interopDefault($hgTxA))).version}:NodePackageManager`, NodePackageManager);
|
|
|
|
});
|
|
parcelRegister("dBBzS", function(module, exports) {
|
|
"use strict";
|
|
function $9e7be12fc21c270a$var$nullthrows(x, message) {
|
|
if (x != null) return x;
|
|
var error = new Error(message !== undefined ? message : "Got unexpected " + x);
|
|
error.framesToPop = 1; // Skip nullthrows's own stack frame.
|
|
throw error;
|
|
}
|
|
module.exports = $9e7be12fc21c270a$var$nullthrows;
|
|
module.exports.default = $9e7be12fc21c270a$var$nullthrows;
|
|
Object.defineProperty(module.exports, "__esModule", {
|
|
value: true
|
|
});
|
|
|
|
});
|
|
|
|
parcelRegister("a5njb", function(module, exports) {
|
|
|
|
$parcel$export(module.exports, "exec", () => $757c7390f11e5f7a$export$78e3044358792147);
|
|
$parcel$export(module.exports, "npmSpecifierFromModuleRequest", () => $757c7390f11e5f7a$export$44a673cac0f09696);
|
|
$parcel$export(module.exports, "moduleRequestsFromDependencyMap", () => $757c7390f11e5f7a$export$8e3ae06b6f2ee6e2);
|
|
$parcel$export(module.exports, "getConflictingLocalDependencies", () => $757c7390f11e5f7a$export$ab9915b45c70a034);
|
|
|
|
|
|
|
|
|
|
|
|
const $757c7390f11e5f7a$export$78e3044358792147 = (0, $aniHR$child_process.exec) ? (0, $aniHR$util.promisify)((0, $aniHR$child_process.exec)) : // _exec is undefined in browser builds
|
|
(0, $aniHR$child_process.exec);
|
|
function $757c7390f11e5f7a$export$44a673cac0f09696(moduleRequest) {
|
|
return moduleRequest.range != null ? [
|
|
moduleRequest.name,
|
|
moduleRequest.range
|
|
].join("@") : moduleRequest.name;
|
|
}
|
|
function $757c7390f11e5f7a$export$8e3ae06b6f2ee6e2(dependencyMap) {
|
|
return Object.entries(dependencyMap).map(([name, range])=>{
|
|
(0, ($parcel$interopDefault($aniHR$assert)))(typeof range === "string");
|
|
return {
|
|
name: name,
|
|
range: range
|
|
};
|
|
});
|
|
}
|
|
async function $757c7390f11e5f7a$export$ab9915b45c70a034(fs, name, local, projectRoot) {
|
|
let pkgPath = await (0, $aniHR$parcelutils.resolveConfig)(fs, local, [
|
|
"package.json"
|
|
], projectRoot);
|
|
if (pkgPath == null) return;
|
|
let pkgStr = await fs.readFile(pkgPath, "utf8");
|
|
let pkg;
|
|
try {
|
|
pkg = JSON.parse(pkgStr);
|
|
} catch (e) {
|
|
// TODO: codeframe
|
|
throw new (0, ($parcel$interopDefault($aniHR$parceldiagnostic)))({
|
|
diagnostic: {
|
|
message: "Failed to parse package.json",
|
|
origin: "@parcel/package-manager"
|
|
}
|
|
});
|
|
}
|
|
if (typeof pkg !== "object" || pkg == null) // TODO: codeframe
|
|
throw new (0, ($parcel$interopDefault($aniHR$parceldiagnostic)))({
|
|
diagnostic: {
|
|
message: "Expected package.json contents to be an object.",
|
|
origin: "@parcel/package-manager"
|
|
}
|
|
});
|
|
let fields = [];
|
|
for (let field of [
|
|
"dependencies",
|
|
"devDependencies",
|
|
"peerDependencies"
|
|
])if (typeof pkg[field] === "object" && pkg[field] != null && pkg[field][name] != null) fields.push(field);
|
|
if (fields.length > 0) return {
|
|
filePath: pkgPath,
|
|
json: pkgStr,
|
|
fields: fields
|
|
};
|
|
}
|
|
|
|
});
|
|
|
|
parcelRegister("7o0cY", function(module, exports) {
|
|
|
|
$parcel$export(module.exports, "_addToInstallQueue", () => $560aefa43b4aa558$export$f09e6d5146bb6da1);
|
|
$parcel$export(module.exports, "installPackage", () => $560aefa43b4aa558$export$9c0565d18deefc7f);
|
|
|
|
|
|
|
|
var $dBBzS = parcelRequire("dBBzS");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var $4Rmkl = parcelRequire("4Rmkl");
|
|
|
|
var $k9NrW = parcelRequire("k9NrW");
|
|
|
|
var $li6gH = parcelRequire("li6gH");
|
|
|
|
var $a5njb = parcelRequire("a5njb");
|
|
|
|
var $ink4g = parcelRequire("ink4g");
|
|
|
|
var $8T6bp = parcelRequire("8T6bp");
|
|
|
|
var $560aefa43b4aa558$var$$parcel$__filename = $aniHR$path.resolve(__dirname, "../src", "installPackage.js");
|
|
|
|
var $560aefa43b4aa558$var$$parcel$__dirname = $aniHR$path.resolve(__dirname, "../src");
|
|
async function $560aefa43b4aa558$var$install(fs, packageManager, modules, from, projectRoot, options = {}) {
|
|
let { installPeers: installPeers = true, saveDev: saveDev = true, packageInstaller: packageInstaller } = options;
|
|
let moduleNames = modules.map((m)=>m.name).join(", ");
|
|
(0, ($parcel$interopDefault($aniHR$parcellogger))).progress(`Installing ${moduleNames}...`);
|
|
let fromPkgPath = await (0, $aniHR$parcelutils.resolveConfig)(fs, from, [
|
|
"package.json"
|
|
], projectRoot);
|
|
let cwd = fromPkgPath ? (0, ($parcel$interopDefault($aniHR$path))).dirname(fromPkgPath) : fs.cwd();
|
|
if (!packageInstaller) packageInstaller = await $560aefa43b4aa558$var$determinePackageInstaller(fs, from, projectRoot);
|
|
try {
|
|
await packageInstaller.install({
|
|
modules: modules,
|
|
saveDev: saveDev,
|
|
cwd: cwd,
|
|
packagePath: fromPkgPath,
|
|
fs: fs
|
|
});
|
|
} catch (err) {
|
|
throw new Error(`Failed to install ${moduleNames}: ${err.message}`);
|
|
}
|
|
if (installPeers) await Promise.all(modules.map((m)=>$560aefa43b4aa558$var$installPeerDependencies(fs, packageManager, m, from, projectRoot, options)));
|
|
}
|
|
async function $560aefa43b4aa558$var$installPeerDependencies(fs, packageManager, module, from, projectRoot, options) {
|
|
const { resolved: resolved } = await packageManager.resolve(module.name, from);
|
|
const modulePkg = (0, (/*@__PURE__*/$parcel$interopDefault($dBBzS)))(await (0, $aniHR$parcelutils.loadConfig)(fs, resolved, [
|
|
"package.json"
|
|
], projectRoot)).config;
|
|
const peers = modulePkg.peerDependencies || {};
|
|
let modules = [];
|
|
for (let [name, range] of Object.entries(peers)){
|
|
(0, ($parcel$interopDefault($aniHR$assert)))(typeof range === "string");
|
|
let conflicts = await (0, $a5njb.getConflictingLocalDependencies)(fs, name, from, projectRoot);
|
|
if (conflicts) {
|
|
let { pkg: pkg } = await packageManager.resolve(name, from);
|
|
(0, ($parcel$interopDefault($aniHR$assert)))(pkg);
|
|
if (!(0, ($parcel$interopDefault($aniHR$semver))).satisfies(pkg.version, range)) throw new (0, ($parcel$interopDefault($aniHR$parceldiagnostic)))({
|
|
diagnostic: {
|
|
message: (0, $aniHR$parceldiagnostic.md)`Could not install the peer dependency "${name}" for "${module.name}", installed version ${pkg.version} is incompatible with ${range}`,
|
|
origin: "@parcel/package-manager",
|
|
codeFrames: [
|
|
{
|
|
filePath: conflicts.filePath,
|
|
language: "json",
|
|
code: conflicts.json,
|
|
codeHighlights: (0, $aniHR$parceldiagnostic.generateJSONCodeHighlights)(conflicts.json, conflicts.fields.map((field)=>({
|
|
key: `/${field}/${(0, $aniHR$parceldiagnostic.encodeJSONKeyComponent)(name)}`,
|
|
type: "key",
|
|
message: "Found this conflicting local requirement."
|
|
})))
|
|
}
|
|
]
|
|
}
|
|
});
|
|
continue;
|
|
}
|
|
modules.push({
|
|
name: name,
|
|
range: range
|
|
});
|
|
}
|
|
if (modules.length) await $560aefa43b4aa558$var$install(fs, packageManager, modules, from, projectRoot, Object.assign({}, options, {
|
|
installPeers: false
|
|
}));
|
|
}
|
|
async function $560aefa43b4aa558$var$determinePackageInstaller(fs, filepath, projectRoot) {
|
|
var _getCurrentPackageManager;
|
|
let configFile = await (0, $aniHR$parcelutils.resolveConfig)(fs, filepath, [
|
|
"package-lock.json",
|
|
"pnpm-lock.yaml",
|
|
"yarn.lock"
|
|
], projectRoot);
|
|
let configName = configFile && (0, ($parcel$interopDefault($aniHR$path))).basename(configFile);
|
|
// Always use the package manager that seems to be used in the project,
|
|
// falling back to a different one wouldn't update the existing lockfile.
|
|
if (configName === "package-lock.json") return new (0, $4Rmkl.Npm)();
|
|
else if (configName === "pnpm-lock.yaml") return new (0, $li6gH.Pnpm)();
|
|
else if (configName === "yarn.lock") return new (0, $k9NrW.Yarn)();
|
|
let currentPackageManager = (_getCurrentPackageManager = (0, $ink4g.default)()) === null || _getCurrentPackageManager === void 0 ? void 0 : _getCurrentPackageManager.name;
|
|
if (currentPackageManager === "npm") return new (0, $4Rmkl.Npm)();
|
|
else if (currentPackageManager === "yarn") return new (0, $k9NrW.Yarn)();
|
|
else if (currentPackageManager === "pnpm") return new (0, $li6gH.Pnpm)();
|
|
if (await (0, $k9NrW.Yarn).exists()) return new (0, $k9NrW.Yarn)();
|
|
else if (await (0, $li6gH.Pnpm).exists()) return new (0, $li6gH.Pnpm)();
|
|
else return new (0, $4Rmkl.Npm)();
|
|
}
|
|
let $560aefa43b4aa558$var$queue = new (0, $aniHR$parcelutils.PromiseQueue)({
|
|
maxConcurrent: 1
|
|
});
|
|
let $560aefa43b4aa558$var$modulesInstalling = new Set();
|
|
function $560aefa43b4aa558$export$f09e6d5146bb6da1(fs, packageManager, modules, filePath, projectRoot, options) {
|
|
modules = modules.map((request)=>({
|
|
name: (0, $8T6bp.default)(request.name),
|
|
range: request.range
|
|
}));
|
|
// Wrap PromiseQueue and track modules that are currently installing.
|
|
// If a request comes in for a module that is currently installing, don't bother
|
|
// enqueuing it.
|
|
let modulesToInstall = modules.filter((m)=>!$560aefa43b4aa558$var$modulesInstalling.has($560aefa43b4aa558$var$getModuleRequestKey(m)));
|
|
if (modulesToInstall.length) {
|
|
for (let m of modulesToInstall)$560aefa43b4aa558$var$modulesInstalling.add($560aefa43b4aa558$var$getModuleRequestKey(m));
|
|
$560aefa43b4aa558$var$queue.add(()=>$560aefa43b4aa558$var$install(fs, packageManager, modulesToInstall, filePath, projectRoot, options).then(()=>{
|
|
for (let m of modulesToInstall)$560aefa43b4aa558$var$modulesInstalling.delete($560aefa43b4aa558$var$getModuleRequestKey(m));
|
|
})).then(()=>{}, ()=>{});
|
|
}
|
|
return $560aefa43b4aa558$var$queue.run();
|
|
}
|
|
function $560aefa43b4aa558$export$9c0565d18deefc7f(fs, packageManager, modules, filePath, projectRoot, options) {
|
|
if ((0, ($parcel$interopDefault($aniHR$parcelworkers))).isWorker()) {
|
|
let workerApi = (0, ($parcel$interopDefault($aniHR$parcelworkers))).getWorkerApi();
|
|
// TODO this should really be `__filename` but without the rewriting.
|
|
let bundlePath = !process.env.PARCEL_SELF_BUILD ? (0, ($parcel$interopDefault($aniHR$path))).join($560aefa43b4aa558$var$$parcel$__dirname, "..", "lib/index.js") : $560aefa43b4aa558$var$$parcel$__filename;
|
|
return workerApi.callMaster({
|
|
location: bundlePath,
|
|
args: [
|
|
fs,
|
|
packageManager,
|
|
modules,
|
|
filePath,
|
|
projectRoot,
|
|
options
|
|
],
|
|
method: "_addToInstallQueue"
|
|
});
|
|
}
|
|
return $560aefa43b4aa558$export$f09e6d5146bb6da1(fs, packageManager, modules, filePath, projectRoot, options);
|
|
}
|
|
function $560aefa43b4aa558$var$getModuleRequestKey(moduleRequest) {
|
|
return [
|
|
moduleRequest.name,
|
|
moduleRequest.range
|
|
].join("@");
|
|
}
|
|
|
|
});
|
|
parcelRegister("4Rmkl", function(module, exports) {
|
|
|
|
$parcel$export(module.exports, "Npm", () => $389d6e597ca3bda0$export$bc651973ec076cd0);
|
|
|
|
|
|
var $cmSYh = parcelRequire("cmSYh");
|
|
|
|
|
|
var $a4ERc = parcelRequire("a4ERc");
|
|
|
|
|
|
var $a5njb = parcelRequire("a5njb");
|
|
|
|
var $hgTxA = parcelRequire("hgTxA");
|
|
const $389d6e597ca3bda0$var$NPM_CMD = "npm";
|
|
class $389d6e597ca3bda0$export$bc651973ec076cd0 {
|
|
async install({ modules: modules, cwd: cwd, fs: fs, packagePath: packagePath, saveDev: saveDev = true }) {
|
|
// npm doesn't auto-create a package.json when installing,
|
|
// so create an empty one if needed.
|
|
if (packagePath == null) await fs.writeFile((0, ($parcel$interopDefault($aniHR$path))).join(cwd, "package.json"), "{}");
|
|
let args = [
|
|
"install",
|
|
"--json",
|
|
saveDev ? "--save-dev" : "--save"
|
|
].concat(modules.map((0, $a5njb.npmSpecifierFromModuleRequest)));
|
|
// When Parcel is run by npm (e.g. via package.json scripts), several environment variables are
|
|
// added. When parcel in turn calls npm again, these can cause npm to behave stragely, so we
|
|
// filter them out when installing packages.
|
|
let env = {};
|
|
for(let key in process.env)if (!key.startsWith("npm_") && key !== "INIT_CWD" && key !== "NODE_ENV") env[key] = process.env[key];
|
|
let installProcess = (0, (/*@__PURE__*/$parcel$interopDefault($cmSYh)))($389d6e597ca3bda0$var$NPM_CMD, args, {
|
|
cwd: cwd,
|
|
env: env
|
|
});
|
|
let stdout = "";
|
|
installProcess.stdout.on("data", (buf)=>{
|
|
stdout += buf.toString();
|
|
});
|
|
let stderr = [];
|
|
installProcess.stderr.on("data", (buf)=>{
|
|
stderr.push(buf.toString().trim());
|
|
});
|
|
try {
|
|
await (0, $a4ERc.default)(installProcess);
|
|
let results = JSON.parse(stdout);
|
|
let addedCount = results.added.length;
|
|
if (addedCount > 0) (0, ($parcel$interopDefault($aniHR$parcellogger))).log({
|
|
origin: "@parcel/package-manager",
|
|
message: `Added ${addedCount} packages via npm`
|
|
});
|
|
// Since we succeeded, stderr might have useful information not included
|
|
// in the json written to stdout. It's also not necessary to log these as
|
|
// errors as they often aren't.
|
|
for (let message of stderr)if (message.length > 0) (0, ($parcel$interopDefault($aniHR$parcellogger))).log({
|
|
origin: "@parcel/package-manager",
|
|
message: message
|
|
});
|
|
} catch (e) {
|
|
throw new Error("npm failed to install modules: " + e.message + " - " + stderr.join("\n"));
|
|
}
|
|
}
|
|
}
|
|
(0, $aniHR$parcelcore.registerSerializableClass)(`${(0, (/*@__PURE__*/$parcel$interopDefault($hgTxA))).version}:Npm`, $389d6e597ca3bda0$export$bc651973ec076cd0);
|
|
|
|
});
|
|
parcelRegister("cmSYh", function(module, exports) {
|
|
"use strict";
|
|
|
|
|
|
var $gn2cs = parcelRequire("gn2cs");
|
|
|
|
var $2QLxV = parcelRequire("2QLxV");
|
|
function $90122e454a01b0c3$var$spawn(command, args, options) {
|
|
// Parse the arguments
|
|
const parsed = $gn2cs(command, args, options);
|
|
// Spawn the child process
|
|
const spawned = $aniHR$child_process.spawn(parsed.command, parsed.args, parsed.options);
|
|
// Hook into child process "exit" event to emit an error if the command
|
|
// does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16
|
|
$2QLxV.hookChildProcess(spawned, parsed);
|
|
return spawned;
|
|
}
|
|
function $90122e454a01b0c3$var$spawnSync(command, args, options) {
|
|
// Parse the arguments
|
|
const parsed = $gn2cs(command, args, options);
|
|
// Spawn the child process
|
|
const result = $aniHR$child_process.spawnSync(parsed.command, parsed.args, parsed.options);
|
|
// Analyze if the command does not exist, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16
|
|
result.error = result.error || $2QLxV.verifyENOENTSync(result.status, parsed);
|
|
return result;
|
|
}
|
|
module.exports = $90122e454a01b0c3$var$spawn;
|
|
module.exports.spawn = $90122e454a01b0c3$var$spawn;
|
|
module.exports.sync = $90122e454a01b0c3$var$spawnSync;
|
|
module.exports._parse = $gn2cs;
|
|
module.exports._enoent = $2QLxV;
|
|
|
|
});
|
|
parcelRegister("gn2cs", function(module, exports) {
|
|
"use strict";
|
|
|
|
|
|
var $fbKDR = parcelRequire("fbKDR");
|
|
|
|
var $3Vy3W = parcelRequire("3Vy3W");
|
|
|
|
var $4K157 = parcelRequire("4K157");
|
|
|
|
var $8WT3q = parcelRequire("8WT3q");
|
|
|
|
const $beb0803317b8ec95$var$isWin = process.platform === "win32";
|
|
const $beb0803317b8ec95$var$isExecutableRegExp = /\.(?:com|exe)$/i;
|
|
const $beb0803317b8ec95$var$isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
// `options.shell` is supported in Node ^4.8.0, ^5.7.0 and >= 6.0.0
|
|
const $beb0803317b8ec95$var$supportsShellOption = $fbKDR(()=>$aniHR$semver.satisfies(process.version, "^4.8.0 || ^5.7.0 || >= 6.0.0", true)) || false;
|
|
function $beb0803317b8ec95$var$detectShebang(parsed) {
|
|
parsed.file = $3Vy3W(parsed);
|
|
const shebang = parsed.file && $8WT3q(parsed.file);
|
|
if (shebang) {
|
|
parsed.args.unshift(parsed.file);
|
|
parsed.command = shebang;
|
|
return $3Vy3W(parsed);
|
|
}
|
|
return parsed.file;
|
|
}
|
|
function $beb0803317b8ec95$var$parseNonShell(parsed) {
|
|
if (!$beb0803317b8ec95$var$isWin) return parsed;
|
|
// Detect & add support for shebangs
|
|
const commandFile = $beb0803317b8ec95$var$detectShebang(parsed);
|
|
// We don't need a shell if the command filename is an executable
|
|
const needsShell = !$beb0803317b8ec95$var$isExecutableRegExp.test(commandFile);
|
|
// If a shell is required, use cmd.exe and take care of escaping everything correctly
|
|
// Note that `forceShell` is an hidden option used only in tests
|
|
if (parsed.options.forceShell || needsShell) {
|
|
// Need to double escape meta chars if the command is a cmd-shim located in `node_modules/.bin/`
|
|
// The cmd-shim simply calls execute the package bin file with NodeJS, proxying any argument
|
|
// Because the escape of metachars with ^ gets interpreted when the cmd.exe is first called,
|
|
// we need to double escape them
|
|
const needsDoubleEscapeMetaChars = $beb0803317b8ec95$var$isCmdShimRegExp.test(commandFile);
|
|
// Normalize posix paths into OS compatible paths (e.g.: foo/bar -> foo\bar)
|
|
// This is necessary otherwise it will always fail with ENOENT in those cases
|
|
parsed.command = $aniHR$path.normalize(parsed.command);
|
|
// Escape command & arguments
|
|
parsed.command = $4K157.command(parsed.command);
|
|
parsed.args = parsed.args.map((arg)=>$4K157.argument(arg, needsDoubleEscapeMetaChars));
|
|
const shellCommand = [
|
|
parsed.command
|
|
].concat(parsed.args).join(" ");
|
|
parsed.args = [
|
|
"/d",
|
|
"/s",
|
|
"/c",
|
|
`"${shellCommand}"`
|
|
];
|
|
parsed.command = process.env.comspec || "cmd.exe";
|
|
parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped
|
|
}
|
|
return parsed;
|
|
}
|
|
function $beb0803317b8ec95$var$parseShell(parsed) {
|
|
// If node supports the shell option, there's no need to mimic its behavior
|
|
if ($beb0803317b8ec95$var$supportsShellOption) return parsed;
|
|
// Mimic node shell option
|
|
// See https://github.com/nodejs/node/blob/b9f6a2dc059a1062776133f3d4fd848c4da7d150/lib/child_process.js#L335
|
|
const shellCommand = [
|
|
parsed.command
|
|
].concat(parsed.args).join(" ");
|
|
if ($beb0803317b8ec95$var$isWin) {
|
|
parsed.command = typeof parsed.options.shell === "string" ? parsed.options.shell : process.env.comspec || "cmd.exe";
|
|
parsed.args = [
|
|
"/d",
|
|
"/s",
|
|
"/c",
|
|
`"${shellCommand}"`
|
|
];
|
|
parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped
|
|
} else {
|
|
if (typeof parsed.options.shell === "string") parsed.command = parsed.options.shell;
|
|
else if (process.platform === "android") parsed.command = "/system/bin/sh";
|
|
else parsed.command = "/bin/sh";
|
|
parsed.args = [
|
|
"-c",
|
|
shellCommand
|
|
];
|
|
}
|
|
return parsed;
|
|
}
|
|
function $beb0803317b8ec95$var$parse(command, args, options) {
|
|
// Normalize arguments, similar to nodejs
|
|
if (args && !Array.isArray(args)) {
|
|
options = args;
|
|
args = null;
|
|
}
|
|
args = args ? args.slice(0) : []; // Clone array to avoid changing the original
|
|
options = Object.assign({}, options); // Clone object to avoid changing the original
|
|
// Build our parsed object
|
|
const parsed = {
|
|
command: command,
|
|
args: args,
|
|
options: options,
|
|
file: undefined,
|
|
original: {
|
|
command: command,
|
|
args: args
|
|
}
|
|
};
|
|
// Delegate further parsing to shell or non-shell
|
|
return options.shell ? $beb0803317b8ec95$var$parseShell(parsed) : $beb0803317b8ec95$var$parseNonShell(parsed);
|
|
}
|
|
module.exports = $beb0803317b8ec95$var$parse;
|
|
|
|
});
|
|
parcelRegister("fbKDR", function(module, exports) {
|
|
"use strict";
|
|
/**
|
|
* Tries to execute a function and discards any error that occurs.
|
|
* @param {Function} fn - Function that might or might not throw an error.
|
|
* @returns {?*} Return-value of the function when no error occurred.
|
|
*/ module.exports = function(fn) {
|
|
try {
|
|
return fn();
|
|
} catch (e) {}
|
|
};
|
|
|
|
});
|
|
|
|
parcelRegister("3Vy3W", function(module, exports) {
|
|
"use strict";
|
|
|
|
|
|
var $9Z52c = parcelRequire("9Z52c");
|
|
|
|
const $2dc11e110b3b7b5f$var$pathKey = (parcelRequire("jOxMb"))();
|
|
function $2dc11e110b3b7b5f$var$resolveCommandAttempt(parsed, withoutPathExt) {
|
|
const cwd = process.cwd();
|
|
const hasCustomCwd = parsed.options.cwd != null;
|
|
// If a custom `cwd` was specified, we need to change the process cwd
|
|
// because `which` will do stat calls but does not support a custom cwd
|
|
if (hasCustomCwd) try {
|
|
process.chdir(parsed.options.cwd);
|
|
} catch (err) {
|
|
/* Empty */ }
|
|
let resolved;
|
|
try {
|
|
resolved = $9Z52c.sync(parsed.command, {
|
|
path: (parsed.options.env || process.env)[$2dc11e110b3b7b5f$var$pathKey],
|
|
pathExt: withoutPathExt ? $aniHR$path.delimiter : undefined
|
|
});
|
|
} catch (e) {
|
|
/* Empty */ } finally{
|
|
process.chdir(cwd);
|
|
}
|
|
// If we successfully resolved, ensure that an absolute path is returned
|
|
// Note that when a custom `cwd` was used, we need to resolve to an absolute path based on it
|
|
if (resolved) resolved = $aniHR$path.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
return resolved;
|
|
}
|
|
function $2dc11e110b3b7b5f$var$resolveCommand(parsed) {
|
|
return $2dc11e110b3b7b5f$var$resolveCommandAttempt(parsed) || $2dc11e110b3b7b5f$var$resolveCommandAttempt(parsed, true);
|
|
}
|
|
module.exports = $2dc11e110b3b7b5f$var$resolveCommand;
|
|
|
|
});
|
|
parcelRegister("9Z52c", function(module, exports) {
|
|
module.exports = $744db75420522d53$var$which;
|
|
$744db75420522d53$var$which.sync = $744db75420522d53$var$whichSync;
|
|
var $744db75420522d53$var$isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
|
|
var $744db75420522d53$var$COLON = $744db75420522d53$var$isWindows ? ";" : ":";
|
|
|
|
var $833Cy = parcelRequire("833Cy");
|
|
function $744db75420522d53$var$getNotFoundError(cmd) {
|
|
var er = new Error("not found: " + cmd);
|
|
er.code = "ENOENT";
|
|
return er;
|
|
}
|
|
function $744db75420522d53$var$getPathInfo(cmd, opt) {
|
|
var colon = opt.colon || $744db75420522d53$var$COLON;
|
|
var pathEnv = opt.path || process.env.PATH || "";
|
|
var pathExt = [
|
|
""
|
|
];
|
|
pathEnv = pathEnv.split(colon);
|
|
var pathExtExe = "";
|
|
if ($744db75420522d53$var$isWindows) {
|
|
pathEnv.unshift(process.cwd());
|
|
pathExtExe = opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM";
|
|
pathExt = pathExtExe.split(colon);
|
|
// Always test the cmd itself first. isexe will check to make sure
|
|
// it's found in the pathExt set.
|
|
if (cmd.indexOf(".") !== -1 && pathExt[0] !== "") pathExt.unshift("");
|
|
}
|
|
// If it has a slash, then we don't bother searching the pathenv.
|
|
// just check the file itself, and that's it.
|
|
if (cmd.match(/\//) || $744db75420522d53$var$isWindows && cmd.match(/\\/)) pathEnv = [
|
|
""
|
|
];
|
|
return {
|
|
env: pathEnv,
|
|
ext: pathExt,
|
|
extExe: pathExtExe
|
|
};
|
|
}
|
|
function $744db75420522d53$var$which(cmd, opt, cb) {
|
|
if (typeof opt === "function") {
|
|
cb = opt;
|
|
opt = {};
|
|
}
|
|
var info = $744db75420522d53$var$getPathInfo(cmd, opt);
|
|
var pathEnv = info.env;
|
|
var pathExt = info.ext;
|
|
var pathExtExe = info.extExe;
|
|
var found = [];
|
|
(function F(i, l) {
|
|
if (i === l) {
|
|
if (opt.all && found.length) return cb(null, found);
|
|
else return cb($744db75420522d53$var$getNotFoundError(cmd));
|
|
}
|
|
var pathPart = pathEnv[i];
|
|
if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"') pathPart = pathPart.slice(1, -1);
|
|
var p = $aniHR$path.join(pathPart, cmd);
|
|
if (!pathPart && /^\.[\\\/]/.test(cmd)) p = cmd.slice(0, 2) + p;
|
|
(function E(ii, ll) {
|
|
if (ii === ll) return F(i + 1, l);
|
|
var ext = pathExt[ii];
|
|
$833Cy(p + ext, {
|
|
pathExt: pathExtExe
|
|
}, function(er, is) {
|
|
if (!er && is) {
|
|
if (opt.all) found.push(p + ext);
|
|
else return cb(null, p + ext);
|
|
}
|
|
return E(ii + 1, ll);
|
|
});
|
|
})(0, pathExt.length);
|
|
})(0, pathEnv.length);
|
|
}
|
|
function $744db75420522d53$var$whichSync(cmd, opt) {
|
|
opt = opt || {};
|
|
var info = $744db75420522d53$var$getPathInfo(cmd, opt);
|
|
var pathEnv = info.env;
|
|
var pathExt = info.ext;
|
|
var pathExtExe = info.extExe;
|
|
var found = [];
|
|
for(var i = 0, l = pathEnv.length; i < l; i++){
|
|
var pathPart = pathEnv[i];
|
|
if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"') pathPart = pathPart.slice(1, -1);
|
|
var p = $aniHR$path.join(pathPart, cmd);
|
|
if (!pathPart && /^\.[\\\/]/.test(cmd)) p = cmd.slice(0, 2) + p;
|
|
for(var j = 0, ll = pathExt.length; j < ll; j++){
|
|
var cur = p + pathExt[j];
|
|
var is;
|
|
try {
|
|
is = $833Cy.sync(cur, {
|
|
pathExt: pathExtExe
|
|
});
|
|
if (is) {
|
|
if (opt.all) found.push(cur);
|
|
else return cur;
|
|
}
|
|
} catch (ex) {}
|
|
}
|
|
}
|
|
if (opt.all && found.length) return found;
|
|
if (opt.nothrow) return null;
|
|
throw $744db75420522d53$var$getNotFoundError(cmd);
|
|
}
|
|
|
|
});
|
|
parcelRegister("833Cy", function(module, exports) {
|
|
|
|
var $5dc16990b9d84694$var$core;
|
|
|
|
|
|
if (process.platform === "win32" || $parcel$global.TESTING_WINDOWS) $5dc16990b9d84694$var$core = (parcelRequire("7WOeY"));
|
|
else $5dc16990b9d84694$var$core = (parcelRequire("grRFE"));
|
|
module.exports = $5dc16990b9d84694$var$isexe;
|
|
$5dc16990b9d84694$var$isexe.sync = $5dc16990b9d84694$var$sync;
|
|
function $5dc16990b9d84694$var$isexe(path, options, cb) {
|
|
if (typeof options === "function") {
|
|
cb = options;
|
|
options = {};
|
|
}
|
|
if (!cb) {
|
|
if (typeof Promise !== "function") throw new TypeError("callback not provided");
|
|
return new Promise(function(resolve, reject) {
|
|
$5dc16990b9d84694$var$isexe(path, options || {}, function(er, is) {
|
|
if (er) reject(er);
|
|
else resolve(is);
|
|
});
|
|
});
|
|
}
|
|
$5dc16990b9d84694$var$core(path, options || {}, function(er, is) {
|
|
// ignore EACCES because that just means we aren't allowed to run it
|
|
if (er) {
|
|
if (er.code === "EACCES" || options && options.ignoreErrors) {
|
|
er = null;
|
|
is = false;
|
|
}
|
|
}
|
|
cb(er, is);
|
|
});
|
|
}
|
|
function $5dc16990b9d84694$var$sync(path, options) {
|
|
// my kingdom for a filtered catch
|
|
try {
|
|
return $5dc16990b9d84694$var$core.sync(path, options || {});
|
|
} catch (er) {
|
|
if (options && options.ignoreErrors || er.code === "EACCES") return false;
|
|
else throw er;
|
|
}
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
parcelRegister("4K157", function(module, exports) {
|
|
|
|
$parcel$export(module.exports, "command", () => $373c4c180cac8d5d$export$ae50443ffc990749, (v) => $373c4c180cac8d5d$export$ae50443ffc990749 = v);
|
|
$parcel$export(module.exports, "argument", () => $373c4c180cac8d5d$export$6ea29ee575e3f5ff, (v) => $373c4c180cac8d5d$export$6ea29ee575e3f5ff = v);
|
|
var $373c4c180cac8d5d$export$ae50443ffc990749;
|
|
var $373c4c180cac8d5d$export$6ea29ee575e3f5ff;
|
|
"use strict";
|
|
// See http://www.robvanderwoude.com/escapechars.php
|
|
const $373c4c180cac8d5d$var$metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
|
|
function $373c4c180cac8d5d$var$escapeCommand(arg) {
|
|
// Escape meta chars
|
|
arg = arg.replace($373c4c180cac8d5d$var$metaCharsRegExp, "^$1");
|
|
return arg;
|
|
}
|
|
function $373c4c180cac8d5d$var$escapeArgument(arg, doubleEscapeMetaChars) {
|
|
// Convert to string
|
|
arg = `${arg}`;
|
|
// Algorithm below is based on https://qntm.org/cmd
|
|
// Sequence of backslashes followed by a double quote:
|
|
// double up all the backslashes and escape the double quote
|
|
arg = arg.replace(/(\\*)"/g, '$1$1\\"');
|
|
// Sequence of backslashes followed by the end of the string
|
|
// (which will become a double quote later):
|
|
// double up all the backslashes
|
|
arg = arg.replace(/(\\*)$/, "$1$1");
|
|
// All other backslashes occur literally
|
|
// Quote the whole thing:
|
|
arg = `"${arg}"`;
|
|
// Escape meta chars
|
|
arg = arg.replace($373c4c180cac8d5d$var$metaCharsRegExp, "^$1");
|
|
// Double escape meta chars if necessary
|
|
if (doubleEscapeMetaChars) arg = arg.replace($373c4c180cac8d5d$var$metaCharsRegExp, "^$1");
|
|
return arg;
|
|
}
|
|
$373c4c180cac8d5d$export$ae50443ffc990749 = $373c4c180cac8d5d$var$escapeCommand;
|
|
$373c4c180cac8d5d$export$6ea29ee575e3f5ff = $373c4c180cac8d5d$var$escapeArgument;
|
|
|
|
});
|
|
|
|
parcelRegister("8WT3q", function(module, exports) {
|
|
"use strict";
|
|
|
|
|
|
var $3E3cW = parcelRequire("3E3cW");
|
|
function $683e72200c3eaa7b$var$readShebang(command) {
|
|
// Read the first 150 bytes from the file
|
|
const size = 150;
|
|
let buffer;
|
|
if (Buffer.alloc) // Node.js v4.5+ / v5.10+
|
|
buffer = Buffer.alloc(size);
|
|
else {
|
|
// Old Node.js API
|
|
buffer = new Buffer(size);
|
|
buffer.fill(0); // zero-fill
|
|
}
|
|
let fd;
|
|
try {
|
|
fd = $aniHR$fs.openSync(command, "r");
|
|
$aniHR$fs.readSync(fd, buffer, 0, size, 0);
|
|
$aniHR$fs.closeSync(fd);
|
|
} catch (e) {}
|
|
// Attempt to extract shebang (null is returned if not a shebang)
|
|
return $3E3cW(buffer.toString());
|
|
}
|
|
module.exports = $683e72200c3eaa7b$var$readShebang;
|
|
|
|
});
|
|
parcelRegister("3E3cW", function(module, exports) {
|
|
"use strict";
|
|
|
|
var $aRoWl = parcelRequire("aRoWl");
|
|
module.exports = function(str) {
|
|
var match = str.match($aRoWl);
|
|
if (!match) return null;
|
|
var arr = match[0].replace(/#! ?/, "").split(" ");
|
|
var bin = arr[0].split("/").pop();
|
|
var arg = arr[1];
|
|
return bin === "env" ? arg : bin + (arg ? " " + arg : "");
|
|
};
|
|
|
|
});
|
|
parcelRegister("aRoWl", function(module, exports) {
|
|
"use strict";
|
|
module.exports = /^#!.*/;
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
parcelRegister("2QLxV", function(module, exports) {
|
|
"use strict";
|
|
const $213551c859378048$var$isWin = process.platform === "win32";
|
|
function $213551c859378048$var$notFoundError(original, syscall) {
|
|
return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
|
|
code: "ENOENT",
|
|
errno: "ENOENT",
|
|
syscall: `${syscall} ${original.command}`,
|
|
path: original.command,
|
|
spawnargs: original.args
|
|
});
|
|
}
|
|
function $213551c859378048$var$hookChildProcess(cp, parsed) {
|
|
if (!$213551c859378048$var$isWin) return;
|
|
const originalEmit = cp.emit;
|
|
cp.emit = function(name, arg1) {
|
|
// If emitting "exit" event and exit code is 1, we need to check if
|
|
// the command exists and emit an "error" instead
|
|
// See https://github.com/IndigoUnited/node-cross-spawn/issues/16
|
|
if (name === "exit") {
|
|
const err = $213551c859378048$var$verifyENOENT(arg1, parsed, "spawn");
|
|
if (err) return originalEmit.call(cp, "error", err);
|
|
}
|
|
return originalEmit.apply(cp, arguments); // eslint-disable-line prefer-rest-params
|
|
};
|
|
}
|
|
function $213551c859378048$var$verifyENOENT(status, parsed) {
|
|
if ($213551c859378048$var$isWin && status === 1 && !parsed.file) return $213551c859378048$var$notFoundError(parsed.original, "spawn");
|
|
return null;
|
|
}
|
|
function $213551c859378048$var$verifyENOENTSync(status, parsed) {
|
|
if ($213551c859378048$var$isWin && status === 1 && !parsed.file) return $213551c859378048$var$notFoundError(parsed.original, "spawnSync");
|
|
return null;
|
|
}
|
|
module.exports = {
|
|
hookChildProcess: $213551c859378048$var$hookChildProcess,
|
|
verifyENOENT: $213551c859378048$var$verifyENOENT,
|
|
verifyENOENTSync: $213551c859378048$var$verifyENOENTSync,
|
|
notFoundError: $213551c859378048$var$notFoundError
|
|
};
|
|
|
|
});
|
|
|
|
|
|
parcelRegister("a4ERc", function(module, exports) {
|
|
|
|
$parcel$export(module.exports, "default", () => $7559f87c6726b784$export$2e2bcd8739ae039);
|
|
function $7559f87c6726b784$export$2e2bcd8739ae039(childProcess) {
|
|
return new Promise((resolve, reject)=>{
|
|
childProcess.on("error", reject);
|
|
childProcess.on("close", (code)=>{
|
|
if (code !== 0) {
|
|
reject(new Error("Child process failed"));
|
|
return;
|
|
}
|
|
resolve();
|
|
});
|
|
});
|
|
}
|
|
|
|
});
|
|
|
|
parcelRegister("hgTxA", function(module, exports) {
|
|
module.exports = JSON.parse('{"name":"@parcel/package-manager","version":"2.12.0","description":"Blazing fast, zero configuration web application bundler","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"repository":{"type":"git","url":"https://github.com/parcel-bundler/parcel.git"},"main":"lib/index.js","source":"src/index.js","types":"index.d.ts","engines":{"node":">= 12.0.0"},"scripts":{"build-ts":"mkdir -p lib && flow-to-ts src/types.js > lib/types.d.ts","check-ts":"tsc --noEmit index.d.ts","test":"mocha test"},"targets":{"types":false,"main":{"includeNodeModules":{"@parcel/core":false,"@parcel/diagnostic":false,"@parcel/fs":false,"@parcel/logger":false,"@parcel/node-resolver-core":false,"@parcel/types":false,"@parcel/utils":false,"@parcel/workers":false,"@swc/core":false,"semver":false}}},"dependencies":{"@parcel/diagnostic":"2.12.0","@parcel/fs":"2.12.0","@parcel/logger":"2.12.0","@parcel/node-resolver-core":"3.3.0","@parcel/types":"2.12.0","@parcel/utils":"2.12.0","@parcel/workers":"2.12.0","@swc/core":"^1.3.36","semver":"^7.5.2"},"devDependencies":{"command-exists":"^1.2.6","cross-spawn":"^6.0.4","nullthrows":"^1.1.1","split2":"^3.1.1"},"peerDependencies":{"@parcel/core":"^2.12.0"},"browser":{"./src/NodePackageManager.js":false,"./src/Npm.js":false,"./src/Pnpm.js":false,"./src/Yarn.js":false},"gitHead":"2059029ee91e5f03a273b0954d3e629d7375f986"}');
|
|
|
|
});
|
|
|
|
|
|
parcelRegister("k9NrW", function(module, exports) {
|
|
|
|
$parcel$export(module.exports, "Yarn", () => $eacb01941f879d41$export$8db243e2edc9d1b8);
|
|
|
|
var $jNC8s = parcelRequire("jNC8s");
|
|
|
|
var $cmSYh = parcelRequire("cmSYh");
|
|
|
|
|
|
var $l8ujM = parcelRequire("l8ujM");
|
|
|
|
var $4QDYX = parcelRequire("4QDYX");
|
|
|
|
var $a4ERc = parcelRequire("a4ERc");
|
|
|
|
|
|
var $a5njb = parcelRequire("a5njb");
|
|
|
|
var $hgTxA = parcelRequire("hgTxA");
|
|
const $eacb01941f879d41$var$YARN_CMD = "yarn";
|
|
let $eacb01941f879d41$var$hasYarn;
|
|
let $eacb01941f879d41$var$yarnVersion;
|
|
class $eacb01941f879d41$export$8db243e2edc9d1b8 {
|
|
static async exists() {
|
|
if ($eacb01941f879d41$var$hasYarn != null) return $eacb01941f879d41$var$hasYarn;
|
|
try {
|
|
$eacb01941f879d41$var$hasYarn = Boolean(await (0, (/*@__PURE__*/$parcel$interopDefault($jNC8s)))("yarn"));
|
|
} catch (err) {
|
|
$eacb01941f879d41$var$hasYarn = false;
|
|
}
|
|
return $eacb01941f879d41$var$hasYarn;
|
|
}
|
|
async install({ modules: modules, cwd: cwd, saveDev: saveDev = true }) {
|
|
if ($eacb01941f879d41$var$yarnVersion == null) {
|
|
let version = await (0, $a5njb.exec)("yarn --version");
|
|
$eacb01941f879d41$var$yarnVersion = parseInt(version.stdout, 10);
|
|
}
|
|
let args = [
|
|
"add",
|
|
"--json"
|
|
].concat(modules.map((0, $a5njb.npmSpecifierFromModuleRequest)));
|
|
if (saveDev) {
|
|
args.push("-D");
|
|
if ($eacb01941f879d41$var$yarnVersion < 2) args.push("-W");
|
|
}
|
|
// When Parcel is run by Yarn (e.g. via package.json scripts), several environment variables are
|
|
// added. When parcel in turn calls Yarn again, these can cause Yarn to behave stragely, so we
|
|
// filter them out when installing packages.
|
|
let env = {};
|
|
for(let key in process.env)if (!key.startsWith("npm_") && key !== "YARN_WRAP_OUTPUT" && key !== "INIT_CWD" && key !== "NODE_ENV") env[key] = process.env[key];
|
|
let installProcess = (0, (/*@__PURE__*/$parcel$interopDefault($cmSYh)))($eacb01941f879d41$var$YARN_CMD, args, {
|
|
cwd: cwd,
|
|
env: env
|
|
});
|
|
installProcess.stdout// Invoking yarn with --json provides streaming, newline-delimited JSON output.
|
|
.pipe((0, (/*@__PURE__*/$parcel$interopDefault($l8ujM)))()).pipe(new (0, $4QDYX.default)()).on("error", (e)=>{
|
|
(0, ($parcel$interopDefault($aniHR$parcellogger))).error(e, "@parcel/package-manager");
|
|
}).on("data", (message)=>{
|
|
switch(message.type){
|
|
case "step":
|
|
(0, ($parcel$interopDefault($aniHR$parcellogger))).progress($eacb01941f879d41$var$prefix(`[${message.data.current}/${message.data.total}] ${message.data.message}`));
|
|
return;
|
|
case "success":
|
|
case "info":
|
|
(0, ($parcel$interopDefault($aniHR$parcellogger))).info({
|
|
origin: "@parcel/package-manager",
|
|
message: $eacb01941f879d41$var$prefix(message.data)
|
|
});
|
|
return;
|
|
default:
|
|
}
|
|
});
|
|
installProcess.stderr.pipe((0, (/*@__PURE__*/$parcel$interopDefault($l8ujM)))()).pipe(new (0, $4QDYX.default)()).on("error", (e)=>{
|
|
(0, ($parcel$interopDefault($aniHR$parcellogger))).error(e, "@parcel/package-manager");
|
|
}).on("data", (message)=>{
|
|
switch(message.type){
|
|
case "warning":
|
|
(0, ($parcel$interopDefault($aniHR$parcellogger))).warn({
|
|
origin: "@parcel/package-manager",
|
|
message: $eacb01941f879d41$var$prefix(message.data)
|
|
});
|
|
return;
|
|
case "error":
|
|
(0, ($parcel$interopDefault($aniHR$parcellogger))).error({
|
|
origin: "@parcel/package-manager",
|
|
message: $eacb01941f879d41$var$prefix(message.data)
|
|
});
|
|
return;
|
|
default:
|
|
}
|
|
});
|
|
try {
|
|
return await (0, $a4ERc.default)(installProcess);
|
|
} catch (e) {
|
|
throw new Error("Yarn failed to install modules:" + e.message);
|
|
}
|
|
}
|
|
}
|
|
function $eacb01941f879d41$var$prefix(message) {
|
|
return "yarn: " + message;
|
|
}
|
|
(0, $aniHR$parcelcore.registerSerializableClass)(`${(0, (/*@__PURE__*/$parcel$interopDefault($hgTxA))).version}:Yarn`, $eacb01941f879d41$export$8db243e2edc9d1b8);
|
|
|
|
});
|
|
parcelRegister("jNC8s", function(module, exports) {
|
|
|
|
module.exports = (parcelRequire("2Fy42"));
|
|
|
|
});
|
|
|
|
parcelRegister("l8ujM", function(module, exports) {
|
|
/*
|
|
Copyright (c) 2014-2018, Matteo Collina <hello@matteocollina.com>
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted, provided that the above
|
|
copyright notice and this permission notice appear in all copies.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
|
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
*/ "use strict";
|
|
|
|
var $caqzW = parcelRequire("caqzW");
|
|
var $f631dcdcf215792b$require$Transform = $caqzW.Transform;
|
|
|
|
var $f631dcdcf215792b$require$StringDecoder = $aniHR$string_decoder.StringDecoder;
|
|
const $f631dcdcf215792b$var$kLast = Symbol("last");
|
|
const $f631dcdcf215792b$var$kDecoder = Symbol("decoder");
|
|
function $f631dcdcf215792b$var$transform(chunk, enc, cb) {
|
|
var list;
|
|
if (this.overflow) {
|
|
var buf = this[$f631dcdcf215792b$var$kDecoder].write(chunk);
|
|
list = buf.split(this.matcher);
|
|
if (list.length === 1) return cb() // Line ending not found. Discard entire chunk.
|
|
;
|
|
// Line ending found. Discard trailing fragment of previous line and reset overflow state.
|
|
list.shift();
|
|
this.overflow = false;
|
|
} else {
|
|
this[$f631dcdcf215792b$var$kLast] += this[$f631dcdcf215792b$var$kDecoder].write(chunk);
|
|
list = this[$f631dcdcf215792b$var$kLast].split(this.matcher);
|
|
}
|
|
this[$f631dcdcf215792b$var$kLast] = list.pop();
|
|
for(var i = 0; i < list.length; i++)try {
|
|
$f631dcdcf215792b$var$push(this, this.mapper(list[i]));
|
|
} catch (error) {
|
|
return cb(error);
|
|
}
|
|
this.overflow = this[$f631dcdcf215792b$var$kLast].length > this.maxLength;
|
|
if (this.overflow && !this.skipOverflow) return cb(new Error("maximum buffer reached"));
|
|
cb();
|
|
}
|
|
function $f631dcdcf215792b$var$flush(cb) {
|
|
// forward any gibberish left in there
|
|
this[$f631dcdcf215792b$var$kLast] += this[$f631dcdcf215792b$var$kDecoder].end();
|
|
if (this[$f631dcdcf215792b$var$kLast]) try {
|
|
$f631dcdcf215792b$var$push(this, this.mapper(this[$f631dcdcf215792b$var$kLast]));
|
|
} catch (error) {
|
|
return cb(error);
|
|
}
|
|
cb();
|
|
}
|
|
function $f631dcdcf215792b$var$push(self, val) {
|
|
if (val !== undefined) self.push(val);
|
|
}
|
|
function $f631dcdcf215792b$var$noop(incoming) {
|
|
return incoming;
|
|
}
|
|
function $f631dcdcf215792b$var$split(matcher, mapper, options) {
|
|
// Set defaults for any arguments not supplied.
|
|
matcher = matcher || /\r?\n/;
|
|
mapper = mapper || $f631dcdcf215792b$var$noop;
|
|
options = options || {};
|
|
// Test arguments explicitly.
|
|
switch(arguments.length){
|
|
case 1:
|
|
// If mapper is only argument.
|
|
if (typeof matcher === "function") {
|
|
mapper = matcher;
|
|
matcher = /\r?\n/;
|
|
// If options is only argument.
|
|
} else if (typeof matcher === "object" && !(matcher instanceof RegExp)) {
|
|
options = matcher;
|
|
matcher = /\r?\n/;
|
|
}
|
|
break;
|
|
case 2:
|
|
// If mapper and options are arguments.
|
|
if (typeof matcher === "function") {
|
|
options = mapper;
|
|
mapper = matcher;
|
|
matcher = /\r?\n/;
|
|
// If matcher and options are arguments.
|
|
} else if (typeof mapper === "object") {
|
|
options = mapper;
|
|
mapper = $f631dcdcf215792b$var$noop;
|
|
}
|
|
}
|
|
options = Object.assign({}, options);
|
|
options.transform = $f631dcdcf215792b$var$transform;
|
|
options.flush = $f631dcdcf215792b$var$flush;
|
|
options.readableObjectMode = true;
|
|
const stream = new $f631dcdcf215792b$require$Transform(options);
|
|
stream[$f631dcdcf215792b$var$kLast] = "";
|
|
stream[$f631dcdcf215792b$var$kDecoder] = new $f631dcdcf215792b$require$StringDecoder("utf8");
|
|
stream.matcher = matcher;
|
|
stream.mapper = mapper;
|
|
stream.maxLength = options.maxLength;
|
|
stream.skipOverflow = options.skipOverflow;
|
|
stream.overflow = false;
|
|
return stream;
|
|
}
|
|
module.exports = $f631dcdcf215792b$var$split;
|
|
|
|
});
|
|
|
|
parcelRegister("4QDYX", function(module, exports) {
|
|
|
|
$parcel$export(module.exports, "default", () => $387b085f6014315b$export$2e2bcd8739ae039);
|
|
|
|
|
|
class $387b085f6014315b$export$2e2bcd8739ae039 extends (0, $aniHR$stream.Transform) {
|
|
constructor(options){
|
|
super({
|
|
...options,
|
|
objectMode: true
|
|
});
|
|
}
|
|
// $FlowFixMe We are in object mode, so we emit objects, not strings
|
|
_transform(chunk, encoding, callback) {
|
|
try {
|
|
let parsed;
|
|
try {
|
|
parsed = JSON.parse(chunk.toString());
|
|
} catch (e) {
|
|
// Be permissive and ignoreJSON parse errors in case there was
|
|
// a non-JSON line in the package manager's stdout.
|
|
(0, ($parcel$interopDefault($aniHR$parcellogger))).verbose({
|
|
message: "Ignored invalid JSON message: " + chunk.toString(),
|
|
origin: "@parcel/package-manager"
|
|
});
|
|
return;
|
|
}
|
|
callback(null, parsed);
|
|
} catch (err) {
|
|
callback(err);
|
|
}
|
|
}
|
|
}
|
|
|
|
});
|
|
|
|
|
|
parcelRegister("li6gH", function(module, exports) {
|
|
|
|
$parcel$export(module.exports, "Pnpm", () => $f800242c956cac7c$export$ad678da47ffaf985);
|
|
|
|
|
|
|
|
var $jNC8s = parcelRequire("jNC8s");
|
|
|
|
var $cmSYh = parcelRequire("cmSYh");
|
|
|
|
|
|
var $l8ujM = parcelRequire("l8ujM");
|
|
|
|
var $4QDYX = parcelRequire("4QDYX");
|
|
|
|
var $a4ERc = parcelRequire("a4ERc");
|
|
|
|
|
|
var $a5njb = parcelRequire("a5njb");
|
|
|
|
var $hgTxA = parcelRequire("hgTxA");
|
|
const $f800242c956cac7c$var$PNPM_CMD = "pnpm";
|
|
let $f800242c956cac7c$var$hasPnpm;
|
|
let $f800242c956cac7c$var$pnpmVersion;
|
|
class $f800242c956cac7c$export$ad678da47ffaf985 {
|
|
static async exists() {
|
|
if ($f800242c956cac7c$var$hasPnpm != null) return $f800242c956cac7c$var$hasPnpm;
|
|
try {
|
|
$f800242c956cac7c$var$hasPnpm = Boolean(await (0, (/*@__PURE__*/$parcel$interopDefault($jNC8s)))("pnpm"));
|
|
} catch (err) {
|
|
$f800242c956cac7c$var$hasPnpm = false;
|
|
}
|
|
return $f800242c956cac7c$var$hasPnpm;
|
|
}
|
|
async install({ modules: modules, cwd: cwd, saveDev: saveDev = true }) {
|
|
if ($f800242c956cac7c$var$pnpmVersion == null) {
|
|
let version = await (0, $a5njb.exec)("pnpm --version");
|
|
$f800242c956cac7c$var$pnpmVersion = parseInt(version.stdout, 10);
|
|
}
|
|
let args = [
|
|
"add",
|
|
"--reporter",
|
|
"ndjson"
|
|
];
|
|
if (saveDev) args.push("-D");
|
|
if ($f800242c956cac7c$var$pnpmVersion >= 7) {
|
|
if ((0, ($parcel$interopDefault($aniHR$fs))).existsSync((0, ($parcel$interopDefault($aniHR$path))).join(cwd, "pnpm-workspace.yaml"))) // installs in workspace root (regardless of cwd)
|
|
args.push("-w");
|
|
} else // ignores workspace root check
|
|
args.push("-W");
|
|
args = args.concat(modules.map((0, $a5njb.npmSpecifierFromModuleRequest)));
|
|
let env = {};
|
|
for(let key in process.env)if (!key.startsWith("npm_") && key !== "INIT_CWD" && key !== "NODE_ENV") env[key] = process.env[key];
|
|
let addedCount = 0, removedCount = 0;
|
|
let installProcess = (0, (/*@__PURE__*/$parcel$interopDefault($cmSYh)))($f800242c956cac7c$var$PNPM_CMD, args, {
|
|
cwd: cwd,
|
|
env: env
|
|
});
|
|
installProcess.stdout.pipe((0, (/*@__PURE__*/$parcel$interopDefault($l8ujM)))()).pipe(new (0, $4QDYX.default)()).on("error", (e)=>{
|
|
(0, ($parcel$interopDefault($aniHR$parcellogger))).warn({
|
|
origin: "@parcel/package-manager",
|
|
message: e.chunk,
|
|
stack: e.stack
|
|
});
|
|
}).on("data", (json)=>{
|
|
if (json.level === "error") (0, ($parcel$interopDefault($aniHR$parcellogger))).error({
|
|
origin: "@parcel/package-manager",
|
|
message: json.err.message,
|
|
stack: json.err.stack
|
|
});
|
|
else if (json.level === "info" && typeof json.message === "string") (0, ($parcel$interopDefault($aniHR$parcellogger))).info({
|
|
origin: "@parcel/package-manager",
|
|
message: $f800242c956cac7c$var$prefix(json.message)
|
|
});
|
|
else if (json.name === "pnpm:stats") {
|
|
var _json_added;
|
|
addedCount += (_json_added = json.added) !== null && _json_added !== void 0 ? _json_added : 0;
|
|
var _json_removed;
|
|
removedCount += (_json_removed = json.removed) !== null && _json_removed !== void 0 ? _json_removed : 0;
|
|
}
|
|
});
|
|
let stderr = [];
|
|
installProcess.stderr.on("data", (str)=>{
|
|
stderr.push(str.toString());
|
|
}).on("error", (e)=>{
|
|
(0, ($parcel$interopDefault($aniHR$parcellogger))).warn({
|
|
origin: "@parcel/package-manager",
|
|
message: e.message
|
|
});
|
|
});
|
|
try {
|
|
await (0, $a4ERc.default)(installProcess);
|
|
if (addedCount > 0 || removedCount > 0) (0, ($parcel$interopDefault($aniHR$parcellogger))).log({
|
|
origin: "@parcel/package-manager",
|
|
message: `Added ${addedCount} ${removedCount > 0 ? `and removed ${removedCount} ` : ""}packages via pnpm`
|
|
});
|
|
// Since we succeeded, stderr might have useful information not included
|
|
// in the json written to stdout. It's also not necessary to log these as
|
|
// errors as they often aren't.
|
|
for (let message of stderr)(0, ($parcel$interopDefault($aniHR$parcellogger))).log({
|
|
origin: "@parcel/package-manager",
|
|
message: message
|
|
});
|
|
} catch (e) {
|
|
throw new Error("pnpm failed to install modules");
|
|
}
|
|
}
|
|
}
|
|
function $f800242c956cac7c$var$prefix(message) {
|
|
return "pnpm: " + message;
|
|
}
|
|
(0, $aniHR$parcelcore.registerSerializableClass)(`${(0, (/*@__PURE__*/$parcel$interopDefault($hgTxA))).version}:Pnpm`, $f800242c956cac7c$export$ad678da47ffaf985);
|
|
|
|
});
|
|
|
|
parcelRegister("ink4g", function(module, exports) {
|
|
|
|
$parcel$export(module.exports, "default", () => $d609f1020f83774e$export$2e2bcd8739ae039);
|
|
function $d609f1020f83774e$export$2e2bcd8739ae039(userAgent = process.env.npm_config_user_agent) {
|
|
if (!userAgent) return undefined;
|
|
const pmSpec = userAgent.split(" ")[0];
|
|
const separatorPos = pmSpec.lastIndexOf("/");
|
|
const name = pmSpec.substring(0, separatorPos);
|
|
return {
|
|
name: name,
|
|
version: pmSpec.substring(separatorPos + 1)
|
|
};
|
|
}
|
|
|
|
});
|
|
|
|
parcelRegister("8T6bp", function(module, exports) {
|
|
|
|
$parcel$export(module.exports, "default", () => $67884199ced3262c$export$2e2bcd8739ae039);
|
|
const $67884199ced3262c$var$MODULE_REGEX = /^((@[^/\s]+\/){0,1}([^/\s.~]+[^/\s]*)){1}(@[^/\s]+){0,1}/;
|
|
function $67884199ced3262c$export$2e2bcd8739ae039(moduleName) {
|
|
let matches = $67884199ced3262c$var$MODULE_REGEX.exec(moduleName);
|
|
if (matches) return matches[0];
|
|
return "";
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$parcel$export(module.exports, "_addToInstallQueue", () => (parcelRequire("7o0cY"))._addToInstallQueue);
|
|
|
|
var $4Rmkl = parcelRequire("4Rmkl");
|
|
|
|
var $li6gH = parcelRequire("li6gH");
|
|
|
|
var $k9NrW = parcelRequire("k9NrW");
|
|
var $9a174a324d17095e$exports = {};
|
|
|
|
$parcel$export($9a174a324d17095e$exports, "MockPackageInstaller", () => $9a174a324d17095e$export$75a986c28df5fb9b);
|
|
|
|
|
|
|
|
|
|
var $hgTxA = parcelRequire("hgTxA");
|
|
|
|
var $a5njb = parcelRequire("a5njb");
|
|
class $9a174a324d17095e$export$75a986c28df5fb9b {
|
|
packages = new Map();
|
|
register(packageName, fs, packagePath) {
|
|
this.packages.set(packageName, {
|
|
fs: fs,
|
|
packagePath: packagePath
|
|
});
|
|
}
|
|
async install({ modules: modules, fs: fs, cwd: cwd, packagePath: packagePath, saveDev: saveDev = true }) {
|
|
if (packagePath == null) {
|
|
packagePath = (0, ($parcel$interopDefault($aniHR$path))).join(cwd, "package.json");
|
|
await fs.writeFile(packagePath, "{}");
|
|
}
|
|
let pkg = JSON.parse(await fs.readFile(packagePath, "utf8"));
|
|
let key = saveDev ? "devDependencies" : "dependencies";
|
|
if (!pkg[key]) pkg[key] = {};
|
|
for (let module of modules)pkg[key][module.name] = "^" + await this.installPackage(module, fs, packagePath);
|
|
await fs.writeFile(packagePath, JSON.stringify(pkg));
|
|
}
|
|
async installPackage(moduleRequest, fs, packagePath) {
|
|
let pkg = this.packages.get(moduleRequest.name);
|
|
if (!pkg) throw new Error("Unknown package " + moduleRequest.name);
|
|
let dest = (0, ($parcel$interopDefault($aniHR$path))).join((0, ($parcel$interopDefault($aniHR$path))).dirname(packagePath), "node_modules", moduleRequest.name);
|
|
await (0, $aniHR$parcelfs.ncp)(pkg.fs, pkg.packagePath, fs, dest);
|
|
let packageJSON = JSON.parse(await fs.readFile((0, ($parcel$interopDefault($aniHR$path))).join(dest, "package.json"), "utf8"));
|
|
if (packageJSON.dependencies != null) for (let dep of (0, $a5njb.moduleRequestsFromDependencyMap)(packageJSON.dependencies))await this.installPackage(dep, fs, packagePath);
|
|
return packageJSON.version;
|
|
}
|
|
}
|
|
(0, $aniHR$parcelcore.registerSerializableClass)(`${(0, (/*@__PURE__*/$parcel$interopDefault($hgTxA))).version}:MockPackageInstaller`, $9a174a324d17095e$export$75a986c28df5fb9b);
|
|
|
|
|
|
|
|
var $2Tg8r = parcelRequire("2Tg8r");
|
|
|
|
var $7o0cY = parcelRequire("7o0cY");
|
|
$parcel$exportWildcard(module.exports, $4Rmkl);
|
|
$parcel$exportWildcard(module.exports, $li6gH);
|
|
$parcel$exportWildcard(module.exports, $k9NrW);
|
|
$parcel$exportWildcard(module.exports, $9a174a324d17095e$exports);
|
|
$parcel$exportWildcard(module.exports, $2Tg8r);
|
|
|
|
|
|
//# sourceMappingURL=index.js.map
|