diff --git a/__tests__/readConfig.test.ts b/__tests__/readConfig.test.ts
index 5846637..088133d 100644
--- a/__tests__/readConfig.test.ts
+++ b/__tests__/readConfig.test.ts
@@ -1,13 +1,19 @@
import * as fs from 'fs';
import { readConfig, readJSONSync } from '../src/readConfig';
-jest.mock('fs', () => ({
- existsSync: jest.fn(),
- readFileSync: jest.fn(),
- promises: {
- access: jest.fn()
- }
-}));
+jest.mock('fs', () => {
+ const actualFs = jest.requireActual('fs');
+ return {
+ ...actualFs,
+ existsSync: jest.fn(),
+ readFileSync: jest.fn(),
+ promises: {
+ ...actualFs.promises,
+ access: jest.fn()
+ }
+ };
+});
+
jest.mock('@actions/core');
describe('readJSONSync', () => {
diff --git a/dist/index.js b/dist/index.js
index 943bc84..c6435e0 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -112,28 +112,3063 @@ function getReportFooter() {
/***/ }),
-/***/ 93562:
+/***/ 73765:
/***/ ((__unused_webpack_module, __webpack_exports__, __nccwpck_require__) => {
"use strict";
-/* harmony export */ __nccwpck_require__.d(__webpack_exports__, {
-/* harmony export */ "O": () => (/* binding */ duplicatedCheck)
-/* harmony export */ });
-/* unused harmony export REPORT_ARTIFACT_NAME */
-/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(42186);
-/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nccwpck_require__.n(_actions_core__WEBPACK_IMPORTED_MODULE_0__);
-/* harmony import */ var _actions_github__WEBPACK_IMPORTED_MODULE_1__ = __nccwpck_require__(95438);
-/* harmony import */ var _actions_github__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__nccwpck_require__.n(_actions_github__WEBPACK_IMPORTED_MODULE_1__);
-/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_2__ = __nccwpck_require__(57147);
-/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__nccwpck_require__.n(fs__WEBPACK_IMPORTED_MODULE_2__);
-/* harmony import */ var jscpd__WEBPACK_IMPORTED_MODULE_3__ = __nccwpck_require__(84849);
-/* harmony import */ var jscpd__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__nccwpck_require__.n(jscpd__WEBPACK_IMPORTED_MODULE_3__);
-/* harmony import */ var util__WEBPACK_IMPORTED_MODULE_4__ = __nccwpck_require__(73837);
-/* harmony import */ var util__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__nccwpck_require__.n(util__WEBPACK_IMPORTED_MODULE_4__);
-/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_5__ = __nccwpck_require__(86979);
-/* harmony import */ var _execute__WEBPACK_IMPORTED_MODULE_6__ = __nccwpck_require__(3532);
-/* harmony import */ var _git__WEBPACK_IMPORTED_MODULE_7__ = __nccwpck_require__(63350);
-/* harmony import */ var _readConfig__WEBPACK_IMPORTED_MODULE_8__ = __nccwpck_require__(22094);
+
+// EXPORTS
+__nccwpck_require__.d(__webpack_exports__, {
+ "O": () => (/* binding */ duplicatedCheck)
+});
+
+// UNUSED EXPORTS: REPORT_ARTIFACT_NAME
+
+// EXTERNAL MODULE: ./node_modules/@actions/core/lib/core.js
+var core = __nccwpck_require__(42186);
+// EXTERNAL MODULE: ./node_modules/@actions/github/lib/github.js
+var github = __nccwpck_require__(95438);
+// EXTERNAL MODULE: external "fs"
+var external_fs_ = __nccwpck_require__(57147);
+// EXTERNAL MODULE: ./node_modules/eventemitter3/index.js
+var eventemitter3 = __nccwpck_require__(11848);
+;// CONCATENATED MODULE: ./node_modules/eventemitter3/index.mjs
+
+
+
+/* harmony default export */ const node_modules_eventemitter3 = (eventemitter3);
+
+;// CONCATENATED MODULE: ./node_modules/@jscpd/core/dist/index.mjs
+// src/validators/lines-length-clone.validator.ts
+var LinesLengthCloneValidator = class {
+ validate(clone, options) {
+ const lines = clone.duplicationA.end.line - clone.duplicationA.start.line;
+ const status = lines >= Number(options?.minLines);
+ return {
+ status,
+ message: status ? ["ok"] : [`Lines of code less than limit (${lines} < ${options.minLines})`]
+ };
+ }
+};
+
+// src/validators/validator.ts
+function runCloneValidators(clone, options, validators) {
+ return validators.reduce((acc, validator) => {
+ const res = validator.validate(clone, options);
+ return {
+ ...acc,
+ status: res.status && acc.status,
+ message: res.message ? [...acc.message, ...res.message] : acc.message
+ };
+ }, { status: true, message: [], clone });
+}
+
+// src/rabin-karp.ts
+var RabinKarp = class _RabinKarp {
+ constructor(options, eventEmitter, cloneValidators) {
+ this.options = options;
+ this.eventEmitter = eventEmitter;
+ this.cloneValidators = cloneValidators;
+ }
+ async run(tokenMap, store) {
+ return new Promise((resolve) => {
+ let mapFrameInStore;
+ let clone = null;
+ const clones = [];
+ const loop = () => {
+ const iteration = tokenMap.next();
+ store.get(iteration.value.id).then(
+ (mapFrameFromStore) => {
+ mapFrameInStore = mapFrameFromStore;
+ if (!clone) {
+ clone = _RabinKarp.createClone(tokenMap.getFormat(), iteration.value, mapFrameInStore);
+ }
+ },
+ () => {
+ if (clone && this.validate(clone)) {
+ clones.push(clone);
+ }
+ clone = null;
+ if (iteration.value.id) {
+ return store.set(iteration.value.id, iteration.value);
+ }
+ }
+ ).finally(() => {
+ if (!iteration.done) {
+ if (clone) {
+ clone = _RabinKarp.enlargeClone(clone, iteration.value, mapFrameInStore);
+ }
+ loop();
+ } else {
+ resolve(clones);
+ }
+ });
+ };
+ loop();
+ });
+ }
+ validate(clone) {
+ const validation = runCloneValidators(clone, this.options, this.cloneValidators);
+ if (validation.status) {
+ this.eventEmitter.emit("CLONE_FOUND", { clone });
+ } else {
+ this.eventEmitter.emit("CLONE_SKIPPED", { clone, validation });
+ }
+ return validation.status;
+ }
+ static createClone(format, mapFrameA, mapFrameB) {
+ return {
+ format,
+ foundDate: (/* @__PURE__ */ new Date()).getTime(),
+ duplicationA: {
+ sourceId: mapFrameA.sourceId,
+ start: mapFrameA?.start?.loc?.start,
+ end: mapFrameA?.end?.loc?.end,
+ range: [mapFrameA.start.range[0], mapFrameA.end.range[1]]
+ },
+ duplicationB: {
+ sourceId: mapFrameB.sourceId,
+ start: mapFrameB?.start?.loc?.start,
+ end: mapFrameB?.end?.loc?.end,
+ range: [mapFrameB.start.range[0], mapFrameB.end.range[1]]
+ }
+ };
+ }
+ static enlargeClone(clone, mapFrameA, mapFrameB) {
+ clone.duplicationA.range[1] = mapFrameA.end.range[1];
+ clone.duplicationA.end = mapFrameA?.end?.loc?.end;
+ clone.duplicationB.range[1] = mapFrameB.end.range[1];
+ clone.duplicationB.end = mapFrameB?.end?.loc?.end;
+ return clone;
+ }
+};
+
+// src/mode.ts
+function strict(token) {
+ return token.type !== "ignore";
+}
+function mild(token) {
+ return strict(token) && token.type !== "empty" && token.type !== "new_line";
+}
+function weak(token) {
+ return mild(token) && token.format !== "comment" && token.type !== "comment" && token.type !== "block-comment";
+}
+var MODES = {
+ mild,
+ strict,
+ weak
+};
+function getModeByName(name) {
+ if (name in MODES) {
+ return MODES[name];
+ }
+ throw new Error(`Mode ${name} does not supported yet.`);
+}
+function getModeHandler(mode) {
+ return typeof mode === "string" ? getModeByName(mode) : mode;
+}
+
+// src/detector.ts
+
+var Detector = class extends node_modules_eventemitter3 {
+ constructor(tokenizer, store, cloneValidators = [], options) {
+ super();
+ this.tokenizer = tokenizer;
+ this.store = store;
+ this.cloneValidators = cloneValidators;
+ this.options = options;
+ this.initCloneValidators();
+ this.algorithm = new RabinKarp(this.options, this, this.cloneValidators);
+ this.options.minTokens = this.options.minTokens || 50;
+ this.options.maxLines = this.options.maxLines || 500;
+ this.options.minLines = this.options.minLines || 5;
+ this.options.mode = this.options.mode || mild;
+ }
+ algorithm;
+ async detect(id, text, format) {
+ const tokenMaps = this.tokenizer.generateMaps(id, text, format, this.options);
+ this.store.namespace(format);
+ const detect = async (tokenMap, clones) => {
+ if (tokenMap) {
+ this.emit("START_DETECTION", { source: tokenMap });
+ return this.algorithm.run(tokenMap, this.store).then((clns) => {
+ clones.push(...clns);
+ const nextTokenMap = tokenMaps.pop();
+ if (nextTokenMap) {
+ return detect(nextTokenMap, clones);
+ } else {
+ return clones;
+ }
+ });
+ }
+ };
+ const currentTokensMap = tokenMaps.pop();
+ return currentTokensMap ? detect(currentTokensMap, []) : [];
+ }
+ initCloneValidators() {
+ if (this.options.minLines || this.options.maxLines) {
+ this.cloneValidators.push(new LinesLengthCloneValidator());
+ }
+ }
+};
+
+// src/options.ts
+function getDefaultOptions() {
+ return {
+ executionId: (/* @__PURE__ */ new Date()).toISOString(),
+ path: [process.cwd()],
+ mode: getModeHandler("mild"),
+ minLines: 5,
+ maxLines: 1e3,
+ maxSize: "100kb",
+ minTokens: 50,
+ output: "./report",
+ reporters: ["console"],
+ ignore: [],
+ threshold: void 0,
+ formatsExts: {},
+ debug: false,
+ silent: false,
+ blame: false,
+ cache: true,
+ absolute: false,
+ noSymlinks: false,
+ skipLocal: false,
+ ignoreCase: false,
+ gitignore: false,
+ reportersOptions: {},
+ exitCode: 0
+ };
+}
+function getOption(name, options) {
+ const defaultOptions = getDefaultOptions();
+ return options ? options[name] || defaultOptions[name] : defaultOptions[name];
+}
+
+// src/statistic.ts
+var Statistic = class _Statistic {
+ static getDefaultStatistic() {
+ return {
+ lines: 0,
+ tokens: 0,
+ sources: 0,
+ clones: 0,
+ duplicatedLines: 0,
+ duplicatedTokens: 0,
+ percentage: 0,
+ percentageTokens: 0,
+ newDuplicatedLines: 0,
+ newClones: 0
+ };
+ }
+ statistic = {
+ detectionDate: (/* @__PURE__ */ new Date()).toISOString(),
+ formats: {},
+ total: _Statistic.getDefaultStatistic()
+ };
+ subscribe() {
+ return {
+ CLONE_FOUND: this.cloneFound.bind(this),
+ START_DETECTION: this.matchSource.bind(this)
+ };
+ }
+ getStatistic() {
+ return this.statistic;
+ }
+ cloneFound(payload) {
+ const { clone } = payload;
+ const id = clone.duplicationA.sourceId;
+ const id2 = clone.duplicationB.sourceId;
+ const linesCount = clone.duplicationA.end.line - clone.duplicationA.start.line;
+ const duplicatedTokens = clone.duplicationA.end.position - clone.duplicationA.start.position;
+ this.statistic.total.clones++;
+ this.statistic.total.duplicatedLines += linesCount;
+ this.statistic.total.duplicatedTokens += duplicatedTokens;
+ this.statistic.formats[clone.format].total.clones++;
+ this.statistic.formats[clone.format].total.duplicatedLines += linesCount;
+ this.statistic.formats[clone.format].total.duplicatedTokens += duplicatedTokens;
+ this.statistic.formats[clone.format].sources[id].clones++;
+ this.statistic.formats[clone.format].sources[id].duplicatedLines += linesCount;
+ this.statistic.formats[clone.format].sources[id].duplicatedTokens += duplicatedTokens;
+ this.statistic.formats[clone.format].sources[id2].clones++;
+ this.statistic.formats[clone.format].sources[id2].duplicatedLines += linesCount;
+ this.statistic.formats[clone.format].sources[id2].duplicatedTokens += duplicatedTokens;
+ this.updatePercentage(clone.format);
+ }
+ matchSource(payload) {
+ const { source } = payload;
+ const format = source.getFormat();
+ if (!(format in this.statistic.formats)) {
+ this.statistic.formats[format] = {
+ sources: {},
+ total: _Statistic.getDefaultStatistic()
+ };
+ }
+ this.statistic.total.sources++;
+ this.statistic.total.lines += source.getLinesCount();
+ this.statistic.total.tokens += source.getTokensCount();
+ this.statistic.formats[format].total.sources++;
+ this.statistic.formats[format].total.lines += source.getLinesCount();
+ this.statistic.formats[format].total.tokens += source.getTokensCount();
+ this.statistic.formats[format].sources[source.getId()] = this.statistic.formats[format].sources[source.getId()] || _Statistic.getDefaultStatistic();
+ this.statistic.formats[format].sources[source.getId()].sources = 1;
+ this.statistic.formats[format].sources[source.getId()].lines += source.getLinesCount();
+ this.statistic.formats[format].sources[source.getId()].tokens += source.getTokensCount();
+ this.updatePercentage(format);
+ }
+ updatePercentage(format) {
+ this.statistic.total.percentage = _Statistic.calculatePercentage(
+ this.statistic.total.lines,
+ this.statistic.total.duplicatedLines
+ );
+ this.statistic.total.percentageTokens = _Statistic.calculatePercentage(
+ this.statistic.total.tokens,
+ this.statistic.total.duplicatedTokens
+ );
+ this.statistic.formats[format].total.percentage = _Statistic.calculatePercentage(
+ this.statistic.formats[format].total.lines,
+ this.statistic.formats[format].total.duplicatedLines
+ );
+ this.statistic.formats[format].total.percentageTokens = _Statistic.calculatePercentage(
+ this.statistic.formats[format].total.tokens,
+ this.statistic.formats[format].total.duplicatedTokens
+ );
+ Object.entries(this.statistic.formats[format].sources).forEach(([id, stat]) => {
+ this.statistic.formats[format].sources[id].percentage = _Statistic.calculatePercentage(
+ stat.lines,
+ stat.duplicatedLines
+ );
+ this.statistic.formats[format].sources[id].percentageTokens = _Statistic.calculatePercentage(
+ stat.tokens,
+ stat.duplicatedTokens
+ );
+ });
+ }
+ static calculatePercentage(total, cloned) {
+ return total ? Math.round(1e4 * cloned / total) / 100 : 0;
+ }
+};
+
+// src/store/memory.ts
+var MemoryStore = class {
+ _namespace = "";
+ values = {};
+ namespace(namespace) {
+ this._namespace = namespace;
+ this.values[namespace] = this.values[namespace] || {};
+ }
+ get(key) {
+ return new Promise((resolve, reject) => {
+ if (key in this.values[this._namespace]) {
+ resolve(this.values[this._namespace][key]);
+ } else {
+ reject(new Error("not found"));
+ }
+ });
+ }
+ set(key, value) {
+ this.values[this._namespace][key] = value;
+ return Promise.resolve(value);
+ }
+ close() {
+ this.values = {};
+ }
+};
+
+//# sourceMappingURL=index.mjs.map
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?colors/safe
+var safe = __nccwpck_require__(75381);
+// EXTERNAL MODULE: ./node_modules/reprism/lib/index.js
+var lib = __nccwpck_require__(18042);
+// EXTERNAL MODULE: external "path"
+var external_path_ = __nccwpck_require__(71017);
+// EXTERNAL MODULE: ./node_modules/spark-md5/spark-md5.js
+var spark_md5 = __nccwpck_require__(70220);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/abap
+var abap = __nccwpck_require__(30062);
+var abap_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(abap, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/actionscript
+var actionscript = __nccwpck_require__(28965);
+var actionscript_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(actionscript, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/ada
+var ada = __nccwpck_require__(59576);
+var ada_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(ada, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/apacheconf
+var apacheconf = __nccwpck_require__(94764);
+var apacheconf_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(apacheconf, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/apl
+var apl = __nccwpck_require__(37789);
+var apl_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(apl, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/applescript
+var applescript = __nccwpck_require__(70432);
+var applescript_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(applescript, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/arff
+var arff = __nccwpck_require__(24411);
+var arff_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(arff, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/asciidoc
+var asciidoc = __nccwpck_require__(89194);
+var asciidoc_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(asciidoc, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/asm6502
+var asm6502 = __nccwpck_require__(29512);
+var asm6502_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(asm6502, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/aspnet
+var aspnet = __nccwpck_require__(10187);
+var aspnet_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(aspnet, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/autohotkey
+var autohotkey = __nccwpck_require__(33617);
+var autohotkey_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(autohotkey, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/autoit
+var autoit = __nccwpck_require__(53533);
+var autoit_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(autoit, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/bash
+var bash = __nccwpck_require__(63443);
+var bash_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(bash, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/basic
+var basic = __nccwpck_require__(38426);
+var basic_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(basic, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/batch
+var batch = __nccwpck_require__(76079);
+var batch_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(batch, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/brainfuck
+var brainfuck = __nccwpck_require__(23610);
+var brainfuck_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(brainfuck, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/bro
+var bro = __nccwpck_require__(84799);
+var bro_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(bro, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/c
+var c = __nccwpck_require__(17236);
+var c_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(c, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/clike
+var clike = __nccwpck_require__(11884);
+var clike_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(clike, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/clojure
+var clojure = __nccwpck_require__(58413);
+var clojure_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(clojure, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/coffeescript
+var coffeescript = __nccwpck_require__(66304);
+var coffeescript_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(coffeescript, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/cpp
+var cpp = __nccwpck_require__(7212);
+var cpp_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(cpp, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/csharp
+var csharp = __nccwpck_require__(9400);
+var csharp_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(csharp, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/csp
+var csp = __nccwpck_require__(22120);
+var csp_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(csp, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/css-extras
+var css_extras = __nccwpck_require__(63292);
+var css_extras_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(css_extras, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/css
+var css = __nccwpck_require__(34610);
+var css_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(css, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/d
+var d = __nccwpck_require__(69753);
+var d_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(d, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/dart
+var dart = __nccwpck_require__(36099);
+var dart_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(dart, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/diff
+var diff = __nccwpck_require__(41086);
+var diff_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(diff, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/django
+var django = __nccwpck_require__(84313);
+var django_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(django, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/docker
+var docker = __nccwpck_require__(82528);
+var docker_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(docker, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/eiffel
+var eiffel = __nccwpck_require__(86391);
+var eiffel_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(eiffel, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/elixir
+var elixir = __nccwpck_require__(40273);
+var elixir_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(elixir, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/erlang
+var erlang = __nccwpck_require__(57012);
+var erlang_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(erlang, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/flow
+var flow = __nccwpck_require__(11390);
+var flow_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(flow, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/fortran
+var fortran = __nccwpck_require__(30202);
+var fortran_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(fortran, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/fsharp
+var fsharp = __nccwpck_require__(34788);
+var fsharp_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(fsharp, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/gedcom
+var gedcom = __nccwpck_require__(50679);
+var gedcom_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(gedcom, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/gherkin
+var gherkin = __nccwpck_require__(10052);
+var gherkin_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(gherkin, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/git
+var git = __nccwpck_require__(79066);
+var git_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(git, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/glsl
+var glsl = __nccwpck_require__(86333);
+var glsl_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(glsl, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/go
+var go = __nccwpck_require__(18125);
+var go_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(go, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/graphql
+var graphql = __nccwpck_require__(29790);
+var graphql_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(graphql, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/groovy
+var groovy = __nccwpck_require__(80607);
+var groovy_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(groovy, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/haml
+var haml = __nccwpck_require__(76058);
+var haml_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(haml, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/handlebars
+var handlebars = __nccwpck_require__(24667);
+var handlebars_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(handlebars, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/haskell
+var haskell = __nccwpck_require__(83604);
+var haskell_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(haskell, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/haxe
+var haxe = __nccwpck_require__(66545);
+var haxe_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(haxe, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/hpkp
+var hpkp = __nccwpck_require__(27707);
+var hpkp_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(hpkp, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/hsts
+var hsts = __nccwpck_require__(43010);
+var hsts_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(hsts, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/http
+var http = __nccwpck_require__(99920);
+var http_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(http, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/ichigojam
+var ichigojam = __nccwpck_require__(4487);
+var ichigojam_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(ichigojam, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/icon
+var icon = __nccwpck_require__(23558);
+var icon_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(icon, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/inform7
+var inform7 = __nccwpck_require__(79357);
+var inform7_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(inform7, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/ini
+var ini = __nccwpck_require__(70653);
+var ini_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(ini, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/io
+var io = __nccwpck_require__(66177);
+var io_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(io, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/j
+var j = __nccwpck_require__(95580);
+var j_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(j, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/java
+var java = __nccwpck_require__(56957);
+var java_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(java, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/javascript
+var javascript = __nccwpck_require__(46510);
+var javascript_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(javascript, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/jolie
+var jolie = __nccwpck_require__(52956);
+var jolie_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(jolie, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/json
+var json = __nccwpck_require__(71104);
+var json_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(json, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/jsx
+var jsx = __nccwpck_require__(86052);
+var jsx_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(jsx, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/julia
+var julia = __nccwpck_require__(32074);
+var julia_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(julia, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/keyman
+var keyman = __nccwpck_require__(35960);
+var keyman_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(keyman, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/kotlin
+var kotlin = __nccwpck_require__(43355);
+var kotlin_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(kotlin, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/latex
+var latex = __nccwpck_require__(71094);
+var latex_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(latex, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/less
+var less = __nccwpck_require__(28782);
+var less_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(less, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/liquid
+var liquid = __nccwpck_require__(24763);
+var liquid_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(liquid, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/lisp
+var lisp = __nccwpck_require__(906);
+var lisp_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(lisp, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/livescript
+var livescript = __nccwpck_require__(39317);
+var livescript_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(livescript, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/lolcode
+var lolcode = __nccwpck_require__(37565);
+var lolcode_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(lolcode, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/lua
+var lua = __nccwpck_require__(32369);
+var lua_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(lua, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/makefile
+var makefile = __nccwpck_require__(99559);
+var makefile_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(makefile, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/markdown
+var markdown = __nccwpck_require__(50671);
+var markdown_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(markdown, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/markup-templating
+var markup_templating = __nccwpck_require__(25481);
+var markup_templating_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(markup_templating, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/markup
+var markup = __nccwpck_require__(29767);
+var markup_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(markup, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/matlab
+var matlab = __nccwpck_require__(51375);
+var matlab_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(matlab, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/mel
+var mel = __nccwpck_require__(46870);
+var mel_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(mel, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/mizar
+var mizar = __nccwpck_require__(32950);
+var mizar_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(mizar, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/monkey
+var monkey = __nccwpck_require__(65487);
+var monkey_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(monkey, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/n4js
+var n4js = __nccwpck_require__(3993);
+var n4js_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(n4js, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/nasm
+var nasm = __nccwpck_require__(42947);
+var nasm_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(nasm, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/nginx
+var nginx = __nccwpck_require__(40947);
+var nginx_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(nginx, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/nim
+var nim = __nccwpck_require__(60276);
+var nim_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(nim, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/nix
+var nix = __nccwpck_require__(54421);
+var nix_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(nix, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/nsis
+var nsis = __nccwpck_require__(49752);
+var nsis_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(nsis, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/objectivec
+var objectivec = __nccwpck_require__(90301);
+var objectivec_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(objectivec, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/ocaml
+var ocaml = __nccwpck_require__(51689);
+var ocaml_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(ocaml, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/opencl
+var opencl = __nccwpck_require__(70078);
+var opencl_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(opencl, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/oz
+var oz = __nccwpck_require__(34039);
+var oz_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(oz, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/parigp
+var parigp = __nccwpck_require__(50490);
+var parigp_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(parigp, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/parser
+var parser = __nccwpck_require__(91454);
+var parser_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(parser, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/pascal
+var pascal = __nccwpck_require__(72122);
+var pascal_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(pascal, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/perl
+var perl = __nccwpck_require__(44169);
+var perl_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(perl, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/php-extras
+var php_extras = __nccwpck_require__(89565);
+var php_extras_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(php_extras, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/php
+var php = __nccwpck_require__(48121);
+var php_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(php, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/powershell
+var powershell = __nccwpck_require__(55283);
+var powershell_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(powershell, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/processing
+var processing = __nccwpck_require__(20846);
+var processing_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(processing, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/prolog
+var prolog = __nccwpck_require__(66647);
+var prolog_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(prolog, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/properties
+var properties = __nccwpck_require__(58618);
+var properties_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(properties, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/protobuf
+var protobuf = __nccwpck_require__(35887);
+var protobuf_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(protobuf, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/pug
+var pug = __nccwpck_require__(65378);
+var pug_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(pug, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/puppet
+var puppet = __nccwpck_require__(31293);
+var puppet_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(puppet, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/pure
+var pure = __nccwpck_require__(84519);
+var pure_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(pure, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/python
+var python = __nccwpck_require__(89022);
+var python_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(python, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/q
+var q = __nccwpck_require__(12783);
+var q_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(q, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/qore
+var qore = __nccwpck_require__(18167);
+var qore_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(qore, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/r
+var r = __nccwpck_require__(47761);
+var r_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(r, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/reason
+var reason = __nccwpck_require__(32777);
+var reason_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(reason, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/renpy
+var renpy = __nccwpck_require__(89096);
+var renpy_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(renpy, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/rest
+var rest = __nccwpck_require__(78772);
+var rest_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(rest, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/rip
+var rip = __nccwpck_require__(17910);
+var rip_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(rip, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/roboconf
+var roboconf = __nccwpck_require__(72825);
+var roboconf_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(roboconf, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/ruby
+var ruby = __nccwpck_require__(49147);
+var ruby_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(ruby, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/rust
+var rust = __nccwpck_require__(58634);
+var rust_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(rust, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/sas
+var sas = __nccwpck_require__(11854);
+var sas_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(sas, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/sass
+var sass = __nccwpck_require__(68825);
+var sass_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(sass, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/scala
+var scala = __nccwpck_require__(42604);
+var scala_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(scala, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/scheme
+var scheme = __nccwpck_require__(74656);
+var scheme_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(scheme, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/scss
+var scss = __nccwpck_require__(53823);
+var scss_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(scss, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/smalltalk
+var smalltalk = __nccwpck_require__(99657);
+var smalltalk_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(smalltalk, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/smarty
+var smarty = __nccwpck_require__(6218);
+var smarty_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(smarty, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/soy
+var soy = __nccwpck_require__(66154);
+var soy_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(soy, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/stylus
+var stylus = __nccwpck_require__(89796);
+var stylus_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(stylus, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/swift
+var swift = __nccwpck_require__(33773);
+var swift_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(swift, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/tcl
+var tcl = __nccwpck_require__(94492);
+var tcl_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(tcl, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/textile
+var textile = __nccwpck_require__(63291);
+var textile_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(textile, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/tsx
+var tsx = __nccwpck_require__(80047);
+var tsx_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(tsx, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/twig
+var twig = __nccwpck_require__(9962);
+var twig_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(twig, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/typescript
+var typescript = __nccwpck_require__(98381);
+var typescript_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(typescript, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/vbnet
+var vbnet = __nccwpck_require__(80219);
+var vbnet_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(vbnet, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/velocity
+var velocity = __nccwpck_require__(23716);
+var velocity_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(velocity, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/verilog
+var verilog = __nccwpck_require__(55790);
+var verilog_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(verilog, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/vhdl
+var vhdl = __nccwpck_require__(60368);
+var vhdl_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(vhdl, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/vim
+var vim = __nccwpck_require__(65969);
+var vim_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(vim, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/visual-basic
+var visual_basic = __nccwpck_require__(99880);
+var visual_basic_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(visual_basic, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/wasm
+var wasm = __nccwpck_require__(99898);
+var wasm_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(wasm, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/wiki
+var wiki = __nccwpck_require__(73237);
+var wiki_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(wiki, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/xeora
+var xeora = __nccwpck_require__(58553);
+var xeora_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(xeora, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/xojo
+var xojo = __nccwpck_require__(33994);
+var xojo_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(xojo, 2);
+// EXTERNAL MODULE: ./node_modules/@vercel/ncc/dist/ncc/@@notfound.js?reprism/languages/yaml
+var yaml = __nccwpck_require__(54129);
+var yaml_namespaceObject = /*#__PURE__*/__nccwpck_require__.t(yaml, 2);
+;// CONCATENATED MODULE: ./node_modules/@jscpd/tokenizer/dist/index.mjs
+var __defProp = Object.defineProperty;
+var __export = (target, all) => {
+ for (var name in all)
+ __defProp(target, name, { get: all[name], enumerable: true });
+};
+
+// src/tokenize.ts
+
+
+// src/formats.ts
+
+var FORMATS = {
+ abap: {
+ exts: []
+ },
+ actionscript: {
+ exts: ["as"]
+ },
+ ada: {
+ exts: ["ada"]
+ },
+ apacheconf: {
+ exts: []
+ },
+ apl: {
+ exts: ["apl"]
+ },
+ applescript: {
+ exts: []
+ },
+ arduino: {
+ exts: []
+ },
+ arff: {
+ exts: []
+ },
+ asciidoc: {
+ exts: []
+ },
+ asm6502: {
+ exts: []
+ },
+ aspnet: {
+ exts: ["asp", "aspx"]
+ },
+ autohotkey: {
+ exts: []
+ },
+ autoit: {
+ exts: []
+ },
+ bash: {
+ exts: ["sh", "ksh", "bash"]
+ },
+ basic: {
+ exts: ["bas"]
+ },
+ batch: {
+ exts: []
+ },
+ bison: {
+ exts: []
+ },
+ brainfuck: {
+ exts: ["b", "bf"]
+ },
+ bro: {
+ exts: []
+ },
+ c: {
+ exts: ["c", "z80"]
+ },
+ "c-header": {
+ exts: ["h"],
+ parent: "c"
+ },
+ clike: {
+ exts: []
+ },
+ clojure: {
+ exts: ["cljs", "clj", "cljc", "cljx", "edn"]
+ },
+ coffeescript: {
+ exts: ["coffee"]
+ },
+ comments: {
+ exts: []
+ },
+ cpp: {
+ exts: ["cpp", "c++", "cc", "cxx"]
+ },
+ "cpp-header": {
+ exts: ["hpp", "h++", "hh", "hxx"],
+ parent: "cpp"
+ },
+ crystal: {
+ exts: ["cr"]
+ },
+ csharp: {
+ exts: ["cs"]
+ },
+ csp: {
+ exts: []
+ },
+ "css-extras": {
+ exts: []
+ },
+ css: {
+ exts: ["css", "gss"]
+ },
+ d: {
+ exts: ["d"]
+ },
+ dart: {
+ exts: ["dart"]
+ },
+ diff: {
+ exts: ["diff", "patch"]
+ },
+ django: {
+ exts: []
+ },
+ docker: {
+ exts: []
+ },
+ eiffel: {
+ exts: ["e"]
+ },
+ elixir: {
+ exts: []
+ },
+ elm: {
+ exts: ["elm"]
+ },
+ erb: {
+ exts: []
+ },
+ erlang: {
+ exts: ["erl", "erlang"]
+ },
+ flow: {
+ exts: []
+ },
+ fortran: {
+ exts: ["f", "for", "f77", "f90"]
+ },
+ fsharp: {
+ exts: ["fs"]
+ },
+ gedcom: {
+ exts: []
+ },
+ gherkin: {
+ exts: ["feature"]
+ },
+ git: {
+ exts: []
+ },
+ glsl: {
+ exts: []
+ },
+ go: {
+ exts: ["go"]
+ },
+ graphql: {
+ exts: ["graphql"]
+ },
+ groovy: {
+ exts: ["groovy", "gradle"]
+ },
+ haml: {
+ exts: ["haml"]
+ },
+ handlebars: {
+ exts: ["hb", "hbs", "handlebars"]
+ },
+ haskell: {
+ exts: ["hs", "lhs "]
+ },
+ haxe: {
+ exts: ["hx", "hxml"]
+ },
+ hpkp: {
+ exts: []
+ },
+ hsts: {
+ exts: []
+ },
+ http: {
+ exts: []
+ },
+ ichigojam: {
+ exts: []
+ },
+ icon: {
+ exts: []
+ },
+ inform7: {
+ exts: []
+ },
+ ini: {
+ exts: ["ini"]
+ },
+ io: {
+ exts: []
+ },
+ j: {
+ exts: []
+ },
+ java: {
+ exts: ["java"]
+ },
+ javascript: {
+ exts: ["js", "es", "es6", "mjs", "cjs"]
+ },
+ jolie: {
+ exts: []
+ },
+ json: {
+ exts: ["json", "map", "jsonld"]
+ },
+ jsx: {
+ exts: ["jsx"]
+ },
+ julia: {
+ exts: ["jl"]
+ },
+ keymap: {
+ exts: []
+ },
+ kotlin: {
+ exts: ["kt", "kts"]
+ },
+ latex: {
+ exts: ["tex"]
+ },
+ less: {
+ exts: ["less"]
+ },
+ liquid: {
+ exts: []
+ },
+ lisp: {
+ exts: ["cl", "lisp", "el"]
+ },
+ livescript: {
+ exts: ["ls"]
+ },
+ lolcode: {
+ exts: []
+ },
+ lua: {
+ exts: ["lua"]
+ },
+ makefile: {
+ exts: []
+ },
+ markdown: {
+ exts: ["md", "markdown", "mkd", "txt"]
+ },
+ markup: {
+ exts: ["html", "htm", "xml", "xsl", "xslt", "svg", "vue", "ejs", "jsp"]
+ },
+ matlab: {
+ exts: []
+ },
+ mel: {
+ exts: []
+ },
+ mizar: {
+ exts: []
+ },
+ monkey: {
+ exts: []
+ },
+ n4js: {
+ exts: []
+ },
+ nasm: {
+ exts: []
+ },
+ nginx: {
+ exts: []
+ },
+ nim: {
+ exts: []
+ },
+ nix: {
+ exts: []
+ },
+ nsis: {
+ exts: ["nsh", "nsi"]
+ },
+ objectivec: {
+ exts: ["m", "mm"]
+ },
+ ocaml: {
+ exts: ["ocaml", "ml", "mli", "mll", "mly"]
+ },
+ opencl: {
+ exts: []
+ },
+ oz: {
+ exts: ["oz"]
+ },
+ parigp: {
+ exts: []
+ },
+ pascal: {
+ exts: ["pas", "p"]
+ },
+ perl: {
+ exts: ["pl", "pm"]
+ },
+ php: {
+ exts: ["php", "phtml"]
+ },
+ plsql: {
+ exts: ["plsql"]
+ },
+ powershell: {
+ exts: ["ps1", "psd1", "psm1"]
+ },
+ processing: {
+ exts: []
+ },
+ prolog: {
+ exts: ["pro"]
+ },
+ properties: {
+ exts: ["properties"]
+ },
+ protobuf: {
+ exts: ["proto"]
+ },
+ pug: {
+ exts: ["pug", "jade"]
+ },
+ puppet: {
+ exts: ["pp", "puppet"]
+ },
+ pure: {
+ exts: []
+ },
+ python: {
+ exts: ["py", "pyx", "pxd", "pxi"]
+ },
+ q: {
+ exts: ["q"]
+ },
+ qore: {
+ exts: []
+ },
+ r: {
+ exts: ["r", "R"]
+ },
+ reason: {
+ exts: []
+ },
+ renpy: {
+ exts: []
+ },
+ rest: {
+ exts: []
+ },
+ rip: {
+ exts: []
+ },
+ roboconf: {
+ exts: []
+ },
+ ruby: {
+ exts: ["rb"]
+ },
+ rust: {
+ exts: ["rs"]
+ },
+ sas: {
+ exts: ["sas"]
+ },
+ sass: {
+ exts: ["sass"]
+ },
+ scala: {
+ exts: ["scala"]
+ },
+ scheme: {
+ exts: ["scm", "ss"]
+ },
+ scss: {
+ exts: ["scss"]
+ },
+ smalltalk: {
+ exts: ["st"]
+ },
+ smarty: {
+ exts: ["smarty", "tpl"]
+ },
+ soy: {
+ exts: ["soy"]
+ },
+ sql: {
+ exts: ["sql", "cql"]
+ },
+ stylus: {
+ exts: ["styl", "stylus"]
+ },
+ swift: {
+ exts: ["swift"]
+ },
+ tap: {
+ exts: ["tap"]
+ },
+ tcl: {
+ exts: ["tcl"]
+ },
+ textile: {
+ exts: ["textile"]
+ },
+ tsx: {
+ exts: ["tsx"]
+ },
+ tt2: {
+ exts: ["tt2"]
+ },
+ twig: {
+ exts: ["twig"]
+ },
+ typescript: {
+ exts: ["ts", "mts", "cts"]
+ },
+ vbnet: {
+ exts: ["vb"]
+ },
+ velocity: {
+ exts: ["vtl"]
+ },
+ verilog: {
+ exts: ["v"]
+ },
+ vhdl: {
+ exts: ["vhd", "vhdl"]
+ },
+ vim: {
+ exts: []
+ },
+ "visual-basic": {
+ exts: ["vb"]
+ },
+ wasm: {
+ exts: []
+ },
+ url: {
+ exts: []
+ },
+ wiki: {
+ exts: []
+ },
+ xeora: {
+ exts: []
+ },
+ xojo: {
+ exts: []
+ },
+ xquery: {
+ exts: ["xy", "xquery"]
+ },
+ yaml: {
+ exts: ["yaml", "yml"]
+ }
+};
+function getSupportedFormats() {
+ return Object.keys(FORMATS).filter((name) => name !== "important" && name !== "url");
+}
+function getFormatByFile(path, formatsExts) {
+ const ext = (0,external_path_.extname)(path).slice(1);
+ if (formatsExts && Object.keys(formatsExts).length) {
+ return Object.keys(formatsExts).find((format) => formatsExts[format]?.includes(ext));
+ }
+ return Object.keys(FORMATS).find((language) => FORMATS[language]?.exts.includes(ext));
+}
+
+// src/hash.ts
+
+function hash(value) {
+ return spark_md5.hash(value);
+}
+
+// src/token-map.ts
+var TOKEN_HASH_LENGTH = 20;
+function createTokenHash(token, hashFunction = void 0) {
+ return hashFunction ? hashFunction(token.type + token.value).substr(0, TOKEN_HASH_LENGTH) : hash(token.type + token.value).substr(0, TOKEN_HASH_LENGTH);
+}
+function groupByFormat(tokens) {
+ const result = {};
+ tokens.forEach((token) => {
+ result[token.format] = result[token.format] ? [...result[token.format], token] : [token];
+ });
+ return result;
+}
+var TokensMap = class {
+ constructor(id, data, tokens, format, options) {
+ this.id = id;
+ this.data = data;
+ this.tokens = tokens;
+ this.format = format;
+ this.options = options;
+ this.hashMap = this.tokens.map((token) => {
+ if (options.ignoreCase) {
+ token.value = token.value.toLocaleLowerCase();
+ }
+ return createTokenHash(token, this.options.hashFunction);
+ }).join("");
+ }
+ position = 0;
+ hashMap;
+ getTokensCount() {
+ return this.tokens[this.tokens.length - 1].loc.end.position - this.tokens[0].loc.start.position;
+ }
+ getId() {
+ return this.id;
+ }
+ getLinesCount() {
+ return this.tokens[this.tokens.length - 1].loc.end.line - this.tokens[0].loc.start.line;
+ }
+ getFormat() {
+ return this.format;
+ }
+ [Symbol.iterator]() {
+ return this;
+ }
+ next() {
+ const hashFunction = this.options.hashFunction ? this.options.hashFunction : hash;
+ const mapFrame = hashFunction(
+ this.hashMap.substring(
+ this.position * TOKEN_HASH_LENGTH,
+ this.position * TOKEN_HASH_LENGTH + this.options.minTokens * TOKEN_HASH_LENGTH
+ )
+ ).substring(0, TOKEN_HASH_LENGTH);
+ if (this.position < this.tokens.length - this.options.minTokens) {
+ this.position++;
+ return {
+ done: false,
+ value: {
+ id: mapFrame,
+ sourceId: this.getId(),
+ start: this.tokens[this.position - 1],
+ end: this.tokens[this.position + this.options.minTokens - 1]
+ }
+ };
+ } else {
+ return {
+ done: true,
+ value: false
+ };
+ }
+ }
+};
+function generateMapsForFormats(id, data, tokens, options) {
+ return Object.values(groupByFormat(tokens)).map((formatTokens) => new TokensMap(id, data, formatTokens, formatTokens[0].format, options));
+}
+function createTokensMaps(id, data, tokens, options) {
+ return generateMapsForFormats(id, data, tokens, options);
+}
+
+// src/grammar-loader.ts
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+// src/languages/tap.ts
+var tap_exports = {};
+__export(tap_exports, {
+ default: () => tap_default
+});
+var grammar = {
+ language: "tap",
+ init(Prism) {
+ Prism.languages.tap = {
+ fail: /not ok[^#{\n\r]*/,
+ pass: /ok[^#{\n\r]*/,
+ pragma: /pragma [+-][a-z]+/,
+ bailout: /bail out!.*/i,
+ version: /TAP version \d+/i,
+ plan: /\d+\.\.\d+(?: +#.*)?/,
+ subtest: {
+ pattern: /# Subtest(?:: .*)?/,
+ greedy: true
+ },
+ punctuation: /[{}]/,
+ directive: /#.*/,
+ yamlish: {
+ pattern: /(^[ \t]*)---[\s\S]*?[\r\n][ \t]*\.\.\.$/m,
+ lookbehind: true,
+ inside: Prism.languages.yaml,
+ alias: "language-yaml"
+ }
+ };
+ }
+};
+var tap_default = grammar;
+
+// src/languages/sql.ts
+var sql_exports = {};
+__export(sql_exports, {
+ default: () => sql_default
+});
+var grammar2 = {
+ language: "sql",
+ init(Prism) {
+ Prism.languages.sql = {
+ "comment": {
+ pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,
+ lookbehind: true
+ },
+ "variable": [
+ {
+ pattern: /@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,
+ greedy: true
+ },
+ /@[\w.$]+/
+ ],
+ "string": {
+ pattern: /(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,
+ greedy: true,
+ lookbehind: true
+ },
+ "function": /\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,
+ // Should we highlight user defined functions too?
+ "keyword": /\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:_INSERT|COL)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURNS?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,
+ "boolean": /\b(?:TRUE|FALSE|NULL)\b/i,
+ "number": /\b0x[\da-f]+\b|\b\d+\.?\d*|\B\.\d+\b/i,
+ "operator": /[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|IN|LIKE|NOT|OR|IS|DIV|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,
+ "punctuation": /[;[\]()`,.]/
+ };
+ }
+};
+var sql_default = grammar2;
+
+// src/languages/plsql.ts
+var plsql_exports = {};
+__export(plsql_exports, {
+ default: () => plsql_default
+});
+var grammar3 = {
+ language: "plsql",
+ init(Prism) {
+ Prism.languages.plsql = Prism.languages.extend("sql", {
+ comment: [/\/\*[\s\S]*?\*\//, /--.*/]
+ });
+ if (Prism.util.type(Prism.languages.plsql.keyword) !== "Array") {
+ Prism.languages.plsql.keyword = [Prism.languages.plsql.keyword];
+ }
+ Prism.languages.plsql.keyword.unshift(/\b(?:ACCESS|AGENT|AGGREGATE|ARRAY|ARROW|AT|ATTRIBUTE|AUDIT|AUTHID|BFILE_BASE|BLOB_BASE|BLOCK|BODY|BOTH|BOUND|BYTE|CALLING|CHAR_BASE|CHARSET(?:FORM|ID)|CLOB_BASE|COLAUTH|COLLECT|CLUSTERS?|COMPILED|COMPRESS|CONSTANT|CONSTRUCTOR|CONTEXT|CRASH|CUSTOMDATUM|DANGLING|DATE_BASE|DEFINE|DETERMINISTIC|DURATION|ELEMENT|EMPTY|EXCEPTIONS?|EXCLUSIVE|EXTERNAL|FINAL|FORALL|FORM|FOUND|GENERAL|HEAP|HIDDEN|IDENTIFIED|IMMEDIATE|INCLUDING|INCREMENT|INDICATOR|INDEXES|INDICES|INFINITE|INITIAL|ISOPEN|INSTANTIABLE|INTERFACE|INVALIDATE|JAVA|LARGE|LEADING|LENGTH|LIBRARY|LIKE[24C]|LIMITED|LONG|LOOP|MAP|MAXEXTENTS|MAXLEN|MEMBER|MINUS|MLSLABEL|MULTISET|NAME|NAN|NATIVE|NEW|NOAUDIT|NOCOMPRESS|NOCOPY|NOTFOUND|NOWAIT|NUMBER(?:_BASE)?|OBJECT|OCI(?:COLL|DATE|DATETIME|DURATION|INTERVAL|LOBLOCATOR|NUMBER|RAW|REF|REFCURSOR|ROWID|STRING|TYPE)|OFFLINE|ONLINE|ONLY|OPAQUE|OPERATOR|ORACLE|ORADATA|ORGANIZATION|ORL(?:ANY|VARY)|OTHERS|OVERLAPS|OVERRIDING|PACKAGE|PARALLEL_ENABLE|PARAMETERS?|PASCAL|PCTFREE|PIPE(?:LINED)?|PRAGMA|PRIOR|PRIVATE|RAISE|RANGE|RAW|RECORD|REF|REFERENCE|REM|REMAINDER|RESULT|RESOURCE|RETURNING|REVERSE|ROW(?:ID|NUM|TYPE)|SAMPLE|SB[124]|SEGMENT|SELF|SEPARATE|SEQUENCE|SHORT|SIZE(?:_T)?|SPARSE|SQL(?:CODE|DATA|NAME|STATE)|STANDARD|STATIC|STDDEV|STORED|STRING|STRUCT|STYLE|SUBMULTISET|SUBPARTITION|SUBSTITUTABLE|SUBTYPE|SUCCESSFUL|SYNONYM|SYSDATE|TABAUTH|TDO|THE|TIMEZONE_(?:ABBR|HOUR|MINUTE|REGION)|TRAILING|TRANSAC(?:TIONAL)?|TRUSTED|UB[124]|UID|UNDER|UNTRUSTED|VALIDATE|VALIST|VARCHAR2|VARIABLE|VARIANCE|VARRAY|VIEWS|VOID|WHENEVER|WRAPPED|ZONE)\b/i);
+ if (Prism.util.type(Prism.languages.plsql.operator) !== "Array") {
+ Prism.languages.plsql.operator = [Prism.languages.plsql.operator];
+ }
+ Prism.languages.plsql.operator.unshift(/:=/);
+ }
+};
+var plsql_default = grammar3;
+
+// src/grammar-loader.ts
+var languages = {
+ abap: abap_namespaceObject,
+ actionscript: actionscript_namespaceObject,
+ ada: ada_namespaceObject,
+ apacheconf: apacheconf_namespaceObject,
+ apl: apl_namespaceObject,
+ applescript: applescript_namespaceObject,
+ arff: arff_namespaceObject,
+ asciidoc: asciidoc_namespaceObject,
+ asm6502: asm6502_namespaceObject,
+ aspnet: aspnet_namespaceObject,
+ autohotkey: autohotkey_namespaceObject,
+ autoit: autoit_namespaceObject,
+ bash: bash_namespaceObject,
+ basic: basic_namespaceObject,
+ batch: batch_namespaceObject,
+ brainfuck: brainfuck_namespaceObject,
+ bro: bro_namespaceObject,
+ c: c_namespaceObject,
+ clike: clike_namespaceObject,
+ clojure: clojure_namespaceObject,
+ coffeescript: coffeescript_namespaceObject,
+ cpp: cpp_namespaceObject,
+ csharp: csharp_namespaceObject,
+ csp: csp_namespaceObject,
+ cssExtras: css_extras_namespaceObject,
+ css: css_namespaceObject,
+ d: d_namespaceObject,
+ dart: dart_namespaceObject,
+ diff: diff_namespaceObject,
+ django: django_namespaceObject,
+ docker: docker_namespaceObject,
+ eiffel: eiffel_namespaceObject,
+ elixir: elixir_namespaceObject,
+ erlang: erlang_namespaceObject,
+ flow: flow_namespaceObject,
+ fortran: fortran_namespaceObject,
+ fsharp: fsharp_namespaceObject,
+ gedcom: gedcom_namespaceObject,
+ gherkin: gherkin_namespaceObject,
+ git: git_namespaceObject,
+ glsl: glsl_namespaceObject,
+ go: go_namespaceObject,
+ graphql: graphql_namespaceObject,
+ groovy: groovy_namespaceObject,
+ haml: haml_namespaceObject,
+ handlebars: handlebars_namespaceObject,
+ haskell: haskell_namespaceObject,
+ haxe: haxe_namespaceObject,
+ hpkp: hpkp_namespaceObject,
+ hsts: hsts_namespaceObject,
+ http: http_namespaceObject,
+ ichigojam: ichigojam_namespaceObject,
+ icon: icon_namespaceObject,
+ inform7: inform7_namespaceObject,
+ ini: ini_namespaceObject,
+ io: io_namespaceObject,
+ j: j_namespaceObject,
+ java: java_namespaceObject,
+ javascript: javascript_namespaceObject,
+ jolie: jolie_namespaceObject,
+ json: json_namespaceObject,
+ jsx: jsx_namespaceObject,
+ julia: julia_namespaceObject,
+ keyman: keyman_namespaceObject,
+ kotlin: kotlin_namespaceObject,
+ latex: latex_namespaceObject,
+ less: less_namespaceObject,
+ liquid: liquid_namespaceObject,
+ lisp: lisp_namespaceObject,
+ livescript: livescript_namespaceObject,
+ lolcode: lolcode_namespaceObject,
+ lua: lua_namespaceObject,
+ makefile: makefile_namespaceObject,
+ markdown: markdown_namespaceObject,
+ markupTemplating: markup_templating_namespaceObject,
+ markup: markup_namespaceObject,
+ matlab: matlab_namespaceObject,
+ mel: mel_namespaceObject,
+ mizar: mizar_namespaceObject,
+ monkey: monkey_namespaceObject,
+ n4js: n4js_namespaceObject,
+ nasm: nasm_namespaceObject,
+ nginx: nginx_namespaceObject,
+ nim: nim_namespaceObject,
+ nix: nix_namespaceObject,
+ nsis: nsis_namespaceObject,
+ objectivec: objectivec_namespaceObject,
+ ocaml: ocaml_namespaceObject,
+ opencl: opencl_namespaceObject,
+ oz: oz_namespaceObject,
+ parigp: parigp_namespaceObject,
+ parser: parser_namespaceObject,
+ pascal: pascal_namespaceObject,
+ perl: perl_namespaceObject,
+ php: php_namespaceObject,
+ phpExtras: php_extras_namespaceObject,
+ powershell: powershell_namespaceObject,
+ processing: processing_namespaceObject,
+ prolog: prolog_namespaceObject,
+ properties: properties_namespaceObject,
+ protobuf: protobuf_namespaceObject,
+ pug: pug_namespaceObject,
+ puppet: puppet_namespaceObject,
+ pure: pure_namespaceObject,
+ python: python_namespaceObject,
+ q: q_namespaceObject,
+ qore: qore_namespaceObject,
+ r: r_namespaceObject,
+ reason: reason_namespaceObject,
+ renpy: renpy_namespaceObject,
+ rest: rest_namespaceObject,
+ rip: rip_namespaceObject,
+ roboconf: roboconf_namespaceObject,
+ ruby: ruby_namespaceObject,
+ rust: rust_namespaceObject,
+ sas: sas_namespaceObject,
+ sass: sass_namespaceObject,
+ scala: scala_namespaceObject,
+ scheme: scheme_namespaceObject,
+ scss: scss_namespaceObject,
+ smalltalk: smalltalk_namespaceObject,
+ smarty: smarty_namespaceObject,
+ soy: soy_namespaceObject,
+ stylus: stylus_namespaceObject,
+ swift: swift_namespaceObject,
+ tcl: tcl_namespaceObject,
+ textile: textile_namespaceObject,
+ twig: twig_namespaceObject,
+ typescript: typescript_namespaceObject,
+ vbnet: vbnet_namespaceObject,
+ velocity: velocity_namespaceObject,
+ verilog: verilog_namespaceObject,
+ vhdl: vhdl_namespaceObject,
+ vim: vim_namespaceObject,
+ visualBasic: visual_basic_namespaceObject,
+ wasm: wasm_namespaceObject,
+ wiki: wiki_namespaceObject,
+ xeora: xeora_namespaceObject,
+ xojo: xojo_namespaceObject,
+ yaml: yaml_namespaceObject,
+ tsx: tsx_namespaceObject,
+ sql: sql_exports,
+ plsql: plsql_exports,
+ tap: tap_exports
+};
+var loadLanguages2 = () => {
+ lib.loadLanguages(Object.values(languages).map((v) => v.default));
+};
+
+// src/tokenize.ts
+var ignore = {
+ ignore: [
+ {
+ pattern: /(jscpd:ignore-start)[\s\S]*?(?=jscpd:ignore-end)/,
+ lookbehind: true,
+ greedy: true
+ },
+ {
+ pattern: /jscpd:ignore-start/,
+ greedy: false
+ },
+ {
+ pattern: /jscpd:ignore-end/,
+ greedy: false
+ }
+ ]
+};
+var punctuation = {
+ // eslint-disable-next-line @typescript-eslint/camelcase
+ new_line: /\n/,
+ empty: /\s+/
+};
+var initializeFormats = () => {
+ loadLanguages2();
+ Object.keys(lib.languages).forEach((lang) => {
+ if (lang !== "extend" && lang !== "insertBefore" && lang !== "DFS") {
+ lib.languages[lang] = {
+ ...ignore,
+ ...lib.languages[lang],
+ ...punctuation
+ };
+ }
+ });
+};
+initializeFormats();
+function getLanguagePrismName(lang) {
+ if (lang in FORMATS && FORMATS[lang]?.parent) {
+ return FORMATS[lang]?.parent;
+ }
+ return lang;
+}
+function tokenize(code, language) {
+ let length = 0;
+ let line = 1;
+ let column = 1;
+ function sanitizeLangName(name) {
+ return name && name.replace ? name.replace("language-", "") : "unknown";
+ }
+ function createTokenFromString(token, lang) {
+ return [
+ {
+ format: lang,
+ type: "default",
+ value: token,
+ length: token.length
+ }
+ ];
+ }
+ function calculateLocation(token, position) {
+ const result = token;
+ const lines = typeof result.value === "string" && result.value.split ? result.value.split("\n") : [];
+ const newLines = lines.length - 1;
+ const start = {
+ line,
+ column,
+ position
+ };
+ column = newLines >= 0 ? Number(lines[lines.length - 1]?.length) + 1 : column;
+ const end = {
+ line: line + newLines,
+ column,
+ position
+ };
+ result.loc = { start, end };
+ result.range = [length, length + result.length];
+ length += result.length;
+ line += newLines;
+ return result;
+ }
+ function createTokenFromFlatToken(token, lang) {
+ return [
+ {
+ format: lang,
+ type: token.type,
+ value: token.content,
+ length: token.length
+ }
+ ];
+ }
+ function createTokens(token, lang) {
+ if (token.content && typeof token.content === "string") {
+ return createTokenFromFlatToken(token, lang);
+ }
+ if (token.content && Array.isArray(token.content)) {
+ let res = [];
+ token.content.forEach(
+ (t) => res = res.concat(createTokens(t, token.alias ? sanitizeLangName(token.alias) : lang))
+ );
+ return res;
+ }
+ return createTokenFromString(token, lang);
+ }
+ let tokens = [];
+ const grammar4 = lib.languages[getLanguagePrismName(language)];
+ if (!lib.languages[getLanguagePrismName(language)]) {
+ console.warn('Warn: jscpd has issue with support of "' + getLanguagePrismName(language) + '"');
+ return [];
+ }
+ lib.tokenize(code, grammar4).forEach(
+ (t) => tokens = tokens.concat(createTokens(t, language))
+ );
+ return tokens.filter((t) => t.format in FORMATS).map(
+ (token, index) => calculateLocation(token, index)
+ );
+}
+function setupIgnorePatterns(format, ignorePattern) {
+ const language = getLanguagePrismName(format);
+ const ignorePatterns = ignorePattern.map((pattern) => ({
+ pattern: new RegExp(pattern),
+ greedy: false
+ }));
+ lib.languages[language] = {
+ ...ignorePatterns,
+ ...lib.languages[language]
+ };
+}
+function createTokenMapBasedOnCode(id, data, format, options = {}) {
+ const { mode, ignoreCase, ignorePattern } = options;
+ const tokens = tokenize(data, format).filter((token) => mode(token, options));
+ if (ignorePattern)
+ setupIgnorePatterns(format, options.ignorePattern || []);
+ if (ignoreCase) {
+ return createTokensMaps(id, data, tokens.map(
+ (token) => {
+ token.value = token.value.toLocaleLowerCase();
+ return token;
+ }
+ ), options);
+ }
+ return createTokensMaps(id, data, tokens, options);
+}
+
+// src/index.ts
+var Tokenizer = class {
+ generateMaps(id, data, format, options) {
+ return createTokenMapBasedOnCode(id, data, format, options);
+ }
+};
+
+//# sourceMappingURL=index.mjs.map
+// EXTERNAL MODULE: ./node_modules/fast-glob/out/index.js
+var out = __nccwpck_require__(43664);
+// EXTERNAL MODULE: ./node_modules/fs-extra/lib/index.js
+var fs_extra_lib = __nccwpck_require__(5630);
+// EXTERNAL MODULE: ./node_modules/bytes/index.js
+var bytes = __nccwpck_require__(86966);
+// EXTERNAL MODULE: ./node_modules/blamer/build/main/index.js
+var main = __nccwpck_require__(56781);
+;// CONCATENATED MODULE: external "process"
+const external_process_namespaceObject = require("process");
+// EXTERNAL MODULE: ./node_modules/markdown-table/index.js
+var markdown_table = __nccwpck_require__(41062);
+;// CONCATENATED MODULE: ./node_modules/@jscpd/finder/dist/index.mjs
+var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
+}) : x)(function(x) {
+ if (typeof require !== "undefined")
+ return require.apply(this, arguments);
+ throw Error('Dynamic require of "' + x + '" is not supported');
+});
+
+// src/in-files-detector.ts
+
+
+
+// src/validators/skip-local.validator.ts
+
+
+var SkipLocalValidator = class _SkipLocalValidator {
+ validate(clone, options) {
+ const status = !this.shouldSkipClone(clone, options);
+ return {
+ status,
+ clone,
+ message: [
+ `Sources of duplication located in same local folder (${clone.duplicationA.sourceId}, ${clone.duplicationB.sourceId})`
+ ]
+ };
+ }
+ shouldSkipClone(clone, options) {
+ const path = getOption("path", options);
+ return path.some(
+ (dir) => _SkipLocalValidator.isRelative(clone.duplicationA.sourceId, dir) && _SkipLocalValidator.isRelative(clone.duplicationB.sourceId, dir)
+ );
+ }
+ static isRelative(file, path) {
+ const rel = (0,external_path_.relative)(path, file);
+ return rel !== "" && !rel.startsWith("..") && !(0,external_path_.isAbsolute)(rel);
+ }
+};
+
+// src/in-files-detector.ts
+var InFilesDetector = class {
+ constructor(tokenizer, store, statistic, options) {
+ this.tokenizer = tokenizer;
+ this.store = store;
+ this.statistic = statistic;
+ this.options = options;
+ this.registerSubscriber(this.statistic);
+ }
+ reporters = [];
+ subscribes = [];
+ postHooks = [];
+ registerReporter(reporter) {
+ this.reporters.push(reporter);
+ }
+ registerSubscriber(subscriber) {
+ this.subscribes.push(subscriber);
+ }
+ registerHook(hook) {
+ this.postHooks.push(hook);
+ }
+ detect(fls) {
+ const files = fls.filter((f) => !!f);
+ if (files.length === 0) {
+ return Promise.resolve([]);
+ }
+ const options = this.options;
+ const hooks = [...this.postHooks];
+ const store = this.store;
+ const validators = [];
+ if (options.skipLocal) {
+ validators.push(new SkipLocalValidator());
+ }
+ const detector = new Detector(this.tokenizer, store, validators, options);
+ this.subscribes.forEach((listener) => {
+ Object.entries(listener.subscribe()).map(([event, handler]) => detector.on(event, handler));
+ });
+ const detect = (entry, clones = []) => {
+ const { path, content } = entry;
+ const format = getFormatByFile(path, options.formatsExts);
+ return format !== void 0 ? detector.detect(path, content, format).then((clns) => {
+ if (clns) {
+ clones.push(...clns);
+ }
+ const file = files.pop();
+ if (file) {
+ return detect(file, clones);
+ }
+ return clones;
+ }) : Promise.resolve([]);
+ };
+ const processHooks = (hook, detectedClones) => {
+ return hook.process(detectedClones).then((clones) => {
+ const nextHook = hooks.pop();
+ if (nextHook) {
+ return processHooks(nextHook, clones);
+ }
+ return clones;
+ });
+ };
+ return detect(files.pop()).then((clones) => {
+ const hook = hooks.pop();
+ if (hook) {
+ return processHooks(hook, clones);
+ }
+ return clones;
+ }).then((clones) => {
+ const statistic = this.statistic.getStatistic();
+ this.reporters.forEach((reporter) => {
+ reporter.report(clones, statistic);
+ });
+ return clones;
+ });
+ }
+};
+
+// src/files.ts
+
+
+
+
+
+
+
+function isFile(path) {
+ try {
+ const stat = (0,external_fs_.lstatSync)(path);
+ return stat.isFile();
+ } catch (e) {
+ return false;
+ }
+}
+function isSymlink(path) {
+ try {
+ const stat = (0,external_fs_.lstatSync)(path);
+ return stat.isSymbolicLink();
+ } catch (e) {
+ return false;
+ }
+}
+function skipNotSupportedFormats(options) {
+ return (entry) => {
+ const { path } = entry;
+ const format = getFormatByFile(path, options.formatsExts);
+ const shouldNotSkip = !!(format && options.format && options.format.includes(format));
+ if ((options.debug || options.verbose) && !shouldNotSkip) {
+ console.log(`File ${path} skipped! Format "${format}" does not included to supported formats.`);
+ }
+ return shouldNotSkip;
+ };
+}
+function skipBigFiles(options) {
+ return (entry) => {
+ const { stats, path } = entry;
+ const shouldSkip = stats !== void 0 && bytes.parse(stats.size) > bytes.parse(getOption("maxSize", options));
+ if (options.debug && shouldSkip) {
+ console.log(`File ${path} skipped! Size more then limit (${bytes(stats.size)} > ${getOption("maxSize", options)})`);
+ }
+ return !shouldSkip;
+ };
+}
+function skipFilesIfLinesOfContentNotInLimits(options) {
+ return (entry) => {
+ const { path, content } = entry;
+ const lines = content.split("\n").length;
+ const minLines = getOption("minLines", options);
+ const maxLines = getOption("maxLines", options);
+ if (lines < minLines || lines > maxLines) {
+ if (options.debug || options.verbose) {
+ console.log((0,safe.grey)(`File ${path} skipped! Code lines=${lines} not in limits (${minLines}:${maxLines})`));
+ }
+ return false;
+ }
+ return true;
+ };
+}
+function addContentToEntry(entry) {
+ const { path } = entry;
+ const content = (0,fs_extra_lib.readFileSync)(path).toString();
+ return { ...entry, content };
+}
+function getFilesToDetect(options) {
+ const pattern = options.pattern || "**/*";
+ let patterns = options.path;
+ if (options.noSymlinks) {
+ patterns = patterns !== void 0 ? patterns.filter((path) => !isSymlink(path)) : [];
+ }
+ patterns = patterns !== void 0 ? patterns.map((path) => {
+ const currentPath = (0,fs_extra_lib.realpathSync)(path);
+ if (isFile(currentPath)) {
+ return path;
+ }
+ return path.endsWith("/") ? `${path}${pattern}` : `${path}/${pattern}`;
+ }) : [];
+ return (0,out.sync)(
+ patterns,
+ {
+ ignore: options.ignore,
+ onlyFiles: true,
+ dot: true,
+ stats: true,
+ absolute: options.absolute,
+ followSymbolicLinks: !options.noSymlinks
+ }
+ ).filter(skipNotSupportedFormats(options)).filter(skipBigFiles(options)).map(addContentToEntry).filter(skipFilesIfLinesOfContentNotInLimits(options));
+}
+
+// src/hooks/blamer.ts
+
+var BlamerHook = class _BlamerHook {
+ process(clones) {
+ return Promise.all(clones.map((clone) => _BlamerHook.blameLines(clone)));
+ }
+ static async blameLines(clone) {
+ const blamer = new main();
+ const blamedFileA = await blamer.blameByFile(clone.duplicationA.sourceId);
+ const blamedFileB = await blamer.blameByFile(clone.duplicationB.sourceId);
+ clone.duplicationA.blame = _BlamerHook.getBlamedLines(blamedFileA, clone.duplicationA.start.line, clone.duplicationA.end.line);
+ clone.duplicationB.blame = _BlamerHook.getBlamedLines(blamedFileB, clone.duplicationB.start.line, clone.duplicationB.end.line);
+ return clone;
+ }
+ static getBlamedLines(blamedFiles, start, end) {
+ const [file] = Object.keys(blamedFiles);
+ const result = {};
+ Object.keys(blamedFiles[file]).filter((lineNumber) => {
+ return Number(lineNumber) >= start && Number(lineNumber) <= end;
+ }).map((lineNumber) => blamedFiles[file][lineNumber]).forEach((info) => {
+ result[info.line] = info;
+ });
+ return result;
+ }
+};
+
+// src/hooks/fragment.ts
+
+var FragmentsHook = class _FragmentsHook {
+ process(clones) {
+ return Promise.all(
+ clones.map((clone) => _FragmentsHook.addFragments(clone))
+ );
+ }
+ static addFragments(clone) {
+ const codeA = (0,external_fs_.readFileSync)(clone.duplicationA.sourceId).toString();
+ const codeB = (0,external_fs_.readFileSync)(clone.duplicationB.sourceId).toString();
+ clone.duplicationA.fragment = codeA.substring(clone.duplicationA.range[0], clone.duplicationA.range[1]);
+ clone.duplicationB.fragment = codeB.substring(clone.duplicationB.range[0], clone.duplicationB.range[1]);
+ return clone;
+ }
+};
+
+// src/utils/clone-found.ts
+
+
+// src/utils/reports.ts
+
+
+
+var compareDates = (firstDate, secondDate) => {
+ const first = new Date(firstDate);
+ const second = new Date(secondDate);
+ switch (true) {
+ case first < second:
+ return "=>";
+ case first > second:
+ return "<=";
+ default:
+ return "==";
+ }
+};
+function escapeXml(unsafe) {
+ return unsafe.replace(/[<>&'"]/g, (c) => {
+ switch (c) {
+ case "<":
+ return "<";
+ case ">":
+ return ">";
+ case "&":
+ return "&";
+ case "'":
+ return "'";
+ case '"':
+ return """;
+ default:
+ return "";
+ }
+ });
+}
+function getPath(path, options) {
+ return options.absolute ? path : (0,external_path_.relative)((0,external_process_namespaceObject.cwd)(), path);
+}
+function getPathConsoleString(path, options) {
+ return (0,safe.bold)((0,safe.green)(getPath(path, options)));
+}
+function getSourceLocation(start, end) {
+ return `${start.line}:${start.column} - ${end.line}:${end.column}`;
+}
+function generateLine(clone, position, line) {
+ const lineNumberA = (clone.duplicationA.start.line + position).toString();
+ const lineNumberB = (clone.duplicationB.start.line + position).toString();
+ if (clone.duplicationA.blame && clone.duplicationB.blame) {
+ return [
+ lineNumberA,
+ // @ts-ignore
+ clone.duplicationA.blame[lineNumberA] ? clone.duplicationA.blame[lineNumberA].author : "",
+ clone.duplicationA.blame[lineNumberA] && clone.duplicationB.blame[lineNumberB] ? compareDates(clone.duplicationA.blame[lineNumberA].date, clone.duplicationB.blame[lineNumberB].date) : "",
+ lineNumberB,
+ // @ts-ignore
+ clone.duplicationB.blame[lineNumberB] ? clone.duplicationB.blame[lineNumberB].author : "",
+ (0,safe.grey)(line)
+ ];
+ } else {
+ return [lineNumberA, lineNumberB, (0,safe.grey)(line)];
+ }
+}
+function convertStatisticToArray(format, statistic) {
+ return [
+ format,
+ `${statistic.sources}`,
+ `${statistic.lines}`,
+ `${statistic.tokens}`,
+ `${statistic.clones}`,
+ `${statistic.duplicatedLines} (${statistic.percentage}%)`,
+ `${statistic.duplicatedTokens} (${statistic.percentageTokens}%)`
+ ];
+}
+
+// src/utils/clone-found.ts
+function cloneFound(clone, options) {
+ const { duplicationA, duplicationB, format, isNew } = clone;
+ console.log("Clone found (" + format + "):" + (isNew ? (0,safe.red)("*") : ""));
+ console.log(
+ ` - ${getPathConsoleString(duplicationA.sourceId, options)} [${getSourceLocation(
+ duplicationA.start,
+ duplicationA.end
+ )}] (${duplicationA.end.line - duplicationA.start.line} lines${duplicationA.end.position ? ", " + (duplicationA.end.position - duplicationA.start.position) + " tokens" : ""})`
+ );
+ console.log(
+ ` ${getPathConsoleString(duplicationB.sourceId, options)} [${getSourceLocation(
+ duplicationB.start,
+ duplicationB.end
+ )}]`
+ );
+ console.log("");
+}
+
+// src/subscribers/progress.ts
+var ProgressSubscriber = class {
+ constructor(options) {
+ this.options = options;
+ }
+ subscribe() {
+ return {
+ CLONE_FOUND: (payload) => cloneFound(payload.clone, this.options)
+ };
+ }
+};
+
+// src/subscribers/verbose.ts
+
+var VerboseSubscriber = class {
+ constructor(options) {
+ this.options = options;
+ }
+ subscribe() {
+ return {
+ "CLONE_FOUND": (payload) => {
+ const { clone } = payload;
+ console.log((0,safe.yellow)("CLONE_FOUND"));
+ console.log((0,safe.grey)(JSON.stringify(clone, null, " ")));
+ },
+ "CLONE_SKIPPED": (payload) => {
+ const { validation } = payload;
+ console.log((0,safe.yellow)("CLONE_SKIPPED"));
+ console.log(
+ (0,safe.grey)("Clone skipped: " + validation?.message?.join(" "))
+ );
+ },
+ "START_DETECTION": (payload) => {
+ const { source } = payload;
+ console.log((0,safe.yellow)("START_DETECTION"));
+ console.log(
+ (0,safe.grey)("Start detection for source id=" + source?.getId() + " format=" + source?.getFormat())
+ );
+ }
+ };
+ }
+};
+
+// src/reporters/console.ts
+
+var Table = __require("cli-table3");
+var ConsoleReporter = class {
+ options;
+ constructor(options) {
+ this.options = options;
+ }
+ report(clones, statistic = void 0) {
+ if (statistic && !this.options.silent) {
+ const table = new Table({
+ head: ["Format", "Files analyzed", "Total lines", "Total tokens", "Clones found", "Duplicated lines", "Duplicated tokens"]
+ });
+ Object.keys(statistic.formats).filter((format) => statistic.formats[format].sources).forEach((format) => {
+ table.push(convertStatisticToArray(format, statistic.formats[format].total));
+ });
+ table.push(convertStatisticToArray((0,safe.bold)("Total:"), statistic.total));
+ console.log(table.toString());
+ console.log((0,safe.grey)(`Found ${clones.length} clones.`));
+ }
+ }
+};
+
+// src/reporters/console-full.ts
+
+var Table2 = __require("cli-table3");
+var TABLE_OPTIONS = {
+ chars: {
+ top: "",
+ "top-mid": "",
+ "top-left": "",
+ "top-right": "",
+ bottom: "",
+ "bottom-mid": "",
+ "bottom-left": "",
+ "bottom-right": "",
+ left: "",
+ "left-mid": "",
+ mid: "",
+ "mid-mid": "",
+ right: "",
+ "right-mid": "",
+ middle: "\u2502"
+ }
+};
+var ConsoleFullReporter = class {
+ constructor(options) {
+ this.options = options;
+ }
+ report(clones) {
+ clones.forEach((clone) => {
+ this.cloneFullFound(clone);
+ });
+ console.log((0,safe.grey)(`Found ${clones.length} clones.`));
+ }
+ cloneFullFound(clone) {
+ const table = new Table2(TABLE_OPTIONS);
+ cloneFound(clone, this.options);
+ clone.duplicationA.fragment.split("\n").forEach((line, position) => {
+ table.push(generateLine(clone, position, line));
+ });
+ console.log(table.toString());
+ console.log("");
+ }
+};
+
+// src/reporters/json.ts
+
+
+
+
+var JsonReporter = class {
+ constructor(options) {
+ this.options = options;
+ }
+ generateJson(clones, statistics) {
+ return {
+ statistics,
+ duplicates: clones.map((clone) => this.cloneFound(clone))
+ };
+ }
+ report(clones, statistic) {
+ const json = this.generateJson(clones, statistic);
+ (0,fs_extra_lib.ensureDirSync)(getOption("output", this.options));
+ (0,fs_extra_lib.writeFileSync)(getOption("output", this.options) + "/jscpd-report.json", JSON.stringify(json, null, " "));
+ console.log((0,safe.green)(`JSON report saved to ${(0,external_path_.join)(this.options.output, "jscpd-report.json")}`));
+ }
+ cloneFound(clone) {
+ const startLineA = clone.duplicationA.start.line;
+ const endLineA = clone.duplicationA.end.line;
+ const startLineB = clone.duplicationB.start.line;
+ const endLineB = clone.duplicationB.end.line;
+ return {
+ format: clone.format,
+ lines: endLineA - startLineA + 1,
+ fragment: clone.duplicationA.fragment,
+ tokens: 0,
+ firstFile: {
+ name: getPath(clone.duplicationA.sourceId, this.options),
+ start: startLineA,
+ end: endLineA,
+ startLoc: clone.duplicationA.start,
+ endLoc: clone.duplicationA.end,
+ blame: clone.duplicationA.blame
+ },
+ secondFile: {
+ name: getPath(clone.duplicationB.sourceId, this.options),
+ start: startLineB,
+ end: endLineB,
+ startLoc: clone.duplicationB.start,
+ endLoc: clone.duplicationB.end,
+ blame: clone.duplicationB.blame
+ }
+ };
+ }
+};
+
+// src/reporters/csv.ts
+
+
+
+
+var CSVReporter = class {
+ constructor(options) {
+ this.options = options;
+ }
+ // @ts-ignore
+ report(clones, statistic) {
+ const report = [
+ ["Format", "Files analyzed", "Total lines", "Total tokens", "Clones found", "Duplicated lines", "Duplicated tokens"],
+ ...Object.keys(statistic.formats).map((format) => convertStatisticToArray(format, statistic.formats[format].total)),
+ convertStatisticToArray("Total:", statistic.total)
+ ].map((arr) => arr.join(",")).join("\n");
+ (0,fs_extra_lib.ensureDirSync)(getOption("output", this.options));
+ (0,fs_extra_lib.writeFileSync)(getOption("output", this.options) + "/jscpd-report.csv", report);
+ console.log((0,safe.green)(`CSV report saved to ${(0,external_path_.join)(this.options?.output, "jscpd-report.csv")}`));
+ }
+};
+
+// src/reporters/markdown.ts
+
+
+
+
+
+var MarkdownReporter = class {
+ constructor(options) {
+ this.options = options;
+ }
+ report(clones, statistic) {
+ const report = `
+# Copy/paste detection report
+
+> Duplications detection: Found ${clones.length} exact clones with ${statistic.total.duplicatedLines}(${statistic.total.percentage}%) duplicated lines in ${statistic.total.sources} (${Object.keys(statistic.formats).length} formats) files.
+
+${markdown_table([
+ ["Format", "Files analyzed", "Total lines", "Total tokens", "Clones found", "Duplicated lines", "Duplicated tokens"],
+ ...Object.keys(statistic.formats).map((format) => convertStatisticToArray(format, statistic.formats[format].total)),
+ convertStatisticToArray("Total:", statistic.total).map((item) => `**${item}**`)
+ ])}
+`;
+ (0,fs_extra_lib.ensureDirSync)(getOption("output", this.options));
+ (0,fs_extra_lib.writeFileSync)(getOption("output", this.options) + "/jscpd-report.md", report);
+ console.log((0,safe.green)(`Markdown report saved to ${(0,external_path_.join)(this.options.output, "jscpd-report.md")}`));
+ }
+};
+
+// src/reporters/xml.ts
+
+
+
+
+
+var XmlReporter = class {
+ constructor(options) {
+ this.options = options;
+ }
+ report(clones) {
+ let xmlDoc = '';
+ xmlDoc += "";
+ clones.forEach((clone) => {
+ xmlDoc = `${xmlDoc}
+
+
+ /i, "CDATA_END")}]]>
+
+
+ /i, "CDATA_END")}]]>
+
+ /i, "CDATA_END")}]]>
+
+ `;
+ });
+ xmlDoc += "";
+ (0,fs_extra_lib.ensureDirSync)(getOption("output", this.options));
+ (0,external_fs_.writeFileSync)(getOption("output", this.options) + "/jscpd-report.xml", xmlDoc);
+ console.log((0,safe.green)(`XML report saved to ${(0,external_path_.join)(this.options.output, "jscpd-report.xml")}`));
+ }
+};
+
+// src/reporters/silent.ts
+
+var SilentReporter = class {
+ report(clones, statistic) {
+ if (statistic) {
+ console.log(
+ `Duplications detection: Found ${(0,safe.bold)(clones.length.toString())} exact clones with ${(0,safe.bold)(statistic.total.duplicatedLines.toString())}(${statistic.total.percentage}%) duplicated lines in ${(0,safe.bold)(statistic.total.sources.toString())} (${Object.keys(statistic.formats).length} formats) files.`
+ );
+ }
+ }
+};
+
+// src/reporters/threshold.ts
+
+var ThresholdReporter = class {
+ constructor(options) {
+ this.options = options;
+ }
+ // @ts-ignore
+ report(clones, statistic) {
+ if (statistic && this.options.threshold !== void 0 && this.options.threshold < statistic.total.percentage) {
+ const message = `ERROR: jscpd found too many duplicates (${statistic.total.percentage}%) over threshold (${this.options.threshold}%)`;
+ console.error((0,safe.red)(message));
+ throw new Error(message);
+ }
+ }
+};
+
+// src/reporters/xcode.ts
+var XcodeReporter = class {
+ constructor(options) {
+ this.options = options;
+ }
+ report(clones) {
+ clones.forEach((clone) => {
+ this.cloneFound(clone);
+ });
+ console.log(`Found ${clones.length} clones.`);
+ }
+ cloneFound(clone) {
+ const pathA = getPath(clone.duplicationA.sourceId, { ...this.options, absolute: true });
+ const pathB = getPath(clone.duplicationB.sourceId, this.options);
+ const startLineA = clone.duplicationA.start.line;
+ const characterA = clone.duplicationA.start.column;
+ const endLineA = clone.duplicationA.end.line;
+ const startLineB = clone.duplicationB.start.line;
+ const endLineB = clone.duplicationB.end.line;
+ console.log(`${pathA}:${startLineA}:${characterA}: warning: Found ${endLineA - startLineA} lines (${startLineA}-${endLineA}) duplicated on file ${pathB} (${startLineB}-${endLineB})`);
+ }
+};
+
+// src/utils/options.ts
+function parseFormatsExtensions(extensions = "") {
+ const result = {};
+ if (!extensions) {
+ return void 0;
+ }
+ extensions.split(";").forEach((format) => {
+ const pair = format.split(":");
+ result[pair[0]] = pair[1].split(",");
+ });
+ return result;
+}
+
+//# sourceMappingURL=index.mjs.map
+// EXTERNAL MODULE: ./node_modules/jscpd/node_modules/commander/index.js
+var commander = __nccwpck_require__(85178);
+// EXTERNAL MODULE: external "crypto"
+var external_crypto_ = __nccwpck_require__(6113);
+// EXTERNAL MODULE: external "url"
+var external_url_ = __nccwpck_require__(57310);
+// EXTERNAL MODULE: ./node_modules/pug/lib/index.js
+var pug_lib = __nccwpck_require__(40316);
+;// CONCATENATED MODULE: ./node_modules/@jscpd/html-reporter/dist/index.mjs
+// ../../node_modules/.pnpm/tsup@8.0.2_postcss@8.4.38_ts-node@10.9.2_@types+node@20.12.12_typescript@5.4.5__typescript@5.4.5/node_modules/tsup/assets/esm_shims.js
+
+
+var getFilename = () => fileURLToPath(import.meta.url);
+var getDirname = () => path.dirname(getFilename());
+var dist_dirname = /* @__PURE__ */ (/* unused pure expression or super */ null && (getDirname()));
+
+// src/index.ts
+
+
+
+
+
+var HtmlReporter = class {
+ constructor(options) {
+ this.options = options;
+ }
+ report(clones, statistic) {
+ const jsonReporter = new JsonReporter(this.options);
+ const json = jsonReporter.generateJson(clones, statistic);
+ const result = pug_lib.renderFile(__nccwpck_require__.ab + "main.pug", json);
+ if (this.options.output) {
+ const destination = (0,external_path_.join)(this.options.output, "html/");
+ try {
+ (0,fs_extra_lib.copySync)(__nccwpck_require__.ab + "public", destination, { overwrite: true });
+ const index = (0,external_path_.join)(destination, "index.html");
+ (0,fs_extra_lib.writeFileSync)(index, result);
+ (0,fs_extra_lib.writeFileSync)(
+ (0,external_path_.join)(destination, "jscpd-report.json"),
+ JSON.stringify(json, null, " ")
+ );
+ console.log((0,safe.green)(`HTML report saved to ${(0,external_path_.join)(this.options.output, "html/")}`));
+ } catch (e) {
+ console.log((0,safe.red)(e));
+ }
+ }
+ }
+};
+
+//# sourceMappingURL=index.mjs.map
+// EXTERNAL MODULE: ./node_modules/node-sarif-builder/dist/index.js
+var dist = __nccwpck_require__(369);
+;// CONCATENATED MODULE: ./node_modules/jscpd-sarif-reporter/dist/index.mjs
+// ../../node_modules/.pnpm/tsup@8.0.2_postcss@8.4.38_ts-node@10.9.2_@types+node@20.12.12_typescript@5.4.5__typescript@5.4.5/node_modules/tsup/assets/esm_shims.js
+
+
+var dist_getFilename = () => fileURLToPath(import.meta.url);
+var dist_getDirname = () => path.dirname(dist_getFilename());
+var jscpd_sarif_reporter_dist_dirname = /* @__PURE__ */ (/* unused pure expression or super */ null && (dist_getDirname()));
+
+// src/index.ts
+
+
+
+
+function dist_getSourceLocation(start, end) {
+ return `${start.line}:${start.column} - ${end.line}:${end.column}`;
+}
+var SarifReporter = class {
+ constructor(options) {
+ this.options = options;
+ }
+ report(clones, statistic) {
+ const url = "https://github.com/kucherenko/jscpd/";
+ if (this.options.output) {
+ const pkg = (0,fs_extra_lib.readJsonSync)(__nccwpck_require__.ab + "package1.json");
+ const sarifBuilder = new dist/* SarifBuilder */.ZH();
+ const sarifRunBuilder = new dist/* SarifRunBuilder */.Je().initSimple({
+ toolDriverName: "jscpd",
+ toolDriverVersion: pkg.version,
+ url
+ });
+ sarifRunBuilder.addRule(
+ new dist/* SarifRuleBuilder */.iy().initSimple({
+ ruleId: "duplication",
+ shortDescriptionText: "Found code duplication",
+ helpUri: url
+ })
+ );
+ sarifRunBuilder.addRule(
+ new dist/* SarifRuleBuilder */.iy().initSimple({
+ ruleId: "duplications-threshold",
+ shortDescriptionText: "Level of duplication is too high",
+ helpUri: url
+ })
+ );
+ for (const clone of clones) {
+ const sarifResultBuilder = new dist/* SarifResultBuilder */.nn();
+ sarifRunBuilder.addResult(
+ sarifResultBuilder.initSimple(
+ {
+ // Transcode to a SARIF level: can be "warning" or "error" or "note"
+ level: "warning",
+ messageText: `Clone detected in ${clone.format}, - ${clone.duplicationA.sourceId}[${dist_getSourceLocation(clone.duplicationA.start, clone.duplicationA.end)}] and ${clone.duplicationB.sourceId}[${dist_getSourceLocation(clone.duplicationB.start, clone.duplicationB.end)}]`,
+ ruleId: "duplication",
+ fileUri: clone.duplicationA.sourceId,
+ startLine: clone.duplicationA.start.line,
+ startColumn: clone.duplicationA.start.column,
+ endLine: clone.duplicationA.end.line,
+ endColumn: clone.duplicationA.end.column
+ }
+ )
+ );
+ }
+ if (statistic.total?.percentage >= (this.options.threshold || 100)) {
+ const sarifResultBuilderThreshold = new dist/* SarifResultBuilder */.nn();
+ sarifRunBuilder.addResult(
+ sarifResultBuilderThreshold.initSimple({
+ level: "error",
+ messageText: `The duplication level (${statistic.total.percentage}%) is bigger than threshold (${this.options.threshold}%)`,
+ ruleId: "duplications-threshold"
+ })
+ );
+ }
+ const path2 = (0,external_path_.join)(this.options.output, "jscpd-sarif.json");
+ sarifBuilder.addRun(sarifRunBuilder);
+ const sarifJsonString = sarifBuilder.buildSarifJsonString({ indent: false });
+ (0,fs_extra_lib.ensureDirSync)(this.options.output);
+ (0,fs_extra_lib.writeFileSync)(path2, sarifJsonString);
+ console.log((0,safe.green)(`SARIF report saved to ${path2}`));
+ }
+ }
+};
+
+//# sourceMappingURL=index.mjs.map
+;// CONCATENATED MODULE: ./node_modules/jscpd/dist/jscpd.mjs
+var jscpd_require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
+}) : x)(function(x) {
+ if (typeof require !== "undefined") return require.apply(this, arguments);
+ throw Error('Dynamic require of "' + x + '" is not supported');
+});
+
+// src/index.ts
+
+
+
+
+// src/init/cli.ts
+
+
+function initCli(packageJson, argv) {
+ const cli = new commander.Command(packageJson.name);
+ cli.version(packageJson.version).usage("[options] ").description(packageJson.description).option(
+ "-l, --min-lines [number]",
+ "min size of duplication in code lines (Default is " + getOption("minLines") + ")"
+ ).option(
+ "-k, --min-tokens [number]",
+ "min size of duplication in code tokens (Default is " + getOption("minTokens") + ")"
+ ).option("-x, --max-lines [number]", "max size of source in lines (Default is " + getOption("maxLines") + ")").option(
+ "-z, --max-size [string]",
+ "max size of source in bytes, examples: 1kb, 1mb, 120kb (Default is " + getOption("maxSize") + ")"
+ ).option(
+ "-t, --threshold [number]",
+ "threshold for duplication, in case duplications >= threshold jscpd will exit with error"
+ ).option("-c, --config [string]", "path to config file (Default is .jscpd.json in )").option("-i, --ignore [string]", "glob pattern for files what should be excluded from duplication detection").option("--ignore-pattern [string]", "Ignore code blocks matching the regexp patterns").option(
+ "-r, --reporters [string]",
+ "reporters or list of reporters separated with comma to use (Default is time,console)"
+ ).option("-o, --output [string]", "reporters to use (Default is ./report/)").option(
+ "-m, --mode [string]",
+ 'mode of quality of search, can be "strict", "mild" and "weak" (Default is "' + getOption("mode") + '")'
+ ).option("-f, --format [string]", "format or formats separated by comma (Example php,javascript,python)").option("-p, --pattern [string]", "glob pattern to file search (Example **/*.txt)").option("-b, --blame", "blame authors of duplications (get information about authors from git)").option("-s, --silent", "do not write detection progress and result to a console").option("--store [string]", "use for define custom store (e.g. --store leveldb used for big codebase)").option("-a, --absolute", "use absolute path in reports").option("-n, --noSymlinks", "dont use symlinks for detection in files").option("--ignoreCase", "ignore case of symbols in code (experimental)").option("-g, --gitignore", "ignore all files from .gitignore file").option("--formats-exts [string]", "list of formats with file extensions (javascript:es,es6;dart:dt)").option("-d, --debug", "show debug information, not run detection process(options list and selected files)").option("-v, --verbose", "show full information during detection process").option("--list", "show list of total supported formats").option("--skipLocal", "skip duplicates in local folders, just detect cross folders duplications").option("--exitCode [number]", "exit code to use when code duplications are detected");
+ cli.parse(argv);
+ return cli;
+}
+
+// src/init/options.ts
+
+
+
+// src/init/ignore.ts
+
+var gitignoreToGlob = jscpd_require("gitignore-to-glob");
+function initIgnore(options) {
+ const ignore = options.ignore || [];
+ if (options.gitignore && (0,external_fs_.existsSync)(process.cwd() + "/.gitignore")) {
+ let gitignorePatterns = gitignoreToGlob(process.cwd() + "/.gitignore") || [];
+ gitignorePatterns = gitignorePatterns.map(
+ (pattern) => pattern.substr(pattern.length - 1) === "/" ? `${pattern}**/*` : pattern
+ );
+ ignore.push(...gitignorePatterns);
+ ignore.map((pattern) => pattern.replace("!", ""));
+ }
+ return ignore;
+}
+
+// src/options.ts
+
+
+
+
+
+var convertCliToOptions = (cli) => {
+ const result = {
+ minTokens: cli.minTokens ? parseInt(cli.minTokens) : void 0,
+ minLines: cli.minLines ? parseInt(cli.minLines) : void 0,
+ maxLines: cli.maxLines ? parseInt(cli.maxLines) : void 0,
+ maxSize: cli.maxSize,
+ debug: cli.debug,
+ store: cli.store,
+ pattern: cli.pattern,
+ executionId: cli.executionId,
+ silent: cli.silent,
+ blame: cli.blame,
+ verbose: cli.verbose,
+ cache: cli.cache,
+ output: cli.output,
+ format: cli.format,
+ formatsExts: parseFormatsExtensions(cli.formatsExts),
+ list: cli.list,
+ mode: cli.mode,
+ absolute: cli.absolute,
+ noSymlinks: cli.noSymlinks,
+ skipLocal: cli.skipLocal,
+ ignoreCase: cli.ignoreCase,
+ gitignore: cli.gitignore,
+ exitCode: cli.exitCode
+ };
+ if (cli.threshold !== void 0) {
+ result.threshold = Number(cli.threshold);
+ }
+ if (cli.reporters) {
+ result.reporters = cli.reporters.split(",");
+ }
+ if (cli.format) {
+ result.format = cli.format.split(",");
+ }
+ if (cli.ignore) {
+ result.ignore = cli.ignore.split(",");
+ }
+ if (cli.ignorePattern) {
+ result.ignorePattern = cli.ignorePattern.split(",");
+ }
+ result.path = cli.path ? [cli.path].concat(cli.args) : cli.args;
+ if (result.path.length === 0) {
+ delete result.path;
+ }
+ Object.keys(result).forEach((key) => {
+ if (typeof result[key] === "undefined") {
+ delete result[key];
+ }
+ });
+ return result;
+};
+var readConfigJson = (config) => {
+ const configFile = config ? (0,external_path_.resolve)(config) : (0,external_path_.resolve)(".jscpd.json");
+ const configExists = (0,external_fs_.existsSync)(configFile);
+ if (configExists) {
+ const result = { config: configFile, ...(0,fs_extra_lib.readJSONSync)(configFile) };
+ if (result.path) {
+ result.path = result.path.map((path) => (0,external_path_.resolve)((0,external_path_.dirname)(configFile), path));
+ }
+ return result;
+ }
+ return {};
+};
+var readPackageJsonConfig = () => {
+ const config = (0,external_path_.resolve)(process.cwd() + "/package.json");
+ if ((0,external_fs_.existsSync)(config)) {
+ const json = (0,fs_extra_lib.readJSONSync)(config);
+ if (json.jscpd && json.jscpd.path) {
+ json.jscpd.path = json.jscpd.path.map((path) => (0,external_path_.resolve)((0,external_path_.dirname)(config), path));
+ }
+ return json.jscpd ? { config, ...json.jscpd } : {};
+ }
+ return {};
+};
+function prepareOptions(cli) {
+ const storedConfig = readConfigJson(cli.config);
+ const packageJsonConfig = readPackageJsonConfig();
+ const argsConfig = convertCliToOptions(cli);
+ const result = {
+ ...getDefaultOptions(),
+ ...packageJsonConfig,
+ ...storedConfig,
+ ...argsConfig
+ };
+ result.reporters = result.reporters || [];
+ result.listeners = result.listeners || [];
+ if (result.silent) {
+ result.reporters = result.reporters.filter(
+ (reporter) => !reporter.includes("console")
+ ).concat("silent");
+ }
+ if (result.threshold !== void 0) {
+ result.reporters = [...result.reporters, "threshold"];
+ }
+ return result;
+}
+
+// src/init/options.ts
+function initOptionsFromCli(cli) {
+ const options = prepareOptions(cli);
+ options.format = options.format || getSupportedFormats();
+ options.mode = getModeHandler(options.mode);
+ options.ignore = initIgnore(options);
+ return options;
+}
+
+// src/print/files.ts
+
+function printFiles(files) {
+ files.forEach((stats) => {
+ console.log((0,safe.grey)(stats.path));
+ });
+ console.log((0,safe.bold)(`Found ${files.length} files to detect.`));
+}
+
+// src/print/options.ts
+
+function printOptions(options) {
+ console.log((0,safe.bold)((0,safe.white)("Options:")));
+ console.dir(options);
+}
+
+// src/print/supported-format.ts
+
+
+function printSupportedFormat() {
+ console.log((0,safe.bold)((0,safe.white)("Supported formats: ")));
+ console.log(getSupportedFormats().join(", "));
+ process.exit(0);
+}
+
+// src/index.ts
+
+
+// src/init/store.ts
+
+
+function getStore(storeName) {
+ if (storeName) {
+ const packageName = "@jscpd/" + storeName + "-store";
+ try {
+ const store = jscpd_require(packageName).default;
+ return new store();
+ } catch (e) {
+ console.error((0,safe.red)("store name " + storeName + " not installed."));
+ }
+ }
+ return new MemoryStore();
+}
+
+// src/index.ts
+
+
+// src/init/reporters.ts
+
+
+
+
+var reporters = {
+ xml: XmlReporter,
+ json: JsonReporter,
+ csv: CSVReporter,
+ markdown: MarkdownReporter,
+ consoleFull: ConsoleFullReporter,
+ html: HtmlReporter,
+ console: ConsoleReporter,
+ silent: SilentReporter,
+ threshold: ThresholdReporter,
+ xcode: XcodeReporter,
+ sarif: SarifReporter
+};
+function registerReporters(options, detector) {
+ options.reporters.forEach((reporter) => {
+ if (reporter in reporters) {
+ detector.registerReporter(new reporters[reporter](options));
+ } else {
+ try {
+ const reporterClass = jscpd_require(`@jscpd/${reporter}-reporter`).default;
+ detector.registerReporter(new reporterClass(options));
+ } catch (e) {
+ try {
+ const reporterClass = jscpd_require(`jscpd-${reporter}-reporter`).default;
+ detector.registerReporter(new reporterClass(options));
+ } catch (e2) {
+ console.log((0,safe.yellow)(`warning: ${reporter} not installed (install packages named @jscpd/${reporter}-reporter or jscpd-${reporter}-reporter)`));
+ console.log((0,safe.grey)(e2.message));
+ }
+ }
+ }
+ });
+}
+
+// src/init/subscribers.ts
+
+function registerSubscribers(options, detector) {
+ if (options.verbose) {
+ detector.registerSubscriber(new VerboseSubscriber(options));
+ }
+ if (!options.silent) {
+ detector.registerSubscriber(new ProgressSubscriber(options));
+ }
+}
+
+// src/init/hooks.ts
+
+function registerHooks(options, detector) {
+ detector.registerHook(new FragmentsHook());
+ if (options.blame) {
+ detector.registerHook(new BlamerHook());
+ }
+}
+
+// src/index.ts
+
+var TIMER_LABEL = "Detection time:";
+var detectClones = (opts, store = void 0) => {
+ const options = { ...getDefaultOptions(), ...opts };
+ options.format = options.format || getSupportedFormats();
+ const files = getFilesToDetect(options);
+ const hashFunction = (value) => {
+ return (0,external_crypto_.createHash)("md5").update(value).digest("hex");
+ };
+ options.hashFunction = options.hashFunction || hashFunction;
+ const currentStore = store || getStore(options.store);
+ const statistic = new Statistic();
+ const tokenizer = new Tokenizer();
+ const detector = new InFilesDetector(tokenizer, currentStore, statistic, options);
+ registerReporters(options, detector);
+ registerSubscribers(options, detector);
+ registerHooks(options, detector);
+ if (!options.silent) {
+ console.time((0,safe.italic)((0,safe.grey)(TIMER_LABEL)));
+ }
+ return detector.detect(files).then((clones) => {
+ if (!options.silent) {
+ console.timeEnd((0,safe.italic)((0,safe.grey)(TIMER_LABEL)));
+ }
+ return clones;
+ });
+};
+async function jscpd(argv, exitCallback) {
+ const packageJson = (0,fs_extra_lib.readJSONSync)(__nccwpck_require__.ab + "package.json");
+ const cli = initCli(packageJson, argv);
+ const options = initOptionsFromCli(cli);
+ if (options.list) {
+ printSupportedFormat();
+ }
+ if (options.debug) {
+ printOptions(options);
+ }
+ if (!options.path || options.path.length === 0) {
+ options.path = [process.cwd()];
+ }
+ if (options.debug) {
+ const files = getFilesToDetect(options);
+ printFiles(files);
+ return Promise.resolve([]);
+ } else {
+ const store = getStore(options.store);
+ return detectClones(options, store).then((clones) => {
+ if (clones.length > 0) {
+ exitCallback?.(options.exitCode || 0);
+ }
+ return clones;
+ }).finally(() => {
+ store.close();
+ });
+ }
+}
+
+// bin/jscpd.ts
+(async () => {
+ try {
+ await jscpd(process.argv, process.exit);
+ } catch (e) {
+ console.log(e);
+ process.exit(1);
+ }
+})();
+
+//# sourceMappingURL=jscpd.mjs.map
+// EXTERNAL MODULE: external "util"
+var external_util_ = __nccwpck_require__(73837);
+// EXTERNAL MODULE: ./lib/common.js
+var common = __nccwpck_require__(86979);
+// EXTERNAL MODULE: ./lib/execute.js
+var execute = __nccwpck_require__(3532);
+// EXTERNAL MODULE: ./lib/git.js + 1 modules
+var lib_git = __nccwpck_require__(63350);
+// EXTERNAL MODULE: ./lib/readConfig.js + 1 modules
+var readConfig = __nccwpck_require__(22094);
+;// CONCATENATED MODULE: ./lib/duplicated.js
@@ -151,48 +3186,48 @@ async function duplicatedCheck(workspace, jscpdConfigPath, jscpdCheckAsError, po
const cwd = process.cwd();
const path = checkWorkspace(workspace);
const options = getOptions(jscpdConfigPath, path, cwd);
- const clones = await (0,jscpd__WEBPACK_IMPORTED_MODULE_3__.detectClones)(options);
+ const clones = await detectClones(options);
if (clones.length > 0) {
const reportFiles = getReportFiles(cwd);
const markdownReport = reportFiles.find(file => file.endsWith('.md'));
const jsonReport = reportFiles.find(file => file.endsWith('.json'));
const message = await postReport(githubClient, markdownReport, clones, workspace, postNewComment);
- fs__WEBPACK_IMPORTED_MODULE_2__.writeFileSync(markdownReport, message);
- await _git__WEBPACK_IMPORTED_MODULE_7__/* .UploadReportToArtifacts */ .BC([markdownReport, jsonReport], REPORT_ARTIFACT_NAME);
+ external_fs_.writeFileSync(markdownReport, message);
+ await lib_git/* UploadReportToArtifacts */.BC([markdownReport, jsonReport], REPORT_ARTIFACT_NAME);
const isOverThreshold = checkThreshold(jsonReport, options.threshold || 0);
- jscpdCheckAsError && isOverThreshold ? _actions_core__WEBPACK_IMPORTED_MODULE_0__.setFailed('❌ DUPLICATED CODE FOUND') : _actions_core__WEBPACK_IMPORTED_MODULE_0__.warning('DUPLICATED CODE FOUND', ANNOTATION_OPTIONS);
+ jscpdCheckAsError && isOverThreshold ? core.setFailed('❌ DUPLICATED CODE FOUND') : core.warning('DUPLICATED CODE FOUND', ANNOTATION_OPTIONS);
showAnnotation(clones, cwd, jscpdCheckAsError && isOverThreshold);
- _actions_core__WEBPACK_IMPORTED_MODULE_0__.setOutput('hasDuplicates', `${isOverThreshold}`);
+ core.setOutput('hasDuplicates', `${isOverThreshold}`);
}
else {
- _actions_core__WEBPACK_IMPORTED_MODULE_0__.setOutput('hasDuplicates', 'false');
- _actions_core__WEBPACK_IMPORTED_MODULE_0__.notice('✅ NO DUPLICATED CODE FOUND', ANNOTATION_OPTIONS);
+ core.setOutput('hasDuplicates', 'false');
+ core.notice('✅ NO DUPLICATED CODE FOUND', ANNOTATION_OPTIONS);
}
- await (0,_execute__WEBPACK_IMPORTED_MODULE_6__/* .execute */ .h)(`rm -rf ${cwd}/${REPORT_ARTIFACT_NAME}`);
+ await (0,execute/* execute */.h)(`rm -rf ${cwd}/${REPORT_ARTIFACT_NAME}`);
}
function getOptions(jscpdConfigPath, workspace, cwd) {
- const configOptions = (0,_readConfig__WEBPACK_IMPORTED_MODULE_8__/* .readConfig */ .z)({}, jscpdConfigPath, workspace, '.jscpd.json');
+ const configOptions = (0,readConfig/* readConfig */.z)({}, jscpdConfigPath, workspace, '.jscpd.json');
const defaultOptions = {
path: [`${workspace}`],
reporters: ['markdown', 'json', 'consoleFull'],
output: `${cwd}/${REPORT_ARTIFACT_NAME}`
};
const options = { ...configOptions, ...defaultOptions };
- _actions_core__WEBPACK_IMPORTED_MODULE_0__.startGroup('🔎 loaded options');
- _actions_core__WEBPACK_IMPORTED_MODULE_0__.info(`${(0,util__WEBPACK_IMPORTED_MODULE_4__.inspect)(options)}`);
- _actions_core__WEBPACK_IMPORTED_MODULE_0__.endGroup();
+ core.startGroup('🔎 loaded options');
+ core.info(`${(0,external_util_.inspect)(options)}`);
+ core.endGroup();
return options;
}
function getReportFiles(cwd) {
- const files = fs__WEBPACK_IMPORTED_MODULE_2__.readdirSync(`${cwd}/${REPORT_ARTIFACT_NAME}`);
+ const files = external_fs_.readdirSync(`${cwd}/${REPORT_ARTIFACT_NAME}`);
const filePaths = files.map(file => `${cwd}/${REPORT_ARTIFACT_NAME}/${file}`);
- _actions_core__WEBPACK_IMPORTED_MODULE_0__.info(`reportFiles: ${filePaths.join(',')}`);
+ core.info(`reportFiles: ${filePaths.join(',')}`);
return filePaths;
}
function checkWorkspace(workspace) {
- _actions_core__WEBPACK_IMPORTED_MODULE_0__.info(`workspace: ${workspace}`);
+ core.info(`workspace: ${workspace}`);
//check if workspace path is a file
- const isFile = fs__WEBPACK_IMPORTED_MODULE_2__.existsSync(workspace) && fs__WEBPACK_IMPORTED_MODULE_2__.lstatSync(workspace).isFile();
+ const isFile = external_fs_.existsSync(workspace) && external_fs_.lstatSync(workspace).isFile();
if (isFile) {
// if it is a file, get the directory
return workspace.substring(0, workspace.lastIndexOf('/'));
@@ -200,7 +3235,7 @@ function checkWorkspace(workspace) {
return workspace;
}
function showAnnotation(clones, cwd, isError) {
- const show = isError ? _actions_core__WEBPACK_IMPORTED_MODULE_0__.error : _actions_core__WEBPACK_IMPORTED_MODULE_0__.warning;
+ const show = isError ? core.error : core.warning;
for (const clone of clones) {
show(`${clone.duplicationA.sourceId.replace(cwd, '')} (${clone.duplicationA.start.line}-${clone.duplicationA.end.line})
and ${clone.duplicationB.sourceId.replace(cwd, '')} (${clone.duplicationB.start.line}-${clone.duplicationB.end.line})`, {
@@ -215,7 +3250,7 @@ function getReportHeader(workspace) {
return `## ❌ DUPLICATED CODE FOUND - ${workspace}`;
}
async function postReport(githubClient, markdownReport, clones, workspace, postNewComment) {
- let report = fs__WEBPACK_IMPORTED_MODULE_2__.readFileSync(markdownReport, 'utf8');
+ let report = external_fs_.readFileSync(markdownReport, 'utf8');
// remove existing header
report = report.replace('# Copy/paste detection report', '');
const cwd = process.cwd();
@@ -229,28 +3264,28 @@ async function postReport(githubClient, markdownReport, clones, workspace, postN
}
markdown += '\n';
const header = getReportHeader(workspace);
- const message = `${header} \n\n${report}\n\n ${markdown}\n\n ${(0,_common__WEBPACK_IMPORTED_MODULE_5__/* .getReportFooter */ .TS)()}`;
- await _git__WEBPACK_IMPORTED_MODULE_7__/* .setSummary */ .Li(message);
- if (_actions_github__WEBPACK_IMPORTED_MODULE_1__.context.eventName === 'pull_request') {
- const existingCommentId = await _git__WEBPACK_IMPORTED_MODULE_7__/* .getExistingCommentId */ .Iy(githubClient, header);
+ const message = `${header} \n\n${report}\n\n ${markdown}\n\n ${(0,common/* getReportFooter */.TS)()}`;
+ await lib_git/* setSummary */.Li(message);
+ if (github.context.eventName === 'pull_request') {
+ const existingCommentId = await lib_git/* getExistingCommentId */.Iy(githubClient, header);
if (!postNewComment && existingCommentId) {
- await _git__WEBPACK_IMPORTED_MODULE_7__/* .updateComment */ .uA(githubClient, existingCommentId, message);
+ await lib_git/* updateComment */.uA(githubClient, existingCommentId, message);
}
else {
- await _git__WEBPACK_IMPORTED_MODULE_7__/* .comment */ .UI(githubClient, message);
+ await lib_git/* comment */.UI(githubClient, message);
}
}
return message;
}
function toGithubLink(path, cwd, range) {
const main = path.replace(`${cwd}/`, '');
- return `[${main}#L${range[0]}-L${range[1]}](https://github.com/${_actions_github__WEBPACK_IMPORTED_MODULE_1__.context.repo.owner}/${_actions_github__WEBPACK_IMPORTED_MODULE_1__.context.repo.repo}/blob/${_actions_github__WEBPACK_IMPORTED_MODULE_1__.context.sha}/${main}#L${range[0]}-L${range[1]})`;
+ return `[${main}#L${range[0]}-L${range[1]}](https://github.com/${github.context.repo.owner}/${github.context.repo.repo}/blob/${github.context.sha}/${main}#L${range[0]}-L${range[1]})`;
}
function checkThreshold(jsonReport, threshold) {
// read json report
- const report = JSON.parse(fs__WEBPACK_IMPORTED_MODULE_2__.readFileSync(jsonReport, 'utf8'));
+ const report = JSON.parse(external_fs_.readFileSync(jsonReport, 'utf8'));
if (report.statistics.total.percentage > threshold) {
- _actions_core__WEBPACK_IMPORTED_MODULE_0__.error(`DUPLICATED CODE FOUND ${report.statistics.total.percentage}% IS OVER THRESHOLD ${threshold}%`, ANNOTATION_OPTIONS);
+ core.error(`DUPLICATED CODE FOUND ${report.statistics.total.percentage}% IS OVER THRESHOLD ${threshold}%`, ANNOTATION_OPTIONS);
return true;
}
return false;
@@ -823,7 +3858,7 @@ __nccwpck_require__.r(__webpack_exports__);
/* harmony import */ var util__WEBPACK_IMPORTED_MODULE_1__ = __nccwpck_require__(73837);
/* harmony import */ var util__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__nccwpck_require__.n(util__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_2__ = __nccwpck_require__(86979);
-/* harmony import */ var _duplicated__WEBPACK_IMPORTED_MODULE_3__ = __nccwpck_require__(93562);
+/* harmony import */ var _duplicated__WEBPACK_IMPORTED_MODULE_3__ = __nccwpck_require__(73765);
/* harmony import */ var _format__WEBPACK_IMPORTED_MODULE_4__ = __nccwpck_require__(19118);
/* harmony import */ var _problem_matcher__WEBPACK_IMPORTED_MODULE_5__ = __nccwpck_require__(6702);
@@ -6960,7 +9995,7 @@ var __rest = (this && this.__rest) || function (s, e) {
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.DefaultArtifactClient = void 0;
-const core_1 = __nccwpck_require__(15457);
+const core_1 = __nccwpck_require__(42186);
const config_1 = __nccwpck_require__(74610);
const upload_artifact_1 = __nccwpck_require__(42578);
const download_artifact_1 = __nccwpck_require__(73555);
@@ -7100,7 +10135,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.deleteArtifactInternal = exports.deleteArtifactPublic = void 0;
-const core_1 = __nccwpck_require__(15457);
+const core_1 = __nccwpck_require__(42186);
const github_1 = __nccwpck_require__(21260);
const user_agent_1 = __nccwpck_require__(85164);
const retry_options_1 = __nccwpck_require__(64597);
@@ -7218,7 +10253,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.downloadArtifactInternal = exports.downloadArtifactPublic = exports.streamExtractExternal = void 0;
const promises_1 = __importDefault(__nccwpck_require__(73292));
const github = __importStar(__nccwpck_require__(21260));
-const core = __importStar(__nccwpck_require__(15457));
+const core = __importStar(__nccwpck_require__(42186));
const httpClient = __importStar(__nccwpck_require__(58464));
const unzip_stream_1 = __importDefault(__nccwpck_require__(69340));
const user_agent_1 = __nccwpck_require__(85164);
@@ -7427,7 +10462,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getArtifactInternal = exports.getArtifactPublic = void 0;
const github_1 = __nccwpck_require__(21260);
const plugin_retry_1 = __nccwpck_require__(86298);
-const core = __importStar(__nccwpck_require__(15457));
+const core = __importStar(__nccwpck_require__(42186));
const utils_1 = __nccwpck_require__(58154);
const retry_options_1 = __nccwpck_require__(64597);
const plugin_request_log_1 = __nccwpck_require__(68883);
@@ -7531,7 +10566,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.listArtifactsInternal = exports.listArtifactsPublic = void 0;
-const core_1 = __nccwpck_require__(15457);
+const core_1 = __nccwpck_require__(42186);
const github_1 = __nccwpck_require__(21260);
const user_agent_1 = __nccwpck_require__(85164);
const retry_options_1 = __nccwpck_require__(64597);
@@ -7691,7 +10726,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getRetryOptions = void 0;
-const core = __importStar(__nccwpck_require__(15457));
+const core = __importStar(__nccwpck_require__(42186));
// Defaults for fetching artifacts
const defaultMaxRetryNumber = 5;
const defaultExemptStatusCodes = [400, 401, 403, 404, 422]; // https://github.com/octokit/plugin-retry.js/blob/9a2443746c350b3beedec35cf26e197ea318a261/src/index.ts#L14
@@ -7736,7 +10771,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.internalArtifactTwirpClient = void 0;
const http_client_1 = __nccwpck_require__(58464);
const auth_1 = __nccwpck_require__(5788);
-const core_1 = __nccwpck_require__(15457);
+const core_1 = __nccwpck_require__(42186);
const generated_1 = __nccwpck_require__(49960);
const config_1 = __nccwpck_require__(74610);
const user_agent_1 = __nccwpck_require__(85164);
@@ -7888,7 +10923,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getUploadChunkTimeout = exports.getConcurrency = exports.getGitHubWorkspaceDir = exports.isGhes = exports.getResultsServiceUrl = exports.getRuntimeToken = exports.getUploadChunkSize = void 0;
const os_1 = __importDefault(__nccwpck_require__(22037));
-const core_1 = __nccwpck_require__(15457);
+const core_1 = __nccwpck_require__(42186);
// Used for controlling the highWaterMark value of the zip that is being streamed
// The same value is used as the chunk size that is use during upload to blob storage
function getUploadChunkSize() {
@@ -8109,7 +11144,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getBackendIdsFromToken = void 0;
-const core = __importStar(__nccwpck_require__(15457));
+const core = __importStar(__nccwpck_require__(42186));
const config_1 = __nccwpck_require__(74610);
const jwt_decode_1 = __importDefault(__nccwpck_require__(84329));
const InvalidJwtError = new Error('Failed to get backend IDs: The provided JWT token is invalid and/or missing claims');
@@ -8205,7 +11240,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.uploadZipToBlobStorage = void 0;
const storage_blob_1 = __nccwpck_require__(84100);
const config_1 = __nccwpck_require__(74610);
-const core = __importStar(__nccwpck_require__(15457));
+const core = __importStar(__nccwpck_require__(42186));
const crypto = __importStar(__nccwpck_require__(6113));
const stream = __importStar(__nccwpck_require__(12781));
const errors_1 = __nccwpck_require__(38182);
@@ -8288,7 +11323,7 @@ exports.uploadZipToBlobStorage = uploadZipToBlobStorage;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.validateFilePath = exports.validateArtifactName = void 0;
-const core_1 = __nccwpck_require__(15457);
+const core_1 = __nccwpck_require__(42186);
/**
* Invalid characters that cannot be in the artifact name or an uploaded file. Will be rejected
* from the server if attempted to be sent over. These characters are not allowed due to limitations with certain
@@ -8386,7 +11421,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getExpiration = void 0;
const generated_1 = __nccwpck_require__(49960);
-const core = __importStar(__nccwpck_require__(15457));
+const core = __importStar(__nccwpck_require__(42186));
function getExpiration(retentionDays) {
if (!retentionDays) {
return undefined;
@@ -8455,7 +11490,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.uploadArtifact = void 0;
-const core = __importStar(__nccwpck_require__(15457));
+const core = __importStar(__nccwpck_require__(42186));
const retention_1 = __nccwpck_require__(3231);
const path_and_artifact_name_validation_1 = __nccwpck_require__(63219);
const artifact_twirp_client_1 = __nccwpck_require__(12312);
@@ -8558,7 +11593,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getUploadZipSpecification = exports.validateRootDirectory = void 0;
const fs = __importStar(__nccwpck_require__(57147));
-const core_1 = __nccwpck_require__(15457);
+const core_1 = __nccwpck_require__(42186);
const path_1 = __nccwpck_require__(71017);
const path_and_artifact_name_validation_1 = __nccwpck_require__(63219);
/**
@@ -8692,7 +11727,7 @@ exports.createZipUploadStream = exports.ZipUploadStream = exports.DEFAULT_COMPRE
const stream = __importStar(__nccwpck_require__(12781));
const promises_1 = __nccwpck_require__(73292);
const archiver = __importStar(__nccwpck_require__(43084));
-const core = __importStar(__nccwpck_require__(15457));
+const core = __importStar(__nccwpck_require__(42186));
const config_1 = __nccwpck_require__(74610);
exports.DEFAULT_COMPRESSION_LEVEL = 6;
// Custom stream transformer so we can set the highWaterMark property
@@ -8775,18 +11810,75 @@ const zipEndCallback = () => {
/***/ }),
-/***/ 56270:
+/***/ 47387:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.Context = void 0;
+const fs_1 = __nccwpck_require__(57147);
+const os_1 = __nccwpck_require__(22037);
+class Context {
+ /**
+ * Hydrate the context from the environment
+ */
+ constructor() {
+ var _a, _b, _c;
+ this.payload = {};
+ if (process.env.GITHUB_EVENT_PATH) {
+ if (fs_1.existsSync(process.env.GITHUB_EVENT_PATH)) {
+ this.payload = JSON.parse(fs_1.readFileSync(process.env.GITHUB_EVENT_PATH, { encoding: 'utf8' }));
+ }
+ else {
+ const path = process.env.GITHUB_EVENT_PATH;
+ process.stdout.write(`GITHUB_EVENT_PATH ${path} does not exist${os_1.EOL}`);
+ }
+ }
+ this.eventName = process.env.GITHUB_EVENT_NAME;
+ this.sha = process.env.GITHUB_SHA;
+ this.ref = process.env.GITHUB_REF;
+ this.workflow = process.env.GITHUB_WORKFLOW;
+ this.action = process.env.GITHUB_ACTION;
+ this.actor = process.env.GITHUB_ACTOR;
+ this.job = process.env.GITHUB_JOB;
+ this.runNumber = parseInt(process.env.GITHUB_RUN_NUMBER, 10);
+ this.runId = parseInt(process.env.GITHUB_RUN_ID, 10);
+ this.apiUrl = (_a = process.env.GITHUB_API_URL) !== null && _a !== void 0 ? _a : `https://api.github.com`;
+ this.serverUrl = (_b = process.env.GITHUB_SERVER_URL) !== null && _b !== void 0 ? _b : `https://github.com`;
+ this.graphqlUrl = (_c = process.env.GITHUB_GRAPHQL_URL) !== null && _c !== void 0 ? _c : `https://api.github.com/graphql`;
+ }
+ get issue() {
+ const payload = this.payload;
+ return Object.assign(Object.assign({}, this.repo), { number: (payload.issue || payload.pull_request || payload).number });
+ }
+ get repo() {
+ if (process.env.GITHUB_REPOSITORY) {
+ const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/');
+ return { owner, repo };
+ }
+ if (this.payload.repository) {
+ return {
+ owner: this.payload.repository.owner.login,
+ repo: this.payload.repository.name
+ };
+ }
+ throw new Error("context.repo requires a GITHUB_REPOSITORY environment variable like 'owner/repo'");
+ }
+}
+exports.Context = Context;
+//# sourceMappingURL=context.js.map
+
+/***/ }),
+
+/***/ 21260:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
- var desc = Object.getOwnPropertyDescriptor(m, k);
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
- desc = { enumerable: true, get: function() { return m[k]; } };
- }
- Object.defineProperty(o, k2, desc);
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
@@ -8799,90 +11891,147 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.issue = exports.issueCommand = void 0;
-const os = __importStar(__nccwpck_require__(22037));
-const utils_1 = __nccwpck_require__(86700);
+exports.getOctokit = exports.context = void 0;
+const Context = __importStar(__nccwpck_require__(47387));
+const utils_1 = __nccwpck_require__(58154);
+exports.context = new Context.Context();
/**
- * Commands
- *
- * Command Format:
- * ::name key=value,key=value::message
+ * Returns a hydrated octokit ready to use for GitHub Actions
*
- * Examples:
- * ::warning::This is the message
- * ::set-env name=MY_VAR::some value
+ * @param token the repo PAT or GITHUB_TOKEN
+ * @param options other options to set
*/
-function issueCommand(command, properties, message) {
- const cmd = new Command(command, properties, message);
- process.stdout.write(cmd.toString() + os.EOL);
-}
-exports.issueCommand = issueCommand;
-function issue(name, message = '') {
- issueCommand(name, {}, message);
+function getOctokit(token, options, ...additionalPlugins) {
+ const GitHubWithPlugins = utils_1.GitHub.plugin(...additionalPlugins);
+ return new GitHubWithPlugins(utils_1.getOctokitOptions(token, options));
}
-exports.issue = issue;
-const CMD_STRING = '::';
-class Command {
- constructor(command, properties, message) {
- if (!command) {
- command = 'missing.command';
- }
- this.command = command;
- this.properties = properties;
- this.message = message;
+exports.getOctokit = getOctokit;
+//# sourceMappingURL=github.js.map
+
+/***/ }),
+
+/***/ 12114:
+/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
+
+"use strict";
+
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
+}) : (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+ o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || function (mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ __setModuleDefault(result, mod);
+ return result;
+};
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.getApiBaseUrl = exports.getProxyAgent = exports.getAuthString = void 0;
+const httpClient = __importStar(__nccwpck_require__(8343));
+function getAuthString(token, options) {
+ if (!token && !options.auth) {
+ throw new Error('Parameter token or opts.auth is required');
}
- toString() {
- let cmdStr = CMD_STRING + this.command;
- if (this.properties && Object.keys(this.properties).length > 0) {
- cmdStr += ' ';
- let first = true;
- for (const key in this.properties) {
- if (this.properties.hasOwnProperty(key)) {
- const val = this.properties[key];
- if (val) {
- if (first) {
- first = false;
- }
- else {
- cmdStr += ',';
- }
- cmdStr += `${key}=${escapeProperty(val)}`;
- }
- }
- }
- }
- cmdStr += `${CMD_STRING}${escapeData(this.message)}`;
- return cmdStr;
+ else if (token && options.auth) {
+ throw new Error('Parameters token and opts.auth may not both be specified');
}
+ return typeof options.auth === 'string' ? options.auth : `token ${token}`;
}
-function escapeData(s) {
- return (0, utils_1.toCommandValue)(s)
- .replace(/%/g, '%25')
- .replace(/\r/g, '%0D')
- .replace(/\n/g, '%0A');
+exports.getAuthString = getAuthString;
+function getProxyAgent(destinationUrl) {
+ const hc = new httpClient.HttpClient();
+ return hc.getAgent(destinationUrl);
}
-function escapeProperty(s) {
- return (0, utils_1.toCommandValue)(s)
- .replace(/%/g, '%25')
- .replace(/\r/g, '%0D')
- .replace(/\n/g, '%0A')
- .replace(/:/g, '%3A')
- .replace(/,/g, '%2C');
+exports.getProxyAgent = getProxyAgent;
+function getApiBaseUrl() {
+ return process.env['GITHUB_API_URL'] || 'https://api.github.com';
}
-//# sourceMappingURL=command.js.map
+exports.getApiBaseUrl = getApiBaseUrl;
+//# sourceMappingURL=utils.js.map
+
+/***/ }),
+
+/***/ 58154:
+/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
+
+"use strict";
+
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
+}) : (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+ o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || function (mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ __setModuleDefault(result, mod);
+ return result;
+};
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.getOctokitOptions = exports.GitHub = exports.defaults = exports.context = void 0;
+const Context = __importStar(__nccwpck_require__(47387));
+const Utils = __importStar(__nccwpck_require__(12114));
+// octokit + plugins
+const core_1 = __nccwpck_require__(76762);
+const plugin_rest_endpoint_methods_1 = __nccwpck_require__(83044);
+const plugin_paginate_rest_1 = __nccwpck_require__(64193);
+exports.context = new Context.Context();
+const baseUrl = Utils.getApiBaseUrl();
+exports.defaults = {
+ baseUrl,
+ request: {
+ agent: Utils.getProxyAgent(baseUrl)
+ }
+};
+exports.GitHub = core_1.Octokit.plugin(plugin_rest_endpoint_methods_1.restEndpointMethods, plugin_paginate_rest_1.paginateRest).defaults(exports.defaults);
+/**
+ * Convience function to correctly format Octokit Options to pass into the constructor.
+ *
+ * @param token the repo PAT or GITHUB_TOKEN
+ * @param options other options to set
+ */
+function getOctokitOptions(token, options) {
+ const opts = Object.assign({}, options || {}); // Shallow clone - don't mutate the object provided by the caller
+ // Auth
+ const auth = Utils.getAuthString(token, opts);
+ if (auth) {
+ opts.auth = auth;
+ }
+ return opts;
+}
+exports.getOctokitOptions = getOctokitOptions;
+//# sourceMappingURL=utils.js.map
/***/ }),
-/***/ 15457:
+/***/ 8343:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
"use strict";
+/* eslint-disable @typescript-eslint/no-explicit-any */
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -8916,980 +12065,720 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.platform = exports.toPlatformPath = exports.toWin32Path = exports.toPosixPath = exports.markdownSummary = exports.summary = exports.getIDToken = exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.notice = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0;
-const command_1 = __nccwpck_require__(56270);
-const file_command_1 = __nccwpck_require__(85436);
-const utils_1 = __nccwpck_require__(86700);
-const os = __importStar(__nccwpck_require__(22037));
-const path = __importStar(__nccwpck_require__(71017));
-const oidc_utils_1 = __nccwpck_require__(4759);
-/**
- * The code to exit an action
- */
-var ExitCode;
-(function (ExitCode) {
- /**
- * A code indicating that the action was successful
- */
- ExitCode[ExitCode["Success"] = 0] = "Success";
- /**
- * A code indicating that the action was a failure
- */
- ExitCode[ExitCode["Failure"] = 1] = "Failure";
-})(ExitCode || (exports.ExitCode = ExitCode = {}));
-//-----------------------------------------------------------------------
-// Variables
-//-----------------------------------------------------------------------
-/**
- * Sets env variable for this action and future actions in the job
- * @param name the name of the variable to set
- * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
- */
-// eslint-disable-next-line @typescript-eslint/no-explicit-any
-function exportVariable(name, val) {
- const convertedVal = (0, utils_1.toCommandValue)(val);
- process.env[name] = convertedVal;
- const filePath = process.env['GITHUB_ENV'] || '';
- if (filePath) {
- return (0, file_command_1.issueFileCommand)('ENV', (0, file_command_1.prepareKeyValueMessage)(name, val));
- }
- (0, command_1.issueCommand)('set-env', { name }, convertedVal);
-}
-exports.exportVariable = exportVariable;
+exports.HttpClient = exports.isHttps = exports.HttpClientResponse = exports.HttpClientError = exports.getProxyUrl = exports.MediaTypes = exports.Headers = exports.HttpCodes = void 0;
+const http = __importStar(__nccwpck_require__(13685));
+const https = __importStar(__nccwpck_require__(95687));
+const pm = __importStar(__nccwpck_require__(72212));
+const tunnel = __importStar(__nccwpck_require__(74294));
+const undici_1 = __nccwpck_require__(41773);
+var HttpCodes;
+(function (HttpCodes) {
+ HttpCodes[HttpCodes["OK"] = 200] = "OK";
+ HttpCodes[HttpCodes["MultipleChoices"] = 300] = "MultipleChoices";
+ HttpCodes[HttpCodes["MovedPermanently"] = 301] = "MovedPermanently";
+ HttpCodes[HttpCodes["ResourceMoved"] = 302] = "ResourceMoved";
+ HttpCodes[HttpCodes["SeeOther"] = 303] = "SeeOther";
+ HttpCodes[HttpCodes["NotModified"] = 304] = "NotModified";
+ HttpCodes[HttpCodes["UseProxy"] = 305] = "UseProxy";
+ HttpCodes[HttpCodes["SwitchProxy"] = 306] = "SwitchProxy";
+ HttpCodes[HttpCodes["TemporaryRedirect"] = 307] = "TemporaryRedirect";
+ HttpCodes[HttpCodes["PermanentRedirect"] = 308] = "PermanentRedirect";
+ HttpCodes[HttpCodes["BadRequest"] = 400] = "BadRequest";
+ HttpCodes[HttpCodes["Unauthorized"] = 401] = "Unauthorized";
+ HttpCodes[HttpCodes["PaymentRequired"] = 402] = "PaymentRequired";
+ HttpCodes[HttpCodes["Forbidden"] = 403] = "Forbidden";
+ HttpCodes[HttpCodes["NotFound"] = 404] = "NotFound";
+ HttpCodes[HttpCodes["MethodNotAllowed"] = 405] = "MethodNotAllowed";
+ HttpCodes[HttpCodes["NotAcceptable"] = 406] = "NotAcceptable";
+ HttpCodes[HttpCodes["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired";
+ HttpCodes[HttpCodes["RequestTimeout"] = 408] = "RequestTimeout";
+ HttpCodes[HttpCodes["Conflict"] = 409] = "Conflict";
+ HttpCodes[HttpCodes["Gone"] = 410] = "Gone";
+ HttpCodes[HttpCodes["TooManyRequests"] = 429] = "TooManyRequests";
+ HttpCodes[HttpCodes["InternalServerError"] = 500] = "InternalServerError";
+ HttpCodes[HttpCodes["NotImplemented"] = 501] = "NotImplemented";
+ HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway";
+ HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable";
+ HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout";
+})(HttpCodes || (exports.HttpCodes = HttpCodes = {}));
+var Headers;
+(function (Headers) {
+ Headers["Accept"] = "accept";
+ Headers["ContentType"] = "content-type";
+})(Headers || (exports.Headers = Headers = {}));
+var MediaTypes;
+(function (MediaTypes) {
+ MediaTypes["ApplicationJson"] = "application/json";
+})(MediaTypes || (exports.MediaTypes = MediaTypes = {}));
/**
- * Registers a secret which will get masked from logs
- * @param secret value of the secret
+ * Returns the proxy URL, depending upon the supplied url and proxy environment variables.
+ * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
*/
-function setSecret(secret) {
- (0, command_1.issueCommand)('add-mask', {}, secret);
+function getProxyUrl(serverUrl) {
+ const proxyUrl = pm.getProxyUrl(new URL(serverUrl));
+ return proxyUrl ? proxyUrl.href : '';
}
-exports.setSecret = setSecret;
-/**
- * Prepends inputPath to the PATH (for this action and future actions)
- * @param inputPath
- */
-function addPath(inputPath) {
- const filePath = process.env['GITHUB_PATH'] || '';
- if (filePath) {
- (0, file_command_1.issueFileCommand)('PATH', inputPath);
- }
- else {
- (0, command_1.issueCommand)('add-path', {}, inputPath);
+exports.getProxyUrl = getProxyUrl;
+const HttpRedirectCodes = [
+ HttpCodes.MovedPermanently,
+ HttpCodes.ResourceMoved,
+ HttpCodes.SeeOther,
+ HttpCodes.TemporaryRedirect,
+ HttpCodes.PermanentRedirect
+];
+const HttpResponseRetryCodes = [
+ HttpCodes.BadGateway,
+ HttpCodes.ServiceUnavailable,
+ HttpCodes.GatewayTimeout
+];
+const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD'];
+const ExponentialBackoffCeiling = 10;
+const ExponentialBackoffTimeSlice = 5;
+class HttpClientError extends Error {
+ constructor(message, statusCode) {
+ super(message);
+ this.name = 'HttpClientError';
+ this.statusCode = statusCode;
+ Object.setPrototypeOf(this, HttpClientError.prototype);
}
- process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
}
-exports.addPath = addPath;
-/**
- * Gets the value of an input.
- * Unless trimWhitespace is set to false in InputOptions, the value is also trimmed.
- * Returns an empty string if the value is not defined.
- *
- * @param name name of the input to get
- * @param options optional. See InputOptions.
- * @returns string
- */
-function getInput(name, options) {
- const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || '';
- if (options && options.required && !val) {
- throw new Error(`Input required and not supplied: ${name}`);
- }
- if (options && options.trimWhitespace === false) {
- return val;
+exports.HttpClientError = HttpClientError;
+class HttpClientResponse {
+ constructor(message) {
+ this.message = message;
}
- return val.trim();
-}
-exports.getInput = getInput;
-/**
- * Gets the values of an multiline input. Each value is also trimmed.
- *
- * @param name name of the input to get
- * @param options optional. See InputOptions.
- * @returns string[]
- *
- */
-function getMultilineInput(name, options) {
- const inputs = getInput(name, options)
- .split('\n')
- .filter(x => x !== '');
- if (options && options.trimWhitespace === false) {
- return inputs;
+ readBody() {
+ return __awaiter(this, void 0, void 0, function* () {
+ return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
+ let output = Buffer.alloc(0);
+ this.message.on('data', (chunk) => {
+ output = Buffer.concat([output, chunk]);
+ });
+ this.message.on('end', () => {
+ resolve(output.toString());
+ });
+ }));
+ });
}
- return inputs.map(input => input.trim());
-}
-exports.getMultilineInput = getMultilineInput;
-/**
- * Gets the input value of the boolean type in the YAML 1.2 "core schema" specification.
- * Support boolean input list: `true | True | TRUE | false | False | FALSE` .
- * The return value is also in boolean type.
- * ref: https://yaml.org/spec/1.2/spec.html#id2804923
- *
- * @param name name of the input to get
- * @param options optional. See InputOptions.
- * @returns boolean
- */
-function getBooleanInput(name, options) {
- const trueValue = ['true', 'True', 'TRUE'];
- const falseValue = ['false', 'False', 'FALSE'];
- const val = getInput(name, options);
- if (trueValue.includes(val))
- return true;
- if (falseValue.includes(val))
- return false;
- throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name}\n` +
- `Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
-}
-exports.getBooleanInput = getBooleanInput;
-/**
- * Sets the value of an output.
- *
- * @param name name of the output to set
- * @param value value to store. Non-string values will be converted to a string via JSON.stringify
- */
-// eslint-disable-next-line @typescript-eslint/no-explicit-any
-function setOutput(name, value) {
- const filePath = process.env['GITHUB_OUTPUT'] || '';
- if (filePath) {
- return (0, file_command_1.issueFileCommand)('OUTPUT', (0, file_command_1.prepareKeyValueMessage)(name, value));
+ readBodyBuffer() {
+ return __awaiter(this, void 0, void 0, function* () {
+ return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
+ const chunks = [];
+ this.message.on('data', (chunk) => {
+ chunks.push(chunk);
+ });
+ this.message.on('end', () => {
+ resolve(Buffer.concat(chunks));
+ });
+ }));
+ });
}
- process.stdout.write(os.EOL);
- (0, command_1.issueCommand)('set-output', { name }, (0, utils_1.toCommandValue)(value));
-}
-exports.setOutput = setOutput;
-/**
- * Enables or disables the echoing of commands into stdout for the rest of the step.
- * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
- *
- */
-function setCommandEcho(enabled) {
- (0, command_1.issue)('echo', enabled ? 'on' : 'off');
-}
-exports.setCommandEcho = setCommandEcho;
-//-----------------------------------------------------------------------
-// Results
-//-----------------------------------------------------------------------
-/**
- * Sets the action status to failed.
- * When the action exits it will be with an exit code of 1
- * @param message add error issue message
- */
-function setFailed(message) {
- process.exitCode = ExitCode.Failure;
- error(message);
-}
-exports.setFailed = setFailed;
-//-----------------------------------------------------------------------
-// Logging Commands
-//-----------------------------------------------------------------------
-/**
- * Gets whether Actions Step Debug is on or not
- */
-function isDebug() {
- return process.env['RUNNER_DEBUG'] === '1';
-}
-exports.isDebug = isDebug;
-/**
- * Writes debug message to user log
- * @param message debug message
- */
-function debug(message) {
- (0, command_1.issueCommand)('debug', {}, message);
-}
-exports.debug = debug;
-/**
- * Adds an error issue
- * @param message error issue message. Errors will be converted to string via toString()
- * @param properties optional properties to add to the annotation.
- */
-function error(message, properties = {}) {
- (0, command_1.issueCommand)('error', (0, utils_1.toCommandProperties)(properties), message instanceof Error ? message.toString() : message);
-}
-exports.error = error;
-/**
- * Adds a warning issue
- * @param message warning issue message. Errors will be converted to string via toString()
- * @param properties optional properties to add to the annotation.
- */
-function warning(message, properties = {}) {
- (0, command_1.issueCommand)('warning', (0, utils_1.toCommandProperties)(properties), message instanceof Error ? message.toString() : message);
-}
-exports.warning = warning;
-/**
- * Adds a notice issue
- * @param message notice issue message. Errors will be converted to string via toString()
- * @param properties optional properties to add to the annotation.
- */
-function notice(message, properties = {}) {
- (0, command_1.issueCommand)('notice', (0, utils_1.toCommandProperties)(properties), message instanceof Error ? message.toString() : message);
-}
-exports.notice = notice;
-/**
- * Writes info to log with console.log.
- * @param message info message
- */
-function info(message) {
- process.stdout.write(message + os.EOL);
-}
-exports.info = info;
-/**
- * Begin an output group.
- *
- * Output until the next `groupEnd` will be foldable in this group
- *
- * @param name The name of the output group
- */
-function startGroup(name) {
- (0, command_1.issue)('group', name);
}
-exports.startGroup = startGroup;
-/**
- * End an output group.
- */
-function endGroup() {
- (0, command_1.issue)('endgroup');
+exports.HttpClientResponse = HttpClientResponse;
+function isHttps(requestUrl) {
+ const parsedUrl = new URL(requestUrl);
+ return parsedUrl.protocol === 'https:';
}
-exports.endGroup = endGroup;
-/**
- * Wrap an asynchronous function call in a group.
- *
- * Returns the same type as the function itself.
- *
- * @param name The name of the group
- * @param fn The function to wrap in the group
- */
-function group(name, fn) {
- return __awaiter(this, void 0, void 0, function* () {
- startGroup(name);
- let result;
- try {
- result = yield fn();
- }
- finally {
- endGroup();
+exports.isHttps = isHttps;
+class HttpClient {
+ constructor(userAgent, handlers, requestOptions) {
+ this._ignoreSslError = false;
+ this._allowRedirects = true;
+ this._allowRedirectDowngrade = false;
+ this._maxRedirects = 50;
+ this._allowRetries = false;
+ this._maxRetries = 1;
+ this._keepAlive = false;
+ this._disposed = false;
+ this.userAgent = userAgent;
+ this.handlers = handlers || [];
+ this.requestOptions = requestOptions;
+ if (requestOptions) {
+ if (requestOptions.ignoreSslError != null) {
+ this._ignoreSslError = requestOptions.ignoreSslError;
+ }
+ this._socketTimeout = requestOptions.socketTimeout;
+ if (requestOptions.allowRedirects != null) {
+ this._allowRedirects = requestOptions.allowRedirects;
+ }
+ if (requestOptions.allowRedirectDowngrade != null) {
+ this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade;
+ }
+ if (requestOptions.maxRedirects != null) {
+ this._maxRedirects = Math.max(requestOptions.maxRedirects, 0);
+ }
+ if (requestOptions.keepAlive != null) {
+ this._keepAlive = requestOptions.keepAlive;
+ }
+ if (requestOptions.allowRetries != null) {
+ this._allowRetries = requestOptions.allowRetries;
+ }
+ if (requestOptions.maxRetries != null) {
+ this._maxRetries = requestOptions.maxRetries;
+ }
}
- return result;
- });
-}
-exports.group = group;
-//-----------------------------------------------------------------------
-// Wrapper action state
-//-----------------------------------------------------------------------
-/**
- * Saves state for current action, the state can only be retrieved by this action's post job execution.
- *
- * @param name name of the state to store
- * @param value value to store. Non-string values will be converted to a string via JSON.stringify
- */
-// eslint-disable-next-line @typescript-eslint/no-explicit-any
-function saveState(name, value) {
- const filePath = process.env['GITHUB_STATE'] || '';
- if (filePath) {
- return (0, file_command_1.issueFileCommand)('STATE', (0, file_command_1.prepareKeyValueMessage)(name, value));
- }
- (0, command_1.issueCommand)('save-state', { name }, (0, utils_1.toCommandValue)(value));
-}
-exports.saveState = saveState;
-/**
- * Gets the value of an state set by this action's main execution.
- *
- * @param name name of the state to get
- * @returns string
- */
-function getState(name) {
- return process.env[`STATE_${name}`] || '';
-}
-exports.getState = getState;
-function getIDToken(aud) {
- return __awaiter(this, void 0, void 0, function* () {
- return yield oidc_utils_1.OidcClient.getIDToken(aud);
- });
-}
-exports.getIDToken = getIDToken;
-/**
- * Summary exports
- */
-var summary_1 = __nccwpck_require__(47613);
-Object.defineProperty(exports, "summary", ({ enumerable: true, get: function () { return summary_1.summary; } }));
-/**
- * @deprecated use core.summary
- */
-var summary_2 = __nccwpck_require__(47613);
-Object.defineProperty(exports, "markdownSummary", ({ enumerable: true, get: function () { return summary_2.markdownSummary; } }));
-/**
- * Path exports
- */
-var path_utils_1 = __nccwpck_require__(3849);
-Object.defineProperty(exports, "toPosixPath", ({ enumerable: true, get: function () { return path_utils_1.toPosixPath; } }));
-Object.defineProperty(exports, "toWin32Path", ({ enumerable: true, get: function () { return path_utils_1.toWin32Path; } }));
-Object.defineProperty(exports, "toPlatformPath", ({ enumerable: true, get: function () { return path_utils_1.toPlatformPath; } }));
-/**
- * Platform utilities exports
- */
-exports.platform = __importStar(__nccwpck_require__(17940));
-//# sourceMappingURL=core.js.map
-
-/***/ }),
-
-/***/ 85436:
-/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
-
-"use strict";
-
-// For internal use, subject to change.
-var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- var desc = Object.getOwnPropertyDescriptor(m, k);
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
- desc = { enumerable: true, get: function() { return m[k]; } };
}
- Object.defineProperty(o, k2, desc);
-}) : (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- o[k2] = m[k];
-}));
-var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
- Object.defineProperty(o, "default", { enumerable: true, value: v });
-}) : function(o, v) {
- o["default"] = v;
-});
-var __importStar = (this && this.__importStar) || function (mod) {
- if (mod && mod.__esModule) return mod;
- var result = {};
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
- __setModuleDefault(result, mod);
- return result;
-};
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.prepareKeyValueMessage = exports.issueFileCommand = void 0;
-// We use any as a valid input type
-/* eslint-disable @typescript-eslint/no-explicit-any */
-const crypto = __importStar(__nccwpck_require__(6113));
-const fs = __importStar(__nccwpck_require__(57147));
-const os = __importStar(__nccwpck_require__(22037));
-const utils_1 = __nccwpck_require__(86700);
-function issueFileCommand(command, message) {
- const filePath = process.env[`GITHUB_${command}`];
- if (!filePath) {
- throw new Error(`Unable to find environment variable for file command ${command}`);
+ options(requestUrl, additionalHeaders) {
+ return __awaiter(this, void 0, void 0, function* () {
+ return this.request('OPTIONS', requestUrl, null, additionalHeaders || {});
+ });
}
- if (!fs.existsSync(filePath)) {
- throw new Error(`Missing file at path: ${filePath}`);
+ get(requestUrl, additionalHeaders) {
+ return __awaiter(this, void 0, void 0, function* () {
+ return this.request('GET', requestUrl, null, additionalHeaders || {});
+ });
}
- fs.appendFileSync(filePath, `${(0, utils_1.toCommandValue)(message)}${os.EOL}`, {
- encoding: 'utf8'
- });
-}
-exports.issueFileCommand = issueFileCommand;
-function prepareKeyValueMessage(key, value) {
- const delimiter = `ghadelimiter_${crypto.randomUUID()}`;
- const convertedValue = (0, utils_1.toCommandValue)(value);
- // These should realistically never happen, but just in case someone finds a
- // way to exploit uuid generation let's not allow keys or values that contain
- // the delimiter.
- if (key.includes(delimiter)) {
- throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
+ del(requestUrl, additionalHeaders) {
+ return __awaiter(this, void 0, void 0, function* () {
+ return this.request('DELETE', requestUrl, null, additionalHeaders || {});
+ });
}
- if (convertedValue.includes(delimiter)) {
- throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
+ post(requestUrl, data, additionalHeaders) {
+ return __awaiter(this, void 0, void 0, function* () {
+ return this.request('POST', requestUrl, data, additionalHeaders || {});
+ });
}
- return `${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}`;
-}
-exports.prepareKeyValueMessage = prepareKeyValueMessage;
-//# sourceMappingURL=file-command.js.map
-
-/***/ }),
-
-/***/ 4759:
-/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
-
-"use strict";
-
-var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
- return new (P || (P = Promise))(function (resolve, reject) {
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
-};
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.OidcClient = void 0;
-const http_client_1 = __nccwpck_require__(69714);
-const auth_1 = __nccwpck_require__(27444);
-const core_1 = __nccwpck_require__(15457);
-class OidcClient {
- static createHttpClient(allowRetry = true, maxRetry = 10) {
- const requestOptions = {
- allowRetries: allowRetry,
- maxRetries: maxRetry
- };
- return new http_client_1.HttpClient('actions/oidc-client', [new auth_1.BearerCredentialHandler(OidcClient.getRequestToken())], requestOptions);
+ patch(requestUrl, data, additionalHeaders) {
+ return __awaiter(this, void 0, void 0, function* () {
+ return this.request('PATCH', requestUrl, data, additionalHeaders || {});
+ });
}
- static getRequestToken() {
- const token = process.env['ACTIONS_ID_TOKEN_REQUEST_TOKEN'];
- if (!token) {
- throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable');
- }
- return token;
+ put(requestUrl, data, additionalHeaders) {
+ return __awaiter(this, void 0, void 0, function* () {
+ return this.request('PUT', requestUrl, data, additionalHeaders || {});
+ });
}
- static getIDTokenUrl() {
- const runtimeUrl = process.env['ACTIONS_ID_TOKEN_REQUEST_URL'];
- if (!runtimeUrl) {
- throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable');
- }
- return runtimeUrl;
+ head(requestUrl, additionalHeaders) {
+ return __awaiter(this, void 0, void 0, function* () {
+ return this.request('HEAD', requestUrl, null, additionalHeaders || {});
+ });
}
- static getCall(id_token_url) {
- var _a;
+ sendStream(verb, requestUrl, stream, additionalHeaders) {
return __awaiter(this, void 0, void 0, function* () {
- const httpclient = OidcClient.createHttpClient();
- const res = yield httpclient
- .getJson(id_token_url)
- .catch(error => {
- throw new Error(`Failed to get ID Token. \n
- Error Code : ${error.statusCode}\n
- Error Message: ${error.message}`);
- });
- const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value;
- if (!id_token) {
- throw new Error('Response json body do not have ID Token field');
- }
- return id_token;
+ return this.request(verb, requestUrl, stream, additionalHeaders);
});
}
- static getIDToken(audience) {
+ /**
+ * Gets a typed object from an endpoint
+ * Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise
+ */
+ getJson(requestUrl, additionalHeaders = {}) {
return __awaiter(this, void 0, void 0, function* () {
- try {
- // New ID Token is requested from action service
- let id_token_url = OidcClient.getIDTokenUrl();
- if (audience) {
- const encodedAudience = encodeURIComponent(audience);
- id_token_url = `${id_token_url}&audience=${encodedAudience}`;
- }
- (0, core_1.debug)(`ID token url is ${id_token_url}`);
- const id_token = yield OidcClient.getCall(id_token_url);
- (0, core_1.setSecret)(id_token);
- return id_token;
- }
- catch (error) {
- throw new Error(`Error message: ${error.message}`);
- }
+ additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
+ const res = yield this.get(requestUrl, additionalHeaders);
+ return this._processResponse(res, this.requestOptions);
});
}
-}
-exports.OidcClient = OidcClient;
-//# sourceMappingURL=oidc-utils.js.map
-
-/***/ }),
-
-/***/ 3849:
-/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
-
-"use strict";
-
-var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- var desc = Object.getOwnPropertyDescriptor(m, k);
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
- desc = { enumerable: true, get: function() { return m[k]; } };
+ postJson(requestUrl, obj, additionalHeaders = {}) {
+ return __awaiter(this, void 0, void 0, function* () {
+ const data = JSON.stringify(obj, null, 2);
+ additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
+ additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
+ const res = yield this.post(requestUrl, data, additionalHeaders);
+ return this._processResponse(res, this.requestOptions);
+ });
}
- Object.defineProperty(o, k2, desc);
-}) : (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- o[k2] = m[k];
-}));
-var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
- Object.defineProperty(o, "default", { enumerable: true, value: v });
-}) : function(o, v) {
- o["default"] = v;
-});
-var __importStar = (this && this.__importStar) || function (mod) {
- if (mod && mod.__esModule) return mod;
- var result = {};
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
- __setModuleDefault(result, mod);
- return result;
-};
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.toPlatformPath = exports.toWin32Path = exports.toPosixPath = void 0;
-const path = __importStar(__nccwpck_require__(71017));
-/**
- * toPosixPath converts the given path to the posix form. On Windows, \\ will be
- * replaced with /.
- *
- * @param pth. Path to transform.
- * @return string Posix path.
- */
-function toPosixPath(pth) {
- return pth.replace(/[\\]/g, '/');
-}
-exports.toPosixPath = toPosixPath;
-/**
- * toWin32Path converts the given path to the win32 form. On Linux, / will be
- * replaced with \\.
- *
- * @param pth. Path to transform.
- * @return string Win32 path.
- */
-function toWin32Path(pth) {
- return pth.replace(/[/]/g, '\\');
-}
-exports.toWin32Path = toWin32Path;
-/**
- * toPlatformPath converts the given path to a platform-specific path. It does
- * this by replacing instances of / and \ with the platform-specific path
- * separator.
- *
- * @param pth The path to platformize.
- * @return string The platform-specific path.
- */
-function toPlatformPath(pth) {
- return pth.replace(/[/\\]/g, path.sep);
-}
-exports.toPlatformPath = toPlatformPath;
-//# sourceMappingURL=path-utils.js.map
-
-/***/ }),
-
-/***/ 17940:
-/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
-
-"use strict";
-
-var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- var desc = Object.getOwnPropertyDescriptor(m, k);
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
- desc = { enumerable: true, get: function() { return m[k]; } };
+ putJson(requestUrl, obj, additionalHeaders = {}) {
+ return __awaiter(this, void 0, void 0, function* () {
+ const data = JSON.stringify(obj, null, 2);
+ additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
+ additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
+ const res = yield this.put(requestUrl, data, additionalHeaders);
+ return this._processResponse(res, this.requestOptions);
+ });
}
- Object.defineProperty(o, k2, desc);
-}) : (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- o[k2] = m[k];
-}));
-var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
- Object.defineProperty(o, "default", { enumerable: true, value: v });
-}) : function(o, v) {
- o["default"] = v;
-});
-var __importStar = (this && this.__importStar) || function (mod) {
- if (mod && mod.__esModule) return mod;
- var result = {};
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
- __setModuleDefault(result, mod);
- return result;
-};
-var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
- return new (P || (P = Promise))(function (resolve, reject) {
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
-};
-var __importDefault = (this && this.__importDefault) || function (mod) {
- return (mod && mod.__esModule) ? mod : { "default": mod };
-};
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.getDetails = exports.isLinux = exports.isMacOS = exports.isWindows = exports.arch = exports.platform = void 0;
-const os_1 = __importDefault(__nccwpck_require__(22037));
-const exec = __importStar(__nccwpck_require__(71514));
-const getWindowsInfo = () => __awaiter(void 0, void 0, void 0, function* () {
- const { stdout: version } = yield exec.getExecOutput('powershell -command "(Get-CimInstance -ClassName Win32_OperatingSystem).Version"', undefined, {
- silent: true
- });
- const { stdout: name } = yield exec.getExecOutput('powershell -command "(Get-CimInstance -ClassName Win32_OperatingSystem).Caption"', undefined, {
- silent: true
- });
- return {
- name: name.trim(),
- version: version.trim()
- };
-});
-const getMacOsInfo = () => __awaiter(void 0, void 0, void 0, function* () {
- var _a, _b, _c, _d;
- const { stdout } = yield exec.getExecOutput('sw_vers', undefined, {
- silent: true
- });
- const version = (_b = (_a = stdout.match(/ProductVersion:\s*(.+)/)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : '';
- const name = (_d = (_c = stdout.match(/ProductName:\s*(.+)/)) === null || _c === void 0 ? void 0 : _c[1]) !== null && _d !== void 0 ? _d : '';
- return {
- name,
- version
- };
-});
-const getLinuxInfo = () => __awaiter(void 0, void 0, void 0, function* () {
- const { stdout } = yield exec.getExecOutput('lsb_release', ['-i', '-r', '-s'], {
- silent: true
- });
- const [name, version] = stdout.trim().split('\n');
- return {
- name,
- version
- };
-});
-exports.platform = os_1.default.platform();
-exports.arch = os_1.default.arch();
-exports.isWindows = exports.platform === 'win32';
-exports.isMacOS = exports.platform === 'darwin';
-exports.isLinux = exports.platform === 'linux';
-function getDetails() {
- return __awaiter(this, void 0, void 0, function* () {
- return Object.assign(Object.assign({}, (yield (exports.isWindows
- ? getWindowsInfo()
- : exports.isMacOS
- ? getMacOsInfo()
- : getLinuxInfo()))), { platform: exports.platform,
- arch: exports.arch,
- isWindows: exports.isWindows,
- isMacOS: exports.isMacOS,
- isLinux: exports.isLinux });
- });
-}
-exports.getDetails = getDetails;
-//# sourceMappingURL=platform.js.map
-
-/***/ }),
-
-/***/ 47613:
-/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
-
-"use strict";
-
-var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
- return new (P || (P = Promise))(function (resolve, reject) {
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
-};
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.summary = exports.markdownSummary = exports.SUMMARY_DOCS_URL = exports.SUMMARY_ENV_VAR = void 0;
-const os_1 = __nccwpck_require__(22037);
-const fs_1 = __nccwpck_require__(57147);
-const { access, appendFile, writeFile } = fs_1.promises;
-exports.SUMMARY_ENV_VAR = 'GITHUB_STEP_SUMMARY';
-exports.SUMMARY_DOCS_URL = 'https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary';
-class Summary {
- constructor() {
- this._buffer = '';
+ patchJson(requestUrl, obj, additionalHeaders = {}) {
+ return __awaiter(this, void 0, void 0, function* () {
+ const data = JSON.stringify(obj, null, 2);
+ additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
+ additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
+ const res = yield this.patch(requestUrl, data, additionalHeaders);
+ return this._processResponse(res, this.requestOptions);
+ });
}
/**
- * Finds the summary file path from the environment, rejects if env var is not found or file does not exist
- * Also checks r/w permissions.
- *
- * @returns step summary file path
+ * Makes a raw http request.
+ * All other methods such as get, post, patch, and request ultimately call this.
+ * Prefer get, del, post and patch
*/
- filePath() {
+ request(verb, requestUrl, data, headers) {
return __awaiter(this, void 0, void 0, function* () {
- if (this._filePath) {
- return this._filePath;
- }
- const pathFromEnv = process.env[exports.SUMMARY_ENV_VAR];
- if (!pathFromEnv) {
- throw new Error(`Unable to find environment variable for $${exports.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`);
- }
- try {
- yield access(pathFromEnv, fs_1.constants.R_OK | fs_1.constants.W_OK);
- }
- catch (_a) {
- throw new Error(`Unable to access summary file: '${pathFromEnv}'. Check if the file has correct read/write permissions.`);
+ if (this._disposed) {
+ throw new Error('Client has already been disposed.');
}
- this._filePath = pathFromEnv;
- return this._filePath;
+ const parsedUrl = new URL(requestUrl);
+ let info = this._prepareRequest(verb, parsedUrl, headers);
+ // Only perform retries on reads since writes may not be idempotent.
+ const maxTries = this._allowRetries && RetryableHttpVerbs.includes(verb)
+ ? this._maxRetries + 1
+ : 1;
+ let numTries = 0;
+ let response;
+ do {
+ response = yield this.requestRaw(info, data);
+ // Check if it's an authentication challenge
+ if (response &&
+ response.message &&
+ response.message.statusCode === HttpCodes.Unauthorized) {
+ let authenticationHandler;
+ for (const handler of this.handlers) {
+ if (handler.canHandleAuthentication(response)) {
+ authenticationHandler = handler;
+ break;
+ }
+ }
+ if (authenticationHandler) {
+ return authenticationHandler.handleAuthentication(this, info, data);
+ }
+ else {
+ // We have received an unauthorized response but have no handlers to handle it.
+ // Let the response return to the caller.
+ return response;
+ }
+ }
+ let redirectsRemaining = this._maxRedirects;
+ while (response.message.statusCode &&
+ HttpRedirectCodes.includes(response.message.statusCode) &&
+ this._allowRedirects &&
+ redirectsRemaining > 0) {
+ const redirectUrl = response.message.headers['location'];
+ if (!redirectUrl) {
+ // if there's no location to redirect to, we won't
+ break;
+ }
+ const parsedRedirectUrl = new URL(redirectUrl);
+ if (parsedUrl.protocol === 'https:' &&
+ parsedUrl.protocol !== parsedRedirectUrl.protocol &&
+ !this._allowRedirectDowngrade) {
+ throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.');
+ }
+ // we need to finish reading the response before reassigning response
+ // which will leak the open socket.
+ yield response.readBody();
+ // strip authorization header if redirected to a different hostname
+ if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {
+ for (const header in headers) {
+ // header names are case insensitive
+ if (header.toLowerCase() === 'authorization') {
+ delete headers[header];
+ }
+ }
+ }
+ // let's make the request with the new redirectUrl
+ info = this._prepareRequest(verb, parsedRedirectUrl, headers);
+ response = yield this.requestRaw(info, data);
+ redirectsRemaining--;
+ }
+ if (!response.message.statusCode ||
+ !HttpResponseRetryCodes.includes(response.message.statusCode)) {
+ // If not a retry code, return immediately instead of retrying
+ return response;
+ }
+ numTries += 1;
+ if (numTries < maxTries) {
+ yield response.readBody();
+ yield this._performExponentialBackoff(numTries);
+ }
+ } while (numTries < maxTries);
+ return response;
});
}
/**
- * Wraps content in an HTML tag, adding any HTML attributes
- *
- * @param {string} tag HTML tag to wrap
- * @param {string | null} content content within the tag
- * @param {[attribute: string]: string} attrs key-value list of HTML attributes to add
- *
- * @returns {string} content wrapped in HTML element
+ * Needs to be called if keepAlive is set to true in request options.
*/
- wrap(tag, content, attrs = {}) {
- const htmlAttrs = Object.entries(attrs)
- .map(([key, value]) => ` ${key}="${value}"`)
- .join('');
- if (!content) {
- return `<${tag}${htmlAttrs}>`;
+ dispose() {
+ if (this._agent) {
+ this._agent.destroy();
}
- return `<${tag}${htmlAttrs}>${content}${tag}>`;
+ this._disposed = true;
}
/**
- * Writes text in the buffer to the summary buffer file and empties buffer. Will append by default.
- *
- * @param {SummaryWriteOptions} [options] (optional) options for write operation
- *
- * @returns {Promise} summary instance
+ * Raw request.
+ * @param info
+ * @param data
*/
- write(options) {
+ requestRaw(info, data) {
return __awaiter(this, void 0, void 0, function* () {
- const overwrite = !!(options === null || options === void 0 ? void 0 : options.overwrite);
- const filePath = yield this.filePath();
- const writeFunc = overwrite ? writeFile : appendFile;
- yield writeFunc(filePath, this._buffer, { encoding: 'utf8' });
- return this.emptyBuffer();
+ return new Promise((resolve, reject) => {
+ function callbackForResult(err, res) {
+ if (err) {
+ reject(err);
+ }
+ else if (!res) {
+ // If `err` is not passed, then `res` must be passed.
+ reject(new Error('Unknown error'));
+ }
+ else {
+ resolve(res);
+ }
+ }
+ this.requestRawWithCallback(info, data, callbackForResult);
+ });
});
}
/**
- * Clears the summary buffer and wipes the summary file
- *
- * @returns {Summary} summary instance
+ * Raw request with callback.
+ * @param info
+ * @param data
+ * @param onResult
*/
- clear() {
- return __awaiter(this, void 0, void 0, function* () {
- return this.emptyBuffer().write({ overwrite: true });
+ requestRawWithCallback(info, data, onResult) {
+ if (typeof data === 'string') {
+ if (!info.options.headers) {
+ info.options.headers = {};
+ }
+ info.options.headers['Content-Length'] = Buffer.byteLength(data, 'utf8');
+ }
+ let callbackCalled = false;
+ function handleResult(err, res) {
+ if (!callbackCalled) {
+ callbackCalled = true;
+ onResult(err, res);
+ }
+ }
+ const req = info.httpModule.request(info.options, (msg) => {
+ const res = new HttpClientResponse(msg);
+ handleResult(undefined, res);
+ });
+ let socket;
+ req.on('socket', sock => {
+ socket = sock;
+ });
+ // If we ever get disconnected, we want the socket to timeout eventually
+ req.setTimeout(this._socketTimeout || 3 * 60000, () => {
+ if (socket) {
+ socket.end();
+ }
+ handleResult(new Error(`Request timeout: ${info.options.path}`));
+ });
+ req.on('error', function (err) {
+ // err has statusCode property
+ // res should have headers
+ handleResult(err);
});
+ if (data && typeof data === 'string') {
+ req.write(data, 'utf8');
+ }
+ if (data && typeof data !== 'string') {
+ data.on('close', function () {
+ req.end();
+ });
+ data.pipe(req);
+ }
+ else {
+ req.end();
+ }
}
/**
- * Returns the current summary buffer as a string
- *
- * @returns {string} string of summary buffer
- */
- stringify() {
- return this._buffer;
- }
- /**
- * If the summary buffer is empty
- *
- * @returns {boolen} true if the buffer is empty
- */
- isEmptyBuffer() {
- return this._buffer.length === 0;
- }
- /**
- * Resets the summary buffer without writing to summary file
- *
- * @returns {Summary} summary instance
- */
- emptyBuffer() {
- this._buffer = '';
- return this;
- }
- /**
- * Adds raw text to the summary buffer
- *
- * @param {string} text content to add
- * @param {boolean} [addEOL=false] (optional) append an EOL to the raw text (default: false)
- *
- * @returns {Summary} summary instance
- */
- addRaw(text, addEOL = false) {
- this._buffer += text;
- return addEOL ? this.addEOL() : this;
- }
- /**
- * Adds the operating system-specific end-of-line marker to the buffer
- *
- * @returns {Summary} summary instance
- */
- addEOL() {
- return this.addRaw(os_1.EOL);
- }
- /**
- * Adds an HTML codeblock to the summary buffer
- *
- * @param {string} code content to render within fenced code block
- * @param {string} lang (optional) language to syntax highlight code
- *
- * @returns {Summary} summary instance
- */
- addCodeBlock(code, lang) {
- const attrs = Object.assign({}, (lang && { lang }));
- const element = this.wrap('pre', this.wrap('code', code), attrs);
- return this.addRaw(element).addEOL();
- }
- /**
- * Adds an HTML list to the summary buffer
- *
- * @param {string[]} items list of items to render
- * @param {boolean} [ordered=false] (optional) if the rendered list should be ordered or not (default: false)
- *
- * @returns {Summary} summary instance
+ * Gets an http agent. This function is useful when you need an http agent that handles
+ * routing through a proxy server - depending upon the url and proxy environment variables.
+ * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
*/
- addList(items, ordered = false) {
- const tag = ordered ? 'ol' : 'ul';
- const listItems = items.map(item => this.wrap('li', item)).join('');
- const element = this.wrap(tag, listItems);
- return this.addRaw(element).addEOL();
+ getAgent(serverUrl) {
+ const parsedUrl = new URL(serverUrl);
+ return this._getAgent(parsedUrl);
}
- /**
- * Adds an HTML table to the summary buffer
- *
- * @param {SummaryTableCell[]} rows table rows
- *
- * @returns {Summary} summary instance
- */
- addTable(rows) {
- const tableBody = rows
- .map(row => {
- const cells = row
- .map(cell => {
- if (typeof cell === 'string') {
- return this.wrap('td', cell);
- }
- const { header, data, colspan, rowspan } = cell;
- const tag = header ? 'th' : 'td';
- const attrs = Object.assign(Object.assign({}, (colspan && { colspan })), (rowspan && { rowspan }));
- return this.wrap(tag, data, attrs);
- })
- .join('');
- return this.wrap('tr', cells);
- })
- .join('');
- const element = this.wrap('table', tableBody);
- return this.addRaw(element).addEOL();
+ getAgentDispatcher(serverUrl) {
+ const parsedUrl = new URL(serverUrl);
+ const proxyUrl = pm.getProxyUrl(parsedUrl);
+ const useProxy = proxyUrl && proxyUrl.hostname;
+ if (!useProxy) {
+ return;
+ }
+ return this._getProxyAgentDispatcher(parsedUrl, proxyUrl);
}
- /**
- * Adds a collapsable HTML details element to the summary buffer
- *
- * @param {string} label text for the closed state
- * @param {string} content collapsable content
- *
- * @returns {Summary} summary instance
- */
- addDetails(label, content) {
- const element = this.wrap('details', this.wrap('summary', label) + content);
- return this.addRaw(element).addEOL();
+ _prepareRequest(method, requestUrl, headers) {
+ const info = {};
+ info.parsedUrl = requestUrl;
+ const usingSsl = info.parsedUrl.protocol === 'https:';
+ info.httpModule = usingSsl ? https : http;
+ const defaultPort = usingSsl ? 443 : 80;
+ info.options = {};
+ info.options.host = info.parsedUrl.hostname;
+ info.options.port = info.parsedUrl.port
+ ? parseInt(info.parsedUrl.port)
+ : defaultPort;
+ info.options.path =
+ (info.parsedUrl.pathname || '') + (info.parsedUrl.search || '');
+ info.options.method = method;
+ info.options.headers = this._mergeHeaders(headers);
+ if (this.userAgent != null) {
+ info.options.headers['user-agent'] = this.userAgent;
+ }
+ info.options.agent = this._getAgent(info.parsedUrl);
+ // gives handlers an opportunity to participate
+ if (this.handlers) {
+ for (const handler of this.handlers) {
+ handler.prepareRequest(info.options);
+ }
+ }
+ return info;
}
- /**
- * Adds an HTML image tag to the summary buffer
- *
- * @param {string} src path to the image you to embed
- * @param {string} alt text description of the image
- * @param {SummaryImageOptions} options (optional) addition image attributes
- *
- * @returns {Summary} summary instance
- */
- addImage(src, alt, options) {
- const { width, height } = options || {};
- const attrs = Object.assign(Object.assign({}, (width && { width })), (height && { height }));
- const element = this.wrap('img', null, Object.assign({ src, alt }, attrs));
- return this.addRaw(element).addEOL();
+ _mergeHeaders(headers) {
+ if (this.requestOptions && this.requestOptions.headers) {
+ return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers || {}));
+ }
+ return lowercaseKeys(headers || {});
}
- /**
- * Adds an HTML section heading element
- *
- * @param {string} text heading text
- * @param {number | string} [level=1] (optional) the heading level, default: 1
- *
- * @returns {Summary} summary instance
- */
- addHeading(text, level) {
- const tag = `h${level}`;
- const allowedTag = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(tag)
- ? tag
- : 'h1';
- const element = this.wrap(allowedTag, text);
- return this.addRaw(element).addEOL();
+ _getExistingOrDefaultHeader(additionalHeaders, header, _default) {
+ let clientHeader;
+ if (this.requestOptions && this.requestOptions.headers) {
+ clientHeader = lowercaseKeys(this.requestOptions.headers)[header];
+ }
+ return additionalHeaders[header] || clientHeader || _default;
}
- /**
- * Adds an HTML thematic break (
) to the summary buffer
- *
- * @returns {Summary} summary instance
- */
- addSeparator() {
- const element = this.wrap('hr', null);
- return this.addRaw(element).addEOL();
+ _getAgent(parsedUrl) {
+ let agent;
+ const proxyUrl = pm.getProxyUrl(parsedUrl);
+ const useProxy = proxyUrl && proxyUrl.hostname;
+ if (this._keepAlive && useProxy) {
+ agent = this._proxyAgent;
+ }
+ if (this._keepAlive && !useProxy) {
+ agent = this._agent;
+ }
+ // if agent is already assigned use that agent.
+ if (agent) {
+ return agent;
+ }
+ const usingSsl = parsedUrl.protocol === 'https:';
+ let maxSockets = 100;
+ if (this.requestOptions) {
+ maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets;
+ }
+ // This is `useProxy` again, but we need to check `proxyURl` directly for TypeScripts's flow analysis.
+ if (proxyUrl && proxyUrl.hostname) {
+ const agentOptions = {
+ maxSockets,
+ keepAlive: this._keepAlive,
+ proxy: Object.assign(Object.assign({}, ((proxyUrl.username || proxyUrl.password) && {
+ proxyAuth: `${proxyUrl.username}:${proxyUrl.password}`
+ })), { host: proxyUrl.hostname, port: proxyUrl.port })
+ };
+ let tunnelAgent;
+ const overHttps = proxyUrl.protocol === 'https:';
+ if (usingSsl) {
+ tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp;
+ }
+ else {
+ tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp;
+ }
+ agent = tunnelAgent(agentOptions);
+ this._proxyAgent = agent;
+ }
+ // if reusing agent across request and tunneling agent isn't assigned create a new agent
+ if (this._keepAlive && !agent) {
+ const options = { keepAlive: this._keepAlive, maxSockets };
+ agent = usingSsl ? new https.Agent(options) : new http.Agent(options);
+ this._agent = agent;
+ }
+ // if not using private agent and tunnel agent isn't setup then use global agent
+ if (!agent) {
+ agent = usingSsl ? https.globalAgent : http.globalAgent;
+ }
+ if (usingSsl && this._ignoreSslError) {
+ // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process
+ // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options
+ // we have to cast it to any and change it directly
+ agent.options = Object.assign(agent.options || {}, {
+ rejectUnauthorized: false
+ });
+ }
+ return agent;
}
- /**
- * Adds an HTML line break (
) to the summary buffer
- *
- * @returns {Summary} summary instance
- */
- addBreak() {
- const element = this.wrap('br', null);
- return this.addRaw(element).addEOL();
+ _getProxyAgentDispatcher(parsedUrl, proxyUrl) {
+ let proxyAgent;
+ if (this._keepAlive) {
+ proxyAgent = this._proxyAgentDispatcher;
+ }
+ // if agent is already assigned use that agent.
+ if (proxyAgent) {
+ return proxyAgent;
+ }
+ const usingSsl = parsedUrl.protocol === 'https:';
+ proxyAgent = new undici_1.ProxyAgent(Object.assign({ uri: proxyUrl.href, pipelining: !this._keepAlive ? 0 : 1 }, ((proxyUrl.username || proxyUrl.password) && {
+ token: `${proxyUrl.username}:${proxyUrl.password}`
+ })));
+ this._proxyAgentDispatcher = proxyAgent;
+ if (usingSsl && this._ignoreSslError) {
+ // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process
+ // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options
+ // we have to cast it to any and change it directly
+ proxyAgent.options = Object.assign(proxyAgent.options.requestTls || {}, {
+ rejectUnauthorized: false
+ });
+ }
+ return proxyAgent;
}
- /**
- * Adds an HTML blockquote to the summary buffer
- *
- * @param {string} text quote text
- * @param {string} cite (optional) citation url
- *
- * @returns {Summary} summary instance
- */
- addQuote(text, cite) {
- const attrs = Object.assign({}, (cite && { cite }));
- const element = this.wrap('blockquote', text, attrs);
- return this.addRaw(element).addEOL();
+ _performExponentialBackoff(retryNumber) {
+ return __awaiter(this, void 0, void 0, function* () {
+ retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber);
+ const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber);
+ return new Promise(resolve => setTimeout(() => resolve(), ms));
+ });
}
- /**
- * Adds an HTML anchor tag to the summary buffer
- *
- * @param {string} text link text/content
- * @param {string} href hyperlink
- *
- * @returns {Summary} summary instance
- */
- addLink(text, href) {
- const element = this.wrap('a', text, { href });
- return this.addRaw(element).addEOL();
+ _processResponse(res, options) {
+ return __awaiter(this, void 0, void 0, function* () {
+ return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
+ const statusCode = res.message.statusCode || 0;
+ const response = {
+ statusCode,
+ result: null,
+ headers: {}
+ };
+ // not found leads to null obj returned
+ if (statusCode === HttpCodes.NotFound) {
+ resolve(response);
+ }
+ // get the result from the body
+ function dateTimeDeserializer(key, value) {
+ if (typeof value === 'string') {
+ const a = new Date(value);
+ if (!isNaN(a.valueOf())) {
+ return a;
+ }
+ }
+ return value;
+ }
+ let obj;
+ let contents;
+ try {
+ contents = yield res.readBody();
+ if (contents && contents.length > 0) {
+ if (options && options.deserializeDates) {
+ obj = JSON.parse(contents, dateTimeDeserializer);
+ }
+ else {
+ obj = JSON.parse(contents);
+ }
+ response.result = obj;
+ }
+ response.headers = res.message.headers;
+ }
+ catch (err) {
+ // Invalid resource (contents not json); leaving result obj null
+ }
+ // note that 3xx redirects are handled by the http layer.
+ if (statusCode > 299) {
+ let msg;
+ // if exception/error in body, attempt to get better error
+ if (obj && obj.message) {
+ msg = obj.message;
+ }
+ else if (contents && contents.length > 0) {
+ // it may be the case that the exception is in the body message as string
+ msg = contents;
+ }
+ else {
+ msg = `Failed request: (${statusCode})`;
+ }
+ const err = new HttpClientError(msg, statusCode);
+ err.result = response.result;
+ reject(err);
+ }
+ else {
+ resolve(response);
+ }
+ }));
+ });
}
}
-const _summary = new Summary();
-/**
- * @deprecated use `core.summary`
- */
-exports.markdownSummary = _summary;
-exports.summary = _summary;
-//# sourceMappingURL=summary.js.map
+exports.HttpClient = HttpClient;
+const lowercaseKeys = (obj) => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {});
+//# sourceMappingURL=index.js.map
/***/ }),
-/***/ 86700:
+/***/ 72212:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
-// We use any as a valid input type
-/* eslint-disable @typescript-eslint/no-explicit-any */
Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.toCommandProperties = exports.toCommandValue = void 0;
-/**
- * Sanitizes an input into a string so it can be passed into issueCommand safely
- * @param input input to sanitize into a string
- */
-function toCommandValue(input) {
- if (input === null || input === undefined) {
- return '';
+exports.checkBypass = exports.getProxyUrl = void 0;
+function getProxyUrl(reqUrl) {
+ const usingSsl = reqUrl.protocol === 'https:';
+ if (checkBypass(reqUrl)) {
+ return undefined;
}
- else if (typeof input === 'string' || input instanceof String) {
- return input;
+ const proxyVar = (() => {
+ if (usingSsl) {
+ return process.env['https_proxy'] || process.env['HTTPS_PROXY'];
+ }
+ else {
+ return process.env['http_proxy'] || process.env['HTTP_PROXY'];
+ }
+ })();
+ if (proxyVar) {
+ try {
+ return new URL(proxyVar);
+ }
+ catch (_a) {
+ if (!proxyVar.startsWith('http://') && !proxyVar.startsWith('https://'))
+ return new URL(`http://${proxyVar}`);
+ }
+ }
+ else {
+ return undefined;
}
- return JSON.stringify(input);
}
-exports.toCommandValue = toCommandValue;
-/**
- *
- * @param annotationProperties
- * @returns The command properties to send with the actual annotation command
- * See IssueCommandProperties: https://github.com/actions/runner/blob/main/src/Runner.Worker/ActionCommandManager.cs#L646
- */
-function toCommandProperties(annotationProperties) {
- if (!Object.keys(annotationProperties).length) {
- return {};
+exports.getProxyUrl = getProxyUrl;
+function checkBypass(reqUrl) {
+ if (!reqUrl.hostname) {
+ return false;
}
- return {
- title: annotationProperties.title,
- file: annotationProperties.file,
- line: annotationProperties.startLine,
- endLine: annotationProperties.endLine,
- col: annotationProperties.startColumn,
- endColumn: annotationProperties.endColumn
- };
+ const reqHost = reqUrl.hostname;
+ if (isLoopbackAddress(reqHost)) {
+ return true;
+ }
+ const noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || '';
+ if (!noProxy) {
+ return false;
+ }
+ // Determine the request port
+ let reqPort;
+ if (reqUrl.port) {
+ reqPort = Number(reqUrl.port);
+ }
+ else if (reqUrl.protocol === 'http:') {
+ reqPort = 80;
+ }
+ else if (reqUrl.protocol === 'https:') {
+ reqPort = 443;
+ }
+ // Format the request hostname and hostname with port
+ const upperReqHosts = [reqUrl.hostname.toUpperCase()];
+ if (typeof reqPort === 'number') {
+ upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`);
+ }
+ // Compare request host against noproxy
+ for (const upperNoProxyItem of noProxy
+ .split(',')
+ .map(x => x.trim().toUpperCase())
+ .filter(x => x)) {
+ if (upperNoProxyItem === '*' ||
+ upperReqHosts.some(x => x === upperNoProxyItem ||
+ x.endsWith(`.${upperNoProxyItem}`) ||
+ (upperNoProxyItem.startsWith('.') &&
+ x.endsWith(`${upperNoProxyItem}`)))) {
+ return true;
+ }
+ }
+ return false;
}
-exports.toCommandProperties = toCommandProperties;
-//# sourceMappingURL=utils.js.map
+exports.checkBypass = checkBypass;
+function isLoopbackAddress(host) {
+ const hostLower = host.toLowerCase();
+ return (hostLower === 'localhost' ||
+ hostLower.startsWith('127.') ||
+ hostLower.startsWith('[::1]') ||
+ hostLower.startsWith('[0:0:0:0:0:0:0:1]'));
+}
+//# sourceMappingURL=proxy.js.map
/***/ }),
-/***/ 27444:
+/***/ 5788:
/***/ (function(__unused_webpack_module, exports) {
"use strict";
@@ -9977,7 +12866,7 @@ exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHand
/***/ }),
-/***/ 69714:
+/***/ 58464:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
"use strict";
@@ -10019,7 +12908,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.HttpClient = exports.isHttps = exports.HttpClientResponse = exports.HttpClientError = exports.getProxyUrl = exports.MediaTypes = exports.Headers = exports.HttpCodes = void 0;
const http = __importStar(__nccwpck_require__(13685));
const https = __importStar(__nccwpck_require__(95687));
-const pm = __importStar(__nccwpck_require__(78649));
+const pm = __importStar(__nccwpck_require__(7377));
const tunnel = __importStar(__nccwpck_require__(74294));
const undici_1 = __nccwpck_require__(41773);
var HttpCodes;
@@ -10485,7 +13374,7 @@ class HttpClient {
if (this._keepAlive && useProxy) {
agent = this._proxyAgent;
}
- if (this._keepAlive && !useProxy) {
+ if (!useProxy) {
agent = this._agent;
}
// if agent is already assigned use that agent.
@@ -10517,16 +13406,12 @@ class HttpClient {
agent = tunnelAgent(agentOptions);
this._proxyAgent = agent;
}
- // if reusing agent across request and tunneling agent isn't assigned create a new agent
- if (this._keepAlive && !agent) {
+ // if tunneling agent isn't assigned create a new agent
+ if (!agent) {
const options = { keepAlive: this._keepAlive, maxSockets };
agent = usingSsl ? new https.Agent(options) : new http.Agent(options);
this._agent = agent;
}
- // if not using private agent and tunnel agent isn't setup then use global agent
- if (!agent) {
- agent = usingSsl ? https.globalAgent : http.globalAgent;
- }
if (usingSsl && this._ignoreSslError) {
// we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process
// http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options
@@ -10548,7 +13433,7 @@ class HttpClient {
}
const usingSsl = parsedUrl.protocol === 'https:';
proxyAgent = new undici_1.ProxyAgent(Object.assign({ uri: proxyUrl.href, pipelining: !this._keepAlive ? 0 : 1 }, ((proxyUrl.username || proxyUrl.password) && {
- token: `${proxyUrl.username}:${proxyUrl.password}`
+ token: `Basic ${Buffer.from(`${proxyUrl.username}:${proxyUrl.password}`).toString('base64')}`
})));
this._proxyAgentDispatcher = proxyAgent;
if (usingSsl && this._ignoreSslError) {
@@ -10640,7 +13525,7 @@ const lowercaseKeys = (obj) => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCa
/***/ }),
-/***/ 78649:
+/***/ 7377:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
@@ -10662,11 +13547,11 @@ function getProxyUrl(reqUrl) {
})();
if (proxyVar) {
try {
- return new URL(proxyVar);
+ return new DecodedURL(proxyVar);
}
catch (_a) {
if (!proxyVar.startsWith('http://') && !proxyVar.startsWith('https://'))
- return new URL(`http://${proxyVar}`);
+ return new DecodedURL(`http://${proxyVar}`);
}
}
else {
@@ -10725,79 +13610,138 @@ function isLoopbackAddress(host) {
hostLower.startsWith('[::1]') ||
hostLower.startsWith('[0:0:0:0:0:0:0:1]'));
}
+class DecodedURL extends URL {
+ constructor(url, base) {
+ super(url, base);
+ this._decodedUsername = decodeURIComponent(super.username);
+ this._decodedPassword = decodeURIComponent(super.password);
+ }
+ get username() {
+ return this._decodedUsername;
+ }
+ get password() {
+ return this._decodedPassword;
+ }
+}
//# sourceMappingURL=proxy.js.map
/***/ }),
-/***/ 47387:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+/***/ 87351:
+/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
"use strict";
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() { return m[k]; } };
+ }
+ Object.defineProperty(o, k2, desc);
+}) : (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+ o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || function (mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ __setModuleDefault(result, mod);
+ return result;
+};
Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.Context = void 0;
-const fs_1 = __nccwpck_require__(57147);
-const os_1 = __nccwpck_require__(22037);
-class Context {
- /**
- * Hydrate the context from the environment
- */
- constructor() {
- var _a, _b, _c;
- this.payload = {};
- if (process.env.GITHUB_EVENT_PATH) {
- if (fs_1.existsSync(process.env.GITHUB_EVENT_PATH)) {
- this.payload = JSON.parse(fs_1.readFileSync(process.env.GITHUB_EVENT_PATH, { encoding: 'utf8' }));
- }
- else {
- const path = process.env.GITHUB_EVENT_PATH;
- process.stdout.write(`GITHUB_EVENT_PATH ${path} does not exist${os_1.EOL}`);
- }
+exports.issue = exports.issueCommand = void 0;
+const os = __importStar(__nccwpck_require__(22037));
+const utils_1 = __nccwpck_require__(5278);
+/**
+ * Commands
+ *
+ * Command Format:
+ * ::name key=value,key=value::message
+ *
+ * Examples:
+ * ::warning::This is the message
+ * ::set-env name=MY_VAR::some value
+ */
+function issueCommand(command, properties, message) {
+ const cmd = new Command(command, properties, message);
+ process.stdout.write(cmd.toString() + os.EOL);
+}
+exports.issueCommand = issueCommand;
+function issue(name, message = '') {
+ issueCommand(name, {}, message);
+}
+exports.issue = issue;
+const CMD_STRING = '::';
+class Command {
+ constructor(command, properties, message) {
+ if (!command) {
+ command = 'missing.command';
}
- this.eventName = process.env.GITHUB_EVENT_NAME;
- this.sha = process.env.GITHUB_SHA;
- this.ref = process.env.GITHUB_REF;
- this.workflow = process.env.GITHUB_WORKFLOW;
- this.action = process.env.GITHUB_ACTION;
- this.actor = process.env.GITHUB_ACTOR;
- this.job = process.env.GITHUB_JOB;
- this.runNumber = parseInt(process.env.GITHUB_RUN_NUMBER, 10);
- this.runId = parseInt(process.env.GITHUB_RUN_ID, 10);
- this.apiUrl = (_a = process.env.GITHUB_API_URL) !== null && _a !== void 0 ? _a : `https://api.github.com`;
- this.serverUrl = (_b = process.env.GITHUB_SERVER_URL) !== null && _b !== void 0 ? _b : `https://github.com`;
- this.graphqlUrl = (_c = process.env.GITHUB_GRAPHQL_URL) !== null && _c !== void 0 ? _c : `https://api.github.com/graphql`;
- }
- get issue() {
- const payload = this.payload;
- return Object.assign(Object.assign({}, this.repo), { number: (payload.issue || payload.pull_request || payload).number });
+ this.command = command;
+ this.properties = properties;
+ this.message = message;
}
- get repo() {
- if (process.env.GITHUB_REPOSITORY) {
- const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/');
- return { owner, repo };
- }
- if (this.payload.repository) {
- return {
- owner: this.payload.repository.owner.login,
- repo: this.payload.repository.name
- };
+ toString() {
+ let cmdStr = CMD_STRING + this.command;
+ if (this.properties && Object.keys(this.properties).length > 0) {
+ cmdStr += ' ';
+ let first = true;
+ for (const key in this.properties) {
+ if (this.properties.hasOwnProperty(key)) {
+ const val = this.properties[key];
+ if (val) {
+ if (first) {
+ first = false;
+ }
+ else {
+ cmdStr += ',';
+ }
+ cmdStr += `${key}=${escapeProperty(val)}`;
+ }
+ }
+ }
}
- throw new Error("context.repo requires a GITHUB_REPOSITORY environment variable like 'owner/repo'");
+ cmdStr += `${CMD_STRING}${escapeData(this.message)}`;
+ return cmdStr;
}
}
-exports.Context = Context;
-//# sourceMappingURL=context.js.map
+function escapeData(s) {
+ return (0, utils_1.toCommandValue)(s)
+ .replace(/%/g, '%25')
+ .replace(/\r/g, '%0D')
+ .replace(/\n/g, '%0A');
+}
+function escapeProperty(s) {
+ return (0, utils_1.toCommandValue)(s)
+ .replace(/%/g, '%25')
+ .replace(/\r/g, '%0D')
+ .replace(/\n/g, '%0A')
+ .replace(/:/g, '%3A')
+ .replace(/,/g, '%2C');
+}
+//# sourceMappingURL=command.js.map
/***/ }),
-/***/ 21260:
+/***/ 42186:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() { return m[k]; } };
+ }
+ Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
@@ -10810,38 +13754,346 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
- if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
+var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+};
Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.getOctokit = exports.context = void 0;
-const Context = __importStar(__nccwpck_require__(47387));
-const utils_1 = __nccwpck_require__(58154);
-exports.context = new Context.Context();
+exports.platform = exports.toPlatformPath = exports.toWin32Path = exports.toPosixPath = exports.markdownSummary = exports.summary = exports.getIDToken = exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.notice = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0;
+const command_1 = __nccwpck_require__(87351);
+const file_command_1 = __nccwpck_require__(717);
+const utils_1 = __nccwpck_require__(5278);
+const os = __importStar(__nccwpck_require__(22037));
+const path = __importStar(__nccwpck_require__(71017));
+const oidc_utils_1 = __nccwpck_require__(98041);
/**
- * Returns a hydrated octokit ready to use for GitHub Actions
+ * The code to exit an action
+ */
+var ExitCode;
+(function (ExitCode) {
+ /**
+ * A code indicating that the action was successful
+ */
+ ExitCode[ExitCode["Success"] = 0] = "Success";
+ /**
+ * A code indicating that the action was a failure
+ */
+ ExitCode[ExitCode["Failure"] = 1] = "Failure";
+})(ExitCode || (exports.ExitCode = ExitCode = {}));
+//-----------------------------------------------------------------------
+// Variables
+//-----------------------------------------------------------------------
+/**
+ * Sets env variable for this action and future actions in the job
+ * @param name the name of the variable to set
+ * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
+ */
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+function exportVariable(name, val) {
+ const convertedVal = (0, utils_1.toCommandValue)(val);
+ process.env[name] = convertedVal;
+ const filePath = process.env['GITHUB_ENV'] || '';
+ if (filePath) {
+ return (0, file_command_1.issueFileCommand)('ENV', (0, file_command_1.prepareKeyValueMessage)(name, val));
+ }
+ (0, command_1.issueCommand)('set-env', { name }, convertedVal);
+}
+exports.exportVariable = exportVariable;
+/**
+ * Registers a secret which will get masked from logs
+ * @param secret value of the secret
+ */
+function setSecret(secret) {
+ (0, command_1.issueCommand)('add-mask', {}, secret);
+}
+exports.setSecret = setSecret;
+/**
+ * Prepends inputPath to the PATH (for this action and future actions)
+ * @param inputPath
+ */
+function addPath(inputPath) {
+ const filePath = process.env['GITHUB_PATH'] || '';
+ if (filePath) {
+ (0, file_command_1.issueFileCommand)('PATH', inputPath);
+ }
+ else {
+ (0, command_1.issueCommand)('add-path', {}, inputPath);
+ }
+ process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
+}
+exports.addPath = addPath;
+/**
+ * Gets the value of an input.
+ * Unless trimWhitespace is set to false in InputOptions, the value is also trimmed.
+ * Returns an empty string if the value is not defined.
*
- * @param token the repo PAT or GITHUB_TOKEN
- * @param options other options to set
+ * @param name name of the input to get
+ * @param options optional. See InputOptions.
+ * @returns string
*/
-function getOctokit(token, options, ...additionalPlugins) {
- const GitHubWithPlugins = utils_1.GitHub.plugin(...additionalPlugins);
- return new GitHubWithPlugins(utils_1.getOctokitOptions(token, options));
+function getInput(name, options) {
+ const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || '';
+ if (options && options.required && !val) {
+ throw new Error(`Input required and not supplied: ${name}`);
+ }
+ if (options && options.trimWhitespace === false) {
+ return val;
+ }
+ return val.trim();
}
-exports.getOctokit = getOctokit;
-//# sourceMappingURL=github.js.map
+exports.getInput = getInput;
+/**
+ * Gets the values of an multiline input. Each value is also trimmed.
+ *
+ * @param name name of the input to get
+ * @param options optional. See InputOptions.
+ * @returns string[]
+ *
+ */
+function getMultilineInput(name, options) {
+ const inputs = getInput(name, options)
+ .split('\n')
+ .filter(x => x !== '');
+ if (options && options.trimWhitespace === false) {
+ return inputs;
+ }
+ return inputs.map(input => input.trim());
+}
+exports.getMultilineInput = getMultilineInput;
+/**
+ * Gets the input value of the boolean type in the YAML 1.2 "core schema" specification.
+ * Support boolean input list: `true | True | TRUE | false | False | FALSE` .
+ * The return value is also in boolean type.
+ * ref: https://yaml.org/spec/1.2/spec.html#id2804923
+ *
+ * @param name name of the input to get
+ * @param options optional. See InputOptions.
+ * @returns boolean
+ */
+function getBooleanInput(name, options) {
+ const trueValue = ['true', 'True', 'TRUE'];
+ const falseValue = ['false', 'False', 'FALSE'];
+ const val = getInput(name, options);
+ if (trueValue.includes(val))
+ return true;
+ if (falseValue.includes(val))
+ return false;
+ throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name}\n` +
+ `Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
+}
+exports.getBooleanInput = getBooleanInput;
+/**
+ * Sets the value of an output.
+ *
+ * @param name name of the output to set
+ * @param value value to store. Non-string values will be converted to a string via JSON.stringify
+ */
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+function setOutput(name, value) {
+ const filePath = process.env['GITHUB_OUTPUT'] || '';
+ if (filePath) {
+ return (0, file_command_1.issueFileCommand)('OUTPUT', (0, file_command_1.prepareKeyValueMessage)(name, value));
+ }
+ process.stdout.write(os.EOL);
+ (0, command_1.issueCommand)('set-output', { name }, (0, utils_1.toCommandValue)(value));
+}
+exports.setOutput = setOutput;
+/**
+ * Enables or disables the echoing of commands into stdout for the rest of the step.
+ * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
+ *
+ */
+function setCommandEcho(enabled) {
+ (0, command_1.issue)('echo', enabled ? 'on' : 'off');
+}
+exports.setCommandEcho = setCommandEcho;
+//-----------------------------------------------------------------------
+// Results
+//-----------------------------------------------------------------------
+/**
+ * Sets the action status to failed.
+ * When the action exits it will be with an exit code of 1
+ * @param message add error issue message
+ */
+function setFailed(message) {
+ process.exitCode = ExitCode.Failure;
+ error(message);
+}
+exports.setFailed = setFailed;
+//-----------------------------------------------------------------------
+// Logging Commands
+//-----------------------------------------------------------------------
+/**
+ * Gets whether Actions Step Debug is on or not
+ */
+function isDebug() {
+ return process.env['RUNNER_DEBUG'] === '1';
+}
+exports.isDebug = isDebug;
+/**
+ * Writes debug message to user log
+ * @param message debug message
+ */
+function debug(message) {
+ (0, command_1.issueCommand)('debug', {}, message);
+}
+exports.debug = debug;
+/**
+ * Adds an error issue
+ * @param message error issue message. Errors will be converted to string via toString()
+ * @param properties optional properties to add to the annotation.
+ */
+function error(message, properties = {}) {
+ (0, command_1.issueCommand)('error', (0, utils_1.toCommandProperties)(properties), message instanceof Error ? message.toString() : message);
+}
+exports.error = error;
+/**
+ * Adds a warning issue
+ * @param message warning issue message. Errors will be converted to string via toString()
+ * @param properties optional properties to add to the annotation.
+ */
+function warning(message, properties = {}) {
+ (0, command_1.issueCommand)('warning', (0, utils_1.toCommandProperties)(properties), message instanceof Error ? message.toString() : message);
+}
+exports.warning = warning;
+/**
+ * Adds a notice issue
+ * @param message notice issue message. Errors will be converted to string via toString()
+ * @param properties optional properties to add to the annotation.
+ */
+function notice(message, properties = {}) {
+ (0, command_1.issueCommand)('notice', (0, utils_1.toCommandProperties)(properties), message instanceof Error ? message.toString() : message);
+}
+exports.notice = notice;
+/**
+ * Writes info to log with console.log.
+ * @param message info message
+ */
+function info(message) {
+ process.stdout.write(message + os.EOL);
+}
+exports.info = info;
+/**
+ * Begin an output group.
+ *
+ * Output until the next `groupEnd` will be foldable in this group
+ *
+ * @param name The name of the output group
+ */
+function startGroup(name) {
+ (0, command_1.issue)('group', name);
+}
+exports.startGroup = startGroup;
+/**
+ * End an output group.
+ */
+function endGroup() {
+ (0, command_1.issue)('endgroup');
+}
+exports.endGroup = endGroup;
+/**
+ * Wrap an asynchronous function call in a group.
+ *
+ * Returns the same type as the function itself.
+ *
+ * @param name The name of the group
+ * @param fn The function to wrap in the group
+ */
+function group(name, fn) {
+ return __awaiter(this, void 0, void 0, function* () {
+ startGroup(name);
+ let result;
+ try {
+ result = yield fn();
+ }
+ finally {
+ endGroup();
+ }
+ return result;
+ });
+}
+exports.group = group;
+//-----------------------------------------------------------------------
+// Wrapper action state
+//-----------------------------------------------------------------------
+/**
+ * Saves state for current action, the state can only be retrieved by this action's post job execution.
+ *
+ * @param name name of the state to store
+ * @param value value to store. Non-string values will be converted to a string via JSON.stringify
+ */
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+function saveState(name, value) {
+ const filePath = process.env['GITHUB_STATE'] || '';
+ if (filePath) {
+ return (0, file_command_1.issueFileCommand)('STATE', (0, file_command_1.prepareKeyValueMessage)(name, value));
+ }
+ (0, command_1.issueCommand)('save-state', { name }, (0, utils_1.toCommandValue)(value));
+}
+exports.saveState = saveState;
+/**
+ * Gets the value of an state set by this action's main execution.
+ *
+ * @param name name of the state to get
+ * @returns string
+ */
+function getState(name) {
+ return process.env[`STATE_${name}`] || '';
+}
+exports.getState = getState;
+function getIDToken(aud) {
+ return __awaiter(this, void 0, void 0, function* () {
+ return yield oidc_utils_1.OidcClient.getIDToken(aud);
+ });
+}
+exports.getIDToken = getIDToken;
+/**
+ * Summary exports
+ */
+var summary_1 = __nccwpck_require__(81327);
+Object.defineProperty(exports, "summary", ({ enumerable: true, get: function () { return summary_1.summary; } }));
+/**
+ * @deprecated use core.summary
+ */
+var summary_2 = __nccwpck_require__(81327);
+Object.defineProperty(exports, "markdownSummary", ({ enumerable: true, get: function () { return summary_2.markdownSummary; } }));
+/**
+ * Path exports
+ */
+var path_utils_1 = __nccwpck_require__(2981);
+Object.defineProperty(exports, "toPosixPath", ({ enumerable: true, get: function () { return path_utils_1.toPosixPath; } }));
+Object.defineProperty(exports, "toWin32Path", ({ enumerable: true, get: function () { return path_utils_1.toWin32Path; } }));
+Object.defineProperty(exports, "toPlatformPath", ({ enumerable: true, get: function () { return path_utils_1.toPlatformPath; } }));
+/**
+ * Platform utilities exports
+ */
+exports.platform = __importStar(__nccwpck_require__(85243));
+//# sourceMappingURL=core.js.map
/***/ }),
-/***/ 12114:
+/***/ 717:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
"use strict";
+// For internal use, subject to change.
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() { return m[k]; } };
+ }
+ Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
@@ -10854,44 +14106,146 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
- if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.getApiBaseUrl = exports.getProxyAgent = exports.getAuthString = void 0;
-const httpClient = __importStar(__nccwpck_require__(8343));
-function getAuthString(token, options) {
- if (!token && !options.auth) {
- throw new Error('Parameter token or opts.auth is required');
+exports.prepareKeyValueMessage = exports.issueFileCommand = void 0;
+// We use any as a valid input type
+/* eslint-disable @typescript-eslint/no-explicit-any */
+const crypto = __importStar(__nccwpck_require__(6113));
+const fs = __importStar(__nccwpck_require__(57147));
+const os = __importStar(__nccwpck_require__(22037));
+const utils_1 = __nccwpck_require__(5278);
+function issueFileCommand(command, message) {
+ const filePath = process.env[`GITHUB_${command}`];
+ if (!filePath) {
+ throw new Error(`Unable to find environment variable for file command ${command}`);
}
- else if (token && options.auth) {
- throw new Error('Parameters token and opts.auth may not both be specified');
+ if (!fs.existsSync(filePath)) {
+ throw new Error(`Missing file at path: ${filePath}`);
}
- return typeof options.auth === 'string' ? options.auth : `token ${token}`;
+ fs.appendFileSync(filePath, `${(0, utils_1.toCommandValue)(message)}${os.EOL}`, {
+ encoding: 'utf8'
+ });
}
-exports.getAuthString = getAuthString;
-function getProxyAgent(destinationUrl) {
- const hc = new httpClient.HttpClient();
- return hc.getAgent(destinationUrl);
+exports.issueFileCommand = issueFileCommand;
+function prepareKeyValueMessage(key, value) {
+ const delimiter = `ghadelimiter_${crypto.randomUUID()}`;
+ const convertedValue = (0, utils_1.toCommandValue)(value);
+ // These should realistically never happen, but just in case someone finds a
+ // way to exploit uuid generation let's not allow keys or values that contain
+ // the delimiter.
+ if (key.includes(delimiter)) {
+ throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
+ }
+ if (convertedValue.includes(delimiter)) {
+ throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
+ }
+ return `${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}`;
}
-exports.getProxyAgent = getProxyAgent;
-function getApiBaseUrl() {
- return process.env['GITHUB_API_URL'] || 'https://api.github.com';
+exports.prepareKeyValueMessage = prepareKeyValueMessage;
+//# sourceMappingURL=file-command.js.map
+
+/***/ }),
+
+/***/ 98041:
+/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
+
+"use strict";
+
+var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+};
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.OidcClient = void 0;
+const http_client_1 = __nccwpck_require__(96255);
+const auth_1 = __nccwpck_require__(35526);
+const core_1 = __nccwpck_require__(42186);
+class OidcClient {
+ static createHttpClient(allowRetry = true, maxRetry = 10) {
+ const requestOptions = {
+ allowRetries: allowRetry,
+ maxRetries: maxRetry
+ };
+ return new http_client_1.HttpClient('actions/oidc-client', [new auth_1.BearerCredentialHandler(OidcClient.getRequestToken())], requestOptions);
+ }
+ static getRequestToken() {
+ const token = process.env['ACTIONS_ID_TOKEN_REQUEST_TOKEN'];
+ if (!token) {
+ throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable');
+ }
+ return token;
+ }
+ static getIDTokenUrl() {
+ const runtimeUrl = process.env['ACTIONS_ID_TOKEN_REQUEST_URL'];
+ if (!runtimeUrl) {
+ throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable');
+ }
+ return runtimeUrl;
+ }
+ static getCall(id_token_url) {
+ var _a;
+ return __awaiter(this, void 0, void 0, function* () {
+ const httpclient = OidcClient.createHttpClient();
+ const res = yield httpclient
+ .getJson(id_token_url)
+ .catch(error => {
+ throw new Error(`Failed to get ID Token. \n
+ Error Code : ${error.statusCode}\n
+ Error Message: ${error.message}`);
+ });
+ const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value;
+ if (!id_token) {
+ throw new Error('Response json body do not have ID Token field');
+ }
+ return id_token;
+ });
+ }
+ static getIDToken(audience) {
+ return __awaiter(this, void 0, void 0, function* () {
+ try {
+ // New ID Token is requested from action service
+ let id_token_url = OidcClient.getIDTokenUrl();
+ if (audience) {
+ const encodedAudience = encodeURIComponent(audience);
+ id_token_url = `${id_token_url}&audience=${encodedAudience}`;
+ }
+ (0, core_1.debug)(`ID token url is ${id_token_url}`);
+ const id_token = yield OidcClient.getCall(id_token_url);
+ (0, core_1.setSecret)(id_token);
+ return id_token;
+ }
+ catch (error) {
+ throw new Error(`Error message: ${error.message}`);
+ }
+ });
+ }
}
-exports.getApiBaseUrl = getApiBaseUrl;
-//# sourceMappingURL=utils.js.map
+exports.OidcClient = OidcClient;
+//# sourceMappingURL=oidc-utils.js.map
/***/ }),
-/***/ 58154:
+/***/ 2981:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() { return m[k]; } };
+ }
+ Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
@@ -10904,53 +14258,56 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
- if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.getOctokitOptions = exports.GitHub = exports.defaults = exports.context = void 0;
-const Context = __importStar(__nccwpck_require__(47387));
-const Utils = __importStar(__nccwpck_require__(12114));
-// octokit + plugins
-const core_1 = __nccwpck_require__(76762);
-const plugin_rest_endpoint_methods_1 = __nccwpck_require__(83044);
-const plugin_paginate_rest_1 = __nccwpck_require__(64193);
-exports.context = new Context.Context();
-const baseUrl = Utils.getApiBaseUrl();
-exports.defaults = {
- baseUrl,
- request: {
- agent: Utils.getProxyAgent(baseUrl)
- }
-};
-exports.GitHub = core_1.Octokit.plugin(plugin_rest_endpoint_methods_1.restEndpointMethods, plugin_paginate_rest_1.paginateRest).defaults(exports.defaults);
+exports.toPlatformPath = exports.toWin32Path = exports.toPosixPath = void 0;
+const path = __importStar(__nccwpck_require__(71017));
/**
- * Convience function to correctly format Octokit Options to pass into the constructor.
+ * toPosixPath converts the given path to the posix form. On Windows, \\ will be
+ * replaced with /.
*
- * @param token the repo PAT or GITHUB_TOKEN
- * @param options other options to set
+ * @param pth. Path to transform.
+ * @return string Posix path.
*/
-function getOctokitOptions(token, options) {
- const opts = Object.assign({}, options || {}); // Shallow clone - don't mutate the object provided by the caller
- // Auth
- const auth = Utils.getAuthString(token, opts);
- if (auth) {
- opts.auth = auth;
- }
- return opts;
+function toPosixPath(pth) {
+ return pth.replace(/[\\]/g, '/');
}
-exports.getOctokitOptions = getOctokitOptions;
-//# sourceMappingURL=utils.js.map
+exports.toPosixPath = toPosixPath;
+/**
+ * toWin32Path converts the given path to the win32 form. On Linux, / will be
+ * replaced with \\.
+ *
+ * @param pth. Path to transform.
+ * @return string Win32 path.
+ */
+function toWin32Path(pth) {
+ return pth.replace(/[/]/g, '\\');
+}
+exports.toWin32Path = toWin32Path;
+/**
+ * toPlatformPath converts the given path to a platform-specific path. It does
+ * this by replacing instances of / and \ with the platform-specific path
+ * separator.
+ *
+ * @param pth The path to platformize.
+ * @return string The platform-specific path.
+ */
+function toPlatformPath(pth) {
+ return pth.replace(/[/\\]/g, path.sep);
+}
+exports.toPlatformPath = toPlatformPath;
+//# sourceMappingURL=path-utils.js.map
/***/ }),
-/***/ 8343:
+/***/ 85243:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
"use strict";
-/* eslint-disable @typescript-eslint/no-explicit-any */
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -10983,725 +14340,431 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
+var __importDefault = (this && this.__importDefault) || function (mod) {
+ return (mod && mod.__esModule) ? mod : { "default": mod };
+};
Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.HttpClient = exports.isHttps = exports.HttpClientResponse = exports.HttpClientError = exports.getProxyUrl = exports.MediaTypes = exports.Headers = exports.HttpCodes = void 0;
-const http = __importStar(__nccwpck_require__(13685));
-const https = __importStar(__nccwpck_require__(95687));
-const pm = __importStar(__nccwpck_require__(72212));
-const tunnel = __importStar(__nccwpck_require__(74294));
-const undici_1 = __nccwpck_require__(41773);
-var HttpCodes;
-(function (HttpCodes) {
- HttpCodes[HttpCodes["OK"] = 200] = "OK";
- HttpCodes[HttpCodes["MultipleChoices"] = 300] = "MultipleChoices";
- HttpCodes[HttpCodes["MovedPermanently"] = 301] = "MovedPermanently";
- HttpCodes[HttpCodes["ResourceMoved"] = 302] = "ResourceMoved";
- HttpCodes[HttpCodes["SeeOther"] = 303] = "SeeOther";
- HttpCodes[HttpCodes["NotModified"] = 304] = "NotModified";
- HttpCodes[HttpCodes["UseProxy"] = 305] = "UseProxy";
- HttpCodes[HttpCodes["SwitchProxy"] = 306] = "SwitchProxy";
- HttpCodes[HttpCodes["TemporaryRedirect"] = 307] = "TemporaryRedirect";
- HttpCodes[HttpCodes["PermanentRedirect"] = 308] = "PermanentRedirect";
- HttpCodes[HttpCodes["BadRequest"] = 400] = "BadRequest";
- HttpCodes[HttpCodes["Unauthorized"] = 401] = "Unauthorized";
- HttpCodes[HttpCodes["PaymentRequired"] = 402] = "PaymentRequired";
- HttpCodes[HttpCodes["Forbidden"] = 403] = "Forbidden";
- HttpCodes[HttpCodes["NotFound"] = 404] = "NotFound";
- HttpCodes[HttpCodes["MethodNotAllowed"] = 405] = "MethodNotAllowed";
- HttpCodes[HttpCodes["NotAcceptable"] = 406] = "NotAcceptable";
- HttpCodes[HttpCodes["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired";
- HttpCodes[HttpCodes["RequestTimeout"] = 408] = "RequestTimeout";
- HttpCodes[HttpCodes["Conflict"] = 409] = "Conflict";
- HttpCodes[HttpCodes["Gone"] = 410] = "Gone";
- HttpCodes[HttpCodes["TooManyRequests"] = 429] = "TooManyRequests";
- HttpCodes[HttpCodes["InternalServerError"] = 500] = "InternalServerError";
- HttpCodes[HttpCodes["NotImplemented"] = 501] = "NotImplemented";
- HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway";
- HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable";
- HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout";
-})(HttpCodes || (exports.HttpCodes = HttpCodes = {}));
-var Headers;
-(function (Headers) {
- Headers["Accept"] = "accept";
- Headers["ContentType"] = "content-type";
-})(Headers || (exports.Headers = Headers = {}));
-var MediaTypes;
-(function (MediaTypes) {
- MediaTypes["ApplicationJson"] = "application/json";
-})(MediaTypes || (exports.MediaTypes = MediaTypes = {}));
-/**
- * Returns the proxy URL, depending upon the supplied url and proxy environment variables.
- * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
- */
-function getProxyUrl(serverUrl) {
- const proxyUrl = pm.getProxyUrl(new URL(serverUrl));
- return proxyUrl ? proxyUrl.href : '';
-}
-exports.getProxyUrl = getProxyUrl;
-const HttpRedirectCodes = [
- HttpCodes.MovedPermanently,
- HttpCodes.ResourceMoved,
- HttpCodes.SeeOther,
- HttpCodes.TemporaryRedirect,
- HttpCodes.PermanentRedirect
-];
-const HttpResponseRetryCodes = [
- HttpCodes.BadGateway,
- HttpCodes.ServiceUnavailable,
- HttpCodes.GatewayTimeout
-];
-const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD'];
-const ExponentialBackoffCeiling = 10;
-const ExponentialBackoffTimeSlice = 5;
-class HttpClientError extends Error {
- constructor(message, statusCode) {
- super(message);
- this.name = 'HttpClientError';
- this.statusCode = statusCode;
- Object.setPrototypeOf(this, HttpClientError.prototype);
- }
+exports.getDetails = exports.isLinux = exports.isMacOS = exports.isWindows = exports.arch = exports.platform = void 0;
+const os_1 = __importDefault(__nccwpck_require__(22037));
+const exec = __importStar(__nccwpck_require__(71514));
+const getWindowsInfo = () => __awaiter(void 0, void 0, void 0, function* () {
+ const { stdout: version } = yield exec.getExecOutput('powershell -command "(Get-CimInstance -ClassName Win32_OperatingSystem).Version"', undefined, {
+ silent: true
+ });
+ const { stdout: name } = yield exec.getExecOutput('powershell -command "(Get-CimInstance -ClassName Win32_OperatingSystem).Caption"', undefined, {
+ silent: true
+ });
+ return {
+ name: name.trim(),
+ version: version.trim()
+ };
+});
+const getMacOsInfo = () => __awaiter(void 0, void 0, void 0, function* () {
+ var _a, _b, _c, _d;
+ const { stdout } = yield exec.getExecOutput('sw_vers', undefined, {
+ silent: true
+ });
+ const version = (_b = (_a = stdout.match(/ProductVersion:\s*(.+)/)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : '';
+ const name = (_d = (_c = stdout.match(/ProductName:\s*(.+)/)) === null || _c === void 0 ? void 0 : _c[1]) !== null && _d !== void 0 ? _d : '';
+ return {
+ name,
+ version
+ };
+});
+const getLinuxInfo = () => __awaiter(void 0, void 0, void 0, function* () {
+ const { stdout } = yield exec.getExecOutput('lsb_release', ['-i', '-r', '-s'], {
+ silent: true
+ });
+ const [name, version] = stdout.trim().split('\n');
+ return {
+ name,
+ version
+ };
+});
+exports.platform = os_1.default.platform();
+exports.arch = os_1.default.arch();
+exports.isWindows = exports.platform === 'win32';
+exports.isMacOS = exports.platform === 'darwin';
+exports.isLinux = exports.platform === 'linux';
+function getDetails() {
+ return __awaiter(this, void 0, void 0, function* () {
+ return Object.assign(Object.assign({}, (yield (exports.isWindows
+ ? getWindowsInfo()
+ : exports.isMacOS
+ ? getMacOsInfo()
+ : getLinuxInfo()))), { platform: exports.platform,
+ arch: exports.arch,
+ isWindows: exports.isWindows,
+ isMacOS: exports.isMacOS,
+ isLinux: exports.isLinux });
+ });
}
-exports.HttpClientError = HttpClientError;
-class HttpClientResponse {
- constructor(message) {
- this.message = message;
- }
- readBody() {
- return __awaiter(this, void 0, void 0, function* () {
- return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
- let output = Buffer.alloc(0);
- this.message.on('data', (chunk) => {
- output = Buffer.concat([output, chunk]);
- });
- this.message.on('end', () => {
- resolve(output.toString());
- });
- }));
- });
+exports.getDetails = getDetails;
+//# sourceMappingURL=platform.js.map
+
+/***/ }),
+
+/***/ 81327:
+/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
+
+"use strict";
+
+var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+};
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.summary = exports.markdownSummary = exports.SUMMARY_DOCS_URL = exports.SUMMARY_ENV_VAR = void 0;
+const os_1 = __nccwpck_require__(22037);
+const fs_1 = __nccwpck_require__(57147);
+const { access, appendFile, writeFile } = fs_1.promises;
+exports.SUMMARY_ENV_VAR = 'GITHUB_STEP_SUMMARY';
+exports.SUMMARY_DOCS_URL = 'https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary';
+class Summary {
+ constructor() {
+ this._buffer = '';
}
- readBodyBuffer() {
+ /**
+ * Finds the summary file path from the environment, rejects if env var is not found or file does not exist
+ * Also checks r/w permissions.
+ *
+ * @returns step summary file path
+ */
+ filePath() {
return __awaiter(this, void 0, void 0, function* () {
- return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
- const chunks = [];
- this.message.on('data', (chunk) => {
- chunks.push(chunk);
- });
- this.message.on('end', () => {
- resolve(Buffer.concat(chunks));
- });
- }));
- });
- }
-}
-exports.HttpClientResponse = HttpClientResponse;
-function isHttps(requestUrl) {
- const parsedUrl = new URL(requestUrl);
- return parsedUrl.protocol === 'https:';
-}
-exports.isHttps = isHttps;
-class HttpClient {
- constructor(userAgent, handlers, requestOptions) {
- this._ignoreSslError = false;
- this._allowRedirects = true;
- this._allowRedirectDowngrade = false;
- this._maxRedirects = 50;
- this._allowRetries = false;
- this._maxRetries = 1;
- this._keepAlive = false;
- this._disposed = false;
- this.userAgent = userAgent;
- this.handlers = handlers || [];
- this.requestOptions = requestOptions;
- if (requestOptions) {
- if (requestOptions.ignoreSslError != null) {
- this._ignoreSslError = requestOptions.ignoreSslError;
- }
- this._socketTimeout = requestOptions.socketTimeout;
- if (requestOptions.allowRedirects != null) {
- this._allowRedirects = requestOptions.allowRedirects;
- }
- if (requestOptions.allowRedirectDowngrade != null) {
- this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade;
- }
- if (requestOptions.maxRedirects != null) {
- this._maxRedirects = Math.max(requestOptions.maxRedirects, 0);
+ if (this._filePath) {
+ return this._filePath;
}
- if (requestOptions.keepAlive != null) {
- this._keepAlive = requestOptions.keepAlive;
+ const pathFromEnv = process.env[exports.SUMMARY_ENV_VAR];
+ if (!pathFromEnv) {
+ throw new Error(`Unable to find environment variable for $${exports.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`);
}
- if (requestOptions.allowRetries != null) {
- this._allowRetries = requestOptions.allowRetries;
+ try {
+ yield access(pathFromEnv, fs_1.constants.R_OK | fs_1.constants.W_OK);
}
- if (requestOptions.maxRetries != null) {
- this._maxRetries = requestOptions.maxRetries;
+ catch (_a) {
+ throw new Error(`Unable to access summary file: '${pathFromEnv}'. Check if the file has correct read/write permissions.`);
}
- }
- }
- options(requestUrl, additionalHeaders) {
- return __awaiter(this, void 0, void 0, function* () {
- return this.request('OPTIONS', requestUrl, null, additionalHeaders || {});
- });
- }
- get(requestUrl, additionalHeaders) {
- return __awaiter(this, void 0, void 0, function* () {
- return this.request('GET', requestUrl, null, additionalHeaders || {});
- });
- }
- del(requestUrl, additionalHeaders) {
- return __awaiter(this, void 0, void 0, function* () {
- return this.request('DELETE', requestUrl, null, additionalHeaders || {});
- });
- }
- post(requestUrl, data, additionalHeaders) {
- return __awaiter(this, void 0, void 0, function* () {
- return this.request('POST', requestUrl, data, additionalHeaders || {});
- });
- }
- patch(requestUrl, data, additionalHeaders) {
- return __awaiter(this, void 0, void 0, function* () {
- return this.request('PATCH', requestUrl, data, additionalHeaders || {});
+ this._filePath = pathFromEnv;
+ return this._filePath;
});
}
- put(requestUrl, data, additionalHeaders) {
- return __awaiter(this, void 0, void 0, function* () {
- return this.request('PUT', requestUrl, data, additionalHeaders || {});
- });
+ /**
+ * Wraps content in an HTML tag, adding any HTML attributes
+ *
+ * @param {string} tag HTML tag to wrap
+ * @param {string | null} content content within the tag
+ * @param {[attribute: string]: string} attrs key-value list of HTML attributes to add
+ *
+ * @returns {string} content wrapped in HTML element
+ */
+ wrap(tag, content, attrs = {}) {
+ const htmlAttrs = Object.entries(attrs)
+ .map(([key, value]) => ` ${key}="${value}"`)
+ .join('');
+ if (!content) {
+ return `<${tag}${htmlAttrs}>`;
+ }
+ return `<${tag}${htmlAttrs}>${content}${tag}>`;
}
- head(requestUrl, additionalHeaders) {
+ /**
+ * Writes text in the buffer to the summary buffer file and empties buffer. Will append by default.
+ *
+ * @param {SummaryWriteOptions} [options] (optional) options for write operation
+ *
+ * @returns {Promise} summary instance
+ */
+ write(options) {
return __awaiter(this, void 0, void 0, function* () {
- return this.request('HEAD', requestUrl, null, additionalHeaders || {});
+ const overwrite = !!(options === null || options === void 0 ? void 0 : options.overwrite);
+ const filePath = yield this.filePath();
+ const writeFunc = overwrite ? writeFile : appendFile;
+ yield writeFunc(filePath, this._buffer, { encoding: 'utf8' });
+ return this.emptyBuffer();
});
}
- sendStream(verb, requestUrl, stream, additionalHeaders) {
+ /**
+ * Clears the summary buffer and wipes the summary file
+ *
+ * @returns {Summary} summary instance
+ */
+ clear() {
return __awaiter(this, void 0, void 0, function* () {
- return this.request(verb, requestUrl, stream, additionalHeaders);
+ return this.emptyBuffer().write({ overwrite: true });
});
}
/**
- * Gets a typed object from an endpoint
- * Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise
+ * Returns the current summary buffer as a string
+ *
+ * @returns {string} string of summary buffer
*/
- getJson(requestUrl, additionalHeaders = {}) {
- return __awaiter(this, void 0, void 0, function* () {
- additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
- const res = yield this.get(requestUrl, additionalHeaders);
- return this._processResponse(res, this.requestOptions);
- });
- }
- postJson(requestUrl, obj, additionalHeaders = {}) {
- return __awaiter(this, void 0, void 0, function* () {
- const data = JSON.stringify(obj, null, 2);
- additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
- additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
- const res = yield this.post(requestUrl, data, additionalHeaders);
- return this._processResponse(res, this.requestOptions);
- });
- }
- putJson(requestUrl, obj, additionalHeaders = {}) {
- return __awaiter(this, void 0, void 0, function* () {
- const data = JSON.stringify(obj, null, 2);
- additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
- additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
- const res = yield this.put(requestUrl, data, additionalHeaders);
- return this._processResponse(res, this.requestOptions);
- });
+ stringify() {
+ return this._buffer;
}
- patchJson(requestUrl, obj, additionalHeaders = {}) {
- return __awaiter(this, void 0, void 0, function* () {
- const data = JSON.stringify(obj, null, 2);
- additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
- additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
- const res = yield this.patch(requestUrl, data, additionalHeaders);
- return this._processResponse(res, this.requestOptions);
- });
+ /**
+ * If the summary buffer is empty
+ *
+ * @returns {boolen} true if the buffer is empty
+ */
+ isEmptyBuffer() {
+ return this._buffer.length === 0;
}
/**
- * Makes a raw http request.
- * All other methods such as get, post, patch, and request ultimately call this.
- * Prefer get, del, post and patch
+ * Resets the summary buffer without writing to summary file
+ *
+ * @returns {Summary} summary instance
*/
- request(verb, requestUrl, data, headers) {
- return __awaiter(this, void 0, void 0, function* () {
- if (this._disposed) {
- throw new Error('Client has already been disposed.');
- }
- const parsedUrl = new URL(requestUrl);
- let info = this._prepareRequest(verb, parsedUrl, headers);
- // Only perform retries on reads since writes may not be idempotent.
- const maxTries = this._allowRetries && RetryableHttpVerbs.includes(verb)
- ? this._maxRetries + 1
- : 1;
- let numTries = 0;
- let response;
- do {
- response = yield this.requestRaw(info, data);
- // Check if it's an authentication challenge
- if (response &&
- response.message &&
- response.message.statusCode === HttpCodes.Unauthorized) {
- let authenticationHandler;
- for (const handler of this.handlers) {
- if (handler.canHandleAuthentication(response)) {
- authenticationHandler = handler;
- break;
- }
- }
- if (authenticationHandler) {
- return authenticationHandler.handleAuthentication(this, info, data);
- }
- else {
- // We have received an unauthorized response but have no handlers to handle it.
- // Let the response return to the caller.
- return response;
- }
- }
- let redirectsRemaining = this._maxRedirects;
- while (response.message.statusCode &&
- HttpRedirectCodes.includes(response.message.statusCode) &&
- this._allowRedirects &&
- redirectsRemaining > 0) {
- const redirectUrl = response.message.headers['location'];
- if (!redirectUrl) {
- // if there's no location to redirect to, we won't
- break;
- }
- const parsedRedirectUrl = new URL(redirectUrl);
- if (parsedUrl.protocol === 'https:' &&
- parsedUrl.protocol !== parsedRedirectUrl.protocol &&
- !this._allowRedirectDowngrade) {
- throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.');
- }
- // we need to finish reading the response before reassigning response
- // which will leak the open socket.
- yield response.readBody();
- // strip authorization header if redirected to a different hostname
- if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {
- for (const header in headers) {
- // header names are case insensitive
- if (header.toLowerCase() === 'authorization') {
- delete headers[header];
- }
- }
- }
- // let's make the request with the new redirectUrl
- info = this._prepareRequest(verb, parsedRedirectUrl, headers);
- response = yield this.requestRaw(info, data);
- redirectsRemaining--;
- }
- if (!response.message.statusCode ||
- !HttpResponseRetryCodes.includes(response.message.statusCode)) {
- // If not a retry code, return immediately instead of retrying
- return response;
- }
- numTries += 1;
- if (numTries < maxTries) {
- yield response.readBody();
- yield this._performExponentialBackoff(numTries);
- }
- } while (numTries < maxTries);
- return response;
- });
+ emptyBuffer() {
+ this._buffer = '';
+ return this;
}
/**
- * Needs to be called if keepAlive is set to true in request options.
+ * Adds raw text to the summary buffer
+ *
+ * @param {string} text content to add
+ * @param {boolean} [addEOL=false] (optional) append an EOL to the raw text (default: false)
+ *
+ * @returns {Summary} summary instance
*/
- dispose() {
- if (this._agent) {
- this._agent.destroy();
- }
- this._disposed = true;
+ addRaw(text, addEOL = false) {
+ this._buffer += text;
+ return addEOL ? this.addEOL() : this;
}
/**
- * Raw request.
- * @param info
- * @param data
+ * Adds the operating system-specific end-of-line marker to the buffer
+ *
+ * @returns {Summary} summary instance
*/
- requestRaw(info, data) {
- return __awaiter(this, void 0, void 0, function* () {
- return new Promise((resolve, reject) => {
- function callbackForResult(err, res) {
- if (err) {
- reject(err);
- }
- else if (!res) {
- // If `err` is not passed, then `res` must be passed.
- reject(new Error('Unknown error'));
- }
- else {
- resolve(res);
- }
- }
- this.requestRawWithCallback(info, data, callbackForResult);
- });
- });
+ addEOL() {
+ return this.addRaw(os_1.EOL);
}
/**
- * Raw request with callback.
- * @param info
- * @param data
- * @param onResult
+ * Adds an HTML codeblock to the summary buffer
+ *
+ * @param {string} code content to render within fenced code block
+ * @param {string} lang (optional) language to syntax highlight code
+ *
+ * @returns {Summary} summary instance
*/
- requestRawWithCallback(info, data, onResult) {
- if (typeof data === 'string') {
- if (!info.options.headers) {
- info.options.headers = {};
- }
- info.options.headers['Content-Length'] = Buffer.byteLength(data, 'utf8');
- }
- let callbackCalled = false;
- function handleResult(err, res) {
- if (!callbackCalled) {
- callbackCalled = true;
- onResult(err, res);
- }
- }
- const req = info.httpModule.request(info.options, (msg) => {
- const res = new HttpClientResponse(msg);
- handleResult(undefined, res);
- });
- let socket;
- req.on('socket', sock => {
- socket = sock;
- });
- // If we ever get disconnected, we want the socket to timeout eventually
- req.setTimeout(this._socketTimeout || 3 * 60000, () => {
- if (socket) {
- socket.end();
- }
- handleResult(new Error(`Request timeout: ${info.options.path}`));
- });
- req.on('error', function (err) {
- // err has statusCode property
- // res should have headers
- handleResult(err);
- });
- if (data && typeof data === 'string') {
- req.write(data, 'utf8');
- }
- if (data && typeof data !== 'string') {
- data.on('close', function () {
- req.end();
- });
- data.pipe(req);
- }
- else {
- req.end();
- }
+ addCodeBlock(code, lang) {
+ const attrs = Object.assign({}, (lang && { lang }));
+ const element = this.wrap('pre', this.wrap('code', code), attrs);
+ return this.addRaw(element).addEOL();
}
/**
- * Gets an http agent. This function is useful when you need an http agent that handles
- * routing through a proxy server - depending upon the url and proxy environment variables.
- * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
+ * Adds an HTML list to the summary buffer
+ *
+ * @param {string[]} items list of items to render
+ * @param {boolean} [ordered=false] (optional) if the rendered list should be ordered or not (default: false)
+ *
+ * @returns {Summary} summary instance
*/
- getAgent(serverUrl) {
- const parsedUrl = new URL(serverUrl);
- return this._getAgent(parsedUrl);
+ addList(items, ordered = false) {
+ const tag = ordered ? 'ol' : 'ul';
+ const listItems = items.map(item => this.wrap('li', item)).join('');
+ const element = this.wrap(tag, listItems);
+ return this.addRaw(element).addEOL();
}
- getAgentDispatcher(serverUrl) {
- const parsedUrl = new URL(serverUrl);
- const proxyUrl = pm.getProxyUrl(parsedUrl);
- const useProxy = proxyUrl && proxyUrl.hostname;
- if (!useProxy) {
- return;
- }
- return this._getProxyAgentDispatcher(parsedUrl, proxyUrl);
+ /**
+ * Adds an HTML table to the summary buffer
+ *
+ * @param {SummaryTableCell[]} rows table rows
+ *
+ * @returns {Summary} summary instance
+ */
+ addTable(rows) {
+ const tableBody = rows
+ .map(row => {
+ const cells = row
+ .map(cell => {
+ if (typeof cell === 'string') {
+ return this.wrap('td', cell);
+ }
+ const { header, data, colspan, rowspan } = cell;
+ const tag = header ? 'th' : 'td';
+ const attrs = Object.assign(Object.assign({}, (colspan && { colspan })), (rowspan && { rowspan }));
+ return this.wrap(tag, data, attrs);
+ })
+ .join('');
+ return this.wrap('tr', cells);
+ })
+ .join('');
+ const element = this.wrap('table', tableBody);
+ return this.addRaw(element).addEOL();
}
- _prepareRequest(method, requestUrl, headers) {
- const info = {};
- info.parsedUrl = requestUrl;
- const usingSsl = info.parsedUrl.protocol === 'https:';
- info.httpModule = usingSsl ? https : http;
- const defaultPort = usingSsl ? 443 : 80;
- info.options = {};
- info.options.host = info.parsedUrl.hostname;
- info.options.port = info.parsedUrl.port
- ? parseInt(info.parsedUrl.port)
- : defaultPort;
- info.options.path =
- (info.parsedUrl.pathname || '') + (info.parsedUrl.search || '');
- info.options.method = method;
- info.options.headers = this._mergeHeaders(headers);
- if (this.userAgent != null) {
- info.options.headers['user-agent'] = this.userAgent;
- }
- info.options.agent = this._getAgent(info.parsedUrl);
- // gives handlers an opportunity to participate
- if (this.handlers) {
- for (const handler of this.handlers) {
- handler.prepareRequest(info.options);
- }
- }
- return info;
+ /**
+ * Adds a collapsable HTML details element to the summary buffer
+ *
+ * @param {string} label text for the closed state
+ * @param {string} content collapsable content
+ *
+ * @returns {Summary} summary instance
+ */
+ addDetails(label, content) {
+ const element = this.wrap('details', this.wrap('summary', label) + content);
+ return this.addRaw(element).addEOL();
}
- _mergeHeaders(headers) {
- if (this.requestOptions && this.requestOptions.headers) {
- return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers || {}));
- }
- return lowercaseKeys(headers || {});
+ /**
+ * Adds an HTML image tag to the summary buffer
+ *
+ * @param {string} src path to the image you to embed
+ * @param {string} alt text description of the image
+ * @param {SummaryImageOptions} options (optional) addition image attributes
+ *
+ * @returns {Summary} summary instance
+ */
+ addImage(src, alt, options) {
+ const { width, height } = options || {};
+ const attrs = Object.assign(Object.assign({}, (width && { width })), (height && { height }));
+ const element = this.wrap('img', null, Object.assign({ src, alt }, attrs));
+ return this.addRaw(element).addEOL();
}
- _getExistingOrDefaultHeader(additionalHeaders, header, _default) {
- let clientHeader;
- if (this.requestOptions && this.requestOptions.headers) {
- clientHeader = lowercaseKeys(this.requestOptions.headers)[header];
- }
- return additionalHeaders[header] || clientHeader || _default;
+ /**
+ * Adds an HTML section heading element
+ *
+ * @param {string} text heading text
+ * @param {number | string} [level=1] (optional) the heading level, default: 1
+ *
+ * @returns {Summary} summary instance
+ */
+ addHeading(text, level) {
+ const tag = `h${level}`;
+ const allowedTag = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(tag)
+ ? tag
+ : 'h1';
+ const element = this.wrap(allowedTag, text);
+ return this.addRaw(element).addEOL();
}
- _getAgent(parsedUrl) {
- let agent;
- const proxyUrl = pm.getProxyUrl(parsedUrl);
- const useProxy = proxyUrl && proxyUrl.hostname;
- if (this._keepAlive && useProxy) {
- agent = this._proxyAgent;
- }
- if (this._keepAlive && !useProxy) {
- agent = this._agent;
- }
- // if agent is already assigned use that agent.
- if (agent) {
- return agent;
- }
- const usingSsl = parsedUrl.protocol === 'https:';
- let maxSockets = 100;
- if (this.requestOptions) {
- maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets;
- }
- // This is `useProxy` again, but we need to check `proxyURl` directly for TypeScripts's flow analysis.
- if (proxyUrl && proxyUrl.hostname) {
- const agentOptions = {
- maxSockets,
- keepAlive: this._keepAlive,
- proxy: Object.assign(Object.assign({}, ((proxyUrl.username || proxyUrl.password) && {
- proxyAuth: `${proxyUrl.username}:${proxyUrl.password}`
- })), { host: proxyUrl.hostname, port: proxyUrl.port })
- };
- let tunnelAgent;
- const overHttps = proxyUrl.protocol === 'https:';
- if (usingSsl) {
- tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp;
- }
- else {
- tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp;
- }
- agent = tunnelAgent(agentOptions);
- this._proxyAgent = agent;
- }
- // if reusing agent across request and tunneling agent isn't assigned create a new agent
- if (this._keepAlive && !agent) {
- const options = { keepAlive: this._keepAlive, maxSockets };
- agent = usingSsl ? new https.Agent(options) : new http.Agent(options);
- this._agent = agent;
- }
- // if not using private agent and tunnel agent isn't setup then use global agent
- if (!agent) {
- agent = usingSsl ? https.globalAgent : http.globalAgent;
- }
- if (usingSsl && this._ignoreSslError) {
- // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process
- // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options
- // we have to cast it to any and change it directly
- agent.options = Object.assign(agent.options || {}, {
- rejectUnauthorized: false
- });
- }
- return agent;
+ /**
+ * Adds an HTML thematic break (
) to the summary buffer
+ *
+ * @returns {Summary} summary instance
+ */
+ addSeparator() {
+ const element = this.wrap('hr', null);
+ return this.addRaw(element).addEOL();
}
- _getProxyAgentDispatcher(parsedUrl, proxyUrl) {
- let proxyAgent;
- if (this._keepAlive) {
- proxyAgent = this._proxyAgentDispatcher;
- }
- // if agent is already assigned use that agent.
- if (proxyAgent) {
- return proxyAgent;
- }
- const usingSsl = parsedUrl.protocol === 'https:';
- proxyAgent = new undici_1.ProxyAgent(Object.assign({ uri: proxyUrl.href, pipelining: !this._keepAlive ? 0 : 1 }, ((proxyUrl.username || proxyUrl.password) && {
- token: `${proxyUrl.username}:${proxyUrl.password}`
- })));
- this._proxyAgentDispatcher = proxyAgent;
- if (usingSsl && this._ignoreSslError) {
- // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process
- // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options
- // we have to cast it to any and change it directly
- proxyAgent.options = Object.assign(proxyAgent.options.requestTls || {}, {
- rejectUnauthorized: false
- });
- }
- return proxyAgent;
+ /**
+ * Adds an HTML line break (
) to the summary buffer
+ *
+ * @returns {Summary} summary instance
+ */
+ addBreak() {
+ const element = this.wrap('br', null);
+ return this.addRaw(element).addEOL();
}
- _performExponentialBackoff(retryNumber) {
- return __awaiter(this, void 0, void 0, function* () {
- retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber);
- const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber);
- return new Promise(resolve => setTimeout(() => resolve(), ms));
- });
+ /**
+ * Adds an HTML blockquote to the summary buffer
+ *
+ * @param {string} text quote text
+ * @param {string} cite (optional) citation url
+ *
+ * @returns {Summary} summary instance
+ */
+ addQuote(text, cite) {
+ const attrs = Object.assign({}, (cite && { cite }));
+ const element = this.wrap('blockquote', text, attrs);
+ return this.addRaw(element).addEOL();
}
- _processResponse(res, options) {
- return __awaiter(this, void 0, void 0, function* () {
- return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
- const statusCode = res.message.statusCode || 0;
- const response = {
- statusCode,
- result: null,
- headers: {}
- };
- // not found leads to null obj returned
- if (statusCode === HttpCodes.NotFound) {
- resolve(response);
- }
- // get the result from the body
- function dateTimeDeserializer(key, value) {
- if (typeof value === 'string') {
- const a = new Date(value);
- if (!isNaN(a.valueOf())) {
- return a;
- }
- }
- return value;
- }
- let obj;
- let contents;
- try {
- contents = yield res.readBody();
- if (contents && contents.length > 0) {
- if (options && options.deserializeDates) {
- obj = JSON.parse(contents, dateTimeDeserializer);
- }
- else {
- obj = JSON.parse(contents);
- }
- response.result = obj;
- }
- response.headers = res.message.headers;
- }
- catch (err) {
- // Invalid resource (contents not json); leaving result obj null
- }
- // note that 3xx redirects are handled by the http layer.
- if (statusCode > 299) {
- let msg;
- // if exception/error in body, attempt to get better error
- if (obj && obj.message) {
- msg = obj.message;
- }
- else if (contents && contents.length > 0) {
- // it may be the case that the exception is in the body message as string
- msg = contents;
- }
- else {
- msg = `Failed request: (${statusCode})`;
- }
- const err = new HttpClientError(msg, statusCode);
- err.result = response.result;
- reject(err);
- }
- else {
- resolve(response);
- }
- }));
- });
+ /**
+ * Adds an HTML anchor tag to the summary buffer
+ *
+ * @param {string} text link text/content
+ * @param {string} href hyperlink
+ *
+ * @returns {Summary} summary instance
+ */
+ addLink(text, href) {
+ const element = this.wrap('a', text, { href });
+ return this.addRaw(element).addEOL();
}
}
-exports.HttpClient = HttpClient;
-const lowercaseKeys = (obj) => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {});
-//# sourceMappingURL=index.js.map
+const _summary = new Summary();
+/**
+ * @deprecated use `core.summary`
+ */
+exports.markdownSummary = _summary;
+exports.summary = _summary;
+//# sourceMappingURL=summary.js.map
/***/ }),
-/***/ 72212:
+/***/ 5278:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
+// We use any as a valid input type
+/* eslint-disable @typescript-eslint/no-explicit-any */
Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.checkBypass = exports.getProxyUrl = void 0;
-function getProxyUrl(reqUrl) {
- const usingSsl = reqUrl.protocol === 'https:';
- if (checkBypass(reqUrl)) {
- return undefined;
- }
- const proxyVar = (() => {
- if (usingSsl) {
- return process.env['https_proxy'] || process.env['HTTPS_PROXY'];
- }
- else {
- return process.env['http_proxy'] || process.env['HTTP_PROXY'];
- }
- })();
- if (proxyVar) {
- try {
- return new URL(proxyVar);
- }
- catch (_a) {
- if (!proxyVar.startsWith('http://') && !proxyVar.startsWith('https://'))
- return new URL(`http://${proxyVar}`);
- }
+exports.toCommandProperties = exports.toCommandValue = void 0;
+/**
+ * Sanitizes an input into a string so it can be passed into issueCommand safely
+ * @param input input to sanitize into a string
+ */
+function toCommandValue(input) {
+ if (input === null || input === undefined) {
+ return '';
}
- else {
- return undefined;
+ else if (typeof input === 'string' || input instanceof String) {
+ return input;
}
+ return JSON.stringify(input);
}
-exports.getProxyUrl = getProxyUrl;
-function checkBypass(reqUrl) {
- if (!reqUrl.hostname) {
- return false;
- }
- const reqHost = reqUrl.hostname;
- if (isLoopbackAddress(reqHost)) {
- return true;
- }
- const noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || '';
- if (!noProxy) {
- return false;
- }
- // Determine the request port
- let reqPort;
- if (reqUrl.port) {
- reqPort = Number(reqUrl.port);
- }
- else if (reqUrl.protocol === 'http:') {
- reqPort = 80;
- }
- else if (reqUrl.protocol === 'https:') {
- reqPort = 443;
- }
- // Format the request hostname and hostname with port
- const upperReqHosts = [reqUrl.hostname.toUpperCase()];
- if (typeof reqPort === 'number') {
- upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`);
- }
- // Compare request host against noproxy
- for (const upperNoProxyItem of noProxy
- .split(',')
- .map(x => x.trim().toUpperCase())
- .filter(x => x)) {
- if (upperNoProxyItem === '*' ||
- upperReqHosts.some(x => x === upperNoProxyItem ||
- x.endsWith(`.${upperNoProxyItem}`) ||
- (upperNoProxyItem.startsWith('.') &&
- x.endsWith(`${upperNoProxyItem}`)))) {
- return true;
- }
+exports.toCommandValue = toCommandValue;
+/**
+ *
+ * @param annotationProperties
+ * @returns The command properties to send with the actual annotation command
+ * See IssueCommandProperties: https://github.com/actions/runner/blob/main/src/Runner.Worker/ActionCommandManager.cs#L646
+ */
+function toCommandProperties(annotationProperties) {
+ if (!Object.keys(annotationProperties).length) {
+ return {};
}
- return false;
-}
-exports.checkBypass = checkBypass;
-function isLoopbackAddress(host) {
- const hostLower = host.toLowerCase();
- return (hostLower === 'localhost' ||
- hostLower.startsWith('127.') ||
- hostLower.startsWith('[::1]') ||
- hostLower.startsWith('[0:0:0:0:0:0:0:1]'));
+ return {
+ title: annotationProperties.title,
+ file: annotationProperties.file,
+ line: annotationProperties.startLine,
+ endLine: annotationProperties.endLine,
+ col: annotationProperties.startColumn,
+ endColumn: annotationProperties.endColumn
+ };
}
-//# sourceMappingURL=proxy.js.map
+exports.toCommandProperties = toCommandProperties;
+//# sourceMappingURL=utils.js.map
/***/ }),
-/***/ 5788:
-/***/ (function(__unused_webpack_module, exports) {
+/***/ 71514:
+/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
"use strict";
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
+}) : (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+ o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || function (mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ __setModuleDefault(result, mod);
+ return result;
+};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
@@ -11712,92 +14775,90 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.PersonalAccessTokenCredentialHandler = exports.BearerCredentialHandler = exports.BasicCredentialHandler = void 0;
-class BasicCredentialHandler {
- constructor(username, password) {
- this.username = username;
- this.password = password;
- }
- prepareRequest(options) {
- if (!options.headers) {
- throw Error('The request has no headers');
- }
- options.headers['Authorization'] = `Basic ${Buffer.from(`${this.username}:${this.password}`).toString('base64')}`;
- }
- // This handler cannot handle 401
- canHandleAuthentication() {
- return false;
- }
- handleAuthentication() {
- return __awaiter(this, void 0, void 0, function* () {
- throw new Error('not implemented');
- });
- }
-}
-exports.BasicCredentialHandler = BasicCredentialHandler;
-class BearerCredentialHandler {
- constructor(token) {
- this.token = token;
- }
- // currently implements pre-authorization
- // TODO: support preAuth = false where it hooks on 401
- prepareRequest(options) {
- if (!options.headers) {
- throw Error('The request has no headers');
+exports.getExecOutput = exports.exec = void 0;
+const string_decoder_1 = __nccwpck_require__(71576);
+const tr = __importStar(__nccwpck_require__(88159));
+/**
+ * Exec a command.
+ * Output will be streamed to the live console.
+ * Returns promise with return code
+ *
+ * @param commandLine command to execute (can include additional args). Must be correctly escaped.
+ * @param args optional arguments for tool. Escaping is handled by the lib.
+ * @param options optional exec options. See ExecOptions
+ * @returns Promise exit code
+ */
+function exec(commandLine, args, options) {
+ return __awaiter(this, void 0, void 0, function* () {
+ const commandArgs = tr.argStringToArray(commandLine);
+ if (commandArgs.length === 0) {
+ throw new Error(`Parameter 'commandLine' cannot be null or empty.`);
}
- options.headers['Authorization'] = `Bearer ${this.token}`;
- }
- // This handler cannot handle 401
- canHandleAuthentication() {
- return false;
- }
- handleAuthentication() {
- return __awaiter(this, void 0, void 0, function* () {
- throw new Error('not implemented');
- });
- }
+ // Path to tool to execute should be first arg
+ const toolPath = commandArgs[0];
+ args = commandArgs.slice(1).concat(args || []);
+ const runner = new tr.ToolRunner(toolPath, args, options);
+ return runner.exec();
+ });
}
-exports.BearerCredentialHandler = BearerCredentialHandler;
-class PersonalAccessTokenCredentialHandler {
- constructor(token) {
- this.token = token;
- }
- // currently implements pre-authorization
- // TODO: support preAuth = false where it hooks on 401
- prepareRequest(options) {
- if (!options.headers) {
- throw Error('The request has no headers');
- }
- options.headers['Authorization'] = `Basic ${Buffer.from(`PAT:${this.token}`).toString('base64')}`;
- }
- // This handler cannot handle 401
- canHandleAuthentication() {
- return false;
- }
- handleAuthentication() {
- return __awaiter(this, void 0, void 0, function* () {
- throw new Error('not implemented');
- });
- }
+exports.exec = exec;
+/**
+ * Exec a command and get the output.
+ * Output will be streamed to the live console.
+ * Returns promise with the exit code and collected stdout and stderr
+ *
+ * @param commandLine command to execute (can include additional args). Must be correctly escaped.
+ * @param args optional arguments for tool. Escaping is handled by the lib.
+ * @param options optional exec options. See ExecOptions
+ * @returns Promise exit code, stdout, and stderr
+ */
+function getExecOutput(commandLine, args, options) {
+ var _a, _b;
+ return __awaiter(this, void 0, void 0, function* () {
+ let stdout = '';
+ let stderr = '';
+ //Using string decoder covers the case where a mult-byte character is split
+ const stdoutDecoder = new string_decoder_1.StringDecoder('utf8');
+ const stderrDecoder = new string_decoder_1.StringDecoder('utf8');
+ const originalStdoutListener = (_a = options === null || options === void 0 ? void 0 : options.listeners) === null || _a === void 0 ? void 0 : _a.stdout;
+ const originalStdErrListener = (_b = options === null || options === void 0 ? void 0 : options.listeners) === null || _b === void 0 ? void 0 : _b.stderr;
+ const stdErrListener = (data) => {
+ stderr += stderrDecoder.write(data);
+ if (originalStdErrListener) {
+ originalStdErrListener(data);
+ }
+ };
+ const stdOutListener = (data) => {
+ stdout += stdoutDecoder.write(data);
+ if (originalStdoutListener) {
+ originalStdoutListener(data);
+ }
+ };
+ const listeners = Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.listeners), { stdout: stdOutListener, stderr: stdErrListener });
+ const exitCode = yield exec(commandLine, args, Object.assign(Object.assign({}, options), { listeners }));
+ //flush any remaining characters
+ stdout += stdoutDecoder.end();
+ stderr += stderrDecoder.end();
+ return {
+ exitCode,
+ stdout,
+ stderr
+ };
+ });
}
-exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHandler;
-//# sourceMappingURL=auth.js.map
+exports.getExecOutput = getExecOutput;
+//# sourceMappingURL=exec.js.map
/***/ }),
-/***/ 58464:
+/***/ 88159:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
"use strict";
-/* eslint-disable @typescript-eslint/no-explicit-any */
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
- var desc = Object.getOwnPropertyDescriptor(m, k);
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
- desc = { enumerable: true, get: function() { return m[k]; } };
- }
- Object.defineProperty(o, k2, desc);
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
@@ -11810,7 +14871,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
@@ -11824,835 +14885,671 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.HttpClient = exports.isHttps = exports.HttpClientResponse = exports.HttpClientError = exports.getProxyUrl = exports.MediaTypes = exports.Headers = exports.HttpCodes = void 0;
-const http = __importStar(__nccwpck_require__(13685));
-const https = __importStar(__nccwpck_require__(95687));
-const pm = __importStar(__nccwpck_require__(7377));
-const tunnel = __importStar(__nccwpck_require__(74294));
-const undici_1 = __nccwpck_require__(41773);
-var HttpCodes;
-(function (HttpCodes) {
- HttpCodes[HttpCodes["OK"] = 200] = "OK";
- HttpCodes[HttpCodes["MultipleChoices"] = 300] = "MultipleChoices";
- HttpCodes[HttpCodes["MovedPermanently"] = 301] = "MovedPermanently";
- HttpCodes[HttpCodes["ResourceMoved"] = 302] = "ResourceMoved";
- HttpCodes[HttpCodes["SeeOther"] = 303] = "SeeOther";
- HttpCodes[HttpCodes["NotModified"] = 304] = "NotModified";
- HttpCodes[HttpCodes["UseProxy"] = 305] = "UseProxy";
- HttpCodes[HttpCodes["SwitchProxy"] = 306] = "SwitchProxy";
- HttpCodes[HttpCodes["TemporaryRedirect"] = 307] = "TemporaryRedirect";
- HttpCodes[HttpCodes["PermanentRedirect"] = 308] = "PermanentRedirect";
- HttpCodes[HttpCodes["BadRequest"] = 400] = "BadRequest";
- HttpCodes[HttpCodes["Unauthorized"] = 401] = "Unauthorized";
- HttpCodes[HttpCodes["PaymentRequired"] = 402] = "PaymentRequired";
- HttpCodes[HttpCodes["Forbidden"] = 403] = "Forbidden";
- HttpCodes[HttpCodes["NotFound"] = 404] = "NotFound";
- HttpCodes[HttpCodes["MethodNotAllowed"] = 405] = "MethodNotAllowed";
- HttpCodes[HttpCodes["NotAcceptable"] = 406] = "NotAcceptable";
- HttpCodes[HttpCodes["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired";
- HttpCodes[HttpCodes["RequestTimeout"] = 408] = "RequestTimeout";
- HttpCodes[HttpCodes["Conflict"] = 409] = "Conflict";
- HttpCodes[HttpCodes["Gone"] = 410] = "Gone";
- HttpCodes[HttpCodes["TooManyRequests"] = 429] = "TooManyRequests";
- HttpCodes[HttpCodes["InternalServerError"] = 500] = "InternalServerError";
- HttpCodes[HttpCodes["NotImplemented"] = 501] = "NotImplemented";
- HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway";
- HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable";
- HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout";
-})(HttpCodes || (exports.HttpCodes = HttpCodes = {}));
-var Headers;
-(function (Headers) {
- Headers["Accept"] = "accept";
- Headers["ContentType"] = "content-type";
-})(Headers || (exports.Headers = Headers = {}));
-var MediaTypes;
-(function (MediaTypes) {
- MediaTypes["ApplicationJson"] = "application/json";
-})(MediaTypes || (exports.MediaTypes = MediaTypes = {}));
-/**
- * Returns the proxy URL, depending upon the supplied url and proxy environment variables.
- * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
+exports.argStringToArray = exports.ToolRunner = void 0;
+const os = __importStar(__nccwpck_require__(22037));
+const events = __importStar(__nccwpck_require__(82361));
+const child = __importStar(__nccwpck_require__(32081));
+const path = __importStar(__nccwpck_require__(71017));
+const io = __importStar(__nccwpck_require__(47351));
+const ioUtil = __importStar(__nccwpck_require__(81962));
+const timers_1 = __nccwpck_require__(39512);
+/* eslint-disable @typescript-eslint/unbound-method */
+const IS_WINDOWS = process.platform === 'win32';
+/*
+ * Class for running command line tools. Handles quoting and arg parsing in a platform agnostic way.
*/
-function getProxyUrl(serverUrl) {
- const proxyUrl = pm.getProxyUrl(new URL(serverUrl));
- return proxyUrl ? proxyUrl.href : '';
-}
-exports.getProxyUrl = getProxyUrl;
-const HttpRedirectCodes = [
- HttpCodes.MovedPermanently,
- HttpCodes.ResourceMoved,
- HttpCodes.SeeOther,
- HttpCodes.TemporaryRedirect,
- HttpCodes.PermanentRedirect
-];
-const HttpResponseRetryCodes = [
- HttpCodes.BadGateway,
- HttpCodes.ServiceUnavailable,
- HttpCodes.GatewayTimeout
-];
-const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD'];
-const ExponentialBackoffCeiling = 10;
-const ExponentialBackoffTimeSlice = 5;
-class HttpClientError extends Error {
- constructor(message, statusCode) {
- super(message);
- this.name = 'HttpClientError';
- this.statusCode = statusCode;
- Object.setPrototypeOf(this, HttpClientError.prototype);
- }
-}
-exports.HttpClientError = HttpClientError;
-class HttpClientResponse {
- constructor(message) {
- this.message = message;
- }
- readBody() {
- return __awaiter(this, void 0, void 0, function* () {
- return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
- let output = Buffer.alloc(0);
- this.message.on('data', (chunk) => {
- output = Buffer.concat([output, chunk]);
- });
- this.message.on('end', () => {
- resolve(output.toString());
- });
- }));
- });
+class ToolRunner extends events.EventEmitter {
+ constructor(toolPath, args, options) {
+ super();
+ if (!toolPath) {
+ throw new Error("Parameter 'toolPath' cannot be null or empty.");
+ }
+ this.toolPath = toolPath;
+ this.args = args || [];
+ this.options = options || {};
}
- readBodyBuffer() {
- return __awaiter(this, void 0, void 0, function* () {
- return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
- const chunks = [];
- this.message.on('data', (chunk) => {
- chunks.push(chunk);
- });
- this.message.on('end', () => {
- resolve(Buffer.concat(chunks));
- });
- }));
- });
+ _debug(message) {
+ if (this.options.listeners && this.options.listeners.debug) {
+ this.options.listeners.debug(message);
+ }
}
-}
-exports.HttpClientResponse = HttpClientResponse;
-function isHttps(requestUrl) {
- const parsedUrl = new URL(requestUrl);
- return parsedUrl.protocol === 'https:';
-}
-exports.isHttps = isHttps;
-class HttpClient {
- constructor(userAgent, handlers, requestOptions) {
- this._ignoreSslError = false;
- this._allowRedirects = true;
- this._allowRedirectDowngrade = false;
- this._maxRedirects = 50;
- this._allowRetries = false;
- this._maxRetries = 1;
- this._keepAlive = false;
- this._disposed = false;
- this.userAgent = userAgent;
- this.handlers = handlers || [];
- this.requestOptions = requestOptions;
- if (requestOptions) {
- if (requestOptions.ignoreSslError != null) {
- this._ignoreSslError = requestOptions.ignoreSslError;
- }
- this._socketTimeout = requestOptions.socketTimeout;
- if (requestOptions.allowRedirects != null) {
- this._allowRedirects = requestOptions.allowRedirects;
+ _getCommandString(options, noPrefix) {
+ const toolPath = this._getSpawnFileName();
+ const args = this._getSpawnArgs(options);
+ let cmd = noPrefix ? '' : '[command]'; // omit prefix when piped to a second tool
+ if (IS_WINDOWS) {
+ // Windows + cmd file
+ if (this._isCmdFile()) {
+ cmd += toolPath;
+ for (const a of args) {
+ cmd += ` ${a}`;
+ }
}
- if (requestOptions.allowRedirectDowngrade != null) {
- this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade;
+ // Windows + verbatim
+ else if (options.windowsVerbatimArguments) {
+ cmd += `"${toolPath}"`;
+ for (const a of args) {
+ cmd += ` ${a}`;
+ }
}
- if (requestOptions.maxRedirects != null) {
- this._maxRedirects = Math.max(requestOptions.maxRedirects, 0);
- }
- if (requestOptions.keepAlive != null) {
- this._keepAlive = requestOptions.keepAlive;
- }
- if (requestOptions.allowRetries != null) {
- this._allowRetries = requestOptions.allowRetries;
- }
- if (requestOptions.maxRetries != null) {
- this._maxRetries = requestOptions.maxRetries;
- }
- }
- }
- options(requestUrl, additionalHeaders) {
- return __awaiter(this, void 0, void 0, function* () {
- return this.request('OPTIONS', requestUrl, null, additionalHeaders || {});
- });
- }
- get(requestUrl, additionalHeaders) {
- return __awaiter(this, void 0, void 0, function* () {
- return this.request('GET', requestUrl, null, additionalHeaders || {});
- });
- }
- del(requestUrl, additionalHeaders) {
- return __awaiter(this, void 0, void 0, function* () {
- return this.request('DELETE', requestUrl, null, additionalHeaders || {});
- });
- }
- post(requestUrl, data, additionalHeaders) {
- return __awaiter(this, void 0, void 0, function* () {
- return this.request('POST', requestUrl, data, additionalHeaders || {});
- });
- }
- patch(requestUrl, data, additionalHeaders) {
- return __awaiter(this, void 0, void 0, function* () {
- return this.request('PATCH', requestUrl, data, additionalHeaders || {});
- });
- }
- put(requestUrl, data, additionalHeaders) {
- return __awaiter(this, void 0, void 0, function* () {
- return this.request('PUT', requestUrl, data, additionalHeaders || {});
- });
- }
- head(requestUrl, additionalHeaders) {
- return __awaiter(this, void 0, void 0, function* () {
- return this.request('HEAD', requestUrl, null, additionalHeaders || {});
- });
- }
- sendStream(verb, requestUrl, stream, additionalHeaders) {
- return __awaiter(this, void 0, void 0, function* () {
- return this.request(verb, requestUrl, stream, additionalHeaders);
- });
- }
- /**
- * Gets a typed object from an endpoint
- * Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise
- */
- getJson(requestUrl, additionalHeaders = {}) {
- return __awaiter(this, void 0, void 0, function* () {
- additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
- const res = yield this.get(requestUrl, additionalHeaders);
- return this._processResponse(res, this.requestOptions);
- });
- }
- postJson(requestUrl, obj, additionalHeaders = {}) {
- return __awaiter(this, void 0, void 0, function* () {
- const data = JSON.stringify(obj, null, 2);
- additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
- additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
- const res = yield this.post(requestUrl, data, additionalHeaders);
- return this._processResponse(res, this.requestOptions);
- });
- }
- putJson(requestUrl, obj, additionalHeaders = {}) {
- return __awaiter(this, void 0, void 0, function* () {
- const data = JSON.stringify(obj, null, 2);
- additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
- additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
- const res = yield this.put(requestUrl, data, additionalHeaders);
- return this._processResponse(res, this.requestOptions);
- });
- }
- patchJson(requestUrl, obj, additionalHeaders = {}) {
- return __awaiter(this, void 0, void 0, function* () {
- const data = JSON.stringify(obj, null, 2);
- additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
- additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
- const res = yield this.patch(requestUrl, data, additionalHeaders);
- return this._processResponse(res, this.requestOptions);
- });
- }
- /**
- * Makes a raw http request.
- * All other methods such as get, post, patch, and request ultimately call this.
- * Prefer get, del, post and patch
- */
- request(verb, requestUrl, data, headers) {
- return __awaiter(this, void 0, void 0, function* () {
- if (this._disposed) {
- throw new Error('Client has already been disposed.');
- }
- const parsedUrl = new URL(requestUrl);
- let info = this._prepareRequest(verb, parsedUrl, headers);
- // Only perform retries on reads since writes may not be idempotent.
- const maxTries = this._allowRetries && RetryableHttpVerbs.includes(verb)
- ? this._maxRetries + 1
- : 1;
- let numTries = 0;
- let response;
- do {
- response = yield this.requestRaw(info, data);
- // Check if it's an authentication challenge
- if (response &&
- response.message &&
- response.message.statusCode === HttpCodes.Unauthorized) {
- let authenticationHandler;
- for (const handler of this.handlers) {
- if (handler.canHandleAuthentication(response)) {
- authenticationHandler = handler;
- break;
- }
- }
- if (authenticationHandler) {
- return authenticationHandler.handleAuthentication(this, info, data);
- }
- else {
- // We have received an unauthorized response but have no handlers to handle it.
- // Let the response return to the caller.
- return response;
- }
- }
- let redirectsRemaining = this._maxRedirects;
- while (response.message.statusCode &&
- HttpRedirectCodes.includes(response.message.statusCode) &&
- this._allowRedirects &&
- redirectsRemaining > 0) {
- const redirectUrl = response.message.headers['location'];
- if (!redirectUrl) {
- // if there's no location to redirect to, we won't
- break;
- }
- const parsedRedirectUrl = new URL(redirectUrl);
- if (parsedUrl.protocol === 'https:' &&
- parsedUrl.protocol !== parsedRedirectUrl.protocol &&
- !this._allowRedirectDowngrade) {
- throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.');
- }
- // we need to finish reading the response before reassigning response
- // which will leak the open socket.
- yield response.readBody();
- // strip authorization header if redirected to a different hostname
- if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {
- for (const header in headers) {
- // header names are case insensitive
- if (header.toLowerCase() === 'authorization') {
- delete headers[header];
- }
- }
- }
- // let's make the request with the new redirectUrl
- info = this._prepareRequest(verb, parsedRedirectUrl, headers);
- response = yield this.requestRaw(info, data);
- redirectsRemaining--;
- }
- if (!response.message.statusCode ||
- !HttpResponseRetryCodes.includes(response.message.statusCode)) {
- // If not a retry code, return immediately instead of retrying
- return response;
- }
- numTries += 1;
- if (numTries < maxTries) {
- yield response.readBody();
- yield this._performExponentialBackoff(numTries);
- }
- } while (numTries < maxTries);
- return response;
- });
- }
- /**
- * Needs to be called if keepAlive is set to true in request options.
- */
- dispose() {
- if (this._agent) {
- this._agent.destroy();
- }
- this._disposed = true;
- }
- /**
- * Raw request.
- * @param info
- * @param data
- */
- requestRaw(info, data) {
- return __awaiter(this, void 0, void 0, function* () {
- return new Promise((resolve, reject) => {
- function callbackForResult(err, res) {
- if (err) {
- reject(err);
- }
- else if (!res) {
- // If `err` is not passed, then `res` must be passed.
- reject(new Error('Unknown error'));
- }
- else {
- resolve(res);
- }
+ // Windows (regular)
+ else {
+ cmd += this._windowsQuoteCmdArg(toolPath);
+ for (const a of args) {
+ cmd += ` ${this._windowsQuoteCmdArg(a)}`;
}
- this.requestRawWithCallback(info, data, callbackForResult);
- });
- });
- }
- /**
- * Raw request with callback.
- * @param info
- * @param data
- * @param onResult
- */
- requestRawWithCallback(info, data, onResult) {
- if (typeof data === 'string') {
- if (!info.options.headers) {
- info.options.headers = {};
}
- info.options.headers['Content-Length'] = Buffer.byteLength(data, 'utf8');
}
- let callbackCalled = false;
- function handleResult(err, res) {
- if (!callbackCalled) {
- callbackCalled = true;
- onResult(err, res);
+ else {
+ // OSX/Linux - this can likely be improved with some form of quoting.
+ // creating processes on Unix is fundamentally different than Windows.
+ // on Unix, execvp() takes an arg array.
+ cmd += toolPath;
+ for (const a of args) {
+ cmd += ` ${a}`;
}
}
- const req = info.httpModule.request(info.options, (msg) => {
- const res = new HttpClientResponse(msg);
- handleResult(undefined, res);
- });
- let socket;
- req.on('socket', sock => {
- socket = sock;
- });
- // If we ever get disconnected, we want the socket to timeout eventually
- req.setTimeout(this._socketTimeout || 3 * 60000, () => {
- if (socket) {
- socket.end();
+ return cmd;
+ }
+ _processLineBuffer(data, strBuffer, onLine) {
+ try {
+ let s = strBuffer + data.toString();
+ let n = s.indexOf(os.EOL);
+ while (n > -1) {
+ const line = s.substring(0, n);
+ onLine(line);
+ // the rest of the string ...
+ s = s.substring(n + os.EOL.length);
+ n = s.indexOf(os.EOL);
}
- handleResult(new Error(`Request timeout: ${info.options.path}`));
- });
- req.on('error', function (err) {
- // err has statusCode property
- // res should have headers
- handleResult(err);
- });
- if (data && typeof data === 'string') {
- req.write(data, 'utf8');
- }
- if (data && typeof data !== 'string') {
- data.on('close', function () {
- req.end();
- });
- data.pipe(req);
+ return s;
}
- else {
- req.end();
+ catch (err) {
+ // streaming lines to console is best effort. Don't fail a build.
+ this._debug(`error processing line. Failed with error ${err}`);
+ return '';
}
}
- /**
- * Gets an http agent. This function is useful when you need an http agent that handles
- * routing through a proxy server - depending upon the url and proxy environment variables.
- * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
- */
- getAgent(serverUrl) {
- const parsedUrl = new URL(serverUrl);
- return this._getAgent(parsedUrl);
- }
- getAgentDispatcher(serverUrl) {
- const parsedUrl = new URL(serverUrl);
- const proxyUrl = pm.getProxyUrl(parsedUrl);
- const useProxy = proxyUrl && proxyUrl.hostname;
- if (!useProxy) {
- return;
+ _getSpawnFileName() {
+ if (IS_WINDOWS) {
+ if (this._isCmdFile()) {
+ return process.env['COMSPEC'] || 'cmd.exe';
+ }
}
- return this._getProxyAgentDispatcher(parsedUrl, proxyUrl);
+ return this.toolPath;
}
- _prepareRequest(method, requestUrl, headers) {
- const info = {};
- info.parsedUrl = requestUrl;
- const usingSsl = info.parsedUrl.protocol === 'https:';
- info.httpModule = usingSsl ? https : http;
- const defaultPort = usingSsl ? 443 : 80;
- info.options = {};
- info.options.host = info.parsedUrl.hostname;
- info.options.port = info.parsedUrl.port
- ? parseInt(info.parsedUrl.port)
- : defaultPort;
- info.options.path =
- (info.parsedUrl.pathname || '') + (info.parsedUrl.search || '');
- info.options.method = method;
- info.options.headers = this._mergeHeaders(headers);
- if (this.userAgent != null) {
- info.options.headers['user-agent'] = this.userAgent;
- }
- info.options.agent = this._getAgent(info.parsedUrl);
- // gives handlers an opportunity to participate
- if (this.handlers) {
- for (const handler of this.handlers) {
- handler.prepareRequest(info.options);
+ _getSpawnArgs(options) {
+ if (IS_WINDOWS) {
+ if (this._isCmdFile()) {
+ let argline = `/D /S /C "${this._windowsQuoteCmdArg(this.toolPath)}`;
+ for (const a of this.args) {
+ argline += ' ';
+ argline += options.windowsVerbatimArguments
+ ? a
+ : this._windowsQuoteCmdArg(a);
+ }
+ argline += '"';
+ return [argline];
}
}
- return info;
+ return this.args;
}
- _mergeHeaders(headers) {
- if (this.requestOptions && this.requestOptions.headers) {
- return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers || {}));
- }
- return lowercaseKeys(headers || {});
+ _endsWith(str, end) {
+ return str.endsWith(end);
}
- _getExistingOrDefaultHeader(additionalHeaders, header, _default) {
- let clientHeader;
- if (this.requestOptions && this.requestOptions.headers) {
- clientHeader = lowercaseKeys(this.requestOptions.headers)[header];
- }
- return additionalHeaders[header] || clientHeader || _default;
+ _isCmdFile() {
+ const upperToolPath = this.toolPath.toUpperCase();
+ return (this._endsWith(upperToolPath, '.CMD') ||
+ this._endsWith(upperToolPath, '.BAT'));
}
- _getAgent(parsedUrl) {
- let agent;
- const proxyUrl = pm.getProxyUrl(parsedUrl);
- const useProxy = proxyUrl && proxyUrl.hostname;
- if (this._keepAlive && useProxy) {
- agent = this._proxyAgent;
+ _windowsQuoteCmdArg(arg) {
+ // for .exe, apply the normal quoting rules that libuv applies
+ if (!this._isCmdFile()) {
+ return this._uvQuoteCmdArg(arg);
}
- if (!useProxy) {
- agent = this._agent;
+ // otherwise apply quoting rules specific to the cmd.exe command line parser.
+ // the libuv rules are generic and are not designed specifically for cmd.exe
+ // command line parser.
+ //
+ // for a detailed description of the cmd.exe command line parser, refer to
+ // http://stackoverflow.com/questions/4094699/how-does-the-windows-command-interpreter-cmd-exe-parse-scripts/7970912#7970912
+ // need quotes for empty arg
+ if (!arg) {
+ return '""';
}
- // if agent is already assigned use that agent.
- if (agent) {
- return agent;
+ // determine whether the arg needs to be quoted
+ const cmdSpecialChars = [
+ ' ',
+ '\t',
+ '&',
+ '(',
+ ')',
+ '[',
+ ']',
+ '{',
+ '}',
+ '^',
+ '=',
+ ';',
+ '!',
+ "'",
+ '+',
+ ',',
+ '`',
+ '~',
+ '|',
+ '<',
+ '>',
+ '"'
+ ];
+ let needsQuotes = false;
+ for (const char of arg) {
+ if (cmdSpecialChars.some(x => x === char)) {
+ needsQuotes = true;
+ break;
+ }
}
- const usingSsl = parsedUrl.protocol === 'https:';
- let maxSockets = 100;
- if (this.requestOptions) {
- maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets;
+ // short-circuit if quotes not needed
+ if (!needsQuotes) {
+ return arg;
}
- // This is `useProxy` again, but we need to check `proxyURl` directly for TypeScripts's flow analysis.
- if (proxyUrl && proxyUrl.hostname) {
- const agentOptions = {
- maxSockets,
- keepAlive: this._keepAlive,
- proxy: Object.assign(Object.assign({}, ((proxyUrl.username || proxyUrl.password) && {
- proxyAuth: `${proxyUrl.username}:${proxyUrl.password}`
- })), { host: proxyUrl.hostname, port: proxyUrl.port })
- };
- let tunnelAgent;
- const overHttps = proxyUrl.protocol === 'https:';
- if (usingSsl) {
- tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp;
+ // the following quoting rules are very similar to the rules that by libuv applies.
+ //
+ // 1) wrap the string in quotes
+ //
+ // 2) double-up quotes - i.e. " => ""
+ //
+ // this is different from the libuv quoting rules. libuv replaces " with \", which unfortunately
+ // doesn't work well with a cmd.exe command line.
+ //
+ // note, replacing " with "" also works well if the arg is passed to a downstream .NET console app.
+ // for example, the command line:
+ // foo.exe "myarg:""my val"""
+ // is parsed by a .NET console app into an arg array:
+ // [ "myarg:\"my val\"" ]
+ // which is the same end result when applying libuv quoting rules. although the actual
+ // command line from libuv quoting rules would look like:
+ // foo.exe "myarg:\"my val\""
+ //
+ // 3) double-up slashes that precede a quote,
+ // e.g. hello \world => "hello \world"
+ // hello\"world => "hello\\""world"
+ // hello\\"world => "hello\\\\""world"
+ // hello world\ => "hello world\\"
+ //
+ // technically this is not required for a cmd.exe command line, or the batch argument parser.
+ // the reasons for including this as a .cmd quoting rule are:
+ //
+ // a) this is optimized for the scenario where the argument is passed from the .cmd file to an
+ // external program. many programs (e.g. .NET console apps) rely on the slash-doubling rule.
+ //
+ // b) it's what we've been doing previously (by deferring to node default behavior) and we
+ // haven't heard any complaints about that aspect.
+ //
+ // note, a weakness of the quoting rules chosen here, is that % is not escaped. in fact, % cannot be
+ // escaped when used on the command line directly - even though within a .cmd file % can be escaped
+ // by using %%.
+ //
+ // the saving grace is, on the command line, %var% is left as-is if var is not defined. this contrasts
+ // the line parsing rules within a .cmd file, where if var is not defined it is replaced with nothing.
+ //
+ // one option that was explored was replacing % with ^% - i.e. %var% => ^%var^%. this hack would
+ // often work, since it is unlikely that var^ would exist, and the ^ character is removed when the
+ // variable is used. the problem, however, is that ^ is not removed when %* is used to pass the args
+ // to an external program.
+ //
+ // an unexplored potential solution for the % escaping problem, is to create a wrapper .cmd file.
+ // % can be escaped within a .cmd file.
+ let reverse = '"';
+ let quoteHit = true;
+ for (let i = arg.length; i > 0; i--) {
+ // walk the string in reverse
+ reverse += arg[i - 1];
+ if (quoteHit && arg[i - 1] === '\\') {
+ reverse += '\\'; // double the slash
+ }
+ else if (arg[i - 1] === '"') {
+ quoteHit = true;
+ reverse += '"'; // double the quote
}
else {
- tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp;
+ quoteHit = false;
}
- agent = tunnelAgent(agentOptions);
- this._proxyAgent = agent;
}
- // if tunneling agent isn't assigned create a new agent
- if (!agent) {
- const options = { keepAlive: this._keepAlive, maxSockets };
- agent = usingSsl ? new https.Agent(options) : new http.Agent(options);
- this._agent = agent;
- }
- if (usingSsl && this._ignoreSslError) {
- // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process
- // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options
- // we have to cast it to any and change it directly
- agent.options = Object.assign(agent.options || {}, {
- rejectUnauthorized: false
- });
- }
- return agent;
+ reverse += '"';
+ return reverse
+ .split('')
+ .reverse()
+ .join('');
}
- _getProxyAgentDispatcher(parsedUrl, proxyUrl) {
- let proxyAgent;
- if (this._keepAlive) {
- proxyAgent = this._proxyAgentDispatcher;
+ _uvQuoteCmdArg(arg) {
+ // Tool runner wraps child_process.spawn() and needs to apply the same quoting as
+ // Node in certain cases where the undocumented spawn option windowsVerbatimArguments
+ // is used.
+ //
+ // Since this function is a port of quote_cmd_arg from Node 4.x (technically, lib UV,
+ // see https://github.com/nodejs/node/blob/v4.x/deps/uv/src/win/process.c for details),
+ // pasting copyright notice from Node within this function:
+ //
+ // Copyright Joyent, Inc. and other Node contributors. All rights reserved.
+ //
+ // 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.
+ if (!arg) {
+ // Need double quotation for empty argument
+ return '""';
}
- // if agent is already assigned use that agent.
- if (proxyAgent) {
- return proxyAgent;
+ if (!arg.includes(' ') && !arg.includes('\t') && !arg.includes('"')) {
+ // No quotation needed
+ return arg;
}
- const usingSsl = parsedUrl.protocol === 'https:';
- proxyAgent = new undici_1.ProxyAgent(Object.assign({ uri: proxyUrl.href, pipelining: !this._keepAlive ? 0 : 1 }, ((proxyUrl.username || proxyUrl.password) && {
- token: `Basic ${Buffer.from(`${proxyUrl.username}:${proxyUrl.password}`).toString('base64')}`
- })));
- this._proxyAgentDispatcher = proxyAgent;
- if (usingSsl && this._ignoreSslError) {
- // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process
- // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options
- // we have to cast it to any and change it directly
- proxyAgent.options = Object.assign(proxyAgent.options.requestTls || {}, {
- rejectUnauthorized: false
- });
+ if (!arg.includes('"') && !arg.includes('\\')) {
+ // No embedded double quotes or backslashes, so I can just wrap
+ // quote marks around the whole thing.
+ return `"${arg}"`;
}
- return proxyAgent;
+ // Expected input/output:
+ // input : hello"world
+ // output: "hello\"world"
+ // input : hello""world
+ // output: "hello\"\"world"
+ // input : hello\world
+ // output: hello\world
+ // input : hello\\world
+ // output: hello\\world
+ // input : hello\"world
+ // output: "hello\\\"world"
+ // input : hello\\"world
+ // output: "hello\\\\\"world"
+ // input : hello world\
+ // output: "hello world\\" - note the comment in libuv actually reads "hello world\"
+ // but it appears the comment is wrong, it should be "hello world\\"
+ let reverse = '"';
+ let quoteHit = true;
+ for (let i = arg.length; i > 0; i--) {
+ // walk the string in reverse
+ reverse += arg[i - 1];
+ if (quoteHit && arg[i - 1] === '\\') {
+ reverse += '\\';
+ }
+ else if (arg[i - 1] === '"') {
+ quoteHit = true;
+ reverse += '\\';
+ }
+ else {
+ quoteHit = false;
+ }
+ }
+ reverse += '"';
+ return reverse
+ .split('')
+ .reverse()
+ .join('');
}
- _performExponentialBackoff(retryNumber) {
- return __awaiter(this, void 0, void 0, function* () {
- retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber);
- const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber);
- return new Promise(resolve => setTimeout(() => resolve(), ms));
- });
+ _cloneExecOptions(options) {
+ options = options || {};
+ const result = {
+ cwd: options.cwd || process.cwd(),
+ env: options.env || process.env,
+ silent: options.silent || false,
+ windowsVerbatimArguments: options.windowsVerbatimArguments || false,
+ failOnStdErr: options.failOnStdErr || false,
+ ignoreReturnCode: options.ignoreReturnCode || false,
+ delay: options.delay || 10000
+ };
+ result.outStream = options.outStream || process.stdout;
+ result.errStream = options.errStream || process.stderr;
+ return result;
}
- _processResponse(res, options) {
+ _getSpawnOptions(options, toolPath) {
+ options = options || {};
+ const result = {};
+ result.cwd = options.cwd;
+ result.env = options.env;
+ result['windowsVerbatimArguments'] =
+ options.windowsVerbatimArguments || this._isCmdFile();
+ if (options.windowsVerbatimArguments) {
+ result.argv0 = `"${toolPath}"`;
+ }
+ return result;
+ }
+ /**
+ * Exec a tool.
+ * Output will be streamed to the live console.
+ * Returns promise with return code
+ *
+ * @param tool path to tool to exec
+ * @param options optional exec options. See ExecOptions
+ * @returns number
+ */
+ exec() {
return __awaiter(this, void 0, void 0, function* () {
+ // root the tool path if it is unrooted and contains relative pathing
+ if (!ioUtil.isRooted(this.toolPath) &&
+ (this.toolPath.includes('/') ||
+ (IS_WINDOWS && this.toolPath.includes('\\')))) {
+ // prefer options.cwd if it is specified, however options.cwd may also need to be rooted
+ this.toolPath = path.resolve(process.cwd(), this.options.cwd || process.cwd(), this.toolPath);
+ }
+ // if the tool is only a file name, then resolve it from the PATH
+ // otherwise verify it exists (add extension on Windows if necessary)
+ this.toolPath = yield io.which(this.toolPath, true);
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
- const statusCode = res.message.statusCode || 0;
- const response = {
- statusCode,
- result: null,
- headers: {}
- };
- // not found leads to null obj returned
- if (statusCode === HttpCodes.NotFound) {
- resolve(response);
+ this._debug(`exec tool: ${this.toolPath}`);
+ this._debug('arguments:');
+ for (const arg of this.args) {
+ this._debug(` ${arg}`);
}
- // get the result from the body
- function dateTimeDeserializer(key, value) {
- if (typeof value === 'string') {
- const a = new Date(value);
- if (!isNaN(a.valueOf())) {
- return a;
- }
- }
- return value;
+ const optionsNonNull = this._cloneExecOptions(this.options);
+ if (!optionsNonNull.silent && optionsNonNull.outStream) {
+ optionsNonNull.outStream.write(this._getCommandString(optionsNonNull) + os.EOL);
}
- let obj;
- let contents;
- try {
- contents = yield res.readBody();
- if (contents && contents.length > 0) {
- if (options && options.deserializeDates) {
- obj = JSON.parse(contents, dateTimeDeserializer);
+ const state = new ExecState(optionsNonNull, this.toolPath);
+ state.on('debug', (message) => {
+ this._debug(message);
+ });
+ if (this.options.cwd && !(yield ioUtil.exists(this.options.cwd))) {
+ return reject(new Error(`The cwd: ${this.options.cwd} does not exist!`));
+ }
+ const fileName = this._getSpawnFileName();
+ const cp = child.spawn(fileName, this._getSpawnArgs(optionsNonNull), this._getSpawnOptions(this.options, fileName));
+ let stdbuffer = '';
+ if (cp.stdout) {
+ cp.stdout.on('data', (data) => {
+ if (this.options.listeners && this.options.listeners.stdout) {
+ this.options.listeners.stdout(data);
}
- else {
- obj = JSON.parse(contents);
+ if (!optionsNonNull.silent && optionsNonNull.outStream) {
+ optionsNonNull.outStream.write(data);
}
- response.result = obj;
- }
- response.headers = res.message.headers;
+ stdbuffer = this._processLineBuffer(data, stdbuffer, (line) => {
+ if (this.options.listeners && this.options.listeners.stdline) {
+ this.options.listeners.stdline(line);
+ }
+ });
+ });
}
- catch (err) {
- // Invalid resource (contents not json); leaving result obj null
+ let errbuffer = '';
+ if (cp.stderr) {
+ cp.stderr.on('data', (data) => {
+ state.processStderr = true;
+ if (this.options.listeners && this.options.listeners.stderr) {
+ this.options.listeners.stderr(data);
+ }
+ if (!optionsNonNull.silent &&
+ optionsNonNull.errStream &&
+ optionsNonNull.outStream) {
+ const s = optionsNonNull.failOnStdErr
+ ? optionsNonNull.errStream
+ : optionsNonNull.outStream;
+ s.write(data);
+ }
+ errbuffer = this._processLineBuffer(data, errbuffer, (line) => {
+ if (this.options.listeners && this.options.listeners.errline) {
+ this.options.listeners.errline(line);
+ }
+ });
+ });
}
- // note that 3xx redirects are handled by the http layer.
- if (statusCode > 299) {
- let msg;
- // if exception/error in body, attempt to get better error
- if (obj && obj.message) {
- msg = obj.message;
+ cp.on('error', (err) => {
+ state.processError = err.message;
+ state.processExited = true;
+ state.processClosed = true;
+ state.CheckComplete();
+ });
+ cp.on('exit', (code) => {
+ state.processExitCode = code;
+ state.processExited = true;
+ this._debug(`Exit code ${code} received from tool '${this.toolPath}'`);
+ state.CheckComplete();
+ });
+ cp.on('close', (code) => {
+ state.processExitCode = code;
+ state.processExited = true;
+ state.processClosed = true;
+ this._debug(`STDIO streams have closed for tool '${this.toolPath}'`);
+ state.CheckComplete();
+ });
+ state.on('done', (error, exitCode) => {
+ if (stdbuffer.length > 0) {
+ this.emit('stdline', stdbuffer);
}
- else if (contents && contents.length > 0) {
- // it may be the case that the exception is in the body message as string
- msg = contents;
+ if (errbuffer.length > 0) {
+ this.emit('errline', errbuffer);
+ }
+ cp.removeAllListeners();
+ if (error) {
+ reject(error);
}
else {
- msg = `Failed request: (${statusCode})`;
+ resolve(exitCode);
}
- const err = new HttpClientError(msg, statusCode);
- err.result = response.result;
- reject(err);
- }
- else {
- resolve(response);
+ });
+ if (this.options.input) {
+ if (!cp.stdin) {
+ throw new Error('child process missing stdin');
+ }
+ cp.stdin.end(this.options.input);
}
}));
});
}
}
-exports.HttpClient = HttpClient;
-const lowercaseKeys = (obj) => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {});
-//# sourceMappingURL=index.js.map
-
-/***/ }),
-
-/***/ 7377:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.checkBypass = exports.getProxyUrl = void 0;
-function getProxyUrl(reqUrl) {
- const usingSsl = reqUrl.protocol === 'https:';
- if (checkBypass(reqUrl)) {
- return undefined;
+exports.ToolRunner = ToolRunner;
+/**
+ * Convert an arg string to an array of args. Handles escaping
+ *
+ * @param argString string of arguments
+ * @returns string[] array of arguments
+ */
+function argStringToArray(argString) {
+ const args = [];
+ let inQuotes = false;
+ let escaped = false;
+ let arg = '';
+ function append(c) {
+ // we only escape double quotes.
+ if (escaped && c !== '"') {
+ arg += '\\';
+ }
+ arg += c;
+ escaped = false;
}
- const proxyVar = (() => {
- if (usingSsl) {
- return process.env['https_proxy'] || process.env['HTTPS_PROXY'];
+ for (let i = 0; i < argString.length; i++) {
+ const c = argString.charAt(i);
+ if (c === '"') {
+ if (!escaped) {
+ inQuotes = !inQuotes;
+ }
+ else {
+ append(c);
+ }
+ continue;
}
- else {
- return process.env['http_proxy'] || process.env['HTTP_PROXY'];
+ if (c === '\\' && escaped) {
+ append(c);
+ continue;
}
- })();
- if (proxyVar) {
- try {
- return new DecodedURL(proxyVar);
+ if (c === '\\' && inQuotes) {
+ escaped = true;
+ continue;
}
- catch (_a) {
- if (!proxyVar.startsWith('http://') && !proxyVar.startsWith('https://'))
- return new DecodedURL(`http://${proxyVar}`);
+ if (c === ' ' && !inQuotes) {
+ if (arg.length > 0) {
+ args.push(arg);
+ arg = '';
+ }
+ continue;
}
+ append(c);
}
- else {
- return undefined;
+ if (arg.length > 0) {
+ args.push(arg.trim());
}
+ return args;
}
-exports.getProxyUrl = getProxyUrl;
-function checkBypass(reqUrl) {
- if (!reqUrl.hostname) {
- return false;
- }
- const reqHost = reqUrl.hostname;
- if (isLoopbackAddress(reqHost)) {
- return true;
- }
- const noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || '';
- if (!noProxy) {
- return false;
- }
- // Determine the request port
- let reqPort;
- if (reqUrl.port) {
- reqPort = Number(reqUrl.port);
- }
- else if (reqUrl.protocol === 'http:') {
- reqPort = 80;
- }
- else if (reqUrl.protocol === 'https:') {
- reqPort = 443;
- }
- // Format the request hostname and hostname with port
- const upperReqHosts = [reqUrl.hostname.toUpperCase()];
- if (typeof reqPort === 'number') {
- upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`);
+exports.argStringToArray = argStringToArray;
+class ExecState extends events.EventEmitter {
+ constructor(options, toolPath) {
+ super();
+ this.processClosed = false; // tracks whether the process has exited and stdio is closed
+ this.processError = '';
+ this.processExitCode = 0;
+ this.processExited = false; // tracks whether the process has exited
+ this.processStderr = false; // tracks whether stderr was written to
+ this.delay = 10000; // 10 seconds
+ this.done = false;
+ this.timeout = null;
+ if (!toolPath) {
+ throw new Error('toolPath must not be empty');
+ }
+ this.options = options;
+ this.toolPath = toolPath;
+ if (options.delay) {
+ this.delay = options.delay;
+ }
}
- // Compare request host against noproxy
- for (const upperNoProxyItem of noProxy
- .split(',')
- .map(x => x.trim().toUpperCase())
- .filter(x => x)) {
- if (upperNoProxyItem === '*' ||
- upperReqHosts.some(x => x === upperNoProxyItem ||
- x.endsWith(`.${upperNoProxyItem}`) ||
- (upperNoProxyItem.startsWith('.') &&
- x.endsWith(`${upperNoProxyItem}`)))) {
- return true;
+ CheckComplete() {
+ if (this.done) {
+ return;
+ }
+ if (this.processClosed) {
+ this._setResult();
+ }
+ else if (this.processExited) {
+ this.timeout = timers_1.setTimeout(ExecState.HandleTimeout, this.delay, this);
}
}
- return false;
-}
-exports.checkBypass = checkBypass;
-function isLoopbackAddress(host) {
- const hostLower = host.toLowerCase();
- return (hostLower === 'localhost' ||
- hostLower.startsWith('127.') ||
- hostLower.startsWith('[::1]') ||
- hostLower.startsWith('[0:0:0:0:0:0:0:1]'));
-}
-class DecodedURL extends URL {
- constructor(url, base) {
- super(url, base);
- this._decodedUsername = decodeURIComponent(super.username);
- this._decodedPassword = decodeURIComponent(super.password);
+ _debug(message) {
+ this.emit('debug', message);
}
- get username() {
- return this._decodedUsername;
+ _setResult() {
+ // determine whether there is an error
+ let error;
+ if (this.processExited) {
+ if (this.processError) {
+ error = new Error(`There was an error when attempting to execute the process '${this.toolPath}'. This may indicate the process failed to start. Error: ${this.processError}`);
+ }
+ else if (this.processExitCode !== 0 && !this.options.ignoreReturnCode) {
+ error = new Error(`The process '${this.toolPath}' failed with exit code ${this.processExitCode}`);
+ }
+ else if (this.processStderr && this.options.failOnStdErr) {
+ error = new Error(`The process '${this.toolPath}' failed because one or more lines were written to the STDERR stream`);
+ }
+ }
+ // clear the timeout
+ if (this.timeout) {
+ clearTimeout(this.timeout);
+ this.timeout = null;
+ }
+ this.done = true;
+ this.emit('done', error, this.processExitCode);
}
- get password() {
- return this._decodedPassword;
+ static HandleTimeout(state) {
+ if (state.done) {
+ return;
+ }
+ if (!state.processClosed && state.processExited) {
+ const message = `The STDIO streams did not close within ${state.delay /
+ 1000} seconds of the exit event from process '${state.toolPath}'. This may indicate a child process inherited the STDIO streams and has not yet exited.`;
+ state._debug(message);
+ }
+ state._setResult();
}
}
-//# sourceMappingURL=proxy.js.map
+//# sourceMappingURL=toolrunner.js.map
/***/ }),
-/***/ 87351:
-/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
+/***/ 74087:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
"use strict";
-var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
-}) : (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- o[k2] = m[k];
-}));
-var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
- Object.defineProperty(o, "default", { enumerable: true, value: v });
-}) : function(o, v) {
- o["default"] = v;
-});
-var __importStar = (this && this.__importStar) || function (mod) {
- if (mod && mod.__esModule) return mod;
- var result = {};
- if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
- __setModuleDefault(result, mod);
- return result;
-};
Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.issue = exports.issueCommand = void 0;
-const os = __importStar(__nccwpck_require__(22037));
-const utils_1 = __nccwpck_require__(5278);
-/**
- * Commands
- *
- * Command Format:
- * ::name key=value,key=value::message
- *
- * Examples:
- * ::warning::This is the message
- * ::set-env name=MY_VAR::some value
- */
-function issueCommand(command, properties, message) {
- const cmd = new Command(command, properties, message);
- process.stdout.write(cmd.toString() + os.EOL);
-}
-exports.issueCommand = issueCommand;
-function issue(name, message = '') {
- issueCommand(name, {}, message);
-}
-exports.issue = issue;
-const CMD_STRING = '::';
-class Command {
- constructor(command, properties, message) {
- if (!command) {
- command = 'missing.command';
+exports.Context = void 0;
+const fs_1 = __nccwpck_require__(57147);
+const os_1 = __nccwpck_require__(22037);
+class Context {
+ /**
+ * Hydrate the context from the environment
+ */
+ constructor() {
+ var _a, _b, _c;
+ this.payload = {};
+ if (process.env.GITHUB_EVENT_PATH) {
+ if ((0, fs_1.existsSync)(process.env.GITHUB_EVENT_PATH)) {
+ this.payload = JSON.parse((0, fs_1.readFileSync)(process.env.GITHUB_EVENT_PATH, { encoding: 'utf8' }));
+ }
+ else {
+ const path = process.env.GITHUB_EVENT_PATH;
+ process.stdout.write(`GITHUB_EVENT_PATH ${path} does not exist${os_1.EOL}`);
+ }
}
- this.command = command;
- this.properties = properties;
- this.message = message;
+ this.eventName = process.env.GITHUB_EVENT_NAME;
+ this.sha = process.env.GITHUB_SHA;
+ this.ref = process.env.GITHUB_REF;
+ this.workflow = process.env.GITHUB_WORKFLOW;
+ this.action = process.env.GITHUB_ACTION;
+ this.actor = process.env.GITHUB_ACTOR;
+ this.job = process.env.GITHUB_JOB;
+ this.runNumber = parseInt(process.env.GITHUB_RUN_NUMBER, 10);
+ this.runId = parseInt(process.env.GITHUB_RUN_ID, 10);
+ this.apiUrl = (_a = process.env.GITHUB_API_URL) !== null && _a !== void 0 ? _a : `https://api.github.com`;
+ this.serverUrl = (_b = process.env.GITHUB_SERVER_URL) !== null && _b !== void 0 ? _b : `https://github.com`;
+ this.graphqlUrl =
+ (_c = process.env.GITHUB_GRAPHQL_URL) !== null && _c !== void 0 ? _c : `https://api.github.com/graphql`;
}
- toString() {
- let cmdStr = CMD_STRING + this.command;
- if (this.properties && Object.keys(this.properties).length > 0) {
- cmdStr += ' ';
- let first = true;
- for (const key in this.properties) {
- if (this.properties.hasOwnProperty(key)) {
- const val = this.properties[key];
- if (val) {
- if (first) {
- first = false;
- }
- else {
- cmdStr += ',';
- }
- cmdStr += `${key}=${escapeProperty(val)}`;
- }
- }
- }
+ get issue() {
+ const payload = this.payload;
+ return Object.assign(Object.assign({}, this.repo), { number: (payload.issue || payload.pull_request || payload).number });
+ }
+ get repo() {
+ if (process.env.GITHUB_REPOSITORY) {
+ const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/');
+ return { owner, repo };
}
- cmdStr += `${CMD_STRING}${escapeData(this.message)}`;
- return cmdStr;
+ if (this.payload.repository) {
+ return {
+ owner: this.payload.repository.owner.login,
+ repo: this.payload.repository.name
+ };
+ }
+ throw new Error("context.repo requires a GITHUB_REPOSITORY environment variable like 'owner/repo'");
}
}
-function escapeData(s) {
- return utils_1.toCommandValue(s)
- .replace(/%/g, '%25')
- .replace(/\r/g, '%0D')
- .replace(/\n/g, '%0A');
-}
-function escapeProperty(s) {
- return utils_1.toCommandValue(s)
- .replace(/%/g, '%25')
- .replace(/\r/g, '%0D')
- .replace(/\n/g, '%0A')
- .replace(/:/g, '%3A')
- .replace(/,/g, '%2C');
-}
-//# sourceMappingURL=command.js.map
+exports.Context = Context;
+//# sourceMappingURL=context.js.map
/***/ }),
-/***/ 42186:
+/***/ 95438:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() { return m[k]; } };
+ }
+ Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
@@ -12665,338 +15562,42 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
- if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
-var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
- return new (P || (P = Promise))(function (resolve, reject) {
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
-};
Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.getIDToken = exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.notice = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0;
-const command_1 = __nccwpck_require__(87351);
-const file_command_1 = __nccwpck_require__(717);
-const utils_1 = __nccwpck_require__(5278);
-const os = __importStar(__nccwpck_require__(22037));
-const path = __importStar(__nccwpck_require__(71017));
-const oidc_utils_1 = __nccwpck_require__(98041);
-/**
- * The code to exit an action
- */
-var ExitCode;
-(function (ExitCode) {
- /**
- * A code indicating that the action was successful
- */
- ExitCode[ExitCode["Success"] = 0] = "Success";
- /**
- * A code indicating that the action was a failure
- */
- ExitCode[ExitCode["Failure"] = 1] = "Failure";
-})(ExitCode = exports.ExitCode || (exports.ExitCode = {}));
-//-----------------------------------------------------------------------
-// Variables
-//-----------------------------------------------------------------------
-/**
- * Sets env variable for this action and future actions in the job
- * @param name the name of the variable to set
- * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
- */
-// eslint-disable-next-line @typescript-eslint/no-explicit-any
-function exportVariable(name, val) {
- const convertedVal = utils_1.toCommandValue(val);
- process.env[name] = convertedVal;
- const filePath = process.env['GITHUB_ENV'] || '';
- if (filePath) {
- return file_command_1.issueFileCommand('ENV', file_command_1.prepareKeyValueMessage(name, val));
- }
- command_1.issueCommand('set-env', { name }, convertedVal);
-}
-exports.exportVariable = exportVariable;
-/**
- * Registers a secret which will get masked from logs
- * @param secret value of the secret
- */
-function setSecret(secret) {
- command_1.issueCommand('add-mask', {}, secret);
-}
-exports.setSecret = setSecret;
-/**
- * Prepends inputPath to the PATH (for this action and future actions)
- * @param inputPath
- */
-function addPath(inputPath) {
- const filePath = process.env['GITHUB_PATH'] || '';
- if (filePath) {
- file_command_1.issueFileCommand('PATH', inputPath);
- }
- else {
- command_1.issueCommand('add-path', {}, inputPath);
- }
- process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
-}
-exports.addPath = addPath;
-/**
- * Gets the value of an input.
- * Unless trimWhitespace is set to false in InputOptions, the value is also trimmed.
- * Returns an empty string if the value is not defined.
- *
- * @param name name of the input to get
- * @param options optional. See InputOptions.
- * @returns string
- */
-function getInput(name, options) {
- const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || '';
- if (options && options.required && !val) {
- throw new Error(`Input required and not supplied: ${name}`);
- }
- if (options && options.trimWhitespace === false) {
- return val;
- }
- return val.trim();
-}
-exports.getInput = getInput;
-/**
- * Gets the values of an multiline input. Each value is also trimmed.
- *
- * @param name name of the input to get
- * @param options optional. See InputOptions.
- * @returns string[]
- *
- */
-function getMultilineInput(name, options) {
- const inputs = getInput(name, options)
- .split('\n')
- .filter(x => x !== '');
- if (options && options.trimWhitespace === false) {
- return inputs;
- }
- return inputs.map(input => input.trim());
-}
-exports.getMultilineInput = getMultilineInput;
-/**
- * Gets the input value of the boolean type in the YAML 1.2 "core schema" specification.
- * Support boolean input list: `true | True | TRUE | false | False | FALSE` .
- * The return value is also in boolean type.
- * ref: https://yaml.org/spec/1.2/spec.html#id2804923
- *
- * @param name name of the input to get
- * @param options optional. See InputOptions.
- * @returns boolean
- */
-function getBooleanInput(name, options) {
- const trueValue = ['true', 'True', 'TRUE'];
- const falseValue = ['false', 'False', 'FALSE'];
- const val = getInput(name, options);
- if (trueValue.includes(val))
- return true;
- if (falseValue.includes(val))
- return false;
- throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name}\n` +
- `Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
-}
-exports.getBooleanInput = getBooleanInput;
-/**
- * Sets the value of an output.
- *
- * @param name name of the output to set
- * @param value value to store. Non-string values will be converted to a string via JSON.stringify
- */
-// eslint-disable-next-line @typescript-eslint/no-explicit-any
-function setOutput(name, value) {
- const filePath = process.env['GITHUB_OUTPUT'] || '';
- if (filePath) {
- return file_command_1.issueFileCommand('OUTPUT', file_command_1.prepareKeyValueMessage(name, value));
- }
- process.stdout.write(os.EOL);
- command_1.issueCommand('set-output', { name }, utils_1.toCommandValue(value));
-}
-exports.setOutput = setOutput;
-/**
- * Enables or disables the echoing of commands into stdout for the rest of the step.
- * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
- *
- */
-function setCommandEcho(enabled) {
- command_1.issue('echo', enabled ? 'on' : 'off');
-}
-exports.setCommandEcho = setCommandEcho;
-//-----------------------------------------------------------------------
-// Results
-//-----------------------------------------------------------------------
-/**
- * Sets the action status to failed.
- * When the action exits it will be with an exit code of 1
- * @param message add error issue message
- */
-function setFailed(message) {
- process.exitCode = ExitCode.Failure;
- error(message);
-}
-exports.setFailed = setFailed;
-//-----------------------------------------------------------------------
-// Logging Commands
-//-----------------------------------------------------------------------
-/**
- * Gets whether Actions Step Debug is on or not
- */
-function isDebug() {
- return process.env['RUNNER_DEBUG'] === '1';
-}
-exports.isDebug = isDebug;
-/**
- * Writes debug message to user log
- * @param message debug message
- */
-function debug(message) {
- command_1.issueCommand('debug', {}, message);
-}
-exports.debug = debug;
-/**
- * Adds an error issue
- * @param message error issue message. Errors will be converted to string via toString()
- * @param properties optional properties to add to the annotation.
- */
-function error(message, properties = {}) {
- command_1.issueCommand('error', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
-}
-exports.error = error;
-/**
- * Adds a warning issue
- * @param message warning issue message. Errors will be converted to string via toString()
- * @param properties optional properties to add to the annotation.
- */
-function warning(message, properties = {}) {
- command_1.issueCommand('warning', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
-}
-exports.warning = warning;
-/**
- * Adds a notice issue
- * @param message notice issue message. Errors will be converted to string via toString()
- * @param properties optional properties to add to the annotation.
- */
-function notice(message, properties = {}) {
- command_1.issueCommand('notice', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
-}
-exports.notice = notice;
-/**
- * Writes info to log with console.log.
- * @param message info message
- */
-function info(message) {
- process.stdout.write(message + os.EOL);
-}
-exports.info = info;
-/**
- * Begin an output group.
- *
- * Output until the next `groupEnd` will be foldable in this group
- *
- * @param name The name of the output group
- */
-function startGroup(name) {
- command_1.issue('group', name);
-}
-exports.startGroup = startGroup;
-/**
- * End an output group.
- */
-function endGroup() {
- command_1.issue('endgroup');
-}
-exports.endGroup = endGroup;
-/**
- * Wrap an asynchronous function call in a group.
- *
- * Returns the same type as the function itself.
- *
- * @param name The name of the group
- * @param fn The function to wrap in the group
- */
-function group(name, fn) {
- return __awaiter(this, void 0, void 0, function* () {
- startGroup(name);
- let result;
- try {
- result = yield fn();
- }
- finally {
- endGroup();
- }
- return result;
- });
-}
-exports.group = group;
-//-----------------------------------------------------------------------
-// Wrapper action state
-//-----------------------------------------------------------------------
-/**
- * Saves state for current action, the state can only be retrieved by this action's post job execution.
- *
- * @param name name of the state to store
- * @param value value to store. Non-string values will be converted to a string via JSON.stringify
- */
-// eslint-disable-next-line @typescript-eslint/no-explicit-any
-function saveState(name, value) {
- const filePath = process.env['GITHUB_STATE'] || '';
- if (filePath) {
- return file_command_1.issueFileCommand('STATE', file_command_1.prepareKeyValueMessage(name, value));
- }
- command_1.issueCommand('save-state', { name }, utils_1.toCommandValue(value));
-}
-exports.saveState = saveState;
+exports.getOctokit = exports.context = void 0;
+const Context = __importStar(__nccwpck_require__(74087));
+const utils_1 = __nccwpck_require__(73030);
+exports.context = new Context.Context();
/**
- * Gets the value of an state set by this action's main execution.
+ * Returns a hydrated octokit ready to use for GitHub Actions
*
- * @param name name of the state to get
- * @returns string
+ * @param token the repo PAT or GITHUB_TOKEN
+ * @param options other options to set
*/
-function getState(name) {
- return process.env[`STATE_${name}`] || '';
-}
-exports.getState = getState;
-function getIDToken(aud) {
- return __awaiter(this, void 0, void 0, function* () {
- return yield oidc_utils_1.OidcClient.getIDToken(aud);
- });
+function getOctokit(token, options, ...additionalPlugins) {
+ const GitHubWithPlugins = utils_1.GitHub.plugin(...additionalPlugins);
+ return new GitHubWithPlugins((0, utils_1.getOctokitOptions)(token, options));
}
-exports.getIDToken = getIDToken;
-/**
- * Summary exports
- */
-var summary_1 = __nccwpck_require__(81327);
-Object.defineProperty(exports, "summary", ({ enumerable: true, get: function () { return summary_1.summary; } }));
-/**
- * @deprecated use core.summary
- */
-var summary_2 = __nccwpck_require__(81327);
-Object.defineProperty(exports, "markdownSummary", ({ enumerable: true, get: function () { return summary_2.markdownSummary; } }));
-/**
- * Path exports
- */
-var path_utils_1 = __nccwpck_require__(2981);
-Object.defineProperty(exports, "toPosixPath", ({ enumerable: true, get: function () { return path_utils_1.toPosixPath; } }));
-Object.defineProperty(exports, "toWin32Path", ({ enumerable: true, get: function () { return path_utils_1.toWin32Path; } }));
-Object.defineProperty(exports, "toPlatformPath", ({ enumerable: true, get: function () { return path_utils_1.toPlatformPath; } }));
-//# sourceMappingURL=core.js.map
+exports.getOctokit = getOctokit;
+//# sourceMappingURL=github.js.map
/***/ }),
-/***/ 717:
+/***/ 47914:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
"use strict";
-// For internal use, subject to change.
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() { return m[k]; } };
+ }
+ Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
@@ -13009,55 +15610,10 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
- if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.prepareKeyValueMessage = exports.issueFileCommand = void 0;
-// We use any as a valid input type
-/* eslint-disable @typescript-eslint/no-explicit-any */
-const fs = __importStar(__nccwpck_require__(57147));
-const os = __importStar(__nccwpck_require__(22037));
-const uuid_1 = __nccwpck_require__(75840);
-const utils_1 = __nccwpck_require__(5278);
-function issueFileCommand(command, message) {
- const filePath = process.env[`GITHUB_${command}`];
- if (!filePath) {
- throw new Error(`Unable to find environment variable for file command ${command}`);
- }
- if (!fs.existsSync(filePath)) {
- throw new Error(`Missing file at path: ${filePath}`);
- }
- fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
- encoding: 'utf8'
- });
-}
-exports.issueFileCommand = issueFileCommand;
-function prepareKeyValueMessage(key, value) {
- const delimiter = `ghadelimiter_${uuid_1.v4()}`;
- const convertedValue = utils_1.toCommandValue(value);
- // These should realistically never happen, but just in case someone finds a
- // way to exploit uuid generation let's not allow keys or values that contain
- // the delimiter.
- if (key.includes(delimiter)) {
- throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
- }
- if (convertedValue.includes(delimiter)) {
- throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
- }
- return `${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}`;
-}
-exports.prepareKeyValueMessage = prepareKeyValueMessage;
-//# sourceMappingURL=file-command.js.map
-
-/***/ }),
-
-/***/ 98041:
-/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
-
-"use strict";
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
@@ -13068,83 +15624,57 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.OidcClient = void 0;
-const http_client_1 = __nccwpck_require__(96255);
-const auth_1 = __nccwpck_require__(35526);
-const core_1 = __nccwpck_require__(42186);
-class OidcClient {
- static createHttpClient(allowRetry = true, maxRetry = 10) {
- const requestOptions = {
- allowRetries: allowRetry,
- maxRetries: maxRetry
- };
- return new http_client_1.HttpClient('actions/oidc-client', [new auth_1.BearerCredentialHandler(OidcClient.getRequestToken())], requestOptions);
- }
- static getRequestToken() {
- const token = process.env['ACTIONS_ID_TOKEN_REQUEST_TOKEN'];
- if (!token) {
- throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable');
- }
- return token;
- }
- static getIDTokenUrl() {
- const runtimeUrl = process.env['ACTIONS_ID_TOKEN_REQUEST_URL'];
- if (!runtimeUrl) {
- throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable');
- }
- return runtimeUrl;
- }
- static getCall(id_token_url) {
- var _a;
- return __awaiter(this, void 0, void 0, function* () {
- const httpclient = OidcClient.createHttpClient();
- const res = yield httpclient
- .getJson(id_token_url)
- .catch(error => {
- throw new Error(`Failed to get ID Token. \n
- Error Code : ${error.statusCode}\n
- Error Message: ${error.message}`);
- });
- const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value;
- if (!id_token) {
- throw new Error('Response json body do not have ID Token field');
- }
- return id_token;
- });
+exports.getApiBaseUrl = exports.getProxyFetch = exports.getProxyAgentDispatcher = exports.getProxyAgent = exports.getAuthString = void 0;
+const httpClient = __importStar(__nccwpck_require__(96255));
+const undici_1 = __nccwpck_require__(41773);
+function getAuthString(token, options) {
+ if (!token && !options.auth) {
+ throw new Error('Parameter token or opts.auth is required');
}
- static getIDToken(audience) {
- return __awaiter(this, void 0, void 0, function* () {
- try {
- // New ID Token is requested from action service
- let id_token_url = OidcClient.getIDTokenUrl();
- if (audience) {
- const encodedAudience = encodeURIComponent(audience);
- id_token_url = `${id_token_url}&audience=${encodedAudience}`;
- }
- core_1.debug(`ID token url is ${id_token_url}`);
- const id_token = yield OidcClient.getCall(id_token_url);
- core_1.setSecret(id_token);
- return id_token;
- }
- catch (error) {
- throw new Error(`Error message: ${error.message}`);
- }
- });
+ else if (token && options.auth) {
+ throw new Error('Parameters token and opts.auth may not both be specified');
}
+ return typeof options.auth === 'string' ? options.auth : `token ${token}`;
}
-exports.OidcClient = OidcClient;
-//# sourceMappingURL=oidc-utils.js.map
+exports.getAuthString = getAuthString;
+function getProxyAgent(destinationUrl) {
+ const hc = new httpClient.HttpClient();
+ return hc.getAgent(destinationUrl);
+}
+exports.getProxyAgent = getProxyAgent;
+function getProxyAgentDispatcher(destinationUrl) {
+ const hc = new httpClient.HttpClient();
+ return hc.getAgentDispatcher(destinationUrl);
+}
+exports.getProxyAgentDispatcher = getProxyAgentDispatcher;
+function getProxyFetch(destinationUrl) {
+ const httpDispatcher = getProxyAgentDispatcher(destinationUrl);
+ const proxyFetch = (url, opts) => __awaiter(this, void 0, void 0, function* () {
+ return (0, undici_1.fetch)(url, Object.assign(Object.assign({}, opts), { dispatcher: httpDispatcher }));
+ });
+ return proxyFetch;
+}
+exports.getProxyFetch = getProxyFetch;
+function getApiBaseUrl() {
+ return process.env['GITHUB_API_URL'] || 'https://api.github.com';
+}
+exports.getApiBaseUrl = getApiBaseUrl;
+//# sourceMappingURL=utils.js.map
/***/ }),
-/***/ 2981:
+/***/ 73030:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() { return m[k]; } };
+ }
+ Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
@@ -13157,1900 +15687,572 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
- if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.toPlatformPath = exports.toWin32Path = exports.toPosixPath = void 0;
-const path = __importStar(__nccwpck_require__(71017));
-/**
- * toPosixPath converts the given path to the posix form. On Windows, \\ will be
- * replaced with /.
- *
- * @param pth. Path to transform.
- * @return string Posix path.
- */
-function toPosixPath(pth) {
- return pth.replace(/[\\]/g, '/');
-}
-exports.toPosixPath = toPosixPath;
-/**
- * toWin32Path converts the given path to the win32 form. On Linux, / will be
- * replaced with \\.
- *
- * @param pth. Path to transform.
- * @return string Win32 path.
- */
-function toWin32Path(pth) {
- return pth.replace(/[/]/g, '\\');
-}
-exports.toWin32Path = toWin32Path;
+exports.getOctokitOptions = exports.GitHub = exports.defaults = exports.context = void 0;
+const Context = __importStar(__nccwpck_require__(74087));
+const Utils = __importStar(__nccwpck_require__(47914));
+// octokit + plugins
+const core_1 = __nccwpck_require__(18525);
+const plugin_rest_endpoint_methods_1 = __nccwpck_require__(94045);
+const plugin_paginate_rest_1 = __nccwpck_require__(48945);
+exports.context = new Context.Context();
+const baseUrl = Utils.getApiBaseUrl();
+exports.defaults = {
+ baseUrl,
+ request: {
+ agent: Utils.getProxyAgent(baseUrl),
+ fetch: Utils.getProxyFetch(baseUrl)
+ }
+};
+exports.GitHub = core_1.Octokit.plugin(plugin_rest_endpoint_methods_1.restEndpointMethods, plugin_paginate_rest_1.paginateRest).defaults(exports.defaults);
/**
- * toPlatformPath converts the given path to a platform-specific path. It does
- * this by replacing instances of / and \ with the platform-specific path
- * separator.
+ * Convience function to correctly format Octokit Options to pass into the constructor.
*
- * @param pth The path to platformize.
- * @return string The platform-specific path.
+ * @param token the repo PAT or GITHUB_TOKEN
+ * @param options other options to set
*/
-function toPlatformPath(pth) {
- return pth.replace(/[/\\]/g, path.sep);
+function getOctokitOptions(token, options) {
+ const opts = Object.assign({}, options || {}); // Shallow clone - don't mutate the object provided by the caller
+ // Auth
+ const auth = Utils.getAuthString(token, opts);
+ if (auth) {
+ opts.auth = auth;
+ }
+ return opts;
}
-exports.toPlatformPath = toPlatformPath;
-//# sourceMappingURL=path-utils.js.map
+exports.getOctokitOptions = getOctokitOptions;
+//# sourceMappingURL=utils.js.map
/***/ }),
-/***/ 81327:
-/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
+/***/ 40673:
+/***/ ((module) => {
"use strict";
-var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
- return new (P || (P = Promise))(function (resolve, reject) {
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
+var __defProp = Object.defineProperty;
+var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
+var __getOwnPropNames = Object.getOwnPropertyNames;
+var __hasOwnProp = Object.prototype.hasOwnProperty;
+var __export = (target, all) => {
+ for (var name in all)
+ __defProp(target, name, { get: all[name], enumerable: true });
};
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.summary = exports.markdownSummary = exports.SUMMARY_DOCS_URL = exports.SUMMARY_ENV_VAR = void 0;
-const os_1 = __nccwpck_require__(22037);
-const fs_1 = __nccwpck_require__(57147);
-const { access, appendFile, writeFile } = fs_1.promises;
-exports.SUMMARY_ENV_VAR = 'GITHUB_STEP_SUMMARY';
-exports.SUMMARY_DOCS_URL = 'https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary';
-class Summary {
- constructor() {
- this._buffer = '';
- }
- /**
- * Finds the summary file path from the environment, rejects if env var is not found or file does not exist
- * Also checks r/w permissions.
- *
- * @returns step summary file path
- */
- filePath() {
- return __awaiter(this, void 0, void 0, function* () {
- if (this._filePath) {
- return this._filePath;
- }
- const pathFromEnv = process.env[exports.SUMMARY_ENV_VAR];
- if (!pathFromEnv) {
- throw new Error(`Unable to find environment variable for $${exports.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`);
- }
- try {
- yield access(pathFromEnv, fs_1.constants.R_OK | fs_1.constants.W_OK);
- }
- catch (_a) {
- throw new Error(`Unable to access summary file: '${pathFromEnv}'. Check if the file has correct read/write permissions.`);
- }
- this._filePath = pathFromEnv;
- return this._filePath;
- });
- }
- /**
- * Wraps content in an HTML tag, adding any HTML attributes
- *
- * @param {string} tag HTML tag to wrap
- * @param {string | null} content content within the tag
- * @param {[attribute: string]: string} attrs key-value list of HTML attributes to add
- *
- * @returns {string} content wrapped in HTML element
- */
- wrap(tag, content, attrs = {}) {
- const htmlAttrs = Object.entries(attrs)
- .map(([key, value]) => ` ${key}="${value}"`)
- .join('');
- if (!content) {
- return `<${tag}${htmlAttrs}>`;
- }
- return `<${tag}${htmlAttrs}>${content}${tag}>`;
- }
- /**
- * Writes text in the buffer to the summary buffer file and empties buffer. Will append by default.
- *
- * @param {SummaryWriteOptions} [options] (optional) options for write operation
- *
- * @returns {Promise} summary instance
- */
- write(options) {
- return __awaiter(this, void 0, void 0, function* () {
- const overwrite = !!(options === null || options === void 0 ? void 0 : options.overwrite);
- const filePath = yield this.filePath();
- const writeFunc = overwrite ? writeFile : appendFile;
- yield writeFunc(filePath, this._buffer, { encoding: 'utf8' });
- return this.emptyBuffer();
- });
- }
- /**
- * Clears the summary buffer and wipes the summary file
- *
- * @returns {Summary} summary instance
- */
- clear() {
- return __awaiter(this, void 0, void 0, function* () {
- return this.emptyBuffer().write({ overwrite: true });
- });
- }
- /**
- * Returns the current summary buffer as a string
- *
- * @returns {string} string of summary buffer
- */
- stringify() {
- return this._buffer;
- }
- /**
- * If the summary buffer is empty
- *
- * @returns {boolen} true if the buffer is empty
- */
- isEmptyBuffer() {
- return this._buffer.length === 0;
- }
- /**
- * Resets the summary buffer without writing to summary file
- *
- * @returns {Summary} summary instance
- */
- emptyBuffer() {
- this._buffer = '';
- return this;
- }
- /**
- * Adds raw text to the summary buffer
- *
- * @param {string} text content to add
- * @param {boolean} [addEOL=false] (optional) append an EOL to the raw text (default: false)
- *
- * @returns {Summary} summary instance
- */
- addRaw(text, addEOL = false) {
- this._buffer += text;
- return addEOL ? this.addEOL() : this;
- }
- /**
- * Adds the operating system-specific end-of-line marker to the buffer
- *
- * @returns {Summary} summary instance
- */
- addEOL() {
- return this.addRaw(os_1.EOL);
- }
- /**
- * Adds an HTML codeblock to the summary buffer
- *
- * @param {string} code content to render within fenced code block
- * @param {string} lang (optional) language to syntax highlight code
- *
- * @returns {Summary} summary instance
- */
- addCodeBlock(code, lang) {
- const attrs = Object.assign({}, (lang && { lang }));
- const element = this.wrap('pre', this.wrap('code', code), attrs);
- return this.addRaw(element).addEOL();
- }
- /**
- * Adds an HTML list to the summary buffer
- *
- * @param {string[]} items list of items to render
- * @param {boolean} [ordered=false] (optional) if the rendered list should be ordered or not (default: false)
- *
- * @returns {Summary} summary instance
- */
- addList(items, ordered = false) {
- const tag = ordered ? 'ol' : 'ul';
- const listItems = items.map(item => this.wrap('li', item)).join('');
- const element = this.wrap(tag, listItems);
- return this.addRaw(element).addEOL();
- }
- /**
- * Adds an HTML table to the summary buffer
- *
- * @param {SummaryTableCell[]} rows table rows
- *
- * @returns {Summary} summary instance
- */
- addTable(rows) {
- const tableBody = rows
- .map(row => {
- const cells = row
- .map(cell => {
- if (typeof cell === 'string') {
- return this.wrap('td', cell);
- }
- const { header, data, colspan, rowspan } = cell;
- const tag = header ? 'th' : 'td';
- const attrs = Object.assign(Object.assign({}, (colspan && { colspan })), (rowspan && { rowspan }));
- return this.wrap(tag, data, attrs);
- })
- .join('');
- return this.wrap('tr', cells);
- })
- .join('');
- const element = this.wrap('table', tableBody);
- return this.addRaw(element).addEOL();
- }
- /**
- * Adds a collapsable HTML details element to the summary buffer
- *
- * @param {string} label text for the closed state
- * @param {string} content collapsable content
- *
- * @returns {Summary} summary instance
- */
- addDetails(label, content) {
- const element = this.wrap('details', this.wrap('summary', label) + content);
- return this.addRaw(element).addEOL();
- }
- /**
- * Adds an HTML image tag to the summary buffer
- *
- * @param {string} src path to the image you to embed
- * @param {string} alt text description of the image
- * @param {SummaryImageOptions} options (optional) addition image attributes
- *
- * @returns {Summary} summary instance
- */
- addImage(src, alt, options) {
- const { width, height } = options || {};
- const attrs = Object.assign(Object.assign({}, (width && { width })), (height && { height }));
- const element = this.wrap('img', null, Object.assign({ src, alt }, attrs));
- return this.addRaw(element).addEOL();
- }
- /**
- * Adds an HTML section heading element
- *
- * @param {string} text heading text
- * @param {number | string} [level=1] (optional) the heading level, default: 1
- *
- * @returns {Summary} summary instance
- */
- addHeading(text, level) {
- const tag = `h${level}`;
- const allowedTag = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(tag)
- ? tag
- : 'h1';
- const element = this.wrap(allowedTag, text);
- return this.addRaw(element).addEOL();
- }
- /**
- * Adds an HTML thematic break (
) to the summary buffer
- *
- * @returns {Summary} summary instance
- */
- addSeparator() {
- const element = this.wrap('hr', null);
- return this.addRaw(element).addEOL();
- }
- /**
- * Adds an HTML line break (
) to the summary buffer
- *
- * @returns {Summary} summary instance
- */
- addBreak() {
- const element = this.wrap('br', null);
- return this.addRaw(element).addEOL();
- }
- /**
- * Adds an HTML blockquote to the summary buffer
- *
- * @param {string} text quote text
- * @param {string} cite (optional) citation url
- *
- * @returns {Summary} summary instance
- */
- addQuote(text, cite) {
- const attrs = Object.assign({}, (cite && { cite }));
- const element = this.wrap('blockquote', text, attrs);
- return this.addRaw(element).addEOL();
- }
- /**
- * Adds an HTML anchor tag to the summary buffer
- *
- * @param {string} text link text/content
- * @param {string} href hyperlink
- *
- * @returns {Summary} summary instance
- */
- addLink(text, href) {
- const element = this.wrap('a', text, { href });
- return this.addRaw(element).addEOL();
- }
+var __copyProps = (to, from, except, desc) => {
+ if (from && typeof from === "object" || typeof from === "function") {
+ for (let key of __getOwnPropNames(from))
+ if (!__hasOwnProp.call(to, key) && key !== except)
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
+ }
+ return to;
+};
+var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
+
+// pkg/dist-src/index.js
+var dist_src_exports = {};
+__export(dist_src_exports, {
+ createTokenAuth: () => createTokenAuth
+});
+module.exports = __toCommonJS(dist_src_exports);
+
+// pkg/dist-src/auth.js
+var REGEX_IS_INSTALLATION_LEGACY = /^v1\./;
+var REGEX_IS_INSTALLATION = /^ghs_/;
+var REGEX_IS_USER_TO_SERVER = /^ghu_/;
+async function auth(token) {
+ const isApp = token.split(/\./).length === 3;
+ const isInstallation = REGEX_IS_INSTALLATION_LEGACY.test(token) || REGEX_IS_INSTALLATION.test(token);
+ const isUserToServer = REGEX_IS_USER_TO_SERVER.test(token);
+ const tokenType = isApp ? "app" : isInstallation ? "installation" : isUserToServer ? "user-to-server" : "oauth";
+ return {
+ type: "token",
+ token,
+ tokenType
+ };
}
-const _summary = new Summary();
-/**
- * @deprecated use `core.summary`
- */
-exports.markdownSummary = _summary;
-exports.summary = _summary;
-//# sourceMappingURL=summary.js.map
+
+// pkg/dist-src/with-authorization-prefix.js
+function withAuthorizationPrefix(token) {
+ if (token.split(/\./).length === 3) {
+ return `bearer ${token}`;
+ }
+ return `token ${token}`;
+}
+
+// pkg/dist-src/hook.js
+async function hook(token, request, route, parameters) {
+ const endpoint = request.endpoint.merge(
+ route,
+ parameters
+ );
+ endpoint.headers.authorization = withAuthorizationPrefix(token);
+ return request(endpoint);
+}
+
+// pkg/dist-src/index.js
+var createTokenAuth = function createTokenAuth2(token) {
+ if (!token) {
+ throw new Error("[@octokit/auth-token] No token passed to createTokenAuth");
+ }
+ if (typeof token !== "string") {
+ throw new Error(
+ "[@octokit/auth-token] Token passed to createTokenAuth is not a string"
+ );
+ }
+ token = token.replace(/^(token|bearer) +/i, "");
+ return Object.assign(auth.bind(null, token), {
+ hook: hook.bind(null, token)
+ });
+};
+// Annotate the CommonJS export names for ESM import in node:
+0 && (0);
+
/***/ }),
-/***/ 5278:
-/***/ ((__unused_webpack_module, exports) => {
+/***/ 18525:
+/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
-// We use any as a valid input type
-/* eslint-disable @typescript-eslint/no-explicit-any */
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.toCommandProperties = exports.toCommandValue = void 0;
-/**
- * Sanitizes an input into a string so it can be passed into issueCommand safely
- * @param input input to sanitize into a string
- */
-function toCommandValue(input) {
- if (input === null || input === undefined) {
- return '';
- }
- else if (typeof input === 'string' || input instanceof String) {
- return input;
- }
- return JSON.stringify(input);
-}
-exports.toCommandValue = toCommandValue;
-/**
- *
- * @param annotationProperties
- * @returns The command properties to send with the actual annotation command
- * See IssueCommandProperties: https://github.com/actions/runner/blob/main/src/Runner.Worker/ActionCommandManager.cs#L646
- */
-function toCommandProperties(annotationProperties) {
- if (!Object.keys(annotationProperties).length) {
- return {};
- }
- return {
- title: annotationProperties.title,
- file: annotationProperties.file,
- line: annotationProperties.startLine,
- endLine: annotationProperties.endLine,
- col: annotationProperties.startColumn,
- endColumn: annotationProperties.endColumn
+var __defProp = Object.defineProperty;
+var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
+var __getOwnPropNames = Object.getOwnPropertyNames;
+var __hasOwnProp = Object.prototype.hasOwnProperty;
+var __export = (target, all) => {
+ for (var name in all)
+ __defProp(target, name, { get: all[name], enumerable: true });
+};
+var __copyProps = (to, from, except, desc) => {
+ if (from && typeof from === "object" || typeof from === "function") {
+ for (let key of __getOwnPropNames(from))
+ if (!__hasOwnProp.call(to, key) && key !== except)
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
+ }
+ return to;
+};
+var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
+
+// pkg/dist-src/index.js
+var dist_src_exports = {};
+__export(dist_src_exports, {
+ Octokit: () => Octokit
+});
+module.exports = __toCommonJS(dist_src_exports);
+var import_universal_user_agent = __nccwpck_require__(45030);
+var import_before_after_hook = __nccwpck_require__(83682);
+var import_request = __nccwpck_require__(89353);
+var import_graphql = __nccwpck_require__(86422);
+var import_auth_token = __nccwpck_require__(40673);
+
+// pkg/dist-src/version.js
+var VERSION = "5.0.1";
+
+// pkg/dist-src/index.js
+var Octokit = class {
+ static {
+ this.VERSION = VERSION;
+ }
+ static defaults(defaults) {
+ const OctokitWithDefaults = class extends this {
+ constructor(...args) {
+ const options = args[0] || {};
+ if (typeof defaults === "function") {
+ super(defaults(options));
+ return;
+ }
+ super(
+ Object.assign(
+ {},
+ defaults,
+ options,
+ options.userAgent && defaults.userAgent ? {
+ userAgent: `${options.userAgent} ${defaults.userAgent}`
+ } : null
+ )
+ );
+ }
};
-}
-exports.toCommandProperties = toCommandProperties;
-//# sourceMappingURL=utils.js.map
+ return OctokitWithDefaults;
+ }
+ static {
+ this.plugins = [];
+ }
+ /**
+ * Attach a plugin (or many) to your Octokit instance.
+ *
+ * @example
+ * const API = Octokit.plugin(plugin1, plugin2, plugin3, ...)
+ */
+ static plugin(...newPlugins) {
+ const currentPlugins = this.plugins;
+ const NewOctokit = class extends this {
+ static {
+ this.plugins = currentPlugins.concat(
+ newPlugins.filter((plugin) => !currentPlugins.includes(plugin))
+ );
+ }
+ };
+ return NewOctokit;
+ }
+ constructor(options = {}) {
+ const hook = new import_before_after_hook.Collection();
+ const requestDefaults = {
+ baseUrl: import_request.request.endpoint.DEFAULTS.baseUrl,
+ headers: {},
+ request: Object.assign({}, options.request, {
+ // @ts-ignore internal usage only, no need to type
+ hook: hook.bind(null, "request")
+ }),
+ mediaType: {
+ previews: [],
+ format: ""
+ }
+ };
+ requestDefaults.headers["user-agent"] = [
+ options.userAgent,
+ `octokit-core.js/${VERSION} ${(0, import_universal_user_agent.getUserAgent)()}`
+ ].filter(Boolean).join(" ");
+ if (options.baseUrl) {
+ requestDefaults.baseUrl = options.baseUrl;
+ }
+ if (options.previews) {
+ requestDefaults.mediaType.previews = options.previews;
+ }
+ if (options.timeZone) {
+ requestDefaults.headers["time-zone"] = options.timeZone;
+ }
+ this.request = import_request.request.defaults(requestDefaults);
+ this.graphql = (0, import_graphql.withCustomRequest)(this.request).defaults(requestDefaults);
+ this.log = Object.assign(
+ {
+ debug: () => {
+ },
+ info: () => {
+ },
+ warn: console.warn.bind(console),
+ error: console.error.bind(console)
+ },
+ options.log
+ );
+ this.hook = hook;
+ if (!options.authStrategy) {
+ if (!options.auth) {
+ this.auth = async () => ({
+ type: "unauthenticated"
+ });
+ } else {
+ const auth = (0, import_auth_token.createTokenAuth)(options.auth);
+ hook.wrap("request", auth.hook);
+ this.auth = auth;
+ }
+ } else {
+ const { authStrategy, ...otherOptions } = options;
+ const auth = authStrategy(
+ Object.assign(
+ {
+ request: this.request,
+ log: this.log,
+ // we pass the current octokit instance as well as its constructor options
+ // to allow for authentication strategies that return a new octokit instance
+ // that shares the same internal state as the current one. The original
+ // requirement for this was the "event-octokit" authentication strategy
+ // of https://github.com/probot/octokit-auth-probot.
+ octokit: this,
+ octokitOptions: otherOptions
+ },
+ options.auth
+ )
+ );
+ hook.wrap("request", auth.hook);
+ this.auth = auth;
+ }
+ const classConstructor = this.constructor;
+ classConstructor.plugins.forEach((plugin) => {
+ Object.assign(this, plugin(this, options));
+ });
+ }
+};
+// Annotate the CommonJS export names for ESM import in node:
+0 && (0);
+
/***/ }),
-/***/ 71514:
-/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
+/***/ 38713:
+/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
-var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
-}) : (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- o[k2] = m[k];
-}));
-var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
- Object.defineProperty(o, "default", { enumerable: true, value: v });
-}) : function(o, v) {
- o["default"] = v;
-});
-var __importStar = (this && this.__importStar) || function (mod) {
- if (mod && mod.__esModule) return mod;
- var result = {};
- if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
- __setModuleDefault(result, mod);
- return result;
+var __defProp = Object.defineProperty;
+var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
+var __getOwnPropNames = Object.getOwnPropertyNames;
+var __hasOwnProp = Object.prototype.hasOwnProperty;
+var __export = (target, all) => {
+ for (var name in all)
+ __defProp(target, name, { get: all[name], enumerable: true });
};
-var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
- return new (P || (P = Promise))(function (resolve, reject) {
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
+var __copyProps = (to, from, except, desc) => {
+ if (from && typeof from === "object" || typeof from === "function") {
+ for (let key of __getOwnPropNames(from))
+ if (!__hasOwnProp.call(to, key) && key !== except)
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
+ }
+ return to;
};
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.getExecOutput = exports.exec = void 0;
-const string_decoder_1 = __nccwpck_require__(71576);
-const tr = __importStar(__nccwpck_require__(88159));
-/**
- * Exec a command.
- * Output will be streamed to the live console.
- * Returns promise with return code
- *
- * @param commandLine command to execute (can include additional args). Must be correctly escaped.
- * @param args optional arguments for tool. Escaping is handled by the lib.
- * @param options optional exec options. See ExecOptions
- * @returns Promise exit code
- */
-function exec(commandLine, args, options) {
- return __awaiter(this, void 0, void 0, function* () {
- const commandArgs = tr.argStringToArray(commandLine);
- if (commandArgs.length === 0) {
- throw new Error(`Parameter 'commandLine' cannot be null or empty.`);
- }
- // Path to tool to execute should be first arg
- const toolPath = commandArgs[0];
- args = commandArgs.slice(1).concat(args || []);
- const runner = new tr.ToolRunner(toolPath, args, options);
- return runner.exec();
- });
-}
-exports.exec = exec;
-/**
- * Exec a command and get the output.
- * Output will be streamed to the live console.
- * Returns promise with the exit code and collected stdout and stderr
- *
- * @param commandLine command to execute (can include additional args). Must be correctly escaped.
- * @param args optional arguments for tool. Escaping is handled by the lib.
- * @param options optional exec options. See ExecOptions
- * @returns Promise exit code, stdout, and stderr
- */
-function getExecOutput(commandLine, args, options) {
- var _a, _b;
- return __awaiter(this, void 0, void 0, function* () {
- let stdout = '';
- let stderr = '';
- //Using string decoder covers the case where a mult-byte character is split
- const stdoutDecoder = new string_decoder_1.StringDecoder('utf8');
- const stderrDecoder = new string_decoder_1.StringDecoder('utf8');
- const originalStdoutListener = (_a = options === null || options === void 0 ? void 0 : options.listeners) === null || _a === void 0 ? void 0 : _a.stdout;
- const originalStdErrListener = (_b = options === null || options === void 0 ? void 0 : options.listeners) === null || _b === void 0 ? void 0 : _b.stderr;
- const stdErrListener = (data) => {
- stderr += stderrDecoder.write(data);
- if (originalStdErrListener) {
- originalStdErrListener(data);
- }
- };
- const stdOutListener = (data) => {
- stdout += stdoutDecoder.write(data);
- if (originalStdoutListener) {
- originalStdoutListener(data);
- }
- };
- const listeners = Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.listeners), { stdout: stdOutListener, stderr: stdErrListener });
- const exitCode = yield exec(commandLine, args, Object.assign(Object.assign({}, options), { listeners }));
- //flush any remaining characters
- stdout += stdoutDecoder.end();
- stderr += stderrDecoder.end();
- return {
- exitCode,
- stdout,
- stderr
- };
- });
-}
-exports.getExecOutput = getExecOutput;
-//# sourceMappingURL=exec.js.map
+var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
-/***/ }),
+// pkg/dist-src/index.js
+var dist_src_exports = {};
+__export(dist_src_exports, {
+ endpoint: () => endpoint
+});
+module.exports = __toCommonJS(dist_src_exports);
-/***/ 88159:
-/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
+// pkg/dist-src/defaults.js
+var import_universal_user_agent = __nccwpck_require__(45030);
-"use strict";
+// pkg/dist-src/version.js
+var VERSION = "9.0.1";
-var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
-}) : (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- o[k2] = m[k];
-}));
-var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
- Object.defineProperty(o, "default", { enumerable: true, value: v });
-}) : function(o, v) {
- o["default"] = v;
-});
-var __importStar = (this && this.__importStar) || function (mod) {
- if (mod && mod.__esModule) return mod;
- var result = {};
- if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
- __setModuleDefault(result, mod);
- return result;
-};
-var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
- return new (P || (P = Promise))(function (resolve, reject) {
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
+// pkg/dist-src/defaults.js
+var userAgent = `octokit-endpoint.js/${VERSION} ${(0, import_universal_user_agent.getUserAgent)()}`;
+var DEFAULTS = {
+ method: "GET",
+ baseUrl: "https://api.github.com",
+ headers: {
+ accept: "application/vnd.github.v3+json",
+ "user-agent": userAgent
+ },
+ mediaType: {
+ format: ""
+ }
};
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.argStringToArray = exports.ToolRunner = void 0;
-const os = __importStar(__nccwpck_require__(22037));
-const events = __importStar(__nccwpck_require__(82361));
-const child = __importStar(__nccwpck_require__(32081));
-const path = __importStar(__nccwpck_require__(71017));
-const io = __importStar(__nccwpck_require__(47351));
-const ioUtil = __importStar(__nccwpck_require__(81962));
-const timers_1 = __nccwpck_require__(39512);
-/* eslint-disable @typescript-eslint/unbound-method */
-const IS_WINDOWS = process.platform === 'win32';
-/*
- * Class for running command line tools. Handles quoting and arg parsing in a platform agnostic way.
- */
-class ToolRunner extends events.EventEmitter {
- constructor(toolPath, args, options) {
- super();
- if (!toolPath) {
- throw new Error("Parameter 'toolPath' cannot be null or empty.");
- }
- this.toolPath = toolPath;
- this.args = args || [];
- this.options = options || {};
- }
- _debug(message) {
- if (this.options.listeners && this.options.listeners.debug) {
- this.options.listeners.debug(message);
- }
- }
- _getCommandString(options, noPrefix) {
- const toolPath = this._getSpawnFileName();
- const args = this._getSpawnArgs(options);
- let cmd = noPrefix ? '' : '[command]'; // omit prefix when piped to a second tool
- if (IS_WINDOWS) {
- // Windows + cmd file
- if (this._isCmdFile()) {
- cmd += toolPath;
- for (const a of args) {
- cmd += ` ${a}`;
- }
- }
- // Windows + verbatim
- else if (options.windowsVerbatimArguments) {
- cmd += `"${toolPath}"`;
- for (const a of args) {
- cmd += ` ${a}`;
- }
- }
- // Windows (regular)
- else {
- cmd += this._windowsQuoteCmdArg(toolPath);
- for (const a of args) {
- cmd += ` ${this._windowsQuoteCmdArg(a)}`;
- }
- }
- }
- else {
- // OSX/Linux - this can likely be improved with some form of quoting.
- // creating processes on Unix is fundamentally different than Windows.
- // on Unix, execvp() takes an arg array.
- cmd += toolPath;
- for (const a of args) {
- cmd += ` ${a}`;
- }
- }
- return cmd;
- }
- _processLineBuffer(data, strBuffer, onLine) {
- try {
- let s = strBuffer + data.toString();
- let n = s.indexOf(os.EOL);
- while (n > -1) {
- const line = s.substring(0, n);
- onLine(line);
- // the rest of the string ...
- s = s.substring(n + os.EOL.length);
- n = s.indexOf(os.EOL);
- }
- return s;
- }
- catch (err) {
- // streaming lines to console is best effort. Don't fail a build.
- this._debug(`error processing line. Failed with error ${err}`);
- return '';
- }
+
+// pkg/dist-src/util/lowercase-keys.js
+function lowercaseKeys(object) {
+ if (!object) {
+ return {};
+ }
+ return Object.keys(object).reduce((newObj, key) => {
+ newObj[key.toLowerCase()] = object[key];
+ return newObj;
+ }, {});
+}
+
+// pkg/dist-src/util/merge-deep.js
+var import_is_plain_object = __nccwpck_require__(63287);
+function mergeDeep(defaults, options) {
+ const result = Object.assign({}, defaults);
+ Object.keys(options).forEach((key) => {
+ if ((0, import_is_plain_object.isPlainObject)(options[key])) {
+ if (!(key in defaults))
+ Object.assign(result, { [key]: options[key] });
+ else
+ result[key] = mergeDeep(defaults[key], options[key]);
+ } else {
+ Object.assign(result, { [key]: options[key] });
}
- _getSpawnFileName() {
- if (IS_WINDOWS) {
- if (this._isCmdFile()) {
- return process.env['COMSPEC'] || 'cmd.exe';
- }
- }
- return this.toolPath;
+ });
+ return result;
+}
+
+// pkg/dist-src/util/remove-undefined-properties.js
+function removeUndefinedProperties(obj) {
+ for (const key in obj) {
+ if (obj[key] === void 0) {
+ delete obj[key];
}
- _getSpawnArgs(options) {
- if (IS_WINDOWS) {
- if (this._isCmdFile()) {
- let argline = `/D /S /C "${this._windowsQuoteCmdArg(this.toolPath)}`;
- for (const a of this.args) {
- argline += ' ';
- argline += options.windowsVerbatimArguments
- ? a
- : this._windowsQuoteCmdArg(a);
- }
- argline += '"';
- return [argline];
- }
- }
- return this.args;
+ }
+ return obj;
+}
+
+// pkg/dist-src/merge.js
+function merge(defaults, route, options) {
+ if (typeof route === "string") {
+ let [method, url] = route.split(" ");
+ options = Object.assign(url ? { method, url } : { url: method }, options);
+ } else {
+ options = Object.assign({}, route);
+ }
+ options.headers = lowercaseKeys(options.headers);
+ removeUndefinedProperties(options);
+ removeUndefinedProperties(options.headers);
+ const mergedOptions = mergeDeep(defaults || {}, options);
+ if (options.url === "/graphql") {
+ if (defaults && defaults.mediaType.previews?.length) {
+ mergedOptions.mediaType.previews = defaults.mediaType.previews.filter(
+ (preview) => !mergedOptions.mediaType.previews.includes(preview)
+ ).concat(mergedOptions.mediaType.previews);
}
- _endsWith(str, end) {
- return str.endsWith(end);
+ mergedOptions.mediaType.previews = (mergedOptions.mediaType.previews || []).map((preview) => preview.replace(/-preview/, ""));
+ }
+ return mergedOptions;
+}
+
+// pkg/dist-src/util/add-query-parameters.js
+function addQueryParameters(url, parameters) {
+ const separator = /\?/.test(url) ? "&" : "?";
+ const names = Object.keys(parameters);
+ if (names.length === 0) {
+ return url;
+ }
+ return url + separator + names.map((name) => {
+ if (name === "q") {
+ return "q=" + parameters.q.split("+").map(encodeURIComponent).join("+");
}
- _isCmdFile() {
- const upperToolPath = this.toolPath.toUpperCase();
- return (this._endsWith(upperToolPath, '.CMD') ||
- this._endsWith(upperToolPath, '.BAT'));
+ return `${name}=${encodeURIComponent(parameters[name])}`;
+ }).join("&");
+}
+
+// pkg/dist-src/util/extract-url-variable-names.js
+var urlVariableRegex = /\{[^}]+\}/g;
+function removeNonChars(variableName) {
+ return variableName.replace(/^\W+|\W+$/g, "").split(/,/);
+}
+function extractUrlVariableNames(url) {
+ const matches = url.match(urlVariableRegex);
+ if (!matches) {
+ return [];
+ }
+ return matches.map(removeNonChars).reduce((a, b) => a.concat(b), []);
+}
+
+// pkg/dist-src/util/omit.js
+function omit(object, keysToOmit) {
+ return Object.keys(object).filter((option) => !keysToOmit.includes(option)).reduce((obj, key) => {
+ obj[key] = object[key];
+ return obj;
+ }, {});
+}
+
+// pkg/dist-src/util/url-template.js
+function encodeReserved(str) {
+ return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) {
+ if (!/%[0-9A-Fa-f]/.test(part)) {
+ part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]");
}
- _windowsQuoteCmdArg(arg) {
- // for .exe, apply the normal quoting rules that libuv applies
- if (!this._isCmdFile()) {
- return this._uvQuoteCmdArg(arg);
- }
- // otherwise apply quoting rules specific to the cmd.exe command line parser.
- // the libuv rules are generic and are not designed specifically for cmd.exe
- // command line parser.
- //
- // for a detailed description of the cmd.exe command line parser, refer to
- // http://stackoverflow.com/questions/4094699/how-does-the-windows-command-interpreter-cmd-exe-parse-scripts/7970912#7970912
- // need quotes for empty arg
- if (!arg) {
- return '""';
- }
- // determine whether the arg needs to be quoted
- const cmdSpecialChars = [
- ' ',
- '\t',
- '&',
- '(',
- ')',
- '[',
- ']',
- '{',
- '}',
- '^',
- '=',
- ';',
- '!',
- "'",
- '+',
- ',',
- '`',
- '~',
- '|',
- '<',
- '>',
- '"'
- ];
- let needsQuotes = false;
- for (const char of arg) {
- if (cmdSpecialChars.some(x => x === char)) {
- needsQuotes = true;
- break;
+ return part;
+ }).join("");
+}
+function encodeUnreserved(str) {
+ return encodeURIComponent(str).replace(/[!'()*]/g, function(c) {
+ return "%" + c.charCodeAt(0).toString(16).toUpperCase();
+ });
+}
+function encodeValue(operator, value, key) {
+ value = operator === "+" || operator === "#" ? encodeReserved(value) : encodeUnreserved(value);
+ if (key) {
+ return encodeUnreserved(key) + "=" + value;
+ } else {
+ return value;
+ }
+}
+function isDefined(value) {
+ return value !== void 0 && value !== null;
+}
+function isKeyOperator(operator) {
+ return operator === ";" || operator === "&" || operator === "?";
+}
+function getValues(context, operator, key, modifier) {
+ var value = context[key], result = [];
+ if (isDefined(value) && value !== "") {
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
+ value = value.toString();
+ if (modifier && modifier !== "*") {
+ value = value.substring(0, parseInt(modifier, 10));
+ }
+ result.push(
+ encodeValue(operator, value, isKeyOperator(operator) ? key : "")
+ );
+ } else {
+ if (modifier === "*") {
+ if (Array.isArray(value)) {
+ value.filter(isDefined).forEach(function(value2) {
+ result.push(
+ encodeValue(operator, value2, isKeyOperator(operator) ? key : "")
+ );
+ });
+ } else {
+ Object.keys(value).forEach(function(k) {
+ if (isDefined(value[k])) {
+ result.push(encodeValue(operator, value[k], k));
}
+ });
}
- // short-circuit if quotes not needed
- if (!needsQuotes) {
- return arg;
- }
- // the following quoting rules are very similar to the rules that by libuv applies.
- //
- // 1) wrap the string in quotes
- //
- // 2) double-up quotes - i.e. " => ""
- //
- // this is different from the libuv quoting rules. libuv replaces " with \", which unfortunately
- // doesn't work well with a cmd.exe command line.
- //
- // note, replacing " with "" also works well if the arg is passed to a downstream .NET console app.
- // for example, the command line:
- // foo.exe "myarg:""my val"""
- // is parsed by a .NET console app into an arg array:
- // [ "myarg:\"my val\"" ]
- // which is the same end result when applying libuv quoting rules. although the actual
- // command line from libuv quoting rules would look like:
- // foo.exe "myarg:\"my val\""
- //
- // 3) double-up slashes that precede a quote,
- // e.g. hello \world => "hello \world"
- // hello\"world => "hello\\""world"
- // hello\\"world => "hello\\\\""world"
- // hello world\ => "hello world\\"
- //
- // technically this is not required for a cmd.exe command line, or the batch argument parser.
- // the reasons for including this as a .cmd quoting rule are:
- //
- // a) this is optimized for the scenario where the argument is passed from the .cmd file to an
- // external program. many programs (e.g. .NET console apps) rely on the slash-doubling rule.
- //
- // b) it's what we've been doing previously (by deferring to node default behavior) and we
- // haven't heard any complaints about that aspect.
- //
- // note, a weakness of the quoting rules chosen here, is that % is not escaped. in fact, % cannot be
- // escaped when used on the command line directly - even though within a .cmd file % can be escaped
- // by using %%.
- //
- // the saving grace is, on the command line, %var% is left as-is if var is not defined. this contrasts
- // the line parsing rules within a .cmd file, where if var is not defined it is replaced with nothing.
- //
- // one option that was explored was replacing % with ^% - i.e. %var% => ^%var^%. this hack would
- // often work, since it is unlikely that var^ would exist, and the ^ character is removed when the
- // variable is used. the problem, however, is that ^ is not removed when %* is used to pass the args
- // to an external program.
- //
- // an unexplored potential solution for the % escaping problem, is to create a wrapper .cmd file.
- // % can be escaped within a .cmd file.
- let reverse = '"';
- let quoteHit = true;
- for (let i = arg.length; i > 0; i--) {
- // walk the string in reverse
- reverse += arg[i - 1];
- if (quoteHit && arg[i - 1] === '\\') {
- reverse += '\\'; // double the slash
- }
- else if (arg[i - 1] === '"') {
- quoteHit = true;
- reverse += '"'; // double the quote
- }
- else {
- quoteHit = false;
+ } else {
+ const tmp = [];
+ if (Array.isArray(value)) {
+ value.filter(isDefined).forEach(function(value2) {
+ tmp.push(encodeValue(operator, value2));
+ });
+ } else {
+ Object.keys(value).forEach(function(k) {
+ if (isDefined(value[k])) {
+ tmp.push(encodeUnreserved(k));
+ tmp.push(encodeValue(operator, value[k].toString()));
}
+ });
}
- reverse += '"';
- return reverse
- .split('')
- .reverse()
- .join('');
- }
- _uvQuoteCmdArg(arg) {
- // Tool runner wraps child_process.spawn() and needs to apply the same quoting as
- // Node in certain cases where the undocumented spawn option windowsVerbatimArguments
- // is used.
- //
- // Since this function is a port of quote_cmd_arg from Node 4.x (technically, lib UV,
- // see https://github.com/nodejs/node/blob/v4.x/deps/uv/src/win/process.c for details),
- // pasting copyright notice from Node within this function:
- //
- // Copyright Joyent, Inc. and other Node contributors. All rights reserved.
- //
- // 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.
- if (!arg) {
- // Need double quotation for empty argument
- return '""';
- }
- if (!arg.includes(' ') && !arg.includes('\t') && !arg.includes('"')) {
- // No quotation needed
- return arg;
- }
- if (!arg.includes('"') && !arg.includes('\\')) {
- // No embedded double quotes or backslashes, so I can just wrap
- // quote marks around the whole thing.
- return `"${arg}"`;
- }
- // Expected input/output:
- // input : hello"world
- // output: "hello\"world"
- // input : hello""world
- // output: "hello\"\"world"
- // input : hello\world
- // output: hello\world
- // input : hello\\world
- // output: hello\\world
- // input : hello\"world
- // output: "hello\\\"world"
- // input : hello\\"world
- // output: "hello\\\\\"world"
- // input : hello world\
- // output: "hello world\\" - note the comment in libuv actually reads "hello world\"
- // but it appears the comment is wrong, it should be "hello world\\"
- let reverse = '"';
- let quoteHit = true;
- for (let i = arg.length; i > 0; i--) {
- // walk the string in reverse
- reverse += arg[i - 1];
- if (quoteHit && arg[i - 1] === '\\') {
- reverse += '\\';
- }
- else if (arg[i - 1] === '"') {
- quoteHit = true;
- reverse += '\\';
- }
- else {
- quoteHit = false;
- }
+ if (isKeyOperator(operator)) {
+ result.push(encodeUnreserved(key) + "=" + tmp.join(","));
+ } else if (tmp.length !== 0) {
+ result.push(tmp.join(","));
}
- reverse += '"';
- return reverse
- .split('')
- .reverse()
- .join('');
+ }
}
- _cloneExecOptions(options) {
- options = options || {};
- const result = {
- cwd: options.cwd || process.cwd(),
- env: options.env || process.env,
- silent: options.silent || false,
- windowsVerbatimArguments: options.windowsVerbatimArguments || false,
- failOnStdErr: options.failOnStdErr || false,
- ignoreReturnCode: options.ignoreReturnCode || false,
- delay: options.delay || 10000
- };
- result.outStream = options.outStream || process.stdout;
- result.errStream = options.errStream || process.stderr;
- return result;
+ } else {
+ if (operator === ";") {
+ if (isDefined(value)) {
+ result.push(encodeUnreserved(key));
+ }
+ } else if (value === "" && (operator === "&" || operator === "?")) {
+ result.push(encodeUnreserved(key) + "=");
+ } else if (value === "") {
+ result.push("");
}
- _getSpawnOptions(options, toolPath) {
- options = options || {};
- const result = {};
- result.cwd = options.cwd;
- result.env = options.env;
- result['windowsVerbatimArguments'] =
- options.windowsVerbatimArguments || this._isCmdFile();
- if (options.windowsVerbatimArguments) {
- result.argv0 = `"${toolPath}"`;
+ }
+ return result;
+}
+function parseUrl(template) {
+ return {
+ expand: expand.bind(null, template)
+ };
+}
+function expand(template, context) {
+ var operators = ["+", "#", ".", "/", ";", "?", "&"];
+ return template.replace(
+ /\{([^\{\}]+)\}|([^\{\}]+)/g,
+ function(_, expression, literal) {
+ if (expression) {
+ let operator = "";
+ const values = [];
+ if (operators.indexOf(expression.charAt(0)) !== -1) {
+ operator = expression.charAt(0);
+ expression = expression.substr(1);
}
- return result;
- }
- /**
- * Exec a tool.
- * Output will be streamed to the live console.
- * Returns promise with return code
- *
- * @param tool path to tool to exec
- * @param options optional exec options. See ExecOptions
- * @returns number
- */
- exec() {
- return __awaiter(this, void 0, void 0, function* () {
- // root the tool path if it is unrooted and contains relative pathing
- if (!ioUtil.isRooted(this.toolPath) &&
- (this.toolPath.includes('/') ||
- (IS_WINDOWS && this.toolPath.includes('\\')))) {
- // prefer options.cwd if it is specified, however options.cwd may also need to be rooted
- this.toolPath = path.resolve(process.cwd(), this.options.cwd || process.cwd(), this.toolPath);
- }
- // if the tool is only a file name, then resolve it from the PATH
- // otherwise verify it exists (add extension on Windows if necessary)
- this.toolPath = yield io.which(this.toolPath, true);
- return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
- this._debug(`exec tool: ${this.toolPath}`);
- this._debug('arguments:');
- for (const arg of this.args) {
- this._debug(` ${arg}`);
- }
- const optionsNonNull = this._cloneExecOptions(this.options);
- if (!optionsNonNull.silent && optionsNonNull.outStream) {
- optionsNonNull.outStream.write(this._getCommandString(optionsNonNull) + os.EOL);
- }
- const state = new ExecState(optionsNonNull, this.toolPath);
- state.on('debug', (message) => {
- this._debug(message);
- });
- if (this.options.cwd && !(yield ioUtil.exists(this.options.cwd))) {
- return reject(new Error(`The cwd: ${this.options.cwd} does not exist!`));
- }
- const fileName = this._getSpawnFileName();
- const cp = child.spawn(fileName, this._getSpawnArgs(optionsNonNull), this._getSpawnOptions(this.options, fileName));
- let stdbuffer = '';
- if (cp.stdout) {
- cp.stdout.on('data', (data) => {
- if (this.options.listeners && this.options.listeners.stdout) {
- this.options.listeners.stdout(data);
- }
- if (!optionsNonNull.silent && optionsNonNull.outStream) {
- optionsNonNull.outStream.write(data);
- }
- stdbuffer = this._processLineBuffer(data, stdbuffer, (line) => {
- if (this.options.listeners && this.options.listeners.stdline) {
- this.options.listeners.stdline(line);
- }
- });
- });
- }
- let errbuffer = '';
- if (cp.stderr) {
- cp.stderr.on('data', (data) => {
- state.processStderr = true;
- if (this.options.listeners && this.options.listeners.stderr) {
- this.options.listeners.stderr(data);
- }
- if (!optionsNonNull.silent &&
- optionsNonNull.errStream &&
- optionsNonNull.outStream) {
- const s = optionsNonNull.failOnStdErr
- ? optionsNonNull.errStream
- : optionsNonNull.outStream;
- s.write(data);
- }
- errbuffer = this._processLineBuffer(data, errbuffer, (line) => {
- if (this.options.listeners && this.options.listeners.errline) {
- this.options.listeners.errline(line);
- }
- });
- });
- }
- cp.on('error', (err) => {
- state.processError = err.message;
- state.processExited = true;
- state.processClosed = true;
- state.CheckComplete();
- });
- cp.on('exit', (code) => {
- state.processExitCode = code;
- state.processExited = true;
- this._debug(`Exit code ${code} received from tool '${this.toolPath}'`);
- state.CheckComplete();
- });
- cp.on('close', (code) => {
- state.processExitCode = code;
- state.processExited = true;
- state.processClosed = true;
- this._debug(`STDIO streams have closed for tool '${this.toolPath}'`);
- state.CheckComplete();
- });
- state.on('done', (error, exitCode) => {
- if (stdbuffer.length > 0) {
- this.emit('stdline', stdbuffer);
- }
- if (errbuffer.length > 0) {
- this.emit('errline', errbuffer);
- }
- cp.removeAllListeners();
- if (error) {
- reject(error);
- }
- else {
- resolve(exitCode);
- }
- });
- if (this.options.input) {
- if (!cp.stdin) {
- throw new Error('child process missing stdin');
- }
- cp.stdin.end(this.options.input);
- }
- }));
+ expression.split(/,/g).forEach(function(variable) {
+ var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable);
+ values.push(getValues(context, operator, tmp[1], tmp[2] || tmp[3]));
});
- }
-}
-exports.ToolRunner = ToolRunner;
-/**
- * Convert an arg string to an array of args. Handles escaping
- *
- * @param argString string of arguments
- * @returns string[] array of arguments
- */
-function argStringToArray(argString) {
- const args = [];
- let inQuotes = false;
- let escaped = false;
- let arg = '';
- function append(c) {
- // we only escape double quotes.
- if (escaped && c !== '"') {
- arg += '\\';
+ if (operator && operator !== "+") {
+ var separator = ",";
+ if (operator === "?") {
+ separator = "&";
+ } else if (operator !== "#") {
+ separator = operator;
+ }
+ return (values.length !== 0 ? operator : "") + values.join(separator);
+ } else {
+ return values.join(",");
}
- arg += c;
- escaped = false;
- }
- for (let i = 0; i < argString.length; i++) {
- const c = argString.charAt(i);
- if (c === '"') {
- if (!escaped) {
- inQuotes = !inQuotes;
- }
- else {
- append(c);
- }
- continue;
- }
- if (c === '\\' && escaped) {
- append(c);
- continue;
- }
- if (c === '\\' && inQuotes) {
- escaped = true;
- continue;
- }
- if (c === ' ' && !inQuotes) {
- if (arg.length > 0) {
- args.push(arg);
- arg = '';
- }
- continue;
- }
- append(c);
- }
- if (arg.length > 0) {
- args.push(arg.trim());
- }
- return args;
-}
-exports.argStringToArray = argStringToArray;
-class ExecState extends events.EventEmitter {
- constructor(options, toolPath) {
- super();
- this.processClosed = false; // tracks whether the process has exited and stdio is closed
- this.processError = '';
- this.processExitCode = 0;
- this.processExited = false; // tracks whether the process has exited
- this.processStderr = false; // tracks whether stderr was written to
- this.delay = 10000; // 10 seconds
- this.done = false;
- this.timeout = null;
- if (!toolPath) {
- throw new Error('toolPath must not be empty');
- }
- this.options = options;
- this.toolPath = toolPath;
- if (options.delay) {
- this.delay = options.delay;
- }
- }
- CheckComplete() {
- if (this.done) {
- return;
- }
- if (this.processClosed) {
- this._setResult();
- }
- else if (this.processExited) {
- this.timeout = timers_1.setTimeout(ExecState.HandleTimeout, this.delay, this);
- }
- }
- _debug(message) {
- this.emit('debug', message);
- }
- _setResult() {
- // determine whether there is an error
- let error;
- if (this.processExited) {
- if (this.processError) {
- error = new Error(`There was an error when attempting to execute the process '${this.toolPath}'. This may indicate the process failed to start. Error: ${this.processError}`);
- }
- else if (this.processExitCode !== 0 && !this.options.ignoreReturnCode) {
- error = new Error(`The process '${this.toolPath}' failed with exit code ${this.processExitCode}`);
- }
- else if (this.processStderr && this.options.failOnStdErr) {
- error = new Error(`The process '${this.toolPath}' failed because one or more lines were written to the STDERR stream`);
- }
- }
- // clear the timeout
- if (this.timeout) {
- clearTimeout(this.timeout);
- this.timeout = null;
- }
- this.done = true;
- this.emit('done', error, this.processExitCode);
- }
- static HandleTimeout(state) {
- if (state.done) {
- return;
- }
- if (!state.processClosed && state.processExited) {
- const message = `The STDIO streams did not close within ${state.delay /
- 1000} seconds of the exit event from process '${state.toolPath}'. This may indicate a child process inherited the STDIO streams and has not yet exited.`;
- state._debug(message);
- }
- state._setResult();
- }
-}
-//# sourceMappingURL=toolrunner.js.map
-
-/***/ }),
-
-/***/ 74087:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.Context = void 0;
-const fs_1 = __nccwpck_require__(57147);
-const os_1 = __nccwpck_require__(22037);
-class Context {
- /**
- * Hydrate the context from the environment
- */
- constructor() {
- var _a, _b, _c;
- this.payload = {};
- if (process.env.GITHUB_EVENT_PATH) {
- if ((0, fs_1.existsSync)(process.env.GITHUB_EVENT_PATH)) {
- this.payload = JSON.parse((0, fs_1.readFileSync)(process.env.GITHUB_EVENT_PATH, { encoding: 'utf8' }));
- }
- else {
- const path = process.env.GITHUB_EVENT_PATH;
- process.stdout.write(`GITHUB_EVENT_PATH ${path} does not exist${os_1.EOL}`);
- }
- }
- this.eventName = process.env.GITHUB_EVENT_NAME;
- this.sha = process.env.GITHUB_SHA;
- this.ref = process.env.GITHUB_REF;
- this.workflow = process.env.GITHUB_WORKFLOW;
- this.action = process.env.GITHUB_ACTION;
- this.actor = process.env.GITHUB_ACTOR;
- this.job = process.env.GITHUB_JOB;
- this.runNumber = parseInt(process.env.GITHUB_RUN_NUMBER, 10);
- this.runId = parseInt(process.env.GITHUB_RUN_ID, 10);
- this.apiUrl = (_a = process.env.GITHUB_API_URL) !== null && _a !== void 0 ? _a : `https://api.github.com`;
- this.serverUrl = (_b = process.env.GITHUB_SERVER_URL) !== null && _b !== void 0 ? _b : `https://github.com`;
- this.graphqlUrl =
- (_c = process.env.GITHUB_GRAPHQL_URL) !== null && _c !== void 0 ? _c : `https://api.github.com/graphql`;
- }
- get issue() {
- const payload = this.payload;
- return Object.assign(Object.assign({}, this.repo), { number: (payload.issue || payload.pull_request || payload).number });
- }
- get repo() {
- if (process.env.GITHUB_REPOSITORY) {
- const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/');
- return { owner, repo };
- }
- if (this.payload.repository) {
- return {
- owner: this.payload.repository.owner.login,
- repo: this.payload.repository.name
- };
- }
- throw new Error("context.repo requires a GITHUB_REPOSITORY environment variable like 'owner/repo'");
- }
-}
-exports.Context = Context;
-//# sourceMappingURL=context.js.map
-
-/***/ }),
-
-/***/ 95438:
-/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
-
-"use strict";
-
-var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- var desc = Object.getOwnPropertyDescriptor(m, k);
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
- desc = { enumerable: true, get: function() { return m[k]; } };
- }
- Object.defineProperty(o, k2, desc);
-}) : (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- o[k2] = m[k];
-}));
-var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
- Object.defineProperty(o, "default", { enumerable: true, value: v });
-}) : function(o, v) {
- o["default"] = v;
-});
-var __importStar = (this && this.__importStar) || function (mod) {
- if (mod && mod.__esModule) return mod;
- var result = {};
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
- __setModuleDefault(result, mod);
- return result;
-};
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.getOctokit = exports.context = void 0;
-const Context = __importStar(__nccwpck_require__(74087));
-const utils_1 = __nccwpck_require__(73030);
-exports.context = new Context.Context();
-/**
- * Returns a hydrated octokit ready to use for GitHub Actions
- *
- * @param token the repo PAT or GITHUB_TOKEN
- * @param options other options to set
- */
-function getOctokit(token, options, ...additionalPlugins) {
- const GitHubWithPlugins = utils_1.GitHub.plugin(...additionalPlugins);
- return new GitHubWithPlugins((0, utils_1.getOctokitOptions)(token, options));
-}
-exports.getOctokit = getOctokit;
-//# sourceMappingURL=github.js.map
-
-/***/ }),
-
-/***/ 47914:
-/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
-
-"use strict";
-
-var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- var desc = Object.getOwnPropertyDescriptor(m, k);
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
- desc = { enumerable: true, get: function() { return m[k]; } };
- }
- Object.defineProperty(o, k2, desc);
-}) : (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- o[k2] = m[k];
-}));
-var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
- Object.defineProperty(o, "default", { enumerable: true, value: v });
-}) : function(o, v) {
- o["default"] = v;
-});
-var __importStar = (this && this.__importStar) || function (mod) {
- if (mod && mod.__esModule) return mod;
- var result = {};
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
- __setModuleDefault(result, mod);
- return result;
-};
-var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
- return new (P || (P = Promise))(function (resolve, reject) {
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
-};
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.getApiBaseUrl = exports.getProxyFetch = exports.getProxyAgentDispatcher = exports.getProxyAgent = exports.getAuthString = void 0;
-const httpClient = __importStar(__nccwpck_require__(96255));
-const undici_1 = __nccwpck_require__(41773);
-function getAuthString(token, options) {
- if (!token && !options.auth) {
- throw new Error('Parameter token or opts.auth is required');
- }
- else if (token && options.auth) {
- throw new Error('Parameters token and opts.auth may not both be specified');
- }
- return typeof options.auth === 'string' ? options.auth : `token ${token}`;
-}
-exports.getAuthString = getAuthString;
-function getProxyAgent(destinationUrl) {
- const hc = new httpClient.HttpClient();
- return hc.getAgent(destinationUrl);
-}
-exports.getProxyAgent = getProxyAgent;
-function getProxyAgentDispatcher(destinationUrl) {
- const hc = new httpClient.HttpClient();
- return hc.getAgentDispatcher(destinationUrl);
-}
-exports.getProxyAgentDispatcher = getProxyAgentDispatcher;
-function getProxyFetch(destinationUrl) {
- const httpDispatcher = getProxyAgentDispatcher(destinationUrl);
- const proxyFetch = (url, opts) => __awaiter(this, void 0, void 0, function* () {
- return (0, undici_1.fetch)(url, Object.assign(Object.assign({}, opts), { dispatcher: httpDispatcher }));
- });
- return proxyFetch;
-}
-exports.getProxyFetch = getProxyFetch;
-function getApiBaseUrl() {
- return process.env['GITHUB_API_URL'] || 'https://api.github.com';
-}
-exports.getApiBaseUrl = getApiBaseUrl;
-//# sourceMappingURL=utils.js.map
-
-/***/ }),
-
-/***/ 73030:
-/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
-
-"use strict";
-
-var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- var desc = Object.getOwnPropertyDescriptor(m, k);
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
- desc = { enumerable: true, get: function() { return m[k]; } };
- }
- Object.defineProperty(o, k2, desc);
-}) : (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- o[k2] = m[k];
-}));
-var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
- Object.defineProperty(o, "default", { enumerable: true, value: v });
-}) : function(o, v) {
- o["default"] = v;
-});
-var __importStar = (this && this.__importStar) || function (mod) {
- if (mod && mod.__esModule) return mod;
- var result = {};
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
- __setModuleDefault(result, mod);
- return result;
-};
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.getOctokitOptions = exports.GitHub = exports.defaults = exports.context = void 0;
-const Context = __importStar(__nccwpck_require__(74087));
-const Utils = __importStar(__nccwpck_require__(47914));
-// octokit + plugins
-const core_1 = __nccwpck_require__(18525);
-const plugin_rest_endpoint_methods_1 = __nccwpck_require__(94045);
-const plugin_paginate_rest_1 = __nccwpck_require__(48945);
-exports.context = new Context.Context();
-const baseUrl = Utils.getApiBaseUrl();
-exports.defaults = {
- baseUrl,
- request: {
- agent: Utils.getProxyAgent(baseUrl),
- fetch: Utils.getProxyFetch(baseUrl)
- }
-};
-exports.GitHub = core_1.Octokit.plugin(plugin_rest_endpoint_methods_1.restEndpointMethods, plugin_paginate_rest_1.paginateRest).defaults(exports.defaults);
-/**
- * Convience function to correctly format Octokit Options to pass into the constructor.
- *
- * @param token the repo PAT or GITHUB_TOKEN
- * @param options other options to set
- */
-function getOctokitOptions(token, options) {
- const opts = Object.assign({}, options || {}); // Shallow clone - don't mutate the object provided by the caller
- // Auth
- const auth = Utils.getAuthString(token, opts);
- if (auth) {
- opts.auth = auth;
- }
- return opts;
-}
-exports.getOctokitOptions = getOctokitOptions;
-//# sourceMappingURL=utils.js.map
-
-/***/ }),
-
-/***/ 40673:
-/***/ ((module) => {
-
-"use strict";
-
-var __defProp = Object.defineProperty;
-var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
-var __getOwnPropNames = Object.getOwnPropertyNames;
-var __hasOwnProp = Object.prototype.hasOwnProperty;
-var __export = (target, all) => {
- for (var name in all)
- __defProp(target, name, { get: all[name], enumerable: true });
-};
-var __copyProps = (to, from, except, desc) => {
- if (from && typeof from === "object" || typeof from === "function") {
- for (let key of __getOwnPropNames(from))
- if (!__hasOwnProp.call(to, key) && key !== except)
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
- }
- return to;
-};
-var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
-
-// pkg/dist-src/index.js
-var dist_src_exports = {};
-__export(dist_src_exports, {
- createTokenAuth: () => createTokenAuth
-});
-module.exports = __toCommonJS(dist_src_exports);
-
-// pkg/dist-src/auth.js
-var REGEX_IS_INSTALLATION_LEGACY = /^v1\./;
-var REGEX_IS_INSTALLATION = /^ghs_/;
-var REGEX_IS_USER_TO_SERVER = /^ghu_/;
-async function auth(token) {
- const isApp = token.split(/\./).length === 3;
- const isInstallation = REGEX_IS_INSTALLATION_LEGACY.test(token) || REGEX_IS_INSTALLATION.test(token);
- const isUserToServer = REGEX_IS_USER_TO_SERVER.test(token);
- const tokenType = isApp ? "app" : isInstallation ? "installation" : isUserToServer ? "user-to-server" : "oauth";
- return {
- type: "token",
- token,
- tokenType
- };
-}
-
-// pkg/dist-src/with-authorization-prefix.js
-function withAuthorizationPrefix(token) {
- if (token.split(/\./).length === 3) {
- return `bearer ${token}`;
- }
- return `token ${token}`;
-}
-
-// pkg/dist-src/hook.js
-async function hook(token, request, route, parameters) {
- const endpoint = request.endpoint.merge(
- route,
- parameters
- );
- endpoint.headers.authorization = withAuthorizationPrefix(token);
- return request(endpoint);
-}
-
-// pkg/dist-src/index.js
-var createTokenAuth = function createTokenAuth2(token) {
- if (!token) {
- throw new Error("[@octokit/auth-token] No token passed to createTokenAuth");
- }
- if (typeof token !== "string") {
- throw new Error(
- "[@octokit/auth-token] Token passed to createTokenAuth is not a string"
- );
- }
- token = token.replace(/^(token|bearer) +/i, "");
- return Object.assign(auth.bind(null, token), {
- hook: hook.bind(null, token)
- });
-};
-// Annotate the CommonJS export names for ESM import in node:
-0 && (0);
-
-
-/***/ }),
-
-/***/ 18525:
-/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
-
-"use strict";
-
-var __defProp = Object.defineProperty;
-var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
-var __getOwnPropNames = Object.getOwnPropertyNames;
-var __hasOwnProp = Object.prototype.hasOwnProperty;
-var __export = (target, all) => {
- for (var name in all)
- __defProp(target, name, { get: all[name], enumerable: true });
-};
-var __copyProps = (to, from, except, desc) => {
- if (from && typeof from === "object" || typeof from === "function") {
- for (let key of __getOwnPropNames(from))
- if (!__hasOwnProp.call(to, key) && key !== except)
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
- }
- return to;
-};
-var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
-
-// pkg/dist-src/index.js
-var dist_src_exports = {};
-__export(dist_src_exports, {
- Octokit: () => Octokit
-});
-module.exports = __toCommonJS(dist_src_exports);
-var import_universal_user_agent = __nccwpck_require__(45030);
-var import_before_after_hook = __nccwpck_require__(83682);
-var import_request = __nccwpck_require__(89353);
-var import_graphql = __nccwpck_require__(86422);
-var import_auth_token = __nccwpck_require__(40673);
-
-// pkg/dist-src/version.js
-var VERSION = "5.0.1";
-
-// pkg/dist-src/index.js
-var Octokit = class {
- static {
- this.VERSION = VERSION;
- }
- static defaults(defaults) {
- const OctokitWithDefaults = class extends this {
- constructor(...args) {
- const options = args[0] || {};
- if (typeof defaults === "function") {
- super(defaults(options));
- return;
- }
- super(
- Object.assign(
- {},
- defaults,
- options,
- options.userAgent && defaults.userAgent ? {
- userAgent: `${options.userAgent} ${defaults.userAgent}`
- } : null
- )
- );
- }
- };
- return OctokitWithDefaults;
- }
- static {
- this.plugins = [];
- }
- /**
- * Attach a plugin (or many) to your Octokit instance.
- *
- * @example
- * const API = Octokit.plugin(plugin1, plugin2, plugin3, ...)
- */
- static plugin(...newPlugins) {
- const currentPlugins = this.plugins;
- const NewOctokit = class extends this {
- static {
- this.plugins = currentPlugins.concat(
- newPlugins.filter((plugin) => !currentPlugins.includes(plugin))
- );
- }
- };
- return NewOctokit;
- }
- constructor(options = {}) {
- const hook = new import_before_after_hook.Collection();
- const requestDefaults = {
- baseUrl: import_request.request.endpoint.DEFAULTS.baseUrl,
- headers: {},
- request: Object.assign({}, options.request, {
- // @ts-ignore internal usage only, no need to type
- hook: hook.bind(null, "request")
- }),
- mediaType: {
- previews: [],
- format: ""
- }
- };
- requestDefaults.headers["user-agent"] = [
- options.userAgent,
- `octokit-core.js/${VERSION} ${(0, import_universal_user_agent.getUserAgent)()}`
- ].filter(Boolean).join(" ");
- if (options.baseUrl) {
- requestDefaults.baseUrl = options.baseUrl;
- }
- if (options.previews) {
- requestDefaults.mediaType.previews = options.previews;
- }
- if (options.timeZone) {
- requestDefaults.headers["time-zone"] = options.timeZone;
- }
- this.request = import_request.request.defaults(requestDefaults);
- this.graphql = (0, import_graphql.withCustomRequest)(this.request).defaults(requestDefaults);
- this.log = Object.assign(
- {
- debug: () => {
- },
- info: () => {
- },
- warn: console.warn.bind(console),
- error: console.error.bind(console)
- },
- options.log
- );
- this.hook = hook;
- if (!options.authStrategy) {
- if (!options.auth) {
- this.auth = async () => ({
- type: "unauthenticated"
- });
- } else {
- const auth = (0, import_auth_token.createTokenAuth)(options.auth);
- hook.wrap("request", auth.hook);
- this.auth = auth;
- }
- } else {
- const { authStrategy, ...otherOptions } = options;
- const auth = authStrategy(
- Object.assign(
- {
- request: this.request,
- log: this.log,
- // we pass the current octokit instance as well as its constructor options
- // to allow for authentication strategies that return a new octokit instance
- // that shares the same internal state as the current one. The original
- // requirement for this was the "event-octokit" authentication strategy
- // of https://github.com/probot/octokit-auth-probot.
- octokit: this,
- octokitOptions: otherOptions
- },
- options.auth
- )
- );
- hook.wrap("request", auth.hook);
- this.auth = auth;
- }
- const classConstructor = this.constructor;
- classConstructor.plugins.forEach((plugin) => {
- Object.assign(this, plugin(this, options));
- });
- }
-};
-// Annotate the CommonJS export names for ESM import in node:
-0 && (0);
-
-
-/***/ }),
-
-/***/ 38713:
-/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
-
-"use strict";
-
-var __defProp = Object.defineProperty;
-var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
-var __getOwnPropNames = Object.getOwnPropertyNames;
-var __hasOwnProp = Object.prototype.hasOwnProperty;
-var __export = (target, all) => {
- for (var name in all)
- __defProp(target, name, { get: all[name], enumerable: true });
-};
-var __copyProps = (to, from, except, desc) => {
- if (from && typeof from === "object" || typeof from === "function") {
- for (let key of __getOwnPropNames(from))
- if (!__hasOwnProp.call(to, key) && key !== except)
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
- }
- return to;
-};
-var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
-
-// pkg/dist-src/index.js
-var dist_src_exports = {};
-__export(dist_src_exports, {
- endpoint: () => endpoint
-});
-module.exports = __toCommonJS(dist_src_exports);
-
-// pkg/dist-src/defaults.js
-var import_universal_user_agent = __nccwpck_require__(45030);
-
-// pkg/dist-src/version.js
-var VERSION = "9.0.1";
-
-// pkg/dist-src/defaults.js
-var userAgent = `octokit-endpoint.js/${VERSION} ${(0, import_universal_user_agent.getUserAgent)()}`;
-var DEFAULTS = {
- method: "GET",
- baseUrl: "https://api.github.com",
- headers: {
- accept: "application/vnd.github.v3+json",
- "user-agent": userAgent
- },
- mediaType: {
- format: ""
- }
-};
-
-// pkg/dist-src/util/lowercase-keys.js
-function lowercaseKeys(object) {
- if (!object) {
- return {};
- }
- return Object.keys(object).reduce((newObj, key) => {
- newObj[key.toLowerCase()] = object[key];
- return newObj;
- }, {});
-}
-
-// pkg/dist-src/util/merge-deep.js
-var import_is_plain_object = __nccwpck_require__(63287);
-function mergeDeep(defaults, options) {
- const result = Object.assign({}, defaults);
- Object.keys(options).forEach((key) => {
- if ((0, import_is_plain_object.isPlainObject)(options[key])) {
- if (!(key in defaults))
- Object.assign(result, { [key]: options[key] });
- else
- result[key] = mergeDeep(defaults[key], options[key]);
- } else {
- Object.assign(result, { [key]: options[key] });
- }
- });
- return result;
-}
-
-// pkg/dist-src/util/remove-undefined-properties.js
-function removeUndefinedProperties(obj) {
- for (const key in obj) {
- if (obj[key] === void 0) {
- delete obj[key];
- }
- }
- return obj;
-}
-
-// pkg/dist-src/merge.js
-function merge(defaults, route, options) {
- if (typeof route === "string") {
- let [method, url] = route.split(" ");
- options = Object.assign(url ? { method, url } : { url: method }, options);
- } else {
- options = Object.assign({}, route);
- }
- options.headers = lowercaseKeys(options.headers);
- removeUndefinedProperties(options);
- removeUndefinedProperties(options.headers);
- const mergedOptions = mergeDeep(defaults || {}, options);
- if (options.url === "/graphql") {
- if (defaults && defaults.mediaType.previews?.length) {
- mergedOptions.mediaType.previews = defaults.mediaType.previews.filter(
- (preview) => !mergedOptions.mediaType.previews.includes(preview)
- ).concat(mergedOptions.mediaType.previews);
- }
- mergedOptions.mediaType.previews = (mergedOptions.mediaType.previews || []).map((preview) => preview.replace(/-preview/, ""));
- }
- return mergedOptions;
-}
-
-// pkg/dist-src/util/add-query-parameters.js
-function addQueryParameters(url, parameters) {
- const separator = /\?/.test(url) ? "&" : "?";
- const names = Object.keys(parameters);
- if (names.length === 0) {
- return url;
- }
- return url + separator + names.map((name) => {
- if (name === "q") {
- return "q=" + parameters.q.split("+").map(encodeURIComponent).join("+");
- }
- return `${name}=${encodeURIComponent(parameters[name])}`;
- }).join("&");
-}
-
-// pkg/dist-src/util/extract-url-variable-names.js
-var urlVariableRegex = /\{[^}]+\}/g;
-function removeNonChars(variableName) {
- return variableName.replace(/^\W+|\W+$/g, "").split(/,/);
-}
-function extractUrlVariableNames(url) {
- const matches = url.match(urlVariableRegex);
- if (!matches) {
- return [];
- }
- return matches.map(removeNonChars).reduce((a, b) => a.concat(b), []);
-}
-
-// pkg/dist-src/util/omit.js
-function omit(object, keysToOmit) {
- return Object.keys(object).filter((option) => !keysToOmit.includes(option)).reduce((obj, key) => {
- obj[key] = object[key];
- return obj;
- }, {});
-}
-
-// pkg/dist-src/util/url-template.js
-function encodeReserved(str) {
- return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) {
- if (!/%[0-9A-Fa-f]/.test(part)) {
- part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]");
- }
- return part;
- }).join("");
-}
-function encodeUnreserved(str) {
- return encodeURIComponent(str).replace(/[!'()*]/g, function(c) {
- return "%" + c.charCodeAt(0).toString(16).toUpperCase();
- });
-}
-function encodeValue(operator, value, key) {
- value = operator === "+" || operator === "#" ? encodeReserved(value) : encodeUnreserved(value);
- if (key) {
- return encodeUnreserved(key) + "=" + value;
- } else {
- return value;
- }
-}
-function isDefined(value) {
- return value !== void 0 && value !== null;
-}
-function isKeyOperator(operator) {
- return operator === ";" || operator === "&" || operator === "?";
-}
-function getValues(context, operator, key, modifier) {
- var value = context[key], result = [];
- if (isDefined(value) && value !== "") {
- if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
- value = value.toString();
- if (modifier && modifier !== "*") {
- value = value.substring(0, parseInt(modifier, 10));
- }
- result.push(
- encodeValue(operator, value, isKeyOperator(operator) ? key : "")
- );
- } else {
- if (modifier === "*") {
- if (Array.isArray(value)) {
- value.filter(isDefined).forEach(function(value2) {
- result.push(
- encodeValue(operator, value2, isKeyOperator(operator) ? key : "")
- );
- });
- } else {
- Object.keys(value).forEach(function(k) {
- if (isDefined(value[k])) {
- result.push(encodeValue(operator, value[k], k));
- }
- });
- }
- } else {
- const tmp = [];
- if (Array.isArray(value)) {
- value.filter(isDefined).forEach(function(value2) {
- tmp.push(encodeValue(operator, value2));
- });
- } else {
- Object.keys(value).forEach(function(k) {
- if (isDefined(value[k])) {
- tmp.push(encodeUnreserved(k));
- tmp.push(encodeValue(operator, value[k].toString()));
- }
- });
- }
- if (isKeyOperator(operator)) {
- result.push(encodeUnreserved(key) + "=" + tmp.join(","));
- } else if (tmp.length !== 0) {
- result.push(tmp.join(","));
- }
- }
- }
- } else {
- if (operator === ";") {
- if (isDefined(value)) {
- result.push(encodeUnreserved(key));
- }
- } else if (value === "" && (operator === "&" || operator === "?")) {
- result.push(encodeUnreserved(key) + "=");
- } else if (value === "") {
- result.push("");
- }
- }
- return result;
-}
-function parseUrl(template) {
- return {
- expand: expand.bind(null, template)
- };
-}
-function expand(template, context) {
- var operators = ["+", "#", ".", "/", ";", "?", "&"];
- return template.replace(
- /\{([^\{\}]+)\}|([^\{\}]+)/g,
- function(_, expression, literal) {
- if (expression) {
- let operator = "";
- const values = [];
- if (operators.indexOf(expression.charAt(0)) !== -1) {
- operator = expression.charAt(0);
- expression = expression.substr(1);
- }
- expression.split(/,/g).forEach(function(variable) {
- var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable);
- values.push(getValues(context, operator, tmp[1], tmp[2] || tmp[3]));
- });
- if (operator && operator !== "+") {
- var separator = ",";
- if (operator === "?") {
- separator = "&";
- } else if (operator !== "#") {
- separator = operator;
- }
- return (values.length !== 0 ? operator : "") + values.join(separator);
- } else {
- return values.join(",");
- }
- } else {
- return encodeReserved(literal);
- }
+ } else {
+ return encodeReserved(literal);
+ }
}
);
}
@@ -44257,781 +45459,6 @@ exports.newPipeline = newPipeline;
//# sourceMappingURL=index.js.map
-/***/ }),
-
-/***/ 14175:
-/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
-
-/*
-
-The MIT License (MIT)
-
-Original Library
- - Copyright (c) Marak Squires
-
-Additional functionality
- - Copyright (c) Sindre Sorhus (sindresorhus.com)
-
-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.
-
-*/
-
-var colors = {};
-module['exports'] = colors;
-
-colors.themes = {};
-
-var util = __nccwpck_require__(73837);
-var ansiStyles = colors.styles = __nccwpck_require__(95691);
-var defineProps = Object.defineProperties;
-var newLineRegex = new RegExp(/[\r\n]+/g);
-
-colors.supportsColor = (__nccwpck_require__(21959).supportsColor);
-
-if (typeof colors.enabled === 'undefined') {
- colors.enabled = colors.supportsColor() !== false;
-}
-
-colors.enable = function() {
- colors.enabled = true;
-};
-
-colors.disable = function() {
- colors.enabled = false;
-};
-
-colors.stripColors = colors.strip = function(str) {
- return ('' + str).replace(/\x1B\[\d+m/g, '');
-};
-
-// eslint-disable-next-line no-unused-vars
-var stylize = colors.stylize = function stylize(str, style) {
- if (!colors.enabled) {
- return str+'';
- }
-
- var styleMap = ansiStyles[style];
-
- // Stylize should work for non-ANSI styles, too
- if (!styleMap && style in colors) {
- // Style maps like trap operate as functions on strings;
- // they don't have properties like open or close.
- return colors[style](str);
- }
-
- return styleMap.open + str + styleMap.close;
-};
-
-var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
-var escapeStringRegexp = function(str) {
- if (typeof str !== 'string') {
- throw new TypeError('Expected a string');
- }
- return str.replace(matchOperatorsRe, '\\$&');
-};
-
-function build(_styles) {
- var builder = function builder() {
- return applyStyle.apply(builder, arguments);
- };
- builder._styles = _styles;
- // __proto__ is used because we must return a function, but there is
- // no way to create a function with a different prototype.
- builder.__proto__ = proto;
- return builder;
-}
-
-var styles = (function() {
- var ret = {};
- ansiStyles.grey = ansiStyles.gray;
- Object.keys(ansiStyles).forEach(function(key) {
- ansiStyles[key].closeRe =
- new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g');
- ret[key] = {
- get: function() {
- return build(this._styles.concat(key));
- },
- };
- });
- return ret;
-})();
-
-var proto = defineProps(function colors() {}, styles);
-
-function applyStyle() {
- var args = Array.prototype.slice.call(arguments);
-
- var str = args.map(function(arg) {
- // Use weak equality check so we can colorize null/undefined in safe mode
- if (arg != null && arg.constructor === String) {
- return arg;
- } else {
- return util.inspect(arg);
- }
- }).join(' ');
-
- if (!colors.enabled || !str) {
- return str;
- }
-
- var newLinesPresent = str.indexOf('\n') != -1;
-
- var nestedStyles = this._styles;
-
- var i = nestedStyles.length;
- while (i--) {
- var code = ansiStyles[nestedStyles[i]];
- str = code.open + str.replace(code.closeRe, code.open) + code.close;
- if (newLinesPresent) {
- str = str.replace(newLineRegex, function(match) {
- return code.close + match + code.open;
- });
- }
- }
-
- return str;
-}
-
-colors.setTheme = function(theme) {
- if (typeof theme === 'string') {
- console.log('colors.setTheme now only accepts an object, not a string. ' +
- 'If you are trying to set a theme from a file, it is now your (the ' +
- 'caller\'s) responsibility to require the file. The old syntax ' +
- 'looked like colors.setTheme(__dirname + ' +
- '\'/../themes/generic-logging.js\'); The new syntax looks like '+
- 'colors.setTheme(require(__dirname + ' +
- '\'/../themes/generic-logging.js\'));');
- return;
- }
- for (var style in theme) {
- (function(style) {
- colors[style] = function(str) {
- if (typeof theme[style] === 'object') {
- var out = str;
- for (var i in theme[style]) {
- out = colors[theme[style][i]](out);
- }
- return out;
- }
- return colors[theme[style]](str);
- };
- })(style);
- }
-};
-
-function init() {
- var ret = {};
- Object.keys(styles).forEach(function(name) {
- ret[name] = {
- get: function() {
- return build([name]);
- },
- };
- });
- return ret;
-}
-
-var sequencer = function sequencer(map, str) {
- var exploded = str.split('');
- exploded = exploded.map(map);
- return exploded.join('');
-};
-
-// custom formatter methods
-colors.trap = __nccwpck_require__(29493);
-colors.zalgo = __nccwpck_require__(80090);
-
-// maps
-colors.maps = {};
-colors.maps.america = __nccwpck_require__(29337)(colors);
-colors.maps.zebra = __nccwpck_require__(3792)(colors);
-colors.maps.rainbow = __nccwpck_require__(19565)(colors);
-colors.maps.random = __nccwpck_require__(78212)(colors);
-
-for (var map in colors.maps) {
- (function(map) {
- colors[map] = function(str) {
- return sequencer(colors.maps[map], str);
- };
- })(map);
-}
-
-defineProps(colors, init());
-
-
-/***/ }),
-
-/***/ 29493:
-/***/ ((module) => {
-
-module['exports'] = function runTheTrap(text, options) {
- var result = '';
- text = text || 'Run the trap, drop the bass';
- text = text.split('');
- var trap = {
- a: ['\u0040', '\u0104', '\u023a', '\u0245', '\u0394', '\u039b', '\u0414'],
- b: ['\u00df', '\u0181', '\u0243', '\u026e', '\u03b2', '\u0e3f'],
- c: ['\u00a9', '\u023b', '\u03fe'],
- d: ['\u00d0', '\u018a', '\u0500', '\u0501', '\u0502', '\u0503'],
- e: ['\u00cb', '\u0115', '\u018e', '\u0258', '\u03a3', '\u03be', '\u04bc',
- '\u0a6c'],
- f: ['\u04fa'],
- g: ['\u0262'],
- h: ['\u0126', '\u0195', '\u04a2', '\u04ba', '\u04c7', '\u050a'],
- i: ['\u0f0f'],
- j: ['\u0134'],
- k: ['\u0138', '\u04a0', '\u04c3', '\u051e'],
- l: ['\u0139'],
- m: ['\u028d', '\u04cd', '\u04ce', '\u0520', '\u0521', '\u0d69'],
- n: ['\u00d1', '\u014b', '\u019d', '\u0376', '\u03a0', '\u048a'],
- o: ['\u00d8', '\u00f5', '\u00f8', '\u01fe', '\u0298', '\u047a', '\u05dd',
- '\u06dd', '\u0e4f'],
- p: ['\u01f7', '\u048e'],
- q: ['\u09cd'],
- r: ['\u00ae', '\u01a6', '\u0210', '\u024c', '\u0280', '\u042f'],
- s: ['\u00a7', '\u03de', '\u03df', '\u03e8'],
- t: ['\u0141', '\u0166', '\u0373'],
- u: ['\u01b1', '\u054d'],
- v: ['\u05d8'],
- w: ['\u0428', '\u0460', '\u047c', '\u0d70'],
- x: ['\u04b2', '\u04fe', '\u04fc', '\u04fd'],
- y: ['\u00a5', '\u04b0', '\u04cb'],
- z: ['\u01b5', '\u0240'],
- };
- text.forEach(function(c) {
- c = c.toLowerCase();
- var chars = trap[c] || [' '];
- var rand = Math.floor(Math.random() * chars.length);
- if (typeof trap[c] !== 'undefined') {
- result += trap[c][rand];
- } else {
- result += c;
- }
- });
- return result;
-};
-
-
-/***/ }),
-
-/***/ 80090:
-/***/ ((module) => {
-
-// please no
-module['exports'] = function zalgo(text, options) {
- text = text || ' he is here ';
- var soul = {
- 'up': [
- '̍', '̎', '̄', '̅',
- '̿', '̑', '̆', '̐',
- '͒', '͗', '͑', '̇',
- '̈', '̊', '͂', '̓',
- '̈', '͊', '͋', '͌',
- '̃', '̂', '̌', '͐',
- '̀', '́', '̋', '̏',
- '̒', '̓', '̔', '̽',
- '̉', 'ͣ', 'ͤ', 'ͥ',
- 'ͦ', 'ͧ', 'ͨ', 'ͩ',
- 'ͪ', 'ͫ', 'ͬ', 'ͭ',
- 'ͮ', 'ͯ', '̾', '͛',
- '͆', '̚',
- ],
- 'down': [
- '̖', '̗', '̘', '̙',
- '̜', '̝', '̞', '̟',
- '̠', '̤', '̥', '̦',
- '̩', '̪', '̫', '̬',
- '̭', '̮', '̯', '̰',
- '̱', '̲', '̳', '̹',
- '̺', '̻', '̼', 'ͅ',
- '͇', '͈', '͉', '͍',
- '͎', '͓', '͔', '͕',
- '͖', '͙', '͚', '̣',
- ],
- 'mid': [
- '̕', '̛', '̀', '́',
- '͘', '̡', '̢', '̧',
- '̨', '̴', '̵', '̶',
- '͜', '͝', '͞',
- '͟', '͠', '͢', '̸',
- '̷', '͡', ' ҉',
- ],
- };
- var all = [].concat(soul.up, soul.down, soul.mid);
-
- function randomNumber(range) {
- var r = Math.floor(Math.random() * range);
- return r;
- }
-
- function isChar(character) {
- var bool = false;
- all.filter(function(i) {
- bool = (i === character);
- });
- return bool;
- }
-
-
- function heComes(text, options) {
- var result = '';
- var counts;
- var l;
- options = options || {};
- options['up'] =
- typeof options['up'] !== 'undefined' ? options['up'] : true;
- options['mid'] =
- typeof options['mid'] !== 'undefined' ? options['mid'] : true;
- options['down'] =
- typeof options['down'] !== 'undefined' ? options['down'] : true;
- options['size'] =
- typeof options['size'] !== 'undefined' ? options['size'] : 'maxi';
- text = text.split('');
- for (l in text) {
- if (isChar(l)) {
- continue;
- }
- result = result + text[l];
- counts = {'up': 0, 'down': 0, 'mid': 0};
- switch (options.size) {
- case 'mini':
- counts.up = randomNumber(8);
- counts.mid = randomNumber(2);
- counts.down = randomNumber(8);
- break;
- case 'maxi':
- counts.up = randomNumber(16) + 3;
- counts.mid = randomNumber(4) + 1;
- counts.down = randomNumber(64) + 3;
- break;
- default:
- counts.up = randomNumber(8) + 1;
- counts.mid = randomNumber(6) / 2;
- counts.down = randomNumber(8) + 1;
- break;
- }
-
- var arr = ['up', 'mid', 'down'];
- for (var d in arr) {
- var index = arr[d];
- for (var i = 0; i <= counts[index]; i++) {
- if (options[index]) {
- result = result + soul[index][randomNumber(soul[index].length)];
- }
- }
- }
- }
- return result;
- }
- // don't summon him
- return heComes(text, options);
-};
-
-
-
-/***/ }),
-
-/***/ 29337:
-/***/ ((module) => {
-
-module['exports'] = function(colors) {
- return function(letter, i, exploded) {
- if (letter === ' ') return letter;
- switch (i%3) {
- case 0: return colors.red(letter);
- case 1: return colors.white(letter);
- case 2: return colors.blue(letter);
- }
- };
-};
-
-
-/***/ }),
-
-/***/ 19565:
-/***/ ((module) => {
-
-module['exports'] = function(colors) {
- // RoY G BiV
- var rainbowColors = ['red', 'yellow', 'green', 'blue', 'magenta'];
- return function(letter, i, exploded) {
- if (letter === ' ') {
- return letter;
- } else {
- return colors[rainbowColors[i++ % rainbowColors.length]](letter);
- }
- };
-};
-
-
-
-/***/ }),
-
-/***/ 78212:
-/***/ ((module) => {
-
-module['exports'] = function(colors) {
- var available = ['underline', 'inverse', 'grey', 'yellow', 'red', 'green',
- 'blue', 'white', 'cyan', 'magenta', 'brightYellow', 'brightRed',
- 'brightGreen', 'brightBlue', 'brightWhite', 'brightCyan', 'brightMagenta'];
- return function(letter, i, exploded) {
- return letter === ' ' ? letter :
- colors[
- available[Math.round(Math.random() * (available.length - 2))]
- ](letter);
- };
-};
-
-
-/***/ }),
-
-/***/ 3792:
-/***/ ((module) => {
-
-module['exports'] = function(colors) {
- return function(letter, i, exploded) {
- return i % 2 === 0 ? letter : colors.inverse(letter);
- };
-};
-
-
-/***/ }),
-
-/***/ 95691:
-/***/ ((module) => {
-
-/*
-The MIT License (MIT)
-
-Copyright (c) Sindre Sorhus (sindresorhus.com)
-
-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.
-
-*/
-
-var styles = {};
-module['exports'] = styles;
-
-var codes = {
- reset: [0, 0],
-
- bold: [1, 22],
- dim: [2, 22],
- italic: [3, 23],
- underline: [4, 24],
- inverse: [7, 27],
- hidden: [8, 28],
- strikethrough: [9, 29],
-
- black: [30, 39],
- red: [31, 39],
- green: [32, 39],
- yellow: [33, 39],
- blue: [34, 39],
- magenta: [35, 39],
- cyan: [36, 39],
- white: [37, 39],
- gray: [90, 39],
- grey: [90, 39],
-
- brightRed: [91, 39],
- brightGreen: [92, 39],
- brightYellow: [93, 39],
- brightBlue: [94, 39],
- brightMagenta: [95, 39],
- brightCyan: [96, 39],
- brightWhite: [97, 39],
-
- bgBlack: [40, 49],
- bgRed: [41, 49],
- bgGreen: [42, 49],
- bgYellow: [43, 49],
- bgBlue: [44, 49],
- bgMagenta: [45, 49],
- bgCyan: [46, 49],
- bgWhite: [47, 49],
- bgGray: [100, 49],
- bgGrey: [100, 49],
-
- bgBrightRed: [101, 49],
- bgBrightGreen: [102, 49],
- bgBrightYellow: [103, 49],
- bgBrightBlue: [104, 49],
- bgBrightMagenta: [105, 49],
- bgBrightCyan: [106, 49],
- bgBrightWhite: [107, 49],
-
- // legacy styles for colors pre v1.0.0
- blackBG: [40, 49],
- redBG: [41, 49],
- greenBG: [42, 49],
- yellowBG: [43, 49],
- blueBG: [44, 49],
- magentaBG: [45, 49],
- cyanBG: [46, 49],
- whiteBG: [47, 49],
-
-};
-
-Object.keys(codes).forEach(function(key) {
- var val = codes[key];
- var style = styles[key] = [];
- style.open = '\u001b[' + val[0] + 'm';
- style.close = '\u001b[' + val[1] + 'm';
-});
-
-
-/***/ }),
-
-/***/ 63680:
-/***/ ((module) => {
-
-"use strict";
-/*
-MIT License
-
-Copyright (c) Sindre Sorhus (sindresorhus.com)
-
-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.
-*/
-
-
-
-module.exports = function(flag, argv) {
- argv = argv || process.argv;
-
- var terminatorPos = argv.indexOf('--');
- var prefix = /^-{1,2}/.test(flag) ? '' : '--';
- var pos = argv.indexOf(prefix + flag);
-
- return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
-};
-
-
-/***/ }),
-
-/***/ 21959:
-/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
-
-"use strict";
-/*
-The MIT License (MIT)
-
-Copyright (c) Sindre Sorhus (sindresorhus.com)
-
-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.
-
-*/
-
-
-
-var os = __nccwpck_require__(22037);
-var hasFlag = __nccwpck_require__(63680);
-
-var env = process.env;
-
-var forceColor = void 0;
-if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false')) {
- forceColor = false;
-} else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true')
- || hasFlag('color=always')) {
- forceColor = true;
-}
-if ('FORCE_COLOR' in env) {
- forceColor = env.FORCE_COLOR.length === 0
- || parseInt(env.FORCE_COLOR, 10) !== 0;
-}
-
-function translateLevel(level) {
- if (level === 0) {
- return false;
- }
-
- return {
- level: level,
- hasBasic: true,
- has256: level >= 2,
- has16m: level >= 3,
- };
-}
-
-function supportsColor(stream) {
- if (forceColor === false) {
- return 0;
- }
-
- if (hasFlag('color=16m') || hasFlag('color=full')
- || hasFlag('color=truecolor')) {
- return 3;
- }
-
- if (hasFlag('color=256')) {
- return 2;
- }
-
- if (stream && !stream.isTTY && forceColor !== true) {
- return 0;
- }
-
- var min = forceColor ? 1 : 0;
-
- if (process.platform === 'win32') {
- // Node.js 7.5.0 is the first version of Node.js to include a patch to
- // libuv that enables 256 color output on Windows. Anything earlier and it
- // won't work. However, here we target Node.js 8 at minimum as it is an LTS
- // release, and Node.js 7 is not. Windows 10 build 10586 is the first
- // Windows release that supports 256 colors. Windows 10 build 14931 is the
- // first release that supports 16m/TrueColor.
- var osRelease = os.release().split('.');
- if (Number(process.versions.node.split('.')[0]) >= 8
- && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
- return Number(osRelease[2]) >= 14931 ? 3 : 2;
- }
-
- return 1;
- }
-
- if ('CI' in env) {
- if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(function(sign) {
- return sign in env;
- }) || env.CI_NAME === 'codeship') {
- return 1;
- }
-
- return min;
- }
-
- if ('TEAMCITY_VERSION' in env) {
- return (/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0
- );
- }
-
- if ('TERM_PROGRAM' in env) {
- var version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
-
- switch (env.TERM_PROGRAM) {
- case 'iTerm.app':
- return version >= 3 ? 3 : 2;
- case 'Hyper':
- return 3;
- case 'Apple_Terminal':
- return 2;
- // No default
- }
- }
-
- if (/-256(color)?$/i.test(env.TERM)) {
- return 2;
- }
-
- if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
- return 1;
- }
-
- if ('COLORTERM' in env) {
- return 1;
- }
-
- if (env.TERM === 'dumb') {
- return min;
- }
-
- return min;
-}
-
-function getSupportLevel(stream) {
- var level = supportsColor(stream);
- return translateLevel(level);
-}
-
-module.exports = {
- supportsColor: getSupportLevel,
- stdout: getSupportLevel(process.stdout),
- stderr: getSupportLevel(process.stderr),
-};
-
-
-/***/ }),
-
-/***/ 59256:
-/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
-
-//
-// Remark: Requiring this file will use the "safe" colors API,
-// which will not touch String.prototype.
-//
-// var colors = require('colors/safe');
-// colors.red("foo")
-//
-//
-var colors = __nccwpck_require__(14175);
-module['exports'] = colors;
-
-
/***/ }),
/***/ 2856:
@@ -46454,2461 +46881,6 @@ function parseParams (str) {
module.exports = parseParams
-/***/ }),
-
-/***/ 55128:
-/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
-
-"use strict";
-
-var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
- return new (P || (P = Promise))(function (resolve, reject) {
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
-};
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-const rabin_karp_1 = __nccwpck_require__(8105);
-const validators_1 = __nccwpck_require__(82218);
-const mode_1 = __nccwpck_require__(27899);
-// TODO replace to own event emitter
-const EventEmitter = __nccwpck_require__(11848);
-class Detector extends EventEmitter {
- constructor(tokenizer, store, cloneValidators = [], options) {
- super();
- this.tokenizer = tokenizer;
- this.store = store;
- this.cloneValidators = cloneValidators;
- this.options = options;
- this.initCloneValidators();
- this.algorithm = new rabin_karp_1.RabinKarp(this.options, this, this.cloneValidators);
- this.options.minTokens = this.options.minTokens || 50;
- this.options.maxLines = this.options.maxLines || 500;
- this.options.minLines = this.options.minLines || 5;
- this.options.mode = this.options.mode || mode_1.mild;
- }
- detect(id, text, format) {
- return __awaiter(this, void 0, void 0, function* () {
- const tokenMaps = this.tokenizer.generateMaps(id, text, format, this.options);
- // TODO change stores implementation
- this.store.namespace(format);
- const detect = (tokenMap, clones) => __awaiter(this, void 0, void 0, function* () {
- if (tokenMap) {
- this.emit('START_DETECTION', { source: tokenMap });
- return this.algorithm
- .run(tokenMap, this.store)
- .then((clns) => {
- clones.push(...clns);
- const nextTokenMap = tokenMaps.pop();
- if (nextTokenMap) {
- return detect(nextTokenMap, clones);
- }
- else {
- return clones;
- }
- });
- }
- });
- return detect(tokenMaps.pop(), []);
- });
- }
- initCloneValidators() {
- if (this.options.minLines || this.options.maxLines) {
- this.cloneValidators.push(new validators_1.LinesLengthCloneValidator());
- }
- }
-}
-exports.Detector = Detector;
-//# sourceMappingURL=detector.js.map
-
-/***/ }),
-
-/***/ 84511:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-function __export(m) {
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
-}
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-__export(__nccwpck_require__(55128));
-__export(__nccwpck_require__(27899));
-__export(__nccwpck_require__(81070));
-__export(__nccwpck_require__(67799));
-__export(__nccwpck_require__(54628));
-//# sourceMappingURL=index.js.map
-
-/***/ }),
-
-/***/ 27899:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-function strict(token) {
- return token.type !== 'ignore';
-}
-exports.strict = strict;
-function mild(token) {
- return strict(token) && token.type !== 'empty' && token.type !== 'new_line';
-}
-exports.mild = mild;
-function weak(token) {
- return mild(token)
- && token.format !== 'comment'
- && token.type !== 'comment'
- && token.type !== 'block-comment';
-}
-exports.weak = weak;
-const MODES = {
- mild,
- strict,
- weak,
-};
-function getModeByName(name) {
- if (name in MODES) {
- return MODES[name];
- }
- throw new Error(`Mode ${name} does not supported yet.`);
-}
-exports.getModeByName = getModeByName;
-function getModeHandler(mode) {
- return typeof mode === 'string' ? getModeByName(mode) : mode;
-}
-exports.getModeHandler = getModeHandler;
-//# sourceMappingURL=mode.js.map
-
-/***/ }),
-
-/***/ 81070:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-const mode_1 = __nccwpck_require__(27899);
-function getDefaultOptions() {
- return {
- executionId: new Date().toISOString(),
- path: [process.cwd()],
- mode: mode_1.getModeHandler('mild'),
- minLines: 5,
- maxLines: 1000,
- maxSize: '100kb',
- minTokens: 50,
- output: './report',
- reporters: ['console'],
- ignore: [],
- threshold: undefined,
- formatsExts: {},
- debug: false,
- silent: false,
- blame: false,
- cache: true,
- absolute: false,
- noSymlinks: false,
- skipLocal: false,
- ignoreCase: false,
- gitignore: false,
- reportersOptions: {},
- exitCode: 0,
- };
-}
-exports.getDefaultOptions = getDefaultOptions;
-// eslint-disable-next-line @typescript-eslint/no-explicit-any
-function getOption(name, options) {
- const defaultOptions = getDefaultOptions();
- return options ? options[name] || defaultOptions[name] : defaultOptions[name];
-}
-exports.getOption = getOption;
-//# sourceMappingURL=options.js.map
-
-/***/ }),
-
-/***/ 8105:
-/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
-
-"use strict";
-
-var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
- return new (P || (P = Promise))(function (resolve, reject) {
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
-};
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-const validators_1 = __nccwpck_require__(82218);
-class RabinKarp {
- constructor(options, eventEmitter, cloneValidators) {
- this.options = options;
- this.eventEmitter = eventEmitter;
- this.cloneValidators = cloneValidators;
- }
- run(tokenMap, store) {
- return __awaiter(this, void 0, void 0, function* () {
- return new Promise((resolve => {
- let mapFrameInStore;
- let clone = null;
- const clones = [];
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
- const loop = () => {
- const iteration = tokenMap.next();
- store
- .get(iteration.value.id)
- .then((mapFrameFromStore) => {
- mapFrameInStore = mapFrameFromStore;
- if (!clone) {
- clone = RabinKarp.createClone(tokenMap.getFormat(), iteration.value, mapFrameInStore);
- }
- }, () => {
- if (clone && this.validate(clone)) {
- clones.push(clone);
- }
- clone = null;
- if (iteration.value.id) {
- return store.set(iteration.value.id, iteration.value);
- }
- })
- .finally(() => {
- if (!iteration.done) {
- if (clone) {
- clone = RabinKarp.enlargeClone(clone, iteration.value, mapFrameInStore);
- }
- loop();
- }
- else {
- resolve(clones);
- }
- });
- };
- loop();
- }));
- });
- }
- validate(clone) {
- const validation = validators_1.runCloneValidators(clone, this.options, this.cloneValidators);
- if (validation.status) {
- this.eventEmitter.emit('CLONE_FOUND', { clone });
- }
- else {
- this.eventEmitter.emit('CLONE_SKIPPED', { clone, validation });
- }
- return validation.status;
- }
- static createClone(format, mapFrameA, mapFrameB) {
- return {
- format,
- foundDate: new Date().getTime(),
- duplicationA: {
- sourceId: mapFrameA.sourceId,
- start: mapFrameA.start.loc.start,
- end: mapFrameA.end.loc.end,
- range: [mapFrameA.start.range[0], mapFrameA.end.range[1]],
- },
- duplicationB: {
- sourceId: mapFrameB.sourceId,
- start: mapFrameB.start.loc.start,
- end: mapFrameB.end.loc.end,
- range: [mapFrameB.start.range[0], mapFrameB.end.range[1]],
- },
- };
- }
- static enlargeClone(clone, mapFrameA, mapFrameB) {
- clone.duplicationA.range[1] = mapFrameA.end.range[1];
- clone.duplicationA.end = mapFrameA.end.loc.end;
- clone.duplicationB.range[1] = mapFrameB.end.range[1];
- clone.duplicationB.end = mapFrameB.end.loc.end;
- return clone;
- }
-}
-exports.RabinKarp = RabinKarp;
-//# sourceMappingURL=rabin-karp.js.map
-
-/***/ }),
-
-/***/ 67799:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-class Statistic {
- constructor() {
- this.statistic = {
- detectionDate: new Date().toISOString(),
- formats: {},
- total: Statistic.getDefaultStatistic(),
- };
- }
- static getDefaultStatistic() {
- return {
- lines: 0,
- tokens: 0,
- sources: 0,
- clones: 0,
- duplicatedLines: 0,
- duplicatedTokens: 0,
- percentage: 0,
- percentageTokens: 0,
- newDuplicatedLines: 0,
- newClones: 0,
- };
- }
- subscribe() {
- return {
- CLONE_FOUND: this.cloneFound.bind(this),
- START_DETECTION: this.matchSource.bind(this),
- };
- }
- getStatistic() {
- return this.statistic;
- }
- cloneFound(payload) {
- const { clone } = payload;
- const id = clone.duplicationA.sourceId;
- const id2 = clone.duplicationB.sourceId;
- const linesCount = clone.duplicationA.end.line - clone.duplicationA.start.line;
- const duplicatedTokens = clone.duplicationA.end.position - clone.duplicationA.start.position;
- this.statistic.total.clones++;
- this.statistic.total.duplicatedLines += linesCount;
- this.statistic.total.duplicatedTokens += duplicatedTokens;
- this.statistic.formats[clone.format].total.clones++;
- this.statistic.formats[clone.format].total.duplicatedLines += linesCount;
- this.statistic.formats[clone.format].total.duplicatedTokens += duplicatedTokens;
- this.statistic.formats[clone.format].sources[id].clones++;
- this.statistic.formats[clone.format].sources[id].duplicatedLines += linesCount;
- this.statistic.formats[clone.format].sources[id].duplicatedTokens += duplicatedTokens;
- this.statistic.formats[clone.format].sources[id2].clones++;
- this.statistic.formats[clone.format].sources[id2].duplicatedLines += linesCount;
- this.statistic.formats[clone.format].sources[id2].duplicatedTokens += duplicatedTokens;
- this.updatePercentage(clone.format);
- }
- matchSource(payload) {
- const { source } = payload;
- const format = source.getFormat();
- if (!(format in this.statistic.formats)) {
- this.statistic.formats[format] = {
- sources: {},
- total: Statistic.getDefaultStatistic(),
- };
- }
- this.statistic.total.sources++;
- this.statistic.total.lines += source.getLinesCount();
- this.statistic.total.tokens += source.getTokensCount();
- this.statistic.formats[format].total.sources++;
- this.statistic.formats[format].total.lines += source.getLinesCount();
- this.statistic.formats[format].total.tokens += source.getTokensCount();
- this.statistic.formats[format].sources[source.getId()] =
- this.statistic.formats[format].sources[source.getId()] || Statistic.getDefaultStatistic();
- this.statistic.formats[format].sources[source.getId()].sources = 1;
- this.statistic.formats[format].sources[source.getId()].lines += source.getLinesCount();
- this.statistic.formats[format].sources[source.getId()].tokens += source.getTokensCount();
- this.updatePercentage(format);
- }
- updatePercentage(format) {
- this.statistic.total.percentage = Statistic.calculatePercentage(this.statistic.total.lines, this.statistic.total.duplicatedLines);
- this.statistic.total.percentageTokens = Statistic.calculatePercentage(this.statistic.total.tokens, this.statistic.total.duplicatedTokens);
- this.statistic.formats[format].total.percentage = Statistic.calculatePercentage(this.statistic.formats[format].total.lines, this.statistic.formats[format].total.duplicatedLines);
- this.statistic.formats[format].total.percentageTokens = Statistic.calculatePercentage(this.statistic.formats[format].total.tokens, this.statistic.formats[format].total.duplicatedTokens);
- Object.entries(this.statistic.formats[format].sources).forEach(([id, stat]) => {
- this.statistic.formats[format].sources[id].percentage = Statistic.calculatePercentage(stat.lines, stat.duplicatedLines);
- this.statistic.formats[format].sources[id].percentageTokens = Statistic.calculatePercentage(stat.tokens, stat.duplicatedTokens);
- });
- }
- static calculatePercentage(total, cloned) {
- return total ? Math.round((10000 * cloned) / total) / 100 : 0.0;
- }
-}
-exports.Statistic = Statistic;
-//# sourceMappingURL=statistic.js.map
-
-/***/ }),
-
-/***/ 54628:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-class MemoryStore {
- constructor() {
- this.values = {};
- }
- namespace(namespace) {
- this._namespace = namespace;
- this.values[namespace] = this.values[namespace] || {};
- }
- get(key) {
- return new Promise((resolve, reject) => {
- if (key in this.values[this._namespace]) {
- resolve(this.values[this._namespace][key]);
- }
- else {
- reject(new Error('not found'));
- }
- });
- }
- set(key, value) {
- this.values[this._namespace][key] = value;
- return Promise.resolve(value);
- }
- close() {
- this.values = {};
- }
-}
-exports.MemoryStore = MemoryStore;
-//# sourceMappingURL=memory.js.map
-
-/***/ }),
-
-/***/ 82218:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-function __export(m) {
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
-}
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-__export(__nccwpck_require__(52214));
-__export(__nccwpck_require__(43865));
-//# sourceMappingURL=index.js.map
-
-/***/ }),
-
-/***/ 52214:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-class LinesLengthCloneValidator {
- validate(clone, options) {
- const lines = clone.duplicationA.end.line - clone.duplicationA.start.line;
- const status = lines >= options.minLines;
- return {
- status,
- message: status ? ['ok'] : [`Lines of code less than limit (${lines} < ${options.minLines})`],
- };
- }
-}
-exports.LinesLengthCloneValidator = LinesLengthCloneValidator;
-//# sourceMappingURL=lines-length-clone.validator.js.map
-
-/***/ }),
-
-/***/ 43865:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-function runCloneValidators(clone, options, validators) {
- return validators.reduce((acc, validator) => {
- const res = validator.validate(clone, options);
- return Object.assign(Object.assign({}, acc), { status: res.status && acc.status, message: res.message ? [...acc.message, ...res.message] : acc.message });
- }, { status: true, message: [], clone });
-}
-exports.runCloneValidators = runCloneValidators;
-//# sourceMappingURL=validator.js.map
-
-/***/ }),
-
-/***/ 51908:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-const core_1 = __nccwpck_require__(84511);
-const fast_glob_1 = __nccwpck_require__(43664);
-const tokenizer_1 = __nccwpck_require__(92080);
-const fs_extra_1 = __nccwpck_require__(5630);
-const safe_1 = __nccwpck_require__(41997);
-const fs_1 = __nccwpck_require__(57147);
-const bytes = __nccwpck_require__(86966);
-function isFile(path) {
- try {
- const stat = fs_1.lstatSync(path);
- return stat.isFile();
- }
- catch (e) {
- // lstatSync throws an error if path doesn't exist
- return false;
- }
-}
-function isSymlink(path) {
- try {
- const stat = fs_1.lstatSync(path);
- return stat.isSymbolicLink();
- }
- catch (e) {
- // lstatSync throws an error if path doesn't exist
- return false;
- }
-}
-function skipNotSupportedFormats(options) {
- return (entry) => {
- const { path } = entry;
- const format = tokenizer_1.getFormatByFile(path, options.formatsExts);
- const shouldNotSkip = format && options.format && options.format.includes(format);
- if ((options.debug || options.verbose) && !shouldNotSkip) {
- console.log(`File ${path} skipped! Format "${format}" does not included to supported formats.`);
- }
- return shouldNotSkip;
- };
-}
-function skipBigFiles(options) {
- return (entry) => {
- const { stats, path } = entry;
- const shouldSkip = bytes.parse(stats.size) > bytes.parse(core_1.getOption('maxSize', options));
- if (options.debug && shouldSkip) {
- console.log(`File ${path} skipped! Size more then limit (${bytes(stats.size)} > ${core_1.getOption('maxSize', options)})`);
- }
- return !shouldSkip;
- };
-}
-function skipFilesIfLinesOfContentNotInLimits(options) {
- return (entry) => {
- const { path, content } = entry;
- const lines = content.split('\n').length;
- const minLines = core_1.getOption('minLines', options);
- const maxLines = core_1.getOption('maxLines', options);
- if (lines < minLines || lines > maxLines) {
- if ((options.debug || options.verbose)) {
- console.log(safe_1.grey(`File ${path} skipped! Code lines=${lines} not in limits (${minLines}:${maxLines})`));
- }
- return false;
- }
- return true;
- };
-}
-function addContentToEntry(entry) {
- const { path } = entry;
- const content = fs_extra_1.readFileSync(path).toString();
- return Object.assign(Object.assign({}, entry), { content });
-}
-function getFilesToDetect(options) {
- const pattern = options.pattern || '**/*';
- let patterns = options.path;
- if (options.noSymlinks) {
- patterns = patterns.filter((path) => !isSymlink(path));
- }
- patterns = patterns.map((path) => {
- const currentPath = fs_extra_1.realpathSync(path);
- if (isFile(currentPath)) {
- return path;
- }
- return path.endsWith('/') ? `${path}${pattern}` : `${path}/${pattern}`;
- });
- return fast_glob_1.sync(patterns, {
- ignore: options.ignore,
- onlyFiles: true,
- dot: true,
- stats: true,
- absolute: options.absolute,
- followSymbolicLinks: !options.noSymlinks,
- })
- .filter(skipNotSupportedFormats(options))
- .filter(skipBigFiles(options))
- .map(addContentToEntry)
- .filter(skipFilesIfLinesOfContentNotInLimits(options));
-}
-exports.getFilesToDetect = getFilesToDetect;
-//# sourceMappingURL=files.js.map
-
-/***/ }),
-
-/***/ 74574:
-/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
-
-"use strict";
-
-var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
- return new (P || (P = Promise))(function (resolve, reject) {
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
-};
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-const blamer_1 = __nccwpck_require__(56781);
-class BlamerHook {
- process(clones) {
- return Promise.all(clones.map((clone) => BlamerHook.blameLines(clone)));
- }
- static blameLines(clone) {
- return __awaiter(this, void 0, void 0, function* () {
- const blamer = new blamer_1.default();
- const blamedFileA = yield blamer.blameByFile(clone.duplicationA.sourceId);
- const blamedFileB = yield blamer.blameByFile(clone.duplicationB.sourceId);
- clone.duplicationA.blame = BlamerHook.getBlamedLines(blamedFileA, clone.duplicationA.start.line, clone.duplicationA.end.line);
- clone.duplicationB.blame = BlamerHook.getBlamedLines(blamedFileB, clone.duplicationB.start.line, clone.duplicationB.end.line);
- return clone;
- });
- }
- static getBlamedLines(blamedFiles, start, end) {
- // TODO rewrite the method
- const [file] = Object.keys(blamedFiles);
- const result = {};
- Object.keys(blamedFiles[file])
- .filter((lineNumber) => {
- return Number(lineNumber) >= start && Number(lineNumber) <= end;
- })
- .map((lineNumber) => blamedFiles[file][lineNumber])
- .forEach((info) => {
- result[info.line] = info;
- });
- return result;
- }
-}
-exports.BlamerHook = BlamerHook;
-//# sourceMappingURL=blamer.js.map
-
-/***/ }),
-
-/***/ 44810:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-const fs_1 = __nccwpck_require__(57147);
-class FragmentsHook {
- process(clones) {
- return Promise.all(clones.map((clone) => FragmentsHook.addFragments(clone)));
- }
- static addFragments(clone) {
- const codeA = fs_1.readFileSync(clone.duplicationA.sourceId).toString();
- const codeB = fs_1.readFileSync(clone.duplicationB.sourceId).toString();
- clone.duplicationA.fragment = codeA.substring(clone.duplicationA.range[0], clone.duplicationA.range[1]);
- clone.duplicationB.fragment = codeB.substring(clone.duplicationB.range[0], clone.duplicationB.range[1]);
- return clone;
- }
-}
-exports.FragmentsHook = FragmentsHook;
-//# sourceMappingURL=fragment.js.map
-
-/***/ }),
-
-/***/ 88131:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-function __export(m) {
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
-}
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-__export(__nccwpck_require__(74574));
-__export(__nccwpck_require__(44810));
-//# sourceMappingURL=index.js.map
-
-/***/ }),
-
-/***/ 88241:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-const core_1 = __nccwpck_require__(84511);
-const tokenizer_1 = __nccwpck_require__(92080);
-const validators_1 = __nccwpck_require__(20733);
-class InFilesDetector {
- constructor(tokenizer, store, statistic, options) {
- this.tokenizer = tokenizer;
- this.store = store;
- this.statistic = statistic;
- this.options = options;
- this.reporters = [];
- this.subscribes = [];
- this.postHooks = [];
- this.registerSubscriber(this.statistic);
- }
- registerReporter(reporter) {
- this.reporters.push(reporter);
- }
- registerSubscriber(subscriber) {
- this.subscribes.push(subscriber);
- }
- registerHook(hook) {
- this.postHooks.push(hook);
- }
- detect(fls) {
- const files = fls.filter((f) => !!f);
- if (files.length === 0) {
- return Promise.resolve([]);
- }
- const options = this.options;
- const hooks = [...this.postHooks];
- const store = this.store;
- const validators = [];
- if (options.skipLocal) {
- validators.push(new validators_1.SkipLocalValidator());
- }
- const detector = new core_1.Detector(this.tokenizer, store, validators, options);
- this.subscribes.forEach((listener) => {
- Object
- .entries(listener.subscribe())
- .map(([event, handler]) => detector.on(event, handler));
- });
- const detect = (entry, clones = []) => {
- const { path, content } = entry;
- const format = tokenizer_1.getFormatByFile(path, options.formatsExts);
- return detector
- .detect(path, content, format)
- .then((clns) => {
- if (clns) {
- clones.push(...clns);
- }
- const file = files.pop();
- if (file) {
- return detect(file, clones);
- }
- return clones;
- });
- };
- const processHooks = (hook, detectedClones) => {
- return hook
- .process(detectedClones)
- .then((clones) => {
- const nextHook = hooks.pop();
- if (nextHook) {
- return processHooks(nextHook, clones);
- }
- return clones;
- });
- };
- return detect(files.pop())
- .then((clones) => {
- const hook = hooks.pop();
- if (hook) {
- return processHooks(hook, clones);
- }
- return clones;
- })
- .then((clones) => {
- const statistic = this.statistic.getStatistic();
- this.reporters.forEach((reporter) => {
- reporter.report(clones, statistic);
- });
- return clones;
- });
- }
-}
-exports.InFilesDetector = InFilesDetector;
-//# sourceMappingURL=in-files-detector.js.map
-
-/***/ }),
-
-/***/ 39148:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-function __export(m) {
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
-}
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-__export(__nccwpck_require__(88241));
-__export(__nccwpck_require__(51908));
-__export(__nccwpck_require__(88131));
-__export(__nccwpck_require__(48812));
-__export(__nccwpck_require__(16872));
-__export(__nccwpck_require__(20733));
-__export(__nccwpck_require__(43465));
-//# sourceMappingURL=index.js.map
-
-/***/ }),
-
-/***/ 57959:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-const reports_1 = __nccwpck_require__(42083);
-const clone_found_1 = __nccwpck_require__(17304);
-const safe_1 = __nccwpck_require__(41997);
-const Table = __nccwpck_require__(2101);
-const TABLE_OPTIONS = {
- chars: {
- top: '',
- 'top-mid': '',
- 'top-left': '',
- 'top-right': '',
- bottom: '',
- 'bottom-mid': '',
- 'bottom-left': '',
- 'bottom-right': '',
- left: '',
- 'left-mid': '',
- mid: '',
- 'mid-mid': '',
- right: '',
- 'right-mid': '',
- middle: '│',
- },
-};
-class ConsoleFullReporter {
- constructor(options) {
- this.options = options;
- }
- report(clones) {
- clones.forEach((clone) => {
- this.cloneFullFound(clone);
- });
- console.log(safe_1.grey(`Found ${clones.length} clones.`));
- }
- cloneFullFound(clone) {
- const table = new Table(TABLE_OPTIONS);
- clone_found_1.cloneFound(clone, this.options);
- clone.duplicationA.fragment.split('\n').forEach((line, position) => {
- (table).push(reports_1.generateLine(clone, position, line));
- });
- console.log(table.toString());
- console.log('');
- }
-}
-exports.ConsoleFullReporter = ConsoleFullReporter;
-//# sourceMappingURL=console-full.js.map
-
-/***/ }),
-
-/***/ 94513:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-const safe_1 = __nccwpck_require__(41997);
-const reports_1 = __nccwpck_require__(42083);
-const Table = __nccwpck_require__(2101);
-class ConsoleReporter {
- constructor(options) {
- this.options = options;
- }
- report(clones, statistic = undefined) {
- if (statistic && !this.options.silent) {
- const table = new Table({
- head: ['Format', 'Files analyzed', 'Total lines', 'Total tokens', 'Clones found', 'Duplicated lines', 'Duplicated tokens'],
- });
- Object.keys(statistic.formats)
- .filter((format) => statistic.formats[format].sources)
- .forEach((format) => {
- table.push(reports_1.convertStatisticToArray(format, statistic.formats[format].total));
- });
- table.push(reports_1.convertStatisticToArray(safe_1.bold('Total:'), statistic.total));
- console.log(table.toString());
- console.log(safe_1.grey(`Found ${clones.length} clones.`));
- }
- }
-}
-exports.ConsoleReporter = ConsoleReporter;
-//# sourceMappingURL=console.js.map
-
-/***/ }),
-
-/***/ 54038:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-const core_1 = __nccwpck_require__(84511);
-const fs_extra_1 = __nccwpck_require__(5630);
-const safe_1 = __nccwpck_require__(41997);
-const path_1 = __nccwpck_require__(71017);
-const reports_1 = __nccwpck_require__(42083);
-class CSVReporter {
- constructor(options) {
- this.options = options;
- }
- report(clones, statistic) {
- const report = [
- ['Format', 'Files analyzed', 'Total lines', 'Total tokens', 'Clones found', 'Duplicated lines', 'Duplicated tokens'],
- ...Object.keys(statistic.formats).map((format) => reports_1.convertStatisticToArray(format, statistic.formats[format].total)),
- reports_1.convertStatisticToArray('Total:', statistic.total)
- ].map((arr) => arr.join(',')).join('\n');
- fs_extra_1.ensureDirSync(core_1.getOption('output', this.options));
- fs_extra_1.writeFileSync(core_1.getOption('output', this.options) + '/jscpd-report.csv', report);
- console.log(safe_1.green(`CSV report saved to ${path_1.join(this.options.output, 'jscpd-report.csv')}`));
- }
-}
-exports.CSVReporter = CSVReporter;
-//# sourceMappingURL=csv.js.map
-
-/***/ }),
-
-/***/ 16872:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-function __export(m) {
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
-}
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-__export(__nccwpck_require__(94513));
-__export(__nccwpck_require__(57959));
-__export(__nccwpck_require__(78634));
-__export(__nccwpck_require__(54038));
-__export(__nccwpck_require__(91708));
-__export(__nccwpck_require__(9319));
-__export(__nccwpck_require__(87850));
-__export(__nccwpck_require__(42639));
-__export(__nccwpck_require__(39774));
-//# sourceMappingURL=index.js.map
-
-/***/ }),
-
-/***/ 78634:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-const fs_extra_1 = __nccwpck_require__(5630);
-const core_1 = __nccwpck_require__(84511);
-const reports_1 = __nccwpck_require__(42083);
-const safe_1 = __nccwpck_require__(41997);
-const path_1 = __nccwpck_require__(71017);
-class JsonReporter {
- constructor(options) {
- this.options = options;
- }
- generateJson(clones, statistics) {
- return {
- statistics,
- duplicates: clones.map(clone => this.cloneFound(clone))
- };
- }
- report(clones, statistic) {
- const json = this.generateJson(clones, statistic);
- fs_extra_1.ensureDirSync(core_1.getOption('output', this.options));
- fs_extra_1.writeFileSync(core_1.getOption('output', this.options) + '/jscpd-report.json', JSON.stringify(json, null, ' '));
- console.log(safe_1.green(`JSON report saved to ${path_1.join(this.options.output, 'jscpd-report.json')}`));
- }
- cloneFound(clone) {
- const startLineA = clone.duplicationA.start.line;
- const endLineA = clone.duplicationA.end.line;
- const startLineB = clone.duplicationB.start.line;
- const endLineB = clone.duplicationB.end.line;
- return {
- format: clone.format,
- lines: endLineA - startLineA + 1,
- fragment: clone.duplicationA.fragment,
- tokens: 0,
- firstFile: {
- name: reports_1.getPath(clone.duplicationA.sourceId, this.options),
- start: startLineA,
- end: endLineA,
- startLoc: clone.duplicationA.start,
- endLoc: clone.duplicationA.end,
- blame: clone.duplicationA.blame,
- },
- secondFile: {
- name: reports_1.getPath(clone.duplicationB.sourceId, this.options),
- start: startLineB,
- end: endLineB,
- startLoc: clone.duplicationB.start,
- endLoc: clone.duplicationB.end,
- blame: clone.duplicationB.blame,
- },
- };
- }
-}
-exports.JsonReporter = JsonReporter;
-//# sourceMappingURL=json.js.map
-
-/***/ }),
-
-/***/ 91708:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-const core_1 = __nccwpck_require__(84511);
-const fs_extra_1 = __nccwpck_require__(5630);
-const safe_1 = __nccwpck_require__(41997);
-const path_1 = __nccwpck_require__(71017);
-const reports_1 = __nccwpck_require__(42083);
-const table = __nccwpck_require__(41062);
-class MarkdownReporter {
- constructor(options) {
- this.options = options;
- }
- report(clones, statistic) {
- const report = `
-# Copy/paste detection report
-
-> Duplications detection: Found ${clones.length} exact clones with ${statistic.total.duplicatedLines}(${statistic.total.percentage}%) duplicated lines in ${statistic.total.sources} (${Object.keys(statistic.formats).length} formats) files.
-
-${table([
- ['Format', 'Files analyzed', 'Total lines', 'Total tokens', 'Clones found', 'Duplicated lines', 'Duplicated tokens'],
- ...Object.keys(statistic.formats).map((format) => reports_1.convertStatisticToArray(format, statistic.formats[format].total)),
- reports_1.convertStatisticToArray('Total:', statistic.total).map(item => `**${item}**`)
- ])}
-`;
- fs_extra_1.ensureDirSync(core_1.getOption('output', this.options));
- fs_extra_1.writeFileSync(core_1.getOption('output', this.options) + '/jscpd-report.md', report);
- console.log(safe_1.green(`Markdown report saved to ${path_1.join(this.options.output, 'jscpd-report.md')}`));
- }
-}
-exports.MarkdownReporter = MarkdownReporter;
-//# sourceMappingURL=markdown.js.map
-
-/***/ }),
-
-/***/ 87850:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-const safe_1 = __nccwpck_require__(41997);
-class SilentReporter {
- report(clones, statistic) {
- if (statistic) {
- console.log(`Duplications detection: Found ${safe_1.bold(clones.length.toString())} ` +
- `exact clones with ${safe_1.bold(statistic.total.duplicatedLines.toString())}(${statistic.total.percentage}%) ` +
- `duplicated lines in ${safe_1.bold(statistic.total.sources.toString())} ` +
- `(${Object.keys(statistic.formats).length} formats) files.`);
- }
- }
-}
-exports.SilentReporter = SilentReporter;
-//# sourceMappingURL=silent.js.map
-
-/***/ }),
-
-/***/ 42639:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-const safe_1 = __nccwpck_require__(41997);
-class ThresholdReporter {
- constructor(options) {
- this.options = options;
- }
- report(clones, statistic) {
- if (statistic && this.options.threshold !== undefined && this.options.threshold < statistic.total.percentage) {
- const message = `ERROR: jscpd found too many duplicates (${statistic.total.percentage}%) over threshold (${this.options.threshold}%)`;
- console.error(safe_1.red(message));
- throw new Error(message);
- }
- }
-}
-exports.ThresholdReporter = ThresholdReporter;
-//# sourceMappingURL=threshold.js.map
-
-/***/ }),
-
-/***/ 39774:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-const reports_1 = __nccwpck_require__(42083);
-class XcodeReporter {
- constructor(options) {
- this.options = options;
- }
- report(clones) {
- clones.forEach((clone) => {
- this.cloneFound(clone);
- });
- console.log(`Found ${clones.length} clones.`);
- }
- cloneFound(clone) {
- const pathA = reports_1.getPath(clone.duplicationA.sourceId, Object.assign(Object.assign({}, this.options), { absolute: true }));
- const pathB = reports_1.getPath(clone.duplicationB.sourceId, this.options);
- const startLineA = clone.duplicationA.start.line;
- const characterA = clone.duplicationA.start.column;
- const endLineA = clone.duplicationA.end.line;
- const startLineB = clone.duplicationB.start.line;
- const endLineB = clone.duplicationB.end.line;
- console.log(`${pathA}:${startLineA}:${characterA}: warning: Found ${endLineA - startLineA} lines (${startLineA}-${endLineA}) duplicated on file ${pathB} (${startLineB}-${endLineB})`);
- }
-}
-exports.XcodeReporter = XcodeReporter;
-//# sourceMappingURL=xcode.js.map
-
-/***/ }),
-
-/***/ 9319:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-const fs_1 = __nccwpck_require__(57147);
-const fs_extra_1 = __nccwpck_require__(5630);
-const core_1 = __nccwpck_require__(84511);
-const reports_1 = __nccwpck_require__(42083);
-const safe_1 = __nccwpck_require__(41997);
-const path_1 = __nccwpck_require__(71017);
-class XmlReporter {
- constructor(options) {
- this.options = options;
- }
- report(clones) {
- let xmlDoc = '';
- xmlDoc += '';
- clones.forEach((clone) => {
- xmlDoc = `${xmlDoc}
-
-
- /i, 'CDATA_END')}]]>
-
-
- /i, 'CDATA_END')}]]>
-
- /i, 'CDATA_END')}]]>
-
- `;
- });
- xmlDoc += '';
- fs_extra_1.ensureDirSync(core_1.getOption('output', this.options));
- fs_1.writeFileSync(core_1.getOption('output', this.options) + '/jscpd-report.xml', xmlDoc);
- console.log(safe_1.green(`XML report saved to ${path_1.join(this.options.output, 'jscpd-report.xml')}`));
- }
-}
-exports.XmlReporter = XmlReporter;
-//# sourceMappingURL=xml.js.map
-
-/***/ }),
-
-/***/ 48812:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-function __export(m) {
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
-}
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-__export(__nccwpck_require__(14941));
-__export(__nccwpck_require__(10865));
-//# sourceMappingURL=index.js.map
-
-/***/ }),
-
-/***/ 14941:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-const clone_found_1 = __nccwpck_require__(17304);
-class ProgressSubscriber {
- constructor(options) {
- this.options = options;
- }
- subscribe() {
- return {
- CLONE_FOUND: (payload) => clone_found_1.cloneFound(payload.clone, this.options),
- };
- }
-}
-exports.ProgressSubscriber = ProgressSubscriber;
-//# sourceMappingURL=progress.js.map
-
-/***/ }),
-
-/***/ 10865:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-const safe_1 = __nccwpck_require__(41997);
-class VerboseSubscriber {
- constructor(options) {
- this.options = options;
- }
- subscribe() {
- return {
- 'CLONE_FOUND': (payload) => {
- const { clone } = payload;
- console.log(safe_1.yellow('CLONE_FOUND'));
- console.log(safe_1.grey(JSON.stringify(clone, null, '\t')));
- },
- 'CLONE_SKIPPED': (payload) => {
- const { validation } = payload;
- console.log(safe_1.yellow('CLONE_SKIPPED'));
- console.log(safe_1.grey('Clone skipped: ' + validation.message.join(' ')));
- },
- 'START_DETECTION': (payload) => {
- const { source } = payload;
- console.log(safe_1.yellow('START_DETECTION'));
- console.log(safe_1.grey('Start detection for source id=' + source.getId() + ' format=' + source.getFormat()));
- },
- };
- }
-}
-exports.VerboseSubscriber = VerboseSubscriber;
-//# sourceMappingURL=verbose.js.map
-
-/***/ }),
-
-/***/ 17304:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-const safe_1 = __nccwpck_require__(41997);
-const reports_1 = __nccwpck_require__(42083);
-function cloneFound(clone, options) {
- const { duplicationA, duplicationB, format, isNew } = clone;
- console.log('Clone found (' + format + '):' + (isNew ? safe_1.red('*') : ''));
- console.log(` - ${reports_1.getPathConsoleString(duplicationA.sourceId, options)} [${reports_1.getSourceLocation(duplicationA.start, duplicationA.end)}] (${duplicationA.end.line - duplicationA.start.line} lines${duplicationA.end.position ? ', ' + (duplicationA.end.position - duplicationA.start.position) + ' tokens' : ''})`);
- console.log(` ${reports_1.getPathConsoleString(duplicationB.sourceId, options)} [${reports_1.getSourceLocation(duplicationB.start, duplicationB.end)}]`);
- console.log('');
-}
-exports.cloneFound = cloneFound;
-//# sourceMappingURL=clone-found.js.map
-
-/***/ }),
-
-/***/ 43465:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-function parseFormatsExtensions(extensions = '') {
- const result = {};
- if (!extensions) {
- return undefined;
- }
- extensions.split(';').forEach((format) => {
- const pair = format.split(':');
- result[pair[0]] = pair[1].split(',');
- });
- return result;
-}
-exports.parseFormatsExtensions = parseFormatsExtensions;
-//# sourceMappingURL=options.js.map
-
-/***/ }),
-
-/***/ 42083:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-const path_1 = __nccwpck_require__(71017);
-const process_1 = __nccwpck_require__(77282);
-const safe_1 = __nccwpck_require__(41997);
-exports.compareDates = (firstDate, secondDate) => {
- const first = new Date(firstDate);
- const second = new Date(secondDate);
- switch (true) {
- case first < second:
- return '=>';
- case first > second:
- return '<=';
- default:
- return '==';
- }
-};
-function escapeXml(unsafe) {
- return unsafe.replace(/[<>&'"]/g, function (c) {
- switch (c) {
- case '<': return '<';
- case '>': return '>';
- case '&': return '&';
- case '\'': return ''';
- case '"': return '"';
- }
- });
-}
-exports.escapeXml = escapeXml;
-function getPath(path, options) {
- return options.absolute ? path : path_1.relative(process_1.cwd(), path);
-}
-exports.getPath = getPath;
-function getPathConsoleString(path, options) {
- return safe_1.bold(safe_1.green(getPath(path, options)));
-}
-exports.getPathConsoleString = getPathConsoleString;
-function getSourceLocation(start, end) {
- return `${start.line}:${start.column} - ${end.line}:${end.column}`;
-}
-exports.getSourceLocation = getSourceLocation;
-function generateLine(clone, position, line) {
- const lineNumberA = (clone.duplicationA.start.line + position).toString();
- const lineNumberB = (clone.duplicationB.start.line + position).toString();
- if (clone.duplicationA.blame && clone.duplicationB.blame) {
- return [
- lineNumberA,
- clone.duplicationA.blame[lineNumberA] ? clone.duplicationA.blame[lineNumberA].author : '',
- clone.duplicationA.blame[lineNumberA] && clone.duplicationB.blame[lineNumberB]
- ? exports.compareDates(clone.duplicationA.blame[lineNumberA].date, clone.duplicationB.blame[lineNumberB].date)
- : '',
- lineNumberB,
- clone.duplicationB.blame[lineNumberB] ? clone.duplicationB.blame[lineNumberB].author : '',
- safe_1.grey(line),
- ];
- }
- else {
- return [lineNumberA, lineNumberB, safe_1.grey(line)];
- }
-}
-exports.generateLine = generateLine;
-function convertStatisticToArray(format, statistic) {
- return [
- format,
- `${statistic.sources}`,
- `${statistic.lines}`,
- `${statistic.tokens}`,
- `${statistic.clones}`,
- `${statistic.duplicatedLines} (${statistic.percentage}%)`,
- `${statistic.duplicatedTokens} (${statistic.percentageTokens}%)`,
- ];
-}
-exports.convertStatisticToArray = convertStatisticToArray;
-//# sourceMappingURL=reports.js.map
-
-/***/ }),
-
-/***/ 20733:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-function __export(m) {
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
-}
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-__export(__nccwpck_require__(69653));
-//# sourceMappingURL=index.js.map
-
-/***/ }),
-
-/***/ 69653:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-const core_1 = __nccwpck_require__(84511);
-const path_1 = __nccwpck_require__(71017);
-class SkipLocalValidator {
- validate(clone, options) {
- const status = !this.shouldSkipClone(clone, options);
- return {
- status,
- clone,
- message: [
- `Sources of duplication located in same local folder (${clone.duplicationA.sourceId}, ${clone.duplicationB.sourceId})`
- ]
- };
- }
- shouldSkipClone(clone, options) {
- const path = core_1.getOption('path', options);
- return path.some((dir) => SkipLocalValidator.isRelative(clone.duplicationA.sourceId, dir) && SkipLocalValidator.isRelative(clone.duplicationB.sourceId, dir));
- }
- static isRelative(file, path) {
- const rel = path_1.relative(path, file);
- return rel !== '' && !rel.startsWith('..') && !path_1.isAbsolute(rel);
- }
-}
-exports.SkipLocalValidator = SkipLocalValidator;
-//# sourceMappingURL=skip-local.validator.js.map
-
-/***/ }),
-
-/***/ 71084:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-const path_1 = __nccwpck_require__(71017);
-const finder_1 = __nccwpck_require__(39148);
-const fs_extra_1 = __nccwpck_require__(5630);
-const safe_1 = __nccwpck_require__(41997);
-const pug = __nccwpck_require__(40316);
-class HtmlReporter {
- constructor(options) {
- this.options = options;
- }
- report(clones, statistic) {
- const jsonReporter = new finder_1.JsonReporter(this.options);
- const json = jsonReporter.generateJson(clones, statistic);
- const result = pug.renderFile(__nccwpck_require__.ab + "main.pug", json);
- if (this.options.output) {
- const destination = path_1.join(this.options.output, 'html/');
- try {
- fs_extra_1.copySync(__nccwpck_require__.ab + "public", destination, { overwrite: true });
- const index = path_1.join(destination, 'index.html');
- fs_extra_1.writeFileSync(index, result);
- fs_extra_1.writeFileSync(path_1.join(destination, 'jscpd-report.json'), JSON.stringify(json, null, ' '));
- console.log(safe_1.green(`HTML report saved to ${path_1.join(this.options.output, 'html/')}`));
- }
- catch (e) {
- console.log(safe_1.red(e));
- }
- }
- }
-}
-exports["default"] = HtmlReporter;
-//# sourceMappingURL=index.js.map
-
-/***/ }),
-
-/***/ 85049:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-const path_1 = __nccwpck_require__(71017);
-exports.FORMATS = {
- abap: {
- exts: [],
- },
- actionscript: {
- exts: ['as'],
- },
- ada: {
- exts: ['ada'],
- },
- apacheconf: {
- exts: [],
- },
- apl: {
- exts: ['apl'],
- },
- applescript: {
- exts: [],
- },
- arduino: {
- exts: [],
- },
- arff: {
- exts: [],
- },
- asciidoc: {
- exts: [],
- },
- asm6502: {
- exts: [],
- },
- aspnet: {
- exts: ['asp', 'aspx'],
- },
- autohotkey: {
- exts: [],
- },
- autoit: {
- exts: [],
- },
- bash: {
- exts: ['sh', 'ksh', 'bash'],
- },
- basic: {
- exts: ['bas'],
- },
- batch: {
- exts: [],
- },
- bison: {
- exts: [],
- },
- brainfuck: {
- exts: ['b', 'bf'],
- },
- bro: {
- exts: [],
- },
- c: {
- exts: ['c', 'z80'],
- },
- 'c-header': {
- exts: ['h'],
- parent: 'c',
- },
- clike: {
- exts: [],
- },
- clojure: {
- exts: ['cljs', 'clj', 'cljc', 'cljx', 'edn'],
- },
- coffeescript: {
- exts: ['coffee'],
- },
- comments: {
- exts: []
- },
- cpp: {
- exts: ['cpp', 'c++', 'cc', 'cxx'],
- },
- 'cpp-header': {
- exts: ['hpp', 'h++', 'hh', 'hxx'],
- parent: 'cpp',
- },
- crystal: {
- exts: ['cr'],
- },
- csharp: {
- exts: ['cs'],
- },
- csp: {
- exts: [],
- },
- 'css-extras': {
- exts: [],
- },
- css: {
- exts: ['css', 'gss'],
- },
- d: {
- exts: ['d'],
- },
- dart: {
- exts: ['dart'],
- },
- diff: {
- exts: ['diff', 'patch'],
- },
- django: {
- exts: [],
- },
- docker: {
- exts: [],
- },
- eiffel: {
- exts: ['e'],
- },
- elixir: {
- exts: [],
- },
- elm: {
- exts: ['elm'],
- },
- erb: {
- exts: [],
- },
- erlang: {
- exts: ['erl', 'erlang'],
- },
- flow: {
- exts: [],
- },
- fortran: {
- exts: ['f', 'for', 'f77', 'f90'],
- },
- fsharp: {
- exts: ['fs'],
- },
- gedcom: {
- exts: [],
- },
- gherkin: {
- exts: ['feature'],
- },
- git: {
- exts: [],
- },
- glsl: {
- exts: [],
- },
- go: {
- exts: ['go'],
- },
- graphql: {
- exts: ['graphql'],
- },
- groovy: {
- exts: ['groovy', 'gradle'],
- },
- haml: {
- exts: ['haml'],
- },
- handlebars: {
- exts: ['hb', 'hbs', 'handlebars'],
- },
- haskell: {
- exts: ['hs', 'lhs '],
- },
- haxe: {
- exts: ['hx', 'hxml'],
- },
- hpkp: {
- exts: [],
- },
- hsts: {
- exts: [],
- },
- http: {
- exts: [],
- },
- ichigojam: {
- exts: [],
- },
- icon: {
- exts: [],
- },
- inform7: {
- exts: [],
- },
- ini: {
- exts: ['ini'],
- },
- io: {
- exts: [],
- },
- j: {
- exts: [],
- },
- java: {
- exts: ['java'],
- },
- javascript: {
- exts: ['js', 'es', 'es6', 'mjs', 'cjs'],
- },
- jolie: {
- exts: [],
- },
- json: {
- exts: ['json', 'map', 'jsonld'],
- },
- jsx: {
- exts: ['jsx'],
- },
- julia: {
- exts: ['jl'],
- },
- keymap: {
- exts: [],
- },
- kotlin: {
- exts: ['kt', 'kts'],
- },
- latex: {
- exts: ['tex'],
- },
- less: {
- exts: ['less'],
- },
- liquid: {
- exts: [],
- },
- lisp: {
- exts: ['cl', 'lisp', 'el'],
- },
- livescript: {
- exts: ['ls'],
- },
- lolcode: {
- exts: [],
- },
- lua: {
- exts: ['lua'],
- },
- makefile: {
- exts: [],
- },
- markdown: {
- exts: ['md', 'markdown', 'mkd', 'txt'],
- },
- markup: {
- exts: ['html', 'htm', 'xml', 'xsl', 'xslt', 'svg', 'vue', 'ejs', 'jsp'],
- },
- matlab: {
- exts: [],
- },
- mel: {
- exts: [],
- },
- mizar: {
- exts: [],
- },
- monkey: {
- exts: [],
- },
- n4js: {
- exts: [],
- },
- nasm: {
- exts: [],
- },
- nginx: {
- exts: [],
- },
- nim: {
- exts: [],
- },
- nix: {
- exts: [],
- },
- nsis: {
- exts: ['nsh', 'nsi'],
- },
- objectivec: {
- exts: ['m', 'mm'],
- },
- ocaml: {
- exts: ['ocaml', 'ml', 'mli', 'mll', 'mly'],
- },
- opencl: {
- exts: [],
- },
- oz: {
- exts: ['oz'],
- },
- parigp: {
- exts: [],
- },
- pascal: {
- exts: ['pas', 'p'],
- },
- perl: {
- exts: ['pl', 'pm'],
- },
- php: {
- exts: ['php', 'phtml'],
- },
- plsql: {
- exts: ['plsql'],
- },
- powershell: {
- exts: ['ps1', 'psd1', 'psm1'],
- },
- processing: {
- exts: [],
- },
- prolog: {
- exts: ['pro'],
- },
- properties: {
- exts: ['properties'],
- },
- protobuf: {
- exts: ['proto'],
- },
- pug: {
- exts: ['pug', 'jade'],
- },
- puppet: {
- exts: ['pp', 'puppet'],
- },
- pure: {
- exts: [],
- },
- python: {
- exts: ['py', 'pyx', 'pxd', 'pxi'],
- },
- q: {
- exts: ['q'],
- },
- qore: {
- exts: [],
- },
- r: {
- exts: ['r', 'R'],
- },
- reason: {
- exts: [],
- },
- renpy: {
- exts: [],
- },
- rest: {
- exts: [],
- },
- rip: {
- exts: [],
- },
- roboconf: {
- exts: [],
- },
- ruby: {
- exts: ['rb'],
- },
- rust: {
- exts: ['rs'],
- },
- sas: {
- exts: ['sas'],
- },
- sass: {
- exts: ['sass'],
- },
- scala: {
- exts: ['scala'],
- },
- scheme: {
- exts: ['scm', 'ss'],
- },
- scss: {
- exts: ['scss'],
- },
- smalltalk: {
- exts: ['st'],
- },
- smarty: {
- exts: ['smarty', 'tpl'],
- },
- soy: {
- exts: ['soy'],
- },
- sql: {
- exts: ['sql', 'cql'],
- },
- stylus: {
- exts: ['styl', 'stylus'],
- },
- swift: {
- exts: ['swift'],
- },
- tap: {
- exts: ['tap'],
- },
- tcl: {
- exts: ['tcl'],
- },
- textile: {
- exts: ['textile'],
- },
- tsx: {
- exts: ['tsx'],
- },
- tt2: {
- exts: ['tt2'],
- },
- twig: {
- exts: ['twig'],
- },
- typescript: {
- exts: ['ts', 'mts', 'cts'],
- },
- vbnet: {
- exts: ['vb'],
- },
- velocity: {
- exts: ['vtl'],
- },
- verilog: {
- exts: ['v'],
- },
- vhdl: {
- exts: ['vhd', 'vhdl'],
- },
- vim: {
- exts: [],
- },
- 'visual-basic': {
- exts: ['vb'],
- },
- wasm: {
- exts: [],
- },
- url: {
- exts: [],
- },
- wiki: {
- exts: [],
- },
- xeora: {
- exts: [],
- },
- xojo: {
- exts: [],
- },
- xquery: {
- exts: ['xy', 'xquery'],
- },
- yaml: {
- exts: ['yaml', 'yml'],
- },
-};
-function getSupportedFormats() {
- return Object.keys(exports.FORMATS).filter((name) => name !== 'important' && name !== 'url');
-}
-exports.getSupportedFormats = getSupportedFormats;
-function getFormatByFile(path, formatsExts) {
- const ext = path_1.extname(path).slice(1);
- if (formatsExts && Object.keys(formatsExts).length) {
- return Object.keys(formatsExts).find((format) => formatsExts[format].includes(ext));
- }
- return Object.keys(exports.FORMATS).find((language) => exports.FORMATS[language].exts.includes(ext));
-}
-exports.getFormatByFile = getFormatByFile;
-//# sourceMappingURL=formats.js.map
-
-/***/ }),
-
-/***/ 53524:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-const reprism = __nccwpck_require__(18042);
-const abap = __nccwpck_require__(65444);
-const actionscript = __nccwpck_require__(21019);
-const ada = __nccwpck_require__(99040);
-const apacheconf = __nccwpck_require__(70629);
-const apl = __nccwpck_require__(13529);
-const applescript = __nccwpck_require__(95394);
-const arff = __nccwpck_require__(56245);
-const asciidoc = __nccwpck_require__(86002);
-const asm6502 = __nccwpck_require__(68737);
-const aspnet = __nccwpck_require__(16326);
-const autohotkey = __nccwpck_require__(3183);
-const autoit = __nccwpck_require__(41502);
-const bash = __nccwpck_require__(15209);
-const basic = __nccwpck_require__(46676);
-const batch = __nccwpck_require__(20986);
-const brainfuck = __nccwpck_require__(64636);
-const bro = __nccwpck_require__(57206);
-const c = __nccwpck_require__(98220);
-const clike = __nccwpck_require__(17403);
-const clojure = __nccwpck_require__(45685);
-const coffeescript = __nccwpck_require__(20525);
-const cpp = __nccwpck_require__(26433);
-const csharp = __nccwpck_require__(3204);
-const csp = __nccwpck_require__(12115);
-const cssExtras = __nccwpck_require__(16590);
-const css = __nccwpck_require__(58302);
-const d = __nccwpck_require__(60310);
-const dart = __nccwpck_require__(14572);
-const diff = __nccwpck_require__(35844);
-const django = __nccwpck_require__(97535);
-const docker = __nccwpck_require__(94508);
-const eiffel = __nccwpck_require__(79209);
-const elixir = __nccwpck_require__(74952);
-const erlang = __nccwpck_require__(15691);
-const flow = __nccwpck_require__(53794);
-const fortran = __nccwpck_require__(90374);
-const fsharp = __nccwpck_require__(63354);
-const gedcom = __nccwpck_require__(25605);
-const gherkin = __nccwpck_require__(14194);
-const git = __nccwpck_require__(96602);
-const glsl = __nccwpck_require__(96860);
-const go = __nccwpck_require__(96509);
-const graphql = __nccwpck_require__(6219);
-const groovy = __nccwpck_require__(90897);
-const haml = __nccwpck_require__(33412);
-const handlebars = __nccwpck_require__(62023);
-const haskell = __nccwpck_require__(2524);
-const haxe = __nccwpck_require__(7267);
-const hpkp = __nccwpck_require__(358);
-const hsts = __nccwpck_require__(42669);
-const http = __nccwpck_require__(7378);
-const ichigojam = __nccwpck_require__(79406);
-const icon = __nccwpck_require__(87849);
-const inform7 = __nccwpck_require__(63411);
-const ini = __nccwpck_require__(49597);
-const io = __nccwpck_require__(28985);
-const j = __nccwpck_require__(83738);
-const java = __nccwpck_require__(47998);
-const javascript = __nccwpck_require__(48430);
-const jolie = __nccwpck_require__(37234);
-const json = __nccwpck_require__(96317);
-const jsx = __nccwpck_require__(16054);
-const julia = __nccwpck_require__(18521);
-const keyman = __nccwpck_require__(1453);
-const kotlin = __nccwpck_require__(69707);
-const latex = __nccwpck_require__(78387);
-const less = __nccwpck_require__(25526);
-const liquid = __nccwpck_require__(110);
-const lisp = __nccwpck_require__(5716);
-const livescript = __nccwpck_require__(4273);
-const lolcode = __nccwpck_require__(78908);
-const lua = __nccwpck_require__(28482);
-const makefile = __nccwpck_require__(65822);
-const markdown = __nccwpck_require__(20518);
-const markupTemplating = __nccwpck_require__(8914);
-const markup = __nccwpck_require__(42152);
-const matlab = __nccwpck_require__(21372);
-const mel = __nccwpck_require__(19177);
-const mizar = __nccwpck_require__(37457);
-const monkey = __nccwpck_require__(26314);
-const n4js = __nccwpck_require__(41630);
-const nasm = __nccwpck_require__(57062);
-const nginx = __nccwpck_require__(44909);
-const nim = __nccwpck_require__(64441);
-const nix = __nccwpck_require__(51758);
-const nsis = __nccwpck_require__(47159);
-const objectivec = __nccwpck_require__(41466);
-const ocaml = __nccwpck_require__(20505);
-const opencl = __nccwpck_require__(24484);
-const oz = __nccwpck_require__(70834);
-const parigp = __nccwpck_require__(29775);
-const parser = __nccwpck_require__(28480);
-const pascal = __nccwpck_require__(98305);
-const perl = __nccwpck_require__(46306);
-const phpExtras = __nccwpck_require__(78800);
-const php = __nccwpck_require__(92619);
-const powershell = __nccwpck_require__(31896);
-const processing = __nccwpck_require__(63028);
-const prolog = __nccwpck_require__(11831);
-const properties = __nccwpck_require__(6971);
-const protobuf = __nccwpck_require__(9802);
-const pug = __nccwpck_require__(47602);
-const puppet = __nccwpck_require__(16015);
-const pure = __nccwpck_require__(96047);
-const python = __nccwpck_require__(42212);
-const q = __nccwpck_require__(70061);
-const qore = __nccwpck_require__(97631);
-const r = __nccwpck_require__(20420);
-const reason = __nccwpck_require__(39443);
-const renpy = __nccwpck_require__(48755);
-const rest = __nccwpck_require__(57652);
-const rip = __nccwpck_require__(11090);
-const roboconf = __nccwpck_require__(72149);
-const ruby = __nccwpck_require__(40415);
-const rust = __nccwpck_require__(93399);
-const sas = __nccwpck_require__(96939);
-const sass = __nccwpck_require__(37650);
-const scala = __nccwpck_require__(60988);
-const scheme = __nccwpck_require__(14150);
-const scss = __nccwpck_require__(56838);
-const smalltalk = __nccwpck_require__(81200);
-const smarty = __nccwpck_require__(94171);
-const soy = __nccwpck_require__(89135);
-const stylus = __nccwpck_require__(94920);
-const swift = __nccwpck_require__(58479);
-const tcl = __nccwpck_require__(59758);
-const textile = __nccwpck_require__(38347);
-const tsx = __nccwpck_require__(13220);
-const twig = __nccwpck_require__(99323);
-const typescript = __nccwpck_require__(148);
-const vbnet = __nccwpck_require__(15305);
-const velocity = __nccwpck_require__(16657);
-const verilog = __nccwpck_require__(26734);
-const vhdl = __nccwpck_require__(19450);
-const vim = __nccwpck_require__(38565);
-const visualBasic = __nccwpck_require__(58229);
-const wasm = __nccwpck_require__(63735);
-const wiki = __nccwpck_require__(9213);
-const xeora = __nccwpck_require__(93867);
-const xojo = __nccwpck_require__(81975);
-const yaml = __nccwpck_require__(54163);
-const tap = __nccwpck_require__(33636);
-const sql = __nccwpck_require__(19325);
-const plsql = __nccwpck_require__(23678);
-exports.languages = {
- abap, actionscript, ada, apacheconf, apl, applescript, arff,
- asciidoc, asm6502, aspnet, autohotkey, autoit, bash, basic, batch,
- brainfuck, bro, c, clike, clojure, coffeescript, cpp, csharp, csp, cssExtras,
- css, d, dart, diff, django, docker, eiffel, elixir, erlang, flow, fortran, fsharp,
- gedcom, gherkin, git, glsl, go, graphql, groovy, haml, handlebars, haskell, haxe,
- hpkp, hsts, http, ichigojam, icon, inform7, ini, io, j, java, javascript, jolie,
- json, jsx, julia, keyman, kotlin, latex, less, liquid, lisp, livescript,
- lolcode, lua, makefile, markdown, markupTemplating, markup, matlab, mel, mizar,
- monkey, n4js, nasm, nginx, nim, nix, nsis, objectivec, ocaml, opencl, oz, parigp,
- parser, pascal, perl, php, phpExtras, powershell, processing, prolog,
- properties, protobuf, pug, puppet, pure, python, q, qore, r, reason, renpy, rest,
- rip, roboconf, ruby, rust, sas, sass, scala, scheme, scss, smalltalk, smarty, soy,
- stylus, swift, tcl, textile, twig, typescript, vbnet, velocity, verilog, vhdl,
- vim, visualBasic, wasm, wiki, xeora, xojo, yaml, tsx, sql, plsql, tap
-};
-exports.loadLanguages = () => {
- reprism.loadLanguages(Object.values(exports.languages).map(v => v.default));
-};
-//# sourceMappingURL=grammar-loader.js.map
-
-/***/ }),
-
-/***/ 43439:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-const SparkMD5 = __nccwpck_require__(70220);
-function hash(value) {
- return SparkMD5.hash(value);
-}
-exports.hash = hash;
-//# sourceMappingURL=hash.js.map
-
-/***/ }),
-
-/***/ 92080:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-function __export(m) {
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
-}
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-const tokenize_1 = __nccwpck_require__(74749);
-__export(__nccwpck_require__(74749));
-__export(__nccwpck_require__(78199));
-__export(__nccwpck_require__(85049));
-class Tokenizer {
- generateMaps(id, data, format, options) {
- return tokenize_1.createTokenMapBasedOnCode(id, data, format, options);
- }
-}
-exports.Tokenizer = Tokenizer;
-//# sourceMappingURL=index.js.map
-
-/***/ }),
-
-/***/ 23678:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-const grammar = {
- language: 'plsql',
- init(Prism) {
- Prism.languages.plsql = Prism.languages.extend('sql', {
- comment: [/\/\*[\s\S]*?\*\//, /--.*/],
- });
- if (Prism.util.type(Prism.languages.plsql.keyword) !== 'Array') {
- Prism.languages.plsql.keyword = [Prism.languages.plsql.keyword];
- }
- Prism.languages.plsql.keyword.unshift(/\b(?:ACCESS|AGENT|AGGREGATE|ARRAY|ARROW|AT|ATTRIBUTE|AUDIT|AUTHID|BFILE_BASE|BLOB_BASE|BLOCK|BODY|BOTH|BOUND|BYTE|CALLING|CHAR_BASE|CHARSET(?:FORM|ID)|CLOB_BASE|COLAUTH|COLLECT|CLUSTERS?|COMPILED|COMPRESS|CONSTANT|CONSTRUCTOR|CONTEXT|CRASH|CUSTOMDATUM|DANGLING|DATE_BASE|DEFINE|DETERMINISTIC|DURATION|ELEMENT|EMPTY|EXCEPTIONS?|EXCLUSIVE|EXTERNAL|FINAL|FORALL|FORM|FOUND|GENERAL|HEAP|HIDDEN|IDENTIFIED|IMMEDIATE|INCLUDING|INCREMENT|INDICATOR|INDEXES|INDICES|INFINITE|INITIAL|ISOPEN|INSTANTIABLE|INTERFACE|INVALIDATE|JAVA|LARGE|LEADING|LENGTH|LIBRARY|LIKE[24C]|LIMITED|LONG|LOOP|MAP|MAXEXTENTS|MAXLEN|MEMBER|MINUS|MLSLABEL|MULTISET|NAME|NAN|NATIVE|NEW|NOAUDIT|NOCOMPRESS|NOCOPY|NOTFOUND|NOWAIT|NUMBER(?:_BASE)?|OBJECT|OCI(?:COLL|DATE|DATETIME|DURATION|INTERVAL|LOBLOCATOR|NUMBER|RAW|REF|REFCURSOR|ROWID|STRING|TYPE)|OFFLINE|ONLINE|ONLY|OPAQUE|OPERATOR|ORACLE|ORADATA|ORGANIZATION|ORL(?:ANY|VARY)|OTHERS|OVERLAPS|OVERRIDING|PACKAGE|PARALLEL_ENABLE|PARAMETERS?|PASCAL|PCTFREE|PIPE(?:LINED)?|PRAGMA|PRIOR|PRIVATE|RAISE|RANGE|RAW|RECORD|REF|REFERENCE|REM|REMAINDER|RESULT|RESOURCE|RETURNING|REVERSE|ROW(?:ID|NUM|TYPE)|SAMPLE|SB[124]|SEGMENT|SELF|SEPARATE|SEQUENCE|SHORT|SIZE(?:_T)?|SPARSE|SQL(?:CODE|DATA|NAME|STATE)|STANDARD|STATIC|STDDEV|STORED|STRING|STRUCT|STYLE|SUBMULTISET|SUBPARTITION|SUBSTITUTABLE|SUBTYPE|SUCCESSFUL|SYNONYM|SYSDATE|TABAUTH|TDO|THE|TIMEZONE_(?:ABBR|HOUR|MINUTE|REGION)|TRAILING|TRANSAC(?:TIONAL)?|TRUSTED|UB[124]|UID|UNDER|UNTRUSTED|VALIDATE|VALIST|VARCHAR2|VARIABLE|VARIANCE|VARRAY|VIEWS|VOID|WHENEVER|WRAPPED|ZONE)\b/i);
- if (Prism.util.type(Prism.languages.plsql.operator) !== 'Array') {
- Prism.languages.plsql.operator = [Prism.languages.plsql.operator];
- }
- Prism.languages.plsql.operator.unshift(/:=/);
- },
-};
-exports["default"] = grammar;
-//# sourceMappingURL=plsql.js.map
-
-/***/ }),
-
-/***/ 19325:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-const grammar = {
- language: 'sql',
- init(Prism) {
- Prism.languages.sql = {
- 'comment': {
- pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,
- lookbehind: true,
- },
- 'variable': [
- {
- pattern: /@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,
- greedy: true,
- },
- /@[\w.$]+/,
- ],
- 'string': {
- pattern: /(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,
- greedy: true,
- lookbehind: true,
- },
- 'function': /\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,
- 'keyword': /\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:_INSERT|COL)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURNS?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,
- 'boolean': /\b(?:TRUE|FALSE|NULL)\b/i,
- 'number': /\b0x[\da-f]+\b|\b\d+\.?\d*|\B\.\d+\b/i,
- 'operator': /[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|IN|LIKE|NOT|OR|IS|DIV|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,
- 'punctuation': /[;[\]()`,.]/,
- };
- },
-};
-exports["default"] = grammar;
-//# sourceMappingURL=sql.js.map
-
-/***/ }),
-
-/***/ 33636:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-const grammar = {
- language: 'tap',
- init(Prism) {
- Prism.languages.tap = {
- fail: /not ok[^#{\n\r]*/,
- pass: /ok[^#{\n\r]*/,
- pragma: /pragma [+-][a-z]+/,
- bailout: /bail out!.*/i,
- version: /TAP version \d+/i,
- plan: /\d+\.\.\d+(?: +#.*)?/,
- subtest: {
- pattern: /# Subtest(?:: .*)?/,
- greedy: true
- },
- punctuation: /[{}]/,
- directive: /#.*/,
- yamlish: {
- pattern: /(^[ \t]*)---[\s\S]*?[\r\n][ \t]*\.\.\.$/m,
- lookbehind: true,
- inside: Prism.languages.yaml,
- alias: 'language-yaml'
- }
- };
- },
-};
-exports["default"] = grammar;
-//# sourceMappingURL=tap.js.map
-
-/***/ }),
-
-/***/ 78199:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-const hash_1 = __nccwpck_require__(43439);
-const TOKEN_HASH_LENGTH = 20;
-function createTokenHash(token, hashFunction = undefined) {
- return hashFunction ?
- hashFunction(token.type + token.value).substr(0, TOKEN_HASH_LENGTH) :
- hash_1.hash(token.type + token.value).substr(0, TOKEN_HASH_LENGTH);
-}
-function groupByFormat(tokens) {
- const result = {};
- // TODO change to reduce
- tokens.forEach((token) => {
- (result[token.format] = result[token.format] ? [...result[token.format], token] : [token]);
- });
- return result;
-}
-class TokensMap {
- constructor(id, data, tokens, format, options) {
- this.id = id;
- this.data = data;
- this.tokens = tokens;
- this.format = format;
- this.options = options;
- this.position = 0;
- this.hashMap = this.tokens.map((token) => {
- if (options.ignoreCase) {
- token.value = token.value.toLocaleLowerCase();
- }
- return createTokenHash(token, this.options.hashFunction);
- }).join('');
- }
- getTokensCount() {
- return this.tokens[this.tokens.length - 1].loc.end.position - this.tokens[0].loc.start.position;
- }
- getId() {
- return this.id;
- }
- getLinesCount() {
- return this.tokens[this.tokens.length - 1].loc.end.line - this.tokens[0].loc.start.line;
- }
- getFormat() {
- return this.format;
- }
- [Symbol.iterator]() {
- return this;
- }
- next() {
- const hashFunction = this.options.hashFunction ? this.options.hashFunction : hash_1.hash;
- const mapFrame = hashFunction(this.hashMap.substring(this.position * TOKEN_HASH_LENGTH, this.position * TOKEN_HASH_LENGTH + this.options.minTokens * TOKEN_HASH_LENGTH)).substring(0, TOKEN_HASH_LENGTH);
- if (this.position < this.tokens.length - this.options.minTokens) {
- this.position++;
- return {
- done: false,
- value: {
- id: mapFrame,
- sourceId: this.getId(),
- start: this.tokens[this.position - 1],
- end: this.tokens[this.position + this.options.minTokens - 1],
- },
- };
- }
- else {
- return {
- done: true,
- value: false,
- };
- }
- }
-}
-exports.TokensMap = TokensMap;
-function generateMapsForFormats(id, data, tokens, options) {
- return Object
- .values(groupByFormat(tokens))
- .map((formatTokens) => new TokensMap(id, data, formatTokens, formatTokens[0].format, options));
-}
-exports.generateMapsForFormats = generateMapsForFormats;
-function createTokensMaps(id, data, tokens, options) {
- return generateMapsForFormats(id, data, tokens, options);
-}
-exports.createTokensMaps = createTokensMaps;
-//# sourceMappingURL=token-map.js.map
-
-/***/ }),
-
-/***/ 74749:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-const reprism = __nccwpck_require__(18042);
-const formats_1 = __nccwpck_require__(85049);
-const token_map_1 = __nccwpck_require__(78199);
-const grammar_loader_1 = __nccwpck_require__(53524);
-const ignore = {
- ignore: [
- {
- pattern: /(jscpd:ignore-start)[\s\S]*?(?=jscpd:ignore-end)/,
- lookbehind: true,
- greedy: true,
- },
- {
- pattern: /jscpd:ignore-start/,
- greedy: false,
- },
- {
- pattern: /jscpd:ignore-end/,
- greedy: false,
- },
- ],
-};
-const punctuation = {
- // eslint-disable-next-line @typescript-eslint/camelcase
- new_line: /\n/,
- empty: /\s+/,
-};
-const initializeFormats = () => {
- grammar_loader_1.loadLanguages();
- Object
- .keys(reprism.default.languages)
- .forEach((lang) => {
- if (lang !== 'extend' && lang !== 'insertBefore' && lang !== 'DFS') {
- reprism.default.languages[lang] = Object.assign(Object.assign(Object.assign({}, ignore), reprism.default.languages[lang]), punctuation);
- }
- });
-};
-initializeFormats();
-function getLanguagePrismName(lang) {
- if (lang in formats_1.FORMATS && formats_1.FORMATS[lang].parent) {
- return formats_1.FORMATS[lang].parent;
- }
- return lang;
-}
-function tokenize(code, language) {
- let length = 0;
- let line = 1;
- let column = 1;
- function sanitizeLangName(name) {
- return name && name.replace ? name.replace('language-', '') : 'unknown';
- }
- function createTokenFromString(token, lang) {
- return [
- {
- format: lang,
- type: 'default',
- value: token,
- length: token.length,
- },
- ];
- }
- function calculateLocation(token, position) {
- const result = token;
- const lines = typeof result.value === 'string' && result.value.split ? result.value.split('\n') : [];
- const newLines = lines.length - 1;
- const start = {
- line,
- column,
- position
- };
- column = newLines >= 0 ? lines[lines.length - 1].length + 1 : column;
- const end = {
- line: line + newLines,
- column,
- position
- };
- result.loc = { start, end };
- result.range = [length, length + result.length];
- length += result.length;
- line += newLines;
- return result;
- }
- function createTokenFromFlatToken(token, lang) {
- return [
- {
- format: lang,
- type: token.type,
- value: token.content,
- length: token.length,
- },
- ];
- }
- function createTokens(token, lang) {
- if (token.content && typeof token.content === 'string') {
- return createTokenFromFlatToken(token, lang);
- }
- if (token.content && Array.isArray(token.content)) {
- let res = [];
- token.content.forEach((t) => (res = res.concat(createTokens(t, token.alias ? sanitizeLangName(token.alias) : lang))));
- return res;
- }
- return createTokenFromString(token, lang);
- }
- let tokens = [];
- const grammar = reprism.default.languages[getLanguagePrismName(language)];
- if (!reprism.default.languages[getLanguagePrismName(language)]) {
- console.warn('Warn: jscpd has issue with support of "' + getLanguagePrismName(language) + '"');
- return [];
- }
- reprism.default.tokenize(code, grammar)
- .forEach((t) => (tokens = tokens.concat(createTokens(t, language))));
- return tokens
- .filter((t) => t.format in formats_1.FORMATS)
- .map((token, index) => calculateLocation(token, index));
-}
-exports.tokenize = tokenize;
-function setupIgnorePatterns(format, ignorePattern) {
- const language = getLanguagePrismName(format);
- const ignorePatterns = ignorePattern.map(pattern => ({
- pattern: new RegExp(pattern),
- greedy: false,
- }));
- reprism.default.languages[language] = Object.assign(Object.assign({}, ignorePatterns), reprism.default.languages[language]);
-}
-function createTokenMapBasedOnCode(id, data, format, options = {}) {
- const { mode, ignoreCase, ignorePattern } = options;
- const tokens = tokenize(data, format)
- .filter((token) => mode(token, options));
- if (ignorePattern)
- setupIgnorePatterns(format, options.ignorePattern);
- if (ignoreCase) {
- return token_map_1.createTokensMaps(id, data, tokens.map((token) => {
- token.value = token.value.toLocaleLowerCase();
- return token;
- }), options);
- }
- return token_map_1.createTokensMaps(id, data, tokens, options);
-}
-exports.createTokenMapBasedOnCode = createTokenMapBasedOnCode;
-//# sourceMappingURL=tokenize.js.map
-
/***/ }),
/***/ 63803:
@@ -59474,24 +57446,6 @@ class Agent extends http.Agent {
exports.Agent = Agent;
//# sourceMappingURL=index.js.map
-/***/ }),
-
-/***/ 65063:
-/***/ ((module) => {
-
-"use strict";
-
-
-module.exports = ({onlyFirst = false} = {}) => {
- const pattern = [
- '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
- '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'
- ].join('|');
-
- return new RegExp(pattern, onlyFirst ? undefined : 'g');
-};
-
-
/***/ }),
/***/ 81231:
@@ -68197,69107 +66151,61426 @@ exports["default"] = assertNever;
wrapAsync(task)((err, ...args) => {
if (err === false) return taskCb(err);
- if (args.length < 2) {
- [result] = args;
- } else {
- result = args;
- }
- error = err;
- taskCb(err ? null : {});
- });
- }, () => callback(error, result));
- }
-
- var tryEach$1 = awaitify(tryEach);
-
- /**
- * Undoes a [memoize]{@link module:Utils.memoize}d function, reverting it to the original,
- * unmemoized form. Handy for testing.
- *
- * @name unmemoize
- * @static
- * @memberOf module:Utils
- * @method
- * @see [async.memoize]{@link module:Utils.memoize}
- * @category Util
- * @param {AsyncFunction} fn - the memoized function
- * @returns {AsyncFunction} a function that calls the original unmemoized function
- */
- function unmemoize(fn) {
- return (...args) => {
- return (fn.unmemoized || fn)(...args);
- };
- }
-
- /**
- * Repeatedly call `iteratee`, while `test` returns `true`. Calls `callback` when
- * stopped, or an error occurs.
- *
- * @name whilst
- * @static
- * @memberOf module:ControlFlow
- * @method
- * @category Control Flow
- * @param {AsyncFunction} test - asynchronous truth test to perform before each
- * execution of `iteratee`. Invoked with (callback).
- * @param {AsyncFunction} iteratee - An async function which is called each time
- * `test` passes. Invoked with (callback).
- * @param {Function} [callback] - A callback which is called after the test
- * function has failed and repeated execution of `iteratee` has stopped. `callback`
- * will be passed an error and any arguments passed to the final `iteratee`'s
- * callback. Invoked with (err, [results]);
- * @returns {Promise} a promise, if no callback is passed
- * @example
- *
- * var count = 0;
- * async.whilst(
- * function test(cb) { cb(null, count < 5); },
- * function iter(callback) {
- * count++;
- * setTimeout(function() {
- * callback(null, count);
- * }, 1000);
- * },
- * function (err, n) {
- * // 5 seconds have passed, n = 5
- * }
- * );
- */
- function whilst(test, iteratee, callback) {
- callback = onlyOnce(callback);
- var _fn = wrapAsync(iteratee);
- var _test = wrapAsync(test);
- var results = [];
-
- function next(err, ...rest) {
- if (err) return callback(err);
- results = rest;
- if (err === false) return;
- _test(check);
- }
-
- function check(err, truth) {
- if (err) return callback(err);
- if (err === false) return;
- if (!truth) return callback(null, ...results);
- _fn(next);
- }
-
- return _test(check);
- }
- var whilst$1 = awaitify(whilst, 3);
-
- /**
- * Repeatedly call `iteratee` until `test` returns `true`. Calls `callback` when
- * stopped, or an error occurs. `callback` will be passed an error and any
- * arguments passed to the final `iteratee`'s callback.
- *
- * The inverse of [whilst]{@link module:ControlFlow.whilst}.
- *
- * @name until
- * @static
- * @memberOf module:ControlFlow
- * @method
- * @see [async.whilst]{@link module:ControlFlow.whilst}
- * @category Control Flow
- * @param {AsyncFunction} test - asynchronous truth test to perform before each
- * execution of `iteratee`. Invoked with (callback).
- * @param {AsyncFunction} iteratee - An async function which is called each time
- * `test` fails. Invoked with (callback).
- * @param {Function} [callback] - A callback which is called after the test
- * function has passed and repeated execution of `iteratee` has stopped. `callback`
- * will be passed an error and any arguments passed to the final `iteratee`'s
- * callback. Invoked with (err, [results]);
- * @returns {Promise} a promise, if a callback is not passed
- *
- * @example
- * const results = []
- * let finished = false
- * async.until(function test(cb) {
- * cb(null, finished)
- * }, function iter(next) {
- * fetchPage(url, (err, body) => {
- * if (err) return next(err)
- * results = results.concat(body.objects)
- * finished = !!body.next
- * next(err)
- * })
- * }, function done (err) {
- * // all pages have been fetched
- * })
- */
- function until(test, iteratee, callback) {
- const _test = wrapAsync(test);
- return whilst$1((cb) => _test((err, truth) => cb (err, !truth)), iteratee, callback);
- }
-
- /**
- * Runs the `tasks` array of functions in series, each passing their results to
- * the next in the array. However, if any of the `tasks` pass an error to their
- * own callback, the next function is not executed, and the main `callback` is
- * immediately called with the error.
- *
- * @name waterfall
- * @static
- * @memberOf module:ControlFlow
- * @method
- * @category Control Flow
- * @param {Array} tasks - An array of [async functions]{@link AsyncFunction}
- * to run.
- * Each function should complete with any number of `result` values.
- * The `result` values will be passed as arguments, in order, to the next task.
- * @param {Function} [callback] - An optional callback to run once all the
- * functions have completed. This will be passed the results of the last task's
- * callback. Invoked with (err, [results]).
- * @returns {Promise} a promise, if a callback is omitted
- * @example
- *
- * async.waterfall([
- * function(callback) {
- * callback(null, 'one', 'two');
- * },
- * function(arg1, arg2, callback) {
- * // arg1 now equals 'one' and arg2 now equals 'two'
- * callback(null, 'three');
- * },
- * function(arg1, callback) {
- * // arg1 now equals 'three'
- * callback(null, 'done');
- * }
- * ], function (err, result) {
- * // result now equals 'done'
- * });
- *
- * // Or, with named functions:
- * async.waterfall([
- * myFirstFunction,
- * mySecondFunction,
- * myLastFunction,
- * ], function (err, result) {
- * // result now equals 'done'
- * });
- * function myFirstFunction(callback) {
- * callback(null, 'one', 'two');
- * }
- * function mySecondFunction(arg1, arg2, callback) {
- * // arg1 now equals 'one' and arg2 now equals 'two'
- * callback(null, 'three');
- * }
- * function myLastFunction(arg1, callback) {
- * // arg1 now equals 'three'
- * callback(null, 'done');
- * }
- */
- function waterfall (tasks, callback) {
- callback = once(callback);
- if (!Array.isArray(tasks)) return callback(new Error('First argument to waterfall must be an array of functions'));
- if (!tasks.length) return callback();
- var taskIndex = 0;
-
- function nextTask(args) {
- var task = wrapAsync(tasks[taskIndex++]);
- task(...args, onlyOnce(next));
- }
-
- function next(err, ...args) {
- if (err === false) return
- if (err || taskIndex === tasks.length) {
- return callback(err, ...args);
- }
- nextTask(args);
- }
-
- nextTask([]);
- }
-
- var waterfall$1 = awaitify(waterfall);
-
- /**
- * An "async function" in the context of Async is an asynchronous function with
- * a variable number of parameters, with the final parameter being a callback.
- * (`function (arg1, arg2, ..., callback) {}`)
- * The final callback is of the form `callback(err, results...)`, which must be
- * called once the function is completed. The callback should be called with a
- * Error as its first argument to signal that an error occurred.
- * Otherwise, if no error occurred, it should be called with `null` as the first
- * argument, and any additional `result` arguments that may apply, to signal
- * successful completion.
- * The callback must be called exactly once, ideally on a later tick of the
- * JavaScript event loop.
- *
- * This type of function is also referred to as a "Node-style async function",
- * or a "continuation passing-style function" (CPS). Most of the methods of this
- * library are themselves CPS/Node-style async functions, or functions that
- * return CPS/Node-style async functions.
- *
- * Wherever we accept a Node-style async function, we also directly accept an
- * [ES2017 `async` function]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function}.
- * In this case, the `async` function will not be passed a final callback
- * argument, and any thrown error will be used as the `err` argument of the
- * implicit callback, and the return value will be used as the `result` value.
- * (i.e. a `rejected` of the returned Promise becomes the `err` callback
- * argument, and a `resolved` value becomes the `result`.)
- *
- * Note, due to JavaScript limitations, we can only detect native `async`
- * functions and not transpilied implementations.
- * Your environment must have `async`/`await` support for this to work.
- * (e.g. Node > v7.6, or a recent version of a modern browser).
- * If you are using `async` functions through a transpiler (e.g. Babel), you
- * must still wrap the function with [asyncify]{@link module:Utils.asyncify},
- * because the `async function` will be compiled to an ordinary function that
- * returns a promise.
- *
- * @typedef {Function} AsyncFunction
- * @static
- */
-
-
- var index = {
- apply,
- applyEach,
- applyEachSeries,
- asyncify,
- auto,
- autoInject,
- cargo: cargo$1,
- cargoQueue: cargo,
- compose,
- concat: concat$1,
- concatLimit: concatLimit$1,
- concatSeries: concatSeries$1,
- constant: constant$1,
- detect: detect$1,
- detectLimit: detectLimit$1,
- detectSeries: detectSeries$1,
- dir,
- doUntil,
- doWhilst: doWhilst$1,
- each,
- eachLimit: eachLimit$1,
- eachOf: eachOf$1,
- eachOfLimit: eachOfLimit$1,
- eachOfSeries: eachOfSeries$1,
- eachSeries: eachSeries$1,
- ensureAsync,
- every: every$1,
- everyLimit: everyLimit$1,
- everySeries: everySeries$1,
- filter: filter$1,
- filterLimit: filterLimit$1,
- filterSeries: filterSeries$1,
- forever: forever$1,
- groupBy,
- groupByLimit: groupByLimit$1,
- groupBySeries,
- log,
- map: map$1,
- mapLimit: mapLimit$1,
- mapSeries: mapSeries$1,
- mapValues,
- mapValuesLimit: mapValuesLimit$1,
- mapValuesSeries,
- memoize,
- nextTick,
- parallel,
- parallelLimit,
- priorityQueue,
- queue,
- race: race$1,
- reduce: reduce$1,
- reduceRight,
- reflect,
- reflectAll,
- reject: reject$1,
- rejectLimit: rejectLimit$1,
- rejectSeries: rejectSeries$1,
- retry,
- retryable,
- seq,
- series,
- setImmediate: setImmediate$1,
- some: some$1,
- someLimit: someLimit$1,
- someSeries: someSeries$1,
- sortBy: sortBy$1,
- timeout,
- times,
- timesLimit,
- timesSeries,
- transform,
- tryEach: tryEach$1,
- unmemoize,
- until,
- waterfall: waterfall$1,
- whilst: whilst$1,
-
- // aliases
- all: every$1,
- allLimit: everyLimit$1,
- allSeries: everySeries$1,
- any: some$1,
- anyLimit: someLimit$1,
- anySeries: someSeries$1,
- find: detect$1,
- findLimit: detectLimit$1,
- findSeries: detectSeries$1,
- flatMap: concat$1,
- flatMapLimit: concatLimit$1,
- flatMapSeries: concatSeries$1,
- forEach: each,
- forEachSeries: eachSeries$1,
- forEachLimit: eachLimit$1,
- forEachOf: eachOf$1,
- forEachOfSeries: eachOfSeries$1,
- forEachOfLimit: eachOfLimit$1,
- inject: reduce$1,
- foldl: reduce$1,
- foldr: reduceRight,
- select: filter$1,
- selectLimit: filterLimit$1,
- selectSeries: filterSeries$1,
- wrapSync: asyncify,
- during: whilst$1,
- doDuring: doWhilst$1
- };
-
- exports.all = every$1;
- exports.allLimit = everyLimit$1;
- exports.allSeries = everySeries$1;
- exports.any = some$1;
- exports.anyLimit = someLimit$1;
- exports.anySeries = someSeries$1;
- exports.apply = apply;
- exports.applyEach = applyEach;
- exports.applyEachSeries = applyEachSeries;
- exports.asyncify = asyncify;
- exports.auto = auto;
- exports.autoInject = autoInject;
- exports.cargo = cargo$1;
- exports.cargoQueue = cargo;
- exports.compose = compose;
- exports.concat = concat$1;
- exports.concatLimit = concatLimit$1;
- exports.concatSeries = concatSeries$1;
- exports.constant = constant$1;
- exports.default = index;
- exports.detect = detect$1;
- exports.detectLimit = detectLimit$1;
- exports.detectSeries = detectSeries$1;
- exports.dir = dir;
- exports.doDuring = doWhilst$1;
- exports.doUntil = doUntil;
- exports.doWhilst = doWhilst$1;
- exports.during = whilst$1;
- exports.each = each;
- exports.eachLimit = eachLimit$1;
- exports.eachOf = eachOf$1;
- exports.eachOfLimit = eachOfLimit$1;
- exports.eachOfSeries = eachOfSeries$1;
- exports.eachSeries = eachSeries$1;
- exports.ensureAsync = ensureAsync;
- exports.every = every$1;
- exports.everyLimit = everyLimit$1;
- exports.everySeries = everySeries$1;
- exports.filter = filter$1;
- exports.filterLimit = filterLimit$1;
- exports.filterSeries = filterSeries$1;
- exports.find = detect$1;
- exports.findLimit = detectLimit$1;
- exports.findSeries = detectSeries$1;
- exports.flatMap = concat$1;
- exports.flatMapLimit = concatLimit$1;
- exports.flatMapSeries = concatSeries$1;
- exports.foldl = reduce$1;
- exports.foldr = reduceRight;
- exports.forEach = each;
- exports.forEachLimit = eachLimit$1;
- exports.forEachOf = eachOf$1;
- exports.forEachOfLimit = eachOfLimit$1;
- exports.forEachOfSeries = eachOfSeries$1;
- exports.forEachSeries = eachSeries$1;
- exports.forever = forever$1;
- exports.groupBy = groupBy;
- exports.groupByLimit = groupByLimit$1;
- exports.groupBySeries = groupBySeries;
- exports.inject = reduce$1;
- exports.log = log;
- exports.map = map$1;
- exports.mapLimit = mapLimit$1;
- exports.mapSeries = mapSeries$1;
- exports.mapValues = mapValues;
- exports.mapValuesLimit = mapValuesLimit$1;
- exports.mapValuesSeries = mapValuesSeries;
- exports.memoize = memoize;
- exports.nextTick = nextTick;
- exports.parallel = parallel;
- exports.parallelLimit = parallelLimit;
- exports.priorityQueue = priorityQueue;
- exports.queue = queue;
- exports.race = race$1;
- exports.reduce = reduce$1;
- exports.reduceRight = reduceRight;
- exports.reflect = reflect;
- exports.reflectAll = reflectAll;
- exports.reject = reject$1;
- exports.rejectLimit = rejectLimit$1;
- exports.rejectSeries = rejectSeries$1;
- exports.retry = retry;
- exports.retryable = retryable;
- exports.select = filter$1;
- exports.selectLimit = filterLimit$1;
- exports.selectSeries = filterSeries$1;
- exports.seq = seq;
- exports.series = series;
- exports.setImmediate = setImmediate$1;
- exports.some = some$1;
- exports.someLimit = someLimit$1;
- exports.someSeries = someSeries$1;
- exports.sortBy = sortBy$1;
- exports.timeout = timeout;
- exports.times = times;
- exports.timesLimit = timesLimit;
- exports.timesSeries = timesSeries;
- exports.transform = transform;
- exports.tryEach = tryEach$1;
- exports.unmemoize = unmemoize;
- exports.until = until;
- exports.waterfall = waterfall$1;
- exports.whilst = whilst$1;
- exports.wrapSync = asyncify;
-
- Object.defineProperty(exports, '__esModule', { value: true });
-
-}));
-
-
-/***/ }),
-
-/***/ 25995:
-/***/ ((module) => {
-
-module.exports = r => {
- const n = process.versions.node.split('.').map(x => parseInt(x, 10))
- r = r.split('.').map(x => parseInt(x, 10))
- return n[0] > r[0] || (n[0] === r[0] && (n[1] > r[1] || (n[1] === r[1] && n[2] >= r[2])))
-}
-
-
-/***/ }),
-
-/***/ 33497:
-/***/ ((module) => {
-
-function isBuffer (value) {
- return Buffer.isBuffer(value) || value instanceof Uint8Array
-}
-
-function isEncoding (encoding) {
- return Buffer.isEncoding(encoding)
-}
-
-function alloc (size, fill, encoding) {
- return Buffer.alloc(size, fill, encoding)
-}
-
-function allocUnsafe (size) {
- return Buffer.allocUnsafe(size)
-}
-
-function allocUnsafeSlow (size) {
- return Buffer.allocUnsafeSlow(size)
-}
-
-function byteLength (string, encoding) {
- return Buffer.byteLength(string, encoding)
-}
-
-function compare (a, b) {
- return Buffer.compare(a, b)
-}
-
-function concat (buffers, totalLength) {
- return Buffer.concat(buffers, totalLength)
-}
-
-function copy (source, target, targetStart, start, end) {
- return toBuffer(source).copy(target, targetStart, start, end)
-}
-
-function equals (a, b) {
- return toBuffer(a).equals(b)
-}
-
-function fill (buffer, value, offset, end, encoding) {
- return toBuffer(buffer).fill(value, offset, end, encoding)
-}
-
-function from (value, encodingOrOffset, length) {
- return Buffer.from(value, encodingOrOffset, length)
-}
-
-function includes (buffer, value, byteOffset, encoding) {
- return toBuffer(buffer).includes(value, byteOffset, encoding)
-}
-
-function indexOf (buffer, value, byfeOffset, encoding) {
- return toBuffer(buffer).indexOf(value, byfeOffset, encoding)
-}
-
-function lastIndexOf (buffer, value, byteOffset, encoding) {
- return toBuffer(buffer).lastIndexOf(value, byteOffset, encoding)
-}
-
-function swap16 (buffer) {
- return toBuffer(buffer).swap16()
-}
-
-function swap32 (buffer) {
- return toBuffer(buffer).swap32()
-}
-
-function swap64 (buffer) {
- return toBuffer(buffer).swap64()
-}
-
-function toBuffer (buffer) {
- if (Buffer.isBuffer(buffer)) return buffer
- return Buffer.from(buffer.buffer, buffer.byteOffset, buffer.byteLength)
-}
-
-function toString (buffer, encoding, start, end) {
- return toBuffer(buffer).toString(encoding, start, end)
-}
-
-function write (buffer, string, offset, length, encoding) {
- return toBuffer(buffer).write(string, offset, length, encoding)
-}
-
-function writeDoubleLE (buffer, value, offset) {
- return toBuffer(buffer).writeDoubleLE(value, offset)
-}
-
-function writeFloatLE (buffer, value, offset) {
- return toBuffer(buffer).writeFloatLE(value, offset)
-}
-
-function writeUInt32LE (buffer, value, offset) {
- return toBuffer(buffer).writeUInt32LE(value, offset)
-}
-
-function writeInt32LE (buffer, value, offset) {
- return toBuffer(buffer).writeInt32LE(value, offset)
-}
-
-function readDoubleLE (buffer, offset) {
- return toBuffer(buffer).readDoubleLE(offset)
-}
-
-function readFloatLE (buffer, offset) {
- return toBuffer(buffer).readFloatLE(offset)
-}
-
-function readUInt32LE (buffer, offset) {
- return toBuffer(buffer).readUInt32LE(offset)
-}
-
-function readInt32LE (buffer, offset) {
- return toBuffer(buffer).readInt32LE(offset)
-}
-
-function writeDoubleBE (buffer, value, offset) {
- return toBuffer(buffer).writeDoubleBE(value, offset)
-}
-
-function writeFloatBE (buffer, value, offset) {
- return toBuffer(buffer).writeFloatBE(value, offset)
-}
-
-function writeUInt32BE (buffer, value, offset) {
- return toBuffer(buffer).writeUInt32BE(value, offset)
-}
-
-function writeInt32BE (buffer, value, offset) {
- return toBuffer(buffer).writeInt32BE(value, offset)
-}
-
-function readDoubleBE (buffer, offset) {
- return toBuffer(buffer).readDoubleBE(offset)
-}
-
-function readFloatBE (buffer, offset) {
- return toBuffer(buffer).readFloatBE(offset)
-}
-
-function readUInt32BE (buffer, offset) {
- return toBuffer(buffer).readUInt32BE(offset)
-}
-
-function readInt32BE (buffer, offset) {
- return toBuffer(buffer).readInt32BE(offset)
-}
-
-module.exports = {
- isBuffer,
- isEncoding,
- alloc,
- allocUnsafe,
- allocUnsafeSlow,
- byteLength,
- compare,
- concat,
- copy,
- equals,
- fill,
- from,
- includes,
- indexOf,
- lastIndexOf,
- swap16,
- swap32,
- swap64,
- toBuffer,
- toString,
- write,
- writeDoubleLE,
- writeFloatLE,
- writeUInt32LE,
- writeInt32LE,
- readDoubleLE,
- readFloatLE,
- readUInt32LE,
- readInt32LE,
- writeDoubleBE,
- writeFloatBE,
- writeUInt32BE,
- writeInt32BE,
- readDoubleBE,
- readFloatBE,
- readUInt32BE,
- readInt32BE
-
-}
-
-
-/***/ }),
-
-/***/ 18098:
-/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
-
-"use strict";
-
-var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
-}) : (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- o[k2] = m[k];
-}));
-var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
- Object.defineProperty(o, "default", { enumerable: true, value: v });
-}) : function(o, v) {
- o["default"] = v;
-});
-var __importStar = (this && this.__importStar) || function (mod) {
- if (mod && mod.__esModule) return mod;
- var result = {};
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
- __setModuleDefault(result, mod);
- return result;
-};
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-const t = __importStar(__nccwpck_require__(7912));
-if (!(Array.isArray(t.TYPES) &&
- t.TYPES.every((t) => typeof t === 'string'))) {
- throw new Error('@babel/types TYPES does not match the expected type.');
-}
-const FLIPPED_ALIAS_KEYS = t
- .FLIPPED_ALIAS_KEYS;
-const TYPES = new Set(t.TYPES);
-if (!(FLIPPED_ALIAS_KEYS &&
- // tslint:disable-next-line: strict-type-predicates
- typeof FLIPPED_ALIAS_KEYS === 'object' &&
- Object.keys(FLIPPED_ALIAS_KEYS).every((key) => Array.isArray(FLIPPED_ALIAS_KEYS[key]) &&
- // tslint:disable-next-line: strict-type-predicates
- FLIPPED_ALIAS_KEYS[key].every((v) => typeof v === 'string')))) {
- throw new Error('@babel/types FLIPPED_ALIAS_KEYS does not match the expected type.');
-}
-/**
- * This serves thre functions:
- *
- * 1. Take any "aliases" and explode them to refecence the concrete types
- * 2. Normalize all handlers to have an `{enter, exit}` pair, rather than raw functions
- * 3. make the enter and exit handlers arrays, so that multiple handlers can be merged
- */
-function explode(input) {
- const results = {};
- for (const key in input) {
- const aliases = FLIPPED_ALIAS_KEYS[key];
- if (aliases) {
- for (const concreteKey of aliases) {
- if (concreteKey in results) {
- if (typeof input[key] === 'function') {
- results[concreteKey].enter.push(input[key]);
- }
- else {
- if (input[key].enter)
- results[concreteKey].enter.push(input[key].enter);
- if (input[key].exit)
- results[concreteKey].exit.push(input[key].exit);
- }
- }
- else {
- if (typeof input[key] === 'function') {
- results[concreteKey] = {
- enter: [input[key]],
- exit: [],
- };
- }
- else {
- results[concreteKey] = {
- enter: input[key].enter ? [input[key].enter] : [],
- exit: input[key].exit ? [input[key].exit] : [],
- };
- }
- }
- }
- }
- else if (TYPES.has(key)) {
- if (key in results) {
- if (typeof input[key] === 'function') {
- results[key].enter.push(input[key]);
- }
- else {
- if (input[key].enter)
- results[key].enter.push(input[key].enter);
- if (input[key].exit)
- results[key].exit.push(input[key].exit);
- }
- }
- else {
- if (typeof input[key] === 'function') {
- results[key] = {
- enter: [input[key]],
- exit: [],
- };
- }
- else {
- results[key] = {
- enter: input[key].enter ? [input[key].enter] : [],
- exit: input[key].exit ? [input[key].exit] : [],
- };
- }
- }
- }
- }
- return results;
-}
-exports["default"] = explode;
-//# sourceMappingURL=explode.js.map
-
-/***/ }),
-
-/***/ 6407:
-/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
-
-"use strict";
-
-var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
-}) : (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- o[k2] = m[k];
-}));
-var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
- Object.defineProperty(o, "default", { enumerable: true, value: v });
-}) : function(o, v) {
- o["default"] = v;
-});
-var __importStar = (this && this.__importStar) || function (mod) {
- if (mod && mod.__esModule) return mod;
- var result = {};
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
- __setModuleDefault(result, mod);
- return result;
-};
-var __importDefault = (this && this.__importDefault) || function (mod) {
- return (mod && mod.__esModule) ? mod : { "default": mod };
-};
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.recursive = exports.ancestor = exports.simple = void 0;
-const t = __importStar(__nccwpck_require__(7912));
-const explode_1 = __importDefault(__nccwpck_require__(18098));
-const VISITOR_KEYS = t.VISITOR_KEYS;
-if (!(VISITOR_KEYS &&
- // tslint:disable-next-line: strict-type-predicates
- typeof VISITOR_KEYS === 'object' &&
- Object.keys(VISITOR_KEYS).every((key) => Array.isArray(VISITOR_KEYS[key]) &&
- // tslint:disable-next-line: strict-type-predicates
- VISITOR_KEYS[key].every((v) => typeof v === 'string')))) {
- throw new Error('@babel/types VISITOR_KEYS does not match the expected type.');
-}
-function simple(visitors) {
- const vis = explode_1.default(visitors);
- return (node, state) => {
- (function recurse(node) {
- if (!node)
- return;
- const visitor = vis[node.type];
- if (visitor === null || visitor === void 0 ? void 0 : visitor.enter) {
- for (const v of visitor.enter) {
- v(node, state);
- }
- }
- for (const key of VISITOR_KEYS[node.type] || []) {
- const subNode = node[key];
- if (Array.isArray(subNode)) {
- for (const subSubNode of subNode) {
- recurse(subSubNode);
- }
- }
- else {
- recurse(subNode);
- }
- }
- if (visitor === null || visitor === void 0 ? void 0 : visitor.exit) {
- for (const v of visitor.exit) {
- v(node, state);
- }
- }
- })(node);
- };
-}
-exports.simple = simple;
-function ancestor(visitors) {
- const vis = explode_1.default(visitors);
- return (node, state) => {
- const ancestors = [];
- (function recurse(node) {
- if (!node)
- return;
- const visitor = vis[node.type];
- const isNew = node !== ancestors[ancestors.length - 1];
- if (isNew)
- ancestors.push(node);
- if (visitor === null || visitor === void 0 ? void 0 : visitor.enter) {
- for (const v of visitor.enter) {
- v(node, state, ancestors);
- }
- }
- for (const key of VISITOR_KEYS[node.type] || []) {
- const subNode = node[key];
- if (Array.isArray(subNode)) {
- for (const subSubNode of subNode) {
- recurse(subSubNode);
- }
- }
- else {
- recurse(subNode);
- }
- }
- if (visitor === null || visitor === void 0 ? void 0 : visitor.exit) {
- for (const v of visitor.exit) {
- v(node, state, ancestors);
- }
- }
- if (isNew)
- ancestors.pop();
- })(node);
- };
-}
-exports.ancestor = ancestor;
-function recursive(visitors) {
- const vis = explode_1.default(visitors);
- return (node, state) => {
- (function recurse(node) {
- if (!node)
- return;
- const visitor = vis[node.type];
- if (visitor === null || visitor === void 0 ? void 0 : visitor.enter) {
- for (const v of visitor.enter) {
- v(node, state, recurse);
- }
- }
- else {
- for (const key of VISITOR_KEYS[node.type] || []) {
- const subNode = node[key];
- if (Array.isArray(subNode)) {
- for (const subSubNode of subNode) {
- recurse(subSubNode);
- }
- }
- else {
- recurse(subNode);
- }
- }
- }
- })(node);
- };
-}
-exports.recursive = recursive;
-//# sourceMappingURL=index.js.map
-
-/***/ }),
-
-/***/ 9417:
-/***/ ((module) => {
-
-"use strict";
-
-module.exports = balanced;
-function balanced(a, b, str) {
- if (a instanceof RegExp) a = maybeMatch(a, str);
- if (b instanceof RegExp) b = maybeMatch(b, str);
-
- var r = range(a, b, str);
-
- return r && {
- start: r[0],
- end: r[1],
- pre: str.slice(0, r[0]),
- body: str.slice(r[0] + a.length, r[1]),
- post: str.slice(r[1] + b.length)
- };
-}
-
-function maybeMatch(reg, str) {
- var m = str.match(reg);
- return m ? m[0] : null;
-}
-
-balanced.range = range;
-function range(a, b, str) {
- var begs, beg, left, right, result;
- var ai = str.indexOf(a);
- var bi = str.indexOf(b, ai + 1);
- var i = ai;
-
- if (ai >= 0 && bi > 0) {
- if(a===b) {
- return [ai, bi];
- }
- begs = [];
- left = str.length;
-
- while (i >= 0 && !result) {
- if (i == ai) {
- begs.push(i);
- ai = str.indexOf(a, i + 1);
- } else if (begs.length == 1) {
- result = [ begs.pop(), bi ];
- } else {
- beg = begs.pop();
- if (beg < left) {
- left = beg;
- right = bi;
- }
-
- bi = str.indexOf(b, i + 1);
- }
-
- i = ai < bi && ai >= 0 ? ai : bi;
- }
-
- if (begs.length) {
- result = [ left, right ];
- }
- }
-
- return result;
-}
-
-
-/***/ }),
-
-/***/ 83682:
-/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
-
-var register = __nccwpck_require__(44670)
-var addHook = __nccwpck_require__(5549)
-var removeHook = __nccwpck_require__(6819)
-
-// bind with array of arguments: https://stackoverflow.com/a/21792913
-var bind = Function.bind
-var bindable = bind.bind(bind)
-
-function bindApi (hook, state, name) {
- var removeHookRef = bindable(removeHook, null).apply(null, name ? [state, name] : [state])
- hook.api = { remove: removeHookRef }
- hook.remove = removeHookRef
-
- ;['before', 'error', 'after', 'wrap'].forEach(function (kind) {
- var args = name ? [state, kind, name] : [state, kind]
- hook[kind] = hook.api[kind] = bindable(addHook, null).apply(null, args)
- })
-}
-
-function HookSingular () {
- var singularHookName = 'h'
- var singularHookState = {
- registry: {}
- }
- var singularHook = register.bind(null, singularHookState, singularHookName)
- bindApi(singularHook, singularHookState, singularHookName)
- return singularHook
-}
-
-function HookCollection () {
- var state = {
- registry: {}
- }
-
- var hook = register.bind(null, state)
- bindApi(hook, state)
-
- return hook
-}
-
-var collectionHookDeprecationMessageDisplayed = false
-function Hook () {
- if (!collectionHookDeprecationMessageDisplayed) {
- console.warn('[before-after-hook]: "Hook()" repurposing warning, use "Hook.Collection()". Read more: https://git.io/upgrade-before-after-hook-to-1.4')
- collectionHookDeprecationMessageDisplayed = true
- }
- return HookCollection()
-}
-
-Hook.Singular = HookSingular.bind()
-Hook.Collection = HookCollection.bind()
-
-module.exports = Hook
-// expose constructors as a named property for TypeScript
-module.exports.Hook = Hook
-module.exports.Singular = Hook.Singular
-module.exports.Collection = Hook.Collection
-
-
-/***/ }),
-
-/***/ 5549:
-/***/ ((module) => {
-
-module.exports = addHook;
-
-function addHook(state, kind, name, hook) {
- var orig = hook;
- if (!state.registry[name]) {
- state.registry[name] = [];
- }
-
- if (kind === "before") {
- hook = function (method, options) {
- return Promise.resolve()
- .then(orig.bind(null, options))
- .then(method.bind(null, options));
- };
- }
-
- if (kind === "after") {
- hook = function (method, options) {
- var result;
- return Promise.resolve()
- .then(method.bind(null, options))
- .then(function (result_) {
- result = result_;
- return orig(result, options);
- })
- .then(function () {
- return result;
- });
- };
- }
-
- if (kind === "error") {
- hook = function (method, options) {
- return Promise.resolve()
- .then(method.bind(null, options))
- .catch(function (error) {
- return orig(error, options);
- });
- };
- }
-
- state.registry[name].push({
- hook: hook,
- orig: orig,
- });
-}
-
-
-/***/ }),
-
-/***/ 44670:
-/***/ ((module) => {
-
-module.exports = register;
-
-function register(state, name, method, options) {
- if (typeof method !== "function") {
- throw new Error("method for before hook must be a function");
- }
-
- if (!options) {
- options = {};
- }
-
- if (Array.isArray(name)) {
- return name.reverse().reduce(function (callback, name) {
- return register.bind(null, state, name, callback, options);
- }, method)();
- }
-
- return Promise.resolve().then(function () {
- if (!state.registry[name]) {
- return method(options);
- }
-
- return state.registry[name].reduce(function (method, registered) {
- return registered.hook.bind(null, method, options);
- }, method)();
- });
-}
-
-
-/***/ }),
-
-/***/ 6819:
-/***/ ((module) => {
-
-module.exports = removeHook;
-
-function removeHook(state, name, method) {
- if (!state.registry[name]) {
- return;
- }
-
- var index = state.registry[name]
- .map(function (registered) {
- return registered.orig;
- })
- .indexOf(method);
-
- if (index === -1) {
- return;
- }
-
- state.registry[name].splice(index, 1);
-}
-
-
-/***/ }),
-
-/***/ 66474:
-/***/ ((module, exports, __nccwpck_require__) => {
-
-var Chainsaw = __nccwpck_require__(46533);
-var EventEmitter = (__nccwpck_require__(82361).EventEmitter);
-var Buffers = __nccwpck_require__(51590);
-var Vars = __nccwpck_require__(13755);
-var Stream = (__nccwpck_require__(12781).Stream);
-
-exports = module.exports = function (bufOrEm, eventName) {
- if (Buffer.isBuffer(bufOrEm)) {
- return exports.parse(bufOrEm);
- }
-
- var s = exports.stream();
- if (bufOrEm && bufOrEm.pipe) {
- bufOrEm.pipe(s);
- }
- else if (bufOrEm) {
- bufOrEm.on(eventName || 'data', function (buf) {
- s.write(buf);
- });
-
- bufOrEm.on('end', function () {
- s.end();
- });
- }
- return s;
-};
-
-exports.stream = function (input) {
- if (input) return exports.apply(null, arguments);
-
- var pending = null;
- function getBytes (bytes, cb, skip) {
- pending = {
- bytes : bytes,
- skip : skip,
- cb : function (buf) {
- pending = null;
- cb(buf);
- },
- };
- dispatch();
- }
-
- var offset = null;
- function dispatch () {
- if (!pending) {
- if (caughtEnd) done = true;
- return;
- }
- if (typeof pending === 'function') {
- pending();
- }
- else {
- var bytes = offset + pending.bytes;
-
- if (buffers.length >= bytes) {
- var buf;
- if (offset == null) {
- buf = buffers.splice(0, bytes);
- if (!pending.skip) {
- buf = buf.slice();
- }
- }
- else {
- if (!pending.skip) {
- buf = buffers.slice(offset, bytes);
- }
- offset = bytes;
- }
-
- if (pending.skip) {
- pending.cb();
- }
- else {
- pending.cb(buf);
- }
- }
- }
- }
-
- function builder (saw) {
- function next () { if (!done) saw.next() }
-
- var self = words(function (bytes, cb) {
- return function (name) {
- getBytes(bytes, function (buf) {
- vars.set(name, cb(buf));
- next();
- });
- };
- });
-
- self.tap = function (cb) {
- saw.nest(cb, vars.store);
- };
-
- self.into = function (key, cb) {
- if (!vars.get(key)) vars.set(key, {});
- var parent = vars;
- vars = Vars(parent.get(key));
-
- saw.nest(function () {
- cb.apply(this, arguments);
- this.tap(function () {
- vars = parent;
- });
- }, vars.store);
- };
-
- self.flush = function () {
- vars.store = {};
- next();
- };
-
- self.loop = function (cb) {
- var end = false;
-
- saw.nest(false, function loop () {
- this.vars = vars.store;
- cb.call(this, function () {
- end = true;
- next();
- }, vars.store);
- this.tap(function () {
- if (end) saw.next()
- else loop.call(this)
- }.bind(this));
- }, vars.store);
- };
-
- self.buffer = function (name, bytes) {
- if (typeof bytes === 'string') {
- bytes = vars.get(bytes);
- }
-
- getBytes(bytes, function (buf) {
- vars.set(name, buf);
- next();
- });
- };
-
- self.skip = function (bytes) {
- if (typeof bytes === 'string') {
- bytes = vars.get(bytes);
- }
-
- getBytes(bytes, function () {
- next();
- });
- };
-
- self.scan = function find (name, search) {
- if (typeof search === 'string') {
- search = new Buffer(search);
- }
- else if (!Buffer.isBuffer(search)) {
- throw new Error('search must be a Buffer or a string');
- }
-
- var taken = 0;
- pending = function () {
- var pos = buffers.indexOf(search, offset + taken);
- var i = pos-offset-taken;
- if (pos !== -1) {
- pending = null;
- if (offset != null) {
- vars.set(
- name,
- buffers.slice(offset, offset + taken + i)
- );
- offset += taken + i + search.length;
- }
- else {
- vars.set(
- name,
- buffers.slice(0, taken + i)
- );
- buffers.splice(0, taken + i + search.length);
- }
- next();
- dispatch();
- } else {
- i = Math.max(buffers.length - search.length - offset - taken, 0);
- }
- taken += i;
- };
- dispatch();
- };
-
- self.peek = function (cb) {
- offset = 0;
- saw.nest(function () {
- cb.call(this, vars.store);
- this.tap(function () {
- offset = null;
- });
- });
- };
-
- return self;
- };
-
- var stream = Chainsaw.light(builder);
- stream.writable = true;
-
- var buffers = Buffers();
-
- stream.write = function (buf) {
- buffers.push(buf);
- dispatch();
- };
-
- var vars = Vars();
-
- var done = false, caughtEnd = false;
- stream.end = function () {
- caughtEnd = true;
- };
-
- stream.pipe = Stream.prototype.pipe;
- Object.getOwnPropertyNames(EventEmitter.prototype).forEach(function (name) {
- stream[name] = EventEmitter.prototype[name];
- });
-
- return stream;
-};
-
-exports.parse = function parse (buffer) {
- var self = words(function (bytes, cb) {
- return function (name) {
- if (offset + bytes <= buffer.length) {
- var buf = buffer.slice(offset, offset + bytes);
- offset += bytes;
- vars.set(name, cb(buf));
- }
- else {
- vars.set(name, null);
- }
- return self;
- };
- });
-
- var offset = 0;
- var vars = Vars();
- self.vars = vars.store;
-
- self.tap = function (cb) {
- cb.call(self, vars.store);
- return self;
- };
-
- self.into = function (key, cb) {
- if (!vars.get(key)) {
- vars.set(key, {});
- }
- var parent = vars;
- vars = Vars(parent.get(key));
- cb.call(self, vars.store);
- vars = parent;
- return self;
- };
-
- self.loop = function (cb) {
- var end = false;
- var ender = function () { end = true };
- while (end === false) {
- cb.call(self, ender, vars.store);
- }
- return self;
- };
-
- self.buffer = function (name, size) {
- if (typeof size === 'string') {
- size = vars.get(size);
- }
- var buf = buffer.slice(offset, Math.min(buffer.length, offset + size));
- offset += size;
- vars.set(name, buf);
-
- return self;
- };
-
- self.skip = function (bytes) {
- if (typeof bytes === 'string') {
- bytes = vars.get(bytes);
- }
- offset += bytes;
-
- return self;
- };
-
- self.scan = function (name, search) {
- if (typeof search === 'string') {
- search = new Buffer(search);
- }
- else if (!Buffer.isBuffer(search)) {
- throw new Error('search must be a Buffer or a string');
- }
- vars.set(name, null);
-
- // simple but slow string search
- for (var i = 0; i + offset <= buffer.length - search.length + 1; i++) {
- for (
- var j = 0;
- j < search.length && buffer[offset+i+j] === search[j];
- j++
- );
- if (j === search.length) break;
- }
-
- vars.set(name, buffer.slice(offset, offset + i));
- offset += i + search.length;
- return self;
- };
-
- self.peek = function (cb) {
- var was = offset;
- cb.call(self, vars.store);
- offset = was;
- return self;
- };
-
- self.flush = function () {
- vars.store = {};
- return self;
- };
-
- self.eof = function () {
- return offset >= buffer.length;
- };
-
- return self;
-};
-
-// convert byte strings to unsigned little endian numbers
-function decodeLEu (bytes) {
- var acc = 0;
- for (var i = 0; i < bytes.length; i++) {
- acc += Math.pow(256,i) * bytes[i];
- }
- return acc;
-}
-
-// convert byte strings to unsigned big endian numbers
-function decodeBEu (bytes) {
- var acc = 0;
- for (var i = 0; i < bytes.length; i++) {
- acc += Math.pow(256, bytes.length - i - 1) * bytes[i];
- }
- return acc;
-}
-
-// convert byte strings to signed big endian numbers
-function decodeBEs (bytes) {
- var val = decodeBEu(bytes);
- if ((bytes[0] & 0x80) == 0x80) {
- val -= Math.pow(256, bytes.length);
- }
- return val;
-}
-
-// convert byte strings to signed little endian numbers
-function decodeLEs (bytes) {
- var val = decodeLEu(bytes);
- if ((bytes[bytes.length - 1] & 0x80) == 0x80) {
- val -= Math.pow(256, bytes.length);
- }
- return val;
-}
-
-function words (decode) {
- var self = {};
-
- [ 1, 2, 4, 8 ].forEach(function (bytes) {
- var bits = bytes * 8;
-
- self['word' + bits + 'le']
- = self['word' + bits + 'lu']
- = decode(bytes, decodeLEu);
-
- self['word' + bits + 'ls']
- = decode(bytes, decodeLEs);
-
- self['word' + bits + 'be']
- = self['word' + bits + 'bu']
- = decode(bytes, decodeBEu);
-
- self['word' + bits + 'bs']
- = decode(bytes, decodeBEs);
- });
-
- // word8be(n) == word8le(n) for all n
- self.word8 = self.word8u = self.word8be;
- self.word8s = self.word8bs;
-
- return self;
-}
-
-
-/***/ }),
-
-/***/ 13755:
-/***/ ((module) => {
-
-module.exports = function (store) {
- function getset (name, value) {
- var node = vars.store;
- var keys = name.split('.');
- keys.slice(0,-1).forEach(function (k) {
- if (node[k] === undefined) node[k] = {};
- node = node[k]
- });
- var key = keys[keys.length - 1];
- if (arguments.length == 1) {
- return node[key];
- }
- else {
- return node[key] = value;
- }
- }
-
- var vars = {
- get : function (name) {
- return getset(name);
- },
- set : function (name, value) {
- return getset(name, value);
- },
- store : store || {},
- };
- return vars;
-};
-
-
-/***/ }),
-
-/***/ 21491:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmxhbWUtcmVzdWx0LmludGVyZmFjZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ibGFtZS1yZXN1bHQuaW50ZXJmYWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIifQ==
-
-/***/ }),
-
-/***/ 6686:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.Blamer = void 0;
-const git_1 = __nccwpck_require__(38295);
-class Blamer {
- async blameByFile(path) {
- return this.getVCSBlamer()(path);
- }
- getVCSBlamer() {
- return git_1.git;
- }
-}
-exports.Blamer = Blamer;
-//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmxhbWVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2JsYW1lci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFDQSxtQ0FBZ0M7QUFFaEMsTUFBYSxNQUFNO0lBQ1YsS0FBSyxDQUFDLFdBQVcsQ0FBQyxJQUFZO1FBQ25DLE9BQU8sSUFBSSxDQUFDLFlBQVksRUFBRSxDQUFDLElBQUksQ0FBQyxDQUFDO0lBQ25DLENBQUM7SUFFTyxZQUFZO1FBQ2xCLE9BQU8sU0FBRyxDQUFDO0lBQ2IsQ0FBQztDQUNGO0FBUkQsd0JBUUMifQ==
-
-/***/ }),
-
-/***/ 56781:
-/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
-
-"use strict";
-
-var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- var desc = Object.getOwnPropertyDescriptor(m, k);
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
- desc = { enumerable: true, get: function() { return m[k]; } };
- }
- Object.defineProperty(o, k2, desc);
-}) : (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- o[k2] = m[k];
-}));
-var __exportStar = (this && this.__exportStar) || function(m, exports) {
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
-};
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-const blamer_1 = __nccwpck_require__(6686);
-__exportStar(__nccwpck_require__(21491), exports);
-exports["default"] = blamer_1.Blamer;
-//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7OztBQUFBLHFDQUFrQztBQUVsQywyREFBeUM7QUFDekMsa0JBQWUsZUFBTSxDQUFDIn0=
-
-/***/ }),
-
-/***/ 38295:
-/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
-
-"use strict";
-
-var __importDefault = (this && this.__importDefault) || function (mod) {
- return (mod && mod.__esModule) ? mod : { "default": mod };
-};
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.git = void 0;
-const execa_1 = __importDefault(__nccwpck_require__(20920));
-const which_1 = __importDefault(__nccwpck_require__(34207));
-const node_fs_1 = __nccwpck_require__(87561);
-const convertStringToObject = (sourceLine) => {
- const matches = sourceLine.match(/(.+)\s+\((.+)\s+(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} (\+|\-)\d{4})\s+(\d+)\)(.*)/);
- const [, rev, author, date, , line] = matches
- ? [...matches]
- : [null, '', '', '', '', ''];
- return {
- author,
- date,
- line,
- rev
- };
-};
-async function git(path) {
- const blamedLines = {};
- const pathToGit = await (0, which_1.default)('git');
- if (!(0, node_fs_1.existsSync)(path)) {
- throw new Error(`File ${path} does not exist`);
- }
- const result = execa_1.default.sync(pathToGit, ['blame', '-w', path]);
- result.stdout.split('\n').forEach(line => {
- if (line !== '') {
- const blamedLine = convertStringToObject(line);
- if (blamedLine.line) {
- blamedLines[blamedLine.line] = blamedLine;
- }
- }
- });
- return {
- [path]: blamedLines
- };
-}
-exports.git = git;
-//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2l0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3Zjcy9naXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUEsa0RBQTBCO0FBQzFCLGtEQUEwQjtBQUUxQixxQ0FBcUM7QUFFckMsTUFBTSxxQkFBcUIsR0FBRyxDQUFDLFVBQWtCLEVBQWMsRUFBRTtJQUMvRCxNQUFNLE9BQU8sR0FBRyxVQUFVLENBQUMsS0FBSyxDQUM5QixrRkFBa0YsQ0FDbkYsQ0FBQztJQUNGLE1BQU0sQ0FBQyxFQUFFLEdBQUcsRUFBRSxNQUFNLEVBQUUsSUFBSSxFQUFFLEFBQUQsRUFBRyxJQUFJLENBQUMsR0FBRyxPQUFPO1FBQzNDLENBQUMsQ0FBQyxDQUFDLEdBQUcsT0FBTyxDQUFDO1FBQ2QsQ0FBQyxDQUFDLENBQUMsSUFBSSxFQUFFLEVBQUUsRUFBRSxFQUFFLEVBQUUsRUFBRSxFQUFFLEVBQUUsRUFBRSxFQUFFLENBQUMsQ0FBQztJQUMvQixPQUFPO1FBQ0wsTUFBTTtRQUNOLElBQUk7UUFDSixJQUFJO1FBQ0osR0FBRztLQUNKLENBQUM7QUFDSixDQUFDLENBQUM7QUFFSyxLQUFLLFVBQVUsR0FBRyxDQUFDLElBQVk7SUFDcEMsTUFBTSxXQUFXLEdBQW1DLEVBQUUsQ0FBQztJQUN2RCxNQUFNLFNBQVMsR0FBVyxNQUFNLElBQUEsZUFBSyxFQUFDLEtBQUssQ0FBQyxDQUFDO0lBRTdDLElBQUksQ0FBQyxJQUFBLG9CQUFVLEVBQUMsSUFBSSxDQUFDLEVBQUU7UUFDckIsTUFBTSxJQUFJLEtBQUssQ0FBQyxRQUFRLElBQUksaUJBQWlCLENBQUMsQ0FBQztLQUNoRDtJQUVELE1BQU0sTUFBTSxHQUFHLGVBQUssQ0FBQyxJQUFJLENBQUMsU0FBUyxFQUFFLENBQUMsT0FBTyxFQUFFLElBQUksRUFBRSxJQUFJLENBQUMsQ0FBQyxDQUFDO0lBQzVELE1BQU0sQ0FBQyxNQUFNLENBQUMsS0FBSyxDQUFDLElBQUksQ0FBQyxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsRUFBRTtRQUN2QyxJQUFJLElBQUksS0FBSyxFQUFFLEVBQUU7WUFDZixNQUFNLFVBQVUsR0FBRyxxQkFBcUIsQ0FBQyxJQUFJLENBQUMsQ0FBQztZQUMvQyxJQUFJLFVBQVUsQ0FBQyxJQUFJLEVBQUU7Z0JBQ25CLFdBQVcsQ0FBQyxVQUFVLENBQUMsSUFBSSxDQUFDLEdBQUcsVUFBVSxDQUFDO2FBQzNDO1NBQ0Y7SUFDSCxDQUFDLENBQUMsQ0FBQztJQUNILE9BQU87UUFDTCxDQUFDLElBQUksQ0FBQyxFQUFFLFdBQVc7S0FDcEIsQ0FBQztBQUNKLENBQUM7QUFwQkQsa0JBb0JDIn0=
-
-/***/ }),
-
-/***/ 20920:
-/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
-
-"use strict";
-
-const path = __nccwpck_require__(71017);
-const childProcess = __nccwpck_require__(32081);
-const crossSpawn = __nccwpck_require__(72746);
-const stripFinalNewline = __nccwpck_require__(88174);
-const npmRunPath = __nccwpck_require__(20502);
-const onetime = __nccwpck_require__(89082);
-const makeError = __nccwpck_require__(11325);
-const normalizeStdio = __nccwpck_require__(54149);
-const {spawnedKill, spawnedCancel, setupTimeout, setExitHandler} = __nccwpck_require__(77321);
-const {handleInput, getSpawnedResult, makeAllStream, validateInputSync} = __nccwpck_require__(2658);
-const {mergePromise, getSpawnedPromise} = __nccwpck_require__(51935);
-const {joinCommand, parseCommand} = __nccwpck_require__(1099);
-
-const DEFAULT_MAX_BUFFER = 1000 * 1000 * 100;
-
-const getEnv = ({env: envOption, extendEnv, preferLocal, localDir, execPath}) => {
- const env = extendEnv ? {...process.env, ...envOption} : envOption;
-
- if (preferLocal) {
- return npmRunPath.env({env, cwd: localDir, execPath});
- }
-
- return env;
-};
-
-const handleArguments = (file, args, options = {}) => {
- const parsed = crossSpawn._parse(file, args, options);
- file = parsed.command;
- args = parsed.args;
- options = parsed.options;
-
- options = {
- maxBuffer: DEFAULT_MAX_BUFFER,
- buffer: true,
- stripFinalNewline: true,
- extendEnv: true,
- preferLocal: false,
- localDir: options.cwd || process.cwd(),
- execPath: process.execPath,
- encoding: 'utf8',
- reject: true,
- cleanup: true,
- all: false,
- windowsHide: true,
- ...options
- };
-
- options.env = getEnv(options);
-
- options.stdio = normalizeStdio(options);
-
- if (process.platform === 'win32' && path.basename(file, '.exe') === 'cmd') {
- // #116
- args.unshift('/q');
- }
-
- return {file, args, options, parsed};
-};
-
-const handleOutput = (options, value, error) => {
- if (typeof value !== 'string' && !Buffer.isBuffer(value)) {
- // When `execa.sync()` errors, we normalize it to '' to mimic `execa()`
- return error === undefined ? undefined : '';
- }
-
- if (options.stripFinalNewline) {
- return stripFinalNewline(value);
- }
-
- return value;
-};
-
-const execa = (file, args, options) => {
- const parsed = handleArguments(file, args, options);
- const command = joinCommand(file, args);
-
- let spawned;
- try {
- spawned = childProcess.spawn(parsed.file, parsed.args, parsed.options);
- } catch (error) {
- // Ensure the returned error is always both a promise and a child process
- const dummySpawned = new childProcess.ChildProcess();
- const errorPromise = Promise.reject(makeError({
- error,
- stdout: '',
- stderr: '',
- all: '',
- command,
- parsed,
- timedOut: false,
- isCanceled: false,
- killed: false
- }));
- return mergePromise(dummySpawned, errorPromise);
- }
-
- const spawnedPromise = getSpawnedPromise(spawned);
- const timedPromise = setupTimeout(spawned, parsed.options, spawnedPromise);
- const processDone = setExitHandler(spawned, parsed.options, timedPromise);
-
- const context = {isCanceled: false};
-
- spawned.kill = spawnedKill.bind(null, spawned.kill.bind(spawned));
- spawned.cancel = spawnedCancel.bind(null, spawned, context);
-
- const handlePromise = async () => {
- const [{error, exitCode, signal, timedOut}, stdoutResult, stderrResult, allResult] = await getSpawnedResult(spawned, parsed.options, processDone);
- const stdout = handleOutput(parsed.options, stdoutResult);
- const stderr = handleOutput(parsed.options, stderrResult);
- const all = handleOutput(parsed.options, allResult);
-
- if (error || exitCode !== 0 || signal !== null) {
- const returnedError = makeError({
- error,
- exitCode,
- signal,
- stdout,
- stderr,
- all,
- command,
- parsed,
- timedOut,
- isCanceled: context.isCanceled,
- killed: spawned.killed
- });
-
- if (!parsed.options.reject) {
- return returnedError;
- }
-
- throw returnedError;
- }
-
- return {
- command,
- exitCode: 0,
- stdout,
- stderr,
- all,
- failed: false,
- timedOut: false,
- isCanceled: false,
- killed: false
- };
- };
-
- const handlePromiseOnce = onetime(handlePromise);
-
- crossSpawn._enoent.hookChildProcess(spawned, parsed.parsed);
-
- handleInput(spawned, parsed.options.input);
-
- spawned.all = makeAllStream(spawned, parsed.options);
-
- return mergePromise(spawned, handlePromiseOnce);
-};
-
-module.exports = execa;
-
-module.exports.sync = (file, args, options) => {
- const parsed = handleArguments(file, args, options);
- const command = joinCommand(file, args);
-
- validateInputSync(parsed.options);
-
- let result;
- try {
- result = childProcess.spawnSync(parsed.file, parsed.args, parsed.options);
- } catch (error) {
- throw makeError({
- error,
- stdout: '',
- stderr: '',
- all: '',
- command,
- parsed,
- timedOut: false,
- isCanceled: false,
- killed: false
- });
- }
-
- const stdout = handleOutput(parsed.options, result.stdout, result.error);
- const stderr = handleOutput(parsed.options, result.stderr, result.error);
-
- if (result.error || result.status !== 0 || result.signal !== null) {
- const error = makeError({
- stdout,
- stderr,
- error: result.error,
- signal: result.signal,
- exitCode: result.status,
- command,
- parsed,
- timedOut: result.error && result.error.code === 'ETIMEDOUT',
- isCanceled: false,
- killed: result.signal !== null
- });
-
- if (!parsed.options.reject) {
- return error;
- }
-
- throw error;
- }
-
- return {
- command,
- exitCode: 0,
- stdout,
- stderr,
- failed: false,
- timedOut: false,
- isCanceled: false,
- killed: false
- };
-};
-
-module.exports.command = (command, options) => {
- const [file, ...args] = parseCommand(command);
- return execa(file, args, options);
-};
-
-module.exports.commandSync = (command, options) => {
- const [file, ...args] = parseCommand(command);
- return execa.sync(file, args, options);
-};
-
-module.exports.node = (scriptPath, args, options = {}) => {
- if (args && !Array.isArray(args) && typeof args === 'object') {
- options = args;
- args = [];
- }
-
- const stdio = normalizeStdio.node(options);
- const defaultExecArgv = process.execArgv.filter(arg => !arg.startsWith('--inspect'));
-
- const {
- nodePath = process.execPath,
- nodeOptions = defaultExecArgv
- } = options;
-
- return execa(
- nodePath,
- [
- ...nodeOptions,
- scriptPath,
- ...(Array.isArray(args) ? args : [])
- ],
- {
- ...options,
- stdin: undefined,
- stdout: undefined,
- stderr: undefined,
- stdio,
- shell: false
- }
- );
-};
-
-
-/***/ }),
-
-/***/ 1099:
-/***/ ((module) => {
-
-"use strict";
-
-const SPACES_REGEXP = / +/g;
-
-const joinCommand = (file, args = []) => {
- if (!Array.isArray(args)) {
- return file;
- }
-
- return [file, ...args].join(' ');
-};
-
-// Handle `execa.command()`
-const parseCommand = command => {
- const tokens = [];
- for (const token of command.trim().split(SPACES_REGEXP)) {
- // Allow spaces to be escaped by a backslash if not meant as a delimiter
- const previousToken = tokens[tokens.length - 1];
- if (previousToken && previousToken.endsWith('\\')) {
- // Merge previous token with current one
- tokens[tokens.length - 1] = `${previousToken.slice(0, -1)} ${token}`;
- } else {
- tokens.push(token);
- }
- }
-
- return tokens;
-};
-
-module.exports = {
- joinCommand,
- parseCommand
-};
-
-
-/***/ }),
-
-/***/ 11325:
-/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
-
-"use strict";
-
-const {signalsByName} = __nccwpck_require__(27605);
-
-const getErrorPrefix = ({timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled}) => {
- if (timedOut) {
- return `timed out after ${timeout} milliseconds`;
- }
-
- if (isCanceled) {
- return 'was canceled';
- }
-
- if (errorCode !== undefined) {
- return `failed with ${errorCode}`;
- }
-
- if (signal !== undefined) {
- return `was killed with ${signal} (${signalDescription})`;
- }
-
- if (exitCode !== undefined) {
- return `failed with exit code ${exitCode}`;
- }
-
- return 'failed';
-};
-
-const makeError = ({
- stdout,
- stderr,
- all,
- error,
- signal,
- exitCode,
- command,
- timedOut,
- isCanceled,
- killed,
- parsed: {options: {timeout}}
-}) => {
- // `signal` and `exitCode` emitted on `spawned.on('exit')` event can be `null`.
- // We normalize them to `undefined`
- exitCode = exitCode === null ? undefined : exitCode;
- signal = signal === null ? undefined : signal;
- const signalDescription = signal === undefined ? undefined : signalsByName[signal].description;
-
- const errorCode = error && error.code;
-
- const prefix = getErrorPrefix({timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled});
- const execaMessage = `Command ${prefix}: ${command}`;
- const isError = Object.prototype.toString.call(error) === '[object Error]';
- const shortMessage = isError ? `${execaMessage}\n${error.message}` : execaMessage;
- const message = [shortMessage, stderr, stdout].filter(Boolean).join('\n');
-
- if (isError) {
- error.originalMessage = error.message;
- error.message = message;
- } else {
- error = new Error(message);
- }
-
- error.shortMessage = shortMessage;
- error.command = command;
- error.exitCode = exitCode;
- error.signal = signal;
- error.signalDescription = signalDescription;
- error.stdout = stdout;
- error.stderr = stderr;
-
- if (all !== undefined) {
- error.all = all;
- }
-
- if ('bufferedData' in error) {
- delete error.bufferedData;
- }
-
- error.failed = true;
- error.timedOut = Boolean(timedOut);
- error.isCanceled = isCanceled;
- error.killed = killed && !timedOut;
-
- return error;
-};
-
-module.exports = makeError;
-
-
-/***/ }),
-
-/***/ 77321:
-/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
-
-"use strict";
-
-const os = __nccwpck_require__(22037);
-const onExit = __nccwpck_require__(24931);
-
-const DEFAULT_FORCE_KILL_TIMEOUT = 1000 * 5;
-
-// Monkey-patches `childProcess.kill()` to add `forceKillAfterTimeout` behavior
-const spawnedKill = (kill, signal = 'SIGTERM', options = {}) => {
- const killResult = kill(signal);
- setKillTimeout(kill, signal, options, killResult);
- return killResult;
-};
-
-const setKillTimeout = (kill, signal, options, killResult) => {
- if (!shouldForceKill(signal, options, killResult)) {
- return;
- }
-
- const timeout = getForceKillAfterTimeout(options);
- const t = setTimeout(() => {
- kill('SIGKILL');
- }, timeout);
-
- // Guarded because there's no `.unref()` when `execa` is used in the renderer
- // process in Electron. This cannot be tested since we don't run tests in
- // Electron.
- // istanbul ignore else
- if (t.unref) {
- t.unref();
- }
-};
-
-const shouldForceKill = (signal, {forceKillAfterTimeout}, killResult) => {
- return isSigterm(signal) && forceKillAfterTimeout !== false && killResult;
-};
-
-const isSigterm = signal => {
- return signal === os.constants.signals.SIGTERM ||
- (typeof signal === 'string' && signal.toUpperCase() === 'SIGTERM');
-};
-
-const getForceKillAfterTimeout = ({forceKillAfterTimeout = true}) => {
- if (forceKillAfterTimeout === true) {
- return DEFAULT_FORCE_KILL_TIMEOUT;
- }
-
- if (!Number.isFinite(forceKillAfterTimeout) || forceKillAfterTimeout < 0) {
- throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${forceKillAfterTimeout}\` (${typeof forceKillAfterTimeout})`);
- }
-
- return forceKillAfterTimeout;
-};
-
-// `childProcess.cancel()`
-const spawnedCancel = (spawned, context) => {
- const killResult = spawned.kill();
-
- if (killResult) {
- context.isCanceled = true;
- }
-};
-
-const timeoutKill = (spawned, signal, reject) => {
- spawned.kill(signal);
- reject(Object.assign(new Error('Timed out'), {timedOut: true, signal}));
-};
-
-// `timeout` option handling
-const setupTimeout = (spawned, {timeout, killSignal = 'SIGTERM'}, spawnedPromise) => {
- if (timeout === 0 || timeout === undefined) {
- return spawnedPromise;
- }
-
- if (!Number.isFinite(timeout) || timeout < 0) {
- throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${timeout}\` (${typeof timeout})`);
- }
-
- let timeoutId;
- const timeoutPromise = new Promise((resolve, reject) => {
- timeoutId = setTimeout(() => {
- timeoutKill(spawned, killSignal, reject);
- }, timeout);
- });
-
- const safeSpawnedPromise = spawnedPromise.finally(() => {
- clearTimeout(timeoutId);
- });
-
- return Promise.race([timeoutPromise, safeSpawnedPromise]);
-};
-
-// `cleanup` option handling
-const setExitHandler = async (spawned, {cleanup, detached}, timedPromise) => {
- if (!cleanup || detached) {
- return timedPromise;
- }
-
- const removeExitHandler = onExit(() => {
- spawned.kill();
- });
-
- return timedPromise.finally(() => {
- removeExitHandler();
- });
-};
-
-module.exports = {
- spawnedKill,
- spawnedCancel,
- setupTimeout,
- setExitHandler
-};
-
-
-/***/ }),
-
-/***/ 51935:
-/***/ ((module) => {
-
-"use strict";
-
-
-const nativePromisePrototype = (async () => {})().constructor.prototype;
-const descriptors = ['then', 'catch', 'finally'].map(property => [
- property,
- Reflect.getOwnPropertyDescriptor(nativePromisePrototype, property)
-]);
-
-// The return value is a mixin of `childProcess` and `Promise`
-const mergePromise = (spawned, promise) => {
- for (const [property, descriptor] of descriptors) {
- // Starting the main `promise` is deferred to avoid consuming streams
- const value = typeof promise === 'function' ?
- (...args) => Reflect.apply(descriptor.value, promise(), args) :
- descriptor.value.bind(promise);
-
- Reflect.defineProperty(spawned, property, {...descriptor, value});
- }
-
- return spawned;
-};
-
-// Use promises instead of `child_process` events
-const getSpawnedPromise = spawned => {
- return new Promise((resolve, reject) => {
- spawned.on('exit', (exitCode, signal) => {
- resolve({exitCode, signal});
- });
-
- spawned.on('error', error => {
- reject(error);
- });
-
- if (spawned.stdin) {
- spawned.stdin.on('error', error => {
- reject(error);
- });
- }
- });
-};
-
-module.exports = {
- mergePromise,
- getSpawnedPromise
-};
-
-
-
-/***/ }),
-
-/***/ 54149:
-/***/ ((module) => {
-
-"use strict";
-
-const aliases = ['stdin', 'stdout', 'stderr'];
-
-const hasAlias = opts => aliases.some(alias => opts[alias] !== undefined);
-
-const normalizeStdio = opts => {
- if (!opts) {
- return;
- }
-
- const {stdio} = opts;
-
- if (stdio === undefined) {
- return aliases.map(alias => opts[alias]);
- }
-
- if (hasAlias(opts)) {
- throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${aliases.map(alias => `\`${alias}\``).join(', ')}`);
- }
-
- if (typeof stdio === 'string') {
- return stdio;
- }
-
- if (!Array.isArray(stdio)) {
- throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof stdio}\``);
- }
-
- const length = Math.max(stdio.length, aliases.length);
- return Array.from({length}, (value, index) => stdio[index]);
-};
-
-module.exports = normalizeStdio;
-
-// `ipc` is pushed unless it is already present
-module.exports.node = opts => {
- const stdio = normalizeStdio(opts);
-
- if (stdio === 'ipc') {
- return 'ipc';
- }
-
- if (stdio === undefined || typeof stdio === 'string') {
- return [stdio, stdio, stdio, 'ipc'];
- }
-
- if (stdio.includes('ipc')) {
- return stdio;
- }
-
- return [...stdio, 'ipc'];
-};
-
-
-/***/ }),
-
-/***/ 2658:
-/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
-
-"use strict";
-
-const isStream = __nccwpck_require__(41554);
-const getStream = __nccwpck_require__(80591);
-const mergeStream = __nccwpck_require__(2621);
-
-// `input` option
-const handleInput = (spawned, input) => {
- // Checking for stdin is workaround for https://github.com/nodejs/node/issues/26852
- // TODO: Remove `|| spawned.stdin === undefined` once we drop support for Node.js <=12.2.0
- if (input === undefined || spawned.stdin === undefined) {
- return;
- }
-
- if (isStream(input)) {
- input.pipe(spawned.stdin);
- } else {
- spawned.stdin.end(input);
- }
-};
-
-// `all` interleaves `stdout` and `stderr`
-const makeAllStream = (spawned, {all}) => {
- if (!all || (!spawned.stdout && !spawned.stderr)) {
- return;
- }
-
- const mixed = mergeStream();
-
- if (spawned.stdout) {
- mixed.add(spawned.stdout);
- }
-
- if (spawned.stderr) {
- mixed.add(spawned.stderr);
- }
-
- return mixed;
-};
-
-// On failure, `result.stdout|stderr|all` should contain the currently buffered stream
-const getBufferedData = async (stream, streamPromise) => {
- if (!stream) {
- return;
- }
-
- stream.destroy();
-
- try {
- return await streamPromise;
- } catch (error) {
- return error.bufferedData;
- }
-};
-
-const getStreamPromise = (stream, {encoding, buffer, maxBuffer}) => {
- if (!stream || !buffer) {
- return;
- }
-
- if (encoding) {
- return getStream(stream, {encoding, maxBuffer});
- }
-
- return getStream.buffer(stream, {maxBuffer});
-};
-
-// Retrieve result of child process: exit code, signal, error, streams (stdout/stderr/all)
-const getSpawnedResult = async ({stdout, stderr, all}, {encoding, buffer, maxBuffer}, processDone) => {
- const stdoutPromise = getStreamPromise(stdout, {encoding, buffer, maxBuffer});
- const stderrPromise = getStreamPromise(stderr, {encoding, buffer, maxBuffer});
- const allPromise = getStreamPromise(all, {encoding, buffer, maxBuffer: maxBuffer * 2});
-
- try {
- return await Promise.all([processDone, stdoutPromise, stderrPromise, allPromise]);
- } catch (error) {
- return Promise.all([
- {error, signal: error.signal, timedOut: error.timedOut},
- getBufferedData(stdout, stdoutPromise),
- getBufferedData(stderr, stderrPromise),
- getBufferedData(all, allPromise)
- ]);
- }
-};
-
-const validateInputSync = ({input}) => {
- if (isStream(input)) {
- throw new TypeError('The `input` option cannot be a stream in sync mode');
- }
-};
-
-module.exports = {
- handleInput,
- makeAllStream,
- getSpawnedResult,
- validateInputSync
-};
-
-
-
-/***/ }),
-
-/***/ 33059:
-/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
-
-"use strict";
-
-const {PassThrough: PassThroughStream} = __nccwpck_require__(12781);
-
-module.exports = options => {
- options = {...options};
-
- const {array} = options;
- let {encoding} = options;
- const isBuffer = encoding === 'buffer';
- let objectMode = false;
-
- if (array) {
- objectMode = !(encoding || isBuffer);
- } else {
- encoding = encoding || 'utf8';
- }
-
- if (isBuffer) {
- encoding = null;
- }
-
- const stream = new PassThroughStream({objectMode});
-
- if (encoding) {
- stream.setEncoding(encoding);
- }
-
- let length = 0;
- const chunks = [];
-
- stream.on('data', chunk => {
- chunks.push(chunk);
-
- if (objectMode) {
- length = chunks.length;
- } else {
- length += chunk.length;
- }
- });
-
- stream.getBufferedValue = () => {
- if (array) {
- return chunks;
- }
-
- return isBuffer ? Buffer.concat(chunks, length) : chunks.join('');
- };
-
- stream.getBufferedLength = () => length;
-
- return stream;
-};
-
-
-/***/ }),
-
-/***/ 80591:
-/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
-
-"use strict";
-
-const {constants: BufferConstants} = __nccwpck_require__(14300);
-const pump = __nccwpck_require__(18341);
-const bufferStream = __nccwpck_require__(33059);
-
-class MaxBufferError extends Error {
- constructor() {
- super('maxBuffer exceeded');
- this.name = 'MaxBufferError';
- }
-}
-
-async function getStream(inputStream, options) {
- if (!inputStream) {
- return Promise.reject(new Error('Expected a stream'));
- }
-
- options = {
- maxBuffer: Infinity,
- ...options
- };
-
- const {maxBuffer} = options;
-
- let stream;
- await new Promise((resolve, reject) => {
- const rejectPromise = error => {
- // Don't retrieve an oversized buffer.
- if (error && stream.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
- error.bufferedData = stream.getBufferedValue();
- }
-
- reject(error);
- };
-
- stream = pump(inputStream, bufferStream(options), error => {
- if (error) {
- rejectPromise(error);
- return;
- }
-
- resolve();
- });
-
- stream.on('data', () => {
- if (stream.getBufferedLength() > maxBuffer) {
- rejectPromise(new MaxBufferError());
- }
- });
- });
-
- return stream.getBufferedValue();
-}
-
-module.exports = getStream;
-// TODO: Remove this for the next major release
-module.exports["default"] = getStream;
-module.exports.buffer = (stream, options) => getStream(stream, {...options, encoding: 'buffer'});
-module.exports.array = (stream, options) => getStream(stream, {...options, array: true});
-module.exports.MaxBufferError = MaxBufferError;
-
-
-/***/ }),
-
-/***/ 29778:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-Object.defineProperty(exports, "__esModule", ({value:true}));exports.SIGNALS=void 0;
-
-const SIGNALS=[
-{
-name:"SIGHUP",
-number:1,
-action:"terminate",
-description:"Terminal closed",
-standard:"posix"},
-
-{
-name:"SIGINT",
-number:2,
-action:"terminate",
-description:"User interruption with CTRL-C",
-standard:"ansi"},
-
-{
-name:"SIGQUIT",
-number:3,
-action:"core",
-description:"User interruption with CTRL-\\",
-standard:"posix"},
-
-{
-name:"SIGILL",
-number:4,
-action:"core",
-description:"Invalid machine instruction",
-standard:"ansi"},
-
-{
-name:"SIGTRAP",
-number:5,
-action:"core",
-description:"Debugger breakpoint",
-standard:"posix"},
-
-{
-name:"SIGABRT",
-number:6,
-action:"core",
-description:"Aborted",
-standard:"ansi"},
-
-{
-name:"SIGIOT",
-number:6,
-action:"core",
-description:"Aborted",
-standard:"bsd"},
-
-{
-name:"SIGBUS",
-number:7,
-action:"core",
-description:
-"Bus error due to misaligned, non-existing address or paging error",
-standard:"bsd"},
-
-{
-name:"SIGEMT",
-number:7,
-action:"terminate",
-description:"Command should be emulated but is not implemented",
-standard:"other"},
-
-{
-name:"SIGFPE",
-number:8,
-action:"core",
-description:"Floating point arithmetic error",
-standard:"ansi"},
-
-{
-name:"SIGKILL",
-number:9,
-action:"terminate",
-description:"Forced termination",
-standard:"posix",
-forced:true},
-
-{
-name:"SIGUSR1",
-number:10,
-action:"terminate",
-description:"Application-specific signal",
-standard:"posix"},
-
-{
-name:"SIGSEGV",
-number:11,
-action:"core",
-description:"Segmentation fault",
-standard:"ansi"},
-
-{
-name:"SIGUSR2",
-number:12,
-action:"terminate",
-description:"Application-specific signal",
-standard:"posix"},
-
-{
-name:"SIGPIPE",
-number:13,
-action:"terminate",
-description:"Broken pipe or socket",
-standard:"posix"},
-
-{
-name:"SIGALRM",
-number:14,
-action:"terminate",
-description:"Timeout or timer",
-standard:"posix"},
-
-{
-name:"SIGTERM",
-number:15,
-action:"terminate",
-description:"Termination",
-standard:"ansi"},
-
-{
-name:"SIGSTKFLT",
-number:16,
-action:"terminate",
-description:"Stack is empty or overflowed",
-standard:"other"},
-
-{
-name:"SIGCHLD",
-number:17,
-action:"ignore",
-description:"Child process terminated, paused or unpaused",
-standard:"posix"},
-
-{
-name:"SIGCLD",
-number:17,
-action:"ignore",
-description:"Child process terminated, paused or unpaused",
-standard:"other"},
-
-{
-name:"SIGCONT",
-number:18,
-action:"unpause",
-description:"Unpaused",
-standard:"posix",
-forced:true},
-
-{
-name:"SIGSTOP",
-number:19,
-action:"pause",
-description:"Paused",
-standard:"posix",
-forced:true},
-
-{
-name:"SIGTSTP",
-number:20,
-action:"pause",
-description:"Paused using CTRL-Z or \"suspend\"",
-standard:"posix"},
-
-{
-name:"SIGTTIN",
-number:21,
-action:"pause",
-description:"Background process cannot read terminal input",
-standard:"posix"},
-
-{
-name:"SIGBREAK",
-number:21,
-action:"terminate",
-description:"User interruption with CTRL-BREAK",
-standard:"other"},
-
-{
-name:"SIGTTOU",
-number:22,
-action:"pause",
-description:"Background process cannot write to terminal output",
-standard:"posix"},
-
-{
-name:"SIGURG",
-number:23,
-action:"ignore",
-description:"Socket received out-of-band data",
-standard:"bsd"},
-
-{
-name:"SIGXCPU",
-number:24,
-action:"core",
-description:"Process timed out",
-standard:"bsd"},
-
-{
-name:"SIGXFSZ",
-number:25,
-action:"core",
-description:"File too big",
-standard:"bsd"},
-
-{
-name:"SIGVTALRM",
-number:26,
-action:"terminate",
-description:"Timeout or timer",
-standard:"bsd"},
-
-{
-name:"SIGPROF",
-number:27,
-action:"terminate",
-description:"Timeout or timer",
-standard:"bsd"},
-
-{
-name:"SIGWINCH",
-number:28,
-action:"ignore",
-description:"Terminal window size changed",
-standard:"bsd"},
-
-{
-name:"SIGIO",
-number:29,
-action:"terminate",
-description:"I/O is available",
-standard:"other"},
-
-{
-name:"SIGPOLL",
-number:29,
-action:"terminate",
-description:"Watched event",
-standard:"other"},
-
-{
-name:"SIGINFO",
-number:29,
-action:"ignore",
-description:"Request for process information",
-standard:"other"},
-
-{
-name:"SIGPWR",
-number:30,
-action:"terminate",
-description:"Device running out of power",
-standard:"systemv"},
-
-{
-name:"SIGSYS",
-number:31,
-action:"core",
-description:"Invalid system call",
-standard:"other"},
-
-{
-name:"SIGUNUSED",
-number:31,
-action:"terminate",
-description:"Invalid system call",
-standard:"other"}];exports.SIGNALS=SIGNALS;
-//# sourceMappingURL=core.js.map
-
-/***/ }),
-
-/***/ 27605:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-Object.defineProperty(exports, "__esModule", ({value:true}));exports.signalsByNumber=exports.signalsByName=void 0;var _os=__nccwpck_require__(22037);
-
-var _signals=__nccwpck_require__(59519);
-var _realtime=__nccwpck_require__(45904);
-
-
-
-const getSignalsByName=function(){
-const signals=(0,_signals.getSignals)();
-return signals.reduce(getSignalByName,{});
-};
-
-const getSignalByName=function(
-signalByNameMemo,
-{name,number,description,supported,action,forced,standard})
-{
-return{
-...signalByNameMemo,
-[name]:{name,number,description,supported,action,forced,standard}};
-
-};
-
-const signalsByName=getSignalsByName();exports.signalsByName=signalsByName;
-
-
-
-
-const getSignalsByNumber=function(){
-const signals=(0,_signals.getSignals)();
-const length=_realtime.SIGRTMAX+1;
-const signalsA=Array.from({length},(value,number)=>
-getSignalByNumber(number,signals));
-
-return Object.assign({},...signalsA);
-};
-
-const getSignalByNumber=function(number,signals){
-const signal=findSignalByNumber(number,signals);
-
-if(signal===undefined){
-return{};
-}
-
-const{name,description,supported,action,forced,standard}=signal;
-return{
-[number]:{
-name,
-number,
-description,
-supported,
-action,
-forced,
-standard}};
-
-
-};
-
-
-
-const findSignalByNumber=function(number,signals){
-const signal=signals.find(({name})=>_os.constants.signals[name]===number);
-
-if(signal!==undefined){
-return signal;
-}
-
-return signals.find(signalA=>signalA.number===number);
-};
-
-const signalsByNumber=getSignalsByNumber();exports.signalsByNumber=signalsByNumber;
-//# sourceMappingURL=main.js.map
-
-/***/ }),
-
-/***/ 45904:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-Object.defineProperty(exports, "__esModule", ({value:true}));exports.SIGRTMAX=exports.getRealtimeSignals=void 0;
-const getRealtimeSignals=function(){
-const length=SIGRTMAX-SIGRTMIN+1;
-return Array.from({length},getRealtimeSignal);
-};exports.getRealtimeSignals=getRealtimeSignals;
-
-const getRealtimeSignal=function(value,index){
-return{
-name:`SIGRT${index+1}`,
-number:SIGRTMIN+index,
-action:"terminate",
-description:"Application-specific signal (realtime)",
-standard:"posix"};
-
-};
-
-const SIGRTMIN=34;
-const SIGRTMAX=64;exports.SIGRTMAX=SIGRTMAX;
-//# sourceMappingURL=realtime.js.map
-
-/***/ }),
-
-/***/ 59519:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-Object.defineProperty(exports, "__esModule", ({value:true}));exports.getSignals=void 0;var _os=__nccwpck_require__(22037);
-
-var _core=__nccwpck_require__(29778);
-var _realtime=__nccwpck_require__(45904);
-
-
-
-const getSignals=function(){
-const realtimeSignals=(0,_realtime.getRealtimeSignals)();
-const signals=[..._core.SIGNALS,...realtimeSignals].map(normalizeSignal);
-return signals;
-};exports.getSignals=getSignals;
-
-
-
-
-
-
-
-const normalizeSignal=function({
-name,
-number:defaultNumber,
-description,
-action,
-forced=false,
-standard})
-{
-const{
-signals:{[name]:constantSignal}}=
-_os.constants;
-const supported=constantSignal!==undefined;
-const number=supported?constantSignal:defaultNumber;
-return{name,number,description,supported,action,forced,standard};
-};
-//# sourceMappingURL=signals.js.map
-
-/***/ }),
-
-/***/ 11174:
-/***/ (function(module) {
-
-/**
- * This file contains the Bottleneck library (MIT), compiled to ES2017, and without Clustering support.
- * https://github.com/SGrondin/bottleneck
- */
-(function (global, factory) {
- true ? module.exports = factory() :
- 0;
-}(this, (function () { 'use strict';
-
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
-
- function getCjsExportFromNamespace (n) {
- return n && n['default'] || n;
- }
-
- var load = function(received, defaults, onto = {}) {
- var k, ref, v;
- for (k in defaults) {
- v = defaults[k];
- onto[k] = (ref = received[k]) != null ? ref : v;
- }
- return onto;
- };
-
- var overwrite = function(received, defaults, onto = {}) {
- var k, v;
- for (k in received) {
- v = received[k];
- if (defaults[k] !== void 0) {
- onto[k] = v;
- }
- }
- return onto;
- };
-
- var parser = {
- load: load,
- overwrite: overwrite
- };
-
- var DLList;
-
- DLList = class DLList {
- constructor(incr, decr) {
- this.incr = incr;
- this.decr = decr;
- this._first = null;
- this._last = null;
- this.length = 0;
- }
-
- push(value) {
- var node;
- this.length++;
- if (typeof this.incr === "function") {
- this.incr();
- }
- node = {
- value,
- prev: this._last,
- next: null
- };
- if (this._last != null) {
- this._last.next = node;
- this._last = node;
- } else {
- this._first = this._last = node;
- }
- return void 0;
- }
-
- shift() {
- var value;
- if (this._first == null) {
- return;
- } else {
- this.length--;
- if (typeof this.decr === "function") {
- this.decr();
- }
- }
- value = this._first.value;
- if ((this._first = this._first.next) != null) {
- this._first.prev = null;
- } else {
- this._last = null;
- }
- return value;
- }
-
- first() {
- if (this._first != null) {
- return this._first.value;
- }
- }
-
- getArray() {
- var node, ref, results;
- node = this._first;
- results = [];
- while (node != null) {
- results.push((ref = node, node = node.next, ref.value));
- }
- return results;
- }
-
- forEachShift(cb) {
- var node;
- node = this.shift();
- while (node != null) {
- (cb(node), node = this.shift());
- }
- return void 0;
- }
-
- debug() {
- var node, ref, ref1, ref2, results;
- node = this._first;
- results = [];
- while (node != null) {
- results.push((ref = node, node = node.next, {
- value: ref.value,
- prev: (ref1 = ref.prev) != null ? ref1.value : void 0,
- next: (ref2 = ref.next) != null ? ref2.value : void 0
- }));
- }
- return results;
- }
-
- };
-
- var DLList_1 = DLList;
-
- var Events;
-
- Events = class Events {
- constructor(instance) {
- this.instance = instance;
- this._events = {};
- if ((this.instance.on != null) || (this.instance.once != null) || (this.instance.removeAllListeners != null)) {
- throw new Error("An Emitter already exists for this object");
- }
- this.instance.on = (name, cb) => {
- return this._addListener(name, "many", cb);
- };
- this.instance.once = (name, cb) => {
- return this._addListener(name, "once", cb);
- };
- this.instance.removeAllListeners = (name = null) => {
- if (name != null) {
- return delete this._events[name];
- } else {
- return this._events = {};
- }
- };
- }
-
- _addListener(name, status, cb) {
- var base;
- if ((base = this._events)[name] == null) {
- base[name] = [];
- }
- this._events[name].push({cb, status});
- return this.instance;
- }
-
- listenerCount(name) {
- if (this._events[name] != null) {
- return this._events[name].length;
- } else {
- return 0;
- }
- }
-
- async trigger(name, ...args) {
- var e, promises;
- try {
- if (name !== "debug") {
- this.trigger("debug", `Event triggered: ${name}`, args);
- }
- if (this._events[name] == null) {
- return;
- }
- this._events[name] = this._events[name].filter(function(listener) {
- return listener.status !== "none";
- });
- promises = this._events[name].map(async(listener) => {
- var e, returned;
- if (listener.status === "none") {
- return;
- }
- if (listener.status === "once") {
- listener.status = "none";
- }
- try {
- returned = typeof listener.cb === "function" ? listener.cb(...args) : void 0;
- if (typeof (returned != null ? returned.then : void 0) === "function") {
- return (await returned);
- } else {
- return returned;
- }
- } catch (error) {
- e = error;
- {
- this.trigger("error", e);
- }
- return null;
- }
- });
- return ((await Promise.all(promises))).find(function(x) {
- return x != null;
- });
- } catch (error) {
- e = error;
- {
- this.trigger("error", e);
- }
- return null;
- }
- }
-
- };
-
- var Events_1 = Events;
-
- var DLList$1, Events$1, Queues;
-
- DLList$1 = DLList_1;
-
- Events$1 = Events_1;
-
- Queues = class Queues {
- constructor(num_priorities) {
- var i;
- this.Events = new Events$1(this);
- this._length = 0;
- this._lists = (function() {
- var j, ref, results;
- results = [];
- for (i = j = 1, ref = num_priorities; (1 <= ref ? j <= ref : j >= ref); i = 1 <= ref ? ++j : --j) {
- results.push(new DLList$1((() => {
- return this.incr();
- }), (() => {
- return this.decr();
- })));
- }
- return results;
- }).call(this);
- }
-
- incr() {
- if (this._length++ === 0) {
- return this.Events.trigger("leftzero");
- }
- }
-
- decr() {
- if (--this._length === 0) {
- return this.Events.trigger("zero");
- }
- }
-
- push(job) {
- return this._lists[job.options.priority].push(job);
- }
-
- queued(priority) {
- if (priority != null) {
- return this._lists[priority].length;
- } else {
- return this._length;
- }
- }
-
- shiftAll(fn) {
- return this._lists.forEach(function(list) {
- return list.forEachShift(fn);
- });
- }
-
- getFirst(arr = this._lists) {
- var j, len, list;
- for (j = 0, len = arr.length; j < len; j++) {
- list = arr[j];
- if (list.length > 0) {
- return list;
- }
- }
- return [];
- }
-
- shiftLastFrom(priority) {
- return this.getFirst(this._lists.slice(priority).reverse()).shift();
- }
-
- };
-
- var Queues_1 = Queues;
-
- var BottleneckError;
-
- BottleneckError = class BottleneckError extends Error {};
-
- var BottleneckError_1 = BottleneckError;
-
- var BottleneckError$1, DEFAULT_PRIORITY, Job, NUM_PRIORITIES, parser$1;
-
- NUM_PRIORITIES = 10;
-
- DEFAULT_PRIORITY = 5;
-
- parser$1 = parser;
-
- BottleneckError$1 = BottleneckError_1;
-
- Job = class Job {
- constructor(task, args, options, jobDefaults, rejectOnDrop, Events, _states, Promise) {
- this.task = task;
- this.args = args;
- this.rejectOnDrop = rejectOnDrop;
- this.Events = Events;
- this._states = _states;
- this.Promise = Promise;
- this.options = parser$1.load(options, jobDefaults);
- this.options.priority = this._sanitizePriority(this.options.priority);
- if (this.options.id === jobDefaults.id) {
- this.options.id = `${this.options.id}-${this._randomIndex()}`;
- }
- this.promise = new this.Promise((_resolve, _reject) => {
- this._resolve = _resolve;
- this._reject = _reject;
- });
- this.retryCount = 0;
- }
-
- _sanitizePriority(priority) {
- var sProperty;
- sProperty = ~~priority !== priority ? DEFAULT_PRIORITY : priority;
- if (sProperty < 0) {
- return 0;
- } else if (sProperty > NUM_PRIORITIES - 1) {
- return NUM_PRIORITIES - 1;
- } else {
- return sProperty;
- }
- }
-
- _randomIndex() {
- return Math.random().toString(36).slice(2);
- }
-
- doDrop({error, message = "This job has been dropped by Bottleneck"} = {}) {
- if (this._states.remove(this.options.id)) {
- if (this.rejectOnDrop) {
- this._reject(error != null ? error : new BottleneckError$1(message));
- }
- this.Events.trigger("dropped", {args: this.args, options: this.options, task: this.task, promise: this.promise});
- return true;
- } else {
- return false;
- }
- }
-
- _assertStatus(expected) {
- var status;
- status = this._states.jobStatus(this.options.id);
- if (!(status === expected || (expected === "DONE" && status === null))) {
- throw new BottleneckError$1(`Invalid job status ${status}, expected ${expected}. Please open an issue at https://github.com/SGrondin/bottleneck/issues`);
- }
- }
-
- doReceive() {
- this._states.start(this.options.id);
- return this.Events.trigger("received", {args: this.args, options: this.options});
- }
-
- doQueue(reachedHWM, blocked) {
- this._assertStatus("RECEIVED");
- this._states.next(this.options.id);
- return this.Events.trigger("queued", {args: this.args, options: this.options, reachedHWM, blocked});
- }
-
- doRun() {
- if (this.retryCount === 0) {
- this._assertStatus("QUEUED");
- this._states.next(this.options.id);
- } else {
- this._assertStatus("EXECUTING");
- }
- return this.Events.trigger("scheduled", {args: this.args, options: this.options});
- }
-
- async doExecute(chained, clearGlobalState, run, free) {
- var error, eventInfo, passed;
- if (this.retryCount === 0) {
- this._assertStatus("RUNNING");
- this._states.next(this.options.id);
- } else {
- this._assertStatus("EXECUTING");
- }
- eventInfo = {args: this.args, options: this.options, retryCount: this.retryCount};
- this.Events.trigger("executing", eventInfo);
- try {
- passed = (await (chained != null ? chained.schedule(this.options, this.task, ...this.args) : this.task(...this.args)));
- if (clearGlobalState()) {
- this.doDone(eventInfo);
- await free(this.options, eventInfo);
- this._assertStatus("DONE");
- return this._resolve(passed);
- }
- } catch (error1) {
- error = error1;
- return this._onFailure(error, eventInfo, clearGlobalState, run, free);
- }
- }
-
- doExpire(clearGlobalState, run, free) {
- var error, eventInfo;
- if (this._states.jobStatus(this.options.id === "RUNNING")) {
- this._states.next(this.options.id);
- }
- this._assertStatus("EXECUTING");
- eventInfo = {args: this.args, options: this.options, retryCount: this.retryCount};
- error = new BottleneckError$1(`This job timed out after ${this.options.expiration} ms.`);
- return this._onFailure(error, eventInfo, clearGlobalState, run, free);
- }
-
- async _onFailure(error, eventInfo, clearGlobalState, run, free) {
- var retry, retryAfter;
- if (clearGlobalState()) {
- retry = (await this.Events.trigger("failed", error, eventInfo));
- if (retry != null) {
- retryAfter = ~~retry;
- this.Events.trigger("retry", `Retrying ${this.options.id} after ${retryAfter} ms`, eventInfo);
- this.retryCount++;
- return run(retryAfter);
- } else {
- this.doDone(eventInfo);
- await free(this.options, eventInfo);
- this._assertStatus("DONE");
- return this._reject(error);
- }
- }
- }
-
- doDone(eventInfo) {
- this._assertStatus("EXECUTING");
- this._states.next(this.options.id);
- return this.Events.trigger("done", eventInfo);
- }
-
- };
-
- var Job_1 = Job;
-
- var BottleneckError$2, LocalDatastore, parser$2;
-
- parser$2 = parser;
-
- BottleneckError$2 = BottleneckError_1;
-
- LocalDatastore = class LocalDatastore {
- constructor(instance, storeOptions, storeInstanceOptions) {
- this.instance = instance;
- this.storeOptions = storeOptions;
- this.clientId = this.instance._randomIndex();
- parser$2.load(storeInstanceOptions, storeInstanceOptions, this);
- this._nextRequest = this._lastReservoirRefresh = this._lastReservoirIncrease = Date.now();
- this._running = 0;
- this._done = 0;
- this._unblockTime = 0;
- this.ready = this.Promise.resolve();
- this.clients = {};
- this._startHeartbeat();
- }
-
- _startHeartbeat() {
- var base;
- if ((this.heartbeat == null) && (((this.storeOptions.reservoirRefreshInterval != null) && (this.storeOptions.reservoirRefreshAmount != null)) || ((this.storeOptions.reservoirIncreaseInterval != null) && (this.storeOptions.reservoirIncreaseAmount != null)))) {
- return typeof (base = (this.heartbeat = setInterval(() => {
- var amount, incr, maximum, now, reservoir;
- now = Date.now();
- if ((this.storeOptions.reservoirRefreshInterval != null) && now >= this._lastReservoirRefresh + this.storeOptions.reservoirRefreshInterval) {
- this._lastReservoirRefresh = now;
- this.storeOptions.reservoir = this.storeOptions.reservoirRefreshAmount;
- this.instance._drainAll(this.computeCapacity());
- }
- if ((this.storeOptions.reservoirIncreaseInterval != null) && now >= this._lastReservoirIncrease + this.storeOptions.reservoirIncreaseInterval) {
- ({
- reservoirIncreaseAmount: amount,
- reservoirIncreaseMaximum: maximum,
- reservoir
- } = this.storeOptions);
- this._lastReservoirIncrease = now;
- incr = maximum != null ? Math.min(amount, maximum - reservoir) : amount;
- if (incr > 0) {
- this.storeOptions.reservoir += incr;
- return this.instance._drainAll(this.computeCapacity());
- }
- }
- }, this.heartbeatInterval))).unref === "function" ? base.unref() : void 0;
- } else {
- return clearInterval(this.heartbeat);
- }
- }
-
- async __publish__(message) {
- await this.yieldLoop();
- return this.instance.Events.trigger("message", message.toString());
- }
-
- async __disconnect__(flush) {
- await this.yieldLoop();
- clearInterval(this.heartbeat);
- return this.Promise.resolve();
- }
-
- yieldLoop(t = 0) {
- return new this.Promise(function(resolve, reject) {
- return setTimeout(resolve, t);
- });
- }
-
- computePenalty() {
- var ref;
- return (ref = this.storeOptions.penalty) != null ? ref : (15 * this.storeOptions.minTime) || 5000;
- }
-
- async __updateSettings__(options) {
- await this.yieldLoop();
- parser$2.overwrite(options, options, this.storeOptions);
- this._startHeartbeat();
- this.instance._drainAll(this.computeCapacity());
- return true;
- }
-
- async __running__() {
- await this.yieldLoop();
- return this._running;
- }
-
- async __queued__() {
- await this.yieldLoop();
- return this.instance.queued();
- }
-
- async __done__() {
- await this.yieldLoop();
- return this._done;
- }
-
- async __groupCheck__(time) {
- await this.yieldLoop();
- return (this._nextRequest + this.timeout) < time;
- }
-
- computeCapacity() {
- var maxConcurrent, reservoir;
- ({maxConcurrent, reservoir} = this.storeOptions);
- if ((maxConcurrent != null) && (reservoir != null)) {
- return Math.min(maxConcurrent - this._running, reservoir);
- } else if (maxConcurrent != null) {
- return maxConcurrent - this._running;
- } else if (reservoir != null) {
- return reservoir;
- } else {
- return null;
- }
- }
-
- conditionsCheck(weight) {
- var capacity;
- capacity = this.computeCapacity();
- return (capacity == null) || weight <= capacity;
- }
-
- async __incrementReservoir__(incr) {
- var reservoir;
- await this.yieldLoop();
- reservoir = this.storeOptions.reservoir += incr;
- this.instance._drainAll(this.computeCapacity());
- return reservoir;
- }
-
- async __currentReservoir__() {
- await this.yieldLoop();
- return this.storeOptions.reservoir;
- }
-
- isBlocked(now) {
- return this._unblockTime >= now;
- }
-
- check(weight, now) {
- return this.conditionsCheck(weight) && (this._nextRequest - now) <= 0;
- }
-
- async __check__(weight) {
- var now;
- await this.yieldLoop();
- now = Date.now();
- return this.check(weight, now);
- }
-
- async __register__(index, weight, expiration) {
- var now, wait;
- await this.yieldLoop();
- now = Date.now();
- if (this.conditionsCheck(weight)) {
- this._running += weight;
- if (this.storeOptions.reservoir != null) {
- this.storeOptions.reservoir -= weight;
- }
- wait = Math.max(this._nextRequest - now, 0);
- this._nextRequest = now + wait + this.storeOptions.minTime;
- return {
- success: true,
- wait,
- reservoir: this.storeOptions.reservoir
- };
- } else {
- return {
- success: false
- };
- }
- }
-
- strategyIsBlock() {
- return this.storeOptions.strategy === 3;
- }
-
- async __submit__(queueLength, weight) {
- var blocked, now, reachedHWM;
- await this.yieldLoop();
- if ((this.storeOptions.maxConcurrent != null) && weight > this.storeOptions.maxConcurrent) {
- throw new BottleneckError$2(`Impossible to add a job having a weight of ${weight} to a limiter having a maxConcurrent setting of ${this.storeOptions.maxConcurrent}`);
- }
- now = Date.now();
- reachedHWM = (this.storeOptions.highWater != null) && queueLength === this.storeOptions.highWater && !this.check(weight, now);
- blocked = this.strategyIsBlock() && (reachedHWM || this.isBlocked(now));
- if (blocked) {
- this._unblockTime = now + this.computePenalty();
- this._nextRequest = this._unblockTime + this.storeOptions.minTime;
- this.instance._dropAllQueued();
- }
- return {
- reachedHWM,
- blocked,
- strategy: this.storeOptions.strategy
- };
- }
-
- async __free__(index, weight) {
- await this.yieldLoop();
- this._running -= weight;
- this._done += weight;
- this.instance._drainAll(this.computeCapacity());
- return {
- running: this._running
- };
- }
-
- };
-
- var LocalDatastore_1 = LocalDatastore;
-
- var BottleneckError$3, States;
-
- BottleneckError$3 = BottleneckError_1;
-
- States = class States {
- constructor(status1) {
- this.status = status1;
- this._jobs = {};
- this.counts = this.status.map(function() {
- return 0;
- });
- }
-
- next(id) {
- var current, next;
- current = this._jobs[id];
- next = current + 1;
- if ((current != null) && next < this.status.length) {
- this.counts[current]--;
- this.counts[next]++;
- return this._jobs[id]++;
- } else if (current != null) {
- this.counts[current]--;
- return delete this._jobs[id];
- }
- }
-
- start(id) {
- var initial;
- initial = 0;
- this._jobs[id] = initial;
- return this.counts[initial]++;
- }
-
- remove(id) {
- var current;
- current = this._jobs[id];
- if (current != null) {
- this.counts[current]--;
- delete this._jobs[id];
- }
- return current != null;
- }
-
- jobStatus(id) {
- var ref;
- return (ref = this.status[this._jobs[id]]) != null ? ref : null;
- }
-
- statusJobs(status) {
- var k, pos, ref, results, v;
- if (status != null) {
- pos = this.status.indexOf(status);
- if (pos < 0) {
- throw new BottleneckError$3(`status must be one of ${this.status.join(', ')}`);
- }
- ref = this._jobs;
- results = [];
- for (k in ref) {
- v = ref[k];
- if (v === pos) {
- results.push(k);
- }
- }
- return results;
- } else {
- return Object.keys(this._jobs);
- }
- }
-
- statusCounts() {
- return this.counts.reduce(((acc, v, i) => {
- acc[this.status[i]] = v;
- return acc;
- }), {});
- }
-
- };
-
- var States_1 = States;
-
- var DLList$2, Sync;
-
- DLList$2 = DLList_1;
-
- Sync = class Sync {
- constructor(name, Promise) {
- this.schedule = this.schedule.bind(this);
- this.name = name;
- this.Promise = Promise;
- this._running = 0;
- this._queue = new DLList$2();
- }
-
- isEmpty() {
- return this._queue.length === 0;
- }
-
- async _tryToRun() {
- var args, cb, error, reject, resolve, returned, task;
- if ((this._running < 1) && this._queue.length > 0) {
- this._running++;
- ({task, args, resolve, reject} = this._queue.shift());
- cb = (await (async function() {
- try {
- returned = (await task(...args));
- return function() {
- return resolve(returned);
- };
- } catch (error1) {
- error = error1;
- return function() {
- return reject(error);
- };
- }
- })());
- this._running--;
- this._tryToRun();
- return cb();
- }
- }
-
- schedule(task, ...args) {
- var promise, reject, resolve;
- resolve = reject = null;
- promise = new this.Promise(function(_resolve, _reject) {
- resolve = _resolve;
- return reject = _reject;
- });
- this._queue.push({task, args, resolve, reject});
- this._tryToRun();
- return promise;
- }
-
- };
-
- var Sync_1 = Sync;
-
- var version = "2.19.5";
- var version$1 = {
- version: version
- };
-
- var version$2 = /*#__PURE__*/Object.freeze({
- version: version,
- default: version$1
- });
-
- var require$$2 = () => console.log('You must import the full version of Bottleneck in order to use this feature.');
-
- var require$$3 = () => console.log('You must import the full version of Bottleneck in order to use this feature.');
-
- var require$$4 = () => console.log('You must import the full version of Bottleneck in order to use this feature.');
-
- var Events$2, Group, IORedisConnection$1, RedisConnection$1, Scripts$1, parser$3;
-
- parser$3 = parser;
-
- Events$2 = Events_1;
-
- RedisConnection$1 = require$$2;
-
- IORedisConnection$1 = require$$3;
-
- Scripts$1 = require$$4;
-
- Group = (function() {
- class Group {
- constructor(limiterOptions = {}) {
- this.deleteKey = this.deleteKey.bind(this);
- this.limiterOptions = limiterOptions;
- parser$3.load(this.limiterOptions, this.defaults, this);
- this.Events = new Events$2(this);
- this.instances = {};
- this.Bottleneck = Bottleneck_1;
- this._startAutoCleanup();
- this.sharedConnection = this.connection != null;
- if (this.connection == null) {
- if (this.limiterOptions.datastore === "redis") {
- this.connection = new RedisConnection$1(Object.assign({}, this.limiterOptions, {Events: this.Events}));
- } else if (this.limiterOptions.datastore === "ioredis") {
- this.connection = new IORedisConnection$1(Object.assign({}, this.limiterOptions, {Events: this.Events}));
- }
- }
- }
-
- key(key = "") {
- var ref;
- return (ref = this.instances[key]) != null ? ref : (() => {
- var limiter;
- limiter = this.instances[key] = new this.Bottleneck(Object.assign(this.limiterOptions, {
- id: `${this.id}-${key}`,
- timeout: this.timeout,
- connection: this.connection
- }));
- this.Events.trigger("created", limiter, key);
- return limiter;
- })();
- }
-
- async deleteKey(key = "") {
- var deleted, instance;
- instance = this.instances[key];
- if (this.connection) {
- deleted = (await this.connection.__runCommand__(['del', ...Scripts$1.allKeys(`${this.id}-${key}`)]));
- }
- if (instance != null) {
- delete this.instances[key];
- await instance.disconnect();
- }
- return (instance != null) || deleted > 0;
- }
-
- limiters() {
- var k, ref, results, v;
- ref = this.instances;
- results = [];
- for (k in ref) {
- v = ref[k];
- results.push({
- key: k,
- limiter: v
- });
- }
- return results;
- }
-
- keys() {
- return Object.keys(this.instances);
- }
-
- async clusterKeys() {
- var cursor, end, found, i, k, keys, len, next, start;
- if (this.connection == null) {
- return this.Promise.resolve(this.keys());
- }
- keys = [];
- cursor = null;
- start = `b_${this.id}-`.length;
- end = "_settings".length;
- while (cursor !== 0) {
- [next, found] = (await this.connection.__runCommand__(["scan", cursor != null ? cursor : 0, "match", `b_${this.id}-*_settings`, "count", 10000]));
- cursor = ~~next;
- for (i = 0, len = found.length; i < len; i++) {
- k = found[i];
- keys.push(k.slice(start, -end));
- }
- }
- return keys;
- }
-
- _startAutoCleanup() {
- var base;
- clearInterval(this.interval);
- return typeof (base = (this.interval = setInterval(async() => {
- var e, k, ref, results, time, v;
- time = Date.now();
- ref = this.instances;
- results = [];
- for (k in ref) {
- v = ref[k];
- try {
- if ((await v._store.__groupCheck__(time))) {
- results.push(this.deleteKey(k));
- } else {
- results.push(void 0);
- }
- } catch (error) {
- e = error;
- results.push(v.Events.trigger("error", e));
- }
- }
- return results;
- }, this.timeout / 2))).unref === "function" ? base.unref() : void 0;
- }
-
- updateSettings(options = {}) {
- parser$3.overwrite(options, this.defaults, this);
- parser$3.overwrite(options, options, this.limiterOptions);
- if (options.timeout != null) {
- return this._startAutoCleanup();
- }
- }
-
- disconnect(flush = true) {
- var ref;
- if (!this.sharedConnection) {
- return (ref = this.connection) != null ? ref.disconnect(flush) : void 0;
- }
- }
-
- }
- Group.prototype.defaults = {
- timeout: 1000 * 60 * 5,
- connection: null,
- Promise: Promise,
- id: "group-key"
- };
-
- return Group;
-
- }).call(commonjsGlobal);
-
- var Group_1 = Group;
-
- var Batcher, Events$3, parser$4;
-
- parser$4 = parser;
-
- Events$3 = Events_1;
-
- Batcher = (function() {
- class Batcher {
- constructor(options = {}) {
- this.options = options;
- parser$4.load(this.options, this.defaults, this);
- this.Events = new Events$3(this);
- this._arr = [];
- this._resetPromise();
- this._lastFlush = Date.now();
- }
-
- _resetPromise() {
- return this._promise = new this.Promise((res, rej) => {
- return this._resolve = res;
- });
- }
-
- _flush() {
- clearTimeout(this._timeout);
- this._lastFlush = Date.now();
- this._resolve();
- this.Events.trigger("batch", this._arr);
- this._arr = [];
- return this._resetPromise();
- }
-
- add(data) {
- var ret;
- this._arr.push(data);
- ret = this._promise;
- if (this._arr.length === this.maxSize) {
- this._flush();
- } else if ((this.maxTime != null) && this._arr.length === 1) {
- this._timeout = setTimeout(() => {
- return this._flush();
- }, this.maxTime);
- }
- return ret;
- }
-
- }
- Batcher.prototype.defaults = {
- maxTime: null,
- maxSize: null,
- Promise: Promise
- };
-
- return Batcher;
-
- }).call(commonjsGlobal);
-
- var Batcher_1 = Batcher;
-
- var require$$4$1 = () => console.log('You must import the full version of Bottleneck in order to use this feature.');
-
- var require$$8 = getCjsExportFromNamespace(version$2);
-
- var Bottleneck, DEFAULT_PRIORITY$1, Events$4, Job$1, LocalDatastore$1, NUM_PRIORITIES$1, Queues$1, RedisDatastore$1, States$1, Sync$1, parser$5,
- splice = [].splice;
-
- NUM_PRIORITIES$1 = 10;
-
- DEFAULT_PRIORITY$1 = 5;
-
- parser$5 = parser;
-
- Queues$1 = Queues_1;
-
- Job$1 = Job_1;
-
- LocalDatastore$1 = LocalDatastore_1;
-
- RedisDatastore$1 = require$$4$1;
-
- Events$4 = Events_1;
-
- States$1 = States_1;
-
- Sync$1 = Sync_1;
-
- Bottleneck = (function() {
- class Bottleneck {
- constructor(options = {}, ...invalid) {
- var storeInstanceOptions, storeOptions;
- this._addToQueue = this._addToQueue.bind(this);
- this._validateOptions(options, invalid);
- parser$5.load(options, this.instanceDefaults, this);
- this._queues = new Queues$1(NUM_PRIORITIES$1);
- this._scheduled = {};
- this._states = new States$1(["RECEIVED", "QUEUED", "RUNNING", "EXECUTING"].concat(this.trackDoneStatus ? ["DONE"] : []));
- this._limiter = null;
- this.Events = new Events$4(this);
- this._submitLock = new Sync$1("submit", this.Promise);
- this._registerLock = new Sync$1("register", this.Promise);
- storeOptions = parser$5.load(options, this.storeDefaults, {});
- this._store = (function() {
- if (this.datastore === "redis" || this.datastore === "ioredis" || (this.connection != null)) {
- storeInstanceOptions = parser$5.load(options, this.redisStoreDefaults, {});
- return new RedisDatastore$1(this, storeOptions, storeInstanceOptions);
- } else if (this.datastore === "local") {
- storeInstanceOptions = parser$5.load(options, this.localStoreDefaults, {});
- return new LocalDatastore$1(this, storeOptions, storeInstanceOptions);
- } else {
- throw new Bottleneck.prototype.BottleneckError(`Invalid datastore type: ${this.datastore}`);
- }
- }).call(this);
- this._queues.on("leftzero", () => {
- var ref;
- return (ref = this._store.heartbeat) != null ? typeof ref.ref === "function" ? ref.ref() : void 0 : void 0;
- });
- this._queues.on("zero", () => {
- var ref;
- return (ref = this._store.heartbeat) != null ? typeof ref.unref === "function" ? ref.unref() : void 0 : void 0;
- });
- }
-
- _validateOptions(options, invalid) {
- if (!((options != null) && typeof options === "object" && invalid.length === 0)) {
- throw new Bottleneck.prototype.BottleneckError("Bottleneck v2 takes a single object argument. Refer to https://github.com/SGrondin/bottleneck#upgrading-to-v2 if you're upgrading from Bottleneck v1.");
- }
- }
-
- ready() {
- return this._store.ready;
- }
-
- clients() {
- return this._store.clients;
- }
-
- channel() {
- return `b_${this.id}`;
- }
-
- channel_client() {
- return `b_${this.id}_${this._store.clientId}`;
- }
-
- publish(message) {
- return this._store.__publish__(message);
- }
-
- disconnect(flush = true) {
- return this._store.__disconnect__(flush);
- }
-
- chain(_limiter) {
- this._limiter = _limiter;
- return this;
- }
-
- queued(priority) {
- return this._queues.queued(priority);
- }
-
- clusterQueued() {
- return this._store.__queued__();
- }
-
- empty() {
- return this.queued() === 0 && this._submitLock.isEmpty();
- }
-
- running() {
- return this._store.__running__();
- }
-
- done() {
- return this._store.__done__();
- }
-
- jobStatus(id) {
- return this._states.jobStatus(id);
- }
-
- jobs(status) {
- return this._states.statusJobs(status);
- }
-
- counts() {
- return this._states.statusCounts();
- }
-
- _randomIndex() {
- return Math.random().toString(36).slice(2);
- }
-
- check(weight = 1) {
- return this._store.__check__(weight);
- }
-
- _clearGlobalState(index) {
- if (this._scheduled[index] != null) {
- clearTimeout(this._scheduled[index].expiration);
- delete this._scheduled[index];
- return true;
- } else {
- return false;
- }
- }
-
- async _free(index, job, options, eventInfo) {
- var e, running;
- try {
- ({running} = (await this._store.__free__(index, options.weight)));
- this.Events.trigger("debug", `Freed ${options.id}`, eventInfo);
- if (running === 0 && this.empty()) {
- return this.Events.trigger("idle");
- }
- } catch (error1) {
- e = error1;
- return this.Events.trigger("error", e);
- }
- }
-
- _run(index, job, wait) {
- var clearGlobalState, free, run;
- job.doRun();
- clearGlobalState = this._clearGlobalState.bind(this, index);
- run = this._run.bind(this, index, job);
- free = this._free.bind(this, index, job);
- return this._scheduled[index] = {
- timeout: setTimeout(() => {
- return job.doExecute(this._limiter, clearGlobalState, run, free);
- }, wait),
- expiration: job.options.expiration != null ? setTimeout(function() {
- return job.doExpire(clearGlobalState, run, free);
- }, wait + job.options.expiration) : void 0,
- job: job
- };
- }
-
- _drainOne(capacity) {
- return this._registerLock.schedule(() => {
- var args, index, next, options, queue;
- if (this.queued() === 0) {
- return this.Promise.resolve(null);
- }
- queue = this._queues.getFirst();
- ({options, args} = next = queue.first());
- if ((capacity != null) && options.weight > capacity) {
- return this.Promise.resolve(null);
- }
- this.Events.trigger("debug", `Draining ${options.id}`, {args, options});
- index = this._randomIndex();
- return this._store.__register__(index, options.weight, options.expiration).then(({success, wait, reservoir}) => {
- var empty;
- this.Events.trigger("debug", `Drained ${options.id}`, {success, args, options});
- if (success) {
- queue.shift();
- empty = this.empty();
- if (empty) {
- this.Events.trigger("empty");
- }
- if (reservoir === 0) {
- this.Events.trigger("depleted", empty);
- }
- this._run(index, next, wait);
- return this.Promise.resolve(options.weight);
- } else {
- return this.Promise.resolve(null);
- }
- });
- });
- }
-
- _drainAll(capacity, total = 0) {
- return this._drainOne(capacity).then((drained) => {
- var newCapacity;
- if (drained != null) {
- newCapacity = capacity != null ? capacity - drained : capacity;
- return this._drainAll(newCapacity, total + drained);
- } else {
- return this.Promise.resolve(total);
- }
- }).catch((e) => {
- return this.Events.trigger("error", e);
- });
- }
-
- _dropAllQueued(message) {
- return this._queues.shiftAll(function(job) {
- return job.doDrop({message});
- });
- }
-
- stop(options = {}) {
- var done, waitForExecuting;
- options = parser$5.load(options, this.stopDefaults);
- waitForExecuting = (at) => {
- var finished;
- finished = () => {
- var counts;
- counts = this._states.counts;
- return (counts[0] + counts[1] + counts[2] + counts[3]) === at;
- };
- return new this.Promise((resolve, reject) => {
- if (finished()) {
- return resolve();
- } else {
- return this.on("done", () => {
- if (finished()) {
- this.removeAllListeners("done");
- return resolve();
- }
- });
- }
- });
- };
- done = options.dropWaitingJobs ? (this._run = function(index, next) {
- return next.doDrop({
- message: options.dropErrorMessage
- });
- }, this._drainOne = () => {
- return this.Promise.resolve(null);
- }, this._registerLock.schedule(() => {
- return this._submitLock.schedule(() => {
- var k, ref, v;
- ref = this._scheduled;
- for (k in ref) {
- v = ref[k];
- if (this.jobStatus(v.job.options.id) === "RUNNING") {
- clearTimeout(v.timeout);
- clearTimeout(v.expiration);
- v.job.doDrop({
- message: options.dropErrorMessage
- });
- }
- }
- this._dropAllQueued(options.dropErrorMessage);
- return waitForExecuting(0);
- });
- })) : this.schedule({
- priority: NUM_PRIORITIES$1 - 1,
- weight: 0
- }, () => {
- return waitForExecuting(1);
- });
- this._receive = function(job) {
- return job._reject(new Bottleneck.prototype.BottleneckError(options.enqueueErrorMessage));
- };
- this.stop = () => {
- return this.Promise.reject(new Bottleneck.prototype.BottleneckError("stop() has already been called"));
- };
- return done;
- }
-
- async _addToQueue(job) {
- var args, blocked, error, options, reachedHWM, shifted, strategy;
- ({args, options} = job);
- try {
- ({reachedHWM, blocked, strategy} = (await this._store.__submit__(this.queued(), options.weight)));
- } catch (error1) {
- error = error1;
- this.Events.trigger("debug", `Could not queue ${options.id}`, {args, options, error});
- job.doDrop({error});
- return false;
- }
- if (blocked) {
- job.doDrop();
- return true;
- } else if (reachedHWM) {
- shifted = strategy === Bottleneck.prototype.strategy.LEAK ? this._queues.shiftLastFrom(options.priority) : strategy === Bottleneck.prototype.strategy.OVERFLOW_PRIORITY ? this._queues.shiftLastFrom(options.priority + 1) : strategy === Bottleneck.prototype.strategy.OVERFLOW ? job : void 0;
- if (shifted != null) {
- shifted.doDrop();
- }
- if ((shifted == null) || strategy === Bottleneck.prototype.strategy.OVERFLOW) {
- if (shifted == null) {
- job.doDrop();
- }
- return reachedHWM;
- }
- }
- job.doQueue(reachedHWM, blocked);
- this._queues.push(job);
- await this._drainAll();
- return reachedHWM;
- }
-
- _receive(job) {
- if (this._states.jobStatus(job.options.id) != null) {
- job._reject(new Bottleneck.prototype.BottleneckError(`A job with the same id already exists (id=${job.options.id})`));
- return false;
- } else {
- job.doReceive();
- return this._submitLock.schedule(this._addToQueue, job);
- }
- }
-
- submit(...args) {
- var cb, fn, job, options, ref, ref1, task;
- if (typeof args[0] === "function") {
- ref = args, [fn, ...args] = ref, [cb] = splice.call(args, -1);
- options = parser$5.load({}, this.jobDefaults);
- } else {
- ref1 = args, [options, fn, ...args] = ref1, [cb] = splice.call(args, -1);
- options = parser$5.load(options, this.jobDefaults);
- }
- task = (...args) => {
- return new this.Promise(function(resolve, reject) {
- return fn(...args, function(...args) {
- return (args[0] != null ? reject : resolve)(args);
- });
- });
- };
- job = new Job$1(task, args, options, this.jobDefaults, this.rejectOnDrop, this.Events, this._states, this.Promise);
- job.promise.then(function(args) {
- return typeof cb === "function" ? cb(...args) : void 0;
- }).catch(function(args) {
- if (Array.isArray(args)) {
- return typeof cb === "function" ? cb(...args) : void 0;
- } else {
- return typeof cb === "function" ? cb(args) : void 0;
- }
- });
- return this._receive(job);
- }
-
- schedule(...args) {
- var job, options, task;
- if (typeof args[0] === "function") {
- [task, ...args] = args;
- options = {};
- } else {
- [options, task, ...args] = args;
- }
- job = new Job$1(task, args, options, this.jobDefaults, this.rejectOnDrop, this.Events, this._states, this.Promise);
- this._receive(job);
- return job.promise;
- }
-
- wrap(fn) {
- var schedule, wrapped;
- schedule = this.schedule.bind(this);
- wrapped = function(...args) {
- return schedule(fn.bind(this), ...args);
- };
- wrapped.withOptions = function(options, ...args) {
- return schedule(options, fn, ...args);
- };
- return wrapped;
- }
-
- async updateSettings(options = {}) {
- await this._store.__updateSettings__(parser$5.overwrite(options, this.storeDefaults));
- parser$5.overwrite(options, this.instanceDefaults, this);
- return this;
- }
-
- currentReservoir() {
- return this._store.__currentReservoir__();
- }
-
- incrementReservoir(incr = 0) {
- return this._store.__incrementReservoir__(incr);
- }
-
- }
- Bottleneck.default = Bottleneck;
-
- Bottleneck.Events = Events$4;
-
- Bottleneck.version = Bottleneck.prototype.version = require$$8.version;
-
- Bottleneck.strategy = Bottleneck.prototype.strategy = {
- LEAK: 1,
- OVERFLOW: 2,
- OVERFLOW_PRIORITY: 4,
- BLOCK: 3
- };
-
- Bottleneck.BottleneckError = Bottleneck.prototype.BottleneckError = BottleneckError_1;
-
- Bottleneck.Group = Bottleneck.prototype.Group = Group_1;
-
- Bottleneck.RedisConnection = Bottleneck.prototype.RedisConnection = require$$2;
-
- Bottleneck.IORedisConnection = Bottleneck.prototype.IORedisConnection = require$$3;
-
- Bottleneck.Batcher = Bottleneck.prototype.Batcher = Batcher_1;
-
- Bottleneck.prototype.jobDefaults = {
- priority: DEFAULT_PRIORITY$1,
- weight: 1,
- expiration: null,
- id: ""
- };
-
- Bottleneck.prototype.storeDefaults = {
- maxConcurrent: null,
- minTime: 0,
- highWater: null,
- strategy: Bottleneck.prototype.strategy.LEAK,
- penalty: null,
- reservoir: null,
- reservoirRefreshInterval: null,
- reservoirRefreshAmount: null,
- reservoirIncreaseInterval: null,
- reservoirIncreaseAmount: null,
- reservoirIncreaseMaximum: null
- };
-
- Bottleneck.prototype.localStoreDefaults = {
- Promise: Promise,
- timeout: null,
- heartbeatInterval: 250
- };
-
- Bottleneck.prototype.redisStoreDefaults = {
- Promise: Promise,
- timeout: null,
- heartbeatInterval: 5000,
- clientTimeout: 10000,
- Redis: null,
- clientOptions: {},
- clusterNodes: null,
- clearDatastore: false,
- connection: null
- };
-
- Bottleneck.prototype.instanceDefaults = {
- datastore: "local",
- connection: null,
- id: "",
- rejectOnDrop: true,
- trackDoneStatus: false,
- Promise: Promise
- };
-
- Bottleneck.prototype.stopDefaults = {
- enqueueErrorMessage: "This limiter has been stopped and cannot accept new jobs.",
- dropWaitingJobs: true,
- dropErrorMessage: "This limiter has been stopped."
- };
-
- return Bottleneck;
-
- }).call(commonjsGlobal);
-
- var Bottleneck_1 = Bottleneck;
-
- var lib = Bottleneck_1;
-
- return lib;
-
-})));
-
-
-/***/ }),
-
-/***/ 33717:
-/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
-
-var balanced = __nccwpck_require__(9417);
-
-module.exports = expandTop;
-
-var escSlash = '\0SLASH'+Math.random()+'\0';
-var escOpen = '\0OPEN'+Math.random()+'\0';
-var escClose = '\0CLOSE'+Math.random()+'\0';
-var escComma = '\0COMMA'+Math.random()+'\0';
-var escPeriod = '\0PERIOD'+Math.random()+'\0';
-
-function numeric(str) {
- return parseInt(str, 10) == str
- ? parseInt(str, 10)
- : str.charCodeAt(0);
-}
-
-function escapeBraces(str) {
- return str.split('\\\\').join(escSlash)
- .split('\\{').join(escOpen)
- .split('\\}').join(escClose)
- .split('\\,').join(escComma)
- .split('\\.').join(escPeriod);
-}
-
-function unescapeBraces(str) {
- return str.split(escSlash).join('\\')
- .split(escOpen).join('{')
- .split(escClose).join('}')
- .split(escComma).join(',')
- .split(escPeriod).join('.');
-}
-
-
-// Basically just str.split(","), but handling cases
-// where we have nested braced sections, which should be
-// treated as individual members, like {a,{b,c},d}
-function parseCommaParts(str) {
- if (!str)
- return [''];
-
- var parts = [];
- var m = balanced('{', '}', str);
-
- if (!m)
- return str.split(',');
-
- var pre = m.pre;
- var body = m.body;
- var post = m.post;
- var p = pre.split(',');
-
- p[p.length-1] += '{' + body + '}';
- var postParts = parseCommaParts(post);
- if (post.length) {
- p[p.length-1] += postParts.shift();
- p.push.apply(p, postParts);
- }
-
- parts.push.apply(parts, p);
-
- return parts;
-}
-
-function expandTop(str) {
- if (!str)
- return [];
-
- // I don't know why Bash 4.3 does this, but it does.
- // Anything starting with {} will have the first two bytes preserved
- // but *only* at the top level, so {},a}b will not expand to anything,
- // but a{},b}c will be expanded to [a}c,abc].
- // One could argue that this is a bug in Bash, but since the goal of
- // this module is to match Bash's rules, we escape a leading {}
- if (str.substr(0, 2) === '{}') {
- str = '\\{\\}' + str.substr(2);
- }
-
- return expand(escapeBraces(str), true).map(unescapeBraces);
-}
-
-function embrace(str) {
- return '{' + str + '}';
-}
-function isPadded(el) {
- return /^-?0\d/.test(el);
-}
-
-function lte(i, y) {
- return i <= y;
-}
-function gte(i, y) {
- return i >= y;
-}
-
-function expand(str, isTop) {
- var expansions = [];
-
- var m = balanced('{', '}', str);
- if (!m) return [str];
-
- // no need to expand pre, since it is guaranteed to be free of brace-sets
- var pre = m.pre;
- var post = m.post.length
- ? expand(m.post, false)
- : [''];
-
- if (/\$$/.test(m.pre)) {
- for (var k = 0; k < post.length; k++) {
- var expansion = pre+ '{' + m.body + '}' + post[k];
- expansions.push(expansion);
- }
- } else {
- var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
- var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
- var isSequence = isNumericSequence || isAlphaSequence;
- var isOptions = m.body.indexOf(',') >= 0;
- if (!isSequence && !isOptions) {
- // {a},b}
- if (m.post.match(/,.*\}/)) {
- str = m.pre + '{' + m.body + escClose + m.post;
- return expand(str);
- }
- return [str];
- }
-
- var n;
- if (isSequence) {
- n = m.body.split(/\.\./);
- } else {
- n = parseCommaParts(m.body);
- if (n.length === 1) {
- // x{{a,b}}y ==> x{a}y x{b}y
- n = expand(n[0], false).map(embrace);
- if (n.length === 1) {
- return post.map(function(p) {
- return m.pre + n[0] + p;
- });
- }
- }
- }
-
- // at this point, n is the parts, and we know it's not a comma set
- // with a single entry.
- var N;
-
- if (isSequence) {
- var x = numeric(n[0]);
- var y = numeric(n[1]);
- var width = Math.max(n[0].length, n[1].length)
- var incr = n.length == 3
- ? Math.abs(numeric(n[2]))
- : 1;
- var test = lte;
- var reverse = y < x;
- if (reverse) {
- incr *= -1;
- test = gte;
- }
- var pad = n.some(isPadded);
-
- N = [];
-
- for (var i = x; test(i, y); i += incr) {
- var c;
- if (isAlphaSequence) {
- c = String.fromCharCode(i);
- if (c === '\\')
- c = '';
- } else {
- c = String(i);
- if (pad) {
- var need = width - c.length;
- if (need > 0) {
- var z = new Array(need + 1).join('0');
- if (i < 0)
- c = '-' + z + c.slice(1);
- else
- c = z + c;
- }
- }
- }
- N.push(c);
- }
- } else {
- N = [];
-
- for (var j = 0; j < n.length; j++) {
- N.push.apply(N, expand(n[j], false));
- }
- }
-
- for (var j = 0; j < N.length; j++) {
- for (var k = 0; k < post.length; k++) {
- var expansion = pre + N[j] + post[k];
- if (!isTop || isSequence || expansion)
- expansions.push(expansion);
- }
- }
- }
-
- return expansions;
-}
-
-
-
-/***/ }),
-
-/***/ 50610:
-/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-const stringify = __nccwpck_require__(38750);
-const compile = __nccwpck_require__(79434);
-const expand = __nccwpck_require__(35873);
-const parse = __nccwpck_require__(96477);
-
-/**
- * Expand the given pattern or create a regex-compatible string.
- *
- * ```js
- * const braces = require('braces');
- * console.log(braces('{a,b,c}', { compile: true })); //=> ['(a|b|c)']
- * console.log(braces('{a,b,c}')); //=> ['a', 'b', 'c']
- * ```
- * @param {String} `str`
- * @param {Object} `options`
- * @return {String}
- * @api public
- */
-
-const braces = (input, options = {}) => {
- let output = [];
-
- if (Array.isArray(input)) {
- for (let pattern of input) {
- let result = braces.create(pattern, options);
- if (Array.isArray(result)) {
- output.push(...result);
- } else {
- output.push(result);
- }
- }
- } else {
- output = [].concat(braces.create(input, options));
- }
-
- if (options && options.expand === true && options.nodupes === true) {
- output = [...new Set(output)];
- }
- return output;
-};
-
-/**
- * Parse the given `str` with the given `options`.
- *
- * ```js
- * // braces.parse(pattern, [, options]);
- * const ast = braces.parse('a/{b,c}/d');
- * console.log(ast);
- * ```
- * @param {String} pattern Brace pattern to parse
- * @param {Object} options
- * @return {Object} Returns an AST
- * @api public
- */
-
-braces.parse = (input, options = {}) => parse(input, options);
-
-/**
- * Creates a braces string from an AST, or an AST node.
- *
- * ```js
- * const braces = require('braces');
- * let ast = braces.parse('foo/{a,b}/bar');
- * console.log(stringify(ast.nodes[2])); //=> '{a,b}'
- * ```
- * @param {String} `input` Brace pattern or AST.
- * @param {Object} `options`
- * @return {Array} Returns an array of expanded values.
- * @api public
- */
-
-braces.stringify = (input, options = {}) => {
- if (typeof input === 'string') {
- return stringify(braces.parse(input, options), options);
- }
- return stringify(input, options);
-};
-
-/**
- * Compiles a brace pattern into a regex-compatible, optimized string.
- * This method is called by the main [braces](#braces) function by default.
- *
- * ```js
- * const braces = require('braces');
- * console.log(braces.compile('a/{b,c}/d'));
- * //=> ['a/(b|c)/d']
- * ```
- * @param {String} `input` Brace pattern or AST.
- * @param {Object} `options`
- * @return {Array} Returns an array of expanded values.
- * @api public
- */
-
-braces.compile = (input, options = {}) => {
- if (typeof input === 'string') {
- input = braces.parse(input, options);
- }
- return compile(input, options);
-};
-
-/**
- * Expands a brace pattern into an array. This method is called by the
- * main [braces](#braces) function when `options.expand` is true. Before
- * using this method it's recommended that you read the [performance notes](#performance))
- * and advantages of using [.compile](#compile) instead.
- *
- * ```js
- * const braces = require('braces');
- * console.log(braces.expand('a/{b,c}/d'));
- * //=> ['a/b/d', 'a/c/d'];
- * ```
- * @param {String} `pattern` Brace pattern
- * @param {Object} `options`
- * @return {Array} Returns an array of expanded values.
- * @api public
- */
-
-braces.expand = (input, options = {}) => {
- if (typeof input === 'string') {
- input = braces.parse(input, options);
- }
-
- let result = expand(input, options);
-
- // filter out empty strings if specified
- if (options.noempty === true) {
- result = result.filter(Boolean);
- }
-
- // filter out duplicates if specified
- if (options.nodupes === true) {
- result = [...new Set(result)];
- }
-
- return result;
-};
-
-/**
- * Processes a brace pattern and returns either an expanded array
- * (if `options.expand` is true), a highly optimized regex-compatible string.
- * This method is called by the main [braces](#braces) function.
- *
- * ```js
- * const braces = require('braces');
- * console.log(braces.create('user-{200..300}/project-{a,b,c}-{1..10}'))
- * //=> 'user-(20[0-9]|2[1-9][0-9]|300)/project-(a|b|c)-([1-9]|10)'
- * ```
- * @param {String} `pattern` Brace pattern
- * @param {Object} `options`
- * @return {Array} Returns an array of expanded values.
- * @api public
- */
-
-braces.create = (input, options = {}) => {
- if (input === '' || input.length < 3) {
- return [input];
- }
-
- return options.expand !== true
- ? braces.compile(input, options)
- : braces.expand(input, options);
-};
-
-/**
- * Expose "braces"
- */
-
-module.exports = braces;
-
-
-/***/ }),
-
-/***/ 79434:
-/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-const fill = __nccwpck_require__(6330);
-const utils = __nccwpck_require__(45207);
-
-const compile = (ast, options = {}) => {
- let walk = (node, parent = {}) => {
- let invalidBlock = utils.isInvalidBrace(parent);
- let invalidNode = node.invalid === true && options.escapeInvalid === true;
- let invalid = invalidBlock === true || invalidNode === true;
- let prefix = options.escapeInvalid === true ? '\\' : '';
- let output = '';
-
- if (node.isOpen === true) {
- return prefix + node.value;
- }
- if (node.isClose === true) {
- return prefix + node.value;
- }
-
- if (node.type === 'open') {
- return invalid ? (prefix + node.value) : '(';
- }
-
- if (node.type === 'close') {
- return invalid ? (prefix + node.value) : ')';
- }
-
- if (node.type === 'comma') {
- return node.prev.type === 'comma' ? '' : (invalid ? node.value : '|');
- }
-
- if (node.value) {
- return node.value;
- }
-
- if (node.nodes && node.ranges > 0) {
- let args = utils.reduce(node.nodes);
- let range = fill(...args, { ...options, wrap: false, toRegex: true });
-
- if (range.length !== 0) {
- return args.length > 1 && range.length > 1 ? `(${range})` : range;
- }
- }
-
- if (node.nodes) {
- for (let child of node.nodes) {
- output += walk(child, node);
- }
- }
- return output;
- };
-
- return walk(ast);
-};
-
-module.exports = compile;
-
-
-/***/ }),
-
-/***/ 18774:
-/***/ ((module) => {
-
-"use strict";
-
-
-module.exports = {
- MAX_LENGTH: 1024 * 64,
-
- // Digits
- CHAR_0: '0', /* 0 */
- CHAR_9: '9', /* 9 */
-
- // Alphabet chars.
- CHAR_UPPERCASE_A: 'A', /* A */
- CHAR_LOWERCASE_A: 'a', /* a */
- CHAR_UPPERCASE_Z: 'Z', /* Z */
- CHAR_LOWERCASE_Z: 'z', /* z */
-
- CHAR_LEFT_PARENTHESES: '(', /* ( */
- CHAR_RIGHT_PARENTHESES: ')', /* ) */
-
- CHAR_ASTERISK: '*', /* * */
-
- // Non-alphabetic chars.
- CHAR_AMPERSAND: '&', /* & */
- CHAR_AT: '@', /* @ */
- CHAR_BACKSLASH: '\\', /* \ */
- CHAR_BACKTICK: '`', /* ` */
- CHAR_CARRIAGE_RETURN: '\r', /* \r */
- CHAR_CIRCUMFLEX_ACCENT: '^', /* ^ */
- CHAR_COLON: ':', /* : */
- CHAR_COMMA: ',', /* , */
- CHAR_DOLLAR: '$', /* . */
- CHAR_DOT: '.', /* . */
- CHAR_DOUBLE_QUOTE: '"', /* " */
- CHAR_EQUAL: '=', /* = */
- CHAR_EXCLAMATION_MARK: '!', /* ! */
- CHAR_FORM_FEED: '\f', /* \f */
- CHAR_FORWARD_SLASH: '/', /* / */
- CHAR_HASH: '#', /* # */
- CHAR_HYPHEN_MINUS: '-', /* - */
- CHAR_LEFT_ANGLE_BRACKET: '<', /* < */
- CHAR_LEFT_CURLY_BRACE: '{', /* { */
- CHAR_LEFT_SQUARE_BRACKET: '[', /* [ */
- CHAR_LINE_FEED: '\n', /* \n */
- CHAR_NO_BREAK_SPACE: '\u00A0', /* \u00A0 */
- CHAR_PERCENT: '%', /* % */
- CHAR_PLUS: '+', /* + */
- CHAR_QUESTION_MARK: '?', /* ? */
- CHAR_RIGHT_ANGLE_BRACKET: '>', /* > */
- CHAR_RIGHT_CURLY_BRACE: '}', /* } */
- CHAR_RIGHT_SQUARE_BRACKET: ']', /* ] */
- CHAR_SEMICOLON: ';', /* ; */
- CHAR_SINGLE_QUOTE: '\'', /* ' */
- CHAR_SPACE: ' ', /* */
- CHAR_TAB: '\t', /* \t */
- CHAR_UNDERSCORE: '_', /* _ */
- CHAR_VERTICAL_LINE: '|', /* | */
- CHAR_ZERO_WIDTH_NOBREAK_SPACE: '\uFEFF' /* \uFEFF */
-};
-
-
-/***/ }),
-
-/***/ 35873:
-/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-const fill = __nccwpck_require__(6330);
-const stringify = __nccwpck_require__(38750);
-const utils = __nccwpck_require__(45207);
-
-const append = (queue = '', stash = '', enclose = false) => {
- let result = [];
-
- queue = [].concat(queue);
- stash = [].concat(stash);
-
- if (!stash.length) return queue;
- if (!queue.length) {
- return enclose ? utils.flatten(stash).map(ele => `{${ele}}`) : stash;
- }
-
- for (let item of queue) {
- if (Array.isArray(item)) {
- for (let value of item) {
- result.push(append(value, stash, enclose));
- }
- } else {
- for (let ele of stash) {
- if (enclose === true && typeof ele === 'string') ele = `{${ele}}`;
- result.push(Array.isArray(ele) ? append(item, ele, enclose) : (item + ele));
- }
- }
- }
- return utils.flatten(result);
-};
-
-const expand = (ast, options = {}) => {
- let rangeLimit = options.rangeLimit === void 0 ? 1000 : options.rangeLimit;
-
- let walk = (node, parent = {}) => {
- node.queue = [];
-
- let p = parent;
- let q = parent.queue;
-
- while (p.type !== 'brace' && p.type !== 'root' && p.parent) {
- p = p.parent;
- q = p.queue;
- }
-
- if (node.invalid || node.dollar) {
- q.push(append(q.pop(), stringify(node, options)));
- return;
- }
-
- if (node.type === 'brace' && node.invalid !== true && node.nodes.length === 2) {
- q.push(append(q.pop(), ['{}']));
- return;
- }
-
- if (node.nodes && node.ranges > 0) {
- let args = utils.reduce(node.nodes);
-
- if (utils.exceedsLimit(...args, options.step, rangeLimit)) {
- throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.');
- }
-
- let range = fill(...args, options);
- if (range.length === 0) {
- range = stringify(node, options);
- }
-
- q.push(append(q.pop(), range));
- node.nodes = [];
- return;
- }
-
- let enclose = utils.encloseBrace(node);
- let queue = node.queue;
- let block = node;
-
- while (block.type !== 'brace' && block.type !== 'root' && block.parent) {
- block = block.parent;
- queue = block.queue;
- }
-
- for (let i = 0; i < node.nodes.length; i++) {
- let child = node.nodes[i];
-
- if (child.type === 'comma' && node.type === 'brace') {
- if (i === 1) queue.push('');
- queue.push('');
- continue;
- }
-
- if (child.type === 'close') {
- q.push(append(q.pop(), queue, enclose));
- continue;
- }
-
- if (child.value && child.type !== 'open') {
- queue.push(append(queue.pop(), child.value));
- continue;
- }
-
- if (child.nodes) {
- walk(child, node);
- }
- }
-
- return queue;
- };
-
- return utils.flatten(walk(ast));
-};
-
-module.exports = expand;
-
-
-/***/ }),
-
-/***/ 96477:
-/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-const stringify = __nccwpck_require__(38750);
-
-/**
- * Constants
- */
-
-const {
- MAX_LENGTH,
- CHAR_BACKSLASH, /* \ */
- CHAR_BACKTICK, /* ` */
- CHAR_COMMA, /* , */
- CHAR_DOT, /* . */
- CHAR_LEFT_PARENTHESES, /* ( */
- CHAR_RIGHT_PARENTHESES, /* ) */
- CHAR_LEFT_CURLY_BRACE, /* { */
- CHAR_RIGHT_CURLY_BRACE, /* } */
- CHAR_LEFT_SQUARE_BRACKET, /* [ */
- CHAR_RIGHT_SQUARE_BRACKET, /* ] */
- CHAR_DOUBLE_QUOTE, /* " */
- CHAR_SINGLE_QUOTE, /* ' */
- CHAR_NO_BREAK_SPACE,
- CHAR_ZERO_WIDTH_NOBREAK_SPACE
-} = __nccwpck_require__(18774);
-
-/**
- * parse
- */
-
-const parse = (input, options = {}) => {
- if (typeof input !== 'string') {
- throw new TypeError('Expected a string');
- }
-
- let opts = options || {};
- let max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
- if (input.length > max) {
- throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`);
- }
-
- let ast = { type: 'root', input, nodes: [] };
- let stack = [ast];
- let block = ast;
- let prev = ast;
- let brackets = 0;
- let length = input.length;
- let index = 0;
- let depth = 0;
- let value;
- let memo = {};
-
- /**
- * Helpers
- */
-
- const advance = () => input[index++];
- const push = node => {
- if (node.type === 'text' && prev.type === 'dot') {
- prev.type = 'text';
- }
-
- if (prev && prev.type === 'text' && node.type === 'text') {
- prev.value += node.value;
- return;
- }
-
- block.nodes.push(node);
- node.parent = block;
- node.prev = prev;
- prev = node;
- return node;
- };
-
- push({ type: 'bos' });
-
- while (index < length) {
- block = stack[stack.length - 1];
- value = advance();
-
- /**
- * Invalid chars
- */
-
- if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) {
- continue;
- }
-
- /**
- * Escaped chars
- */
-
- if (value === CHAR_BACKSLASH) {
- push({ type: 'text', value: (options.keepEscaping ? value : '') + advance() });
- continue;
- }
-
- /**
- * Right square bracket (literal): ']'
- */
-
- if (value === CHAR_RIGHT_SQUARE_BRACKET) {
- push({ type: 'text', value: '\\' + value });
- continue;
- }
-
- /**
- * Left square bracket: '['
- */
-
- if (value === CHAR_LEFT_SQUARE_BRACKET) {
- brackets++;
-
- let closed = true;
- let next;
-
- while (index < length && (next = advance())) {
- value += next;
-
- if (next === CHAR_LEFT_SQUARE_BRACKET) {
- brackets++;
- continue;
- }
-
- if (next === CHAR_BACKSLASH) {
- value += advance();
- continue;
- }
-
- if (next === CHAR_RIGHT_SQUARE_BRACKET) {
- brackets--;
-
- if (brackets === 0) {
- break;
- }
- }
- }
-
- push({ type: 'text', value });
- continue;
- }
-
- /**
- * Parentheses
- */
-
- if (value === CHAR_LEFT_PARENTHESES) {
- block = push({ type: 'paren', nodes: [] });
- stack.push(block);
- push({ type: 'text', value });
- continue;
- }
-
- if (value === CHAR_RIGHT_PARENTHESES) {
- if (block.type !== 'paren') {
- push({ type: 'text', value });
- continue;
- }
- block = stack.pop();
- push({ type: 'text', value });
- block = stack[stack.length - 1];
- continue;
- }
-
- /**
- * Quotes: '|"|`
- */
-
- if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
- let open = value;
- let next;
-
- if (options.keepQuotes !== true) {
- value = '';
- }
-
- while (index < length && (next = advance())) {
- if (next === CHAR_BACKSLASH) {
- value += next + advance();
- continue;
- }
-
- if (next === open) {
- if (options.keepQuotes === true) value += next;
- break;
- }
-
- value += next;
- }
-
- push({ type: 'text', value });
- continue;
- }
-
- /**
- * Left curly brace: '{'
- */
-
- if (value === CHAR_LEFT_CURLY_BRACE) {
- depth++;
-
- let dollar = prev.value && prev.value.slice(-1) === '$' || block.dollar === true;
- let brace = {
- type: 'brace',
- open: true,
- close: false,
- dollar,
- depth,
- commas: 0,
- ranges: 0,
- nodes: []
- };
-
- block = push(brace);
- stack.push(block);
- push({ type: 'open', value });
- continue;
- }
-
- /**
- * Right curly brace: '}'
- */
-
- if (value === CHAR_RIGHT_CURLY_BRACE) {
- if (block.type !== 'brace') {
- push({ type: 'text', value });
- continue;
- }
-
- let type = 'close';
- block = stack.pop();
- block.close = true;
-
- push({ type, value });
- depth--;
-
- block = stack[stack.length - 1];
- continue;
- }
-
- /**
- * Comma: ','
- */
-
- if (value === CHAR_COMMA && depth > 0) {
- if (block.ranges > 0) {
- block.ranges = 0;
- let open = block.nodes.shift();
- block.nodes = [open, { type: 'text', value: stringify(block) }];
- }
-
- push({ type: 'comma', value });
- block.commas++;
- continue;
- }
-
- /**
- * Dot: '.'
- */
-
- if (value === CHAR_DOT && depth > 0 && block.commas === 0) {
- let siblings = block.nodes;
-
- if (depth === 0 || siblings.length === 0) {
- push({ type: 'text', value });
- continue;
- }
-
- if (prev.type === 'dot') {
- block.range = [];
- prev.value += value;
- prev.type = 'range';
-
- if (block.nodes.length !== 3 && block.nodes.length !== 5) {
- block.invalid = true;
- block.ranges = 0;
- prev.type = 'text';
- continue;
- }
-
- block.ranges++;
- block.args = [];
- continue;
- }
-
- if (prev.type === 'range') {
- siblings.pop();
-
- let before = siblings[siblings.length - 1];
- before.value += prev.value + value;
- prev = before;
- block.ranges--;
- continue;
- }
-
- push({ type: 'dot', value });
- continue;
- }
-
- /**
- * Text
- */
-
- push({ type: 'text', value });
- }
-
- // Mark imbalanced braces and brackets as invalid
- do {
- block = stack.pop();
-
- if (block.type !== 'root') {
- block.nodes.forEach(node => {
- if (!node.nodes) {
- if (node.type === 'open') node.isOpen = true;
- if (node.type === 'close') node.isClose = true;
- if (!node.nodes) node.type = 'text';
- node.invalid = true;
- }
- });
-
- // get the location of the block on parent.nodes (block's siblings)
- let parent = stack[stack.length - 1];
- let index = parent.nodes.indexOf(block);
- // replace the (invalid) block with it's nodes
- parent.nodes.splice(index, 1, ...block.nodes);
- }
- } while (stack.length > 0);
-
- push({ type: 'eos' });
- return ast;
-};
-
-module.exports = parse;
-
-
-/***/ }),
-
-/***/ 38750:
-/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-const utils = __nccwpck_require__(45207);
-
-module.exports = (ast, options = {}) => {
- let stringify = (node, parent = {}) => {
- let invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent);
- let invalidNode = node.invalid === true && options.escapeInvalid === true;
- let output = '';
-
- if (node.value) {
- if ((invalidBlock || invalidNode) && utils.isOpenOrClose(node)) {
- return '\\' + node.value;
- }
- return node.value;
- }
-
- if (node.value) {
- return node.value;
- }
-
- if (node.nodes) {
- for (let child of node.nodes) {
- output += stringify(child);
- }
- }
- return output;
- };
-
- return stringify(ast);
-};
-
-
-
-/***/ }),
-
-/***/ 45207:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-
-
-exports.isInteger = num => {
- if (typeof num === 'number') {
- return Number.isInteger(num);
- }
- if (typeof num === 'string' && num.trim() !== '') {
- return Number.isInteger(Number(num));
- }
- return false;
-};
-
-/**
- * Find a node of the given type
- */
-
-exports.find = (node, type) => node.nodes.find(node => node.type === type);
-
-/**
- * Find a node of the given type
- */
-
-exports.exceedsLimit = (min, max, step = 1, limit) => {
- if (limit === false) return false;
- if (!exports.isInteger(min) || !exports.isInteger(max)) return false;
- return ((Number(max) - Number(min)) / Number(step)) >= limit;
-};
-
-/**
- * Escape the given node with '\\' before node.value
- */
-
-exports.escapeNode = (block, n = 0, type) => {
- let node = block.nodes[n];
- if (!node) return;
-
- if ((type && node.type === type) || node.type === 'open' || node.type === 'close') {
- if (node.escaped !== true) {
- node.value = '\\' + node.value;
- node.escaped = true;
- }
- }
-};
-
-/**
- * Returns true if the given brace node should be enclosed in literal braces
- */
-
-exports.encloseBrace = node => {
- if (node.type !== 'brace') return false;
- if ((node.commas >> 0 + node.ranges >> 0) === 0) {
- node.invalid = true;
- return true;
- }
- return false;
-};
-
-/**
- * Returns true if a brace node is invalid.
- */
-
-exports.isInvalidBrace = block => {
- if (block.type !== 'brace') return false;
- if (block.invalid === true || block.dollar) return true;
- if ((block.commas >> 0 + block.ranges >> 0) === 0) {
- block.invalid = true;
- return true;
- }
- if (block.open !== true || block.close !== true) {
- block.invalid = true;
- return true;
- }
- return false;
-};
-
-/**
- * Returns true if a node is an open or close node
- */
-
-exports.isOpenOrClose = node => {
- if (node.type === 'open' || node.type === 'close') {
- return true;
- }
- return node.open === true || node.close === true;
-};
-
-/**
- * Reduce an array of text nodes.
- */
-
-exports.reduce = nodes => nodes.reduce((acc, node) => {
- if (node.type === 'text') acc.push(node.value);
- if (node.type === 'range') node.type = 'text';
- return acc;
-}, []);
-
-/**
- * Flatten an array
- */
-
-exports.flatten = (...args) => {
- const result = [];
- const flat = arr => {
- for (let i = 0; i < arr.length; i++) {
- let ele = arr[i];
- Array.isArray(ele) ? flat(ele, result) : ele !== void 0 && result.push(ele);
- }
- return result;
- };
- flat(args);
- return result;
-};
-
-
-/***/ }),
-
-/***/ 51590:
-/***/ ((module) => {
-
-module.exports = Buffers;
-
-function Buffers (bufs) {
- if (!(this instanceof Buffers)) return new Buffers(bufs);
- this.buffers = bufs || [];
- this.length = this.buffers.reduce(function (size, buf) {
- return size + buf.length
- }, 0);
-}
-
-Buffers.prototype.push = function () {
- for (var i = 0; i < arguments.length; i++) {
- if (!Buffer.isBuffer(arguments[i])) {
- throw new TypeError('Tried to push a non-buffer');
- }
- }
-
- for (var i = 0; i < arguments.length; i++) {
- var buf = arguments[i];
- this.buffers.push(buf);
- this.length += buf.length;
- }
- return this.length;
-};
-
-Buffers.prototype.unshift = function () {
- for (var i = 0; i < arguments.length; i++) {
- if (!Buffer.isBuffer(arguments[i])) {
- throw new TypeError('Tried to unshift a non-buffer');
- }
- }
-
- for (var i = 0; i < arguments.length; i++) {
- var buf = arguments[i];
- this.buffers.unshift(buf);
- this.length += buf.length;
- }
- return this.length;
-};
-
-Buffers.prototype.copy = function (dst, dStart, start, end) {
- return this.slice(start, end).copy(dst, dStart, 0, end - start);
-};
-
-Buffers.prototype.splice = function (i, howMany) {
- var buffers = this.buffers;
- var index = i >= 0 ? i : this.length - i;
- var reps = [].slice.call(arguments, 2);
-
- if (howMany === undefined) {
- howMany = this.length - index;
- }
- else if (howMany > this.length - index) {
- howMany = this.length - index;
- }
-
- for (var i = 0; i < reps.length; i++) {
- this.length += reps[i].length;
- }
-
- var removed = new Buffers();
- var bytes = 0;
-
- var startBytes = 0;
- for (
- var ii = 0;
- ii < buffers.length && startBytes + buffers[ii].length < index;
- ii ++
- ) { startBytes += buffers[ii].length }
-
- if (index - startBytes > 0) {
- var start = index - startBytes;
-
- if (start + howMany < buffers[ii].length) {
- removed.push(buffers[ii].slice(start, start + howMany));
-
- var orig = buffers[ii];
- //var buf = new Buffer(orig.length - howMany);
- var buf0 = new Buffer(start);
- for (var i = 0; i < start; i++) {
- buf0[i] = orig[i];
- }
-
- var buf1 = new Buffer(orig.length - start - howMany);
- for (var i = start + howMany; i < orig.length; i++) {
- buf1[ i - howMany - start ] = orig[i]
- }
-
- if (reps.length > 0) {
- var reps_ = reps.slice();
- reps_.unshift(buf0);
- reps_.push(buf1);
- buffers.splice.apply(buffers, [ ii, 1 ].concat(reps_));
- ii += reps_.length;
- reps = [];
- }
- else {
- buffers.splice(ii, 1, buf0, buf1);
- //buffers[ii] = buf;
- ii += 2;
- }
- }
- else {
- removed.push(buffers[ii].slice(start));
- buffers[ii] = buffers[ii].slice(0, start);
- ii ++;
- }
- }
-
- if (reps.length > 0) {
- buffers.splice.apply(buffers, [ ii, 0 ].concat(reps));
- ii += reps.length;
- }
-
- while (removed.length < howMany) {
- var buf = buffers[ii];
- var len = buf.length;
- var take = Math.min(len, howMany - removed.length);
-
- if (take === len) {
- removed.push(buf);
- buffers.splice(ii, 1);
- }
- else {
- removed.push(buf.slice(0, take));
- buffers[ii] = buffers[ii].slice(take);
- }
- }
-
- this.length -= removed.length;
-
- return removed;
-};
-
-Buffers.prototype.slice = function (i, j) {
- var buffers = this.buffers;
- if (j === undefined) j = this.length;
- if (i === undefined) i = 0;
-
- if (j > this.length) j = this.length;
-
- var startBytes = 0;
- for (
- var si = 0;
- si < buffers.length && startBytes + buffers[si].length <= i;
- si ++
- ) { startBytes += buffers[si].length }
-
- var target = new Buffer(j - i);
-
- var ti = 0;
- for (var ii = si; ti < j - i && ii < buffers.length; ii++) {
- var len = buffers[ii].length;
-
- var start = ti === 0 ? i - startBytes : 0;
- var end = ti + len >= j - i
- ? Math.min(start + (j - i) - ti, len)
- : len
- ;
-
- buffers[ii].copy(target, ti, start, end);
- ti += end - start;
- }
-
- return target;
-};
-
-Buffers.prototype.pos = function (i) {
- if (i < 0 || i >= this.length) throw new Error('oob');
- var l = i, bi = 0, bu = null;
- for (;;) {
- bu = this.buffers[bi];
- if (l < bu.length) {
- return {buf: bi, offset: l};
- } else {
- l -= bu.length;
- }
- bi++;
- }
-};
-
-Buffers.prototype.get = function get (i) {
- var pos = this.pos(i);
-
- return this.buffers[pos.buf].get(pos.offset);
-};
-
-Buffers.prototype.set = function set (i, b) {
- var pos = this.pos(i);
-
- return this.buffers[pos.buf].set(pos.offset, b);
-};
-
-Buffers.prototype.indexOf = function (needle, offset) {
- if ("string" === typeof needle) {
- needle = new Buffer(needle);
- } else if (needle instanceof Buffer) {
- // already a buffer
- } else {
- throw new Error('Invalid type for a search string');
- }
-
- if (!needle.length) {
- return 0;
- }
-
- if (!this.length) {
- return -1;
- }
-
- var i = 0, j = 0, match = 0, mstart, pos = 0;
-
- // start search from a particular point in the virtual buffer
- if (offset) {
- var p = this.pos(offset);
- i = p.buf;
- j = p.offset;
- pos = offset;
- }
-
- // for each character in virtual buffer
- for (;;) {
- while (j >= this.buffers[i].length) {
- j = 0;
- i++;
-
- if (i >= this.buffers.length) {
- // search string not found
- return -1;
- }
- }
-
- var char = this.buffers[i][j];
-
- if (char == needle[match]) {
- // keep track where match started
- if (match == 0) {
- mstart = {
- i: i,
- j: j,
- pos: pos
- };
- }
- match++;
- if (match == needle.length) {
- // full match
- return mstart.pos;
- }
- } else if (match != 0) {
- // a partial match ended, go back to match starting position
- // this will continue the search at the next character
- i = mstart.i;
- j = mstart.j;
- pos = mstart.pos;
- match = 0;
- }
-
- j++;
- pos++;
- }
-};
-
-Buffers.prototype.toBuffer = function() {
- return this.slice();
-}
-
-Buffers.prototype.toString = function(encoding, start, end) {
- return this.slice(start, end).toString(encoding);
-}
-
-
-/***/ }),
-
-/***/ 86966:
-/***/ ((module) => {
-
-"use strict";
-/*!
- * bytes
- * Copyright(c) 2012-2014 TJ Holowaychuk
- * Copyright(c) 2015 Jed Watson
- * MIT Licensed
- */
-
-
-
-/**
- * Module exports.
- * @public
- */
-
-module.exports = bytes;
-module.exports.format = format;
-module.exports.parse = parse;
-
-/**
- * Module variables.
- * @private
- */
-
-var formatThousandsRegExp = /\B(?=(\d{3})+(?!\d))/g;
-
-var formatDecimalsRegExp = /(?:\.0*|(\.[^0]+)0+)$/;
-
-var map = {
- b: 1,
- kb: 1 << 10,
- mb: 1 << 20,
- gb: 1 << 30,
- tb: Math.pow(1024, 4),
- pb: Math.pow(1024, 5),
-};
-
-var parseRegExp = /^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;
-
-/**
- * Convert the given value in bytes into a string or parse to string to an integer in bytes.
- *
- * @param {string|number} value
- * @param {{
- * case: [string],
- * decimalPlaces: [number]
- * fixedDecimals: [boolean]
- * thousandsSeparator: [string]
- * unitSeparator: [string]
- * }} [options] bytes options.
- *
- * @returns {string|number|null}
- */
-
-function bytes(value, options) {
- if (typeof value === 'string') {
- return parse(value);
- }
-
- if (typeof value === 'number') {
- return format(value, options);
- }
-
- return null;
-}
-
-/**
- * Format the given value in bytes into a string.
- *
- * If the value is negative, it is kept as such. If it is a float,
- * it is rounded.
- *
- * @param {number} value
- * @param {object} [options]
- * @param {number} [options.decimalPlaces=2]
- * @param {number} [options.fixedDecimals=false]
- * @param {string} [options.thousandsSeparator=]
- * @param {string} [options.unit=]
- * @param {string} [options.unitSeparator=]
- *
- * @returns {string|null}
- * @public
- */
-
-function format(value, options) {
- if (!Number.isFinite(value)) {
- return null;
- }
-
- var mag = Math.abs(value);
- var thousandsSeparator = (options && options.thousandsSeparator) || '';
- var unitSeparator = (options && options.unitSeparator) || '';
- var decimalPlaces = (options && options.decimalPlaces !== undefined) ? options.decimalPlaces : 2;
- var fixedDecimals = Boolean(options && options.fixedDecimals);
- var unit = (options && options.unit) || '';
-
- if (!unit || !map[unit.toLowerCase()]) {
- if (mag >= map.pb) {
- unit = 'PB';
- } else if (mag >= map.tb) {
- unit = 'TB';
- } else if (mag >= map.gb) {
- unit = 'GB';
- } else if (mag >= map.mb) {
- unit = 'MB';
- } else if (mag >= map.kb) {
- unit = 'KB';
- } else {
- unit = 'B';
- }
- }
-
- var val = value / map[unit.toLowerCase()];
- var str = val.toFixed(decimalPlaces);
-
- if (!fixedDecimals) {
- str = str.replace(formatDecimalsRegExp, '$1');
- }
-
- if (thousandsSeparator) {
- str = str.split('.').map(function (s, i) {
- return i === 0
- ? s.replace(formatThousandsRegExp, thousandsSeparator)
- : s
- }).join('.');
- }
-
- return str + unitSeparator + unit;
-}
-
-/**
- * Parse the string value into an integer in bytes.
- *
- * If no unit is given, it is assumed the value is in bytes.
- *
- * @param {number|string} val
- *
- * @returns {number|null}
- * @public
- */
-
-function parse(val) {
- if (typeof val === 'number' && !isNaN(val)) {
- return val;
- }
-
- if (typeof val !== 'string') {
- return null;
- }
-
- // Test if the string passed is valid
- var results = parseRegExp.exec(val);
- var floatValue;
- var unit = 'b';
-
- if (!results) {
- // Nothing could be extracted from the given string
- floatValue = parseInt(val, 10);
- unit = 'b'
- } else {
- // Retrieve the value and the unit
- floatValue = parseFloat(results[1]);
- unit = results[4].toLowerCase();
- }
-
- if (isNaN(floatValue)) {
- return null;
- }
-
- return Math.floor(map[unit] * floatValue);
-}
-
-
-/***/ }),
-
-/***/ 28803:
-/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-var GetIntrinsic = __nccwpck_require__(74538);
-
-var callBind = __nccwpck_require__(62977);
-
-var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));
-
-module.exports = function callBoundIntrinsic(name, allowMissing) {
- var intrinsic = GetIntrinsic(name, !!allowMissing);
- if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
- return callBind(intrinsic);
- }
- return intrinsic;
-};
-
-
-/***/ }),
-
-/***/ 62977:
-/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-var bind = __nccwpck_require__(88334);
-var GetIntrinsic = __nccwpck_require__(74538);
-
-var $apply = GetIntrinsic('%Function.prototype.apply%');
-var $call = GetIntrinsic('%Function.prototype.call%');
-var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
-
-var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
-var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
-var $max = GetIntrinsic('%Math.max%');
-
-if ($defineProperty) {
- try {
- $defineProperty({}, 'a', { value: 1 });
- } catch (e) {
- // IE 8 has a broken defineProperty
- $defineProperty = null;
- }
-}
-
-module.exports = function callBind(originalFunction) {
- var func = $reflectApply(bind, $call, arguments);
- if ($gOPD && $defineProperty) {
- var desc = $gOPD(func, 'length');
- if (desc.configurable) {
- // original length, plus the receiver, minus any additional arguments (after the receiver)
- $defineProperty(
- func,
- 'length',
- { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
- );
- }
- }
- return func;
-};
-
-var applyBind = function applyBind() {
- return $reflectApply(bind, $apply, arguments);
-};
-
-if ($defineProperty) {
- $defineProperty(module.exports, 'apply', { value: applyBind });
-} else {
- module.exports.apply = applyBind;
-}
-
-
-/***/ }),
-
-/***/ 46533:
-/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
-
-var Traverse = __nccwpck_require__(8588);
-var EventEmitter = (__nccwpck_require__(82361).EventEmitter);
-
-module.exports = Chainsaw;
-function Chainsaw (builder) {
- var saw = Chainsaw.saw(builder, {});
- var r = builder.call(saw.handlers, saw);
- if (r !== undefined) saw.handlers = r;
- saw.record();
- return saw.chain();
-};
-
-Chainsaw.light = function ChainsawLight (builder) {
- var saw = Chainsaw.saw(builder, {});
- var r = builder.call(saw.handlers, saw);
- if (r !== undefined) saw.handlers = r;
- return saw.chain();
-};
-
-Chainsaw.saw = function (builder, handlers) {
- var saw = new EventEmitter;
- saw.handlers = handlers;
- saw.actions = [];
-
- saw.chain = function () {
- var ch = Traverse(saw.handlers).map(function (node) {
- if (this.isRoot) return node;
- var ps = this.path;
-
- if (typeof node === 'function') {
- this.update(function () {
- saw.actions.push({
- path : ps,
- args : [].slice.call(arguments)
- });
- return ch;
- });
- }
- });
-
- process.nextTick(function () {
- saw.emit('begin');
- saw.next();
- });
-
- return ch;
- };
-
- saw.pop = function () {
- return saw.actions.shift();
- };
-
- saw.next = function () {
- var action = saw.pop();
-
- if (!action) {
- saw.emit('end');
- }
- else if (!action.trap) {
- var node = saw.handlers;
- action.path.forEach(function (key) { node = node[key] });
- node.apply(saw.handlers, action.args);
- }
- };
-
- saw.nest = function (cb) {
- var args = [].slice.call(arguments, 1);
- var autonext = true;
-
- if (typeof cb === 'boolean') {
- var autonext = cb;
- cb = args.shift();
- }
-
- var s = Chainsaw.saw(builder, {});
- var r = builder.call(s.handlers, s);
-
- if (r !== undefined) s.handlers = r;
-
- // If we are recording...
- if ("undefined" !== typeof saw.step) {
- // ... our children should, too
- s.record();
- }
-
- cb.apply(s.chain(), args);
- if (autonext !== false) s.on('end', saw.next);
- };
-
- saw.record = function () {
- upgradeChainsaw(saw);
- };
-
- ['trap', 'down', 'jump'].forEach(function (method) {
- saw[method] = function () {
- throw new Error("To use the trap, down and jump features, please "+
- "call record() first to start recording actions.");
- };
- });
-
- return saw;
-};
-
-function upgradeChainsaw(saw) {
- saw.step = 0;
-
- // override pop
- saw.pop = function () {
- return saw.actions[saw.step++];
- };
-
- saw.trap = function (name, cb) {
- var ps = Array.isArray(name) ? name : [name];
- saw.actions.push({
- path : ps,
- step : saw.step,
- cb : cb,
- trap : true
- });
- };
-
- saw.down = function (name) {
- var ps = (Array.isArray(name) ? name : [name]).join('/');
- var i = saw.actions.slice(saw.step).map(function (x) {
- if (x.trap && x.step <= saw.step) return false;
- return x.path.join('/') == ps;
- }).indexOf(true);
-
- if (i >= 0) saw.step += i;
- else saw.step = saw.actions.length;
-
- var act = saw.actions[saw.step - 1];
- if (act && act.trap) {
- // It's a trap!
- saw.step = act.step;
- act.cb();
- }
- else saw.next();
- };
-
- saw.jump = function (step) {
- saw.step = step;
- saw.next();
- };
-};
-
-
-/***/ }),
-
-/***/ 8937:
-/***/ ((module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-var objIsRegex = __nccwpck_require__(96403);
-
-exports = (module.exports = parse);
-
-var TOKEN_TYPES = exports.TOKEN_TYPES = {
- LINE_COMMENT: '//',
- BLOCK_COMMENT: '/**/',
- SINGLE_QUOTE: '\'',
- DOUBLE_QUOTE: '"',
- TEMPLATE_QUOTE: '`',
- REGEXP: '//g'
-}
-
-var BRACKETS = exports.BRACKETS = {
- '(': ')',
- '{': '}',
- '[': ']'
-};
-var BRACKETS_REVERSED = {
- ')': '(',
- '}': '{',
- ']': '['
-};
-
-exports.parse = parse;
-function parse(src, state, options) {
- options = options || {};
- state = state || exports.defaultState();
- var start = options.start || 0;
- var end = options.end || src.length;
- var index = start;
- while (index < end) {
- try {
- parseChar(src[index], state);
- } catch (ex) {
- ex.index = index;
- throw ex;
- }
- index++;
- }
- return state;
-}
-
-exports.parseUntil = parseUntil;
-function parseUntil(src, delimiter, options) {
- options = options || {};
- var start = options.start || 0;
- var index = start;
- var state = exports.defaultState();
- while (index < src.length) {
- if ((options.ignoreNesting || !state.isNesting(options)) && matches(src, delimiter, index)) {
- var end = index;
- return {
- start: start,
- end: end,
- src: src.substring(start, end)
- };
- }
- try {
- parseChar(src[index], state);
- } catch (ex) {
- ex.index = index;
- throw ex;
- }
- index++;
- }
- var err = new Error('The end of the string was reached with no closing bracket found.');
- err.code = 'CHARACTER_PARSER:END_OF_STRING_REACHED';
- err.index = index;
- throw err;
-}
-
-exports.parseChar = parseChar;
-function parseChar(character, state) {
- if (character.length !== 1) {
- var err = new Error('Character must be a string of length 1');
- err.name = 'InvalidArgumentError';
- err.code = 'CHARACTER_PARSER:CHAR_LENGTH_NOT_ONE';
- throw err;
- }
- state = state || exports.defaultState();
- state.src += character;
- var wasComment = state.isComment();
- var lastChar = state.history ? state.history[0] : '';
-
-
- if (state.regexpStart) {
- if (character === '/' || character == '*') {
- state.stack.pop();
- }
- state.regexpStart = false;
- }
- switch (state.current()) {
- case TOKEN_TYPES.LINE_COMMENT:
- if (character === '\n') {
- state.stack.pop();
- }
- break;
- case TOKEN_TYPES.BLOCK_COMMENT:
- if (state.lastChar === '*' && character === '/') {
- state.stack.pop();
- }
- break;
- case TOKEN_TYPES.SINGLE_QUOTE:
- if (character === '\'' && !state.escaped) {
- state.stack.pop();
- } else if (character === '\\' && !state.escaped) {
- state.escaped = true;
- } else {
- state.escaped = false;
- }
- break;
- case TOKEN_TYPES.DOUBLE_QUOTE:
- if (character === '"' && !state.escaped) {
- state.stack.pop();
- } else if (character === '\\' && !state.escaped) {
- state.escaped = true;
- } else {
- state.escaped = false;
- }
- break;
- case TOKEN_TYPES.TEMPLATE_QUOTE:
- if (character === '`' && !state.escaped) {
- state.stack.pop();
- state.hasDollar = false;
- } else if (character === '\\' && !state.escaped) {
- state.escaped = true;
- state.hasDollar = false;
- } else if (character === '$' && !state.escaped) {
- state.hasDollar = true;
- } else if (character === '{' && state.hasDollar) {
- state.stack.push(BRACKETS[character]);
- } else {
- state.escaped = false;
- state.hasDollar = false;
- }
- break;
- case TOKEN_TYPES.REGEXP:
- if (character === '/' && !state.escaped) {
- state.stack.pop();
- } else if (character === '\\' && !state.escaped) {
- state.escaped = true;
- } else {
- state.escaped = false;
- }
- break;
- default:
- if (character in BRACKETS) {
- state.stack.push(BRACKETS[character]);
- } else if (character in BRACKETS_REVERSED) {
- if (state.current() !== character) {
- var err = new SyntaxError('Mismatched Bracket: ' + character);
- err.code = 'CHARACTER_PARSER:MISMATCHED_BRACKET';
- throw err;
- };
- state.stack.pop();
- } else if (lastChar === '/' && character === '/') {
- // Don't include comments in history
- state.history = state.history.substr(1);
- state.stack.push(TOKEN_TYPES.LINE_COMMENT);
- } else if (lastChar === '/' && character === '*') {
- // Don't include comment in history
- state.history = state.history.substr(1);
- state.stack.push(TOKEN_TYPES.BLOCK_COMMENT);
- } else if (character === '/' && isRegexp(state.history)) {
- state.stack.push(TOKEN_TYPES.REGEXP);
- // N.B. if the next character turns out to be a `*` or a `/`
- // then this isn't actually a regexp
- state.regexpStart = true;
- } else if (character === '\'') {
- state.stack.push(TOKEN_TYPES.SINGLE_QUOTE);
- } else if (character === '"') {
- state.stack.push(TOKEN_TYPES.DOUBLE_QUOTE);
- } else if (character === '`') {
- state.stack.push(TOKEN_TYPES.TEMPLATE_QUOTE);
- }
- break;
- }
- if (!state.isComment() && !wasComment) {
- state.history = character + state.history;
- }
- state.lastChar = character; // store last character for ending block comments
- return state;
-}
-
-exports.defaultState = function () { return new State() };
-function State() {
- this.stack = [];
-
- this.regexpStart = false;
- this.escaped = false;
- this.hasDollar = false;
-
- this.src = '';
- this.history = ''
- this.lastChar = ''
-}
-State.prototype.current = function () {
- return this.stack[this.stack.length - 1];
-};
-State.prototype.isString = function () {
- return (
- this.current() === TOKEN_TYPES.SINGLE_QUOTE ||
- this.current() === TOKEN_TYPES.DOUBLE_QUOTE ||
- this.current() === TOKEN_TYPES.TEMPLATE_QUOTE
- );
-}
-State.prototype.isComment = function () {
- return this.current() === TOKEN_TYPES.LINE_COMMENT || this.current() === TOKEN_TYPES.BLOCK_COMMENT;
-}
-State.prototype.isNesting = function (opts) {
- if (
- opts && opts.ignoreLineComment &&
- this.stack.length === 1 && this.stack[0] === TOKEN_TYPES.LINE_COMMENT
- ) {
- // if we are only inside a line comment, and line comments are ignored
- // don't count it as nesting
- return false;
- }
- return !!this.stack.length;
-}
-
-function matches(str, matcher, i) {
- if (objIsRegex(matcher)) {
- return matcher.test(str.substr(i || 0));
- } else {
- return str.substr(i || 0, matcher.length) === matcher;
- }
-}
-
-exports.isPunctuator = isPunctuator
-function isPunctuator(c) {
- if (!c) return true; // the start of a string is a punctuator
- var code = c.charCodeAt(0)
-
- switch (code) {
- case 46: // . dot
- case 40: // ( open bracket
- case 41: // ) close bracket
- case 59: // ; semicolon
- case 44: // , comma
- case 123: // { open curly brace
- case 125: // } close curly brace
- case 91: // [
- case 93: // ]
- case 58: // :
- case 63: // ?
- case 126: // ~
- case 37: // %
- case 38: // &
- case 42: // *:
- case 43: // +
- case 45: // -
- case 47: // /
- case 60: // <
- case 62: // >
- case 94: // ^
- case 124: // |
- case 33: // !
- case 61: // =
- return true;
- default:
- return false;
- }
-}
-
-exports.isKeyword = isKeyword
-function isKeyword(id) {
- return (id === 'if') || (id === 'in') || (id === 'do') || (id === 'var') || (id === 'for') || (id === 'new') ||
- (id === 'try') || (id === 'let') || (id === 'this') || (id === 'else') || (id === 'case') ||
- (id === 'void') || (id === 'with') || (id === 'enum') || (id === 'while') || (id === 'break') || (id === 'catch') ||
- (id === 'throw') || (id === 'const') || (id === 'yield') || (id === 'class') || (id === 'super') ||
- (id === 'return') || (id === 'typeof') || (id === 'delete') || (id === 'switch') || (id === 'export') ||
- (id === 'import') || (id === 'default') || (id === 'finally') || (id === 'extends') || (id === 'function') ||
- (id === 'continue') || (id === 'debugger') || (id === 'package') || (id === 'private') || (id === 'interface') ||
- (id === 'instanceof') || (id === 'implements') || (id === 'protected') || (id === 'public') || (id === 'static');
-}
+ if (args.length < 2) {
+ [result] = args;
+ } else {
+ result = args;
+ }
+ error = err;
+ taskCb(err ? null : {});
+ });
+ }, () => callback(error, result));
+ }
-function isRegexp(history) {
- //could be start of regexp or divide sign
+ var tryEach$1 = awaitify(tryEach);
- history = history.replace(/^\s*/, '');
+ /**
+ * Undoes a [memoize]{@link module:Utils.memoize}d function, reverting it to the original,
+ * unmemoized form. Handy for testing.
+ *
+ * @name unmemoize
+ * @static
+ * @memberOf module:Utils
+ * @method
+ * @see [async.memoize]{@link module:Utils.memoize}
+ * @category Util
+ * @param {AsyncFunction} fn - the memoized function
+ * @returns {AsyncFunction} a function that calls the original unmemoized function
+ */
+ function unmemoize(fn) {
+ return (...args) => {
+ return (fn.unmemoized || fn)(...args);
+ };
+ }
- //unless its an `if`, `while`, `for` or `with` it's a divide, so we assume it's a divide
- if (history[0] === ')') return false;
- //unless it's a function expression, it's a regexp, so we assume it's a regexp
- if (history[0] === '}') return true;
- //any punctuation means it's a regexp
- if (isPunctuator(history[0])) return true;
- //if the last thing was a keyword then it must be a regexp (e.g. `typeof /foo/`)
- if (/^\w+\b/.test(history) && isKeyword(/^\w+\b/.exec(history)[0].split('').reverse().join(''))) return true;
+ /**
+ * Repeatedly call `iteratee`, while `test` returns `true`. Calls `callback` when
+ * stopped, or an error occurs.
+ *
+ * @name whilst
+ * @static
+ * @memberOf module:ControlFlow
+ * @method
+ * @category Control Flow
+ * @param {AsyncFunction} test - asynchronous truth test to perform before each
+ * execution of `iteratee`. Invoked with (callback).
+ * @param {AsyncFunction} iteratee - An async function which is called each time
+ * `test` passes. Invoked with (callback).
+ * @param {Function} [callback] - A callback which is called after the test
+ * function has failed and repeated execution of `iteratee` has stopped. `callback`
+ * will be passed an error and any arguments passed to the final `iteratee`'s
+ * callback. Invoked with (err, [results]);
+ * @returns {Promise} a promise, if no callback is passed
+ * @example
+ *
+ * var count = 0;
+ * async.whilst(
+ * function test(cb) { cb(null, count < 5); },
+ * function iter(callback) {
+ * count++;
+ * setTimeout(function() {
+ * callback(null, count);
+ * }, 1000);
+ * },
+ * function (err, n) {
+ * // 5 seconds have passed, n = 5
+ * }
+ * );
+ */
+ function whilst(test, iteratee, callback) {
+ callback = onlyOnce(callback);
+ var _fn = wrapAsync(iteratee);
+ var _test = wrapAsync(test);
+ var results = [];
- return false;
-}
+ function next(err, ...rest) {
+ if (err) return callback(err);
+ results = rest;
+ if (err === false) return;
+ _test(check);
+ }
+ function check(err, truth) {
+ if (err) return callback(err);
+ if (err === false) return;
+ if (!truth) return callback(null, ...results);
+ _fn(next);
+ }
-/***/ }),
+ return _test(check);
+ }
+ var whilst$1 = awaitify(whilst, 3);
-/***/ 2101:
-/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
+ /**
+ * Repeatedly call `iteratee` until `test` returns `true`. Calls `callback` when
+ * stopped, or an error occurs. `callback` will be passed an error and any
+ * arguments passed to the final `iteratee`'s callback.
+ *
+ * The inverse of [whilst]{@link module:ControlFlow.whilst}.
+ *
+ * @name until
+ * @static
+ * @memberOf module:ControlFlow
+ * @method
+ * @see [async.whilst]{@link module:ControlFlow.whilst}
+ * @category Control Flow
+ * @param {AsyncFunction} test - asynchronous truth test to perform before each
+ * execution of `iteratee`. Invoked with (callback).
+ * @param {AsyncFunction} iteratee - An async function which is called each time
+ * `test` fails. Invoked with (callback).
+ * @param {Function} [callback] - A callback which is called after the test
+ * function has passed and repeated execution of `iteratee` has stopped. `callback`
+ * will be passed an error and any arguments passed to the final `iteratee`'s
+ * callback. Invoked with (err, [results]);
+ * @returns {Promise} a promise, if a callback is not passed
+ *
+ * @example
+ * const results = []
+ * let finished = false
+ * async.until(function test(cb) {
+ * cb(null, finished)
+ * }, function iter(next) {
+ * fetchPage(url, (err, body) => {
+ * if (err) return next(err)
+ * results = results.concat(body.objects)
+ * finished = !!body.next
+ * next(err)
+ * })
+ * }, function done (err) {
+ * // all pages have been fetched
+ * })
+ */
+ function until(test, iteratee, callback) {
+ const _test = wrapAsync(test);
+ return whilst$1((cb) => _test((err, truth) => cb (err, !truth)), iteratee, callback);
+ }
-module.exports = __nccwpck_require__(16136);
+ /**
+ * Runs the `tasks` array of functions in series, each passing their results to
+ * the next in the array. However, if any of the `tasks` pass an error to their
+ * own callback, the next function is not executed, and the main `callback` is
+ * immediately called with the error.
+ *
+ * @name waterfall
+ * @static
+ * @memberOf module:ControlFlow
+ * @method
+ * @category Control Flow
+ * @param {Array} tasks - An array of [async functions]{@link AsyncFunction}
+ * to run.
+ * Each function should complete with any number of `result` values.
+ * The `result` values will be passed as arguments, in order, to the next task.
+ * @param {Function} [callback] - An optional callback to run once all the
+ * functions have completed. This will be passed the results of the last task's
+ * callback. Invoked with (err, [results]).
+ * @returns {Promise} a promise, if a callback is omitted
+ * @example
+ *
+ * async.waterfall([
+ * function(callback) {
+ * callback(null, 'one', 'two');
+ * },
+ * function(arg1, arg2, callback) {
+ * // arg1 now equals 'one' and arg2 now equals 'two'
+ * callback(null, 'three');
+ * },
+ * function(arg1, callback) {
+ * // arg1 now equals 'three'
+ * callback(null, 'done');
+ * }
+ * ], function (err, result) {
+ * // result now equals 'done'
+ * });
+ *
+ * // Or, with named functions:
+ * async.waterfall([
+ * myFirstFunction,
+ * mySecondFunction,
+ * myLastFunction,
+ * ], function (err, result) {
+ * // result now equals 'done'
+ * });
+ * function myFirstFunction(callback) {
+ * callback(null, 'one', 'two');
+ * }
+ * function mySecondFunction(arg1, arg2, callback) {
+ * // arg1 now equals 'one' and arg2 now equals 'two'
+ * callback(null, 'three');
+ * }
+ * function myLastFunction(arg1, callback) {
+ * // arg1 now equals 'three'
+ * callback(null, 'done');
+ * }
+ */
+ function waterfall (tasks, callback) {
+ callback = once(callback);
+ if (!Array.isArray(tasks)) return callback(new Error('First argument to waterfall must be an array of functions'));
+ if (!tasks.length) return callback();
+ var taskIndex = 0;
-/***/ }),
+ function nextTask(args) {
+ var task = wrapAsync(tasks[taskIndex++]);
+ task(...args, onlyOnce(next));
+ }
-/***/ 66168:
-/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
+ function next(err, ...args) {
+ if (err === false) return
+ if (err || taskIndex === tasks.length) {
+ return callback(err, ...args);
+ }
+ nextTask(args);
+ }
-const { info, debug } = __nccwpck_require__(65829);
-const utils = __nccwpck_require__(98911);
+ nextTask([]);
+ }
-class Cell {
- /**
- * A representation of a cell within the table.
- * Implementations must have `init` and `draw` methods,
- * as well as `colSpan`, `rowSpan`, `desiredHeight` and `desiredWidth` properties.
- * @param options
- * @constructor
- */
- constructor(options) {
- this.setOptions(options);
+ var waterfall$1 = awaitify(waterfall);
/**
- * Each cell will have it's `x` and `y` values set by the `layout-manager` prior to
- * `init` being called;
- * @type {Number}
+ * An "async function" in the context of Async is an asynchronous function with
+ * a variable number of parameters, with the final parameter being a callback.
+ * (`function (arg1, arg2, ..., callback) {}`)
+ * The final callback is of the form `callback(err, results...)`, which must be
+ * called once the function is completed. The callback should be called with a
+ * Error as its first argument to signal that an error occurred.
+ * Otherwise, if no error occurred, it should be called with `null` as the first
+ * argument, and any additional `result` arguments that may apply, to signal
+ * successful completion.
+ * The callback must be called exactly once, ideally on a later tick of the
+ * JavaScript event loop.
+ *
+ * This type of function is also referred to as a "Node-style async function",
+ * or a "continuation passing-style function" (CPS). Most of the methods of this
+ * library are themselves CPS/Node-style async functions, or functions that
+ * return CPS/Node-style async functions.
+ *
+ * Wherever we accept a Node-style async function, we also directly accept an
+ * [ES2017 `async` function]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function}.
+ * In this case, the `async` function will not be passed a final callback
+ * argument, and any thrown error will be used as the `err` argument of the
+ * implicit callback, and the return value will be used as the `result` value.
+ * (i.e. a `rejected` of the returned Promise becomes the `err` callback
+ * argument, and a `resolved` value becomes the `result`.)
+ *
+ * Note, due to JavaScript limitations, we can only detect native `async`
+ * functions and not transpilied implementations.
+ * Your environment must have `async`/`await` support for this to work.
+ * (e.g. Node > v7.6, or a recent version of a modern browser).
+ * If you are using `async` functions through a transpiler (e.g. Babel), you
+ * must still wrap the function with [asyncify]{@link module:Utils.asyncify},
+ * because the `async function` will be compiled to an ordinary function that
+ * returns a promise.
+ *
+ * @typedef {Function} AsyncFunction
+ * @static
*/
- this.x = null;
- this.y = null;
- }
-
- setOptions(options) {
- if (['boolean', 'number', 'string'].indexOf(typeof options) !== -1) {
- options = { content: '' + options };
- }
- options = options || {};
- this.options = options;
- let content = options.content;
- if (['boolean', 'number', 'string'].indexOf(typeof content) !== -1) {
- this.content = String(content);
- } else if (!content) {
- this.content = this.options.href || '';
- } else {
- throw new Error('Content needs to be a primitive, got: ' + typeof content);
- }
- this.colSpan = options.colSpan || 1;
- this.rowSpan = options.rowSpan || 1;
- if (this.options.href) {
- Object.defineProperty(this, 'href', {
- get() {
- return this.options.href;
- },
- });
- }
- }
- mergeTableOptions(tableOptions, cells) {
- this.cells = cells;
-
- let optionsChars = this.options.chars || {};
- let tableChars = tableOptions.chars;
- let chars = (this.chars = {});
- CHAR_NAMES.forEach(function (name) {
- setOption(optionsChars, tableChars, name, chars);
- });
- this.truncate = this.options.truncate || tableOptions.truncate;
+ var index = {
+ apply,
+ applyEach,
+ applyEachSeries,
+ asyncify,
+ auto,
+ autoInject,
+ cargo: cargo$1,
+ cargoQueue: cargo,
+ compose,
+ concat: concat$1,
+ concatLimit: concatLimit$1,
+ concatSeries: concatSeries$1,
+ constant: constant$1,
+ detect: detect$1,
+ detectLimit: detectLimit$1,
+ detectSeries: detectSeries$1,
+ dir,
+ doUntil,
+ doWhilst: doWhilst$1,
+ each,
+ eachLimit: eachLimit$1,
+ eachOf: eachOf$1,
+ eachOfLimit: eachOfLimit$1,
+ eachOfSeries: eachOfSeries$1,
+ eachSeries: eachSeries$1,
+ ensureAsync,
+ every: every$1,
+ everyLimit: everyLimit$1,
+ everySeries: everySeries$1,
+ filter: filter$1,
+ filterLimit: filterLimit$1,
+ filterSeries: filterSeries$1,
+ forever: forever$1,
+ groupBy,
+ groupByLimit: groupByLimit$1,
+ groupBySeries,
+ log,
+ map: map$1,
+ mapLimit: mapLimit$1,
+ mapSeries: mapSeries$1,
+ mapValues,
+ mapValuesLimit: mapValuesLimit$1,
+ mapValuesSeries,
+ memoize,
+ nextTick,
+ parallel,
+ parallelLimit,
+ priorityQueue,
+ queue,
+ race: race$1,
+ reduce: reduce$1,
+ reduceRight,
+ reflect,
+ reflectAll,
+ reject: reject$1,
+ rejectLimit: rejectLimit$1,
+ rejectSeries: rejectSeries$1,
+ retry,
+ retryable,
+ seq,
+ series,
+ setImmediate: setImmediate$1,
+ some: some$1,
+ someLimit: someLimit$1,
+ someSeries: someSeries$1,
+ sortBy: sortBy$1,
+ timeout,
+ times,
+ timesLimit,
+ timesSeries,
+ transform,
+ tryEach: tryEach$1,
+ unmemoize,
+ until,
+ waterfall: waterfall$1,
+ whilst: whilst$1,
- let style = (this.options.style = this.options.style || {});
- let tableStyle = tableOptions.style;
- setOption(style, tableStyle, 'padding-left', this);
- setOption(style, tableStyle, 'padding-right', this);
- this.head = style.head || tableStyle.head;
- this.border = style.border || tableStyle.border;
+ // aliases
+ all: every$1,
+ allLimit: everyLimit$1,
+ allSeries: everySeries$1,
+ any: some$1,
+ anyLimit: someLimit$1,
+ anySeries: someSeries$1,
+ find: detect$1,
+ findLimit: detectLimit$1,
+ findSeries: detectSeries$1,
+ flatMap: concat$1,
+ flatMapLimit: concatLimit$1,
+ flatMapSeries: concatSeries$1,
+ forEach: each,
+ forEachSeries: eachSeries$1,
+ forEachLimit: eachLimit$1,
+ forEachOf: eachOf$1,
+ forEachOfSeries: eachOfSeries$1,
+ forEachOfLimit: eachOfLimit$1,
+ inject: reduce$1,
+ foldl: reduce$1,
+ foldr: reduceRight,
+ select: filter$1,
+ selectLimit: filterLimit$1,
+ selectSeries: filterSeries$1,
+ wrapSync: asyncify,
+ during: whilst$1,
+ doDuring: doWhilst$1
+ };
- this.fixedWidth = tableOptions.colWidths[this.x];
- this.lines = this.computeLines(tableOptions);
+ exports.all = every$1;
+ exports.allLimit = everyLimit$1;
+ exports.allSeries = everySeries$1;
+ exports.any = some$1;
+ exports.anyLimit = someLimit$1;
+ exports.anySeries = someSeries$1;
+ exports.apply = apply;
+ exports.applyEach = applyEach;
+ exports.applyEachSeries = applyEachSeries;
+ exports.asyncify = asyncify;
+ exports.auto = auto;
+ exports.autoInject = autoInject;
+ exports.cargo = cargo$1;
+ exports.cargoQueue = cargo;
+ exports.compose = compose;
+ exports.concat = concat$1;
+ exports.concatLimit = concatLimit$1;
+ exports.concatSeries = concatSeries$1;
+ exports.constant = constant$1;
+ exports.default = index;
+ exports.detect = detect$1;
+ exports.detectLimit = detectLimit$1;
+ exports.detectSeries = detectSeries$1;
+ exports.dir = dir;
+ exports.doDuring = doWhilst$1;
+ exports.doUntil = doUntil;
+ exports.doWhilst = doWhilst$1;
+ exports.during = whilst$1;
+ exports.each = each;
+ exports.eachLimit = eachLimit$1;
+ exports.eachOf = eachOf$1;
+ exports.eachOfLimit = eachOfLimit$1;
+ exports.eachOfSeries = eachOfSeries$1;
+ exports.eachSeries = eachSeries$1;
+ exports.ensureAsync = ensureAsync;
+ exports.every = every$1;
+ exports.everyLimit = everyLimit$1;
+ exports.everySeries = everySeries$1;
+ exports.filter = filter$1;
+ exports.filterLimit = filterLimit$1;
+ exports.filterSeries = filterSeries$1;
+ exports.find = detect$1;
+ exports.findLimit = detectLimit$1;
+ exports.findSeries = detectSeries$1;
+ exports.flatMap = concat$1;
+ exports.flatMapLimit = concatLimit$1;
+ exports.flatMapSeries = concatSeries$1;
+ exports.foldl = reduce$1;
+ exports.foldr = reduceRight;
+ exports.forEach = each;
+ exports.forEachLimit = eachLimit$1;
+ exports.forEachOf = eachOf$1;
+ exports.forEachOfLimit = eachOfLimit$1;
+ exports.forEachOfSeries = eachOfSeries$1;
+ exports.forEachSeries = eachSeries$1;
+ exports.forever = forever$1;
+ exports.groupBy = groupBy;
+ exports.groupByLimit = groupByLimit$1;
+ exports.groupBySeries = groupBySeries;
+ exports.inject = reduce$1;
+ exports.log = log;
+ exports.map = map$1;
+ exports.mapLimit = mapLimit$1;
+ exports.mapSeries = mapSeries$1;
+ exports.mapValues = mapValues;
+ exports.mapValuesLimit = mapValuesLimit$1;
+ exports.mapValuesSeries = mapValuesSeries;
+ exports.memoize = memoize;
+ exports.nextTick = nextTick;
+ exports.parallel = parallel;
+ exports.parallelLimit = parallelLimit;
+ exports.priorityQueue = priorityQueue;
+ exports.queue = queue;
+ exports.race = race$1;
+ exports.reduce = reduce$1;
+ exports.reduceRight = reduceRight;
+ exports.reflect = reflect;
+ exports.reflectAll = reflectAll;
+ exports.reject = reject$1;
+ exports.rejectLimit = rejectLimit$1;
+ exports.rejectSeries = rejectSeries$1;
+ exports.retry = retry;
+ exports.retryable = retryable;
+ exports.select = filter$1;
+ exports.selectLimit = filterLimit$1;
+ exports.selectSeries = filterSeries$1;
+ exports.seq = seq;
+ exports.series = series;
+ exports.setImmediate = setImmediate$1;
+ exports.some = some$1;
+ exports.someLimit = someLimit$1;
+ exports.someSeries = someSeries$1;
+ exports.sortBy = sortBy$1;
+ exports.timeout = timeout;
+ exports.times = times;
+ exports.timesLimit = timesLimit;
+ exports.timesSeries = timesSeries;
+ exports.transform = transform;
+ exports.tryEach = tryEach$1;
+ exports.unmemoize = unmemoize;
+ exports.until = until;
+ exports.waterfall = waterfall$1;
+ exports.whilst = whilst$1;
+ exports.wrapSync = asyncify;
- this.desiredWidth = utils.strlen(this.content) + this.paddingLeft + this.paddingRight;
- this.desiredHeight = this.lines.length;
- }
+ Object.defineProperty(exports, '__esModule', { value: true });
- computeLines(tableOptions) {
- const tableWordWrap = tableOptions.wordWrap || tableOptions.textWrap;
- const { wordWrap = tableWordWrap } = this.options;
- if (this.fixedWidth && wordWrap) {
- this.fixedWidth -= this.paddingLeft + this.paddingRight;
- if (this.colSpan) {
- let i = 1;
- while (i < this.colSpan) {
- this.fixedWidth += tableOptions.colWidths[this.x + i];
- i++;
- }
- }
- const { wrapOnWordBoundary: tableWrapOnWordBoundary = true } = tableOptions;
- const { wrapOnWordBoundary = tableWrapOnWordBoundary } = this.options;
- return this.wrapLines(utils.wordWrap(this.fixedWidth, this.content, wrapOnWordBoundary));
- }
- return this.wrapLines(this.content.split('\n'));
- }
+}));
- wrapLines(computedLines) {
- const lines = utils.colorizeLines(computedLines);
- if (this.href) {
- return lines.map((line) => utils.hyperlink(this.href, line));
- }
- return lines;
- }
- /**
- * Initializes the Cells data structure.
- *
- * @param tableOptions - A fully populated set of tableOptions.
- * In addition to the standard default values, tableOptions must have fully populated the
- * `colWidths` and `rowWidths` arrays. Those arrays must have lengths equal to the number
- * of columns or rows (respectively) in this table, and each array item must be a Number.
- *
- */
- init(tableOptions) {
- let x = this.x;
- let y = this.y;
- this.widths = tableOptions.colWidths.slice(x, x + this.colSpan);
- this.heights = tableOptions.rowHeights.slice(y, y + this.rowSpan);
- this.width = this.widths.reduce(sumPlusOne, -1);
- this.height = this.heights.reduce(sumPlusOne, -1);
+/***/ }),
- this.hAlign = this.options.hAlign || tableOptions.colAligns[x];
- this.vAlign = this.options.vAlign || tableOptions.rowAligns[y];
+/***/ 33497:
+/***/ ((module) => {
- this.drawRight = x + this.colSpan == tableOptions.colWidths.length;
- }
+function isBuffer (value) {
+ return Buffer.isBuffer(value) || value instanceof Uint8Array
+}
- /**
- * Draws the given line of the cell.
- * This default implementation defers to methods `drawTop`, `drawBottom`, `drawLine` and `drawEmpty`.
- * @param lineNum - can be `top`, `bottom` or a numerical line number.
- * @param spanningCell - will be a number if being called from a RowSpanCell, and will represent how
- * many rows below it's being called from. Otherwise it's undefined.
- * @returns {String} The representation of this line.
- */
- draw(lineNum, spanningCell) {
- if (lineNum == 'top') return this.drawTop(this.drawRight);
- if (lineNum == 'bottom') return this.drawBottom(this.drawRight);
- let content = utils.truncate(this.content, 10, this.truncate);
- if (!lineNum) {
- info(`${this.y}-${this.x}: ${this.rowSpan - lineNum}x${this.colSpan} Cell ${content}`);
- } else {
- // debug(`${lineNum}-${this.x}: 1x${this.colSpan} RowSpanCell ${content}`);
- }
- let padLen = Math.max(this.height - this.lines.length, 0);
- let padTop;
- switch (this.vAlign) {
- case 'center':
- padTop = Math.ceil(padLen / 2);
- break;
- case 'bottom':
- padTop = padLen;
- break;
- default:
- padTop = 0;
- }
- if (lineNum < padTop || lineNum >= padTop + this.lines.length) {
- return this.drawEmpty(this.drawRight, spanningCell);
- }
- let forceTruncation = this.lines.length > this.height && lineNum + 1 >= this.height;
- return this.drawLine(lineNum - padTop, this.drawRight, forceTruncation, spanningCell);
- }
+function isEncoding (encoding) {
+ return Buffer.isEncoding(encoding)
+}
- /**
- * Renders the top line of the cell.
- * @param drawRight - true if this method should render the right edge of the cell.
- * @returns {String}
- */
- drawTop(drawRight) {
- let content = [];
- if (this.cells) {
- //TODO: cells should always exist - some tests don't fill it in though
- this.widths.forEach(function (width, index) {
- content.push(this._topLeftChar(index));
- content.push(utils.repeat(this.chars[this.y == 0 ? 'top' : 'mid'], width));
- }, this);
- } else {
- content.push(this._topLeftChar(0));
- content.push(utils.repeat(this.chars[this.y == 0 ? 'top' : 'mid'], this.width));
- }
- if (drawRight) {
- content.push(this.chars[this.y == 0 ? 'topRight' : 'rightMid']);
- }
- return this.wrapWithStyleColors('border', content.join(''));
- }
+function alloc (size, fill, encoding) {
+ return Buffer.alloc(size, fill, encoding)
+}
- _topLeftChar(offset) {
- let x = this.x + offset;
- let leftChar;
- if (this.y == 0) {
- leftChar = x == 0 ? 'topLeft' : offset == 0 ? 'topMid' : 'top';
- } else {
- if (x == 0) {
- leftChar = 'leftMid';
- } else {
- leftChar = offset == 0 ? 'midMid' : 'bottomMid';
- if (this.cells) {
- //TODO: cells should always exist - some tests don't fill it in though
- let spanAbove = this.cells[this.y - 1][x] instanceof Cell.ColSpanCell;
- if (spanAbove) {
- leftChar = offset == 0 ? 'topMid' : 'mid';
- }
- if (offset == 0) {
- let i = 1;
- while (this.cells[this.y][x - i] instanceof Cell.ColSpanCell) {
- i++;
- }
- if (this.cells[this.y][x - i] instanceof Cell.RowSpanCell) {
- leftChar = 'leftMid';
- }
- }
- }
- }
- }
- return this.chars[leftChar];
- }
+function allocUnsafe (size) {
+ return Buffer.allocUnsafe(size)
+}
- wrapWithStyleColors(styleProperty, content) {
- if (this[styleProperty] && this[styleProperty].length) {
- try {
- let colors = __nccwpck_require__(59256);
- for (let i = this[styleProperty].length - 1; i >= 0; i--) {
- colors = colors[this[styleProperty][i]];
- }
- return colors(content);
- } catch (e) {
- return content;
- }
- } else {
- return content;
- }
- }
+function allocUnsafeSlow (size) {
+ return Buffer.allocUnsafeSlow(size)
+}
- /**
- * Renders a line of text.
- * @param lineNum - Which line of text to render. This is not necessarily the line within the cell.
- * There may be top-padding above the first line of text.
- * @param drawRight - true if this method should render the right edge of the cell.
- * @param forceTruncationSymbol - `true` if the rendered text should end with the truncation symbol even
- * if the text fits. This is used when the cell is vertically truncated. If `false` the text should
- * only include the truncation symbol if the text will not fit horizontally within the cell width.
- * @param spanningCell - a number of if being called from a RowSpanCell. (how many rows below). otherwise undefined.
- * @returns {String}
- */
- drawLine(lineNum, drawRight, forceTruncationSymbol, spanningCell) {
- let left = this.chars[this.x == 0 ? 'left' : 'middle'];
- if (this.x && spanningCell && this.cells) {
- let cellLeft = this.cells[this.y + spanningCell][this.x - 1];
- while (cellLeft instanceof ColSpanCell) {
- cellLeft = this.cells[cellLeft.y][cellLeft.x - 1];
- }
- if (!(cellLeft instanceof RowSpanCell)) {
- left = this.chars['rightMid'];
- }
- }
- let leftPadding = utils.repeat(' ', this.paddingLeft);
- let right = drawRight ? this.chars['right'] : '';
- let rightPadding = utils.repeat(' ', this.paddingRight);
- let line = this.lines[lineNum];
- let len = this.width - (this.paddingLeft + this.paddingRight);
- if (forceTruncationSymbol) line += this.truncate || '…';
- let content = utils.truncate(line, len, this.truncate);
- content = utils.pad(content, len, ' ', this.hAlign);
- content = leftPadding + content + rightPadding;
- return this.stylizeLine(left, content, right);
- }
+function byteLength (string, encoding) {
+ return Buffer.byteLength(string, encoding)
+}
- stylizeLine(left, content, right) {
- left = this.wrapWithStyleColors('border', left);
- right = this.wrapWithStyleColors('border', right);
- if (this.y === 0) {
- content = this.wrapWithStyleColors('head', content);
- }
- return left + content + right;
- }
+function compare (a, b) {
+ return Buffer.compare(a, b)
+}
- /**
- * Renders the bottom line of the cell.
- * @param drawRight - true if this method should render the right edge of the cell.
- * @returns {String}
- */
- drawBottom(drawRight) {
- let left = this.chars[this.x == 0 ? 'bottomLeft' : 'bottomMid'];
- let content = utils.repeat(this.chars.bottom, this.width);
- let right = drawRight ? this.chars['bottomRight'] : '';
- return this.wrapWithStyleColors('border', left + content + right);
- }
+function concat (buffers, totalLength) {
+ return Buffer.concat(buffers, totalLength)
+}
- /**
- * Renders a blank line of text within the cell. Used for top and/or bottom padding.
- * @param drawRight - true if this method should render the right edge of the cell.
- * @param spanningCell - a number of if being called from a RowSpanCell. (how many rows below). otherwise undefined.
- * @returns {String}
- */
- drawEmpty(drawRight, spanningCell) {
- let left = this.chars[this.x == 0 ? 'left' : 'middle'];
- if (this.x && spanningCell && this.cells) {
- let cellLeft = this.cells[this.y + spanningCell][this.x - 1];
- while (cellLeft instanceof ColSpanCell) {
- cellLeft = this.cells[cellLeft.y][cellLeft.x - 1];
- }
- if (!(cellLeft instanceof RowSpanCell)) {
- left = this.chars['rightMid'];
- }
- }
- let right = drawRight ? this.chars['right'] : '';
- let content = utils.repeat(' ', this.width);
- return this.stylizeLine(left, content, right);
- }
+function copy (source, target, targetStart, start, end) {
+ return toBuffer(source).copy(target, targetStart, start, end)
}
-class ColSpanCell {
- /**
- * A Cell that doesn't do anything. It just draws empty lines.
- * Used as a placeholder in column spanning.
- * @constructor
- */
- constructor() {}
+function equals (a, b) {
+ return toBuffer(a).equals(b)
+}
- draw(lineNum) {
- if (typeof lineNum === 'number') {
- debug(`${this.y}-${this.x}: 1x1 ColSpanCell`);
- }
- return '';
- }
+function fill (buffer, value, offset, end, encoding) {
+ return toBuffer(buffer).fill(value, offset, end, encoding)
+}
- init() {}
+function from (value, encodingOrOffset, length) {
+ return Buffer.from(value, encodingOrOffset, length)
+}
- mergeTableOptions() {}
+function includes (buffer, value, byteOffset, encoding) {
+ return toBuffer(buffer).includes(value, byteOffset, encoding)
}
-class RowSpanCell {
- /**
- * A placeholder Cell for a Cell that spans multiple rows.
- * It delegates rendering to the original cell, but adds the appropriate offset.
- * @param originalCell
- * @constructor
- */
- constructor(originalCell) {
- this.originalCell = originalCell;
- }
+function indexOf (buffer, value, byfeOffset, encoding) {
+ return toBuffer(buffer).indexOf(value, byfeOffset, encoding)
+}
- init(tableOptions) {
- let y = this.y;
- let originalY = this.originalCell.y;
- this.cellOffset = y - originalY;
- this.offset = findDimension(tableOptions.rowHeights, originalY, this.cellOffset);
- }
+function lastIndexOf (buffer, value, byteOffset, encoding) {
+ return toBuffer(buffer).lastIndexOf(value, byteOffset, encoding)
+}
- draw(lineNum) {
- if (lineNum == 'top') {
- return this.originalCell.draw(this.offset, this.cellOffset);
- }
- if (lineNum == 'bottom') {
- return this.originalCell.draw('bottom');
- }
- debug(`${this.y}-${this.x}: 1x${this.colSpan} RowSpanCell for ${this.originalCell.content}`);
- return this.originalCell.draw(this.offset + 1 + lineNum);
- }
+function swap16 (buffer) {
+ return toBuffer(buffer).swap16()
+}
- mergeTableOptions() {}
+function swap32 (buffer) {
+ return toBuffer(buffer).swap32()
}
-function firstDefined(...args) {
- return args.filter((v) => v !== undefined && v !== null).shift();
+function swap64 (buffer) {
+ return toBuffer(buffer).swap64()
}
-// HELPER FUNCTIONS
-function setOption(objA, objB, nameB, targetObj) {
- let nameA = nameB.split('-');
- if (nameA.length > 1) {
- nameA[1] = nameA[1].charAt(0).toUpperCase() + nameA[1].substr(1);
- nameA = nameA.join('');
- targetObj[nameA] = firstDefined(objA[nameA], objA[nameB], objB[nameA], objB[nameB]);
- } else {
- targetObj[nameB] = firstDefined(objA[nameB], objB[nameB]);
- }
+function toBuffer (buffer) {
+ if (Buffer.isBuffer(buffer)) return buffer
+ return Buffer.from(buffer.buffer, buffer.byteOffset, buffer.byteLength)
}
-function findDimension(dimensionTable, startingIndex, span) {
- let ret = dimensionTable[startingIndex];
- for (let i = 1; i < span; i++) {
- ret += 1 + dimensionTable[startingIndex + i];
- }
- return ret;
+function toString (buffer, encoding, start, end) {
+ return toBuffer(buffer).toString(encoding, start, end)
}
-function sumPlusOne(a, b) {
- return a + b + 1;
-}
-
-let CHAR_NAMES = [
- 'top',
- 'top-mid',
- 'top-left',
- 'top-right',
- 'bottom',
- 'bottom-mid',
- 'bottom-left',
- 'bottom-right',
- 'left',
- 'left-mid',
- 'mid',
- 'mid-mid',
- 'right',
- 'right-mid',
- 'middle',
-];
+function write (buffer, string, offset, length, encoding) {
+ return toBuffer(buffer).write(string, offset, length, encoding)
+}
-module.exports = Cell;
-module.exports.ColSpanCell = ColSpanCell;
-module.exports.RowSpanCell = RowSpanCell;
+function writeDoubleLE (buffer, value, offset) {
+ return toBuffer(buffer).writeDoubleLE(value, offset)
+}
+function writeFloatLE (buffer, value, offset) {
+ return toBuffer(buffer).writeFloatLE(value, offset)
+}
-/***/ }),
+function writeUInt32LE (buffer, value, offset) {
+ return toBuffer(buffer).writeUInt32LE(value, offset)
+}
-/***/ 65829:
-/***/ ((module) => {
+function writeInt32LE (buffer, value, offset) {
+ return toBuffer(buffer).writeInt32LE(value, offset)
+}
-let messages = [];
-let level = 0;
+function readDoubleLE (buffer, offset) {
+ return toBuffer(buffer).readDoubleLE(offset)
+}
-const debug = (msg, min) => {
- if (level >= min) {
- messages.push(msg);
- }
-};
+function readFloatLE (buffer, offset) {
+ return toBuffer(buffer).readFloatLE(offset)
+}
-debug.WARN = 1;
-debug.INFO = 2;
-debug.DEBUG = 3;
+function readUInt32LE (buffer, offset) {
+ return toBuffer(buffer).readUInt32LE(offset)
+}
-debug.reset = () => {
- messages = [];
-};
+function readInt32LE (buffer, offset) {
+ return toBuffer(buffer).readInt32LE(offset)
+}
-debug.setDebugLevel = (v) => {
- level = v;
-};
+function writeDoubleBE (buffer, value, offset) {
+ return toBuffer(buffer).writeDoubleBE(value, offset)
+}
-debug.warn = (msg) => debug(msg, debug.WARN);
-debug.info = (msg) => debug(msg, debug.INFO);
-debug.debug = (msg) => debug(msg, debug.DEBUG);
+function writeFloatBE (buffer, value, offset) {
+ return toBuffer(buffer).writeFloatBE(value, offset)
+}
-debug.debugMessages = () => messages;
+function writeUInt32BE (buffer, value, offset) {
+ return toBuffer(buffer).writeUInt32BE(value, offset)
+}
-module.exports = debug;
+function writeInt32BE (buffer, value, offset) {
+ return toBuffer(buffer).writeInt32BE(value, offset)
+}
+function readDoubleBE (buffer, offset) {
+ return toBuffer(buffer).readDoubleBE(offset)
+}
-/***/ }),
+function readFloatBE (buffer, offset) {
+ return toBuffer(buffer).readFloatBE(offset)
+}
-/***/ 93875:
-/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
+function readUInt32BE (buffer, offset) {
+ return toBuffer(buffer).readUInt32BE(offset)
+}
-const { warn, debug } = __nccwpck_require__(65829);
-const Cell = __nccwpck_require__(66168);
-const { ColSpanCell, RowSpanCell } = Cell;
+function readInt32BE (buffer, offset) {
+ return toBuffer(buffer).readInt32BE(offset)
+}
-(function () {
- function next(alloc, col) {
- if (alloc[col] > 0) {
- return next(alloc, col + 1);
- }
- return col;
- }
-
- function layoutTable(table) {
- let alloc = {};
- table.forEach(function (row, rowIndex) {
- let col = 0;
- row.forEach(function (cell) {
- cell.y = rowIndex;
- // Avoid erroneous call to next() on first row
- cell.x = rowIndex ? next(alloc, col) : col;
- const rowSpan = cell.rowSpan || 1;
- const colSpan = cell.colSpan || 1;
- if (rowSpan > 1) {
- for (let cs = 0; cs < colSpan; cs++) {
- alloc[cell.x + cs] = rowSpan;
- }
- }
- col = cell.x + colSpan;
- });
- Object.keys(alloc).forEach((idx) => {
- alloc[idx]--;
- if (alloc[idx] < 1) delete alloc[idx];
- });
- });
- }
+module.exports = {
+ isBuffer,
+ isEncoding,
+ alloc,
+ allocUnsafe,
+ allocUnsafeSlow,
+ byteLength,
+ compare,
+ concat,
+ copy,
+ equals,
+ fill,
+ from,
+ includes,
+ indexOf,
+ lastIndexOf,
+ swap16,
+ swap32,
+ swap64,
+ toBuffer,
+ toString,
+ write,
+ writeDoubleLE,
+ writeFloatLE,
+ writeUInt32LE,
+ writeInt32LE,
+ readDoubleLE,
+ readFloatLE,
+ readUInt32LE,
+ readInt32LE,
+ writeDoubleBE,
+ writeFloatBE,
+ writeUInt32BE,
+ writeInt32BE,
+ readDoubleBE,
+ readFloatBE,
+ readUInt32BE,
+ readInt32BE
- function maxWidth(table) {
- let mw = 0;
- table.forEach(function (row) {
- row.forEach(function (cell) {
- mw = Math.max(mw, cell.x + (cell.colSpan || 1));
- });
- });
- return mw;
- }
+}
- function maxHeight(table) {
- return table.length;
- }
- function cellsConflict(cell1, cell2) {
- let yMin1 = cell1.y;
- let yMax1 = cell1.y - 1 + (cell1.rowSpan || 1);
- let yMin2 = cell2.y;
- let yMax2 = cell2.y - 1 + (cell2.rowSpan || 1);
- let yConflict = !(yMin1 > yMax2 || yMin2 > yMax1);
+/***/ }),
- let xMin1 = cell1.x;
- let xMax1 = cell1.x - 1 + (cell1.colSpan || 1);
- let xMin2 = cell2.x;
- let xMax2 = cell2.x - 1 + (cell2.colSpan || 1);
- let xConflict = !(xMin1 > xMax2 || xMin2 > xMax1);
+/***/ 18098:
+/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
- return yConflict && xConflict;
- }
+"use strict";
- function conflictExists(rows, x, y) {
- let i_max = Math.min(rows.length - 1, y);
- let cell = { x: x, y: y };
- for (let i = 0; i <= i_max; i++) {
- let row = rows[i];
- for (let j = 0; j < row.length; j++) {
- if (cellsConflict(cell, row[j])) {
- return true;
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
+}) : (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+ o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || function (mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ __setModuleDefault(result, mod);
+ return result;
+};
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+const t = __importStar(__nccwpck_require__(7912));
+if (!(Array.isArray(t.TYPES) &&
+ t.TYPES.every((t) => typeof t === 'string'))) {
+ throw new Error('@babel/types TYPES does not match the expected type.');
+}
+const FLIPPED_ALIAS_KEYS = t
+ .FLIPPED_ALIAS_KEYS;
+const TYPES = new Set(t.TYPES);
+if (!(FLIPPED_ALIAS_KEYS &&
+ // tslint:disable-next-line: strict-type-predicates
+ typeof FLIPPED_ALIAS_KEYS === 'object' &&
+ Object.keys(FLIPPED_ALIAS_KEYS).every((key) => Array.isArray(FLIPPED_ALIAS_KEYS[key]) &&
+ // tslint:disable-next-line: strict-type-predicates
+ FLIPPED_ALIAS_KEYS[key].every((v) => typeof v === 'string')))) {
+ throw new Error('@babel/types FLIPPED_ALIAS_KEYS does not match the expected type.');
+}
+/**
+ * This serves thre functions:
+ *
+ * 1. Take any "aliases" and explode them to refecence the concrete types
+ * 2. Normalize all handlers to have an `{enter, exit}` pair, rather than raw functions
+ * 3. make the enter and exit handlers arrays, so that multiple handlers can be merged
+ */
+function explode(input) {
+ const results = {};
+ for (const key in input) {
+ const aliases = FLIPPED_ALIAS_KEYS[key];
+ if (aliases) {
+ for (const concreteKey of aliases) {
+ if (concreteKey in results) {
+ if (typeof input[key] === 'function') {
+ results[concreteKey].enter.push(input[key]);
+ }
+ else {
+ if (input[key].enter)
+ results[concreteKey].enter.push(input[key].enter);
+ if (input[key].exit)
+ results[concreteKey].exit.push(input[key].exit);
+ }
+ }
+ else {
+ if (typeof input[key] === 'function') {
+ results[concreteKey] = {
+ enter: [input[key]],
+ exit: [],
+ };
+ }
+ else {
+ results[concreteKey] = {
+ enter: input[key].enter ? [input[key].enter] : [],
+ exit: input[key].exit ? [input[key].exit] : [],
+ };
+ }
+ }
+ }
+ }
+ else if (TYPES.has(key)) {
+ if (key in results) {
+ if (typeof input[key] === 'function') {
+ results[key].enter.push(input[key]);
+ }
+ else {
+ if (input[key].enter)
+ results[key].enter.push(input[key].enter);
+ if (input[key].exit)
+ results[key].exit.push(input[key].exit);
+ }
+ }
+ else {
+ if (typeof input[key] === 'function') {
+ results[key] = {
+ enter: [input[key]],
+ exit: [],
+ };
+ }
+ else {
+ results[key] = {
+ enter: input[key].enter ? [input[key].enter] : [],
+ exit: input[key].exit ? [input[key].exit] : [],
+ };
+ }
+ }
}
- }
}
- return false;
- }
+ return results;
+}
+exports["default"] = explode;
+//# sourceMappingURL=explode.js.map
- function allBlank(rows, y, xMin, xMax) {
- for (let x = xMin; x < xMax; x++) {
- if (conflictExists(rows, x, y)) {
- return false;
- }
- }
- return true;
- }
+/***/ }),
- function addRowSpanCells(table) {
- table.forEach(function (row, rowIndex) {
- row.forEach(function (cell) {
- for (let i = 1; i < cell.rowSpan; i++) {
- let rowSpanCell = new RowSpanCell(cell);
- rowSpanCell.x = cell.x;
- rowSpanCell.y = cell.y + i;
- rowSpanCell.colSpan = cell.colSpan;
- insertCell(rowSpanCell, table[rowIndex + i]);
- }
- });
- });
- }
+/***/ 6407:
+/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
- function addColSpanCells(cellRows) {
- for (let rowIndex = cellRows.length - 1; rowIndex >= 0; rowIndex--) {
- let cellColumns = cellRows[rowIndex];
- for (let columnIndex = 0; columnIndex < cellColumns.length; columnIndex++) {
- let cell = cellColumns[columnIndex];
- for (let k = 1; k < cell.colSpan; k++) {
- let colSpanCell = new ColSpanCell();
- colSpanCell.x = cell.x + k;
- colSpanCell.y = cell.y;
- cellColumns.splice(columnIndex + 1, 0, colSpanCell);
- }
- }
- }
- }
+"use strict";
- function insertCell(cell, row) {
- let x = 0;
- while (x < row.length && row[x].x < cell.x) {
- x++;
- }
- row.splice(x, 0, cell);
- }
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
+}) : (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+ o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || function (mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ __setModuleDefault(result, mod);
+ return result;
+};
+var __importDefault = (this && this.__importDefault) || function (mod) {
+ return (mod && mod.__esModule) ? mod : { "default": mod };
+};
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.recursive = exports.ancestor = exports.simple = void 0;
+const t = __importStar(__nccwpck_require__(7912));
+const explode_1 = __importDefault(__nccwpck_require__(18098));
+const VISITOR_KEYS = t.VISITOR_KEYS;
+if (!(VISITOR_KEYS &&
+ // tslint:disable-next-line: strict-type-predicates
+ typeof VISITOR_KEYS === 'object' &&
+ Object.keys(VISITOR_KEYS).every((key) => Array.isArray(VISITOR_KEYS[key]) &&
+ // tslint:disable-next-line: strict-type-predicates
+ VISITOR_KEYS[key].every((v) => typeof v === 'string')))) {
+ throw new Error('@babel/types VISITOR_KEYS does not match the expected type.');
+}
+function simple(visitors) {
+ const vis = explode_1.default(visitors);
+ return (node, state) => {
+ (function recurse(node) {
+ if (!node)
+ return;
+ const visitor = vis[node.type];
+ if (visitor === null || visitor === void 0 ? void 0 : visitor.enter) {
+ for (const v of visitor.enter) {
+ v(node, state);
+ }
+ }
+ for (const key of VISITOR_KEYS[node.type] || []) {
+ const subNode = node[key];
+ if (Array.isArray(subNode)) {
+ for (const subSubNode of subNode) {
+ recurse(subSubNode);
+ }
+ }
+ else {
+ recurse(subNode);
+ }
+ }
+ if (visitor === null || visitor === void 0 ? void 0 : visitor.exit) {
+ for (const v of visitor.exit) {
+ v(node, state);
+ }
+ }
+ })(node);
+ };
+}
+exports.simple = simple;
+function ancestor(visitors) {
+ const vis = explode_1.default(visitors);
+ return (node, state) => {
+ const ancestors = [];
+ (function recurse(node) {
+ if (!node)
+ return;
+ const visitor = vis[node.type];
+ const isNew = node !== ancestors[ancestors.length - 1];
+ if (isNew)
+ ancestors.push(node);
+ if (visitor === null || visitor === void 0 ? void 0 : visitor.enter) {
+ for (const v of visitor.enter) {
+ v(node, state, ancestors);
+ }
+ }
+ for (const key of VISITOR_KEYS[node.type] || []) {
+ const subNode = node[key];
+ if (Array.isArray(subNode)) {
+ for (const subSubNode of subNode) {
+ recurse(subSubNode);
+ }
+ }
+ else {
+ recurse(subNode);
+ }
+ }
+ if (visitor === null || visitor === void 0 ? void 0 : visitor.exit) {
+ for (const v of visitor.exit) {
+ v(node, state, ancestors);
+ }
+ }
+ if (isNew)
+ ancestors.pop();
+ })(node);
+ };
+}
+exports.ancestor = ancestor;
+function recursive(visitors) {
+ const vis = explode_1.default(visitors);
+ return (node, state) => {
+ (function recurse(node) {
+ if (!node)
+ return;
+ const visitor = vis[node.type];
+ if (visitor === null || visitor === void 0 ? void 0 : visitor.enter) {
+ for (const v of visitor.enter) {
+ v(node, state, recurse);
+ }
+ }
+ else {
+ for (const key of VISITOR_KEYS[node.type] || []) {
+ const subNode = node[key];
+ if (Array.isArray(subNode)) {
+ for (const subSubNode of subNode) {
+ recurse(subSubNode);
+ }
+ }
+ else {
+ recurse(subNode);
+ }
+ }
+ }
+ })(node);
+ };
+}
+exports.recursive = recursive;
+//# sourceMappingURL=index.js.map
- function fillInTable(table) {
- let h_max = maxHeight(table);
- let w_max = maxWidth(table);
- debug(`Max rows: ${h_max}; Max cols: ${w_max}`);
- for (let y = 0; y < h_max; y++) {
- for (let x = 0; x < w_max; x++) {
- if (!conflictExists(table, x, y)) {
- let opts = { x: x, y: y, colSpan: 1, rowSpan: 1 };
- x++;
- while (x < w_max && !conflictExists(table, x, y)) {
- opts.colSpan++;
- x++;
- }
- let y2 = y + 1;
- while (y2 < h_max && allBlank(table, y2, opts.x, opts.x + opts.colSpan)) {
- opts.rowSpan++;
- y2++;
- }
- let cell = new Cell(opts);
- cell.x = opts.x;
- cell.y = opts.y;
- warn(`Missing cell at ${cell.y}-${cell.x}.`);
- insertCell(cell, table[y]);
- }
- }
- }
- }
+/***/ }),
+
+/***/ 9417:
+/***/ ((module) => {
- function generateCells(rows) {
- return rows.map(function (row) {
- if (!Array.isArray(row)) {
- let key = Object.keys(row)[0];
- row = row[key];
- if (Array.isArray(row)) {
- row = row.slice();
- row.unshift(key);
- } else {
- row = [key, row];
- }
- }
- return row.map(function (cell) {
- return new Cell(cell);
- });
- });
- }
+"use strict";
- function makeTableLayout(rows) {
- let cellRows = generateCells(rows);
- layoutTable(cellRows);
- fillInTable(cellRows);
- addRowSpanCells(cellRows);
- addColSpanCells(cellRows);
- return cellRows;
- }
+module.exports = balanced;
+function balanced(a, b, str) {
+ if (a instanceof RegExp) a = maybeMatch(a, str);
+ if (b instanceof RegExp) b = maybeMatch(b, str);
+
+ var r = range(a, b, str);
- module.exports = {
- makeTableLayout: makeTableLayout,
- layoutTable: layoutTable,
- addRowSpanCells: addRowSpanCells,
- maxWidth: maxWidth,
- fillInTable: fillInTable,
- computeWidths: makeComputeWidths('colSpan', 'desiredWidth', 'x', 1),
- computeHeights: makeComputeWidths('rowSpan', 'desiredHeight', 'y', 1),
+ return r && {
+ start: r[0],
+ end: r[1],
+ pre: str.slice(0, r[0]),
+ body: str.slice(r[0] + a.length, r[1]),
+ post: str.slice(r[1] + b.length)
};
-})();
+}
-function makeComputeWidths(colSpan, desiredWidth, x, forcedMin) {
- return function (vals, table) {
- let result = [];
- let spanners = [];
- let auto = {};
- table.forEach(function (row) {
- row.forEach(function (cell) {
- if ((cell[colSpan] || 1) > 1) {
- spanners.push(cell);
- } else {
- result[cell[x]] = Math.max(result[cell[x]] || 0, cell[desiredWidth] || 0, forcedMin);
- }
- });
- });
+function maybeMatch(reg, str) {
+ var m = str.match(reg);
+ return m ? m[0] : null;
+}
- vals.forEach(function (val, index) {
- if (typeof val === 'number') {
- result[index] = val;
- }
- });
+balanced.range = range;
+function range(a, b, str) {
+ var begs, beg, left, right, result;
+ var ai = str.indexOf(a);
+ var bi = str.indexOf(b, ai + 1);
+ var i = ai;
- //spanners.forEach(function(cell){
- for (let k = spanners.length - 1; k >= 0; k--) {
- let cell = spanners[k];
- let span = cell[colSpan];
- let col = cell[x];
- let existingWidth = result[col];
- let editableCols = typeof vals[col] === 'number' ? 0 : 1;
- if (typeof existingWidth === 'number') {
- for (let i = 1; i < span; i++) {
- existingWidth += 1 + result[col + i];
- if (typeof vals[col + i] !== 'number') {
- editableCols++;
- }
- }
+ if (ai >= 0 && bi > 0) {
+ if(a===b) {
+ return [ai, bi];
+ }
+ begs = [];
+ left = str.length;
+
+ while (i >= 0 && !result) {
+ if (i == ai) {
+ begs.push(i);
+ ai = str.indexOf(a, i + 1);
+ } else if (begs.length == 1) {
+ result = [ begs.pop(), bi ];
} else {
- existingWidth = desiredWidth === 'desiredWidth' ? cell.desiredWidth - 1 : 1;
- if (!auto[col] || auto[col] < existingWidth) {
- auto[col] = existingWidth;
+ beg = begs.pop();
+ if (beg < left) {
+ left = beg;
+ right = bi;
}
- }
- if (cell[desiredWidth] > existingWidth) {
- let i = 0;
- while (editableCols > 0 && cell[desiredWidth] > existingWidth) {
- if (typeof vals[col + i] !== 'number') {
- let dif = Math.round((cell[desiredWidth] - existingWidth) / editableCols);
- existingWidth += dif;
- result[col + i] += dif;
- editableCols--;
- }
- i++;
- }
+ bi = str.indexOf(b, i + 1);
}
+
+ i = ai < bi && ai >= 0 ? ai : bi;
}
- Object.assign(vals, result, auto);
- for (let j = 0; j < vals.length; j++) {
- vals[j] = Math.max(forcedMin, vals[j] || 0);
+ if (begs.length) {
+ result = [ left, right ];
}
- };
+ }
+
+ return result;
}
/***/ }),
-/***/ 16136:
+/***/ 83682:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
-const debug = __nccwpck_require__(65829);
-const utils = __nccwpck_require__(98911);
-const tableLayout = __nccwpck_require__(93875);
+var register = __nccwpck_require__(44670)
+var addHook = __nccwpck_require__(5549)
+var removeHook = __nccwpck_require__(6819)
-class Table extends Array {
- constructor(opts) {
- super();
+// bind with array of arguments: https://stackoverflow.com/a/21792913
+var bind = Function.bind
+var bindable = bind.bind(bind)
- const options = utils.mergeOptions(opts);
- Object.defineProperty(this, 'options', {
- value: options,
- enumerable: options.debug,
- });
+function bindApi (hook, state, name) {
+ var removeHookRef = bindable(removeHook, null).apply(null, name ? [state, name] : [state])
+ hook.api = { remove: removeHookRef }
+ hook.remove = removeHookRef
- if (options.debug) {
- switch (typeof options.debug) {
- case 'boolean':
- debug.setDebugLevel(debug.WARN);
- break;
- case 'number':
- debug.setDebugLevel(options.debug);
- break;
- case 'string':
- debug.setDebugLevel(parseInt(options.debug, 10));
- break;
- default:
- debug.setDebugLevel(debug.WARN);
- debug.warn(`Debug option is expected to be boolean, number, or string. Received a ${typeof options.debug}`);
- }
- Object.defineProperty(this, 'messages', {
- get() {
- return debug.debugMessages();
- },
- });
- }
+ ;['before', 'error', 'after', 'wrap'].forEach(function (kind) {
+ var args = name ? [state, kind, name] : [state, kind]
+ hook[kind] = hook.api[kind] = bindable(addHook, null).apply(null, args)
+ })
+}
+
+function HookSingular () {
+ var singularHookName = 'h'
+ var singularHookState = {
+ registry: {}
}
+ var singularHook = register.bind(null, singularHookState, singularHookName)
+ bindApi(singularHook, singularHookState, singularHookName)
+ return singularHook
+}
- toString() {
- let array = this;
- let headersPresent = this.options.head && this.options.head.length;
- if (headersPresent) {
- array = [this.options.head];
- if (this.length) {
- array.push.apply(array, this);
- }
- } else {
- this.options.style.head = [];
- }
+function HookCollection () {
+ var state = {
+ registry: {}
+ }
+
+ var hook = register.bind(null, state)
+ bindApi(hook, state)
- let cells = tableLayout.makeTableLayout(array);
+ return hook
+}
- cells.forEach(function (row) {
- row.forEach(function (cell) {
- cell.mergeTableOptions(this.options, cells);
- }, this);
- }, this);
+var collectionHookDeprecationMessageDisplayed = false
+function Hook () {
+ if (!collectionHookDeprecationMessageDisplayed) {
+ console.warn('[before-after-hook]: "Hook()" repurposing warning, use "Hook.Collection()". Read more: https://git.io/upgrade-before-after-hook-to-1.4')
+ collectionHookDeprecationMessageDisplayed = true
+ }
+ return HookCollection()
+}
- tableLayout.computeWidths(this.options.colWidths, cells);
- tableLayout.computeHeights(this.options.rowHeights, cells);
+Hook.Singular = HookSingular.bind()
+Hook.Collection = HookCollection.bind()
- cells.forEach(function (row) {
- row.forEach(function (cell) {
- cell.init(this.options);
- }, this);
- }, this);
+module.exports = Hook
+// expose constructors as a named property for TypeScript
+module.exports.Hook = Hook
+module.exports.Singular = Hook.Singular
+module.exports.Collection = Hook.Collection
- let result = [];
- for (let rowIndex = 0; rowIndex < cells.length; rowIndex++) {
- let row = cells[rowIndex];
- let heightOfRow = this.options.rowHeights[rowIndex];
+/***/ }),
- if (rowIndex === 0 || !this.options.style.compact || (rowIndex == 1 && headersPresent)) {
- doDraw(row, 'top', result);
- }
+/***/ 5549:
+/***/ ((module) => {
- for (let lineNum = 0; lineNum < heightOfRow; lineNum++) {
- doDraw(row, lineNum, result);
- }
+module.exports = addHook;
- if (rowIndex + 1 == cells.length) {
- doDraw(row, 'bottom', result);
- }
- }
+function addHook(state, kind, name, hook) {
+ var orig = hook;
+ if (!state.registry[name]) {
+ state.registry[name] = [];
+ }
- return result.join('\n');
+ if (kind === "before") {
+ hook = function (method, options) {
+ return Promise.resolve()
+ .then(orig.bind(null, options))
+ .then(method.bind(null, options));
+ };
}
- get width() {
- let str = this.toString().split('\n');
- return str[0].length;
+ if (kind === "after") {
+ hook = function (method, options) {
+ var result;
+ return Promise.resolve()
+ .then(method.bind(null, options))
+ .then(function (result_) {
+ result = result_;
+ return orig(result, options);
+ })
+ .then(function () {
+ return result;
+ });
+ };
}
-}
-Table.reset = () => debug.reset();
+ if (kind === "error") {
+ hook = function (method, options) {
+ return Promise.resolve()
+ .then(method.bind(null, options))
+ .catch(function (error) {
+ return orig(error, options);
+ });
+ };
+ }
-function doDraw(row, lineNum, result) {
- let line = [];
- row.forEach(function (cell) {
- line.push(cell.draw(lineNum));
+ state.registry[name].push({
+ hook: hook,
+ orig: orig,
});
- let str = line.join('');
- if (str.length) result.push(str);
}
-module.exports = Table;
-
/***/ }),
-/***/ 98911:
-/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
-
-const stringWidth = __nccwpck_require__(42577);
-
-function codeRegex(capture) {
- return capture ? /\u001b\[((?:\d*;){0,5}\d*)m/g : /\u001b\[(?:\d*;){0,5}\d*m/g;
-}
-
-function strlen(str) {
- let code = codeRegex();
- let stripped = ('' + str).replace(code, '');
- let split = stripped.split('\n');
- return split.reduce(function (memo, s) {
- return stringWidth(s) > memo ? stringWidth(s) : memo;
- }, 0);
-}
+/***/ 44670:
+/***/ ((module) => {
-function repeat(str, times) {
- return Array(times + 1).join(str);
-}
+module.exports = register;
-function pad(str, len, pad, dir) {
- let length = strlen(str);
- if (len + 1 >= length) {
- let padlen = len - length;
- switch (dir) {
- case 'right': {
- str = repeat(pad, padlen) + str;
- break;
- }
- case 'center': {
- let right = Math.ceil(padlen / 2);
- let left = padlen - right;
- str = repeat(pad, left) + str + repeat(pad, right);
- break;
- }
- default: {
- str = str + repeat(pad, padlen);
- break;
- }
- }
+function register(state, name, method, options) {
+ if (typeof method !== "function") {
+ throw new Error("method for before hook must be a function");
}
- return str;
-}
-
-let codeCache = {};
-
-function addToCodeCache(name, on, off) {
- on = '\u001b[' + on + 'm';
- off = '\u001b[' + off + 'm';
- codeCache[on] = { set: name, to: true };
- codeCache[off] = { set: name, to: false };
- codeCache[name] = { on: on, off: off };
-}
-
-//https://github.com/Marak/colors.js/blob/master/lib/styles.js
-addToCodeCache('bold', 1, 22);
-addToCodeCache('italics', 3, 23);
-addToCodeCache('underline', 4, 24);
-addToCodeCache('inverse', 7, 27);
-addToCodeCache('strikethrough', 9, 29);
-function updateState(state, controlChars) {
- let controlCode = controlChars[1] ? parseInt(controlChars[1].split(';')[0]) : 0;
- if ((controlCode >= 30 && controlCode <= 39) || (controlCode >= 90 && controlCode <= 97)) {
- state.lastForegroundAdded = controlChars[0];
- return;
- }
- if ((controlCode >= 40 && controlCode <= 49) || (controlCode >= 100 && controlCode <= 107)) {
- state.lastBackgroundAdded = controlChars[0];
- return;
- }
- if (controlCode === 0) {
- for (let i in state) {
- /* istanbul ignore else */
- if (Object.prototype.hasOwnProperty.call(state, i)) {
- delete state[i];
- }
- }
- return;
- }
- let info = codeCache[controlChars[0]];
- if (info) {
- state[info.set] = info.to;
+ if (!options) {
+ options = {};
}
-}
-function readState(line) {
- let code = codeRegex(true);
- let controlChars = code.exec(line);
- let state = {};
- while (controlChars !== null) {
- updateState(state, controlChars);
- controlChars = code.exec(line);
+ if (Array.isArray(name)) {
+ return name.reverse().reduce(function (callback, name) {
+ return register.bind(null, state, name, callback, options);
+ }, method)();
}
- return state;
-}
-function unwindState(state, ret) {
- let lastBackgroundAdded = state.lastBackgroundAdded;
- let lastForegroundAdded = state.lastForegroundAdded;
-
- delete state.lastBackgroundAdded;
- delete state.lastForegroundAdded;
-
- Object.keys(state).forEach(function (key) {
- if (state[key]) {
- ret += codeCache[key].off;
+ return Promise.resolve().then(function () {
+ if (!state.registry[name]) {
+ return method(options);
}
- });
-
- if (lastBackgroundAdded && lastBackgroundAdded != '\u001b[49m') {
- ret += '\u001b[49m';
- }
- if (lastForegroundAdded && lastForegroundAdded != '\u001b[39m') {
- ret += '\u001b[39m';
- }
- return ret;
+ return state.registry[name].reduce(function (method, registered) {
+ return registered.hook.bind(null, method, options);
+ }, method)();
+ });
}
-function rewindState(state, ret) {
- let lastBackgroundAdded = state.lastBackgroundAdded;
- let lastForegroundAdded = state.lastForegroundAdded;
- delete state.lastBackgroundAdded;
- delete state.lastForegroundAdded;
-
- Object.keys(state).forEach(function (key) {
- if (state[key]) {
- ret = codeCache[key].on + ret;
- }
- });
+/***/ }),
- if (lastBackgroundAdded && lastBackgroundAdded != '\u001b[49m') {
- ret = lastBackgroundAdded + ret;
- }
- if (lastForegroundAdded && lastForegroundAdded != '\u001b[39m') {
- ret = lastForegroundAdded + ret;
- }
+/***/ 6819:
+/***/ ((module) => {
- return ret;
-}
+module.exports = removeHook;
-function truncateWidth(str, desiredLength) {
- if (str.length === strlen(str)) {
- return str.substr(0, desiredLength);
+function removeHook(state, name, method) {
+ if (!state.registry[name]) {
+ return;
}
- while (strlen(str) > desiredLength) {
- str = str.slice(0, -1);
+ var index = state.registry[name]
+ .map(function (registered) {
+ return registered.orig;
+ })
+ .indexOf(method);
+
+ if (index === -1) {
+ return;
}
- return str;
+ state.registry[name].splice(index, 1);
}
-function truncateWidthWithAnsi(str, desiredLength) {
- let code = codeRegex(true);
- let split = str.split(codeRegex());
- let splitIndex = 0;
- let retLen = 0;
- let ret = '';
- let myArray;
- let state = {};
- while (retLen < desiredLength) {
- myArray = code.exec(str);
- let toAdd = split[splitIndex];
- splitIndex++;
- if (retLen + strlen(toAdd) > desiredLength) {
- toAdd = truncateWidth(toAdd, desiredLength - retLen);
- }
- ret += toAdd;
- retLen += strlen(toAdd);
+/***/ }),
- if (retLen < desiredLength) {
- if (!myArray) {
- break;
- } // full-width chars may cause a whitespace which cannot be filled
- ret += myArray[0];
- updateState(state, myArray);
- }
- }
+/***/ 66474:
+/***/ ((module, exports, __nccwpck_require__) => {
- return unwindState(state, ret);
-}
+var Chainsaw = __nccwpck_require__(46533);
+var EventEmitter = (__nccwpck_require__(82361).EventEmitter);
+var Buffers = __nccwpck_require__(51590);
+var Vars = __nccwpck_require__(13755);
+var Stream = (__nccwpck_require__(12781).Stream);
-function truncate(str, desiredLength, truncateChar) {
- truncateChar = truncateChar || '…';
- let lengthOfStr = strlen(str);
- if (lengthOfStr <= desiredLength) {
- return str;
- }
- desiredLength -= strlen(truncateChar);
+exports = module.exports = function (bufOrEm, eventName) {
+ if (Buffer.isBuffer(bufOrEm)) {
+ return exports.parse(bufOrEm);
+ }
+
+ var s = exports.stream();
+ if (bufOrEm && bufOrEm.pipe) {
+ bufOrEm.pipe(s);
+ }
+ else if (bufOrEm) {
+ bufOrEm.on(eventName || 'data', function (buf) {
+ s.write(buf);
+ });
+
+ bufOrEm.on('end', function () {
+ s.end();
+ });
+ }
+ return s;
+};
- let ret = truncateWidthWithAnsi(str, desiredLength);
+exports.stream = function (input) {
+ if (input) return exports.apply(null, arguments);
+
+ var pending = null;
+ function getBytes (bytes, cb, skip) {
+ pending = {
+ bytes : bytes,
+ skip : skip,
+ cb : function (buf) {
+ pending = null;
+ cb(buf);
+ },
+ };
+ dispatch();
+ }
+
+ var offset = null;
+ function dispatch () {
+ if (!pending) {
+ if (caughtEnd) done = true;
+ return;
+ }
+ if (typeof pending === 'function') {
+ pending();
+ }
+ else {
+ var bytes = offset + pending.bytes;
+
+ if (buffers.length >= bytes) {
+ var buf;
+ if (offset == null) {
+ buf = buffers.splice(0, bytes);
+ if (!pending.skip) {
+ buf = buf.slice();
+ }
+ }
+ else {
+ if (!pending.skip) {
+ buf = buffers.slice(offset, bytes);
+ }
+ offset = bytes;
+ }
+
+ if (pending.skip) {
+ pending.cb();
+ }
+ else {
+ pending.cb(buf);
+ }
+ }
+ }
+ }
+
+ function builder (saw) {
+ function next () { if (!done) saw.next() }
+
+ var self = words(function (bytes, cb) {
+ return function (name) {
+ getBytes(bytes, function (buf) {
+ vars.set(name, cb(buf));
+ next();
+ });
+ };
+ });
+
+ self.tap = function (cb) {
+ saw.nest(cb, vars.store);
+ };
+
+ self.into = function (key, cb) {
+ if (!vars.get(key)) vars.set(key, {});
+ var parent = vars;
+ vars = Vars(parent.get(key));
+
+ saw.nest(function () {
+ cb.apply(this, arguments);
+ this.tap(function () {
+ vars = parent;
+ });
+ }, vars.store);
+ };
+
+ self.flush = function () {
+ vars.store = {};
+ next();
+ };
+
+ self.loop = function (cb) {
+ var end = false;
+
+ saw.nest(false, function loop () {
+ this.vars = vars.store;
+ cb.call(this, function () {
+ end = true;
+ next();
+ }, vars.store);
+ this.tap(function () {
+ if (end) saw.next()
+ else loop.call(this)
+ }.bind(this));
+ }, vars.store);
+ };
+
+ self.buffer = function (name, bytes) {
+ if (typeof bytes === 'string') {
+ bytes = vars.get(bytes);
+ }
+
+ getBytes(bytes, function (buf) {
+ vars.set(name, buf);
+ next();
+ });
+ };
+
+ self.skip = function (bytes) {
+ if (typeof bytes === 'string') {
+ bytes = vars.get(bytes);
+ }
+
+ getBytes(bytes, function () {
+ next();
+ });
+ };
+
+ self.scan = function find (name, search) {
+ if (typeof search === 'string') {
+ search = new Buffer(search);
+ }
+ else if (!Buffer.isBuffer(search)) {
+ throw new Error('search must be a Buffer or a string');
+ }
+
+ var taken = 0;
+ pending = function () {
+ var pos = buffers.indexOf(search, offset + taken);
+ var i = pos-offset-taken;
+ if (pos !== -1) {
+ pending = null;
+ if (offset != null) {
+ vars.set(
+ name,
+ buffers.slice(offset, offset + taken + i)
+ );
+ offset += taken + i + search.length;
+ }
+ else {
+ vars.set(
+ name,
+ buffers.slice(0, taken + i)
+ );
+ buffers.splice(0, taken + i + search.length);
+ }
+ next();
+ dispatch();
+ } else {
+ i = Math.max(buffers.length - search.length - offset - taken, 0);
+ }
+ taken += i;
+ };
+ dispatch();
+ };
+
+ self.peek = function (cb) {
+ offset = 0;
+ saw.nest(function () {
+ cb.call(this, vars.store);
+ this.tap(function () {
+ offset = null;
+ });
+ });
+ };
+
+ return self;
+ };
+
+ var stream = Chainsaw.light(builder);
+ stream.writable = true;
+
+ var buffers = Buffers();
+
+ stream.write = function (buf) {
+ buffers.push(buf);
+ dispatch();
+ };
+
+ var vars = Vars();
+
+ var done = false, caughtEnd = false;
+ stream.end = function () {
+ caughtEnd = true;
+ };
+
+ stream.pipe = Stream.prototype.pipe;
+ Object.getOwnPropertyNames(EventEmitter.prototype).forEach(function (name) {
+ stream[name] = EventEmitter.prototype[name];
+ });
+
+ return stream;
+};
- return ret + truncateChar;
-}
+exports.parse = function parse (buffer) {
+ var self = words(function (bytes, cb) {
+ return function (name) {
+ if (offset + bytes <= buffer.length) {
+ var buf = buffer.slice(offset, offset + bytes);
+ offset += bytes;
+ vars.set(name, cb(buf));
+ }
+ else {
+ vars.set(name, null);
+ }
+ return self;
+ };
+ });
+
+ var offset = 0;
+ var vars = Vars();
+ self.vars = vars.store;
+
+ self.tap = function (cb) {
+ cb.call(self, vars.store);
+ return self;
+ };
+
+ self.into = function (key, cb) {
+ if (!vars.get(key)) {
+ vars.set(key, {});
+ }
+ var parent = vars;
+ vars = Vars(parent.get(key));
+ cb.call(self, vars.store);
+ vars = parent;
+ return self;
+ };
+
+ self.loop = function (cb) {
+ var end = false;
+ var ender = function () { end = true };
+ while (end === false) {
+ cb.call(self, ender, vars.store);
+ }
+ return self;
+ };
+
+ self.buffer = function (name, size) {
+ if (typeof size === 'string') {
+ size = vars.get(size);
+ }
+ var buf = buffer.slice(offset, Math.min(buffer.length, offset + size));
+ offset += size;
+ vars.set(name, buf);
+
+ return self;
+ };
+
+ self.skip = function (bytes) {
+ if (typeof bytes === 'string') {
+ bytes = vars.get(bytes);
+ }
+ offset += bytes;
+
+ return self;
+ };
+
+ self.scan = function (name, search) {
+ if (typeof search === 'string') {
+ search = new Buffer(search);
+ }
+ else if (!Buffer.isBuffer(search)) {
+ throw new Error('search must be a Buffer or a string');
+ }
+ vars.set(name, null);
+
+ // simple but slow string search
+ for (var i = 0; i + offset <= buffer.length - search.length + 1; i++) {
+ for (
+ var j = 0;
+ j < search.length && buffer[offset+i+j] === search[j];
+ j++
+ );
+ if (j === search.length) break;
+ }
+
+ vars.set(name, buffer.slice(offset, offset + i));
+ offset += i + search.length;
+ return self;
+ };
+
+ self.peek = function (cb) {
+ var was = offset;
+ cb.call(self, vars.store);
+ offset = was;
+ return self;
+ };
+
+ self.flush = function () {
+ vars.store = {};
+ return self;
+ };
+
+ self.eof = function () {
+ return offset >= buffer.length;
+ };
+
+ return self;
+};
-function defaultOptions() {
- return {
- chars: {
- top: '─',
- 'top-mid': '┬',
- 'top-left': '┌',
- 'top-right': '┐',
- bottom: '─',
- 'bottom-mid': '┴',
- 'bottom-left': '└',
- 'bottom-right': '┘',
- left: '│',
- 'left-mid': '├',
- mid: '─',
- 'mid-mid': '┼',
- right: '│',
- 'right-mid': '┤',
- middle: '│',
- },
- truncate: '…',
- colWidths: [],
- rowHeights: [],
- colAligns: [],
- rowAligns: [],
- style: {
- 'padding-left': 1,
- 'padding-right': 1,
- head: ['red'],
- border: ['grey'],
- compact: false,
- },
- head: [],
- };
+// convert byte strings to unsigned little endian numbers
+function decodeLEu (bytes) {
+ var acc = 0;
+ for (var i = 0; i < bytes.length; i++) {
+ acc += Math.pow(256,i) * bytes[i];
+ }
+ return acc;
}
-function mergeOptions(options, defaults) {
- options = options || {};
- defaults = defaults || defaultOptions();
- let ret = Object.assign({}, defaults, options);
- ret.chars = Object.assign({}, defaults.chars, options.chars);
- ret.style = Object.assign({}, defaults.style, options.style);
- return ret;
+// convert byte strings to unsigned big endian numbers
+function decodeBEu (bytes) {
+ var acc = 0;
+ for (var i = 0; i < bytes.length; i++) {
+ acc += Math.pow(256, bytes.length - i - 1) * bytes[i];
+ }
+ return acc;
}
-// Wrap on word boundary
-function wordWrap(maxLength, input) {
- let lines = [];
- let split = input.split(/(\s+)/g);
- let line = [];
- let lineLength = 0;
- let whitespace;
- for (let i = 0; i < split.length; i += 2) {
- let word = split[i];
- let newLength = lineLength + strlen(word);
- if (lineLength > 0 && whitespace) {
- newLength += whitespace.length;
- }
- if (newLength > maxLength) {
- if (lineLength !== 0) {
- lines.push(line.join(''));
- }
- line = [word];
- lineLength = strlen(word);
- } else {
- line.push(whitespace || '', word);
- lineLength = newLength;
+// convert byte strings to signed big endian numbers
+function decodeBEs (bytes) {
+ var val = decodeBEu(bytes);
+ if ((bytes[0] & 0x80) == 0x80) {
+ val -= Math.pow(256, bytes.length);
}
- whitespace = split[i + 1];
- }
- if (lineLength) {
- lines.push(line.join(''));
- }
- return lines;
+ return val;
}
-// Wrap text (ignoring word boundaries)
-function textWrap(maxLength, input) {
- let lines = [];
- let line = '';
- function pushLine(str, ws) {
- if (line.length && ws) line += ws;
- line += str;
- while (line.length > maxLength) {
- lines.push(line.slice(0, maxLength));
- line = line.slice(maxLength);
+// convert byte strings to signed little endian numbers
+function decodeLEs (bytes) {
+ var val = decodeLEu(bytes);
+ if ((bytes[bytes.length - 1] & 0x80) == 0x80) {
+ val -= Math.pow(256, bytes.length);
}
- }
- let split = input.split(/(\s+)/g);
- for (let i = 0; i < split.length; i += 2) {
- pushLine(split[i], i && split[i - 1]);
- }
- if (line.length) lines.push(line);
- return lines;
+ return val;
}
-function multiLineWordWrap(maxLength, input, wrapOnWordBoundary = true) {
- let output = [];
- input = input.split('\n');
- const handler = wrapOnWordBoundary ? wordWrap : textWrap;
- for (let i = 0; i < input.length; i++) {
- output.push.apply(output, handler(maxLength, input[i]));
- }
- return output;
+function words (decode) {
+ var self = {};
+
+ [ 1, 2, 4, 8 ].forEach(function (bytes) {
+ var bits = bytes * 8;
+
+ self['word' + bits + 'le']
+ = self['word' + bits + 'lu']
+ = decode(bytes, decodeLEu);
+
+ self['word' + bits + 'ls']
+ = decode(bytes, decodeLEs);
+
+ self['word' + bits + 'be']
+ = self['word' + bits + 'bu']
+ = decode(bytes, decodeBEu);
+
+ self['word' + bits + 'bs']
+ = decode(bytes, decodeBEs);
+ });
+
+ // word8be(n) == word8le(n) for all n
+ self.word8 = self.word8u = self.word8be;
+ self.word8s = self.word8bs;
+
+ return self;
}
-function colorizeLines(input) {
- let state = {};
- let output = [];
- for (let i = 0; i < input.length; i++) {
- let line = rewindState(state, input[i]);
- state = readState(line);
- let temp = Object.assign({}, state);
- output.push(unwindState(temp, line));
- }
- return output;
-}
-/**
- * Credit: Matheus Sampaio https://github.com/matheussampaio
- */
-function hyperlink(url, text) {
- const OSC = '\u001B]';
- const BEL = '\u0007';
- const SEP = ';';
+/***/ }),
- return [OSC, '8', SEP, SEP, url || text, BEL, text, OSC, '8', SEP, SEP, BEL].join('');
-}
+/***/ 13755:
+/***/ ((module) => {
-module.exports = {
- strlen: strlen,
- repeat: repeat,
- pad: pad,
- truncate: truncate,
- mergeOptions: mergeOptions,
- wordWrap: multiLineWordWrap,
- colorizeLines: colorizeLines,
- hyperlink,
+module.exports = function (store) {
+ function getset (name, value) {
+ var node = vars.store;
+ var keys = name.split('.');
+ keys.slice(0,-1).forEach(function (k) {
+ if (node[k] === undefined) node[k] = {};
+ node = node[k]
+ });
+ var key = keys[keys.length - 1];
+ if (arguments.length == 1) {
+ return node[key];
+ }
+ else {
+ return node[key] = value;
+ }
+ }
+
+ var vars = {
+ get : function (name) {
+ return getset(name);
+ },
+ set : function (name, value) {
+ return getset(name, value);
+ },
+ store : store || {},
+ };
+ return vars;
};
/***/ }),
-/***/ 43595:
-/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
-
-/*
-
-The MIT License (MIT)
-
-Original Library
- - Copyright (c) Marak Squires
-
-Additional functionality
- - Copyright (c) Sindre Sorhus (sindresorhus.com)
-
-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.
+/***/ 21491:
+/***/ ((__unused_webpack_module, exports) => {
-*/
+"use strict";
-var colors = {};
-module['exports'] = colors;
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmxhbWUtcmVzdWx0LmludGVyZmFjZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ibGFtZS1yZXN1bHQuaW50ZXJmYWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIifQ==
-colors.themes = {};
+/***/ }),
-var util = __nccwpck_require__(73837);
-var ansiStyles = colors.styles = __nccwpck_require__(73104);
-var defineProps = Object.defineProperties;
-var newLineRegex = new RegExp(/[\r\n]+/g);
+/***/ 6686:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-colors.supportsColor = (__nccwpck_require__(10662).supportsColor);
+"use strict";
-if (typeof colors.enabled === 'undefined') {
- colors.enabled = colors.supportsColor() !== false;
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.Blamer = void 0;
+const git_1 = __nccwpck_require__(38295);
+class Blamer {
+ async blameByFile(path) {
+ return this.getVCSBlamer()(path);
+ }
+ getVCSBlamer() {
+ return git_1.git;
+ }
}
+exports.Blamer = Blamer;
+//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmxhbWVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2JsYW1lci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFDQSxtQ0FBZ0M7QUFFaEMsTUFBYSxNQUFNO0lBQ1YsS0FBSyxDQUFDLFdBQVcsQ0FBQyxJQUFZO1FBQ25DLE9BQU8sSUFBSSxDQUFDLFlBQVksRUFBRSxDQUFDLElBQUksQ0FBQyxDQUFDO0lBQ25DLENBQUM7SUFFTyxZQUFZO1FBQ2xCLE9BQU8sU0FBRyxDQUFDO0lBQ2IsQ0FBQztDQUNGO0FBUkQsd0JBUUMifQ==
-colors.enable = function() {
- colors.enabled = true;
-};
+/***/ }),
-colors.disable = function() {
- colors.enabled = false;
-};
+/***/ 56781:
+/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
-colors.stripColors = colors.strip = function(str) {
- return ('' + str).replace(/\x1B\[\d+m/g, '');
-};
+"use strict";
-// eslint-disable-next-line no-unused-vars
-var stylize = colors.stylize = function stylize(str, style) {
- if (!colors.enabled) {
- return str+'';
- }
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() { return m[k]; } };
+ }
+ Object.defineProperty(o, k2, desc);
+}) : (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ o[k2] = m[k];
+}));
+var __exportStar = (this && this.__exportStar) || function(m, exports) {
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
+};
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+const blamer_1 = __nccwpck_require__(6686);
+__exportStar(__nccwpck_require__(21491), exports);
+exports["default"] = blamer_1.Blamer;
+//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7OztBQUFBLHFDQUFrQztBQUVsQywyREFBeUM7QUFDekMsa0JBQWUsZUFBTSxDQUFDIn0=
- var styleMap = ansiStyles[style];
+/***/ }),
- // Stylize should work for non-ANSI styles, too
- if(!styleMap && style in colors){
- // Style maps like trap operate as functions on strings;
- // they don't have properties like open or close.
- return colors[style](str);
- }
+/***/ 38295:
+/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
- return styleMap.open + str + styleMap.close;
-};
+"use strict";
-var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
-var escapeStringRegexp = function(str) {
- if (typeof str !== 'string') {
- throw new TypeError('Expected a string');
- }
- return str.replace(matchOperatorsRe, '\\$&');
+var __importDefault = (this && this.__importDefault) || function (mod) {
+ return (mod && mod.__esModule) ? mod : { "default": mod };
};
-
-function build(_styles) {
- var builder = function builder() {
- return applyStyle.apply(builder, arguments);
- };
- builder._styles = _styles;
- // __proto__ is used because we must return a function, but there is
- // no way to create a function with a different prototype.
- builder.__proto__ = proto;
- return builder;
-}
-
-var styles = (function() {
- var ret = {};
- ansiStyles.grey = ansiStyles.gray;
- Object.keys(ansiStyles).forEach(function(key) {
- ansiStyles[key].closeRe =
- new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g');
- ret[key] = {
- get: function() {
- return build(this._styles.concat(key));
- },
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.git = void 0;
+const execa_1 = __importDefault(__nccwpck_require__(20920));
+const which_1 = __importDefault(__nccwpck_require__(34207));
+const fs_1 = __nccwpck_require__(57147);
+const convertStringToObject = (sourceLine) => {
+ const matches = sourceLine.match(/(.+)\s+\((.+)\s+(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} (\+|\-)\d{4})\s+(\d+)\)(.*)/);
+ const [, rev, author, date, , line] = matches
+ ? [...matches]
+ : [null, '', '', '', '', ''];
+ return {
+ author,
+ date,
+ line,
+ rev
};
- });
- return ret;
-})();
-
-var proto = defineProps(function colors() {}, styles);
-
-function applyStyle() {
- var args = Array.prototype.slice.call(arguments);
-
- var str = args.map(function(arg) {
- // Use weak equality check so we can colorize null/undefined in safe mode
- if (arg != null && arg.constructor === String) {
- return arg;
- } else {
- return util.inspect(arg);
- }
- }).join(' ');
-
- if (!colors.enabled || !str) {
- return str;
- }
-
- var newLinesPresent = str.indexOf('\n') != -1;
-
- var nestedStyles = this._styles;
-
- var i = nestedStyles.length;
- while (i--) {
- var code = ansiStyles[nestedStyles[i]];
- str = code.open + str.replace(code.closeRe, code.open) + code.close;
- if (newLinesPresent) {
- str = str.replace(newLineRegex, function(match) {
- return code.close + match + code.open;
- });
+};
+async function git(path) {
+ const blamedLines = {};
+ const pathToGit = await (0, which_1.default)('git');
+ if (!(0, fs_1.existsSync)(path)) {
+ throw new Error(`File ${path} does not exist`);
}
- }
-
- return str;
-}
-
-colors.setTheme = function(theme) {
- if (typeof theme === 'string') {
- console.log('colors.setTheme now only accepts an object, not a string. ' +
- 'If you are trying to set a theme from a file, it is now your (the ' +
- 'caller\'s) responsibility to require the file. The old syntax ' +
- 'looked like colors.setTheme(__dirname + ' +
- '\'/../themes/generic-logging.js\'); The new syntax looks like '+
- 'colors.setTheme(require(__dirname + ' +
- '\'/../themes/generic-logging.js\'));');
- return;
- }
- for (var style in theme) {
- (function(style) {
- colors[style] = function(str) {
- if (typeof theme[style] === 'object') {
- var out = str;
- for (var i in theme[style]) {
- out = colors[theme[style][i]](out);
- }
- return out;
+ const result = execa_1.default.sync(pathToGit, ['blame', '-w', path]);
+ result.stdout.split('\n').forEach(line => {
+ if (line !== '') {
+ const blamedLine = convertStringToObject(line);
+ if (blamedLine.line) {
+ blamedLines[blamedLine.line] = blamedLine;
+ }
}
- return colors[theme[style]](str);
- };
- })(style);
- }
-};
-
-function init() {
- var ret = {};
- Object.keys(styles).forEach(function(name) {
- ret[name] = {
- get: function() {
- return build([name]);
- },
+ });
+ return {
+ [path]: blamedLines
};
- });
- return ret;
}
+exports.git = git;
+//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2l0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3Zjcy9naXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUEsa0RBQTBCO0FBQzFCLGtEQUEwQjtBQUUxQiwyQkFBZ0M7QUFFaEMsTUFBTSxxQkFBcUIsR0FBRyxDQUFDLFVBQWtCLEVBQWMsRUFBRTtJQUMvRCxNQUFNLE9BQU8sR0FBRyxVQUFVLENBQUMsS0FBSyxDQUM5QixrRkFBa0YsQ0FDbkYsQ0FBQztJQUNGLE1BQU0sQ0FBQyxFQUFFLEdBQUcsRUFBRSxNQUFNLEVBQUUsSUFBSSxFQUFFLEFBQUQsRUFBRyxJQUFJLENBQUMsR0FBRyxPQUFPO1FBQzNDLENBQUMsQ0FBQyxDQUFDLEdBQUcsT0FBTyxDQUFDO1FBQ2QsQ0FBQyxDQUFDLENBQUMsSUFBSSxFQUFFLEVBQUUsRUFBRSxFQUFFLEVBQUUsRUFBRSxFQUFFLEVBQUUsRUFBRSxFQUFFLENBQUMsQ0FBQztJQUMvQixPQUFPO1FBQ0wsTUFBTTtRQUNOLElBQUk7UUFDSixJQUFJO1FBQ0osR0FBRztLQUNKLENBQUM7QUFDSixDQUFDLENBQUM7QUFFSyxLQUFLLFVBQVUsR0FBRyxDQUFDLElBQVk7SUFDcEMsTUFBTSxXQUFXLEdBQW1DLEVBQUUsQ0FBQztJQUN2RCxNQUFNLFNBQVMsR0FBVyxNQUFNLElBQUEsZUFBSyxFQUFDLEtBQUssQ0FBQyxDQUFDO0lBRTdDLElBQUksQ0FBQyxJQUFBLGVBQVUsRUFBQyxJQUFJLENBQUMsRUFBRTtRQUNyQixNQUFNLElBQUksS0FBSyxDQUFDLFFBQVEsSUFBSSxpQkFBaUIsQ0FBQyxDQUFDO0tBQ2hEO0lBRUQsTUFBTSxNQUFNLEdBQUcsZUFBSyxDQUFDLElBQUksQ0FBQyxTQUFTLEVBQUUsQ0FBQyxPQUFPLEVBQUUsSUFBSSxFQUFFLElBQUksQ0FBQyxDQUFDLENBQUM7SUFDNUQsTUFBTSxDQUFDLE1BQU0sQ0FBQyxLQUFLLENBQUMsSUFBSSxDQUFDLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxFQUFFO1FBQ3ZDLElBQUksSUFBSSxLQUFLLEVBQUUsRUFBRTtZQUNmLE1BQU0sVUFBVSxHQUFHLHFCQUFxQixDQUFDLElBQUksQ0FBQyxDQUFDO1lBQy9DLElBQUksVUFBVSxDQUFDLElBQUksRUFBRTtnQkFDbkIsV0FBVyxDQUFDLFVBQVUsQ0FBQyxJQUFJLENBQUMsR0FBRyxVQUFVLENBQUM7YUFDM0M7U0FDRjtJQUNILENBQUMsQ0FBQyxDQUFDO0lBQ0gsT0FBTztRQUNMLENBQUMsSUFBSSxDQUFDLEVBQUUsV0FBVztLQUNwQixDQUFDO0FBQ0osQ0FBQztBQXBCRCxrQkFvQkMifQ==
-var sequencer = function sequencer(map, str) {
- var exploded = str.split('');
- exploded = exploded.map(map);
- return exploded.join('');
-};
-
-// custom formatter methods
-colors.trap = __nccwpck_require__(31302);
-colors.zalgo = __nccwpck_require__(97743);
+/***/ }),
-// maps
-colors.maps = {};
-colors.maps.america = __nccwpck_require__(76936)(colors);
-colors.maps.zebra = __nccwpck_require__(12989)(colors);
-colors.maps.rainbow = __nccwpck_require__(75210)(colors);
-colors.maps.random = __nccwpck_require__(13441)(colors);
+/***/ 20920:
+/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
-for (var map in colors.maps) {
- (function(map) {
- colors[map] = function(str) {
- return sequencer(colors.maps[map], str);
- };
- })(map);
-}
+"use strict";
-defineProps(colors, init());
+const path = __nccwpck_require__(71017);
+const childProcess = __nccwpck_require__(32081);
+const crossSpawn = __nccwpck_require__(72746);
+const stripFinalNewline = __nccwpck_require__(88174);
+const npmRunPath = __nccwpck_require__(20502);
+const onetime = __nccwpck_require__(89082);
+const makeError = __nccwpck_require__(11325);
+const normalizeStdio = __nccwpck_require__(54149);
+const {spawnedKill, spawnedCancel, setupTimeout, setExitHandler} = __nccwpck_require__(77321);
+const {handleInput, getSpawnedResult, makeAllStream, validateInputSync} = __nccwpck_require__(2658);
+const {mergePromise, getSpawnedPromise} = __nccwpck_require__(51935);
+const {joinCommand, parseCommand} = __nccwpck_require__(1099);
+const DEFAULT_MAX_BUFFER = 1000 * 1000 * 100;
-/***/ }),
+const getEnv = ({env: envOption, extendEnv, preferLocal, localDir, execPath}) => {
+ const env = extendEnv ? {...process.env, ...envOption} : envOption;
-/***/ 31302:
-/***/ ((module) => {
+ if (preferLocal) {
+ return npmRunPath.env({env, cwd: localDir, execPath});
+ }
-module['exports'] = function runTheTrap(text, options) {
- var result = '';
- text = text || 'Run the trap, drop the bass';
- text = text.split('');
- var trap = {
- a: ['\u0040', '\u0104', '\u023a', '\u0245', '\u0394', '\u039b', '\u0414'],
- b: ['\u00df', '\u0181', '\u0243', '\u026e', '\u03b2', '\u0e3f'],
- c: ['\u00a9', '\u023b', '\u03fe'],
- d: ['\u00d0', '\u018a', '\u0500', '\u0501', '\u0502', '\u0503'],
- e: ['\u00cb', '\u0115', '\u018e', '\u0258', '\u03a3', '\u03be', '\u04bc',
- '\u0a6c'],
- f: ['\u04fa'],
- g: ['\u0262'],
- h: ['\u0126', '\u0195', '\u04a2', '\u04ba', '\u04c7', '\u050a'],
- i: ['\u0f0f'],
- j: ['\u0134'],
- k: ['\u0138', '\u04a0', '\u04c3', '\u051e'],
- l: ['\u0139'],
- m: ['\u028d', '\u04cd', '\u04ce', '\u0520', '\u0521', '\u0d69'],
- n: ['\u00d1', '\u014b', '\u019d', '\u0376', '\u03a0', '\u048a'],
- o: ['\u00d8', '\u00f5', '\u00f8', '\u01fe', '\u0298', '\u047a', '\u05dd',
- '\u06dd', '\u0e4f'],
- p: ['\u01f7', '\u048e'],
- q: ['\u09cd'],
- r: ['\u00ae', '\u01a6', '\u0210', '\u024c', '\u0280', '\u042f'],
- s: ['\u00a7', '\u03de', '\u03df', '\u03e8'],
- t: ['\u0141', '\u0166', '\u0373'],
- u: ['\u01b1', '\u054d'],
- v: ['\u05d8'],
- w: ['\u0428', '\u0460', '\u047c', '\u0d70'],
- x: ['\u04b2', '\u04fe', '\u04fc', '\u04fd'],
- y: ['\u00a5', '\u04b0', '\u04cb'],
- z: ['\u01b5', '\u0240'],
- };
- text.forEach(function(c) {
- c = c.toLowerCase();
- var chars = trap[c] || [' '];
- var rand = Math.floor(Math.random() * chars.length);
- if (typeof trap[c] !== 'undefined') {
- result += trap[c][rand];
- } else {
- result += c;
- }
- });
- return result;
+ return env;
};
+const handleArguments = (file, args, options = {}) => {
+ const parsed = crossSpawn._parse(file, args, options);
+ file = parsed.command;
+ args = parsed.args;
+ options = parsed.options;
-/***/ }),
-
-/***/ 97743:
-/***/ ((module) => {
-
-// please no
-module['exports'] = function zalgo(text, options) {
- text = text || ' he is here ';
- var soul = {
- 'up': [
- '̍', '̎', '̄', '̅',
- '̿', '̑', '̆', '̐',
- '͒', '͗', '͑', '̇',
- '̈', '̊', '͂', '̓',
- '̈', '͊', '͋', '͌',
- '̃', '̂', '̌', '͐',
- '̀', '́', '̋', '̏',
- '̒', '̓', '̔', '̽',
- '̉', 'ͣ', 'ͤ', 'ͥ',
- 'ͦ', 'ͧ', 'ͨ', 'ͩ',
- 'ͪ', 'ͫ', 'ͬ', 'ͭ',
- 'ͮ', 'ͯ', '̾', '͛',
- '͆', '̚',
- ],
- 'down': [
- '̖', '̗', '̘', '̙',
- '̜', '̝', '̞', '̟',
- '̠', '̤', '̥', '̦',
- '̩', '̪', '̫', '̬',
- '̭', '̮', '̯', '̰',
- '̱', '̲', '̳', '̹',
- '̺', '̻', '̼', 'ͅ',
- '͇', '͈', '͉', '͍',
- '͎', '͓', '͔', '͕',
- '͖', '͙', '͚', '̣',
- ],
- 'mid': [
- '̕', '̛', '̀', '́',
- '͘', '̡', '̢', '̧',
- '̨', '̴', '̵', '̶',
- '͜', '͝', '͞',
- '͟', '͠', '͢', '̸',
- '̷', '͡', ' ҉',
- ],
- };
- var all = [].concat(soul.up, soul.down, soul.mid);
-
- function randomNumber(range) {
- var r = Math.floor(Math.random() * range);
- return r;
- }
+ options = {
+ maxBuffer: DEFAULT_MAX_BUFFER,
+ buffer: true,
+ stripFinalNewline: true,
+ extendEnv: true,
+ preferLocal: false,
+ localDir: options.cwd || process.cwd(),
+ execPath: process.execPath,
+ encoding: 'utf8',
+ reject: true,
+ cleanup: true,
+ all: false,
+ windowsHide: true,
+ ...options
+ };
- function isChar(character) {
- var bool = false;
- all.filter(function(i) {
- bool = (i === character);
- });
- return bool;
- }
+ options.env = getEnv(options);
+ options.stdio = normalizeStdio(options);
- function heComes(text, options) {
- var result = '';
- var counts;
- var l;
- options = options || {};
- options['up'] =
- typeof options['up'] !== 'undefined' ? options['up'] : true;
- options['mid'] =
- typeof options['mid'] !== 'undefined' ? options['mid'] : true;
- options['down'] =
- typeof options['down'] !== 'undefined' ? options['down'] : true;
- options['size'] =
- typeof options['size'] !== 'undefined' ? options['size'] : 'maxi';
- text = text.split('');
- for (l in text) {
- if (isChar(l)) {
- continue;
- }
- result = result + text[l];
- counts = {'up': 0, 'down': 0, 'mid': 0};
- switch (options.size) {
- case 'mini':
- counts.up = randomNumber(8);
- counts.mid = randomNumber(2);
- counts.down = randomNumber(8);
- break;
- case 'maxi':
- counts.up = randomNumber(16) + 3;
- counts.mid = randomNumber(4) + 1;
- counts.down = randomNumber(64) + 3;
- break;
- default:
- counts.up = randomNumber(8) + 1;
- counts.mid = randomNumber(6) / 2;
- counts.down = randomNumber(8) + 1;
- break;
- }
+ if (process.platform === 'win32' && path.basename(file, '.exe') === 'cmd') {
+ // #116
+ args.unshift('/q');
+ }
- var arr = ['up', 'mid', 'down'];
- for (var d in arr) {
- var index = arr[d];
- for (var i = 0; i <= counts[index]; i++) {
- if (options[index]) {
- result = result + soul[index][randomNumber(soul[index].length)];
- }
- }
- }
- }
- return result;
- }
- // don't summon him
- return heComes(text, options);
+ return {file, args, options, parsed};
};
+const handleOutput = (options, value, error) => {
+ if (typeof value !== 'string' && !Buffer.isBuffer(value)) {
+ // When `execa.sync()` errors, we normalize it to '' to mimic `execa()`
+ return error === undefined ? undefined : '';
+ }
+ if (options.stripFinalNewline) {
+ return stripFinalNewline(value);
+ }
-/***/ }),
-
-/***/ 76936:
-/***/ ((module) => {
-
-module['exports'] = function(colors) {
- return function(letter, i, exploded) {
- if (letter === ' ') return letter;
- switch (i%3) {
- case 0: return colors.red(letter);
- case 1: return colors.white(letter);
- case 2: return colors.blue(letter);
- }
- };
+ return value;
};
+const execa = (file, args, options) => {
+ const parsed = handleArguments(file, args, options);
+ const command = joinCommand(file, args);
-/***/ }),
-
-/***/ 75210:
-/***/ ((module) => {
-
-module['exports'] = function(colors) {
- // RoY G BiV
- var rainbowColors = ['red', 'yellow', 'green', 'blue', 'magenta'];
- return function(letter, i, exploded) {
- if (letter === ' ') {
- return letter;
- } else {
- return colors[rainbowColors[i++ % rainbowColors.length]](letter);
- }
- };
-};
+ let spawned;
+ try {
+ spawned = childProcess.spawn(parsed.file, parsed.args, parsed.options);
+ } catch (error) {
+ // Ensure the returned error is always both a promise and a child process
+ const dummySpawned = new childProcess.ChildProcess();
+ const errorPromise = Promise.reject(makeError({
+ error,
+ stdout: '',
+ stderr: '',
+ all: '',
+ command,
+ parsed,
+ timedOut: false,
+ isCanceled: false,
+ killed: false
+ }));
+ return mergePromise(dummySpawned, errorPromise);
+ }
+ const spawnedPromise = getSpawnedPromise(spawned);
+ const timedPromise = setupTimeout(spawned, parsed.options, spawnedPromise);
+ const processDone = setExitHandler(spawned, parsed.options, timedPromise);
+ const context = {isCanceled: false};
-/***/ }),
+ spawned.kill = spawnedKill.bind(null, spawned.kill.bind(spawned));
+ spawned.cancel = spawnedCancel.bind(null, spawned, context);
-/***/ 13441:
-/***/ ((module) => {
+ const handlePromise = async () => {
+ const [{error, exitCode, signal, timedOut}, stdoutResult, stderrResult, allResult] = await getSpawnedResult(spawned, parsed.options, processDone);
+ const stdout = handleOutput(parsed.options, stdoutResult);
+ const stderr = handleOutput(parsed.options, stderrResult);
+ const all = handleOutput(parsed.options, allResult);
-module['exports'] = function(colors) {
- var available = ['underline', 'inverse', 'grey', 'yellow', 'red', 'green',
- 'blue', 'white', 'cyan', 'magenta', 'brightYellow', 'brightRed',
- 'brightGreen', 'brightBlue', 'brightWhite', 'brightCyan', 'brightMagenta'];
- return function(letter, i, exploded) {
- return letter === ' ' ? letter :
- colors[
- available[Math.round(Math.random() * (available.length - 2))]
- ](letter);
- };
-};
+ if (error || exitCode !== 0 || signal !== null) {
+ const returnedError = makeError({
+ error,
+ exitCode,
+ signal,
+ stdout,
+ stderr,
+ all,
+ command,
+ parsed,
+ timedOut,
+ isCanceled: context.isCanceled,
+ killed: spawned.killed
+ });
+ if (!parsed.options.reject) {
+ return returnedError;
+ }
-/***/ }),
+ throw returnedError;
+ }
-/***/ 12989:
-/***/ ((module) => {
+ return {
+ command,
+ exitCode: 0,
+ stdout,
+ stderr,
+ all,
+ failed: false,
+ timedOut: false,
+ isCanceled: false,
+ killed: false
+ };
+ };
-module['exports'] = function(colors) {
- return function(letter, i, exploded) {
- return i % 2 === 0 ? letter : colors.inverse(letter);
- };
-};
+ const handlePromiseOnce = onetime(handlePromise);
+ crossSpawn._enoent.hookChildProcess(spawned, parsed.parsed);
-/***/ }),
+ handleInput(spawned, parsed.options.input);
-/***/ 73104:
-/***/ ((module) => {
+ spawned.all = makeAllStream(spawned, parsed.options);
-/*
-The MIT License (MIT)
+ return mergePromise(spawned, handlePromiseOnce);
+};
-Copyright (c) Sindre Sorhus (sindresorhus.com)
+module.exports = execa;
-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:
+module.exports.sync = (file, args, options) => {
+ const parsed = handleArguments(file, args, options);
+ const command = joinCommand(file, args);
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
+ validateInputSync(parsed.options);
-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.
+ let result;
+ try {
+ result = childProcess.spawnSync(parsed.file, parsed.args, parsed.options);
+ } catch (error) {
+ throw makeError({
+ error,
+ stdout: '',
+ stderr: '',
+ all: '',
+ command,
+ parsed,
+ timedOut: false,
+ isCanceled: false,
+ killed: false
+ });
+ }
-*/
+ const stdout = handleOutput(parsed.options, result.stdout, result.error);
+ const stderr = handleOutput(parsed.options, result.stderr, result.error);
-var styles = {};
-module['exports'] = styles;
-
-var codes = {
- reset: [0, 0],
-
- bold: [1, 22],
- dim: [2, 22],
- italic: [3, 23],
- underline: [4, 24],
- inverse: [7, 27],
- hidden: [8, 28],
- strikethrough: [9, 29],
-
- black: [30, 39],
- red: [31, 39],
- green: [32, 39],
- yellow: [33, 39],
- blue: [34, 39],
- magenta: [35, 39],
- cyan: [36, 39],
- white: [37, 39],
- gray: [90, 39],
- grey: [90, 39],
-
- brightRed: [91, 39],
- brightGreen: [92, 39],
- brightYellow: [93, 39],
- brightBlue: [94, 39],
- brightMagenta: [95, 39],
- brightCyan: [96, 39],
- brightWhite: [97, 39],
-
- bgBlack: [40, 49],
- bgRed: [41, 49],
- bgGreen: [42, 49],
- bgYellow: [43, 49],
- bgBlue: [44, 49],
- bgMagenta: [45, 49],
- bgCyan: [46, 49],
- bgWhite: [47, 49],
- bgGray: [100, 49],
- bgGrey: [100, 49],
-
- bgBrightRed: [101, 49],
- bgBrightGreen: [102, 49],
- bgBrightYellow: [103, 49],
- bgBrightBlue: [104, 49],
- bgBrightMagenta: [105, 49],
- bgBrightCyan: [106, 49],
- bgBrightWhite: [107, 49],
-
- // legacy styles for colors pre v1.0.0
- blackBG: [40, 49],
- redBG: [41, 49],
- greenBG: [42, 49],
- yellowBG: [43, 49],
- blueBG: [44, 49],
- magentaBG: [45, 49],
- cyanBG: [46, 49],
- whiteBG: [47, 49],
-
-};
-
-Object.keys(codes).forEach(function(key) {
- var val = codes[key];
- var style = styles[key] = [];
- style.open = '\u001b[' + val[0] + 'm';
- style.close = '\u001b[' + val[1] + 'm';
-});
+ if (result.error || result.status !== 0 || result.signal !== null) {
+ const error = makeError({
+ stdout,
+ stderr,
+ error: result.error,
+ signal: result.signal,
+ exitCode: result.status,
+ command,
+ parsed,
+ timedOut: result.error && result.error.code === 'ETIMEDOUT',
+ isCanceled: false,
+ killed: result.signal !== null
+ });
+ if (!parsed.options.reject) {
+ return error;
+ }
-/***/ }),
+ throw error;
+ }
-/***/ 10223:
-/***/ ((module) => {
+ return {
+ command,
+ exitCode: 0,
+ stdout,
+ stderr,
+ failed: false,
+ timedOut: false,
+ isCanceled: false,
+ killed: false
+ };
+};
-"use strict";
-/*
-MIT License
-
-Copyright (c) Sindre Sorhus (sindresorhus.com)
-
-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.
-*/
+module.exports.command = (command, options) => {
+ const [file, ...args] = parseCommand(command);
+ return execa(file, args, options);
+};
+module.exports.commandSync = (command, options) => {
+ const [file, ...args] = parseCommand(command);
+ return execa.sync(file, args, options);
+};
+module.exports.node = (scriptPath, args, options = {}) => {
+ if (args && !Array.isArray(args) && typeof args === 'object') {
+ options = args;
+ args = [];
+ }
-module.exports = function(flag, argv) {
- argv = argv || process.argv;
+ const stdio = normalizeStdio.node(options);
+ const defaultExecArgv = process.execArgv.filter(arg => !arg.startsWith('--inspect'));
- var terminatorPos = argv.indexOf('--');
- var prefix = /^-{1,2}/.test(flag) ? '' : '--';
- var pos = argv.indexOf(prefix + flag);
+ const {
+ nodePath = process.execPath,
+ nodeOptions = defaultExecArgv
+ } = options;
- return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
+ return execa(
+ nodePath,
+ [
+ ...nodeOptions,
+ scriptPath,
+ ...(Array.isArray(args) ? args : [])
+ ],
+ {
+ ...options,
+ stdin: undefined,
+ stdout: undefined,
+ stderr: undefined,
+ stdio,
+ shell: false
+ }
+ );
};
/***/ }),
-/***/ 10662:
-/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
+/***/ 1099:
+/***/ ((module) => {
"use strict";
-/*
-The MIT License (MIT)
-
-Copyright (c) Sindre Sorhus (sindresorhus.com)
-
-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.
-
-*/
+const SPACES_REGEXP = / +/g;
+const joinCommand = (file, args = []) => {
+ if (!Array.isArray(args)) {
+ return file;
+ }
-var os = __nccwpck_require__(22037);
-var hasFlag = __nccwpck_require__(10223);
+ return [file, ...args].join(' ');
+};
-var env = process.env;
+// Handle `execa.command()`
+const parseCommand = command => {
+ const tokens = [];
+ for (const token of command.trim().split(SPACES_REGEXP)) {
+ // Allow spaces to be escaped by a backslash if not meant as a delimiter
+ const previousToken = tokens[tokens.length - 1];
+ if (previousToken && previousToken.endsWith('\\')) {
+ // Merge previous token with current one
+ tokens[tokens.length - 1] = `${previousToken.slice(0, -1)} ${token}`;
+ } else {
+ tokens.push(token);
+ }
+ }
-var forceColor = void 0;
-if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false')) {
- forceColor = false;
-} else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true')
- || hasFlag('color=always')) {
- forceColor = true;
-}
-if ('FORCE_COLOR' in env) {
- forceColor = env.FORCE_COLOR.length === 0
- || parseInt(env.FORCE_COLOR, 10) !== 0;
-}
+ return tokens;
+};
-function translateLevel(level) {
- if (level === 0) {
- return false;
- }
+module.exports = {
+ joinCommand,
+ parseCommand
+};
- return {
- level: level,
- hasBasic: true,
- has256: level >= 2,
- has16m: level >= 3,
- };
-}
-function supportsColor(stream) {
- if (forceColor === false) {
- return 0;
- }
+/***/ }),
- if (hasFlag('color=16m') || hasFlag('color=full')
- || hasFlag('color=truecolor')) {
- return 3;
- }
+/***/ 11325:
+/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
- if (hasFlag('color=256')) {
- return 2;
- }
+"use strict";
- if (stream && !stream.isTTY && forceColor !== true) {
- return 0;
- }
+const {signalsByName} = __nccwpck_require__(27605);
- var min = forceColor ? 1 : 0;
+const getErrorPrefix = ({timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled}) => {
+ if (timedOut) {
+ return `timed out after ${timeout} milliseconds`;
+ }
- if (process.platform === 'win32') {
- // Node.js 7.5.0 is the first version of Node.js to include a patch to
- // libuv that enables 256 color output on Windows. Anything earlier and it
- // won't work. However, here we target Node.js 8 at minimum as it is an LTS
- // release, and Node.js 7 is not. Windows 10 build 10586 is the first
- // Windows release that supports 256 colors. Windows 10 build 14931 is the
- // first release that supports 16m/TrueColor.
- var osRelease = os.release().split('.');
- if (Number(process.versions.node.split('.')[0]) >= 8
- && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
- return Number(osRelease[2]) >= 14931 ? 3 : 2;
- }
+ if (isCanceled) {
+ return 'was canceled';
+ }
- return 1;
- }
+ if (errorCode !== undefined) {
+ return `failed with ${errorCode}`;
+ }
- if ('CI' in env) {
- if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(function(sign) {
- return sign in env;
- }) || env.CI_NAME === 'codeship') {
- return 1;
- }
+ if (signal !== undefined) {
+ return `was killed with ${signal} (${signalDescription})`;
+ }
- return min;
- }
+ if (exitCode !== undefined) {
+ return `failed with exit code ${exitCode}`;
+ }
- if ('TEAMCITY_VERSION' in env) {
- return (/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0
- );
- }
+ return 'failed';
+};
- if ('TERM_PROGRAM' in env) {
- var version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
+const makeError = ({
+ stdout,
+ stderr,
+ all,
+ error,
+ signal,
+ exitCode,
+ command,
+ timedOut,
+ isCanceled,
+ killed,
+ parsed: {options: {timeout}}
+}) => {
+ // `signal` and `exitCode` emitted on `spawned.on('exit')` event can be `null`.
+ // We normalize them to `undefined`
+ exitCode = exitCode === null ? undefined : exitCode;
+ signal = signal === null ? undefined : signal;
+ const signalDescription = signal === undefined ? undefined : signalsByName[signal].description;
- switch (env.TERM_PROGRAM) {
- case 'iTerm.app':
- return version >= 3 ? 3 : 2;
- case 'Hyper':
- return 3;
- case 'Apple_Terminal':
- return 2;
- // No default
- }
- }
+ const errorCode = error && error.code;
- if (/-256(color)?$/i.test(env.TERM)) {
- return 2;
- }
+ const prefix = getErrorPrefix({timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled});
+ const execaMessage = `Command ${prefix}: ${command}`;
+ const isError = Object.prototype.toString.call(error) === '[object Error]';
+ const shortMessage = isError ? `${execaMessage}\n${error.message}` : execaMessage;
+ const message = [shortMessage, stderr, stdout].filter(Boolean).join('\n');
- if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
- return 1;
- }
+ if (isError) {
+ error.originalMessage = error.message;
+ error.message = message;
+ } else {
+ error = new Error(message);
+ }
- if ('COLORTERM' in env) {
- return 1;
- }
+ error.shortMessage = shortMessage;
+ error.command = command;
+ error.exitCode = exitCode;
+ error.signal = signal;
+ error.signalDescription = signalDescription;
+ error.stdout = stdout;
+ error.stderr = stderr;
- if (env.TERM === 'dumb') {
- return min;
- }
+ if (all !== undefined) {
+ error.all = all;
+ }
- return min;
-}
+ if ('bufferedData' in error) {
+ delete error.bufferedData;
+ }
-function getSupportLevel(stream) {
- var level = supportsColor(stream);
- return translateLevel(level);
-}
+ error.failed = true;
+ error.timedOut = Boolean(timedOut);
+ error.isCanceled = isCanceled;
+ error.killed = killed && !timedOut;
-module.exports = {
- supportsColor: getSupportLevel,
- stdout: getSupportLevel(process.stdout),
- stderr: getSupportLevel(process.stderr),
+ return error;
};
+module.exports = makeError;
+
/***/ }),
-/***/ 41997:
+/***/ 77321:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
-//
-// Remark: Requiring this file will use the "safe" colors API,
-// which will not touch String.prototype.
-//
-// var colors = require('colors/safe');
-// colors.red("foo")
-//
-//
-var colors = __nccwpck_require__(43595);
-module['exports'] = colors;
-
+"use strict";
-/***/ }),
+const os = __nccwpck_require__(22037);
+const onExit = __nccwpck_require__(24931);
-/***/ 92240:
-/***/ ((module) => {
+const DEFAULT_FORCE_KILL_TIMEOUT = 1000 * 5;
-/**
- * node-compress-commons
- *
- * Copyright (c) 2014 Chris Talkington, contributors.
- * Licensed under the MIT license.
- * https://github.com/archiverjs/node-compress-commons/blob/master/LICENSE-MIT
- */
-var ArchiveEntry = module.exports = function() {};
+// Monkey-patches `childProcess.kill()` to add `forceKillAfterTimeout` behavior
+const spawnedKill = (kill, signal = 'SIGTERM', options = {}) => {
+ const killResult = kill(signal);
+ setKillTimeout(kill, signal, options, killResult);
+ return killResult;
+};
-ArchiveEntry.prototype.getName = function() {};
+const setKillTimeout = (kill, signal, options, killResult) => {
+ if (!shouldForceKill(signal, options, killResult)) {
+ return;
+ }
-ArchiveEntry.prototype.getSize = function() {};
+ const timeout = getForceKillAfterTimeout(options);
+ const t = setTimeout(() => {
+ kill('SIGKILL');
+ }, timeout);
-ArchiveEntry.prototype.getLastModifiedDate = function() {};
+ // Guarded because there's no `.unref()` when `execa` is used in the renderer
+ // process in Electron. This cannot be tested since we don't run tests in
+ // Electron.
+ // istanbul ignore else
+ if (t.unref) {
+ t.unref();
+ }
+};
-ArchiveEntry.prototype.isDirectory = function() {};
+const shouldForceKill = (signal, {forceKillAfterTimeout}, killResult) => {
+ return isSigterm(signal) && forceKillAfterTimeout !== false && killResult;
+};
-/***/ }),
+const isSigterm = signal => {
+ return signal === os.constants.signals.SIGTERM ||
+ (typeof signal === 'string' && signal.toUpperCase() === 'SIGTERM');
+};
-/***/ 36728:
-/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
+const getForceKillAfterTimeout = ({forceKillAfterTimeout = true}) => {
+ if (forceKillAfterTimeout === true) {
+ return DEFAULT_FORCE_KILL_TIMEOUT;
+ }
-/**
- * node-compress-commons
- *
- * Copyright (c) 2014 Chris Talkington, contributors.
- * Licensed under the MIT license.
- * https://github.com/archiverjs/node-compress-commons/blob/master/LICENSE-MIT
- */
-var inherits = (__nccwpck_require__(73837).inherits);
-var isStream = __nccwpck_require__(41554);
-var Transform = (__nccwpck_require__(45193).Transform);
+ if (!Number.isFinite(forceKillAfterTimeout) || forceKillAfterTimeout < 0) {
+ throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${forceKillAfterTimeout}\` (${typeof forceKillAfterTimeout})`);
+ }
-var ArchiveEntry = __nccwpck_require__(92240);
-var util = __nccwpck_require__(95208);
+ return forceKillAfterTimeout;
+};
-var ArchiveOutputStream = module.exports = function(options) {
- if (!(this instanceof ArchiveOutputStream)) {
- return new ArchiveOutputStream(options);
- }
+// `childProcess.cancel()`
+const spawnedCancel = (spawned, context) => {
+ const killResult = spawned.kill();
- Transform.call(this, options);
+ if (killResult) {
+ context.isCanceled = true;
+ }
+};
- this.offset = 0;
- this._archive = {
- finish: false,
- finished: false,
- processing: false
- };
+const timeoutKill = (spawned, signal, reject) => {
+ spawned.kill(signal);
+ reject(Object.assign(new Error('Timed out'), {timedOut: true, signal}));
};
-inherits(ArchiveOutputStream, Transform);
+// `timeout` option handling
+const setupTimeout = (spawned, {timeout, killSignal = 'SIGTERM'}, spawnedPromise) => {
+ if (timeout === 0 || timeout === undefined) {
+ return spawnedPromise;
+ }
-ArchiveOutputStream.prototype._appendBuffer = function(zae, source, callback) {
- // scaffold only
-};
+ if (!Number.isFinite(timeout) || timeout < 0) {
+ throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${timeout}\` (${typeof timeout})`);
+ }
-ArchiveOutputStream.prototype._appendStream = function(zae, source, callback) {
- // scaffold only
-};
+ let timeoutId;
+ const timeoutPromise = new Promise((resolve, reject) => {
+ timeoutId = setTimeout(() => {
+ timeoutKill(spawned, killSignal, reject);
+ }, timeout);
+ });
-ArchiveOutputStream.prototype._emitErrorCallback = function(err) {
- if (err) {
- this.emit('error', err);
- }
-};
+ const safeSpawnedPromise = spawnedPromise.finally(() => {
+ clearTimeout(timeoutId);
+ });
-ArchiveOutputStream.prototype._finish = function(ae) {
- // scaffold only
+ return Promise.race([timeoutPromise, safeSpawnedPromise]);
};
-ArchiveOutputStream.prototype._normalizeEntry = function(ae) {
- // scaffold only
+// `cleanup` option handling
+const setExitHandler = async (spawned, {cleanup, detached}, timedPromise) => {
+ if (!cleanup || detached) {
+ return timedPromise;
+ }
+
+ const removeExitHandler = onExit(() => {
+ spawned.kill();
+ });
+
+ return timedPromise.finally(() => {
+ removeExitHandler();
+ });
};
-ArchiveOutputStream.prototype._transform = function(chunk, encoding, callback) {
- callback(null, chunk);
+module.exports = {
+ spawnedKill,
+ spawnedCancel,
+ setupTimeout,
+ setExitHandler
};
-ArchiveOutputStream.prototype.entry = function(ae, source, callback) {
- source = source || null;
- if (typeof callback !== 'function') {
- callback = this._emitErrorCallback.bind(this);
- }
+/***/ }),
- if (!(ae instanceof ArchiveEntry)) {
- callback(new Error('not a valid instance of ArchiveEntry'));
- return;
- }
+/***/ 51935:
+/***/ ((module) => {
- if (this._archive.finish || this._archive.finished) {
- callback(new Error('unacceptable entry after finish'));
- return;
- }
+"use strict";
- if (this._archive.processing) {
- callback(new Error('already processing an entry'));
- return;
- }
- this._archive.processing = true;
- this._normalizeEntry(ae);
- this._entry = ae;
+const nativePromisePrototype = (async () => {})().constructor.prototype;
+const descriptors = ['then', 'catch', 'finally'].map(property => [
+ property,
+ Reflect.getOwnPropertyDescriptor(nativePromisePrototype, property)
+]);
- source = util.normalizeInputSource(source);
+// The return value is a mixin of `childProcess` and `Promise`
+const mergePromise = (spawned, promise) => {
+ for (const [property, descriptor] of descriptors) {
+ // Starting the main `promise` is deferred to avoid consuming streams
+ const value = typeof promise === 'function' ?
+ (...args) => Reflect.apply(descriptor.value, promise(), args) :
+ descriptor.value.bind(promise);
- if (Buffer.isBuffer(source)) {
- this._appendBuffer(ae, source, callback);
- } else if (isStream(source)) {
- this._appendStream(ae, source, callback);
- } else {
- this._archive.processing = false;
- callback(new Error('input source must be valid Stream or Buffer instance'));
- return;
- }
+ Reflect.defineProperty(spawned, property, {...descriptor, value});
+ }
- return this;
+ return spawned;
};
-ArchiveOutputStream.prototype.finish = function() {
- if (this._archive.processing) {
- this._archive.finish = true;
- return;
- }
+// Use promises instead of `child_process` events
+const getSpawnedPromise = spawned => {
+ return new Promise((resolve, reject) => {
+ spawned.on('exit', (exitCode, signal) => {
+ resolve({exitCode, signal});
+ });
- this._finish();
+ spawned.on('error', error => {
+ reject(error);
+ });
+
+ if (spawned.stdin) {
+ spawned.stdin.on('error', error => {
+ reject(error);
+ });
+ }
+ });
};
-ArchiveOutputStream.prototype.getBytesWritten = function() {
- return this.offset;
+module.exports = {
+ mergePromise,
+ getSpawnedPromise
};
-ArchiveOutputStream.prototype.write = function(chunk, cb) {
- if (chunk) {
- this.offset += chunk.length;
- }
- return Transform.prototype.write.call(this, chunk, cb);
-};
/***/ }),
-/***/ 11704:
+/***/ 54149:
/***/ ((module) => {
-/**
- * node-compress-commons
- *
- * Copyright (c) 2014 Chris Talkington, contributors.
- * Licensed under the MIT license.
- * https://github.com/archiverjs/node-compress-commons/blob/master/LICENSE-MIT
- */
-module.exports = {
- WORD: 4,
- DWORD: 8,
- EMPTY: Buffer.alloc(0),
+"use strict";
- SHORT: 2,
- SHORT_MASK: 0xffff,
- SHORT_SHIFT: 16,
- SHORT_ZERO: Buffer.from(Array(2)),
- LONG: 4,
- LONG_ZERO: Buffer.from(Array(4)),
+const aliases = ['stdin', 'stdout', 'stderr'];
- MIN_VERSION_INITIAL: 10,
- MIN_VERSION_DATA_DESCRIPTOR: 20,
- MIN_VERSION_ZIP64: 45,
- VERSION_MADEBY: 45,
+const hasAlias = opts => aliases.some(alias => opts[alias] !== undefined);
- METHOD_STORED: 0,
- METHOD_DEFLATED: 8,
+const normalizeStdio = opts => {
+ if (!opts) {
+ return;
+ }
- PLATFORM_UNIX: 3,
- PLATFORM_FAT: 0,
+ const {stdio} = opts;
- SIG_LFH: 0x04034b50,
- SIG_DD: 0x08074b50,
- SIG_CFH: 0x02014b50,
- SIG_EOCD: 0x06054b50,
- SIG_ZIP64_EOCD: 0x06064B50,
- SIG_ZIP64_EOCD_LOC: 0x07064B50,
+ if (stdio === undefined) {
+ return aliases.map(alias => opts[alias]);
+ }
- ZIP64_MAGIC_SHORT: 0xffff,
- ZIP64_MAGIC: 0xffffffff,
- ZIP64_EXTRA_ID: 0x0001,
+ if (hasAlias(opts)) {
+ throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${aliases.map(alias => `\`${alias}\``).join(', ')}`);
+ }
- ZLIB_NO_COMPRESSION: 0,
- ZLIB_BEST_SPEED: 1,
- ZLIB_BEST_COMPRESSION: 9,
- ZLIB_DEFAULT_COMPRESSION: -1,
+ if (typeof stdio === 'string') {
+ return stdio;
+ }
- MODE_MASK: 0xFFF,
- DEFAULT_FILE_MODE: 33188, // 010644 = -rw-r--r-- = S_IFREG | S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH
- DEFAULT_DIR_MODE: 16877, // 040755 = drwxr-xr-x = S_IFDIR | S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH
+ if (!Array.isArray(stdio)) {
+ throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof stdio}\``);
+ }
- EXT_FILE_ATTR_DIR: 1106051088, // 010173200020 = drwxr-xr-x = (((S_IFDIR | 0755) << 16) | S_DOS_D)
- EXT_FILE_ATTR_FILE: 2175008800, // 020151000040 = -rw-r--r-- = (((S_IFREG | 0644) << 16) | S_DOS_A) >>> 0
+ const length = Math.max(stdio.length, aliases.length);
+ return Array.from({length}, (value, index) => stdio[index]);
+};
- // Unix file types
- S_IFMT: 61440, // 0170000 type of file mask
- S_IFIFO: 4096, // 010000 named pipe (fifo)
- S_IFCHR: 8192, // 020000 character special
- S_IFDIR: 16384, // 040000 directory
- S_IFBLK: 24576, // 060000 block special
- S_IFREG: 32768, // 0100000 regular
- S_IFLNK: 40960, // 0120000 symbolic link
- S_IFSOCK: 49152, // 0140000 socket
+module.exports = normalizeStdio;
- // DOS file type flags
- S_DOS_A: 32, // 040 Archive
- S_DOS_D: 16, // 020 Directory
- S_DOS_V: 8, // 010 Volume
- S_DOS_S: 4, // 04 System
- S_DOS_H: 2, // 02 Hidden
- S_DOS_R: 1 // 01 Read Only
+// `ipc` is pushed unless it is already present
+module.exports.node = opts => {
+ const stdio = normalizeStdio(opts);
+
+ if (stdio === 'ipc') {
+ return 'ipc';
+ }
+
+ if (stdio === undefined || typeof stdio === 'string') {
+ return [stdio, stdio, stdio, 'ipc'];
+ }
+
+ if (stdio.includes('ipc')) {
+ return stdio;
+ }
+
+ return [...stdio, 'ipc'];
};
/***/ }),
-/***/ 63229:
+/***/ 2658:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
-/**
- * node-compress-commons
- *
- * Copyright (c) 2014 Chris Talkington, contributors.
- * Licensed under the MIT license.
- * https://github.com/archiverjs/node-compress-commons/blob/master/LICENSE-MIT
- */
-var zipUtil = __nccwpck_require__(68682);
-
-var DATA_DESCRIPTOR_FLAG = 1 << 3;
-var ENCRYPTION_FLAG = 1 << 0;
-var NUMBER_OF_SHANNON_FANO_TREES_FLAG = 1 << 2;
-var SLIDING_DICTIONARY_SIZE_FLAG = 1 << 1;
-var STRONG_ENCRYPTION_FLAG = 1 << 6;
-var UFT8_NAMES_FLAG = 1 << 11;
-
-var GeneralPurposeBit = module.exports = function() {
- if (!(this instanceof GeneralPurposeBit)) {
- return new GeneralPurposeBit();
- }
+"use strict";
- this.descriptor = false;
- this.encryption = false;
- this.utf8 = false;
- this.numberOfShannonFanoTrees = 0;
- this.strongEncryption = false;
- this.slidingDictionarySize = 0;
+const isStream = __nccwpck_require__(41554);
+const getStream = __nccwpck_require__(80591);
+const mergeStream = __nccwpck_require__(2621);
- return this;
-};
+// `input` option
+const handleInput = (spawned, input) => {
+ // Checking for stdin is workaround for https://github.com/nodejs/node/issues/26852
+ // TODO: Remove `|| spawned.stdin === undefined` once we drop support for Node.js <=12.2.0
+ if (input === undefined || spawned.stdin === undefined) {
+ return;
+ }
-GeneralPurposeBit.prototype.encode = function() {
- return zipUtil.getShortBytes(
- (this.descriptor ? DATA_DESCRIPTOR_FLAG : 0) |
- (this.utf8 ? UFT8_NAMES_FLAG : 0) |
- (this.encryption ? ENCRYPTION_FLAG : 0) |
- (this.strongEncryption ? STRONG_ENCRYPTION_FLAG : 0)
- );
+ if (isStream(input)) {
+ input.pipe(spawned.stdin);
+ } else {
+ spawned.stdin.end(input);
+ }
};
-GeneralPurposeBit.prototype.parse = function(buf, offset) {
- var flag = zipUtil.getShortBytesValue(buf, offset);
- var gbp = new GeneralPurposeBit();
+// `all` interleaves `stdout` and `stderr`
+const makeAllStream = (spawned, {all}) => {
+ if (!all || (!spawned.stdout && !spawned.stderr)) {
+ return;
+ }
- gbp.useDataDescriptor((flag & DATA_DESCRIPTOR_FLAG) !== 0);
- gbp.useUTF8ForNames((flag & UFT8_NAMES_FLAG) !== 0);
- gbp.useStrongEncryption((flag & STRONG_ENCRYPTION_FLAG) !== 0);
- gbp.useEncryption((flag & ENCRYPTION_FLAG) !== 0);
- gbp.setSlidingDictionarySize((flag & SLIDING_DICTIONARY_SIZE_FLAG) !== 0 ? 8192 : 4096);
- gbp.setNumberOfShannonFanoTrees((flag & NUMBER_OF_SHANNON_FANO_TREES_FLAG) !== 0 ? 3 : 2);
+ const mixed = mergeStream();
- return gbp;
-};
+ if (spawned.stdout) {
+ mixed.add(spawned.stdout);
+ }
-GeneralPurposeBit.prototype.setNumberOfShannonFanoTrees = function(n) {
- this.numberOfShannonFanoTrees = n;
-};
+ if (spawned.stderr) {
+ mixed.add(spawned.stderr);
+ }
-GeneralPurposeBit.prototype.getNumberOfShannonFanoTrees = function() {
- return this.numberOfShannonFanoTrees;
+ return mixed;
};
-GeneralPurposeBit.prototype.setSlidingDictionarySize = function(n) {
- this.slidingDictionarySize = n;
-};
+// On failure, `result.stdout|stderr|all` should contain the currently buffered stream
+const getBufferedData = async (stream, streamPromise) => {
+ if (!stream) {
+ return;
+ }
-GeneralPurposeBit.prototype.getSlidingDictionarySize = function() {
- return this.slidingDictionarySize;
-};
+ stream.destroy();
-GeneralPurposeBit.prototype.useDataDescriptor = function(b) {
- this.descriptor = b;
+ try {
+ return await streamPromise;
+ } catch (error) {
+ return error.bufferedData;
+ }
};
-GeneralPurposeBit.prototype.usesDataDescriptor = function() {
- return this.descriptor;
-};
+const getStreamPromise = (stream, {encoding, buffer, maxBuffer}) => {
+ if (!stream || !buffer) {
+ return;
+ }
-GeneralPurposeBit.prototype.useEncryption = function(b) {
- this.encryption = b;
-};
+ if (encoding) {
+ return getStream(stream, {encoding, maxBuffer});
+ }
-GeneralPurposeBit.prototype.usesEncryption = function() {
- return this.encryption;
+ return getStream.buffer(stream, {maxBuffer});
};
-GeneralPurposeBit.prototype.useStrongEncryption = function(b) {
- this.strongEncryption = b;
-};
+// Retrieve result of child process: exit code, signal, error, streams (stdout/stderr/all)
+const getSpawnedResult = async ({stdout, stderr, all}, {encoding, buffer, maxBuffer}, processDone) => {
+ const stdoutPromise = getStreamPromise(stdout, {encoding, buffer, maxBuffer});
+ const stderrPromise = getStreamPromise(stderr, {encoding, buffer, maxBuffer});
+ const allPromise = getStreamPromise(all, {encoding, buffer, maxBuffer: maxBuffer * 2});
-GeneralPurposeBit.prototype.usesStrongEncryption = function() {
- return this.strongEncryption;
+ try {
+ return await Promise.all([processDone, stdoutPromise, stderrPromise, allPromise]);
+ } catch (error) {
+ return Promise.all([
+ {error, signal: error.signal, timedOut: error.timedOut},
+ getBufferedData(stdout, stdoutPromise),
+ getBufferedData(stderr, stderrPromise),
+ getBufferedData(all, allPromise)
+ ]);
+ }
};
-GeneralPurposeBit.prototype.useUTF8ForNames = function(b) {
- this.utf8 = b;
+const validateInputSync = ({input}) => {
+ if (isStream(input)) {
+ throw new TypeError('The `input` option cannot be a stream in sync mode');
+ }
};
-GeneralPurposeBit.prototype.usesUTF8ForNames = function() {
- return this.utf8;
+module.exports = {
+ handleInput,
+ makeAllStream,
+ getSpawnedResult,
+ validateInputSync
};
-/***/ }),
-
-/***/ 70713:
-/***/ ((module) => {
-
-/**
- * node-compress-commons
- *
- * Copyright (c) 2014 Chris Talkington, contributors.
- * Licensed under the MIT license.
- * https://github.com/archiverjs/node-compress-commons/blob/master/LICENSE-MIT
- */
-module.exports = {
- /**
- * Bits used for permissions (and sticky bit)
- */
- PERM_MASK: 4095, // 07777
- /**
- * Bits used to indicate the filesystem object type.
- */
- FILE_TYPE_FLAG: 61440, // 0170000
- /**
- * Indicates symbolic links.
- */
- LINK_FLAG: 40960, // 0120000
+/***/ }),
- /**
- * Indicates plain files.
- */
- FILE_FLAG: 32768, // 0100000
+/***/ 33059:
+/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
- /**
- * Indicates directories.
- */
- DIR_FLAG: 16384, // 040000
+"use strict";
- // ----------------------------------------------------------
- // somewhat arbitrary choices that are quite common for shared
- // installations
- // -----------------------------------------------------------
+const {PassThrough: PassThroughStream} = __nccwpck_require__(12781);
- /**
- * Default permissions for symbolic links.
- */
- DEFAULT_LINK_PERM: 511, // 0777
+module.exports = options => {
+ options = {...options};
- /**
- * Default permissions for directories.
- */
- DEFAULT_DIR_PERM: 493, // 0755
+ const {array} = options;
+ let {encoding} = options;
+ const isBuffer = encoding === 'buffer';
+ let objectMode = false;
- /**
- * Default permissions for plain files.
- */
- DEFAULT_FILE_PERM: 420 // 0644
-};
+ if (array) {
+ objectMode = !(encoding || isBuffer);
+ } else {
+ encoding = encoding || 'utf8';
+ }
-/***/ }),
+ if (isBuffer) {
+ encoding = null;
+ }
-/***/ 68682:
-/***/ ((module) => {
+ const stream = new PassThroughStream({objectMode});
-/**
- * node-compress-commons
- *
- * Copyright (c) 2014 Chris Talkington, contributors.
- * Licensed under the MIT license.
- * https://github.com/archiverjs/node-compress-commons/blob/master/LICENSE-MIT
- */
-var util = module.exports = {};
+ if (encoding) {
+ stream.setEncoding(encoding);
+ }
-util.dateToDos = function(d, forceLocalTime) {
- forceLocalTime = forceLocalTime || false;
+ let length = 0;
+ const chunks = [];
- var year = forceLocalTime ? d.getFullYear() : d.getUTCFullYear();
+ stream.on('data', chunk => {
+ chunks.push(chunk);
- if (year < 1980) {
- return 2162688; // 1980-1-1 00:00:00
- } else if (year >= 2044) {
- return 2141175677; // 2043-12-31 23:59:58
- }
+ if (objectMode) {
+ length = chunks.length;
+ } else {
+ length += chunk.length;
+ }
+ });
- var val = {
- year: year,
- month: forceLocalTime ? d.getMonth() : d.getUTCMonth(),
- date: forceLocalTime ? d.getDate() : d.getUTCDate(),
- hours: forceLocalTime ? d.getHours() : d.getUTCHours(),
- minutes: forceLocalTime ? d.getMinutes() : d.getUTCMinutes(),
- seconds: forceLocalTime ? d.getSeconds() : d.getUTCSeconds()
- };
+ stream.getBufferedValue = () => {
+ if (array) {
+ return chunks;
+ }
- return ((val.year - 1980) << 25) | ((val.month + 1) << 21) | (val.date << 16) |
- (val.hours << 11) | (val.minutes << 5) | (val.seconds / 2);
-};
+ return isBuffer ? Buffer.concat(chunks, length) : chunks.join('');
+ };
-util.dosToDate = function(dos) {
- return new Date(((dos >> 25) & 0x7f) + 1980, ((dos >> 21) & 0x0f) - 1, (dos >> 16) & 0x1f, (dos >> 11) & 0x1f, (dos >> 5) & 0x3f, (dos & 0x1f) << 1);
-};
+ stream.getBufferedLength = () => length;
-util.fromDosTime = function(buf) {
- return util.dosToDate(buf.readUInt32LE(0));
+ return stream;
};
-util.getEightBytes = function(v) {
- var buf = Buffer.alloc(8);
- buf.writeUInt32LE(v % 0x0100000000, 0);
- buf.writeUInt32LE((v / 0x0100000000) | 0, 4);
- return buf;
-};
+/***/ }),
-util.getShortBytes = function(v) {
- var buf = Buffer.alloc(2);
- buf.writeUInt16LE((v & 0xFFFF) >>> 0, 0);
+/***/ 80591:
+/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
- return buf;
-};
+"use strict";
-util.getShortBytesValue = function(buf, offset) {
- return buf.readUInt16LE(offset);
-};
+const {constants: BufferConstants} = __nccwpck_require__(14300);
+const pump = __nccwpck_require__(18341);
+const bufferStream = __nccwpck_require__(33059);
-util.getLongBytes = function(v) {
- var buf = Buffer.alloc(4);
- buf.writeUInt32LE((v & 0xFFFFFFFF) >>> 0, 0);
+class MaxBufferError extends Error {
+ constructor() {
+ super('maxBuffer exceeded');
+ this.name = 'MaxBufferError';
+ }
+}
- return buf;
-};
+async function getStream(inputStream, options) {
+ if (!inputStream) {
+ return Promise.reject(new Error('Expected a stream'));
+ }
-util.getLongBytesValue = function(buf, offset) {
- return buf.readUInt32LE(offset);
-};
+ options = {
+ maxBuffer: Infinity,
+ ...options
+ };
-util.toDosTime = function(d) {
- return util.getLongBytes(util.dateToDos(d));
-};
+ const {maxBuffer} = options;
-/***/ }),
+ let stream;
+ await new Promise((resolve, reject) => {
+ const rejectPromise = error => {
+ // Don't retrieve an oversized buffer.
+ if (error && stream.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
+ error.bufferedData = stream.getBufferedValue();
+ }
-/***/ 3179:
-/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
+ reject(error);
+ };
-/**
- * node-compress-commons
- *
- * Copyright (c) 2014 Chris Talkington, contributors.
- * Licensed under the MIT license.
- * https://github.com/archiverjs/node-compress-commons/blob/master/LICENSE-MIT
- */
-var inherits = (__nccwpck_require__(73837).inherits);
-var normalizePath = __nccwpck_require__(55388);
+ stream = pump(inputStream, bufferStream(options), error => {
+ if (error) {
+ rejectPromise(error);
+ return;
+ }
-var ArchiveEntry = __nccwpck_require__(92240);
-var GeneralPurposeBit = __nccwpck_require__(63229);
-var UnixStat = __nccwpck_require__(70713);
+ resolve();
+ });
-var constants = __nccwpck_require__(11704);
-var zipUtil = __nccwpck_require__(68682);
+ stream.on('data', () => {
+ if (stream.getBufferedLength() > maxBuffer) {
+ rejectPromise(new MaxBufferError());
+ }
+ });
+ });
-var ZipArchiveEntry = module.exports = function(name) {
- if (!(this instanceof ZipArchiveEntry)) {
- return new ZipArchiveEntry(name);
- }
+ return stream.getBufferedValue();
+}
- ArchiveEntry.call(this);
+module.exports = getStream;
+// TODO: Remove this for the next major release
+module.exports["default"] = getStream;
+module.exports.buffer = (stream, options) => getStream(stream, {...options, encoding: 'buffer'});
+module.exports.array = (stream, options) => getStream(stream, {...options, array: true});
+module.exports.MaxBufferError = MaxBufferError;
- this.platform = constants.PLATFORM_FAT;
- this.method = -1;
- this.name = null;
- this.size = 0;
- this.csize = 0;
- this.gpb = new GeneralPurposeBit();
- this.crc = 0;
- this.time = -1;
+/***/ }),
- this.minver = constants.MIN_VERSION_INITIAL;
- this.mode = -1;
- this.extra = null;
- this.exattr = 0;
- this.inattr = 0;
- this.comment = null;
+/***/ 29778:
+/***/ ((__unused_webpack_module, exports) => {
- if (name) {
- this.setName(name);
- }
-};
+"use strict";
+Object.defineProperty(exports, "__esModule", ({value:true}));exports.SIGNALS=void 0;
-inherits(ZipArchiveEntry, ArchiveEntry);
+const SIGNALS=[
+{
+name:"SIGHUP",
+number:1,
+action:"terminate",
+description:"Terminal closed",
+standard:"posix"},
-/**
- * Returns the extra fields related to the entry.
- *
- * @returns {Buffer}
- */
-ZipArchiveEntry.prototype.getCentralDirectoryExtra = function() {
- return this.getExtra();
-};
+{
+name:"SIGINT",
+number:2,
+action:"terminate",
+description:"User interruption with CTRL-C",
+standard:"ansi"},
-/**
- * Returns the comment set for the entry.
- *
- * @returns {string}
- */
-ZipArchiveEntry.prototype.getComment = function() {
- return this.comment !== null ? this.comment : '';
-};
+{
+name:"SIGQUIT",
+number:3,
+action:"core",
+description:"User interruption with CTRL-\\",
+standard:"posix"},
-/**
- * Returns the compressed size of the entry.
- *
- * @returns {number}
- */
-ZipArchiveEntry.prototype.getCompressedSize = function() {
- return this.csize;
-};
+{
+name:"SIGILL",
+number:4,
+action:"core",
+description:"Invalid machine instruction",
+standard:"ansi"},
-/**
- * Returns the CRC32 digest for the entry.
- *
- * @returns {number}
- */
-ZipArchiveEntry.prototype.getCrc = function() {
- return this.crc;
-};
+{
+name:"SIGTRAP",
+number:5,
+action:"core",
+description:"Debugger breakpoint",
+standard:"posix"},
-/**
- * Returns the external file attributes for the entry.
- *
- * @returns {number}
- */
-ZipArchiveEntry.prototype.getExternalAttributes = function() {
- return this.exattr;
-};
+{
+name:"SIGABRT",
+number:6,
+action:"core",
+description:"Aborted",
+standard:"ansi"},
-/**
- * Returns the extra fields related to the entry.
- *
- * @returns {Buffer}
- */
-ZipArchiveEntry.prototype.getExtra = function() {
- return this.extra !== null ? this.extra : constants.EMPTY;
-};
+{
+name:"SIGIOT",
+number:6,
+action:"core",
+description:"Aborted",
+standard:"bsd"},
-/**
- * Returns the general purpose bits related to the entry.
- *
- * @returns {GeneralPurposeBit}
- */
-ZipArchiveEntry.prototype.getGeneralPurposeBit = function() {
- return this.gpb;
-};
+{
+name:"SIGBUS",
+number:7,
+action:"core",
+description:
+"Bus error due to misaligned, non-existing address or paging error",
+standard:"bsd"},
-/**
- * Returns the internal file attributes for the entry.
- *
- * @returns {number}
- */
-ZipArchiveEntry.prototype.getInternalAttributes = function() {
- return this.inattr;
-};
+{
+name:"SIGEMT",
+number:7,
+action:"terminate",
+description:"Command should be emulated but is not implemented",
+standard:"other"},
-/**
- * Returns the last modified date of the entry.
- *
- * @returns {number}
- */
-ZipArchiveEntry.prototype.getLastModifiedDate = function() {
- return this.getTime();
-};
+{
+name:"SIGFPE",
+number:8,
+action:"core",
+description:"Floating point arithmetic error",
+standard:"ansi"},
-/**
- * Returns the extra fields related to the entry.
- *
- * @returns {Buffer}
- */
-ZipArchiveEntry.prototype.getLocalFileDataExtra = function() {
- return this.getExtra();
-};
+{
+name:"SIGKILL",
+number:9,
+action:"terminate",
+description:"Forced termination",
+standard:"posix",
+forced:true},
-/**
- * Returns the compression method used on the entry.
- *
- * @returns {number}
- */
-ZipArchiveEntry.prototype.getMethod = function() {
- return this.method;
-};
+{
+name:"SIGUSR1",
+number:10,
+action:"terminate",
+description:"Application-specific signal",
+standard:"posix"},
-/**
- * Returns the filename of the entry.
- *
- * @returns {string}
- */
-ZipArchiveEntry.prototype.getName = function() {
- return this.name;
-};
+{
+name:"SIGSEGV",
+number:11,
+action:"core",
+description:"Segmentation fault",
+standard:"ansi"},
-/**
- * Returns the platform on which the entry was made.
- *
- * @returns {number}
- */
-ZipArchiveEntry.prototype.getPlatform = function() {
- return this.platform;
-};
+{
+name:"SIGUSR2",
+number:12,
+action:"terminate",
+description:"Application-specific signal",
+standard:"posix"},
-/**
- * Returns the size of the entry.
- *
- * @returns {number}
- */
-ZipArchiveEntry.prototype.getSize = function() {
- return this.size;
-};
+{
+name:"SIGPIPE",
+number:13,
+action:"terminate",
+description:"Broken pipe or socket",
+standard:"posix"},
-/**
- * Returns a date object representing the last modified date of the entry.
- *
- * @returns {number|Date}
- */
-ZipArchiveEntry.prototype.getTime = function() {
- return this.time !== -1 ? zipUtil.dosToDate(this.time) : -1;
-};
+{
+name:"SIGALRM",
+number:14,
+action:"terminate",
+description:"Timeout or timer",
+standard:"posix"},
-/**
- * Returns the DOS timestamp for the entry.
- *
- * @returns {number}
- */
-ZipArchiveEntry.prototype.getTimeDos = function() {
- return this.time !== -1 ? this.time : 0;
-};
+{
+name:"SIGTERM",
+number:15,
+action:"terminate",
+description:"Termination",
+standard:"ansi"},
-/**
- * Returns the UNIX file permissions for the entry.
- *
- * @returns {number}
- */
-ZipArchiveEntry.prototype.getUnixMode = function() {
- return this.platform !== constants.PLATFORM_UNIX ? 0 : ((this.getExternalAttributes() >> constants.SHORT_SHIFT) & constants.SHORT_MASK);
-};
+{
+name:"SIGSTKFLT",
+number:16,
+action:"terminate",
+description:"Stack is empty or overflowed",
+standard:"other"},
-/**
- * Returns the version of ZIP needed to extract the entry.
- *
- * @returns {number}
- */
-ZipArchiveEntry.prototype.getVersionNeededToExtract = function() {
- return this.minver;
-};
+{
+name:"SIGCHLD",
+number:17,
+action:"ignore",
+description:"Child process terminated, paused or unpaused",
+standard:"posix"},
-/**
- * Sets the comment of the entry.
- *
- * @param comment
- */
-ZipArchiveEntry.prototype.setComment = function(comment) {
- if (Buffer.byteLength(comment) !== comment.length) {
- this.getGeneralPurposeBit().useUTF8ForNames(true);
- }
+{
+name:"SIGCLD",
+number:17,
+action:"ignore",
+description:"Child process terminated, paused or unpaused",
+standard:"other"},
- this.comment = comment;
-};
+{
+name:"SIGCONT",
+number:18,
+action:"unpause",
+description:"Unpaused",
+standard:"posix",
+forced:true},
-/**
- * Sets the compressed size of the entry.
- *
- * @param size
- */
-ZipArchiveEntry.prototype.setCompressedSize = function(size) {
- if (size < 0) {
- throw new Error('invalid entry compressed size');
- }
+{
+name:"SIGSTOP",
+number:19,
+action:"pause",
+description:"Paused",
+standard:"posix",
+forced:true},
- this.csize = size;
-};
+{
+name:"SIGTSTP",
+number:20,
+action:"pause",
+description:"Paused using CTRL-Z or \"suspend\"",
+standard:"posix"},
-/**
- * Sets the checksum of the entry.
- *
- * @param crc
- */
-ZipArchiveEntry.prototype.setCrc = function(crc) {
- if (crc < 0) {
- throw new Error('invalid entry crc32');
- }
+{
+name:"SIGTTIN",
+number:21,
+action:"pause",
+description:"Background process cannot read terminal input",
+standard:"posix"},
- this.crc = crc;
-};
+{
+name:"SIGBREAK",
+number:21,
+action:"terminate",
+description:"User interruption with CTRL-BREAK",
+standard:"other"},
-/**
- * Sets the external file attributes of the entry.
- *
- * @param attr
- */
-ZipArchiveEntry.prototype.setExternalAttributes = function(attr) {
- this.exattr = attr >>> 0;
-};
+{
+name:"SIGTTOU",
+number:22,
+action:"pause",
+description:"Background process cannot write to terminal output",
+standard:"posix"},
-/**
- * Sets the extra fields related to the entry.
- *
- * @param extra
- */
-ZipArchiveEntry.prototype.setExtra = function(extra) {
- this.extra = extra;
-};
+{
+name:"SIGURG",
+number:23,
+action:"ignore",
+description:"Socket received out-of-band data",
+standard:"bsd"},
-/**
- * Sets the general purpose bits related to the entry.
- *
- * @param gpb
- */
-ZipArchiveEntry.prototype.setGeneralPurposeBit = function(gpb) {
- if (!(gpb instanceof GeneralPurposeBit)) {
- throw new Error('invalid entry GeneralPurposeBit');
- }
+{
+name:"SIGXCPU",
+number:24,
+action:"core",
+description:"Process timed out",
+standard:"bsd"},
- this.gpb = gpb;
-};
+{
+name:"SIGXFSZ",
+number:25,
+action:"core",
+description:"File too big",
+standard:"bsd"},
-/**
- * Sets the internal file attributes of the entry.
- *
- * @param attr
- */
-ZipArchiveEntry.prototype.setInternalAttributes = function(attr) {
- this.inattr = attr;
-};
+{
+name:"SIGVTALRM",
+number:26,
+action:"terminate",
+description:"Timeout or timer",
+standard:"bsd"},
-/**
- * Sets the compression method of the entry.
- *
- * @param method
- */
-ZipArchiveEntry.prototype.setMethod = function(method) {
- if (method < 0) {
- throw new Error('invalid entry compression method');
- }
+{
+name:"SIGPROF",
+number:27,
+action:"terminate",
+description:"Timeout or timer",
+standard:"bsd"},
- this.method = method;
-};
+{
+name:"SIGWINCH",
+number:28,
+action:"ignore",
+description:"Terminal window size changed",
+standard:"bsd"},
-/**
- * Sets the name of the entry.
- *
- * @param name
- * @param prependSlash
- */
-ZipArchiveEntry.prototype.setName = function(name, prependSlash = false) {
- name = normalizePath(name, false)
- .replace(/^\w+:/, '')
- .replace(/^(\.\.\/|\/)+/, '');
+{
+name:"SIGIO",
+number:29,
+action:"terminate",
+description:"I/O is available",
+standard:"other"},
- if (prependSlash) {
- name = `/${name}`;
- }
+{
+name:"SIGPOLL",
+number:29,
+action:"terminate",
+description:"Watched event",
+standard:"other"},
- if (Buffer.byteLength(name) !== name.length) {
- this.getGeneralPurposeBit().useUTF8ForNames(true);
- }
+{
+name:"SIGINFO",
+number:29,
+action:"ignore",
+description:"Request for process information",
+standard:"other"},
- this.name = name;
-};
+{
+name:"SIGPWR",
+number:30,
+action:"terminate",
+description:"Device running out of power",
+standard:"systemv"},
-/**
- * Sets the platform on which the entry was made.
- *
- * @param platform
- */
-ZipArchiveEntry.prototype.setPlatform = function(platform) {
- this.platform = platform;
-};
+{
+name:"SIGSYS",
+number:31,
+action:"core",
+description:"Invalid system call",
+standard:"other"},
-/**
- * Sets the size of the entry.
- *
- * @param size
- */
-ZipArchiveEntry.prototype.setSize = function(size) {
- if (size < 0) {
- throw new Error('invalid entry size');
- }
+{
+name:"SIGUNUSED",
+number:31,
+action:"terminate",
+description:"Invalid system call",
+standard:"other"}];exports.SIGNALS=SIGNALS;
+//# sourceMappingURL=core.js.map
- this.size = size;
-};
+/***/ }),
-/**
- * Sets the time of the entry.
- *
- * @param time
- * @param forceLocalTime
- */
-ZipArchiveEntry.prototype.setTime = function(time, forceLocalTime) {
- if (!(time instanceof Date)) {
- throw new Error('invalid entry time');
- }
+/***/ 27605:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
- this.time = zipUtil.dateToDos(time, forceLocalTime);
-};
+"use strict";
+Object.defineProperty(exports, "__esModule", ({value:true}));exports.signalsByNumber=exports.signalsByName=void 0;var _os=__nccwpck_require__(22037);
-/**
- * Sets the UNIX file permissions for the entry.
- *
- * @param mode
- */
-ZipArchiveEntry.prototype.setUnixMode = function(mode) {
- mode |= this.isDirectory() ? constants.S_IFDIR : constants.S_IFREG;
+var _signals=__nccwpck_require__(59519);
+var _realtime=__nccwpck_require__(45904);
- var extattr = 0;
- extattr |= (mode << constants.SHORT_SHIFT) | (this.isDirectory() ? constants.S_DOS_D : constants.S_DOS_A);
- this.setExternalAttributes(extattr);
- this.mode = mode & constants.MODE_MASK;
- this.platform = constants.PLATFORM_UNIX;
-};
-/**
- * Sets the version of ZIP needed to extract this entry.
- *
- * @param minver
- */
-ZipArchiveEntry.prototype.setVersionNeededToExtract = function(minver) {
- this.minver = minver;
+const getSignalsByName=function(){
+const signals=(0,_signals.getSignals)();
+return signals.reduce(getSignalByName,{});
};
-/**
- * Returns true if this entry represents a directory.
- *
- * @returns {boolean}
- */
-ZipArchiveEntry.prototype.isDirectory = function() {
- return this.getName().slice(-1) === '/';
-};
+const getSignalByName=function(
+signalByNameMemo,
+{name,number,description,supported,action,forced,standard})
+{
+return{
+...signalByNameMemo,
+[name]:{name,number,description,supported,action,forced,standard}};
-/**
- * Returns true if this entry represents a unix symlink,
- * in which case the entry's content contains the target path
- * for the symlink.
- *
- * @returns {boolean}
- */
-ZipArchiveEntry.prototype.isUnixSymlink = function() {
- return (this.getUnixMode() & UnixStat.FILE_TYPE_FLAG) === UnixStat.LINK_FLAG;
};
-/**
- * Returns true if this entry is using the ZIP64 extension of ZIP.
- *
- * @returns {boolean}
- */
-ZipArchiveEntry.prototype.isZip64 = function() {
- return this.csize > constants.ZIP64_MAGIC || this.size > constants.ZIP64_MAGIC;
-};
+const signalsByName=getSignalsByName();exports.signalsByName=signalsByName;
-/***/ }),
-/***/ 44432:
-/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
-/**
- * node-compress-commons
- *
- * Copyright (c) 2014 Chris Talkington, contributors.
- * Licensed under the MIT license.
- * https://github.com/archiverjs/node-compress-commons/blob/master/LICENSE-MIT
- */
-var inherits = (__nccwpck_require__(73837).inherits);
-var crc32 = __nccwpck_require__(83201);
-var {CRC32Stream} = __nccwpck_require__(5101);
-var {DeflateCRC32Stream} = __nccwpck_require__(5101);
+const getSignalsByNumber=function(){
+const signals=(0,_signals.getSignals)();
+const length=_realtime.SIGRTMAX+1;
+const signalsA=Array.from({length},(value,number)=>
+getSignalByNumber(number,signals));
-var ArchiveOutputStream = __nccwpck_require__(36728);
-var ZipArchiveEntry = __nccwpck_require__(3179);
-var GeneralPurposeBit = __nccwpck_require__(63229);
+return Object.assign({},...signalsA);
+};
-var constants = __nccwpck_require__(11704);
-var util = __nccwpck_require__(95208);
-var zipUtil = __nccwpck_require__(68682);
+const getSignalByNumber=function(number,signals){
+const signal=findSignalByNumber(number,signals);
-var ZipArchiveOutputStream = module.exports = function(options) {
- if (!(this instanceof ZipArchiveOutputStream)) {
- return new ZipArchiveOutputStream(options);
- }
+if(signal===undefined){
+return{};
+}
- options = this.options = this._defaults(options);
+const{name,description,supported,action,forced,standard}=signal;
+return{
+[number]:{
+name,
+number,
+description,
+supported,
+action,
+forced,
+standard}};
- ArchiveOutputStream.call(this, options);
- this._entry = null;
- this._entries = [];
- this._archive = {
- centralLength: 0,
- centralOffset: 0,
- comment: '',
- finish: false,
- finished: false,
- processing: false,
- forceZip64: options.forceZip64,
- forceLocalTime: options.forceLocalTime
- };
};
-inherits(ZipArchiveOutputStream, ArchiveOutputStream);
-ZipArchiveOutputStream.prototype._afterAppend = function(ae) {
- this._entries.push(ae);
- if (ae.getGeneralPurposeBit().usesDataDescriptor()) {
- this._writeDataDescriptor(ae);
- }
+const findSignalByNumber=function(number,signals){
+const signal=signals.find(({name})=>_os.constants.signals[name]===number);
- this._archive.processing = false;
- this._entry = null;
+if(signal!==undefined){
+return signal;
+}
- if (this._archive.finish && !this._archive.finished) {
- this._finish();
- }
+return signals.find(signalA=>signalA.number===number);
};
-ZipArchiveOutputStream.prototype._appendBuffer = function(ae, source, callback) {
- if (source.length === 0) {
- ae.setMethod(constants.METHOD_STORED);
- }
+const signalsByNumber=getSignalsByNumber();exports.signalsByNumber=signalsByNumber;
+//# sourceMappingURL=main.js.map
- var method = ae.getMethod();
+/***/ }),
- if (method === constants.METHOD_STORED) {
- ae.setSize(source.length);
- ae.setCompressedSize(source.length);
- ae.setCrc(crc32.buf(source) >>> 0);
- }
+/***/ 45904:
+/***/ ((__unused_webpack_module, exports) => {
- this._writeLocalFileHeader(ae);
+"use strict";
+Object.defineProperty(exports, "__esModule", ({value:true}));exports.SIGRTMAX=exports.getRealtimeSignals=void 0;
+const getRealtimeSignals=function(){
+const length=SIGRTMAX-SIGRTMIN+1;
+return Array.from({length},getRealtimeSignal);
+};exports.getRealtimeSignals=getRealtimeSignals;
+
+const getRealtimeSignal=function(value,index){
+return{
+name:`SIGRT${index+1}`,
+number:SIGRTMIN+index,
+action:"terminate",
+description:"Application-specific signal (realtime)",
+standard:"posix"};
- if (method === constants.METHOD_STORED) {
- this.write(source);
- this._afterAppend(ae);
- callback(null, ae);
- return;
- } else if (method === constants.METHOD_DEFLATED) {
- this._smartStream(ae, callback).end(source);
- return;
- } else {
- callback(new Error('compression method ' + method + ' not implemented'));
- return;
- }
};
-ZipArchiveOutputStream.prototype._appendStream = function(ae, source, callback) {
- ae.getGeneralPurposeBit().useDataDescriptor(true);
- ae.setVersionNeededToExtract(constants.MIN_VERSION_DATA_DESCRIPTOR);
+const SIGRTMIN=34;
+const SIGRTMAX=64;exports.SIGRTMAX=SIGRTMAX;
+//# sourceMappingURL=realtime.js.map
- this._writeLocalFileHeader(ae);
+/***/ }),
- var smart = this._smartStream(ae, callback);
- source.once('error', function(err) {
- smart.emit('error', err);
- smart.end();
- })
- source.pipe(smart);
-};
+/***/ 59519:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-ZipArchiveOutputStream.prototype._defaults = function(o) {
- if (typeof o !== 'object') {
- o = {};
- }
+"use strict";
+Object.defineProperty(exports, "__esModule", ({value:true}));exports.getSignals=void 0;var _os=__nccwpck_require__(22037);
- if (typeof o.zlib !== 'object') {
- o.zlib = {};
- }
+var _core=__nccwpck_require__(29778);
+var _realtime=__nccwpck_require__(45904);
- if (typeof o.zlib.level !== 'number') {
- o.zlib.level = constants.ZLIB_BEST_SPEED;
- }
- o.forceZip64 = !!o.forceZip64;
- o.forceLocalTime = !!o.forceLocalTime;
- return o;
-};
+const getSignals=function(){
+const realtimeSignals=(0,_realtime.getRealtimeSignals)();
+const signals=[..._core.SIGNALS,...realtimeSignals].map(normalizeSignal);
+return signals;
+};exports.getSignals=getSignals;
-ZipArchiveOutputStream.prototype._finish = function() {
- this._archive.centralOffset = this.offset;
- this._entries.forEach(function(ae) {
- this._writeCentralFileHeader(ae);
- }.bind(this));
- this._archive.centralLength = this.offset - this._archive.centralOffset;
- if (this.isZip64()) {
- this._writeCentralDirectoryZip64();
- }
- this._writeCentralDirectoryEnd();
- this._archive.processing = false;
- this._archive.finish = true;
- this._archive.finished = true;
- this.end();
+
+const normalizeSignal=function({
+name,
+number:defaultNumber,
+description,
+action,
+forced=false,
+standard})
+{
+const{
+signals:{[name]:constantSignal}}=
+_os.constants;
+const supported=constantSignal!==undefined;
+const number=supported?constantSignal:defaultNumber;
+return{name,number,description,supported,action,forced,standard};
};
+//# sourceMappingURL=signals.js.map
-ZipArchiveOutputStream.prototype._normalizeEntry = function(ae) {
- if (ae.getMethod() === -1) {
- ae.setMethod(constants.METHOD_DEFLATED);
- }
+/***/ }),
- if (ae.getMethod() === constants.METHOD_DEFLATED) {
- ae.getGeneralPurposeBit().useDataDescriptor(true);
- ae.setVersionNeededToExtract(constants.MIN_VERSION_DATA_DESCRIPTOR);
- }
+/***/ 11174:
+/***/ (function(module) {
- if (ae.getTime() === -1) {
- ae.setTime(new Date(), this._archive.forceLocalTime);
- }
+/**
+ * This file contains the Bottleneck library (MIT), compiled to ES2017, and without Clustering support.
+ * https://github.com/SGrondin/bottleneck
+ */
+(function (global, factory) {
+ true ? module.exports = factory() :
+ 0;
+}(this, (function () { 'use strict';
- ae._offsets = {
- file: 0,
- data: 0,
- contents: 0,
- };
-};
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
-ZipArchiveOutputStream.prototype._smartStream = function(ae, callback) {
- var deflate = ae.getMethod() === constants.METHOD_DEFLATED;
- var process = deflate ? new DeflateCRC32Stream(this.options.zlib) : new CRC32Stream();
- var error = null;
+ function getCjsExportFromNamespace (n) {
+ return n && n['default'] || n;
+ }
- function handleStuff() {
- var digest = process.digest().readUInt32BE(0);
- ae.setCrc(digest);
- ae.setSize(process.size());
- ae.setCompressedSize(process.size(true));
- this._afterAppend(ae);
- callback(error, ae);
- }
+ var load = function(received, defaults, onto = {}) {
+ var k, ref, v;
+ for (k in defaults) {
+ v = defaults[k];
+ onto[k] = (ref = received[k]) != null ? ref : v;
+ }
+ return onto;
+ };
- process.once('end', handleStuff.bind(this));
- process.once('error', function(err) {
- error = err;
- });
+ var overwrite = function(received, defaults, onto = {}) {
+ var k, v;
+ for (k in received) {
+ v = received[k];
+ if (defaults[k] !== void 0) {
+ onto[k] = v;
+ }
+ }
+ return onto;
+ };
- process.pipe(this, { end: false });
+ var parser = {
+ load: load,
+ overwrite: overwrite
+ };
- return process;
-};
+ var DLList;
-ZipArchiveOutputStream.prototype._writeCentralDirectoryEnd = function() {
- var records = this._entries.length;
- var size = this._archive.centralLength;
- var offset = this._archive.centralOffset;
+ DLList = class DLList {
+ constructor(incr, decr) {
+ this.incr = incr;
+ this.decr = decr;
+ this._first = null;
+ this._last = null;
+ this.length = 0;
+ }
- if (this.isZip64()) {
- records = constants.ZIP64_MAGIC_SHORT;
- size = constants.ZIP64_MAGIC;
- offset = constants.ZIP64_MAGIC;
- }
+ push(value) {
+ var node;
+ this.length++;
+ if (typeof this.incr === "function") {
+ this.incr();
+ }
+ node = {
+ value,
+ prev: this._last,
+ next: null
+ };
+ if (this._last != null) {
+ this._last.next = node;
+ this._last = node;
+ } else {
+ this._first = this._last = node;
+ }
+ return void 0;
+ }
- // signature
- this.write(zipUtil.getLongBytes(constants.SIG_EOCD));
+ shift() {
+ var value;
+ if (this._first == null) {
+ return;
+ } else {
+ this.length--;
+ if (typeof this.decr === "function") {
+ this.decr();
+ }
+ }
+ value = this._first.value;
+ if ((this._first = this._first.next) != null) {
+ this._first.prev = null;
+ } else {
+ this._last = null;
+ }
+ return value;
+ }
- // disk numbers
- this.write(constants.SHORT_ZERO);
- this.write(constants.SHORT_ZERO);
+ first() {
+ if (this._first != null) {
+ return this._first.value;
+ }
+ }
- // number of entries
- this.write(zipUtil.getShortBytes(records));
- this.write(zipUtil.getShortBytes(records));
+ getArray() {
+ var node, ref, results;
+ node = this._first;
+ results = [];
+ while (node != null) {
+ results.push((ref = node, node = node.next, ref.value));
+ }
+ return results;
+ }
- // length and location of CD
- this.write(zipUtil.getLongBytes(size));
- this.write(zipUtil.getLongBytes(offset));
+ forEachShift(cb) {
+ var node;
+ node = this.shift();
+ while (node != null) {
+ (cb(node), node = this.shift());
+ }
+ return void 0;
+ }
- // archive comment
- var comment = this.getComment();
- var commentLength = Buffer.byteLength(comment);
- this.write(zipUtil.getShortBytes(commentLength));
- this.write(comment);
-};
+ debug() {
+ var node, ref, ref1, ref2, results;
+ node = this._first;
+ results = [];
+ while (node != null) {
+ results.push((ref = node, node = node.next, {
+ value: ref.value,
+ prev: (ref1 = ref.prev) != null ? ref1.value : void 0,
+ next: (ref2 = ref.next) != null ? ref2.value : void 0
+ }));
+ }
+ return results;
+ }
-ZipArchiveOutputStream.prototype._writeCentralDirectoryZip64 = function() {
- // signature
- this.write(zipUtil.getLongBytes(constants.SIG_ZIP64_EOCD));
+ };
- // size of the ZIP64 EOCD record
- this.write(zipUtil.getEightBytes(44));
+ var DLList_1 = DLList;
- // version made by
- this.write(zipUtil.getShortBytes(constants.MIN_VERSION_ZIP64));
+ var Events;
- // version to extract
- this.write(zipUtil.getShortBytes(constants.MIN_VERSION_ZIP64));
+ Events = class Events {
+ constructor(instance) {
+ this.instance = instance;
+ this._events = {};
+ if ((this.instance.on != null) || (this.instance.once != null) || (this.instance.removeAllListeners != null)) {
+ throw new Error("An Emitter already exists for this object");
+ }
+ this.instance.on = (name, cb) => {
+ return this._addListener(name, "many", cb);
+ };
+ this.instance.once = (name, cb) => {
+ return this._addListener(name, "once", cb);
+ };
+ this.instance.removeAllListeners = (name = null) => {
+ if (name != null) {
+ return delete this._events[name];
+ } else {
+ return this._events = {};
+ }
+ };
+ }
- // disk numbers
- this.write(constants.LONG_ZERO);
- this.write(constants.LONG_ZERO);
+ _addListener(name, status, cb) {
+ var base;
+ if ((base = this._events)[name] == null) {
+ base[name] = [];
+ }
+ this._events[name].push({cb, status});
+ return this.instance;
+ }
- // number of entries
- this.write(zipUtil.getEightBytes(this._entries.length));
- this.write(zipUtil.getEightBytes(this._entries.length));
+ listenerCount(name) {
+ if (this._events[name] != null) {
+ return this._events[name].length;
+ } else {
+ return 0;
+ }
+ }
- // length and location of CD
- this.write(zipUtil.getEightBytes(this._archive.centralLength));
- this.write(zipUtil.getEightBytes(this._archive.centralOffset));
+ async trigger(name, ...args) {
+ var e, promises;
+ try {
+ if (name !== "debug") {
+ this.trigger("debug", `Event triggered: ${name}`, args);
+ }
+ if (this._events[name] == null) {
+ return;
+ }
+ this._events[name] = this._events[name].filter(function(listener) {
+ return listener.status !== "none";
+ });
+ promises = this._events[name].map(async(listener) => {
+ var e, returned;
+ if (listener.status === "none") {
+ return;
+ }
+ if (listener.status === "once") {
+ listener.status = "none";
+ }
+ try {
+ returned = typeof listener.cb === "function" ? listener.cb(...args) : void 0;
+ if (typeof (returned != null ? returned.then : void 0) === "function") {
+ return (await returned);
+ } else {
+ return returned;
+ }
+ } catch (error) {
+ e = error;
+ {
+ this.trigger("error", e);
+ }
+ return null;
+ }
+ });
+ return ((await Promise.all(promises))).find(function(x) {
+ return x != null;
+ });
+ } catch (error) {
+ e = error;
+ {
+ this.trigger("error", e);
+ }
+ return null;
+ }
+ }
- // extensible data sector
- // not implemented at this time
+ };
- // end of central directory locator
- this.write(zipUtil.getLongBytes(constants.SIG_ZIP64_EOCD_LOC));
+ var Events_1 = Events;
- // disk number holding the ZIP64 EOCD record
- this.write(constants.LONG_ZERO);
+ var DLList$1, Events$1, Queues;
- // relative offset of the ZIP64 EOCD record
- this.write(zipUtil.getEightBytes(this._archive.centralOffset + this._archive.centralLength));
+ DLList$1 = DLList_1;
- // total number of disks
- this.write(zipUtil.getLongBytes(1));
-};
+ Events$1 = Events_1;
+
+ Queues = class Queues {
+ constructor(num_priorities) {
+ var i;
+ this.Events = new Events$1(this);
+ this._length = 0;
+ this._lists = (function() {
+ var j, ref, results;
+ results = [];
+ for (i = j = 1, ref = num_priorities; (1 <= ref ? j <= ref : j >= ref); i = 1 <= ref ? ++j : --j) {
+ results.push(new DLList$1((() => {
+ return this.incr();
+ }), (() => {
+ return this.decr();
+ })));
+ }
+ return results;
+ }).call(this);
+ }
-ZipArchiveOutputStream.prototype._writeCentralFileHeader = function(ae) {
- var gpb = ae.getGeneralPurposeBit();
- var method = ae.getMethod();
- var fileOffset = ae._offsets.file;
+ incr() {
+ if (this._length++ === 0) {
+ return this.Events.trigger("leftzero");
+ }
+ }
- var size = ae.getSize();
- var compressedSize = ae.getCompressedSize();
+ decr() {
+ if (--this._length === 0) {
+ return this.Events.trigger("zero");
+ }
+ }
- if (ae.isZip64() || fileOffset > constants.ZIP64_MAGIC) {
- size = constants.ZIP64_MAGIC;
- compressedSize = constants.ZIP64_MAGIC;
- fileOffset = constants.ZIP64_MAGIC;
+ push(job) {
+ return this._lists[job.options.priority].push(job);
+ }
- ae.setVersionNeededToExtract(constants.MIN_VERSION_ZIP64);
+ queued(priority) {
+ if (priority != null) {
+ return this._lists[priority].length;
+ } else {
+ return this._length;
+ }
+ }
- var extraBuf = Buffer.concat([
- zipUtil.getShortBytes(constants.ZIP64_EXTRA_ID),
- zipUtil.getShortBytes(24),
- zipUtil.getEightBytes(ae.getSize()),
- zipUtil.getEightBytes(ae.getCompressedSize()),
- zipUtil.getEightBytes(ae._offsets.file)
- ], 28);
+ shiftAll(fn) {
+ return this._lists.forEach(function(list) {
+ return list.forEachShift(fn);
+ });
+ }
- ae.setExtra(extraBuf);
- }
+ getFirst(arr = this._lists) {
+ var j, len, list;
+ for (j = 0, len = arr.length; j < len; j++) {
+ list = arr[j];
+ if (list.length > 0) {
+ return list;
+ }
+ }
+ return [];
+ }
- // signature
- this.write(zipUtil.getLongBytes(constants.SIG_CFH));
+ shiftLastFrom(priority) {
+ return this.getFirst(this._lists.slice(priority).reverse()).shift();
+ }
- // version made by
- this.write(zipUtil.getShortBytes((ae.getPlatform() << 8) | constants.VERSION_MADEBY));
+ };
- // version to extract and general bit flag
- this.write(zipUtil.getShortBytes(ae.getVersionNeededToExtract()));
- this.write(gpb.encode());
+ var Queues_1 = Queues;
- // compression method
- this.write(zipUtil.getShortBytes(method));
+ var BottleneckError;
- // datetime
- this.write(zipUtil.getLongBytes(ae.getTimeDos()));
+ BottleneckError = class BottleneckError extends Error {};
- // crc32 checksum
- this.write(zipUtil.getLongBytes(ae.getCrc()));
+ var BottleneckError_1 = BottleneckError;
- // sizes
- this.write(zipUtil.getLongBytes(compressedSize));
- this.write(zipUtil.getLongBytes(size));
+ var BottleneckError$1, DEFAULT_PRIORITY, Job, NUM_PRIORITIES, parser$1;
- var name = ae.getName();
- var comment = ae.getComment();
- var extra = ae.getCentralDirectoryExtra();
+ NUM_PRIORITIES = 10;
- if (gpb.usesUTF8ForNames()) {
- name = Buffer.from(name);
- comment = Buffer.from(comment);
- }
+ DEFAULT_PRIORITY = 5;
- // name length
- this.write(zipUtil.getShortBytes(name.length));
+ parser$1 = parser;
- // extra length
- this.write(zipUtil.getShortBytes(extra.length));
+ BottleneckError$1 = BottleneckError_1;
- // comments length
- this.write(zipUtil.getShortBytes(comment.length));
+ Job = class Job {
+ constructor(task, args, options, jobDefaults, rejectOnDrop, Events, _states, Promise) {
+ this.task = task;
+ this.args = args;
+ this.rejectOnDrop = rejectOnDrop;
+ this.Events = Events;
+ this._states = _states;
+ this.Promise = Promise;
+ this.options = parser$1.load(options, jobDefaults);
+ this.options.priority = this._sanitizePriority(this.options.priority);
+ if (this.options.id === jobDefaults.id) {
+ this.options.id = `${this.options.id}-${this._randomIndex()}`;
+ }
+ this.promise = new this.Promise((_resolve, _reject) => {
+ this._resolve = _resolve;
+ this._reject = _reject;
+ });
+ this.retryCount = 0;
+ }
- // disk number start
- this.write(constants.SHORT_ZERO);
+ _sanitizePriority(priority) {
+ var sProperty;
+ sProperty = ~~priority !== priority ? DEFAULT_PRIORITY : priority;
+ if (sProperty < 0) {
+ return 0;
+ } else if (sProperty > NUM_PRIORITIES - 1) {
+ return NUM_PRIORITIES - 1;
+ } else {
+ return sProperty;
+ }
+ }
- // internal attributes
- this.write(zipUtil.getShortBytes(ae.getInternalAttributes()));
+ _randomIndex() {
+ return Math.random().toString(36).slice(2);
+ }
- // external attributes
- this.write(zipUtil.getLongBytes(ae.getExternalAttributes()));
+ doDrop({error, message = "This job has been dropped by Bottleneck"} = {}) {
+ if (this._states.remove(this.options.id)) {
+ if (this.rejectOnDrop) {
+ this._reject(error != null ? error : new BottleneckError$1(message));
+ }
+ this.Events.trigger("dropped", {args: this.args, options: this.options, task: this.task, promise: this.promise});
+ return true;
+ } else {
+ return false;
+ }
+ }
- // relative offset of LFH
- this.write(zipUtil.getLongBytes(fileOffset));
+ _assertStatus(expected) {
+ var status;
+ status = this._states.jobStatus(this.options.id);
+ if (!(status === expected || (expected === "DONE" && status === null))) {
+ throw new BottleneckError$1(`Invalid job status ${status}, expected ${expected}. Please open an issue at https://github.com/SGrondin/bottleneck/issues`);
+ }
+ }
- // name
- this.write(name);
+ doReceive() {
+ this._states.start(this.options.id);
+ return this.Events.trigger("received", {args: this.args, options: this.options});
+ }
- // extra
- this.write(extra);
+ doQueue(reachedHWM, blocked) {
+ this._assertStatus("RECEIVED");
+ this._states.next(this.options.id);
+ return this.Events.trigger("queued", {args: this.args, options: this.options, reachedHWM, blocked});
+ }
- // comment
- this.write(comment);
-};
+ doRun() {
+ if (this.retryCount === 0) {
+ this._assertStatus("QUEUED");
+ this._states.next(this.options.id);
+ } else {
+ this._assertStatus("EXECUTING");
+ }
+ return this.Events.trigger("scheduled", {args: this.args, options: this.options});
+ }
-ZipArchiveOutputStream.prototype._writeDataDescriptor = function(ae) {
- // signature
- this.write(zipUtil.getLongBytes(constants.SIG_DD));
+ async doExecute(chained, clearGlobalState, run, free) {
+ var error, eventInfo, passed;
+ if (this.retryCount === 0) {
+ this._assertStatus("RUNNING");
+ this._states.next(this.options.id);
+ } else {
+ this._assertStatus("EXECUTING");
+ }
+ eventInfo = {args: this.args, options: this.options, retryCount: this.retryCount};
+ this.Events.trigger("executing", eventInfo);
+ try {
+ passed = (await (chained != null ? chained.schedule(this.options, this.task, ...this.args) : this.task(...this.args)));
+ if (clearGlobalState()) {
+ this.doDone(eventInfo);
+ await free(this.options, eventInfo);
+ this._assertStatus("DONE");
+ return this._resolve(passed);
+ }
+ } catch (error1) {
+ error = error1;
+ return this._onFailure(error, eventInfo, clearGlobalState, run, free);
+ }
+ }
- // crc32 checksum
- this.write(zipUtil.getLongBytes(ae.getCrc()));
+ doExpire(clearGlobalState, run, free) {
+ var error, eventInfo;
+ if (this._states.jobStatus(this.options.id === "RUNNING")) {
+ this._states.next(this.options.id);
+ }
+ this._assertStatus("EXECUTING");
+ eventInfo = {args: this.args, options: this.options, retryCount: this.retryCount};
+ error = new BottleneckError$1(`This job timed out after ${this.options.expiration} ms.`);
+ return this._onFailure(error, eventInfo, clearGlobalState, run, free);
+ }
- // sizes
- if (ae.isZip64()) {
- this.write(zipUtil.getEightBytes(ae.getCompressedSize()));
- this.write(zipUtil.getEightBytes(ae.getSize()));
- } else {
- this.write(zipUtil.getLongBytes(ae.getCompressedSize()));
- this.write(zipUtil.getLongBytes(ae.getSize()));
- }
-};
+ async _onFailure(error, eventInfo, clearGlobalState, run, free) {
+ var retry, retryAfter;
+ if (clearGlobalState()) {
+ retry = (await this.Events.trigger("failed", error, eventInfo));
+ if (retry != null) {
+ retryAfter = ~~retry;
+ this.Events.trigger("retry", `Retrying ${this.options.id} after ${retryAfter} ms`, eventInfo);
+ this.retryCount++;
+ return run(retryAfter);
+ } else {
+ this.doDone(eventInfo);
+ await free(this.options, eventInfo);
+ this._assertStatus("DONE");
+ return this._reject(error);
+ }
+ }
+ }
-ZipArchiveOutputStream.prototype._writeLocalFileHeader = function(ae) {
- var gpb = ae.getGeneralPurposeBit();
- var method = ae.getMethod();
- var name = ae.getName();
- var extra = ae.getLocalFileDataExtra();
+ doDone(eventInfo) {
+ this._assertStatus("EXECUTING");
+ this._states.next(this.options.id);
+ return this.Events.trigger("done", eventInfo);
+ }
- if (ae.isZip64()) {
- gpb.useDataDescriptor(true);
- ae.setVersionNeededToExtract(constants.MIN_VERSION_ZIP64);
- }
+ };
- if (gpb.usesUTF8ForNames()) {
- name = Buffer.from(name);
- }
+ var Job_1 = Job;
- ae._offsets.file = this.offset;
+ var BottleneckError$2, LocalDatastore, parser$2;
- // signature
- this.write(zipUtil.getLongBytes(constants.SIG_LFH));
+ parser$2 = parser;
- // version to extract and general bit flag
- this.write(zipUtil.getShortBytes(ae.getVersionNeededToExtract()));
- this.write(gpb.encode());
+ BottleneckError$2 = BottleneckError_1;
- // compression method
- this.write(zipUtil.getShortBytes(method));
+ LocalDatastore = class LocalDatastore {
+ constructor(instance, storeOptions, storeInstanceOptions) {
+ this.instance = instance;
+ this.storeOptions = storeOptions;
+ this.clientId = this.instance._randomIndex();
+ parser$2.load(storeInstanceOptions, storeInstanceOptions, this);
+ this._nextRequest = this._lastReservoirRefresh = this._lastReservoirIncrease = Date.now();
+ this._running = 0;
+ this._done = 0;
+ this._unblockTime = 0;
+ this.ready = this.Promise.resolve();
+ this.clients = {};
+ this._startHeartbeat();
+ }
- // datetime
- this.write(zipUtil.getLongBytes(ae.getTimeDos()));
+ _startHeartbeat() {
+ var base;
+ if ((this.heartbeat == null) && (((this.storeOptions.reservoirRefreshInterval != null) && (this.storeOptions.reservoirRefreshAmount != null)) || ((this.storeOptions.reservoirIncreaseInterval != null) && (this.storeOptions.reservoirIncreaseAmount != null)))) {
+ return typeof (base = (this.heartbeat = setInterval(() => {
+ var amount, incr, maximum, now, reservoir;
+ now = Date.now();
+ if ((this.storeOptions.reservoirRefreshInterval != null) && now >= this._lastReservoirRefresh + this.storeOptions.reservoirRefreshInterval) {
+ this._lastReservoirRefresh = now;
+ this.storeOptions.reservoir = this.storeOptions.reservoirRefreshAmount;
+ this.instance._drainAll(this.computeCapacity());
+ }
+ if ((this.storeOptions.reservoirIncreaseInterval != null) && now >= this._lastReservoirIncrease + this.storeOptions.reservoirIncreaseInterval) {
+ ({
+ reservoirIncreaseAmount: amount,
+ reservoirIncreaseMaximum: maximum,
+ reservoir
+ } = this.storeOptions);
+ this._lastReservoirIncrease = now;
+ incr = maximum != null ? Math.min(amount, maximum - reservoir) : amount;
+ if (incr > 0) {
+ this.storeOptions.reservoir += incr;
+ return this.instance._drainAll(this.computeCapacity());
+ }
+ }
+ }, this.heartbeatInterval))).unref === "function" ? base.unref() : void 0;
+ } else {
+ return clearInterval(this.heartbeat);
+ }
+ }
- ae._offsets.data = this.offset;
+ async __publish__(message) {
+ await this.yieldLoop();
+ return this.instance.Events.trigger("message", message.toString());
+ }
- // crc32 checksum and sizes
- if (gpb.usesDataDescriptor()) {
- this.write(constants.LONG_ZERO);
- this.write(constants.LONG_ZERO);
- this.write(constants.LONG_ZERO);
- } else {
- this.write(zipUtil.getLongBytes(ae.getCrc()));
- this.write(zipUtil.getLongBytes(ae.getCompressedSize()));
- this.write(zipUtil.getLongBytes(ae.getSize()));
- }
+ async __disconnect__(flush) {
+ await this.yieldLoop();
+ clearInterval(this.heartbeat);
+ return this.Promise.resolve();
+ }
- // name length
- this.write(zipUtil.getShortBytes(name.length));
+ yieldLoop(t = 0) {
+ return new this.Promise(function(resolve, reject) {
+ return setTimeout(resolve, t);
+ });
+ }
- // extra length
- this.write(zipUtil.getShortBytes(extra.length));
+ computePenalty() {
+ var ref;
+ return (ref = this.storeOptions.penalty) != null ? ref : (15 * this.storeOptions.minTime) || 5000;
+ }
- // name
- this.write(name);
+ async __updateSettings__(options) {
+ await this.yieldLoop();
+ parser$2.overwrite(options, options, this.storeOptions);
+ this._startHeartbeat();
+ this.instance._drainAll(this.computeCapacity());
+ return true;
+ }
- // extra
- this.write(extra);
+ async __running__() {
+ await this.yieldLoop();
+ return this._running;
+ }
- ae._offsets.contents = this.offset;
-};
+ async __queued__() {
+ await this.yieldLoop();
+ return this.instance.queued();
+ }
-ZipArchiveOutputStream.prototype.getComment = function(comment) {
- return this._archive.comment !== null ? this._archive.comment : '';
-};
+ async __done__() {
+ await this.yieldLoop();
+ return this._done;
+ }
-ZipArchiveOutputStream.prototype.isZip64 = function() {
- return this._archive.forceZip64 || this._entries.length > constants.ZIP64_MAGIC_SHORT || this._archive.centralLength > constants.ZIP64_MAGIC || this._archive.centralOffset > constants.ZIP64_MAGIC;
-};
+ async __groupCheck__(time) {
+ await this.yieldLoop();
+ return (this._nextRequest + this.timeout) < time;
+ }
-ZipArchiveOutputStream.prototype.setComment = function(comment) {
- this._archive.comment = comment;
-};
+ computeCapacity() {
+ var maxConcurrent, reservoir;
+ ({maxConcurrent, reservoir} = this.storeOptions);
+ if ((maxConcurrent != null) && (reservoir != null)) {
+ return Math.min(maxConcurrent - this._running, reservoir);
+ } else if (maxConcurrent != null) {
+ return maxConcurrent - this._running;
+ } else if (reservoir != null) {
+ return reservoir;
+ } else {
+ return null;
+ }
+ }
+ conditionsCheck(weight) {
+ var capacity;
+ capacity = this.computeCapacity();
+ return (capacity == null) || weight <= capacity;
+ }
-/***/ }),
+ async __incrementReservoir__(incr) {
+ var reservoir;
+ await this.yieldLoop();
+ reservoir = this.storeOptions.reservoir += incr;
+ this.instance._drainAll(this.computeCapacity());
+ return reservoir;
+ }
-/***/ 25445:
-/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
+ async __currentReservoir__() {
+ await this.yieldLoop();
+ return this.storeOptions.reservoir;
+ }
-/**
- * node-compress-commons
- *
- * Copyright (c) 2014 Chris Talkington, contributors.
- * Licensed under the MIT license.
- * https://github.com/archiverjs/node-compress-commons/blob/master/LICENSE-MIT
- */
-module.exports = {
- ArchiveEntry: __nccwpck_require__(92240),
- ZipArchiveEntry: __nccwpck_require__(3179),
- ArchiveOutputStream: __nccwpck_require__(36728),
- ZipArchiveOutputStream: __nccwpck_require__(44432)
-};
+ isBlocked(now) {
+ return this._unblockTime >= now;
+ }
-/***/ }),
+ check(weight, now) {
+ return this.conditionsCheck(weight) && (this._nextRequest - now) <= 0;
+ }
-/***/ 95208:
-/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
+ async __check__(weight) {
+ var now;
+ await this.yieldLoop();
+ now = Date.now();
+ return this.check(weight, now);
+ }
-/**
- * node-compress-commons
- *
- * Copyright (c) 2014 Chris Talkington, contributors.
- * Licensed under the MIT license.
- * https://github.com/archiverjs/node-compress-commons/blob/master/LICENSE-MIT
- */
-var Stream = (__nccwpck_require__(12781).Stream);
-var PassThrough = (__nccwpck_require__(45193).PassThrough);
-var isStream = __nccwpck_require__(41554);
+ async __register__(index, weight, expiration) {
+ var now, wait;
+ await this.yieldLoop();
+ now = Date.now();
+ if (this.conditionsCheck(weight)) {
+ this._running += weight;
+ if (this.storeOptions.reservoir != null) {
+ this.storeOptions.reservoir -= weight;
+ }
+ wait = Math.max(this._nextRequest - now, 0);
+ this._nextRequest = now + wait + this.storeOptions.minTime;
+ return {
+ success: true,
+ wait,
+ reservoir: this.storeOptions.reservoir
+ };
+ } else {
+ return {
+ success: false
+ };
+ }
+ }
-var util = module.exports = {};
+ strategyIsBlock() {
+ return this.storeOptions.strategy === 3;
+ }
-util.normalizeInputSource = function(source) {
- if (source === null) {
- return Buffer.alloc(0);
- } else if (typeof source === 'string') {
- return Buffer.from(source);
- } else if (isStream(source) && !source._readableState) {
- var normalized = new PassThrough();
- source.pipe(normalized);
+ async __submit__(queueLength, weight) {
+ var blocked, now, reachedHWM;
+ await this.yieldLoop();
+ if ((this.storeOptions.maxConcurrent != null) && weight > this.storeOptions.maxConcurrent) {
+ throw new BottleneckError$2(`Impossible to add a job having a weight of ${weight} to a limiter having a maxConcurrent setting of ${this.storeOptions.maxConcurrent}`);
+ }
+ now = Date.now();
+ reachedHWM = (this.storeOptions.highWater != null) && queueLength === this.storeOptions.highWater && !this.check(weight, now);
+ blocked = this.strategyIsBlock() && (reachedHWM || this.isBlocked(now));
+ if (blocked) {
+ this._unblockTime = now + this.computePenalty();
+ this._nextRequest = this._unblockTime + this.storeOptions.minTime;
+ this.instance._dropAllQueued();
+ }
+ return {
+ reachedHWM,
+ blocked,
+ strategy: this.storeOptions.strategy
+ };
+ }
- return normalized;
- }
+ async __free__(index, weight) {
+ await this.yieldLoop();
+ this._running -= weight;
+ this._done += weight;
+ this.instance._drainAll(this.computeCapacity());
+ return {
+ running: this._running
+ };
+ }
- return source;
-};
+ };
-/***/ }),
+ var LocalDatastore_1 = LocalDatastore;
-/***/ 84322:
-/***/ ((__unused_webpack_module, exports) => {
+ var BottleneckError$3, States;
-"use strict";
+ BottleneckError$3 = BottleneckError_1;
-exports.__esModule = true;
-function binaryOperation(operator, left, right) {
- switch (operator) {
- case '+':
- return left + right;
- case '-':
- return left - right;
- case '/':
- return left / right;
- case '%':
- return left % right;
- case '*':
- return left * right;
- case '**':
- return Math.pow(left, right);
- case '&':
- return left & right;
- case '|':
- return left | right;
- case '>>':
- return left >> right;
- case '>>>':
- return left >>> right;
- case '<<':
- return left << right;
- case '^':
- return left ^ right;
- case '==':
- return left == right;
- case '===':
- return left === right;
- case '!=':
- return left != right;
- case '!==':
- return left !== right;
- case 'in':
- return left in right;
- case 'instanceof':
- return left instanceof right;
- case '>':
- return left > right;
- case '<':
- return left < right;
- case '>=':
- return left >= right;
- case '<=':
- return left <= right;
- }
-}
-exports["default"] = binaryOperation;
+ States = class States {
+ constructor(status1) {
+ this.status = status1;
+ this._jobs = {};
+ this.counts = this.status.map(function() {
+ return 0;
+ });
+ }
+ next(id) {
+ var current, next;
+ current = this._jobs[id];
+ next = current + 1;
+ if ((current != null) && next < this.status.length) {
+ this.counts[current]--;
+ this.counts[next]++;
+ return this._jobs[id]++;
+ } else if (current != null) {
+ this.counts[current]--;
+ return delete this._jobs[id];
+ }
+ }
-/***/ }),
+ start(id) {
+ var initial;
+ initial = 0;
+ this._jobs[id] = initial;
+ return this.counts[initial]++;
+ }
-/***/ 40953:
-/***/ ((module, exports, __nccwpck_require__) => {
+ remove(id) {
+ var current;
+ current = this._jobs[id];
+ if (current != null) {
+ this.counts[current]--;
+ delete this._jobs[id];
+ }
+ return current != null;
+ }
-"use strict";
+ jobStatus(id) {
+ var ref;
+ return (ref = this.status[this._jobs[id]]) != null ? ref : null;
+ }
-exports.__esModule = true;
-var parser_1 = __nccwpck_require__(85026);
-var b = __nccwpck_require__(7912);
-var binaryOperation_1 = __nccwpck_require__(84322);
-function expressionToConstant(expression, options) {
- if (options === void 0) { options = {}; }
- var constant = true;
- function toConstant(expression) {
- if (!constant)
- return;
- if (b.isArrayExpression(expression)) {
- var result_1 = [];
- for (var i = 0; constant && i < expression.elements.length; i++) {
- var element = expression.elements[i];
- if (b.isSpreadElement(element)) {
- var spread = toConstant(element.argument);
- if (!(isSpreadable(spread) && constant)) {
- constant = false;
- }
- else {
- result_1.push.apply(result_1, spread);
- }
- }
- else if (b.isExpression(element)) {
- result_1.push(toConstant(element));
- }
- else {
- constant = false;
- }
- }
- return result_1;
- }
- if (b.isBinaryExpression(expression)) {
- var left = toConstant(expression.left);
- var right = toConstant(expression.right);
- return constant && binaryOperation_1["default"](expression.operator, left, right);
- }
- if (b.isBooleanLiteral(expression)) {
- return expression.value;
- }
- if (b.isCallExpression(expression)) {
- var args = [];
- for (var i = 0; constant && i < expression.arguments.length; i++) {
- var arg = expression.arguments[i];
- if (b.isSpreadElement(arg)) {
- var spread = toConstant(arg.argument);
- if (!(isSpreadable(spread) && constant)) {
- constant = false;
- }
- else {
- args.push.apply(args, spread);
- }
- }
- else if (b.isExpression(arg)) {
- args.push(toConstant(arg));
- }
- else {
- constant = false;
- }
- }
- if (!constant)
- return;
- if (b.isMemberExpression(expression.callee)) {
- var object = toConstant(expression.callee.object);
- if (!object || !constant) {
- constant = false;
- return;
- }
- var member = expression.callee.computed
- ? toConstant(expression.callee.property)
- : b.isIdentifier(expression.callee.property)
- ? expression.callee.property.name
- : undefined;
- if (member === undefined && !expression.callee.computed) {
- constant = false;
- }
- if (!constant)
- return;
- if (canCallMethod(object, '' + member)) {
- return object[member].apply(object, args);
- }
- }
- else {
- if (!b.isExpression(expression.callee)) {
- constant = false;
- return;
- }
- var callee = toConstant(expression.callee);
- if (!constant)
- return;
- return callee.apply(null, args);
- }
- }
- if (b.isConditionalExpression(expression)) {
- var test = toConstant(expression.test);
- return test
- ? toConstant(expression.consequent)
- : toConstant(expression.alternate);
- }
- if (b.isIdentifier(expression)) {
- if (options.constants &&
- {}.hasOwnProperty.call(options.constants, expression.name)) {
- return options.constants[expression.name];
- }
- }
- if (b.isLogicalExpression(expression)) {
- var left = toConstant(expression.left);
- var right = toConstant(expression.right);
- if (constant && expression.operator === '&&') {
- return left && right;
- }
- if (constant && expression.operator === '||') {
- return left || right;
- }
- }
- if (b.isMemberExpression(expression)) {
- var object = toConstant(expression.object);
- if (!object || !constant) {
- constant = false;
- return;
- }
- var member = expression.computed
- ? toConstant(expression.property)
- : b.isIdentifier(expression.property)
- ? expression.property.name
- : undefined;
- if (member === undefined && !expression.computed) {
- constant = false;
- }
- if (!constant)
- return;
- if ({}.hasOwnProperty.call(object, '' + member) && member[0] !== '_') {
- return object[member];
- }
- }
- if (b.isNullLiteral(expression)) {
- return null;
- }
- if (b.isNumericLiteral(expression)) {
- return expression.value;
- }
- if (b.isObjectExpression(expression)) {
- var result_2 = {};
- for (var i = 0; constant && i < expression.properties.length; i++) {
- var property = expression.properties[i];
- if (b.isObjectProperty(property)) {
- if (property.shorthand) {
- constant = false;
- return;
- }
- var key = property.computed
- ? toConstant(property.key)
- : b.isIdentifier(property.key)
- ? property.key.name
- : b.isStringLiteral(property.key)
- ? property.key.value
- : undefined;
- if (!key || key[0] === '_') {
- constant = false;
- }
- if (!constant)
- return;
- if (b.isExpression(property.value)) {
- var value = toConstant(property.value);
- if (!constant)
- return;
- result_2[key] = value;
- }
- else {
- constant = false;
- }
- }
- else if (b.isObjectMethod(property)) {
- constant = false;
- }
- else if (b.isSpreadProperty(property)) {
- var argument = toConstant(property.argument);
- if (!argument)
- constant = false;
- if (!constant)
- return;
- Object.assign(result_2, argument);
- }
- }
- return result_2;
- }
- if (b.isParenthesizedExpression(expression)) {
- return toConstant(expression.expression);
- }
- if (b.isRegExpLiteral(expression)) {
- return new RegExp(expression.pattern, expression.flags);
- }
- if (b.isSequenceExpression(expression)) {
- for (var i = 0; i < expression.expressions.length - 1 && constant; i++) {
- toConstant(expression.expressions[i]);
- }
- return toConstant(expression.expressions[expression.expressions.length - 1]);
- }
- if (b.isStringLiteral(expression)) {
- return expression.value;
- }
- // TODO: TaggedTemplateExpression
- if (b.isTemplateLiteral(expression)) {
- var result_3 = '';
- for (var i = 0; i < expression.quasis.length; i++) {
- var quasi = expression.quasis[i];
- result_3 += quasi.value.cooked;
- if (i < expression.expressions.length) {
- result_3 += '' + toConstant(expression.expressions[i]);
- }
- }
- return result_3;
- }
- if (b.isUnaryExpression(expression)) {
- var argument = toConstant(expression.argument);
- if (!constant) {
- return;
- }
- switch (expression.operator) {
- case '-':
- return -argument;
- case '+':
- return +argument;
- case '!':
- return !argument;
- case '~':
- return ~argument;
- case 'typeof':
- return typeof argument;
- case 'void':
- return void argument;
- }
- }
- constant = false;
- }
- var result = toConstant(expression);
- return constant ? { constant: true, result: result } : { constant: false };
-}
-exports.expressionToConstant = expressionToConstant;
-function isSpreadable(value) {
- return (typeof value === 'string' ||
- Array.isArray(value) ||
- (typeof Set !== 'undefined' && value instanceof Set) ||
- (typeof Map !== 'undefined' && value instanceof Map));
-}
-function shallowEqual(a, b) {
- if (a === b)
- return true;
- if (a && b && typeof a === 'object' && typeof b === 'object') {
- for (var key in a) {
- if (a[key] !== b[key]) {
- return false;
- }
- }
- for (var key in b) {
- if (a[key] !== b[key]) {
- return false;
- }
- }
- return true;
- }
- return false;
-}
-function canCallMethod(object, member) {
- switch (typeof object) {
- case 'boolean':
- switch (member) {
- case 'toString':
- return true;
- default:
- return false;
- }
- case 'number':
- switch (member) {
- case 'toExponential':
- case 'toFixed':
- case 'toPrecision':
- case 'toString':
- return true;
- default:
- return false;
- }
- case 'string':
- switch (member) {
- case 'charAt':
- case 'charCodeAt':
- case 'codePointAt':
- case 'concat':
- case 'endsWith':
- case 'includes':
- case 'indexOf':
- case 'lastIndexOf':
- case 'match':
- case 'normalize':
- case 'padEnd':
- case 'padStart':
- case 'repeat':
- case 'replace':
- case 'search':
- case 'slice':
- case 'split':
- case 'startsWith':
- case 'substr':
- case 'substring':
- case 'toLowerCase':
- case 'toUpperCase':
- case 'trim':
- return true;
- default:
- return false;
- }
- default:
- if (object instanceof RegExp) {
- switch (member) {
- case 'test':
- case 'exec':
- return true;
- default:
- return false;
- }
- }
- return {}.hasOwnProperty.call(object, member) && member[0] !== '_';
- }
-}
-var EMPTY_OBJECT = {};
-var lastSrc = '';
-var lastConstants = EMPTY_OBJECT;
-var lastOptions = EMPTY_OBJECT;
-var lastResult = null;
-var lastWasConstant = false;
-function isConstant(src, constants, options) {
- if (constants === void 0) { constants = EMPTY_OBJECT; }
- if (options === void 0) { options = EMPTY_OBJECT; }
- if (lastSrc === src &&
- shallowEqual(lastConstants, constants) &&
- shallowEqual(lastOptions, options)) {
- return lastWasConstant;
- }
- lastSrc = src;
- lastConstants = constants;
- var ast;
- try {
- ast = parser_1.parseExpression(src, options);
- }
- catch (ex) {
- return (lastWasConstant = false);
- }
- var _a = expressionToConstant(ast, { constants: constants }), result = _a.result, constant = _a.constant;
- lastResult = result;
- return (lastWasConstant = constant);
-}
-exports.isConstant = isConstant;
-function toConstant(src, constants, options) {
- if (constants === void 0) { constants = EMPTY_OBJECT; }
- if (options === void 0) { options = EMPTY_OBJECT; }
- if (!isConstant(src, constants, options)) {
- throw new Error(JSON.stringify(src) + ' is not constant.');
- }
- return lastResult;
-}
-exports.toConstant = toConstant;
-exports["default"] = isConstant;
-module.exports = isConstant;
-module.exports["default"] = isConstant;
-module.exports.expressionToConstant = expressionToConstant;
-module.exports.isConstant = isConstant;
-module.exports.toConstant = toConstant;
+ statusJobs(status) {
+ var k, pos, ref, results, v;
+ if (status != null) {
+ pos = this.status.indexOf(status);
+ if (pos < 0) {
+ throw new BottleneckError$3(`status must be one of ${this.status.join(', ')}`);
+ }
+ ref = this._jobs;
+ results = [];
+ for (k in ref) {
+ v = ref[k];
+ if (v === pos) {
+ results.push(k);
+ }
+ }
+ return results;
+ } else {
+ return Object.keys(this._jobs);
+ }
+ }
+ statusCounts() {
+ return this.counts.reduce(((acc, v, i) => {
+ acc[this.status[i]] = v;
+ return acc;
+ }), {});
+ }
-/***/ }),
+ };
-/***/ 95898:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+ var States_1 = States;
-// 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.
+ var DLList$2, Sync;
-// NOTE: These type checking functions intentionally don't use `instanceof`
-// because it is fragile and can be easily faked with `Object.create()`.
+ DLList$2 = DLList_1;
-function isArray(arg) {
- if (Array.isArray) {
- return Array.isArray(arg);
- }
- return objectToString(arg) === '[object Array]';
-}
-exports.isArray = isArray;
+ Sync = class Sync {
+ constructor(name, Promise) {
+ this.schedule = this.schedule.bind(this);
+ this.name = name;
+ this.Promise = Promise;
+ this._running = 0;
+ this._queue = new DLList$2();
+ }
-function isBoolean(arg) {
- return typeof arg === 'boolean';
-}
-exports.isBoolean = isBoolean;
+ isEmpty() {
+ return this._queue.length === 0;
+ }
-function isNull(arg) {
- return arg === null;
-}
-exports.isNull = isNull;
+ async _tryToRun() {
+ var args, cb, error, reject, resolve, returned, task;
+ if ((this._running < 1) && this._queue.length > 0) {
+ this._running++;
+ ({task, args, resolve, reject} = this._queue.shift());
+ cb = (await (async function() {
+ try {
+ returned = (await task(...args));
+ return function() {
+ return resolve(returned);
+ };
+ } catch (error1) {
+ error = error1;
+ return function() {
+ return reject(error);
+ };
+ }
+ })());
+ this._running--;
+ this._tryToRun();
+ return cb();
+ }
+ }
-function isNullOrUndefined(arg) {
- return arg == null;
-}
-exports.isNullOrUndefined = isNullOrUndefined;
+ schedule(task, ...args) {
+ var promise, reject, resolve;
+ resolve = reject = null;
+ promise = new this.Promise(function(_resolve, _reject) {
+ resolve = _resolve;
+ return reject = _reject;
+ });
+ this._queue.push({task, args, resolve, reject});
+ this._tryToRun();
+ return promise;
+ }
-function isNumber(arg) {
- return typeof arg === 'number';
-}
-exports.isNumber = isNumber;
+ };
-function isString(arg) {
- return typeof arg === 'string';
-}
-exports.isString = isString;
+ var Sync_1 = Sync;
-function isSymbol(arg) {
- return typeof arg === 'symbol';
-}
-exports.isSymbol = isSymbol;
+ var version = "2.19.5";
+ var version$1 = {
+ version: version
+ };
-function isUndefined(arg) {
- return arg === void 0;
-}
-exports.isUndefined = isUndefined;
+ var version$2 = /*#__PURE__*/Object.freeze({
+ version: version,
+ default: version$1
+ });
-function isRegExp(re) {
- return objectToString(re) === '[object RegExp]';
-}
-exports.isRegExp = isRegExp;
+ var require$$2 = () => console.log('You must import the full version of Bottleneck in order to use this feature.');
-function isObject(arg) {
- return typeof arg === 'object' && arg !== null;
-}
-exports.isObject = isObject;
+ var require$$3 = () => console.log('You must import the full version of Bottleneck in order to use this feature.');
-function isDate(d) {
- return objectToString(d) === '[object Date]';
-}
-exports.isDate = isDate;
+ var require$$4 = () => console.log('You must import the full version of Bottleneck in order to use this feature.');
-function isError(e) {
- return (objectToString(e) === '[object Error]' || e instanceof Error);
-}
-exports.isError = isError;
+ var Events$2, Group, IORedisConnection$1, RedisConnection$1, Scripts$1, parser$3;
-function isFunction(arg) {
- return typeof arg === 'function';
-}
-exports.isFunction = isFunction;
+ parser$3 = parser;
-function isPrimitive(arg) {
- return arg === null ||
- typeof arg === 'boolean' ||
- typeof arg === 'number' ||
- typeof arg === 'string' ||
- typeof arg === 'symbol' || // ES6 symbol
- typeof arg === 'undefined';
-}
-exports.isPrimitive = isPrimitive;
+ Events$2 = Events_1;
-exports.isBuffer = __nccwpck_require__(14300).Buffer.isBuffer;
+ RedisConnection$1 = require$$2;
-function objectToString(o) {
- return Object.prototype.toString.call(o);
-}
+ IORedisConnection$1 = require$$3;
+ Scripts$1 = require$$4;
-/***/ }),
+ Group = (function() {
+ class Group {
+ constructor(limiterOptions = {}) {
+ this.deleteKey = this.deleteKey.bind(this);
+ this.limiterOptions = limiterOptions;
+ parser$3.load(this.limiterOptions, this.defaults, this);
+ this.Events = new Events$2(this);
+ this.instances = {};
+ this.Bottleneck = Bottleneck_1;
+ this._startAutoCleanup();
+ this.sharedConnection = this.connection != null;
+ if (this.connection == null) {
+ if (this.limiterOptions.datastore === "redis") {
+ this.connection = new RedisConnection$1(Object.assign({}, this.limiterOptions, {Events: this.Events}));
+ } else if (this.limiterOptions.datastore === "ioredis") {
+ this.connection = new IORedisConnection$1(Object.assign({}, this.limiterOptions, {Events: this.Events}));
+ }
+ }
+ }
-/***/ 83201:
-/***/ ((__unused_webpack_module, exports) => {
+ key(key = "") {
+ var ref;
+ return (ref = this.instances[key]) != null ? ref : (() => {
+ var limiter;
+ limiter = this.instances[key] = new this.Bottleneck(Object.assign(this.limiterOptions, {
+ id: `${this.id}-${key}`,
+ timeout: this.timeout,
+ connection: this.connection
+ }));
+ this.Events.trigger("created", limiter, key);
+ return limiter;
+ })();
+ }
-/*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com */
-/* vim: set ts=2: */
-/*exported CRC32 */
-var CRC32;
-(function (factory) {
- /*jshint ignore:start */
- /*eslint-disable */
- if(typeof DO_NOT_EXPORT_CRC === 'undefined') {
- if(true) {
- factory(exports);
- } else {}
- } else {
- factory(CRC32 = {});
- }
- /*eslint-enable */
- /*jshint ignore:end */
-}(function(CRC32) {
-CRC32.version = '1.2.2';
-/*global Int32Array */
-function signed_crc_table() {
- var c = 0, table = new Array(256);
+ async deleteKey(key = "") {
+ var deleted, instance;
+ instance = this.instances[key];
+ if (this.connection) {
+ deleted = (await this.connection.__runCommand__(['del', ...Scripts$1.allKeys(`${this.id}-${key}`)]));
+ }
+ if (instance != null) {
+ delete this.instances[key];
+ await instance.disconnect();
+ }
+ return (instance != null) || deleted > 0;
+ }
- for(var n =0; n != 256; ++n){
- c = n;
- c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));
- c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));
- c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));
- c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));
- c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));
- c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));
- c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));
- c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));
- table[n] = c;
- }
+ limiters() {
+ var k, ref, results, v;
+ ref = this.instances;
+ results = [];
+ for (k in ref) {
+ v = ref[k];
+ results.push({
+ key: k,
+ limiter: v
+ });
+ }
+ return results;
+ }
- return typeof Int32Array !== 'undefined' ? new Int32Array(table) : table;
-}
+ keys() {
+ return Object.keys(this.instances);
+ }
-var T0 = signed_crc_table();
-function slice_by_16_tables(T) {
- var c = 0, v = 0, n = 0, table = typeof Int32Array !== 'undefined' ? new Int32Array(4096) : new Array(4096) ;
+ async clusterKeys() {
+ var cursor, end, found, i, k, keys, len, next, start;
+ if (this.connection == null) {
+ return this.Promise.resolve(this.keys());
+ }
+ keys = [];
+ cursor = null;
+ start = `b_${this.id}-`.length;
+ end = "_settings".length;
+ while (cursor !== 0) {
+ [next, found] = (await this.connection.__runCommand__(["scan", cursor != null ? cursor : 0, "match", `b_${this.id}-*_settings`, "count", 10000]));
+ cursor = ~~next;
+ for (i = 0, len = found.length; i < len; i++) {
+ k = found[i];
+ keys.push(k.slice(start, -end));
+ }
+ }
+ return keys;
+ }
- for(n = 0; n != 256; ++n) table[n] = T[n];
- for(n = 0; n != 256; ++n) {
- v = T[n];
- for(c = 256 + n; c < 4096; c += 256) v = table[c] = (v >>> 8) ^ T[v & 0xFF];
- }
- var out = [];
- for(n = 1; n != 16; ++n) out[n - 1] = typeof Int32Array !== 'undefined' ? table.subarray(n * 256, n * 256 + 256) : table.slice(n * 256, n * 256 + 256);
- return out;
-}
-var TT = slice_by_16_tables(T0);
-var T1 = TT[0], T2 = TT[1], T3 = TT[2], T4 = TT[3], T5 = TT[4];
-var T6 = TT[5], T7 = TT[6], T8 = TT[7], T9 = TT[8], Ta = TT[9];
-var Tb = TT[10], Tc = TT[11], Td = TT[12], Te = TT[13], Tf = TT[14];
-function crc32_bstr(bstr, seed) {
- var C = seed ^ -1;
- for(var i = 0, L = bstr.length; i < L;) C = (C>>>8) ^ T0[(C^bstr.charCodeAt(i++))&0xFF];
- return ~C;
-}
+ _startAutoCleanup() {
+ var base;
+ clearInterval(this.interval);
+ return typeof (base = (this.interval = setInterval(async() => {
+ var e, k, ref, results, time, v;
+ time = Date.now();
+ ref = this.instances;
+ results = [];
+ for (k in ref) {
+ v = ref[k];
+ try {
+ if ((await v._store.__groupCheck__(time))) {
+ results.push(this.deleteKey(k));
+ } else {
+ results.push(void 0);
+ }
+ } catch (error) {
+ e = error;
+ results.push(v.Events.trigger("error", e));
+ }
+ }
+ return results;
+ }, this.timeout / 2))).unref === "function" ? base.unref() : void 0;
+ }
-function crc32_buf(B, seed) {
- var C = seed ^ -1, L = B.length - 15, i = 0;
- for(; i < L;) C =
- Tf[B[i++] ^ (C & 255)] ^
- Te[B[i++] ^ ((C >> 8) & 255)] ^
- Td[B[i++] ^ ((C >> 16) & 255)] ^
- Tc[B[i++] ^ (C >>> 24)] ^
- Tb[B[i++]] ^ Ta[B[i++]] ^ T9[B[i++]] ^ T8[B[i++]] ^
- T7[B[i++]] ^ T6[B[i++]] ^ T5[B[i++]] ^ T4[B[i++]] ^
- T3[B[i++]] ^ T2[B[i++]] ^ T1[B[i++]] ^ T0[B[i++]];
- L += 15;
- while(i < L) C = (C>>>8) ^ T0[(C^B[i++])&0xFF];
- return ~C;
-}
+ updateSettings(options = {}) {
+ parser$3.overwrite(options, this.defaults, this);
+ parser$3.overwrite(options, options, this.limiterOptions);
+ if (options.timeout != null) {
+ return this._startAutoCleanup();
+ }
+ }
-function crc32_str(str, seed) {
- var C = seed ^ -1;
- for(var i = 0, L = str.length, c = 0, d = 0; i < L;) {
- c = str.charCodeAt(i++);
- if(c < 0x80) {
- C = (C>>>8) ^ T0[(C^c)&0xFF];
- } else if(c < 0x800) {
- C = (C>>>8) ^ T0[(C ^ (192|((c>>6)&31)))&0xFF];
- C = (C>>>8) ^ T0[(C ^ (128|(c&63)))&0xFF];
- } else if(c >= 0xD800 && c < 0xE000) {
- c = (c&1023)+64; d = str.charCodeAt(i++)&1023;
- C = (C>>>8) ^ T0[(C ^ (240|((c>>8)&7)))&0xFF];
- C = (C>>>8) ^ T0[(C ^ (128|((c>>2)&63)))&0xFF];
- C = (C>>>8) ^ T0[(C ^ (128|((d>>6)&15)|((c&3)<<4)))&0xFF];
- C = (C>>>8) ^ T0[(C ^ (128|(d&63)))&0xFF];
- } else {
- C = (C>>>8) ^ T0[(C ^ (224|((c>>12)&15)))&0xFF];
- C = (C>>>8) ^ T0[(C ^ (128|((c>>6)&63)))&0xFF];
- C = (C>>>8) ^ T0[(C ^ (128|(c&63)))&0xFF];
- }
- }
- return ~C;
-}
-CRC32.table = T0;
-// $FlowIgnore
-CRC32.bstr = crc32_bstr;
-// $FlowIgnore
-CRC32.buf = crc32_buf;
-// $FlowIgnore
-CRC32.str = crc32_str;
-}));
+ disconnect(flush = true) {
+ var ref;
+ if (!this.sharedConnection) {
+ return (ref = this.connection) != null ? ref.disconnect(flush) : void 0;
+ }
+ }
+ }
+ Group.prototype.defaults = {
+ timeout: 1000 * 60 * 5,
+ connection: null,
+ Promise: Promise,
+ id: "group-key"
+ };
-/***/ }),
+ return Group;
-/***/ 94521:
-/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
+ }).call(commonjsGlobal);
-"use strict";
-/**
- * node-crc32-stream
- *
- * Copyright (c) 2014 Chris Talkington, contributors.
- * Licensed under the MIT license.
- * https://github.com/archiverjs/node-crc32-stream/blob/master/LICENSE-MIT
- */
+ var Group_1 = Group;
-
+ var Batcher, Events$3, parser$4;
-const {Transform} = __nccwpck_require__(45193);
+ parser$4 = parser;
-const crc32 = __nccwpck_require__(83201);
+ Events$3 = Events_1;
-class CRC32Stream extends Transform {
- constructor(options) {
- super(options);
- this.checksum = Buffer.allocUnsafe(4);
- this.checksum.writeInt32BE(0, 0);
+ Batcher = (function() {
+ class Batcher {
+ constructor(options = {}) {
+ this.options = options;
+ parser$4.load(this.options, this.defaults, this);
+ this.Events = new Events$3(this);
+ this._arr = [];
+ this._resetPromise();
+ this._lastFlush = Date.now();
+ }
- this.rawSize = 0;
- }
+ _resetPromise() {
+ return this._promise = new this.Promise((res, rej) => {
+ return this._resolve = res;
+ });
+ }
- _transform(chunk, encoding, callback) {
- if (chunk) {
- this.checksum = crc32.buf(chunk, this.checksum) >>> 0;
- this.rawSize += chunk.length;
- }
+ _flush() {
+ clearTimeout(this._timeout);
+ this._lastFlush = Date.now();
+ this._resolve();
+ this.Events.trigger("batch", this._arr);
+ this._arr = [];
+ return this._resetPromise();
+ }
- callback(null, chunk);
- }
+ add(data) {
+ var ret;
+ this._arr.push(data);
+ ret = this._promise;
+ if (this._arr.length === this.maxSize) {
+ this._flush();
+ } else if ((this.maxTime != null) && this._arr.length === 1) {
+ this._timeout = setTimeout(() => {
+ return this._flush();
+ }, this.maxTime);
+ }
+ return ret;
+ }
- digest(encoding) {
- const checksum = Buffer.allocUnsafe(4);
- checksum.writeUInt32BE(this.checksum >>> 0, 0);
- return encoding ? checksum.toString(encoding) : checksum;
- }
+ }
+ Batcher.prototype.defaults = {
+ maxTime: null,
+ maxSize: null,
+ Promise: Promise
+ };
- hex() {
- return this.digest('hex').toUpperCase();
- }
+ return Batcher;
- size() {
- return this.rawSize;
- }
-}
+ }).call(commonjsGlobal);
-module.exports = CRC32Stream;
+ var Batcher_1 = Batcher;
+ var require$$4$1 = () => console.log('You must import the full version of Bottleneck in order to use this feature.');
-/***/ }),
+ var require$$8 = getCjsExportFromNamespace(version$2);
-/***/ 92563:
-/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
+ var Bottleneck, DEFAULT_PRIORITY$1, Events$4, Job$1, LocalDatastore$1, NUM_PRIORITIES$1, Queues$1, RedisDatastore$1, States$1, Sync$1, parser$5,
+ splice = [].splice;
-"use strict";
-/**
- * node-crc32-stream
- *
- * Copyright (c) 2014 Chris Talkington, contributors.
- * Licensed under the MIT license.
- * https://github.com/archiverjs/node-crc32-stream/blob/master/LICENSE-MIT
- */
+ NUM_PRIORITIES$1 = 10;
+ DEFAULT_PRIORITY$1 = 5;
+ parser$5 = parser;
-const {DeflateRaw} = __nccwpck_require__(59796);
+ Queues$1 = Queues_1;
-const crc32 = __nccwpck_require__(83201);
+ Job$1 = Job_1;
-class DeflateCRC32Stream extends DeflateRaw {
- constructor(options) {
- super(options);
+ LocalDatastore$1 = LocalDatastore_1;
- this.checksum = Buffer.allocUnsafe(4);
- this.checksum.writeInt32BE(0, 0);
+ RedisDatastore$1 = require$$4$1;
- this.rawSize = 0;
- this.compressedSize = 0;
- }
+ Events$4 = Events_1;
- push(chunk, encoding) {
- if (chunk) {
- this.compressedSize += chunk.length;
- }
+ States$1 = States_1;
- return super.push(chunk, encoding);
- }
+ Sync$1 = Sync_1;
- _transform(chunk, encoding, callback) {
- if (chunk) {
- this.checksum = crc32.buf(chunk, this.checksum) >>> 0;
- this.rawSize += chunk.length;
- }
+ Bottleneck = (function() {
+ class Bottleneck {
+ constructor(options = {}, ...invalid) {
+ var storeInstanceOptions, storeOptions;
+ this._addToQueue = this._addToQueue.bind(this);
+ this._validateOptions(options, invalid);
+ parser$5.load(options, this.instanceDefaults, this);
+ this._queues = new Queues$1(NUM_PRIORITIES$1);
+ this._scheduled = {};
+ this._states = new States$1(["RECEIVED", "QUEUED", "RUNNING", "EXECUTING"].concat(this.trackDoneStatus ? ["DONE"] : []));
+ this._limiter = null;
+ this.Events = new Events$4(this);
+ this._submitLock = new Sync$1("submit", this.Promise);
+ this._registerLock = new Sync$1("register", this.Promise);
+ storeOptions = parser$5.load(options, this.storeDefaults, {});
+ this._store = (function() {
+ if (this.datastore === "redis" || this.datastore === "ioredis" || (this.connection != null)) {
+ storeInstanceOptions = parser$5.load(options, this.redisStoreDefaults, {});
+ return new RedisDatastore$1(this, storeOptions, storeInstanceOptions);
+ } else if (this.datastore === "local") {
+ storeInstanceOptions = parser$5.load(options, this.localStoreDefaults, {});
+ return new LocalDatastore$1(this, storeOptions, storeInstanceOptions);
+ } else {
+ throw new Bottleneck.prototype.BottleneckError(`Invalid datastore type: ${this.datastore}`);
+ }
+ }).call(this);
+ this._queues.on("leftzero", () => {
+ var ref;
+ return (ref = this._store.heartbeat) != null ? typeof ref.ref === "function" ? ref.ref() : void 0 : void 0;
+ });
+ this._queues.on("zero", () => {
+ var ref;
+ return (ref = this._store.heartbeat) != null ? typeof ref.unref === "function" ? ref.unref() : void 0 : void 0;
+ });
+ }
- super._transform(chunk, encoding, callback)
- }
+ _validateOptions(options, invalid) {
+ if (!((options != null) && typeof options === "object" && invalid.length === 0)) {
+ throw new Bottleneck.prototype.BottleneckError("Bottleneck v2 takes a single object argument. Refer to https://github.com/SGrondin/bottleneck#upgrading-to-v2 if you're upgrading from Bottleneck v1.");
+ }
+ }
- digest(encoding) {
- const checksum = Buffer.allocUnsafe(4);
- checksum.writeUInt32BE(this.checksum >>> 0, 0);
- return encoding ? checksum.toString(encoding) : checksum;
- }
+ ready() {
+ return this._store.ready;
+ }
- hex() {
- return this.digest('hex').toUpperCase();
- }
+ clients() {
+ return this._store.clients;
+ }
- size(compressed = false) {
- if (compressed) {
- return this.compressedSize;
- } else {
- return this.rawSize;
- }
- }
-}
+ channel() {
+ return `b_${this.id}`;
+ }
-module.exports = DeflateCRC32Stream;
+ channel_client() {
+ return `b_${this.id}_${this._store.clientId}`;
+ }
+ publish(message) {
+ return this._store.__publish__(message);
+ }
-/***/ }),
+ disconnect(flush = true) {
+ return this._store.__disconnect__(flush);
+ }
-/***/ 5101:
-/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
+ chain(_limiter) {
+ this._limiter = _limiter;
+ return this;
+ }
-"use strict";
-/**
- * node-crc32-stream
- *
- * Copyright (c) 2014 Chris Talkington, contributors.
- * Licensed under the MIT license.
- * https://github.com/archiverjs/node-crc32-stream/blob/master/LICENSE-MIT
- */
+ queued(priority) {
+ return this._queues.queued(priority);
+ }
+ clusterQueued() {
+ return this._store.__queued__();
+ }
+ empty() {
+ return this.queued() === 0 && this._submitLock.isEmpty();
+ }
-module.exports = {
- CRC32Stream: __nccwpck_require__(94521),
- DeflateCRC32Stream: __nccwpck_require__(92563)
-}
+ running() {
+ return this._store.__running__();
+ }
+ done() {
+ return this._store.__done__();
+ }
-/***/ }),
+ jobStatus(id) {
+ return this._states.jobStatus(id);
+ }
-/***/ 72746:
-/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
+ jobs(status) {
+ return this._states.statusJobs(status);
+ }
-"use strict";
+ counts() {
+ return this._states.statusCounts();
+ }
+ _randomIndex() {
+ return Math.random().toString(36).slice(2);
+ }
-const cp = __nccwpck_require__(32081);
-const parse = __nccwpck_require__(66855);
-const enoent = __nccwpck_require__(44101);
+ check(weight = 1) {
+ return this._store.__check__(weight);
+ }
-function spawn(command, args, options) {
- // Parse the arguments
- const parsed = parse(command, args, options);
+ _clearGlobalState(index) {
+ if (this._scheduled[index] != null) {
+ clearTimeout(this._scheduled[index].expiration);
+ delete this._scheduled[index];
+ return true;
+ } else {
+ return false;
+ }
+ }
- // Spawn the child process
- const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
+ async _free(index, job, options, eventInfo) {
+ var e, running;
+ try {
+ ({running} = (await this._store.__free__(index, options.weight)));
+ this.Events.trigger("debug", `Freed ${options.id}`, eventInfo);
+ if (running === 0 && this.empty()) {
+ return this.Events.trigger("idle");
+ }
+ } catch (error1) {
+ e = error1;
+ return this.Events.trigger("error", e);
+ }
+ }
- // 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
- enoent.hookChildProcess(spawned, parsed);
+ _run(index, job, wait) {
+ var clearGlobalState, free, run;
+ job.doRun();
+ clearGlobalState = this._clearGlobalState.bind(this, index);
+ run = this._run.bind(this, index, job);
+ free = this._free.bind(this, index, job);
+ return this._scheduled[index] = {
+ timeout: setTimeout(() => {
+ return job.doExecute(this._limiter, clearGlobalState, run, free);
+ }, wait),
+ expiration: job.options.expiration != null ? setTimeout(function() {
+ return job.doExpire(clearGlobalState, run, free);
+ }, wait + job.options.expiration) : void 0,
+ job: job
+ };
+ }
- return spawned;
-}
+ _drainOne(capacity) {
+ return this._registerLock.schedule(() => {
+ var args, index, next, options, queue;
+ if (this.queued() === 0) {
+ return this.Promise.resolve(null);
+ }
+ queue = this._queues.getFirst();
+ ({options, args} = next = queue.first());
+ if ((capacity != null) && options.weight > capacity) {
+ return this.Promise.resolve(null);
+ }
+ this.Events.trigger("debug", `Draining ${options.id}`, {args, options});
+ index = this._randomIndex();
+ return this._store.__register__(index, options.weight, options.expiration).then(({success, wait, reservoir}) => {
+ var empty;
+ this.Events.trigger("debug", `Drained ${options.id}`, {success, args, options});
+ if (success) {
+ queue.shift();
+ empty = this.empty();
+ if (empty) {
+ this.Events.trigger("empty");
+ }
+ if (reservoir === 0) {
+ this.Events.trigger("depleted", empty);
+ }
+ this._run(index, next, wait);
+ return this.Promise.resolve(options.weight);
+ } else {
+ return this.Promise.resolve(null);
+ }
+ });
+ });
+ }
-function spawnSync(command, args, options) {
- // Parse the arguments
- const parsed = parse(command, args, options);
+ _drainAll(capacity, total = 0) {
+ return this._drainOne(capacity).then((drained) => {
+ var newCapacity;
+ if (drained != null) {
+ newCapacity = capacity != null ? capacity - drained : capacity;
+ return this._drainAll(newCapacity, total + drained);
+ } else {
+ return this.Promise.resolve(total);
+ }
+ }).catch((e) => {
+ return this.Events.trigger("error", e);
+ });
+ }
- // Spawn the child process
- const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
+ _dropAllQueued(message) {
+ return this._queues.shiftAll(function(job) {
+ return job.doDrop({message});
+ });
+ }
- // Analyze if the command does not exist, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16
- result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
+ stop(options = {}) {
+ var done, waitForExecuting;
+ options = parser$5.load(options, this.stopDefaults);
+ waitForExecuting = (at) => {
+ var finished;
+ finished = () => {
+ var counts;
+ counts = this._states.counts;
+ return (counts[0] + counts[1] + counts[2] + counts[3]) === at;
+ };
+ return new this.Promise((resolve, reject) => {
+ if (finished()) {
+ return resolve();
+ } else {
+ return this.on("done", () => {
+ if (finished()) {
+ this.removeAllListeners("done");
+ return resolve();
+ }
+ });
+ }
+ });
+ };
+ done = options.dropWaitingJobs ? (this._run = function(index, next) {
+ return next.doDrop({
+ message: options.dropErrorMessage
+ });
+ }, this._drainOne = () => {
+ return this.Promise.resolve(null);
+ }, this._registerLock.schedule(() => {
+ return this._submitLock.schedule(() => {
+ var k, ref, v;
+ ref = this._scheduled;
+ for (k in ref) {
+ v = ref[k];
+ if (this.jobStatus(v.job.options.id) === "RUNNING") {
+ clearTimeout(v.timeout);
+ clearTimeout(v.expiration);
+ v.job.doDrop({
+ message: options.dropErrorMessage
+ });
+ }
+ }
+ this._dropAllQueued(options.dropErrorMessage);
+ return waitForExecuting(0);
+ });
+ })) : this.schedule({
+ priority: NUM_PRIORITIES$1 - 1,
+ weight: 0
+ }, () => {
+ return waitForExecuting(1);
+ });
+ this._receive = function(job) {
+ return job._reject(new Bottleneck.prototype.BottleneckError(options.enqueueErrorMessage));
+ };
+ this.stop = () => {
+ return this.Promise.reject(new Bottleneck.prototype.BottleneckError("stop() has already been called"));
+ };
+ return done;
+ }
- return result;
-}
+ async _addToQueue(job) {
+ var args, blocked, error, options, reachedHWM, shifted, strategy;
+ ({args, options} = job);
+ try {
+ ({reachedHWM, blocked, strategy} = (await this._store.__submit__(this.queued(), options.weight)));
+ } catch (error1) {
+ error = error1;
+ this.Events.trigger("debug", `Could not queue ${options.id}`, {args, options, error});
+ job.doDrop({error});
+ return false;
+ }
+ if (blocked) {
+ job.doDrop();
+ return true;
+ } else if (reachedHWM) {
+ shifted = strategy === Bottleneck.prototype.strategy.LEAK ? this._queues.shiftLastFrom(options.priority) : strategy === Bottleneck.prototype.strategy.OVERFLOW_PRIORITY ? this._queues.shiftLastFrom(options.priority + 1) : strategy === Bottleneck.prototype.strategy.OVERFLOW ? job : void 0;
+ if (shifted != null) {
+ shifted.doDrop();
+ }
+ if ((shifted == null) || strategy === Bottleneck.prototype.strategy.OVERFLOW) {
+ if (shifted == null) {
+ job.doDrop();
+ }
+ return reachedHWM;
+ }
+ }
+ job.doQueue(reachedHWM, blocked);
+ this._queues.push(job);
+ await this._drainAll();
+ return reachedHWM;
+ }
-module.exports = spawn;
-module.exports.spawn = spawn;
-module.exports.sync = spawnSync;
+ _receive(job) {
+ if (this._states.jobStatus(job.options.id) != null) {
+ job._reject(new Bottleneck.prototype.BottleneckError(`A job with the same id already exists (id=${job.options.id})`));
+ return false;
+ } else {
+ job.doReceive();
+ return this._submitLock.schedule(this._addToQueue, job);
+ }
+ }
-module.exports._parse = parse;
-module.exports._enoent = enoent;
+ submit(...args) {
+ var cb, fn, job, options, ref, ref1, task;
+ if (typeof args[0] === "function") {
+ ref = args, [fn, ...args] = ref, [cb] = splice.call(args, -1);
+ options = parser$5.load({}, this.jobDefaults);
+ } else {
+ ref1 = args, [options, fn, ...args] = ref1, [cb] = splice.call(args, -1);
+ options = parser$5.load(options, this.jobDefaults);
+ }
+ task = (...args) => {
+ return new this.Promise(function(resolve, reject) {
+ return fn(...args, function(...args) {
+ return (args[0] != null ? reject : resolve)(args);
+ });
+ });
+ };
+ job = new Job$1(task, args, options, this.jobDefaults, this.rejectOnDrop, this.Events, this._states, this.Promise);
+ job.promise.then(function(args) {
+ return typeof cb === "function" ? cb(...args) : void 0;
+ }).catch(function(args) {
+ if (Array.isArray(args)) {
+ return typeof cb === "function" ? cb(...args) : void 0;
+ } else {
+ return typeof cb === "function" ? cb(args) : void 0;
+ }
+ });
+ return this._receive(job);
+ }
+ schedule(...args) {
+ var job, options, task;
+ if (typeof args[0] === "function") {
+ [task, ...args] = args;
+ options = {};
+ } else {
+ [options, task, ...args] = args;
+ }
+ job = new Job$1(task, args, options, this.jobDefaults, this.rejectOnDrop, this.Events, this._states, this.Promise);
+ this._receive(job);
+ return job.promise;
+ }
-/***/ }),
+ wrap(fn) {
+ var schedule, wrapped;
+ schedule = this.schedule.bind(this);
+ wrapped = function(...args) {
+ return schedule(fn.bind(this), ...args);
+ };
+ wrapped.withOptions = function(options, ...args) {
+ return schedule(options, fn, ...args);
+ };
+ return wrapped;
+ }
-/***/ 44101:
-/***/ ((module) => {
+ async updateSettings(options = {}) {
+ await this._store.__updateSettings__(parser$5.overwrite(options, this.storeDefaults));
+ parser$5.overwrite(options, this.instanceDefaults, this);
+ return this;
+ }
-"use strict";
+ currentReservoir() {
+ return this._store.__currentReservoir__();
+ }
+ incrementReservoir(incr = 0) {
+ return this._store.__incrementReservoir__(incr);
+ }
-const isWin = process.platform === 'win32';
+ }
+ Bottleneck.default = Bottleneck;
-function 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,
- });
-}
+ Bottleneck.Events = Events$4;
-function hookChildProcess(cp, parsed) {
- if (!isWin) {
- return;
- }
+ Bottleneck.version = Bottleneck.prototype.version = require$$8.version;
- const originalEmit = cp.emit;
+ Bottleneck.strategy = Bottleneck.prototype.strategy = {
+ LEAK: 1,
+ OVERFLOW: 2,
+ OVERFLOW_PRIORITY: 4,
+ BLOCK: 3
+ };
+
+ Bottleneck.BottleneckError = Bottleneck.prototype.BottleneckError = BottleneckError_1;
+
+ Bottleneck.Group = Bottleneck.prototype.Group = Group_1;
+
+ Bottleneck.RedisConnection = Bottleneck.prototype.RedisConnection = require$$2;
+
+ Bottleneck.IORedisConnection = Bottleneck.prototype.IORedisConnection = require$$3;
+
+ Bottleneck.Batcher = Bottleneck.prototype.Batcher = Batcher_1;
+
+ Bottleneck.prototype.jobDefaults = {
+ priority: DEFAULT_PRIORITY$1,
+ weight: 1,
+ expiration: null,
+ id: ""
+ };
+
+ Bottleneck.prototype.storeDefaults = {
+ maxConcurrent: null,
+ minTime: 0,
+ highWater: null,
+ strategy: Bottleneck.prototype.strategy.LEAK,
+ penalty: null,
+ reservoir: null,
+ reservoirRefreshInterval: null,
+ reservoirRefreshAmount: null,
+ reservoirIncreaseInterval: null,
+ reservoirIncreaseAmount: null,
+ reservoirIncreaseMaximum: null
+ };
+
+ Bottleneck.prototype.localStoreDefaults = {
+ Promise: Promise,
+ timeout: null,
+ heartbeatInterval: 250
+ };
+
+ Bottleneck.prototype.redisStoreDefaults = {
+ Promise: Promise,
+ timeout: null,
+ heartbeatInterval: 5000,
+ clientTimeout: 10000,
+ Redis: null,
+ clientOptions: {},
+ clusterNodes: null,
+ clearDatastore: false,
+ connection: null
+ };
- 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 = verifyENOENT(arg1, parsed, 'spawn');
+ Bottleneck.prototype.instanceDefaults = {
+ datastore: "local",
+ connection: null,
+ id: "",
+ rejectOnDrop: true,
+ trackDoneStatus: false,
+ Promise: Promise
+ };
- if (err) {
- return originalEmit.call(cp, 'error', err);
- }
- }
+ Bottleneck.prototype.stopDefaults = {
+ enqueueErrorMessage: "This limiter has been stopped and cannot accept new jobs.",
+ dropWaitingJobs: true,
+ dropErrorMessage: "This limiter has been stopped."
+ };
- return originalEmit.apply(cp, arguments); // eslint-disable-line prefer-rest-params
- };
-}
+ return Bottleneck;
-function verifyENOENT(status, parsed) {
- if (isWin && status === 1 && !parsed.file) {
- return notFoundError(parsed.original, 'spawn');
- }
+ }).call(commonjsGlobal);
- return null;
-}
+ var Bottleneck_1 = Bottleneck;
-function verifyENOENTSync(status, parsed) {
- if (isWin && status === 1 && !parsed.file) {
- return notFoundError(parsed.original, 'spawnSync');
- }
+ var lib = Bottleneck_1;
- return null;
-}
+ return lib;
-module.exports = {
- hookChildProcess,
- verifyENOENT,
- verifyENOENTSync,
- notFoundError,
-};
+})));
/***/ }),
-/***/ 66855:
+/***/ 33717:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
-"use strict";
-
-
-const path = __nccwpck_require__(71017);
-const resolveCommand = __nccwpck_require__(87274);
-const escape = __nccwpck_require__(34274);
-const readShebang = __nccwpck_require__(41252);
-
-const isWin = process.platform === 'win32';
-const isExecutableRegExp = /\.(?:com|exe)$/i;
-const isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
-
-function detectShebang(parsed) {
- parsed.file = resolveCommand(parsed);
+var balanced = __nccwpck_require__(9417);
- const shebang = parsed.file && readShebang(parsed.file);
+module.exports = expandTop;
- if (shebang) {
- parsed.args.unshift(parsed.file);
- parsed.command = shebang;
+var escSlash = '\0SLASH'+Math.random()+'\0';
+var escOpen = '\0OPEN'+Math.random()+'\0';
+var escClose = '\0CLOSE'+Math.random()+'\0';
+var escComma = '\0COMMA'+Math.random()+'\0';
+var escPeriod = '\0PERIOD'+Math.random()+'\0';
- return resolveCommand(parsed);
- }
+function numeric(str) {
+ return parseInt(str, 10) == str
+ ? parseInt(str, 10)
+ : str.charCodeAt(0);
+}
- return parsed.file;
+function escapeBraces(str) {
+ return str.split('\\\\').join(escSlash)
+ .split('\\{').join(escOpen)
+ .split('\\}').join(escClose)
+ .split('\\,').join(escComma)
+ .split('\\.').join(escPeriod);
}
-function parseNonShell(parsed) {
- if (!isWin) {
- return parsed;
- }
+function unescapeBraces(str) {
+ return str.split(escSlash).join('\\')
+ .split(escOpen).join('{')
+ .split(escClose).join('}')
+ .split(escComma).join(',')
+ .split(escPeriod).join('.');
+}
- // Detect & add support for shebangs
- const commandFile = detectShebang(parsed);
- // We don't need a shell if the command filename is an executable
- const needsShell = !isExecutableRegExp.test(commandFile);
+// Basically just str.split(","), but handling cases
+// where we have nested braced sections, which should be
+// treated as individual members, like {a,{b,c},d}
+function parseCommaParts(str) {
+ if (!str)
+ return [''];
- // 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 = isCmdShimRegExp.test(commandFile);
+ var parts = [];
+ var m = balanced('{', '}', str);
- // 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 = path.normalize(parsed.command);
+ if (!m)
+ return str.split(',');
- // Escape command & arguments
- parsed.command = escape.command(parsed.command);
- parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
+ var pre = m.pre;
+ var body = m.body;
+ var post = m.post;
+ var p = pre.split(',');
- const shellCommand = [parsed.command].concat(parsed.args).join(' ');
+ p[p.length-1] += '{' + body + '}';
+ var postParts = parseCommaParts(post);
+ if (post.length) {
+ p[p.length-1] += postParts.shift();
+ p.push.apply(p, postParts);
+ }
- 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
- }
+ parts.push.apply(parts, p);
- return parsed;
+ return parts;
}
-function 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
+function expandTop(str) {
+ if (!str)
+ return [];
- // Build our parsed object
- const parsed = {
- command,
- args,
- options,
- file: undefined,
- original: {
- command,
- args,
- },
- };
+ // I don't know why Bash 4.3 does this, but it does.
+ // Anything starting with {} will have the first two bytes preserved
+ // but *only* at the top level, so {},a}b will not expand to anything,
+ // but a{},b}c will be expanded to [a}c,abc].
+ // One could argue that this is a bug in Bash, but since the goal of
+ // this module is to match Bash's rules, we escape a leading {}
+ if (str.substr(0, 2) === '{}') {
+ str = '\\{\\}' + str.substr(2);
+ }
- // Delegate further parsing to shell or non-shell
- return options.shell ? parsed : parseNonShell(parsed);
+ return expand(escapeBraces(str), true).map(unescapeBraces);
}
-module.exports = parse;
-
-
-/***/ }),
-
-/***/ 34274:
-/***/ ((module) => {
-
-"use strict";
+function embrace(str) {
+ return '{' + str + '}';
+}
+function isPadded(el) {
+ return /^-?0\d/.test(el);
+}
+function lte(i, y) {
+ return i <= y;
+}
+function gte(i, y) {
+ return i >= y;
+}
-// See http://www.robvanderwoude.com/escapechars.php
-const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
+function expand(str, isTop) {
+ var expansions = [];
-function escapeCommand(arg) {
- // Escape meta chars
- arg = arg.replace(metaCharsRegExp, '^$1');
+ var m = balanced('{', '}', str);
+ if (!m) return [str];
- return arg;
-}
+ // no need to expand pre, since it is guaranteed to be free of brace-sets
+ var pre = m.pre;
+ var post = m.post.length
+ ? expand(m.post, false)
+ : [''];
-function escapeArgument(arg, doubleEscapeMetaChars) {
- // Convert to string
- arg = `${arg}`;
+ if (/\$$/.test(m.pre)) {
+ for (var k = 0; k < post.length; k++) {
+ var expansion = pre+ '{' + m.body + '}' + post[k];
+ expansions.push(expansion);
+ }
+ } else {
+ var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
+ var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
+ var isSequence = isNumericSequence || isAlphaSequence;
+ var isOptions = m.body.indexOf(',') >= 0;
+ if (!isSequence && !isOptions) {
+ // {a},b}
+ if (m.post.match(/,.*\}/)) {
+ str = m.pre + '{' + m.body + escClose + m.post;
+ return expand(str);
+ }
+ return [str];
+ }
- // Algorithm below is based on https://qntm.org/cmd
+ var n;
+ if (isSequence) {
+ n = m.body.split(/\.\./);
+ } else {
+ n = parseCommaParts(m.body);
+ if (n.length === 1) {
+ // x{{a,b}}y ==> x{a}y x{b}y
+ n = expand(n[0], false).map(embrace);
+ if (n.length === 1) {
+ return post.map(function(p) {
+ return m.pre + n[0] + p;
+ });
+ }
+ }
+ }
- // Sequence of backslashes followed by a double quote:
- // double up all the backslashes and escape the double quote
- arg = arg.replace(/(\\*)"/g, '$1$1\\"');
+ // at this point, n is the parts, and we know it's not a comma set
+ // with a single entry.
+ var N;
- // 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');
+ if (isSequence) {
+ var x = numeric(n[0]);
+ var y = numeric(n[1]);
+ var width = Math.max(n[0].length, n[1].length)
+ var incr = n.length == 3
+ ? Math.abs(numeric(n[2]))
+ : 1;
+ var test = lte;
+ var reverse = y < x;
+ if (reverse) {
+ incr *= -1;
+ test = gte;
+ }
+ var pad = n.some(isPadded);
- // All other backslashes occur literally
+ N = [];
- // Quote the whole thing:
- arg = `"${arg}"`;
+ for (var i = x; test(i, y); i += incr) {
+ var c;
+ if (isAlphaSequence) {
+ c = String.fromCharCode(i);
+ if (c === '\\')
+ c = '';
+ } else {
+ c = String(i);
+ if (pad) {
+ var need = width - c.length;
+ if (need > 0) {
+ var z = new Array(need + 1).join('0');
+ if (i < 0)
+ c = '-' + z + c.slice(1);
+ else
+ c = z + c;
+ }
+ }
+ }
+ N.push(c);
+ }
+ } else {
+ N = [];
- // Escape meta chars
- arg = arg.replace(metaCharsRegExp, '^$1');
+ for (var j = 0; j < n.length; j++) {
+ N.push.apply(N, expand(n[j], false));
+ }
+ }
- // Double escape meta chars if necessary
- if (doubleEscapeMetaChars) {
- arg = arg.replace(metaCharsRegExp, '^$1');
+ for (var j = 0; j < N.length; j++) {
+ for (var k = 0; k < post.length; k++) {
+ var expansion = pre + N[j] + post[k];
+ if (!isTop || isSequence || expansion)
+ expansions.push(expansion);
+ }
}
+ }
- return arg;
+ return expansions;
}
-module.exports.command = escapeCommand;
-module.exports.argument = escapeArgument;
/***/ }),
-/***/ 41252:
-/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
+/***/ 51590:
+/***/ ((module) => {
-"use strict";
+module.exports = Buffers;
+function Buffers (bufs) {
+ if (!(this instanceof Buffers)) return new Buffers(bufs);
+ this.buffers = bufs || [];
+ this.length = this.buffers.reduce(function (size, buf) {
+ return size + buf.length
+ }, 0);
+}
-const fs = __nccwpck_require__(57147);
-const shebangCommand = __nccwpck_require__(67032);
+Buffers.prototype.push = function () {
+ for (var i = 0; i < arguments.length; i++) {
+ if (!Buffer.isBuffer(arguments[i])) {
+ throw new TypeError('Tried to push a non-buffer');
+ }
+ }
+
+ for (var i = 0; i < arguments.length; i++) {
+ var buf = arguments[i];
+ this.buffers.push(buf);
+ this.length += buf.length;
+ }
+ return this.length;
+};
-function readShebang(command) {
- // Read the first 150 bytes from the file
- const size = 150;
- const buffer = Buffer.alloc(size);
+Buffers.prototype.unshift = function () {
+ for (var i = 0; i < arguments.length; i++) {
+ if (!Buffer.isBuffer(arguments[i])) {
+ throw new TypeError('Tried to unshift a non-buffer');
+ }
+ }
+
+ for (var i = 0; i < arguments.length; i++) {
+ var buf = arguments[i];
+ this.buffers.unshift(buf);
+ this.length += buf.length;
+ }
+ return this.length;
+};
- let fd;
+Buffers.prototype.copy = function (dst, dStart, start, end) {
+ return this.slice(start, end).copy(dst, dStart, 0, end - start);
+};
- try {
- fd = fs.openSync(command, 'r');
- fs.readSync(fd, buffer, 0, size, 0);
- fs.closeSync(fd);
- } catch (e) { /* Empty */ }
+Buffers.prototype.splice = function (i, howMany) {
+ var buffers = this.buffers;
+ var index = i >= 0 ? i : this.length - i;
+ var reps = [].slice.call(arguments, 2);
+
+ if (howMany === undefined) {
+ howMany = this.length - index;
+ }
+ else if (howMany > this.length - index) {
+ howMany = this.length - index;
+ }
+
+ for (var i = 0; i < reps.length; i++) {
+ this.length += reps[i].length;
+ }
+
+ var removed = new Buffers();
+ var bytes = 0;
+
+ var startBytes = 0;
+ for (
+ var ii = 0;
+ ii < buffers.length && startBytes + buffers[ii].length < index;
+ ii ++
+ ) { startBytes += buffers[ii].length }
+
+ if (index - startBytes > 0) {
+ var start = index - startBytes;
+
+ if (start + howMany < buffers[ii].length) {
+ removed.push(buffers[ii].slice(start, start + howMany));
+
+ var orig = buffers[ii];
+ //var buf = new Buffer(orig.length - howMany);
+ var buf0 = new Buffer(start);
+ for (var i = 0; i < start; i++) {
+ buf0[i] = orig[i];
+ }
+
+ var buf1 = new Buffer(orig.length - start - howMany);
+ for (var i = start + howMany; i < orig.length; i++) {
+ buf1[ i - howMany - start ] = orig[i]
+ }
+
+ if (reps.length > 0) {
+ var reps_ = reps.slice();
+ reps_.unshift(buf0);
+ reps_.push(buf1);
+ buffers.splice.apply(buffers, [ ii, 1 ].concat(reps_));
+ ii += reps_.length;
+ reps = [];
+ }
+ else {
+ buffers.splice(ii, 1, buf0, buf1);
+ //buffers[ii] = buf;
+ ii += 2;
+ }
+ }
+ else {
+ removed.push(buffers[ii].slice(start));
+ buffers[ii] = buffers[ii].slice(0, start);
+ ii ++;
+ }
+ }
+
+ if (reps.length > 0) {
+ buffers.splice.apply(buffers, [ ii, 0 ].concat(reps));
+ ii += reps.length;
+ }
+
+ while (removed.length < howMany) {
+ var buf = buffers[ii];
+ var len = buf.length;
+ var take = Math.min(len, howMany - removed.length);
+
+ if (take === len) {
+ removed.push(buf);
+ buffers.splice(ii, 1);
+ }
+ else {
+ removed.push(buf.slice(0, take));
+ buffers[ii] = buffers[ii].slice(take);
+ }
+ }
+
+ this.length -= removed.length;
+
+ return removed;
+};
+
+Buffers.prototype.slice = function (i, j) {
+ var buffers = this.buffers;
+ if (j === undefined) j = this.length;
+ if (i === undefined) i = 0;
+
+ if (j > this.length) j = this.length;
+
+ var startBytes = 0;
+ for (
+ var si = 0;
+ si < buffers.length && startBytes + buffers[si].length <= i;
+ si ++
+ ) { startBytes += buffers[si].length }
+
+ var target = new Buffer(j - i);
+
+ var ti = 0;
+ for (var ii = si; ti < j - i && ii < buffers.length; ii++) {
+ var len = buffers[ii].length;
+
+ var start = ti === 0 ? i - startBytes : 0;
+ var end = ti + len >= j - i
+ ? Math.min(start + (j - i) - ti, len)
+ : len
+ ;
+
+ buffers[ii].copy(target, ti, start, end);
+ ti += end - start;
+ }
+
+ return target;
+};
- // Attempt to extract shebang (null is returned if not a shebang)
- return shebangCommand(buffer.toString());
-}
+Buffers.prototype.pos = function (i) {
+ if (i < 0 || i >= this.length) throw new Error('oob');
+ var l = i, bi = 0, bu = null;
+ for (;;) {
+ bu = this.buffers[bi];
+ if (l < bu.length) {
+ return {buf: bi, offset: l};
+ } else {
+ l -= bu.length;
+ }
+ bi++;
+ }
+};
-module.exports = readShebang;
+Buffers.prototype.get = function get (i) {
+ var pos = this.pos(i);
+ return this.buffers[pos.buf].get(pos.offset);
+};
-/***/ }),
+Buffers.prototype.set = function set (i, b) {
+ var pos = this.pos(i);
-/***/ 87274:
-/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
+ return this.buffers[pos.buf].set(pos.offset, b);
+};
-"use strict";
+Buffers.prototype.indexOf = function (needle, offset) {
+ if ("string" === typeof needle) {
+ needle = new Buffer(needle);
+ } else if (needle instanceof Buffer) {
+ // already a buffer
+ } else {
+ throw new Error('Invalid type for a search string');
+ }
+ if (!needle.length) {
+ return 0;
+ }
-const path = __nccwpck_require__(71017);
-const which = __nccwpck_require__(34207);
-const getPathKey = __nccwpck_require__(20539);
+ if (!this.length) {
+ return -1;
+ }
-function resolveCommandAttempt(parsed, withoutPathExt) {
- const env = parsed.options.env || process.env;
- const cwd = process.cwd();
- const hasCustomCwd = parsed.options.cwd != null;
- // Worker threads do not have process.chdir()
- const shouldSwitchCwd = hasCustomCwd && process.chdir !== undefined && !process.chdir.disabled;
+ var i = 0, j = 0, match = 0, mstart, pos = 0;
- // 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 (shouldSwitchCwd) {
- try {
- process.chdir(parsed.options.cwd);
- } catch (err) {
- /* Empty */
- }
+ // start search from a particular point in the virtual buffer
+ if (offset) {
+ var p = this.pos(offset);
+ i = p.buf;
+ j = p.offset;
+ pos = offset;
}
- let resolved;
+ // for each character in virtual buffer
+ for (;;) {
+ while (j >= this.buffers[i].length) {
+ j = 0;
+ i++;
- try {
- resolved = which.sync(parsed.command, {
- path: env[getPathKey({ env })],
- pathExt: withoutPathExt ? path.delimiter : undefined,
- });
- } catch (e) {
- /* Empty */
- } finally {
- if (shouldSwitchCwd) {
- process.chdir(cwd);
+ if (i >= this.buffers.length) {
+ // search string not found
+ return -1;
+ }
}
- }
- // 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 = path.resolve(hasCustomCwd ? parsed.options.cwd : '', resolved);
+ var char = this.buffers[i][j];
+
+ if (char == needle[match]) {
+ // keep track where match started
+ if (match == 0) {
+ mstart = {
+ i: i,
+ j: j,
+ pos: pos
+ };
+ }
+ match++;
+ if (match == needle.length) {
+ // full match
+ return mstart.pos;
+ }
+ } else if (match != 0) {
+ // a partial match ended, go back to match starting position
+ // this will continue the search at the next character
+ i = mstart.i;
+ j = mstart.j;
+ pos = mstart.pos;
+ match = 0;
+ }
+
+ j++;
+ pos++;
}
+};
- return resolved;
+Buffers.prototype.toBuffer = function() {
+ return this.slice();
}
-function resolveCommand(parsed) {
- return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
+Buffers.prototype.toString = function(encoding, start, end) {
+ return this.slice(start, end).toString(encoding);
}
-module.exports = resolveCommand;
-
/***/ }),
-/***/ 84697:
+/***/ 86966:
/***/ ((module) => {
-/**
- * Helpers.
+"use strict";
+/*!
+ * bytes
+ * Copyright(c) 2012-2014 TJ Holowaychuk
+ * Copyright(c) 2015 Jed Watson
+ * MIT Licensed
*/
-var s = 1000;
-var m = s * 60;
-var h = m * 60;
-var d = h * 24;
-var w = d * 7;
-var y = d * 365.25;
+
/**
- * Parse or format the given `val`.
- *
- * Options:
- *
- * - `long` verbose formatting [false]
- *
- * @param {String|Number} val
- * @param {Object} [options]
- * @throws {Error} throw an error if val is not a non-empty string or a number
- * @return {String|Number}
- * @api public
+ * Module exports.
+ * @public
*/
-module.exports = function(val, options) {
- options = options || {};
- var type = typeof val;
- if (type === 'string' && val.length > 0) {
- return parse(val);
- } else if (type === 'number' && isFinite(val)) {
- return options.long ? fmtLong(val) : fmtShort(val);
- }
- throw new Error(
- 'val is not a non-empty string or a valid number. val=' +
- JSON.stringify(val)
- );
-};
+module.exports = bytes;
+module.exports.format = format;
+module.exports.parse = parse;
/**
- * Parse the given `str` and return milliseconds.
- *
- * @param {String} str
- * @return {Number}
- * @api private
+ * Module variables.
+ * @private
*/
-function parse(str) {
- str = String(str);
- if (str.length > 100) {
- return;
- }
- var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
- str
- );
- if (!match) {
- return;
- }
- var n = parseFloat(match[1]);
- var type = (match[2] || 'ms').toLowerCase();
- switch (type) {
- case 'years':
- case 'year':
- case 'yrs':
- case 'yr':
- case 'y':
- return n * y;
- case 'weeks':
- case 'week':
- case 'w':
- return n * w;
- case 'days':
- case 'day':
- case 'd':
- return n * d;
- case 'hours':
- case 'hour':
- case 'hrs':
- case 'hr':
- case 'h':
- return n * h;
- case 'minutes':
- case 'minute':
- case 'mins':
- case 'min':
- case 'm':
- return n * m;
- case 'seconds':
- case 'second':
- case 'secs':
- case 'sec':
- case 's':
- return n * s;
- case 'milliseconds':
- case 'millisecond':
- case 'msecs':
- case 'msec':
- case 'ms':
- return n;
- default:
- return undefined;
- }
-}
+var formatThousandsRegExp = /\B(?=(\d{3})+(?!\d))/g;
-/**
- * Short format for `ms`.
- *
- * @param {Number} ms
- * @return {String}
- * @api private
- */
+var formatDecimalsRegExp = /(?:\.0*|(\.[^0]+)0+)$/;
-function fmtShort(ms) {
- var msAbs = Math.abs(ms);
- if (msAbs >= d) {
- return Math.round(ms / d) + 'd';
- }
- if (msAbs >= h) {
- return Math.round(ms / h) + 'h';
- }
- if (msAbs >= m) {
- return Math.round(ms / m) + 'm';
- }
- if (msAbs >= s) {
- return Math.round(ms / s) + 's';
- }
- return ms + 'ms';
-}
+var map = {
+ b: 1,
+ kb: 1 << 10,
+ mb: 1 << 20,
+ gb: 1 << 30,
+ tb: Math.pow(1024, 4),
+ pb: Math.pow(1024, 5),
+};
+
+var parseRegExp = /^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;
/**
- * Long format for `ms`.
+ * Convert the given value in bytes into a string or parse to string to an integer in bytes.
*
- * @param {Number} ms
- * @return {String}
- * @api private
+ * @param {string|number} value
+ * @param {{
+ * case: [string],
+ * decimalPlaces: [number]
+ * fixedDecimals: [boolean]
+ * thousandsSeparator: [string]
+ * unitSeparator: [string]
+ * }} [options] bytes options.
+ *
+ * @returns {string|number|null}
*/
-function fmtLong(ms) {
- var msAbs = Math.abs(ms);
- if (msAbs >= d) {
- return plural(ms, msAbs, d, 'day');
- }
- if (msAbs >= h) {
- return plural(ms, msAbs, h, 'hour');
- }
- if (msAbs >= m) {
- return plural(ms, msAbs, m, 'minute');
- }
- if (msAbs >= s) {
- return plural(ms, msAbs, s, 'second');
+function bytes(value, options) {
+ if (typeof value === 'string') {
+ return parse(value);
}
- return ms + ' ms';
-}
-/**
- * Pluralization helper.
- */
+ if (typeof value === 'number') {
+ return format(value, options);
+ }
-function plural(ms, msAbs, n, name) {
- var isPlural = msAbs >= n * 1.5;
- return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
+ return null;
}
-
-/***/ }),
-
-/***/ 28222:
-/***/ ((module, exports, __nccwpck_require__) => {
-
-/* eslint-env browser */
-
-/**
- * This is the web browser implementation of `debug()`.
- */
-
-exports.formatArgs = formatArgs;
-exports.save = save;
-exports.load = load;
-exports.useColors = useColors;
-exports.storage = localstorage();
-exports.destroy = (() => {
- let warned = false;
-
- return () => {
- if (!warned) {
- warned = true;
- console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
- }
- };
-})();
-
-/**
- * Colors.
- */
-
-exports.colors = [
- '#0000CC',
- '#0000FF',
- '#0033CC',
- '#0033FF',
- '#0066CC',
- '#0066FF',
- '#0099CC',
- '#0099FF',
- '#00CC00',
- '#00CC33',
- '#00CC66',
- '#00CC99',
- '#00CCCC',
- '#00CCFF',
- '#3300CC',
- '#3300FF',
- '#3333CC',
- '#3333FF',
- '#3366CC',
- '#3366FF',
- '#3399CC',
- '#3399FF',
- '#33CC00',
- '#33CC33',
- '#33CC66',
- '#33CC99',
- '#33CCCC',
- '#33CCFF',
- '#6600CC',
- '#6600FF',
- '#6633CC',
- '#6633FF',
- '#66CC00',
- '#66CC33',
- '#9900CC',
- '#9900FF',
- '#9933CC',
- '#9933FF',
- '#99CC00',
- '#99CC33',
- '#CC0000',
- '#CC0033',
- '#CC0066',
- '#CC0099',
- '#CC00CC',
- '#CC00FF',
- '#CC3300',
- '#CC3333',
- '#CC3366',
- '#CC3399',
- '#CC33CC',
- '#CC33FF',
- '#CC6600',
- '#CC6633',
- '#CC9900',
- '#CC9933',
- '#CCCC00',
- '#CCCC33',
- '#FF0000',
- '#FF0033',
- '#FF0066',
- '#FF0099',
- '#FF00CC',
- '#FF00FF',
- '#FF3300',
- '#FF3333',
- '#FF3366',
- '#FF3399',
- '#FF33CC',
- '#FF33FF',
- '#FF6600',
- '#FF6633',
- '#FF9900',
- '#FF9933',
- '#FFCC00',
- '#FFCC33'
-];
-
/**
- * Currently only WebKit-based Web Inspectors, Firefox >= v31,
- * and the Firebug extension (any Firefox version) are known
- * to support "%c" CSS customizations.
+ * Format the given value in bytes into a string.
*
- * TODO: add a `localStorage` variable to explicitly enable/disable colors
+ * If the value is negative, it is kept as such. If it is a float,
+ * it is rounded.
+ *
+ * @param {number} value
+ * @param {object} [options]
+ * @param {number} [options.decimalPlaces=2]
+ * @param {number} [options.fixedDecimals=false]
+ * @param {string} [options.thousandsSeparator=]
+ * @param {string} [options.unit=]
+ * @param {string} [options.unitSeparator=]
+ *
+ * @returns {string|null}
+ * @public
*/
-// eslint-disable-next-line complexity
-function useColors() {
- // NB: In an Electron preload script, document will be defined but not fully
- // initialized. Since we know we're in Chrome, we'll just detect this case
- // explicitly
- if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
- return true;
- }
-
- // Internet Explorer and Edge do not support colors.
- if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
- return false;
- }
-
- // Is webkit? http://stackoverflow.com/a/16459606/376773
- // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
- return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
- // Is firebug? http://stackoverflow.com/a/398120/376773
- (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
- // Is firefox >= v31?
- // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
- (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
- // Double check webkit in userAgent just in case we are in a worker
- (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
-}
+function format(value, options) {
+ if (!Number.isFinite(value)) {
+ return null;
+ }
-/**
- * Colorize log arguments if enabled.
- *
- * @api public
- */
+ var mag = Math.abs(value);
+ var thousandsSeparator = (options && options.thousandsSeparator) || '';
+ var unitSeparator = (options && options.unitSeparator) || '';
+ var decimalPlaces = (options && options.decimalPlaces !== undefined) ? options.decimalPlaces : 2;
+ var fixedDecimals = Boolean(options && options.fixedDecimals);
+ var unit = (options && options.unit) || '';
-function formatArgs(args) {
- args[0] = (this.useColors ? '%c' : '') +
- this.namespace +
- (this.useColors ? ' %c' : ' ') +
- args[0] +
- (this.useColors ? '%c ' : ' ') +
- '+' + module.exports.humanize(this.diff);
+ if (!unit || !map[unit.toLowerCase()]) {
+ if (mag >= map.pb) {
+ unit = 'PB';
+ } else if (mag >= map.tb) {
+ unit = 'TB';
+ } else if (mag >= map.gb) {
+ unit = 'GB';
+ } else if (mag >= map.mb) {
+ unit = 'MB';
+ } else if (mag >= map.kb) {
+ unit = 'KB';
+ } else {
+ unit = 'B';
+ }
+ }
- if (!this.useColors) {
- return;
- }
+ var val = value / map[unit.toLowerCase()];
+ var str = val.toFixed(decimalPlaces);
- const c = 'color: ' + this.color;
- args.splice(1, 0, c, 'color: inherit');
+ if (!fixedDecimals) {
+ str = str.replace(formatDecimalsRegExp, '$1');
+ }
- // The final "%c" is somewhat tricky, because there could be other
- // arguments passed either before or after the %c, so we need to
- // figure out the correct index to insert the CSS into
- let index = 0;
- let lastC = 0;
- args[0].replace(/%[a-zA-Z%]/g, match => {
- if (match === '%%') {
- return;
- }
- index++;
- if (match === '%c') {
- // We only are interested in the *last* %c
- // (the user may have provided their own)
- lastC = index;
- }
- });
+ if (thousandsSeparator) {
+ str = str.split('.').map(function (s, i) {
+ return i === 0
+ ? s.replace(formatThousandsRegExp, thousandsSeparator)
+ : s
+ }).join('.');
+ }
- args.splice(lastC, 0, c);
+ return str + unitSeparator + unit;
}
/**
- * Invokes `console.debug()` when available.
- * No-op when `console.debug` is not a "function".
- * If `console.debug` is not available, falls back
- * to `console.log`.
+ * Parse the string value into an integer in bytes.
*
- * @api public
- */
-exports.log = console.debug || console.log || (() => {});
-
-/**
- * Save `namespaces`.
+ * If no unit is given, it is assumed the value is in bytes.
*
- * @param {String} namespaces
- * @api private
- */
-function save(namespaces) {
- try {
- if (namespaces) {
- exports.storage.setItem('debug', namespaces);
- } else {
- exports.storage.removeItem('debug');
- }
- } catch (error) {
- // Swallow
- // XXX (@Qix-) should we be logging these?
- }
-}
-
-/**
- * Load `namespaces`.
+ * @param {number|string} val
*
- * @return {String} returns the previously persisted debug modes
- * @api private
+ * @returns {number|null}
+ * @public
*/
-function load() {
- let r;
- try {
- r = exports.storage.getItem('debug');
- } catch (error) {
- // Swallow
- // XXX (@Qix-) should we be logging these?
- }
- // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
- if (!r && typeof process !== 'undefined' && 'env' in process) {
- r = process.env.DEBUG;
- }
+function parse(val) {
+ if (typeof val === 'number' && !isNaN(val)) {
+ return val;
+ }
- return r;
-}
+ if (typeof val !== 'string') {
+ return null;
+ }
-/**
- * Localstorage attempts to return the localstorage.
- *
- * This is necessary because safari throws
- * when a user disables cookies/localstorage
- * and you attempt to access it.
- *
- * @return {LocalStorage}
- * @api private
- */
+ // Test if the string passed is valid
+ var results = parseRegExp.exec(val);
+ var floatValue;
+ var unit = 'b';
-function localstorage() {
- try {
- // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
- // The Browser also has localStorage in the global context.
- return localStorage;
- } catch (error) {
- // Swallow
- // XXX (@Qix-) should we be logging these?
- }
+ if (!results) {
+ // Nothing could be extracted from the given string
+ floatValue = parseInt(val, 10);
+ unit = 'b'
+ } else {
+ // Retrieve the value and the unit
+ floatValue = parseFloat(results[1]);
+ unit = results[4].toLowerCase();
+ }
+
+ if (isNaN(floatValue)) {
+ return null;
+ }
+
+ return Math.floor(map[unit] * floatValue);
}
-module.exports = __nccwpck_require__(46243)(exports);
-const {formatters} = module.exports;
+/***/ }),
-/**
- * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
- */
+/***/ 28803:
+/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
-formatters.j = function (v) {
- try {
- return JSON.stringify(v);
- } catch (error) {
- return '[UnexpectedJSONParseError]: ' + error.message;
+"use strict";
+
+
+var GetIntrinsic = __nccwpck_require__(74538);
+
+var callBind = __nccwpck_require__(62977);
+
+var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));
+
+module.exports = function callBoundIntrinsic(name, allowMissing) {
+ var intrinsic = GetIntrinsic(name, !!allowMissing);
+ if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
+ return callBind(intrinsic);
}
+ return intrinsic;
};
/***/ }),
-/***/ 46243:
+/***/ 62977:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
+"use strict";
-/**
- * This is the common logic for both the Node.js and web browser
- * implementations of `debug()`.
- */
-function setup(env) {
- createDebug.debug = createDebug;
- createDebug.default = createDebug;
- createDebug.coerce = coerce;
- createDebug.disable = disable;
- createDebug.enable = enable;
- createDebug.enabled = enabled;
- createDebug.humanize = __nccwpck_require__(84697);
- createDebug.destroy = destroy;
+var bind = __nccwpck_require__(88334);
+var GetIntrinsic = __nccwpck_require__(74538);
- Object.keys(env).forEach(key => {
- createDebug[key] = env[key];
- });
+var $apply = GetIntrinsic('%Function.prototype.apply%');
+var $call = GetIntrinsic('%Function.prototype.call%');
+var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
- /**
- * The currently active debug mode names, and names to skip.
- */
+var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
+var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
+var $max = GetIntrinsic('%Math.max%');
- createDebug.names = [];
- createDebug.skips = [];
+if ($defineProperty) {
+ try {
+ $defineProperty({}, 'a', { value: 1 });
+ } catch (e) {
+ // IE 8 has a broken defineProperty
+ $defineProperty = null;
+ }
+}
- /**
- * Map of special "%n" handling functions, for the debug "format" argument.
- *
- * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
- */
- createDebug.formatters = {};
+module.exports = function callBind(originalFunction) {
+ var func = $reflectApply(bind, $call, arguments);
+ if ($gOPD && $defineProperty) {
+ var desc = $gOPD(func, 'length');
+ if (desc.configurable) {
+ // original length, plus the receiver, minus any additional arguments (after the receiver)
+ $defineProperty(
+ func,
+ 'length',
+ { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
+ );
+ }
+ }
+ return func;
+};
- /**
- * Selects a color for a debug namespace
- * @param {String} namespace The namespace string for the debug instance to be colored
- * @return {Number|String} An ANSI color code for the given namespace
- * @api private
- */
- function selectColor(namespace) {
- let hash = 0;
+var applyBind = function applyBind() {
+ return $reflectApply(bind, $apply, arguments);
+};
- for (let i = 0; i < namespace.length; i++) {
- hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
- hash |= 0; // Convert to 32bit integer
- }
+if ($defineProperty) {
+ $defineProperty(module.exports, 'apply', { value: applyBind });
+} else {
+ module.exports.apply = applyBind;
+}
- return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
- }
- createDebug.selectColor = selectColor;
- /**
- * Create a debugger with the given `namespace`.
- *
- * @param {String} namespace
- * @return {Function}
- * @api public
- */
- function createDebug(namespace) {
- let prevTime;
- let enableOverride = null;
- let namespacesCache;
- let enabledCache;
+/***/ }),
- function debug(...args) {
- // Disabled?
- if (!debug.enabled) {
- return;
- }
+/***/ 46533:
+/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
- const self = debug;
+var Traverse = __nccwpck_require__(8588);
+var EventEmitter = (__nccwpck_require__(82361).EventEmitter);
- // Set `diff` timestamp
- const curr = Number(new Date());
- const ms = curr - (prevTime || curr);
- self.diff = ms;
- self.prev = prevTime;
- self.curr = curr;
- prevTime = curr;
+module.exports = Chainsaw;
+function Chainsaw (builder) {
+ var saw = Chainsaw.saw(builder, {});
+ var r = builder.call(saw.handlers, saw);
+ if (r !== undefined) saw.handlers = r;
+ saw.record();
+ return saw.chain();
+};
- args[0] = createDebug.coerce(args[0]);
+Chainsaw.light = function ChainsawLight (builder) {
+ var saw = Chainsaw.saw(builder, {});
+ var r = builder.call(saw.handlers, saw);
+ if (r !== undefined) saw.handlers = r;
+ return saw.chain();
+};
- if (typeof args[0] !== 'string') {
- // Anything else let's inspect with %O
- args.unshift('%O');
- }
+Chainsaw.saw = function (builder, handlers) {
+ var saw = new EventEmitter;
+ saw.handlers = handlers;
+ saw.actions = [];
- // Apply any `formatters` transformations
- let index = 0;
- args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
- // If we encounter an escaped % then don't increase the array index
- if (match === '%%') {
- return '%';
- }
- index++;
- const formatter = createDebug.formatters[format];
- if (typeof formatter === 'function') {
- const val = args[index];
- match = formatter.call(self, val);
+ saw.chain = function () {
+ var ch = Traverse(saw.handlers).map(function (node) {
+ if (this.isRoot) return node;
+ var ps = this.path;
- // Now we need to remove `args[index]` since it's inlined in the `format`
- args.splice(index, 1);
- index--;
- }
- return match;
- });
+ if (typeof node === 'function') {
+ this.update(function () {
+ saw.actions.push({
+ path : ps,
+ args : [].slice.call(arguments)
+ });
+ return ch;
+ });
+ }
+ });
- // Apply env-specific formatting (colors, etc.)
- createDebug.formatArgs.call(self, args);
+ process.nextTick(function () {
+ saw.emit('begin');
+ saw.next();
+ });
- const logFn = self.log || createDebug.log;
- logFn.apply(self, args);
- }
+ return ch;
+ };
- debug.namespace = namespace;
- debug.useColors = createDebug.useColors();
- debug.color = createDebug.selectColor(namespace);
- debug.extend = extend;
- debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
+ saw.pop = function () {
+ return saw.actions.shift();
+ };
- Object.defineProperty(debug, 'enabled', {
- enumerable: true,
- configurable: false,
- get: () => {
- if (enableOverride !== null) {
- return enableOverride;
- }
- if (namespacesCache !== createDebug.namespaces) {
- namespacesCache = createDebug.namespaces;
- enabledCache = createDebug.enabled(namespace);
- }
+ saw.next = function () {
+ var action = saw.pop();
- return enabledCache;
- },
- set: v => {
- enableOverride = v;
- }
- });
+ if (!action) {
+ saw.emit('end');
+ }
+ else if (!action.trap) {
+ var node = saw.handlers;
+ action.path.forEach(function (key) { node = node[key] });
+ node.apply(saw.handlers, action.args);
+ }
+ };
- // Env-specific initialization logic for debug instances
- if (typeof createDebug.init === 'function') {
- createDebug.init(debug);
- }
+ saw.nest = function (cb) {
+ var args = [].slice.call(arguments, 1);
+ var autonext = true;
- return debug;
- }
+ if (typeof cb === 'boolean') {
+ var autonext = cb;
+ cb = args.shift();
+ }
- function extend(namespace, delimiter) {
- const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
- newDebug.log = this.log;
- return newDebug;
- }
+ var s = Chainsaw.saw(builder, {});
+ var r = builder.call(s.handlers, s);
- /**
- * Enables a debug mode by namespaces. This can include modes
- * separated by a colon and wildcards.
- *
- * @param {String} namespaces
- * @api public
- */
- function enable(namespaces) {
- createDebug.save(namespaces);
- createDebug.namespaces = namespaces;
+ if (r !== undefined) s.handlers = r;
- createDebug.names = [];
- createDebug.skips = [];
+ // If we are recording...
+ if ("undefined" !== typeof saw.step) {
+ // ... our children should, too
+ s.record();
+ }
- let i;
- const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
- const len = split.length;
+ cb.apply(s.chain(), args);
+ if (autonext !== false) s.on('end', saw.next);
+ };
- for (i = 0; i < len; i++) {
- if (!split[i]) {
- // ignore empty strings
- continue;
- }
+ saw.record = function () {
+ upgradeChainsaw(saw);
+ };
- namespaces = split[i].replace(/\*/g, '.*?');
+ ['trap', 'down', 'jump'].forEach(function (method) {
+ saw[method] = function () {
+ throw new Error("To use the trap, down and jump features, please "+
+ "call record() first to start recording actions.");
+ };
+ });
- if (namespaces[0] === '-') {
- createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));
- } else {
- createDebug.names.push(new RegExp('^' + namespaces + '$'));
- }
- }
- }
+ return saw;
+};
- /**
- * Disable debug output.
- *
- * @return {String} namespaces
- * @api public
- */
- function disable() {
- const namespaces = [
- ...createDebug.names.map(toNamespace),
- ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
- ].join(',');
- createDebug.enable('');
- return namespaces;
- }
+function upgradeChainsaw(saw) {
+ saw.step = 0;
- /**
- * Returns true if the given mode name is enabled, false otherwise.
- *
- * @param {String} name
- * @return {Boolean}
- * @api public
- */
- function enabled(name) {
- if (name[name.length - 1] === '*') {
- return true;
- }
+ // override pop
+ saw.pop = function () {
+ return saw.actions[saw.step++];
+ };
- let i;
- let len;
+ saw.trap = function (name, cb) {
+ var ps = Array.isArray(name) ? name : [name];
+ saw.actions.push({
+ path : ps,
+ step : saw.step,
+ cb : cb,
+ trap : true
+ });
+ };
- for (i = 0, len = createDebug.skips.length; i < len; i++) {
- if (createDebug.skips[i].test(name)) {
- return false;
- }
- }
+ saw.down = function (name) {
+ var ps = (Array.isArray(name) ? name : [name]).join('/');
+ var i = saw.actions.slice(saw.step).map(function (x) {
+ if (x.trap && x.step <= saw.step) return false;
+ return x.path.join('/') == ps;
+ }).indexOf(true);
- for (i = 0, len = createDebug.names.length; i < len; i++) {
- if (createDebug.names[i].test(name)) {
- return true;
- }
- }
+ if (i >= 0) saw.step += i;
+ else saw.step = saw.actions.length;
- return false;
- }
+ var act = saw.actions[saw.step - 1];
+ if (act && act.trap) {
+ // It's a trap!
+ saw.step = act.step;
+ act.cb();
+ }
+ else saw.next();
+ };
- /**
- * Convert regexp to namespace
- *
- * @param {RegExp} regxep
- * @return {String} namespace
- * @api private
- */
- function toNamespace(regexp) {
- return regexp.toString()
- .substring(2, regexp.toString().length - 2)
- .replace(/\.\*\?$/, '*');
- }
+ saw.jump = function (step) {
+ saw.step = step;
+ saw.next();
+ };
+};
- /**
- * Coerce `val`.
- *
- * @param {Mixed} val
- * @return {Mixed}
- * @api private
- */
- function coerce(val) {
- if (val instanceof Error) {
- return val.stack || val.message;
- }
- return val;
- }
- /**
- * XXX DO NOT USE. This is a temporary stub function.
- * XXX It WILL be removed in the next major release.
- */
- function destroy() {
- console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
- }
+/***/ }),
- createDebug.enable(createDebug.load());
+/***/ 8937:
+/***/ ((module, exports, __nccwpck_require__) => {
- return createDebug;
+"use strict";
+
+
+var objIsRegex = __nccwpck_require__(96403);
+
+exports = (module.exports = parse);
+
+var TOKEN_TYPES = exports.TOKEN_TYPES = {
+ LINE_COMMENT: '//',
+ BLOCK_COMMENT: '/**/',
+ SINGLE_QUOTE: '\'',
+ DOUBLE_QUOTE: '"',
+ TEMPLATE_QUOTE: '`',
+ REGEXP: '//g'
}
-module.exports = setup;
+var BRACKETS = exports.BRACKETS = {
+ '(': ')',
+ '{': '}',
+ '[': ']'
+};
+var BRACKETS_REVERSED = {
+ ')': '(',
+ '}': '{',
+ ']': '['
+};
+exports.parse = parse;
+function parse(src, state, options) {
+ options = options || {};
+ state = state || exports.defaultState();
+ var start = options.start || 0;
+ var end = options.end || src.length;
+ var index = start;
+ while (index < end) {
+ try {
+ parseChar(src[index], state);
+ } catch (ex) {
+ ex.index = index;
+ throw ex;
+ }
+ index++;
+ }
+ return state;
+}
-/***/ }),
+exports.parseUntil = parseUntil;
+function parseUntil(src, delimiter, options) {
+ options = options || {};
+ var start = options.start || 0;
+ var index = start;
+ var state = exports.defaultState();
+ while (index < src.length) {
+ if ((options.ignoreNesting || !state.isNesting(options)) && matches(src, delimiter, index)) {
+ var end = index;
+ return {
+ start: start,
+ end: end,
+ src: src.substring(start, end)
+ };
+ }
+ try {
+ parseChar(src[index], state);
+ } catch (ex) {
+ ex.index = index;
+ throw ex;
+ }
+ index++;
+ }
+ var err = new Error('The end of the string was reached with no closing bracket found.');
+ err.code = 'CHARACTER_PARSER:END_OF_STRING_REACHED';
+ err.index = index;
+ throw err;
+}
-/***/ 38237:
-/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
+exports.parseChar = parseChar;
+function parseChar(character, state) {
+ if (character.length !== 1) {
+ var err = new Error('Character must be a string of length 1');
+ err.name = 'InvalidArgumentError';
+ err.code = 'CHARACTER_PARSER:CHAR_LENGTH_NOT_ONE';
+ throw err;
+ }
+ state = state || exports.defaultState();
+ state.src += character;
+ var wasComment = state.isComment();
+ var lastChar = state.history ? state.history[0] : '';
-/**
- * Detect Electron renderer / nwjs process, which is node, but we should
- * treat as a browser.
- */
-if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
- module.exports = __nccwpck_require__(28222);
-} else {
- module.exports = __nccwpck_require__(35332);
+ if (state.regexpStart) {
+ if (character === '/' || character == '*') {
+ state.stack.pop();
+ }
+ state.regexpStart = false;
+ }
+ switch (state.current()) {
+ case TOKEN_TYPES.LINE_COMMENT:
+ if (character === '\n') {
+ state.stack.pop();
+ }
+ break;
+ case TOKEN_TYPES.BLOCK_COMMENT:
+ if (state.lastChar === '*' && character === '/') {
+ state.stack.pop();
+ }
+ break;
+ case TOKEN_TYPES.SINGLE_QUOTE:
+ if (character === '\'' && !state.escaped) {
+ state.stack.pop();
+ } else if (character === '\\' && !state.escaped) {
+ state.escaped = true;
+ } else {
+ state.escaped = false;
+ }
+ break;
+ case TOKEN_TYPES.DOUBLE_QUOTE:
+ if (character === '"' && !state.escaped) {
+ state.stack.pop();
+ } else if (character === '\\' && !state.escaped) {
+ state.escaped = true;
+ } else {
+ state.escaped = false;
+ }
+ break;
+ case TOKEN_TYPES.TEMPLATE_QUOTE:
+ if (character === '`' && !state.escaped) {
+ state.stack.pop();
+ state.hasDollar = false;
+ } else if (character === '\\' && !state.escaped) {
+ state.escaped = true;
+ state.hasDollar = false;
+ } else if (character === '$' && !state.escaped) {
+ state.hasDollar = true;
+ } else if (character === '{' && state.hasDollar) {
+ state.stack.push(BRACKETS[character]);
+ } else {
+ state.escaped = false;
+ state.hasDollar = false;
+ }
+ break;
+ case TOKEN_TYPES.REGEXP:
+ if (character === '/' && !state.escaped) {
+ state.stack.pop();
+ } else if (character === '\\' && !state.escaped) {
+ state.escaped = true;
+ } else {
+ state.escaped = false;
+ }
+ break;
+ default:
+ if (character in BRACKETS) {
+ state.stack.push(BRACKETS[character]);
+ } else if (character in BRACKETS_REVERSED) {
+ if (state.current() !== character) {
+ var err = new SyntaxError('Mismatched Bracket: ' + character);
+ err.code = 'CHARACTER_PARSER:MISMATCHED_BRACKET';
+ throw err;
+ };
+ state.stack.pop();
+ } else if (lastChar === '/' && character === '/') {
+ // Don't include comments in history
+ state.history = state.history.substr(1);
+ state.stack.push(TOKEN_TYPES.LINE_COMMENT);
+ } else if (lastChar === '/' && character === '*') {
+ // Don't include comment in history
+ state.history = state.history.substr(1);
+ state.stack.push(TOKEN_TYPES.BLOCK_COMMENT);
+ } else if (character === '/' && isRegexp(state.history)) {
+ state.stack.push(TOKEN_TYPES.REGEXP);
+ // N.B. if the next character turns out to be a `*` or a `/`
+ // then this isn't actually a regexp
+ state.regexpStart = true;
+ } else if (character === '\'') {
+ state.stack.push(TOKEN_TYPES.SINGLE_QUOTE);
+ } else if (character === '"') {
+ state.stack.push(TOKEN_TYPES.DOUBLE_QUOTE);
+ } else if (character === '`') {
+ state.stack.push(TOKEN_TYPES.TEMPLATE_QUOTE);
+ }
+ break;
+ }
+ if (!state.isComment() && !wasComment) {
+ state.history = character + state.history;
+ }
+ state.lastChar = character; // store last character for ending block comments
+ return state;
}
+exports.defaultState = function () { return new State() };
+function State() {
+ this.stack = [];
-/***/ }),
+ this.regexpStart = false;
+ this.escaped = false;
+ this.hasDollar = false;
-/***/ 35332:
-/***/ ((module, exports, __nccwpck_require__) => {
+ this.src = '';
+ this.history = ''
+ this.lastChar = ''
+}
+State.prototype.current = function () {
+ return this.stack[this.stack.length - 1];
+};
+State.prototype.isString = function () {
+ return (
+ this.current() === TOKEN_TYPES.SINGLE_QUOTE ||
+ this.current() === TOKEN_TYPES.DOUBLE_QUOTE ||
+ this.current() === TOKEN_TYPES.TEMPLATE_QUOTE
+ );
+}
+State.prototype.isComment = function () {
+ return this.current() === TOKEN_TYPES.LINE_COMMENT || this.current() === TOKEN_TYPES.BLOCK_COMMENT;
+}
+State.prototype.isNesting = function (opts) {
+ if (
+ opts && opts.ignoreLineComment &&
+ this.stack.length === 1 && this.stack[0] === TOKEN_TYPES.LINE_COMMENT
+ ) {
+ // if we are only inside a line comment, and line comments are ignored
+ // don't count it as nesting
+ return false;
+ }
+ return !!this.stack.length;
+}
-/**
- * Module dependencies.
- */
+function matches(str, matcher, i) {
+ if (objIsRegex(matcher)) {
+ return matcher.test(str.substr(i || 0));
+ } else {
+ return str.substr(i || 0, matcher.length) === matcher;
+ }
+}
-const tty = __nccwpck_require__(76224);
-const util = __nccwpck_require__(73837);
+exports.isPunctuator = isPunctuator
+function isPunctuator(c) {
+ if (!c) return true; // the start of a string is a punctuator
+ var code = c.charCodeAt(0)
-/**
- * This is the Node.js implementation of `debug()`.
- */
+ switch (code) {
+ case 46: // . dot
+ case 40: // ( open bracket
+ case 41: // ) close bracket
+ case 59: // ; semicolon
+ case 44: // , comma
+ case 123: // { open curly brace
+ case 125: // } close curly brace
+ case 91: // [
+ case 93: // ]
+ case 58: // :
+ case 63: // ?
+ case 126: // ~
+ case 37: // %
+ case 38: // &
+ case 42: // *:
+ case 43: // +
+ case 45: // -
+ case 47: // /
+ case 60: // <
+ case 62: // >
+ case 94: // ^
+ case 124: // |
+ case 33: // !
+ case 61: // =
+ return true;
+ default:
+ return false;
+ }
+}
-exports.init = init;
-exports.log = log;
-exports.formatArgs = formatArgs;
-exports.save = save;
-exports.load = load;
-exports.useColors = useColors;
-exports.destroy = util.deprecate(
- () => {},
- 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
-);
+exports.isKeyword = isKeyword
+function isKeyword(id) {
+ return (id === 'if') || (id === 'in') || (id === 'do') || (id === 'var') || (id === 'for') || (id === 'new') ||
+ (id === 'try') || (id === 'let') || (id === 'this') || (id === 'else') || (id === 'case') ||
+ (id === 'void') || (id === 'with') || (id === 'enum') || (id === 'while') || (id === 'break') || (id === 'catch') ||
+ (id === 'throw') || (id === 'const') || (id === 'yield') || (id === 'class') || (id === 'super') ||
+ (id === 'return') || (id === 'typeof') || (id === 'delete') || (id === 'switch') || (id === 'export') ||
+ (id === 'import') || (id === 'default') || (id === 'finally') || (id === 'extends') || (id === 'function') ||
+ (id === 'continue') || (id === 'debugger') || (id === 'package') || (id === 'private') || (id === 'interface') ||
+ (id === 'instanceof') || (id === 'implements') || (id === 'protected') || (id === 'public') || (id === 'static');
+}
-/**
- * Colors.
- */
+function isRegexp(history) {
+ //could be start of regexp or divide sign
-exports.colors = [6, 2, 3, 4, 5, 1];
+ history = history.replace(/^\s*/, '');
-try {
- // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
- // eslint-disable-next-line import/no-extraneous-dependencies
- const supportsColor = __nccwpck_require__(59318);
+ //unless its an `if`, `while`, `for` or `with` it's a divide, so we assume it's a divide
+ if (history[0] === ')') return false;
+ //unless it's a function expression, it's a regexp, so we assume it's a regexp
+ if (history[0] === '}') return true;
+ //any punctuation means it's a regexp
+ if (isPunctuator(history[0])) return true;
+ //if the last thing was a keyword then it must be a regexp (e.g. `typeof /foo/`)
+ if (/^\w+\b/.test(history) && isKeyword(/^\w+\b/.exec(history)[0].split('').reverse().join(''))) return true;
- if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
- exports.colors = [
- 20,
- 21,
- 26,
- 27,
- 32,
- 33,
- 38,
- 39,
- 40,
- 41,
- 42,
- 43,
- 44,
- 45,
- 56,
- 57,
- 62,
- 63,
- 68,
- 69,
- 74,
- 75,
- 76,
- 77,
- 78,
- 79,
- 80,
- 81,
- 92,
- 93,
- 98,
- 99,
- 112,
- 113,
- 128,
- 129,
- 134,
- 135,
- 148,
- 149,
- 160,
- 161,
- 162,
- 163,
- 164,
- 165,
- 166,
- 167,
- 168,
- 169,
- 170,
- 171,
- 172,
- 173,
- 178,
- 179,
- 184,
- 185,
- 196,
- 197,
- 198,
- 199,
- 200,
- 201,
- 202,
- 203,
- 204,
- 205,
- 206,
- 207,
- 208,
- 209,
- 214,
- 215,
- 220,
- 221
- ];
- }
-} catch (error) {
- // Swallow - we only care if `supports-color` is available; it doesn't have to be.
+ return false;
}
+
+/***/ }),
+
+/***/ 92240:
+/***/ ((module) => {
+
/**
- * Build up the default `inspectOpts` object from the environment variables.
+ * node-compress-commons
*
- * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
+ * Copyright (c) 2014 Chris Talkington, contributors.
+ * Licensed under the MIT license.
+ * https://github.com/archiverjs/node-compress-commons/blob/master/LICENSE-MIT
*/
+var ArchiveEntry = module.exports = function() {};
-exports.inspectOpts = Object.keys(process.env).filter(key => {
- return /^debug_/i.test(key);
-}).reduce((obj, key) => {
- // Camel-case
- const prop = key
- .substring(6)
- .toLowerCase()
- .replace(/_([a-z])/g, (_, k) => {
- return k.toUpperCase();
- });
+ArchiveEntry.prototype.getName = function() {};
- // Coerce string value into JS value
- let val = process.env[key];
- if (/^(yes|on|true|enabled)$/i.test(val)) {
- val = true;
- } else if (/^(no|off|false|disabled)$/i.test(val)) {
- val = false;
- } else if (val === 'null') {
- val = null;
- } else {
- val = Number(val);
- }
+ArchiveEntry.prototype.getSize = function() {};
- obj[prop] = val;
- return obj;
-}, {});
+ArchiveEntry.prototype.getLastModifiedDate = function() {};
-/**
- * Is stdout a TTY? Colored output is enabled when `true`.
- */
+ArchiveEntry.prototype.isDirectory = function() {};
-function useColors() {
- return 'colors' in exports.inspectOpts ?
- Boolean(exports.inspectOpts.colors) :
- tty.isatty(process.stderr.fd);
-}
+/***/ }),
+
+/***/ 36728:
+/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
/**
- * Adds ANSI color escape codes if enabled.
+ * node-compress-commons
*
- * @api public
+ * Copyright (c) 2014 Chris Talkington, contributors.
+ * Licensed under the MIT license.
+ * https://github.com/archiverjs/node-compress-commons/blob/master/LICENSE-MIT
*/
+var inherits = (__nccwpck_require__(73837).inherits);
+var isStream = __nccwpck_require__(41554);
+var Transform = (__nccwpck_require__(45193).Transform);
+
+var ArchiveEntry = __nccwpck_require__(92240);
+var util = __nccwpck_require__(95208);
+
+var ArchiveOutputStream = module.exports = function(options) {
+ if (!(this instanceof ArchiveOutputStream)) {
+ return new ArchiveOutputStream(options);
+ }
+
+ Transform.call(this, options);
+
+ this.offset = 0;
+ this._archive = {
+ finish: false,
+ finished: false,
+ processing: false
+ };
+};
-function formatArgs(args) {
- const {namespace: name, useColors} = this;
+inherits(ArchiveOutputStream, Transform);
- if (useColors) {
- const c = this.color;
- const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
- const prefix = ` ${colorCode};1m${name} \u001B[0m`;
+ArchiveOutputStream.prototype._appendBuffer = function(zae, source, callback) {
+ // scaffold only
+};
- args[0] = prefix + args[0].split('\n').join('\n' + prefix);
- args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
- } else {
- args[0] = getDate() + name + ' ' + args[0];
- }
-}
+ArchiveOutputStream.prototype._appendStream = function(zae, source, callback) {
+ // scaffold only
+};
-function getDate() {
- if (exports.inspectOpts.hideDate) {
- return '';
- }
- return new Date().toISOString() + ' ';
-}
+ArchiveOutputStream.prototype._emitErrorCallback = function(err) {
+ if (err) {
+ this.emit('error', err);
+ }
+};
-/**
- * Invokes `util.format()` with the specified arguments and writes to stderr.
- */
+ArchiveOutputStream.prototype._finish = function(ae) {
+ // scaffold only
+};
-function log(...args) {
- return process.stderr.write(util.format(...args) + '\n');
-}
+ArchiveOutputStream.prototype._normalizeEntry = function(ae) {
+ // scaffold only
+};
-/**
- * Save `namespaces`.
- *
- * @param {String} namespaces
- * @api private
- */
-function save(namespaces) {
- if (namespaces) {
- process.env.DEBUG = namespaces;
- } else {
- // If you set a process.env field to null or undefined, it gets cast to the
- // string 'null' or 'undefined'. Just delete instead.
- delete process.env.DEBUG;
- }
-}
+ArchiveOutputStream.prototype._transform = function(chunk, encoding, callback) {
+ callback(null, chunk);
+};
-/**
- * Load `namespaces`.
- *
- * @return {String} returns the previously persisted debug modes
- * @api private
- */
+ArchiveOutputStream.prototype.entry = function(ae, source, callback) {
+ source = source || null;
-function load() {
- return process.env.DEBUG;
-}
+ if (typeof callback !== 'function') {
+ callback = this._emitErrorCallback.bind(this);
+ }
-/**
- * Init logic for `debug` instances.
- *
- * Create a new `inspectOpts` object in case `useColors` is set
- * differently for a particular `debug` instance.
- */
+ if (!(ae instanceof ArchiveEntry)) {
+ callback(new Error('not a valid instance of ArchiveEntry'));
+ return;
+ }
-function init(debug) {
- debug.inspectOpts = {};
+ if (this._archive.finish || this._archive.finished) {
+ callback(new Error('unacceptable entry after finish'));
+ return;
+ }
- const keys = Object.keys(exports.inspectOpts);
- for (let i = 0; i < keys.length; i++) {
- debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
- }
-}
+ if (this._archive.processing) {
+ callback(new Error('already processing an entry'));
+ return;
+ }
-module.exports = __nccwpck_require__(46243)(exports);
+ this._archive.processing = true;
+ this._normalizeEntry(ae);
+ this._entry = ae;
-const {formatters} = module.exports;
+ source = util.normalizeInputSource(source);
-/**
- * Map %o to `util.inspect()`, all on a single line.
- */
+ if (Buffer.isBuffer(source)) {
+ this._appendBuffer(ae, source, callback);
+ } else if (isStream(source)) {
+ this._appendStream(ae, source, callback);
+ } else {
+ this._archive.processing = false;
+ callback(new Error('input source must be valid Stream or Buffer instance'));
+ return;
+ }
-formatters.o = function (v) {
- this.inspectOpts.colors = this.useColors;
- return util.inspect(v, this.inspectOpts)
- .split('\n')
- .map(str => str.trim())
- .join(' ');
+ return this;
};
-/**
- * Map %O to `util.inspect()`, allowing multiple lines if needed.
- */
+ArchiveOutputStream.prototype.finish = function() {
+ if (this._archive.processing) {
+ this._archive.finish = true;
+ return;
+ }
-formatters.O = function (v) {
- this.inspectOpts.colors = this.useColors;
- return util.inspect(v, this.inspectOpts);
+ this._finish();
};
+ArchiveOutputStream.prototype.getBytesWritten = function() {
+ return this.offset;
+};
-/***/ }),
+ArchiveOutputStream.prototype.write = function(chunk, cb) {
+ if (chunk) {
+ this.offset += chunk.length;
+ }
-/***/ 56323:
-/***/ ((module) => {
+ return Transform.prototype.write.call(this, chunk, cb);
+};
-"use strict";
+/***/ }),
+/***/ 11704:
+/***/ ((module) => {
-var isMergeableObject = function isMergeableObject(value) {
- return isNonNullObject(value)
- && !isSpecial(value)
-};
+/**
+ * node-compress-commons
+ *
+ * Copyright (c) 2014 Chris Talkington, contributors.
+ * Licensed under the MIT license.
+ * https://github.com/archiverjs/node-compress-commons/blob/master/LICENSE-MIT
+ */
+module.exports = {
+ WORD: 4,
+ DWORD: 8,
+ EMPTY: Buffer.alloc(0),
-function isNonNullObject(value) {
- return !!value && typeof value === 'object'
-}
+ SHORT: 2,
+ SHORT_MASK: 0xffff,
+ SHORT_SHIFT: 16,
+ SHORT_ZERO: Buffer.from(Array(2)),
+ LONG: 4,
+ LONG_ZERO: Buffer.from(Array(4)),
-function isSpecial(value) {
- var stringValue = Object.prototype.toString.call(value);
+ MIN_VERSION_INITIAL: 10,
+ MIN_VERSION_DATA_DESCRIPTOR: 20,
+ MIN_VERSION_ZIP64: 45,
+ VERSION_MADEBY: 45,
- return stringValue === '[object RegExp]'
- || stringValue === '[object Date]'
- || isReactElement(value)
-}
+ METHOD_STORED: 0,
+ METHOD_DEFLATED: 8,
-// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
-var canUseSymbol = typeof Symbol === 'function' && Symbol.for;
-var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;
+ PLATFORM_UNIX: 3,
+ PLATFORM_FAT: 0,
-function isReactElement(value) {
- return value.$$typeof === REACT_ELEMENT_TYPE
-}
+ SIG_LFH: 0x04034b50,
+ SIG_DD: 0x08074b50,
+ SIG_CFH: 0x02014b50,
+ SIG_EOCD: 0x06054b50,
+ SIG_ZIP64_EOCD: 0x06064B50,
+ SIG_ZIP64_EOCD_LOC: 0x07064B50,
-function emptyTarget(val) {
- return Array.isArray(val) ? [] : {}
-}
+ ZIP64_MAGIC_SHORT: 0xffff,
+ ZIP64_MAGIC: 0xffffffff,
+ ZIP64_EXTRA_ID: 0x0001,
-function cloneUnlessOtherwiseSpecified(value, options) {
- return (options.clone !== false && options.isMergeableObject(value))
- ? deepmerge(emptyTarget(value), value, options)
- : value
-}
+ ZLIB_NO_COMPRESSION: 0,
+ ZLIB_BEST_SPEED: 1,
+ ZLIB_BEST_COMPRESSION: 9,
+ ZLIB_DEFAULT_COMPRESSION: -1,
-function defaultArrayMerge(target, source, options) {
- return target.concat(source).map(function(element) {
- return cloneUnlessOtherwiseSpecified(element, options)
- })
-}
+ MODE_MASK: 0xFFF,
+ DEFAULT_FILE_MODE: 33188, // 010644 = -rw-r--r-- = S_IFREG | S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH
+ DEFAULT_DIR_MODE: 16877, // 040755 = drwxr-xr-x = S_IFDIR | S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH
-function getMergeFunction(key, options) {
- if (!options.customMerge) {
- return deepmerge
- }
- var customMerge = options.customMerge(key);
- return typeof customMerge === 'function' ? customMerge : deepmerge
-}
+ EXT_FILE_ATTR_DIR: 1106051088, // 010173200020 = drwxr-xr-x = (((S_IFDIR | 0755) << 16) | S_DOS_D)
+ EXT_FILE_ATTR_FILE: 2175008800, // 020151000040 = -rw-r--r-- = (((S_IFREG | 0644) << 16) | S_DOS_A) >>> 0
-function getEnumerableOwnPropertySymbols(target) {
- return Object.getOwnPropertySymbols
- ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
- return Object.propertyIsEnumerable.call(target, symbol)
- })
- : []
-}
+ // Unix file types
+ S_IFMT: 61440, // 0170000 type of file mask
+ S_IFIFO: 4096, // 010000 named pipe (fifo)
+ S_IFCHR: 8192, // 020000 character special
+ S_IFDIR: 16384, // 040000 directory
+ S_IFBLK: 24576, // 060000 block special
+ S_IFREG: 32768, // 0100000 regular
+ S_IFLNK: 40960, // 0120000 symbolic link
+ S_IFSOCK: 49152, // 0140000 socket
-function getKeys(target) {
- return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))
-}
+ // DOS file type flags
+ S_DOS_A: 32, // 040 Archive
+ S_DOS_D: 16, // 020 Directory
+ S_DOS_V: 8, // 010 Volume
+ S_DOS_S: 4, // 04 System
+ S_DOS_H: 2, // 02 Hidden
+ S_DOS_R: 1 // 01 Read Only
+};
-function propertyIsOnObject(object, property) {
- try {
- return property in object
- } catch(_) {
- return false
- }
-}
-// Protects from prototype poisoning and unexpected merging up the prototype chain.
-function propertyIsUnsafe(target, key) {
- return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,
- && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,
- && Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.
-}
+/***/ }),
-function mergeObject(target, source, options) {
- var destination = {};
- if (options.isMergeableObject(target)) {
- getKeys(target).forEach(function(key) {
- destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
- });
- }
- getKeys(source).forEach(function(key) {
- if (propertyIsUnsafe(target, key)) {
- return
- }
+/***/ 63229:
+/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
- if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
- destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
- } else {
- destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
- }
- });
- return destination
-}
+/**
+ * node-compress-commons
+ *
+ * Copyright (c) 2014 Chris Talkington, contributors.
+ * Licensed under the MIT license.
+ * https://github.com/archiverjs/node-compress-commons/blob/master/LICENSE-MIT
+ */
+var zipUtil = __nccwpck_require__(68682);
-function deepmerge(target, source, options) {
- options = options || {};
- options.arrayMerge = options.arrayMerge || defaultArrayMerge;
- options.isMergeableObject = options.isMergeableObject || isMergeableObject;
- // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()
- // implementations can use it. The caller may not replace it.
- options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
+var DATA_DESCRIPTOR_FLAG = 1 << 3;
+var ENCRYPTION_FLAG = 1 << 0;
+var NUMBER_OF_SHANNON_FANO_TREES_FLAG = 1 << 2;
+var SLIDING_DICTIONARY_SIZE_FLAG = 1 << 1;
+var STRONG_ENCRYPTION_FLAG = 1 << 6;
+var UFT8_NAMES_FLAG = 1 << 11;
- var sourceIsArray = Array.isArray(source);
- var targetIsArray = Array.isArray(target);
- var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
+var GeneralPurposeBit = module.exports = function() {
+ if (!(this instanceof GeneralPurposeBit)) {
+ return new GeneralPurposeBit();
+ }
- if (!sourceAndTargetTypesMatch) {
- return cloneUnlessOtherwiseSpecified(source, options)
- } else if (sourceIsArray) {
- return options.arrayMerge(target, source, options)
- } else {
- return mergeObject(target, source, options)
- }
-}
+ this.descriptor = false;
+ this.encryption = false;
+ this.utf8 = false;
+ this.numberOfShannonFanoTrees = 0;
+ this.strongEncryption = false;
+ this.slidingDictionarySize = 0;
-deepmerge.all = function deepmergeAll(array, options) {
- if (!Array.isArray(array)) {
- throw new Error('first argument should be an array')
- }
+ return this;
+};
- return array.reduce(function(prev, next) {
- return deepmerge(prev, next, options)
- }, {})
+GeneralPurposeBit.prototype.encode = function() {
+ return zipUtil.getShortBytes(
+ (this.descriptor ? DATA_DESCRIPTOR_FLAG : 0) |
+ (this.utf8 ? UFT8_NAMES_FLAG : 0) |
+ (this.encryption ? ENCRYPTION_FLAG : 0) |
+ (this.strongEncryption ? STRONG_ENCRYPTION_FLAG : 0)
+ );
};
-var deepmerge_1 = deepmerge;
+GeneralPurposeBit.prototype.parse = function(buf, offset) {
+ var flag = zipUtil.getShortBytesValue(buf, offset);
+ var gbp = new GeneralPurposeBit();
-module.exports = deepmerge_1;
+ gbp.useDataDescriptor((flag & DATA_DESCRIPTOR_FLAG) !== 0);
+ gbp.useUTF8ForNames((flag & UFT8_NAMES_FLAG) !== 0);
+ gbp.useStrongEncryption((flag & STRONG_ENCRYPTION_FLAG) !== 0);
+ gbp.useEncryption((flag & ENCRYPTION_FLAG) !== 0);
+ gbp.setSlidingDictionarySize((flag & SLIDING_DICTIONARY_SIZE_FLAG) !== 0 ? 8192 : 4096);
+ gbp.setNumberOfShannonFanoTrees((flag & NUMBER_OF_SHANNON_FANO_TREES_FLAG) !== 0 ? 3 : 2);
+ return gbp;
+};
-/***/ }),
+GeneralPurposeBit.prototype.setNumberOfShannonFanoTrees = function(n) {
+ this.numberOfShannonFanoTrees = n;
+};
-/***/ 58932:
-/***/ ((__unused_webpack_module, exports) => {
+GeneralPurposeBit.prototype.getNumberOfShannonFanoTrees = function() {
+ return this.numberOfShannonFanoTrees;
+};
-"use strict";
+GeneralPurposeBit.prototype.setSlidingDictionarySize = function(n) {
+ this.slidingDictionarySize = n;
+};
+GeneralPurposeBit.prototype.getSlidingDictionarySize = function() {
+ return this.slidingDictionarySize;
+};
-Object.defineProperty(exports, "__esModule", ({ value: true }));
+GeneralPurposeBit.prototype.useDataDescriptor = function(b) {
+ this.descriptor = b;
+};
-class Deprecation extends Error {
- constructor(message) {
- super(message); // Maintains proper stack trace (only available on V8)
+GeneralPurposeBit.prototype.usesDataDescriptor = function() {
+ return this.descriptor;
+};
- /* istanbul ignore next */
+GeneralPurposeBit.prototype.useEncryption = function(b) {
+ this.encryption = b;
+};
- if (Error.captureStackTrace) {
- Error.captureStackTrace(this, this.constructor);
- }
+GeneralPurposeBit.prototype.usesEncryption = function() {
+ return this.encryption;
+};
- this.name = 'Deprecation';
- }
+GeneralPurposeBit.prototype.useStrongEncryption = function(b) {
+ this.strongEncryption = b;
+};
-}
+GeneralPurposeBit.prototype.usesStrongEncryption = function() {
+ return this.strongEncryption;
+};
-exports.Deprecation = Deprecation;
+GeneralPurposeBit.prototype.useUTF8ForNames = function(b) {
+ this.utf8 = b;
+};
+GeneralPurposeBit.prototype.usesUTF8ForNames = function() {
+ return this.utf8;
+};
/***/ }),
-/***/ 3194:
+/***/ 70713:
/***/ ((module) => {
-"use strict";
+/**
+ * node-compress-commons
+ *
+ * Copyright (c) 2014 Chris Talkington, contributors.
+ * Licensed under the MIT license.
+ * https://github.com/archiverjs/node-compress-commons/blob/master/LICENSE-MIT
+ */
+module.exports = {
+ /**
+ * Bits used for permissions (and sticky bit)
+ */
+ PERM_MASK: 4095, // 07777
+ /**
+ * Bits used to indicate the filesystem object type.
+ */
+ FILE_TYPE_FLAG: 61440, // 0170000
-module.exports = {
- 'html': '',
- 'xml': '',
- 'transitional': '',
- 'strict': '',
- 'frameset': '',
- '1.1': '',
- 'basic': '',
- 'mobile': '',
- 'plist': ''
-};
+ /**
+ * Indicates symbolic links.
+ */
+ LINK_FLAG: 40960, // 0120000
+
+ /**
+ * Indicates plain files.
+ */
+ FILE_FLAG: 32768, // 0100000
+
+ /**
+ * Indicates directories.
+ */
+ DIR_FLAG: 16384, // 040000
+ // ----------------------------------------------------------
+ // somewhat arbitrary choices that are quite common for shared
+ // installations
+ // -----------------------------------------------------------
+
+ /**
+ * Default permissions for symbolic links.
+ */
+ DEFAULT_LINK_PERM: 511, // 0777
+
+ /**
+ * Default permissions for directories.
+ */
+ DEFAULT_DIR_PERM: 493, // 0755
+
+ /**
+ * Default permissions for plain files.
+ */
+ DEFAULT_FILE_PERM: 420 // 0644
+};
/***/ }),
-/***/ 13598:
+/***/ 68682:
/***/ ((module) => {
-"use strict";
+/**
+ * node-compress-commons
+ *
+ * Copyright (c) 2014 Chris Talkington, contributors.
+ * Licensed under the MIT license.
+ * https://github.com/archiverjs/node-compress-commons/blob/master/LICENSE-MIT
+ */
+var util = module.exports = {};
+util.dateToDos = function(d, forceLocalTime) {
+ forceLocalTime = forceLocalTime || false;
-function _process (v, mod) {
- var i
- var r
+ var year = forceLocalTime ? d.getFullYear() : d.getUTCFullYear();
- if (typeof mod === 'function') {
- r = mod(v)
- if (r !== undefined) {
- v = r
- }
- } else if (Array.isArray(mod)) {
- for (i = 0; i < mod.length; i++) {
- r = mod[i](v)
- if (r !== undefined) {
- v = r
- }
- }
+ if (year < 1980) {
+ return 2162688; // 1980-1-1 00:00:00
+ } else if (year >= 2044) {
+ return 2141175677; // 2043-12-31 23:59:58
}
- return v
-}
+ var val = {
+ year: year,
+ month: forceLocalTime ? d.getMonth() : d.getUTCMonth(),
+ date: forceLocalTime ? d.getDate() : d.getUTCDate(),
+ hours: forceLocalTime ? d.getHours() : d.getUTCHours(),
+ minutes: forceLocalTime ? d.getMinutes() : d.getUTCMinutes(),
+ seconds: forceLocalTime ? d.getSeconds() : d.getUTCSeconds()
+ };
-function parseKey (key, val) {
- // detect negative index notation
- if (key[0] === '-' && Array.isArray(val) && /^-\d+$/.test(key)) {
- return val.length + parseInt(key, 10)
- }
- return key
-}
+ return ((val.year - 1980) << 25) | ((val.month + 1) << 21) | (val.date << 16) |
+ (val.hours << 11) | (val.minutes << 5) | (val.seconds / 2);
+};
-function isIndex (k) {
- return /^\d+$/.test(k)
-}
+util.dosToDate = function(dos) {
+ return new Date(((dos >> 25) & 0x7f) + 1980, ((dos >> 21) & 0x0f) - 1, (dos >> 16) & 0x1f, (dos >> 11) & 0x1f, (dos >> 5) & 0x3f, (dos & 0x1f) << 1);
+};
-function isObject (val) {
- return Object.prototype.toString.call(val) === '[object Object]'
-}
+util.fromDosTime = function(buf) {
+ return util.dosToDate(buf.readUInt32LE(0));
+};
-function isArrayOrObject (val) {
- return Object(val) === val
-}
+util.getEightBytes = function(v) {
+ var buf = Buffer.alloc(8);
+ buf.writeUInt32LE(v % 0x0100000000, 0);
+ buf.writeUInt32LE((v / 0x0100000000) | 0, 4);
-function isEmptyObject (val) {
- return Object.keys(val).length === 0
-}
+ return buf;
+};
-var blacklist = ['__proto__', 'prototype', 'constructor']
-var blacklistFilter = function (part) { return blacklist.indexOf(part) === -1 }
+util.getShortBytes = function(v) {
+ var buf = Buffer.alloc(2);
+ buf.writeUInt16LE((v & 0xFFFF) >>> 0, 0);
-function parsePath (path, sep) {
- if (path.indexOf('[') >= 0) {
- path = path.replace(/\[/g, sep).replace(/]/g, '')
- }
+ return buf;
+};
- var parts = path.split(sep)
+util.getShortBytesValue = function(buf, offset) {
+ return buf.readUInt16LE(offset);
+};
- var check = parts.filter(blacklistFilter)
+util.getLongBytes = function(v) {
+ var buf = Buffer.alloc(4);
+ buf.writeUInt32LE((v & 0xFFFFFFFF) >>> 0, 0);
- if (check.length !== parts.length) {
- throw Error('Refusing to update blacklisted property ' + path)
- }
+ return buf;
+};
- return parts
-}
+util.getLongBytesValue = function(buf, offset) {
+ return buf.readUInt32LE(offset);
+};
-var hasOwnProperty = Object.prototype.hasOwnProperty
+util.toDosTime = function(d) {
+ return util.getLongBytes(util.dateToDos(d));
+};
-function DotObject (separator, override, useArray, useBrackets) {
- if (!(this instanceof DotObject)) {
- return new DotObject(separator, override, useArray, useBrackets)
- }
+/***/ }),
- if (typeof override === 'undefined') override = false
- if (typeof useArray === 'undefined') useArray = true
- if (typeof useBrackets === 'undefined') useBrackets = true
- this.separator = separator || '.'
- this.override = override
- this.useArray = useArray
- this.useBrackets = useBrackets
- this.keepArray = false
+/***/ 3179:
+/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
- // contains touched arrays
- this.cleanup = []
-}
+/**
+ * node-compress-commons
+ *
+ * Copyright (c) 2014 Chris Talkington, contributors.
+ * Licensed under the MIT license.
+ * https://github.com/archiverjs/node-compress-commons/blob/master/LICENSE-MIT
+ */
+var inherits = (__nccwpck_require__(73837).inherits);
+var normalizePath = __nccwpck_require__(55388);
-var dotDefault = new DotObject('.', false, true, true)
-function wrap (method) {
- return function () {
- return dotDefault[method].apply(dotDefault, arguments)
- }
-}
+var ArchiveEntry = __nccwpck_require__(92240);
+var GeneralPurposeBit = __nccwpck_require__(63229);
+var UnixStat = __nccwpck_require__(70713);
-DotObject.prototype._fill = function (a, obj, v, mod) {
- var k = a.shift()
+var constants = __nccwpck_require__(11704);
+var zipUtil = __nccwpck_require__(68682);
- if (a.length > 0) {
- obj[k] = obj[k] || (this.useArray && isIndex(a[0]) ? [] : {})
+var ZipArchiveEntry = module.exports = function(name) {
+ if (!(this instanceof ZipArchiveEntry)) {
+ return new ZipArchiveEntry(name);
+ }
- if (!isArrayOrObject(obj[k])) {
- if (this.override) {
- obj[k] = {}
- } else {
- if (!(isArrayOrObject(v) && isEmptyObject(v))) {
- throw new Error(
- 'Trying to redefine `' + k + '` which is a ' + typeof obj[k]
- )
- }
+ ArchiveEntry.call(this);
- return
- }
- }
+ this.platform = constants.PLATFORM_FAT;
+ this.method = -1;
- this._fill(a, obj[k], v, mod)
- } else {
- if (!this.override && isArrayOrObject(obj[k]) && !isEmptyObject(obj[k])) {
- if (!(isArrayOrObject(v) && isEmptyObject(v))) {
- throw new Error("Trying to redefine non-empty obj['" + k + "']")
- }
+ this.name = null;
+ this.size = 0;
+ this.csize = 0;
+ this.gpb = new GeneralPurposeBit();
+ this.crc = 0;
+ this.time = -1;
- return
- }
+ this.minver = constants.MIN_VERSION_INITIAL;
+ this.mode = -1;
+ this.extra = null;
+ this.exattr = 0;
+ this.inattr = 0;
+ this.comment = null;
- obj[k] = _process(v, mod)
+ if (name) {
+ this.setName(name);
}
-}
+};
+
+inherits(ZipArchiveEntry, ArchiveEntry);
/**
+ * Returns the extra fields related to the entry.
*
- * Converts an object with dotted-key/value pairs to it's expanded version
+ * @returns {Buffer}
+ */
+ZipArchiveEntry.prototype.getCentralDirectoryExtra = function() {
+ return this.getExtra();
+};
+
+/**
+ * Returns the comment set for the entry.
*
- * Optionally transformed by a set of modifiers.
+ * @returns {string}
+ */
+ZipArchiveEntry.prototype.getComment = function() {
+ return this.comment !== null ? this.comment : '';
+};
+
+/**
+ * Returns the compressed size of the entry.
*
- * Usage:
+ * @returns {number}
+ */
+ZipArchiveEntry.prototype.getCompressedSize = function() {
+ return this.csize;
+};
+
+/**
+ * Returns the CRC32 digest for the entry.
*
- * var row = {
- * 'nr': 200,
- * 'doc.name': ' My Document '
- * }
+ * @returns {number}
+ */
+ZipArchiveEntry.prototype.getCrc = function() {
+ return this.crc;
+};
+
+/**
+ * Returns the external file attributes for the entry.
*
- * var mods = {
- * 'doc.name': [_s.trim, _s.underscored]
- * }
+ * @returns {number}
+ */
+ZipArchiveEntry.prototype.getExternalAttributes = function() {
+ return this.exattr;
+};
+
+/**
+ * Returns the extra fields related to the entry.
*
- * dot.object(row, mods)
+ * @returns {Buffer}
+ */
+ZipArchiveEntry.prototype.getExtra = function() {
+ return this.extra !== null ? this.extra : constants.EMPTY;
+};
+
+/**
+ * Returns the general purpose bits related to the entry.
*
- * @param {Object} obj
- * @param {Object} mods
+ * @returns {GeneralPurposeBit}
*/
-DotObject.prototype.object = function (obj, mods) {
- var self = this
+ZipArchiveEntry.prototype.getGeneralPurposeBit = function() {
+ return this.gpb;
+};
- Object.keys(obj).forEach(function (k) {
- var mod = mods === undefined ? null : mods[k]
- // normalize array notation.
- var ok = parsePath(k, self.separator).join(self.separator)
+/**
+ * Returns the internal file attributes for the entry.
+ *
+ * @returns {number}
+ */
+ZipArchiveEntry.prototype.getInternalAttributes = function() {
+ return this.inattr;
+};
- if (ok.indexOf(self.separator) !== -1) {
- self._fill(ok.split(self.separator), obj, obj[k], mod)
- delete obj[k]
- } else {
- obj[k] = _process(obj[k], mod)
- }
- })
+/**
+ * Returns the last modified date of the entry.
+ *
+ * @returns {number}
+ */
+ZipArchiveEntry.prototype.getLastModifiedDate = function() {
+ return this.getTime();
+};
- return obj
-}
+/**
+ * Returns the extra fields related to the entry.
+ *
+ * @returns {Buffer}
+ */
+ZipArchiveEntry.prototype.getLocalFileDataExtra = function() {
+ return this.getExtra();
+};
/**
- * @param {String} path dotted path
- * @param {String} v value to be set
- * @param {Object} obj object to be modified
- * @param {Function|Array} mod optional modifier
+ * Returns the compression method used on the entry.
+ *
+ * @returns {number}
*/
-DotObject.prototype.str = function (path, v, obj, mod) {
- var ok = parsePath(path, this.separator).join(this.separator)
+ZipArchiveEntry.prototype.getMethod = function() {
+ return this.method;
+};
- if (path.indexOf(this.separator) !== -1) {
- this._fill(ok.split(this.separator), obj, v, mod)
- } else {
- obj[path] = _process(v, mod)
- }
+/**
+ * Returns the filename of the entry.
+ *
+ * @returns {string}
+ */
+ZipArchiveEntry.prototype.getName = function() {
+ return this.name;
+};
- return obj
-}
+/**
+ * Returns the platform on which the entry was made.
+ *
+ * @returns {number}
+ */
+ZipArchiveEntry.prototype.getPlatform = function() {
+ return this.platform;
+};
/**
+ * Returns the size of the entry.
*
- * Pick a value from an object using dot notation.
+ * @returns {number}
+ */
+ZipArchiveEntry.prototype.getSize = function() {
+ return this.size;
+};
+
+/**
+ * Returns a date object representing the last modified date of the entry.
*
- * Optionally remove the value
+ * @returns {number|Date}
+ */
+ZipArchiveEntry.prototype.getTime = function() {
+ return this.time !== -1 ? zipUtil.dosToDate(this.time) : -1;
+};
+
+/**
+ * Returns the DOS timestamp for the entry.
*
- * @param {String} path
- * @param {Object} obj
- * @param {Boolean} remove
+ * @returns {number}
*/
-DotObject.prototype.pick = function (path, obj, remove, reindexArray) {
- var i
- var keys
- var val
- var key
- var cp
+ZipArchiveEntry.prototype.getTimeDos = function() {
+ return this.time !== -1 ? this.time : 0;
+};
- keys = parsePath(path, this.separator)
- for (i = 0; i < keys.length; i++) {
- key = parseKey(keys[i], obj)
- if (obj && typeof obj === 'object' && key in obj) {
- if (i === keys.length - 1) {
- if (remove) {
- val = obj[key]
- if (reindexArray && Array.isArray(obj)) {
- obj.splice(key, 1)
- } else {
- delete obj[key]
- }
- if (Array.isArray(obj)) {
- cp = keys.slice(0, -1).join('.')
- if (this.cleanup.indexOf(cp) === -1) {
- this.cleanup.push(cp)
- }
- }
- return val
- } else {
- return obj[key]
- }
- } else {
- obj = obj[key]
- }
- } else {
- return undefined
- }
- }
- if (remove && Array.isArray(obj)) {
- obj = obj.filter(function (n) {
- return n !== undefined
- })
- }
- return obj
-}
/**
+ * Returns the UNIX file permissions for the entry.
*
- * Delete value from an object using dot notation.
+ * @returns {number}
+ */
+ZipArchiveEntry.prototype.getUnixMode = function() {
+ return this.platform !== constants.PLATFORM_UNIX ? 0 : ((this.getExternalAttributes() >> constants.SHORT_SHIFT) & constants.SHORT_MASK);
+};
+
+/**
+ * Returns the version of ZIP needed to extract the entry.
*
- * @param {String} path
- * @param {Object} obj
- * @return {any} The removed value
+ * @returns {number}
*/
-DotObject.prototype.delete = function (path, obj) {
- return this.remove(path, obj, true)
-}
+ZipArchiveEntry.prototype.getVersionNeededToExtract = function() {
+ return this.minver;
+};
/**
+ * Sets the comment of the entry.
*
- * Remove value from an object using dot notation.
+ * @param comment
+ */
+ZipArchiveEntry.prototype.setComment = function(comment) {
+ if (Buffer.byteLength(comment) !== comment.length) {
+ this.getGeneralPurposeBit().useUTF8ForNames(true);
+ }
+
+ this.comment = comment;
+};
+
+/**
+ * Sets the compressed size of the entry.
*
- * Will remove multiple items if path is an array.
- * In this case array indexes will be retained until all
- * removals have been processed.
+ * @param size
+ */
+ZipArchiveEntry.prototype.setCompressedSize = function(size) {
+ if (size < 0) {
+ throw new Error('invalid entry compressed size');
+ }
+
+ this.csize = size;
+};
+
+/**
+ * Sets the checksum of the entry.
*
- * Use dot.delete() to automatically re-index arrays.
+ * @param crc
+ */
+ZipArchiveEntry.prototype.setCrc = function(crc) {
+ if (crc < 0) {
+ throw new Error('invalid entry crc32');
+ }
+
+ this.crc = crc;
+};
+
+/**
+ * Sets the external file attributes of the entry.
*
- * @param {String|Array} path
- * @param {Object} obj
- * @param {Boolean} reindexArray
- * @return {any} The removed value
+ * @param attr
*/
-DotObject.prototype.remove = function (path, obj, reindexArray) {
- var i
+ZipArchiveEntry.prototype.setExternalAttributes = function(attr) {
+ this.exattr = attr >>> 0;
+};
- this.cleanup = []
- if (Array.isArray(path)) {
- for (i = 0; i < path.length; i++) {
- this.pick(path[i], obj, true, reindexArray)
- }
- if (!reindexArray) {
- this._cleanup(obj)
- }
- return obj
- } else {
- return this.pick(path, obj, true, reindexArray)
- }
-}
+/**
+ * Sets the extra fields related to the entry.
+ *
+ * @param extra
+ */
+ZipArchiveEntry.prototype.setExtra = function(extra) {
+ this.extra = extra;
+};
-DotObject.prototype._cleanup = function (obj) {
- var ret
- var i
- var keys
- var root
- if (this.cleanup.length) {
- for (i = 0; i < this.cleanup.length; i++) {
- keys = this.cleanup[i].split('.')
- root = keys.splice(0, -1).join('.')
- ret = root ? this.pick(root, obj) : obj
- ret = ret[keys[0]].filter(function (v) {
- return v !== undefined
- })
- this.set(this.cleanup[i], ret, obj)
- }
- this.cleanup = []
+/**
+ * Sets the general purpose bits related to the entry.
+ *
+ * @param gpb
+ */
+ZipArchiveEntry.prototype.setGeneralPurposeBit = function(gpb) {
+ if (!(gpb instanceof GeneralPurposeBit)) {
+ throw new Error('invalid entry GeneralPurposeBit');
}
-}
+
+ this.gpb = gpb;
+};
/**
- * Alias method for `dot.remove`
- *
- * Note: this is not an alias for dot.delete()
+ * Sets the internal file attributes of the entry.
*
- * @param {String|Array} path
- * @param {Object} obj
- * @param {Boolean} reindexArray
- * @return {any} The removed value
+ * @param attr
*/
-DotObject.prototype.del = DotObject.prototype.remove
+ZipArchiveEntry.prototype.setInternalAttributes = function(attr) {
+ this.inattr = attr;
+};
/**
+ * Sets the compression method of the entry.
*
- * Move a property from one place to the other.
- *
- * If the source path does not exist (undefined)
- * the target property will not be set.
- *
- * @param {String} source
- * @param {String} target
- * @param {Object} obj
- * @param {Function|Array} mods
- * @param {Boolean} merge
+ * @param method
*/
-DotObject.prototype.move = function (source, target, obj, mods, merge) {
- if (typeof mods === 'function' || Array.isArray(mods)) {
- this.set(target, _process(this.pick(source, obj, true), mods), obj, merge)
- } else {
- merge = mods
- this.set(target, this.pick(source, obj, true), obj, merge)
+ZipArchiveEntry.prototype.setMethod = function(method) {
+ if (method < 0) {
+ throw new Error('invalid entry compression method');
}
- return obj
-}
+ this.method = method;
+};
/**
+ * Sets the name of the entry.
*
- * Transfer a property from one object to another object.
- *
- * If the source path does not exist (undefined)
- * the property on the other object will not be set.
- *
- * @param {String} source
- * @param {String} target
- * @param {Object} obj1
- * @param {Object} obj2
- * @param {Function|Array} mods
- * @param {Boolean} merge
+ * @param name
+ * @param prependSlash
*/
-DotObject.prototype.transfer = function (
- source,
- target,
- obj1,
- obj2,
- mods,
- merge
-) {
- if (typeof mods === 'function' || Array.isArray(mods)) {
- this.set(
- target,
- _process(this.pick(source, obj1, true), mods),
- obj2,
- merge
- )
- } else {
- merge = mods
- this.set(target, this.pick(source, obj1, true), obj2, merge)
+ZipArchiveEntry.prototype.setName = function(name, prependSlash = false) {
+ name = normalizePath(name, false)
+ .replace(/^\w+:/, '')
+ .replace(/^(\.\.\/|\/)+/, '');
+
+ if (prependSlash) {
+ name = `/${name}`;
}
- return obj2
-}
+ if (Buffer.byteLength(name) !== name.length) {
+ this.getGeneralPurposeBit().useUTF8ForNames(true);
+ }
+
+ this.name = name;
+};
/**
+ * Sets the platform on which the entry was made.
*
- * Copy a property from one object to another object.
- *
- * If the source path does not exist (undefined)
- * the property on the other object will not be set.
+ * @param platform
+ */
+ZipArchiveEntry.prototype.setPlatform = function(platform) {
+ this.platform = platform;
+};
+
+/**
+ * Sets the size of the entry.
*
- * @param {String} source
- * @param {String} target
- * @param {Object} obj1
- * @param {Object} obj2
- * @param {Function|Array} mods
- * @param {Boolean} merge
+ * @param size
*/
-DotObject.prototype.copy = function (source, target, obj1, obj2, mods, merge) {
- if (typeof mods === 'function' || Array.isArray(mods)) {
- this.set(
- target,
- _process(
- // clone what is picked
- JSON.parse(JSON.stringify(this.pick(source, obj1, false))),
- mods
- ),
- obj2,
- merge
- )
- } else {
- merge = mods
- this.set(target, this.pick(source, obj1, false), obj2, merge)
+ZipArchiveEntry.prototype.setSize = function(size) {
+ if (size < 0) {
+ throw new Error('invalid entry size');
}
- return obj2
-}
+ this.size = size;
+};
/**
+ * Sets the time of the entry.
*
- * Set a property on an object using dot notation.
- *
- * @param {String} path
- * @param {any} val
- * @param {Object} obj
- * @param {Boolean} merge
+ * @param time
+ * @param forceLocalTime
*/
-DotObject.prototype.set = function (path, val, obj, merge) {
- var i
- var k
- var keys
- var key
-
- // Do not operate if the value is undefined.
- if (typeof val === 'undefined') {
- return obj
+ZipArchiveEntry.prototype.setTime = function(time, forceLocalTime) {
+ if (!(time instanceof Date)) {
+ throw new Error('invalid entry time');
}
- keys = parsePath(path, this.separator)
- for (i = 0; i < keys.length; i++) {
- key = keys[i]
- if (i === keys.length - 1) {
- if (merge && isObject(val) && isObject(obj[key])) {
- for (k in val) {
- if (hasOwnProperty.call(val, k)) {
- obj[key][k] = val[k]
- }
- }
- } else if (merge && Array.isArray(obj[key]) && Array.isArray(val)) {
- for (var j = 0; j < val.length; j++) {
- obj[keys[i]].push(val[j])
- }
- } else {
- obj[key] = val
- }
- } else if (
- // force the value to be an object
- !hasOwnProperty.call(obj, key) ||
- (!isObject(obj[key]) && !Array.isArray(obj[key]))
- ) {
- // initialize as array if next key is numeric
- if (/^\d+$/.test(keys[i + 1])) {
- obj[key] = []
- } else {
- obj[key] = {}
- }
- }
- obj = obj[key]
- }
- return obj
-}
+ this.time = zipUtil.dateToDos(time, forceLocalTime);
+};
/**
+ * Sets the UNIX file permissions for the entry.
*
- * Transform an object
- *
- * Usage:
- *
- * var obj = {
- * "id": 1,
- * "some": {
- * "thing": "else"
- * }
- * }
- *
- * var transform = {
- * "id": "nr",
- * "some.thing": "name"
- * }
- *
- * var tgt = dot.transform(transform, obj)
- *
- * @param {Object} recipe Transform recipe
- * @param {Object} obj Object to be transformed
- * @param {Array} mods modifiers for the target
+ * @param mode
*/
-DotObject.prototype.transform = function (recipe, obj, tgt) {
- obj = obj || {}
- tgt = tgt || {}
- Object.keys(recipe).forEach(
- function (key) {
- this.set(recipe[key], this.pick(key, obj), tgt)
- }.bind(this)
- )
- return tgt
-}
+ZipArchiveEntry.prototype.setUnixMode = function(mode) {
+ mode |= this.isDirectory() ? constants.S_IFDIR : constants.S_IFREG;
+
+ var extattr = 0;
+ extattr |= (mode << constants.SHORT_SHIFT) | (this.isDirectory() ? constants.S_DOS_D : constants.S_DOS_A);
+
+ this.setExternalAttributes(extattr);
+ this.mode = mode & constants.MODE_MASK;
+ this.platform = constants.PLATFORM_UNIX;
+};
/**
+ * Sets the version of ZIP needed to extract this entry.
*
- * Convert object to dotted-key/value pair
- *
- * Usage:
+ * @param minver
+ */
+ZipArchiveEntry.prototype.setVersionNeededToExtract = function(minver) {
+ this.minver = minver;
+};
+
+/**
+ * Returns true if this entry represents a directory.
*
- * var tgt = dot.dot(obj)
+ * @returns {boolean}
+ */
+ZipArchiveEntry.prototype.isDirectory = function() {
+ return this.getName().slice(-1) === '/';
+};
+
+/**
+ * Returns true if this entry represents a unix symlink,
+ * in which case the entry's content contains the target path
+ * for the symlink.
*
- * or
+ * @returns {boolean}
+ */
+ZipArchiveEntry.prototype.isUnixSymlink = function() {
+ return (this.getUnixMode() & UnixStat.FILE_TYPE_FLAG) === UnixStat.LINK_FLAG;
+};
+
+/**
+ * Returns true if this entry is using the ZIP64 extension of ZIP.
*
- * var tgt = {}
- * dot.dot(obj, tgt)
+ * @returns {boolean}
+ */
+ZipArchiveEntry.prototype.isZip64 = function() {
+ return this.csize > constants.ZIP64_MAGIC || this.size > constants.ZIP64_MAGIC;
+};
+
+
+/***/ }),
+
+/***/ 44432:
+/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
+
+/**
+ * node-compress-commons
*
- * @param {Object} obj source object
- * @param {Object} tgt target object
- * @param {Array} path path array (internal)
+ * Copyright (c) 2014 Chris Talkington, contributors.
+ * Licensed under the MIT license.
+ * https://github.com/archiverjs/node-compress-commons/blob/master/LICENSE-MIT
*/
-DotObject.prototype.dot = function (obj, tgt, path) {
- tgt = tgt || {}
- path = path || []
- var isArray = Array.isArray(obj)
+var inherits = (__nccwpck_require__(73837).inherits);
+var crc32 = __nccwpck_require__(83201);
+var {CRC32Stream} = __nccwpck_require__(5101);
+var {DeflateCRC32Stream} = __nccwpck_require__(5101);
- Object.keys(obj).forEach(
- function (key) {
- var index = isArray && this.useBrackets ? '[' + key + ']' : key
- if (
- isArrayOrObject(obj[key]) &&
- ((isObject(obj[key]) && !isEmptyObject(obj[key])) ||
- (Array.isArray(obj[key]) && !this.keepArray && obj[key].length !== 0))
- ) {
- if (isArray && this.useBrackets) {
- var previousKey = path[path.length - 1] || ''
- return this.dot(
- obj[key],
- tgt,
- path.slice(0, -1).concat(previousKey + index)
- )
- } else {
- return this.dot(obj[key], tgt, path.concat(index))
- }
- } else {
- if (isArray && this.useBrackets) {
- tgt[path.join(this.separator).concat('[' + key + ']')] = obj[key]
- } else {
- tgt[path.concat(index).join(this.separator)] = obj[key]
- }
- }
- }.bind(this)
- )
- return tgt
-}
+var ArchiveOutputStream = __nccwpck_require__(36728);
+var ZipArchiveEntry = __nccwpck_require__(3179);
+var GeneralPurposeBit = __nccwpck_require__(63229);
-DotObject.pick = wrap('pick')
-DotObject.move = wrap('move')
-DotObject.transfer = wrap('transfer')
-DotObject.transform = wrap('transform')
-DotObject.copy = wrap('copy')
-DotObject.object = wrap('object')
-DotObject.str = wrap('str')
-DotObject.set = wrap('set')
-DotObject.delete = wrap('delete')
-DotObject.del = DotObject.remove = wrap('remove')
-DotObject.dot = wrap('dot');
-['override', 'overwrite'].forEach(function (prop) {
- Object.defineProperty(DotObject, prop, {
- get: function () {
- return dotDefault.override
- },
- set: function (val) {
- dotDefault.override = !!val
- }
- })
-});
-['useArray', 'keepArray', 'useBrackets'].forEach(function (prop) {
- Object.defineProperty(DotObject, prop, {
- get: function () {
- return dotDefault[prop]
- },
- set: function (val) {
- dotDefault[prop] = val
- }
- })
-})
+var constants = __nccwpck_require__(11704);
+var util = __nccwpck_require__(95208);
+var zipUtil = __nccwpck_require__(68682);
-DotObject._process = _process
+var ZipArchiveOutputStream = module.exports = function(options) {
+ if (!(this instanceof ZipArchiveOutputStream)) {
+ return new ZipArchiveOutputStream(options);
+ }
-module.exports = DotObject
+ options = this.options = this._defaults(options);
+ ArchiveOutputStream.call(this, options);
-/***/ }),
+ this._entry = null;
+ this._entries = [];
+ this._archive = {
+ centralLength: 0,
+ centralOffset: 0,
+ comment: '',
+ finish: false,
+ finished: false,
+ processing: false,
+ forceZip64: options.forceZip64,
+ forceLocalTime: options.forceLocalTime
+ };
+};
-/***/ 18212:
-/***/ ((module) => {
+inherits(ZipArchiveOutputStream, ArchiveOutputStream);
-"use strict";
+ZipArchiveOutputStream.prototype._afterAppend = function(ae) {
+ this._entries.push(ae);
+ if (ae.getGeneralPurposeBit().usesDataDescriptor()) {
+ this._writeDataDescriptor(ae);
+ }
-module.exports = function () {
- // https://mths.be/emoji
- return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
+ this._archive.processing = false;
+ this._entry = null;
+
+ if (this._archive.finish && !this._archive.finished) {
+ this._finish();
+ }
};
+ZipArchiveOutputStream.prototype._appendBuffer = function(ae, source, callback) {
+ if (source.length === 0) {
+ ae.setMethod(constants.METHOD_STORED);
+ }
-/***/ }),
+ var method = ae.getMethod();
-/***/ 81205:
-/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
+ if (method === constants.METHOD_STORED) {
+ ae.setSize(source.length);
+ ae.setCompressedSize(source.length);
+ ae.setCrc(crc32.buf(source) >>> 0);
+ }
-var once = __nccwpck_require__(1223);
+ this._writeLocalFileHeader(ae);
-var noop = function() {};
+ if (method === constants.METHOD_STORED) {
+ this.write(source);
+ this._afterAppend(ae);
+ callback(null, ae);
+ return;
+ } else if (method === constants.METHOD_DEFLATED) {
+ this._smartStream(ae, callback).end(source);
+ return;
+ } else {
+ callback(new Error('compression method ' + method + ' not implemented'));
+ return;
+ }
+};
-var isRequest = function(stream) {
- return stream.setHeader && typeof stream.abort === 'function';
+ZipArchiveOutputStream.prototype._appendStream = function(ae, source, callback) {
+ ae.getGeneralPurposeBit().useDataDescriptor(true);
+ ae.setVersionNeededToExtract(constants.MIN_VERSION_DATA_DESCRIPTOR);
+
+ this._writeLocalFileHeader(ae);
+
+ var smart = this._smartStream(ae, callback);
+ source.once('error', function(err) {
+ smart.emit('error', err);
+ smart.end();
+ })
+ source.pipe(smart);
};
-var isChildProcess = function(stream) {
- return stream.stdio && Array.isArray(stream.stdio) && stream.stdio.length === 3
+ZipArchiveOutputStream.prototype._defaults = function(o) {
+ if (typeof o !== 'object') {
+ o = {};
+ }
+
+ if (typeof o.zlib !== 'object') {
+ o.zlib = {};
+ }
+
+ if (typeof o.zlib.level !== 'number') {
+ o.zlib.level = constants.ZLIB_BEST_SPEED;
+ }
+
+ o.forceZip64 = !!o.forceZip64;
+ o.forceLocalTime = !!o.forceLocalTime;
+
+ return o;
};
-var eos = function(stream, opts, callback) {
- if (typeof opts === 'function') return eos(stream, null, opts);
- if (!opts) opts = {};
+ZipArchiveOutputStream.prototype._finish = function() {
+ this._archive.centralOffset = this.offset;
- callback = once(callback || noop);
+ this._entries.forEach(function(ae) {
+ this._writeCentralFileHeader(ae);
+ }.bind(this));
- var ws = stream._writableState;
- var rs = stream._readableState;
- var readable = opts.readable || (opts.readable !== false && stream.readable);
- var writable = opts.writable || (opts.writable !== false && stream.writable);
- var cancelled = false;
+ this._archive.centralLength = this.offset - this._archive.centralOffset;
- var onlegacyfinish = function() {
- if (!stream.writable) onfinish();
- };
+ if (this.isZip64()) {
+ this._writeCentralDirectoryZip64();
+ }
- var onfinish = function() {
- writable = false;
- if (!readable) callback.call(stream);
- };
+ this._writeCentralDirectoryEnd();
- var onend = function() {
- readable = false;
- if (!writable) callback.call(stream);
- };
+ this._archive.processing = false;
+ this._archive.finish = true;
+ this._archive.finished = true;
+ this.end();
+};
- var onexit = function(exitCode) {
- callback.call(stream, exitCode ? new Error('exited with error code: ' + exitCode) : null);
- };
+ZipArchiveOutputStream.prototype._normalizeEntry = function(ae) {
+ if (ae.getMethod() === -1) {
+ ae.setMethod(constants.METHOD_DEFLATED);
+ }
- var onerror = function(err) {
- callback.call(stream, err);
- };
+ if (ae.getMethod() === constants.METHOD_DEFLATED) {
+ ae.getGeneralPurposeBit().useDataDescriptor(true);
+ ae.setVersionNeededToExtract(constants.MIN_VERSION_DATA_DESCRIPTOR);
+ }
- var onclose = function() {
- process.nextTick(onclosenexttick);
- };
+ if (ae.getTime() === -1) {
+ ae.setTime(new Date(), this._archive.forceLocalTime);
+ }
- var onclosenexttick = function() {
- if (cancelled) return;
- if (readable && !(rs && (rs.ended && !rs.destroyed))) return callback.call(stream, new Error('premature close'));
- if (writable && !(ws && (ws.ended && !ws.destroyed))) return callback.call(stream, new Error('premature close'));
- };
+ ae._offsets = {
+ file: 0,
+ data: 0,
+ contents: 0,
+ };
+};
- var onrequest = function() {
- stream.req.on('finish', onfinish);
- };
+ZipArchiveOutputStream.prototype._smartStream = function(ae, callback) {
+ var deflate = ae.getMethod() === constants.METHOD_DEFLATED;
+ var process = deflate ? new DeflateCRC32Stream(this.options.zlib) : new CRC32Stream();
+ var error = null;
- if (isRequest(stream)) {
- stream.on('complete', onfinish);
- stream.on('abort', onclose);
- if (stream.req) onrequest();
- else stream.on('request', onrequest);
- } else if (writable && !ws) { // legacy streams
- stream.on('end', onlegacyfinish);
- stream.on('close', onlegacyfinish);
- }
+ function handleStuff() {
+ var digest = process.digest().readUInt32BE(0);
+ ae.setCrc(digest);
+ ae.setSize(process.size());
+ ae.setCompressedSize(process.size(true));
+ this._afterAppend(ae);
+ callback(error, ae);
+ }
- if (isChildProcess(stream)) stream.on('exit', onexit);
+ process.once('end', handleStuff.bind(this));
+ process.once('error', function(err) {
+ error = err;
+ });
- stream.on('end', onend);
- stream.on('finish', onfinish);
- if (opts.error !== false) stream.on('error', onerror);
- stream.on('close', onclose);
+ process.pipe(this, { end: false });
- return function() {
- cancelled = true;
- 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('exit', onexit);
- stream.removeListener('end', onend);
- stream.removeListener('error', onerror);
- stream.removeListener('close', onclose);
- };
+ return process;
};
-module.exports = eos;
+ZipArchiveOutputStream.prototype._writeCentralDirectoryEnd = function() {
+ var records = this._entries.length;
+ var size = this._archive.centralLength;
+ var offset = this._archive.centralOffset;
+ if (this.isZip64()) {
+ records = constants.ZIP64_MAGIC_SHORT;
+ size = constants.ZIP64_MAGIC;
+ offset = constants.ZIP64_MAGIC;
+ }
-/***/ }),
+ // signature
+ this.write(zipUtil.getLongBytes(constants.SIG_EOCD));
-/***/ 34852:
-/***/ ((module, exports) => {
+ // disk numbers
+ this.write(constants.SHORT_ZERO);
+ this.write(constants.SHORT_ZERO);
-"use strict";
-/**
- * @author Toru Nagashima
- * @copyright 2015 Toru Nagashima. All rights reserved.
- * See LICENSE file in root directory for full license.
- */
+ // number of entries
+ this.write(zipUtil.getShortBytes(records));
+ this.write(zipUtil.getShortBytes(records));
+ // length and location of CD
+ this.write(zipUtil.getLongBytes(size));
+ this.write(zipUtil.getLongBytes(offset));
-Object.defineProperty(exports, "__esModule", ({ value: true }));
+ // archive comment
+ var comment = this.getComment();
+ var commentLength = Buffer.byteLength(comment);
+ this.write(zipUtil.getShortBytes(commentLength));
+ this.write(comment);
+};
-/**
- * @typedef {object} PrivateData
- * @property {EventTarget} eventTarget The event target.
- * @property {{type:string}} event The original event object.
- * @property {number} eventPhase The current event phase.
- * @property {EventTarget|null} currentTarget The current event target.
- * @property {boolean} canceled The flag to prevent default.
- * @property {boolean} stopped The flag to stop propagation.
- * @property {boolean} immediateStopped The flag to stop propagation immediately.
- * @property {Function|null} passiveListener The listener if the current listener is passive. Otherwise this is null.
- * @property {number} timeStamp The unix time.
- * @private
- */
+ZipArchiveOutputStream.prototype._writeCentralDirectoryZip64 = function() {
+ // signature
+ this.write(zipUtil.getLongBytes(constants.SIG_ZIP64_EOCD));
-/**
- * Private data for event wrappers.
- * @type {WeakMap}
- * @private
- */
-const privateData = new WeakMap();
+ // size of the ZIP64 EOCD record
+ this.write(zipUtil.getEightBytes(44));
-/**
- * Cache for wrapper classes.
- * @type {WeakMap